author | Olivier Brunel
<jjk@jjacky.com> 2023-12-16 21:00:52 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2024-01-01 19:10:12 UTC |
parent | 745bd41aa03612395ef3f0c4f0dc5aab93c290e4 |
src/liblimb/djbunix.h/sa_readmax.c | +3 | -6 |
diff --git a/src/liblimb/djbunix.h/sa_readmax.c b/src/liblimb/djbunix.h/sa_readmax.c index 4c8e804..ce784c7 100644 --- a/src/liblimb/djbunix.h/sa_readmax.c +++ b/src/liblimb/djbunix.h/sa_readmax.c @@ -19,12 +19,9 @@ sa_readmax(stralloc *sa, int fd, size_t max) if (!stralloc_readyplus(sa, n)) break; ssize_t r = fd_read(fd, sa->s + sa->len, n) ; - switch (r) - { - case -1: break; - case 0: return 1; - default: sa->len += r; - } + if (!r) return 1; + else if (r == -1) break; + sa->len += r; } sa->len = salen;