mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
Move line-buffing machinery to ports.c
* libguile/ports.c (scm_lfwrite_unlocked): * libguile/fports.c (fport_write): Move line-buffering from fport_write to scm_lfwrite_unlocked.
This commit is contained in:
parent
59a18451b8
commit
4eb9fd47c4
2 changed files with 7 additions and 13 deletions
|
@ -784,10 +784,6 @@ fport_write (SCM port, const void *data, size_t size)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* handle line buffering. */
|
||||
if ((SCM_CELL_WORD_0 (port) & SCM_BUFLINE) && memchr (data, '\n', size))
|
||||
fport_flush (port);
|
||||
}
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
|
|
@ -2753,23 +2753,21 @@ scm_c_write (SCM port, const void *ptr, size_t size)
|
|||
/* scm_lfwrite
|
||||
*
|
||||
* This function differs from scm_c_write; it updates port line and
|
||||
* column. */
|
||||
* column, flushing line-buffered ports when appropriate. */
|
||||
void
|
||||
scm_lfwrite_unlocked (const char *ptr, size_t size, SCM port)
|
||||
{
|
||||
scm_t_port *pt = SCM_PTAB_ENTRY (port);
|
||||
scm_t_ptob_descriptor *ptob = SCM_PORT_DESCRIPTOR (port);
|
||||
int saved_line;
|
||||
|
||||
if (pt->rw_active == SCM_PORT_READ)
|
||||
scm_end_input_unlocked (port);
|
||||
|
||||
ptob->write (port, ptr, size);
|
||||
scm_c_write_unlocked (port, ptr, size);
|
||||
|
||||
saved_line = SCM_LINUM (port);
|
||||
for (; size; ptr++, size--)
|
||||
update_port_lf ((scm_t_wchar) (unsigned char) *ptr, port);
|
||||
|
||||
if (pt->rw_random)
|
||||
pt->rw_active = SCM_PORT_WRITE;
|
||||
/* Handle line buffering. */
|
||||
if ((SCM_CELL_WORD_0 (port) & SCM_BUFLINE) && saved_line != SCM_LINUM (port))
|
||||
scm_flush_unlocked (port);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue