/[guile]/guile/guile-core/libguile/fports.c
ViewVC logotype

Diff of /guile/guile-core/libguile/fports.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.107 by mvo, Sun Nov 25 15:21:07 2001 UTC revision 1.108 by mvo, Mon Feb 11 18:06:49 2002 UTC
# Line 111  scm_fport_buffer_add (SCM port, long rea Line 111  scm_fport_buffer_add (SCM port, long rea
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      }      }
# Line 123  scm_fport_buffer_add (SCM port, long rea Line 123  scm_fport_buffer_add (SCM port, long rea
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      }      }
# Line 192  SCM_DEFINE (scm_setvbuf, "setvbuf", 2, 1 Line 192  SCM_DEFINE (scm_setvbuf, "setvbuf", 2, 1
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;
# Line 436  scm_fdes_to_port (int fdes, char *mode, Line 443  scm_fdes_to_port (int fdes, char *mode,
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);
# Line 820  fport_close (SCM port) Line 826  fport_close (SCM port)
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    

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.108

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26