diff options
-rw-r--r-- | libguile/ChangeLog | 4 | ||||
-rw-r--r-- | libguile/ports.c | 10 | ||||
-rw-r--r-- | libguile/strports.c | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index d4f91408e..0c0c8042f 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,5 +1,7 @@ +2002-08-04 Han-Wen <hanwen@cs.uu.nl> -2002-08-04 Han-Wen Nienhuys <hanwen@cs.uu.nl> + * ports.c (scm_new_port_table_entry): init port entry to 0 + completely. * ports.c (scm_new_port_table_entry): change function from scm_add_to_port_table. This prevents cells with null-pointers from diff --git a/libguile/ports.c b/libguile/ports.c index 6372e8f67..70f402651 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -457,6 +457,7 @@ scm_new_port_table_entry (void) #define FUNC_NAME "scm_new_port_table_entry" { scm_t_port *entry = (scm_t_port *) scm_gc_malloc (sizeof (scm_t_port), "port"); + memset (entry, 0x0, sizeof (scm_t_port)); if (scm_port_table_size == scm_port_table_room) { @@ -471,15 +472,10 @@ scm_new_port_table_entry (void) entry->port = SCM_EOL; entry->entry = scm_port_table_size; - entry->revealed = 0; - entry->stream = 0; + entry->file_name = SCM_BOOL_F; - entry->line_number = 0; - entry->column_number = 0; - entry->putback_buf = 0; - entry->putback_buf_size = 0; entry->rw_active = SCM_PORT_NEITHER; - entry->rw_random = 0; + scm_port_table[scm_port_table_size] = entry; scm_port_table_size++; diff --git a/libguile/strports.c b/libguile/strports.c index 5c3634314..94aa928f5 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -279,12 +279,14 @@ scm_mkstrport (SCM pos, SCM str, long modes, const char *caller) scm_out_of_range (caller, pos); if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG))) scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL); - z = scm_cell (scm_tc16_strport, 0); + SCM_DEFER_INTS; pt = scm_new_port_table_entry (); - SCM_SET_CELL_TYPE (z, scm_tc16_strport | modes); + z = scm_cell (scm_tc16_strport | modes, 0); + SCM_SETPTAB_ENTRY (z, pt); pt->port = z; + SCM_SETSTREAM (z, SCM_UNPACK (str)); pt->write_buf = pt->read_buf = SCM_STRING_UCHARS (str); |