From dd3a63c205a97339d8c8aec3cd49941bc10ba45c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 26 Mar 2001 11:31:49 -0300 Subject: new way to handle `profiles' --- lzio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lzio.c') diff --git a/lzio.c b/lzio.c index c523ece5..b5892ce0 100644 --- a/lzio.c +++ b/lzio.c @@ -1,5 +1,5 @@ /* -** $Id: lzio.c,v 1.12 2000/05/24 13:54:49 roberto Exp roberto $ +** $Id: lzio.c,v 1.13 2000/06/12 13:52:05 roberto Exp roberto $ ** a generic input stream interface ** See Copyright Notice in lua.h */ @@ -9,6 +9,7 @@ #include #include +#define LUA_PRIVATE #include "lua.h" #include "lzio.h" @@ -71,7 +72,10 @@ size_t zread (ZIO *z, void *b, size_t n) { if (z->n == 0) { if (z->filbuf(z) == EOZ) return n; /* return number of missing bytes */ - zungetc(z); /* put result from `filbuf' in the buffer */ + else { + ++z->n; /* filbuf removed first byte; put back it */ + --z->p; + } } m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ memcpy(b, z->p, m); -- cgit v1.2.3-55-g6feb