mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-09 05:33:58 -04:00
terminal: comments and cleanup
This commit is contained in:
parent
a326427caf
commit
79945419eb
1 changed files with 9 additions and 0 deletions
|
|
@ -60,6 +60,11 @@ term_to_slave(struct terminal *term, const void *_data, size_t len)
|
||||||
goto enqueue_data;
|
goto enqueue_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try a synchronous write first. If we fail to write everything,
|
||||||
|
* switch to asynchronous.
|
||||||
|
*/
|
||||||
|
|
||||||
switch (to_slave(term, _data, len, &(size_t){0})) {
|
switch (to_slave(term, _data, len, &(size_t){0})) {
|
||||||
case PTMX_WRITE_REMAIN:
|
case PTMX_WRITE_REMAIN:
|
||||||
if (!fdm_event_add(term->fdm, term->ptmx, EPOLLOUT))
|
if (!fdm_event_add(term->fdm, term->ptmx, EPOLLOUT))
|
||||||
|
|
@ -70,6 +75,10 @@ term_to_slave(struct terminal *term, const void *_data, size_t len)
|
||||||
case PTMX_WRITE_ERR: return false;
|
case PTMX_WRITE_ERR: return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Shouldn't get here */
|
||||||
|
assert(false);
|
||||||
|
return false;
|
||||||
|
|
||||||
enqueue_data:
|
enqueue_data:
|
||||||
{
|
{
|
||||||
void *copy = malloc(len);
|
void *copy = malloc(len);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue