111 |
|
|
112 |
if (SCM_INPUT_PORT_P (port) && read_size > 0) |
if (SCM_INPUT_PORT_P (port) && read_size > 0) |
113 |
{ |
{ |
114 |
pt->read_buf = scm_must_malloc (read_size, FUNC_NAME); |
pt->read_buf = scm_gc_malloc (read_size, "port buffer"); |
115 |
pt->read_pos = pt->read_end = pt->read_buf; |
pt->read_pos = pt->read_end = pt->read_buf; |
116 |
pt->read_buf_size = read_size; |
pt->read_buf_size = read_size; |
117 |
} |
} |
123 |
|
|
124 |
if (SCM_OUTPUT_PORT_P (port) && write_size > 0) |
if (SCM_OUTPUT_PORT_P (port) && write_size > 0) |
125 |
{ |
{ |
126 |
pt->write_buf = scm_must_malloc (write_size, FUNC_NAME); |
pt->write_buf = scm_gc_malloc (write_size, "port buffer"); |
127 |
pt->write_pos = pt->write_buf; |
pt->write_pos = pt->write_buf; |
128 |
pt->write_buf_size = write_size; |
pt->write_buf_size = write_size; |
129 |
} |
} |
192 |
|
|
193 |
pt = SCM_PTAB_ENTRY (port); |
pt = SCM_PTAB_ENTRY (port); |
194 |
|
|
195 |
/* silently discards buffered chars. */ |
/* silently discards buffered and put-back chars. */ |
196 |
|
if (pt->read_buf == pt->putback_buf) |
197 |
|
{ |
198 |
|
pt->read_buf = pt->saved_read_buf; |
199 |
|
pt->read_pos = pt->saved_read_pos; |
200 |
|
pt->read_end = pt->saved_read_end; |
201 |
|
pt->read_buf_size = pt->saved_read_buf_size; |
202 |
|
} |
203 |
if (pt->read_buf != &pt->shortbuf) |
if (pt->read_buf != &pt->shortbuf) |
204 |
scm_must_free (pt->read_buf); |
scm_gc_free (pt->read_buf, pt->read_buf_size, "port buffer"); |
205 |
if (pt->write_buf != &pt->shortbuf) |
if (pt->write_buf != &pt->shortbuf) |
206 |
scm_must_free (pt->write_buf); |
scm_gc_free (pt->write_buf, pt->write_buf_size, "port buffer"); |
207 |
|
|
208 |
scm_fport_buffer_add (port, csize, csize); |
scm_fport_buffer_add (port, csize, csize); |
209 |
return SCM_UNSPECIFIED; |
return SCM_UNSPECIFIED; |
443 |
|
|
444 |
{ |
{ |
445 |
scm_t_fport *fp |
scm_t_fport *fp |
446 |
= (scm_t_fport *) scm_must_malloc (sizeof (scm_t_fport), |
= (scm_t_fport *) scm_gc_malloc (sizeof (scm_t_fport), "file port"); |
|
FUNC_NAME); |
|
447 |
|
|
448 |
fp->fdes = fdes; |
fp->fdes = fdes; |
449 |
pt->rw_random = SCM_FDES_RANDOM_P (fdes); |
pt->rw_random = SCM_FDES_RANDOM_P (fdes); |
826 |
if (pt->read_buf == pt->putback_buf) |
if (pt->read_buf == pt->putback_buf) |
827 |
pt->read_buf = pt->saved_read_buf; |
pt->read_buf = pt->saved_read_buf; |
828 |
if (pt->read_buf != &pt->shortbuf) |
if (pt->read_buf != &pt->shortbuf) |
829 |
scm_must_free (pt->read_buf); |
scm_gc_free (pt->read_buf, pt->read_buf_size, "port buffer"); |
830 |
if (pt->write_buf != &pt->shortbuf) |
if (pt->write_buf != &pt->shortbuf) |
831 |
scm_must_free (pt->write_buf); |
scm_gc_free (pt->write_buf, pt->write_buf_size, "port buffer"); |
832 |
scm_must_free ((char *) fp); |
scm_gc_free (fp, sizeof (*fp), "file port"); |
833 |
return rv; |
return rv; |
834 |
} |
} |
835 |
|
|