X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffb-limfd.c;h=8370b5eb3ea3f44e3b3f7fc72278915def2727e0;hb=e0a22ab2268f3aab6be7a4cd982087429e9cf976;hp=745445a2bad9f6d35a982465d59d2332355ba51b;hpb=49edfa12025a3552d1cfcd2a936201c1da95148a;p=libucw.git diff --git a/lib/fb-limfd.c b/lib/fb-limfd.c index 745445a2..8370b5eb 100644 --- a/lib/fb-limfd.c +++ b/lib/fb-limfd.c @@ -1,8 +1,7 @@ /* - * Sherlock Library -- Fast Buffered Input on Limited File Descriptors + * UCW Library -- Fast Buffered Input on Limited File Descriptors * - * (c) 2003 Martin Mares - * (c) 2004 Robert Spalek + * (c) 2003--2004 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -20,15 +19,16 @@ struct fb_limfd { int limit; }; #define FB_LIMFD(f) ((struct fb_limfd *)(f)->is_fastbuf) +#define FB_BUFFER(f) (byte *)(FB_LIMFD(f) + 1) static int bfl_refill(struct fastbuf *f) { + f->bptr = f->buffer = FB_BUFFER(f); int max = MIN(FB_LIMFD(f)->limit - f->pos, f->bufend - f->buffer); int l = read(FB_LIMFD(f)->fd, f->buffer, max); if (l < 0) die("Error reading %s: %m", f->name); - f->bptr = f->buffer; f->bstop = f->buffer + l; f->pos += l; return l;