home
/
code
/
khatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
69b75a4
)
Blank-out only the remaining slots
author
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 12 Mar 2020 01:13:25 +0000
(21:13 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 12 Mar 2020 01:13:25 +0000
(21:13 -0400)
x5/khatus.c
patch
|
blob
|
blame
|
history
diff --git
a/x5/khatus.c
b/x5/khatus.c
index
2a026dc
..
26e491a
100644
(file)
--- a/
x5/khatus.c
+++ b/
x5/khatus.c
@@
-276,14
+276,14
@@
fifo_read_one(Fifo *f, char *buf)
total = 0;
c = '\0';
b = buf + f->pos;
total = 0;
c = '\0';
b = buf + f->pos;
- /* TODO: Could optimize here and only blank-out the remaining slots. */
- memset(b, ' ', f->width);
while ((current = read(f->fd, &c, 1)) && c != '\n' && c != '\0' && total++ < f->width)
*b++ = c;
if (current == -1) {
error("Failed to read: \"%s\". Error: %s\n", f->name, strerror(errno));
fifo_read_error(f, buf);
while ((current = read(f->fd, &c, 1)) && c != '\n' && c != '\0' && total++ < f->width)
*b++ = c;
if (current == -1) {
error("Failed to read: \"%s\". Error: %s\n", f->name, strerror(errno));
fifo_read_error(f, buf);
- }
+ } else
+ while (total++ < f->width)
+ *b++ = ' ';
/* TODO Record timestamp read */
close(f->fd);
f->fd = -1;
/* TODO Record timestamp read */
close(f->fd);
f->fd = -1;
This page took
0.020106 seconds
and
4
git commands to generate.