{
}
+static size_t
+scm_port_free0 (SCM port)
+{
+ return 0;
+}
+
scm_t_bits
scm_make_port_type (char *name,
int (*fill_input) (SCM port),
scm_ptobs[scm_numptob].name = name;
scm_ptobs[scm_numptob].mark = 0;
- scm_ptobs[scm_numptob].free = scm_free0;
+ scm_ptobs[scm_numptob].free = scm_port_free0;
scm_ptobs[scm_numptob].print = scm_port_print;
scm_ptobs[scm_numptob].equalp = 0;
scm_ptobs[scm_numptob].close = 0;
if (scm_port_table_size == scm_port_table_room)
{
- /* initial malloc is in gc.c. this doesn't use scm_must_malloc etc.,
+ /* initial malloc is in gc.c. this doesn't use scm_gc_malloc etc.,
since it can never be freed during gc. */
- void *newt = realloc ((char *) scm_port_table,
- (size_t) (sizeof (scm_t_port *)
- * scm_port_table_room * 2));
- if (newt == NULL)
- scm_memory_error ("scm_add_to_port_table");
+ void *newt = scm_realloc ((char *) scm_port_table,
+ (size_t) (sizeof (scm_t_port *)
+ * scm_port_table_room * 2));
scm_port_table = (scm_t_port **) newt;
scm_port_table_room *= 2;
}
- entry = (scm_t_port *) scm_must_malloc (sizeof (scm_t_port), FUNC_NAME);
+ entry = (scm_t_port *) scm_gc_malloc (sizeof (scm_t_port), "port");
entry->port = port;
entry->entry = scm_port_table_size;
if (i >= scm_port_table_size)
SCM_MISC_ERROR ("Port not in table: ~S", scm_list_1 (port));
if (p->putback_buf)
- scm_must_free (p->putback_buf);
- scm_must_free (p);
+ scm_gc_free (p->putback_buf, p->putback_buf_size, "putback buffer");
+ scm_gc_free (p, sizeof (scm_t_port), "port");
/* Since we have just freed slot i we can shrink the table by moving
the last entry to that slot... */
if (i < scm_port_table_size - 1)
{
size_t new_size = pt->read_buf_size * 2;
unsigned char *tmp = (unsigned char *)
- scm_must_realloc (pt->putback_buf, pt->read_buf_size, new_size,
- FUNC_NAME);
+ scm_gc_realloc (pt->putback_buf, pt->read_buf_size, new_size,
+ "putback buffer");
pt->read_pos = pt->read_buf = pt->putback_buf = tmp;
pt->read_end = pt->read_buf + pt->read_buf_size;
if (pt->putback_buf == NULL)
{
pt->putback_buf
- = (unsigned char *) scm_must_malloc (SCM_INITIAL_PUTBACK_BUF_SIZE,
- FUNC_NAME);
+ = (unsigned char *) scm_gc_malloc (SCM_INITIAL_PUTBACK_BUF_SIZE,
+ "putback buffer");
pt->putback_buf_size = SCM_INITIAL_PUTBACK_BUF_SIZE;
}