mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-23 04:50:28 +02:00
init port entry
This commit is contained in:
parent
402788a938
commit
5f16b8973e
3 changed files with 10 additions and 10 deletions
|
@ -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
|
* ports.c (scm_new_port_table_entry): change function from
|
||||||
scm_add_to_port_table. This prevents cells with null-pointers from
|
scm_add_to_port_table. This prevents cells with null-pointers from
|
||||||
|
|
|
@ -457,6 +457,7 @@ scm_new_port_table_entry (void)
|
||||||
#define FUNC_NAME "scm_new_port_table_entry"
|
#define FUNC_NAME "scm_new_port_table_entry"
|
||||||
{
|
{
|
||||||
scm_t_port *entry = (scm_t_port *) scm_gc_malloc (sizeof (scm_t_port), "port");
|
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)
|
if (scm_port_table_size == scm_port_table_room)
|
||||||
{
|
{
|
||||||
|
@ -471,15 +472,10 @@ scm_new_port_table_entry (void)
|
||||||
|
|
||||||
entry->port = SCM_EOL;
|
entry->port = SCM_EOL;
|
||||||
entry->entry = scm_port_table_size;
|
entry->entry = scm_port_table_size;
|
||||||
entry->revealed = 0;
|
|
||||||
entry->stream = 0;
|
|
||||||
entry->file_name = SCM_BOOL_F;
|
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_active = SCM_PORT_NEITHER;
|
||||||
entry->rw_random = 0;
|
|
||||||
|
|
||||||
scm_port_table[scm_port_table_size] = entry;
|
scm_port_table[scm_port_table_size] = entry;
|
||||||
scm_port_table_size++;
|
scm_port_table_size++;
|
||||||
|
|
|
@ -279,12 +279,14 @@ scm_mkstrport (SCM pos, SCM str, long modes, const char *caller)
|
||||||
scm_out_of_range (caller, pos);
|
scm_out_of_range (caller, pos);
|
||||||
if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG)))
|
if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG)))
|
||||||
scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL);
|
scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL);
|
||||||
z = scm_cell (scm_tc16_strport, 0);
|
|
||||||
SCM_DEFER_INTS;
|
SCM_DEFER_INTS;
|
||||||
pt = scm_new_port_table_entry ();
|
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);
|
SCM_SETPTAB_ENTRY (z, pt);
|
||||||
pt->port = z;
|
pt->port = z;
|
||||||
|
|
||||||
|
|
||||||
SCM_SETSTREAM (z, SCM_UNPACK (str));
|
SCM_SETSTREAM (z, SCM_UNPACK (str));
|
||||||
pt->write_buf = pt->read_buf = SCM_STRING_UCHARS (str);
|
pt->write_buf = pt->read_buf = SCM_STRING_UCHARS (str);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue