aboutsummaryrefslogtreecommitdiff
path: root/lzio.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-03-26 11:31:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-03-26 11:31:49 -0300
commitdd3a63c205a97339d8c8aec3cd49941bc10ba45c (patch)
tree763c1701607ace52692c8566277c6c70c7895acd /lzio.c
parentcb49b088b61b75b905663a58a2c545de1ffea13a (diff)
downloadlua-dd3a63c205a97339d8c8aec3cd49941bc10ba45c.tar.gz
lua-dd3a63c205a97339d8c8aec3cd49941bc10ba45c.tar.bz2
lua-dd3a63c205a97339d8c8aec3cd49941bc10ba45c.zip
new way to handle `profiles'
Diffstat (limited to 'lzio.c')
-rw-r--r--lzio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lzio.c b/lzio.c
index c523ece5..b5892ce0 100644
--- a/lzio.c
+++ b/lzio.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lzio.c,v 1.12 2000/05/24 13:54:49 roberto Exp roberto $ 2** $Id: lzio.c,v 1.13 2000/06/12 13:52:05 roberto Exp roberto $
3** a generic input stream interface 3** a generic input stream interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -9,6 +9,7 @@
9#include <stdio.h> 9#include <stdio.h>
10#include <string.h> 10#include <string.h>
11 11
12#define LUA_PRIVATE
12#include "lua.h" 13#include "lua.h"
13 14
14#include "lzio.h" 15#include "lzio.h"
@@ -71,7 +72,10 @@ size_t zread (ZIO *z, void *b, size_t n) {
71 if (z->n == 0) { 72 if (z->n == 0) {
72 if (z->filbuf(z) == EOZ) 73 if (z->filbuf(z) == EOZ)
73 return n; /* return number of missing bytes */ 74 return n; /* return number of missing bytes */
74 zungetc(z); /* put result from `filbuf' in the buffer */ 75 else {
76 ++z->n; /* filbuf removed first byte; put back it */
77 --z->p;
78 }
75 } 79 }
76 m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 80 m = (n <= z->n) ? n : z->n; /* min. between n and z->n */
77 memcpy(b, z->p, m); 81 memcpy(b, z->p, m);