=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/aucat/aucat.c,v retrieving revision 1.154 retrieving revision 1.155 diff -u -r1.154 -r1.155 --- src/usr.bin/aucat/aucat.c 2016/05/27 15:38:27 1.154 +++ src/usr.bin/aucat/aucat.c 2016/05/27 15:46:41 1.155 @@ -157,14 +157,13 @@ static void slot_flush(struct slot *s) { - int todo, count, n; + int count, n; unsigned char *data; - todo = s->buf.used; - while (todo > 0) { + for (;;) { data = abuf_rgetblk(&s->buf, &count); - if (count > todo) - count = todo; + if (count == 0) + break; n = afile_write(&s->afile, data, count); if (n == 0) { slot_log(s); @@ -173,21 +172,19 @@ return; } abuf_rdiscard(&s->buf, n); - todo -= n; } } static void slot_fill(struct slot *s) { - int todo, count, n; + int count, n; unsigned char *data; - todo = s->buf.len; - while (todo > 0) { + for (;;) { data = abuf_wgetblk(&s->buf, &count); - if (count > todo) - count = todo; + if (count == 0) + break; n = afile_read(&s->afile, data, count); if (n == 0) { #ifdef DEBUG @@ -200,7 +197,6 @@ break; } abuf_wcommit(&s->buf, n); - todo -= n; } }