reader runs outside core Lua

This commit is contained in:
Roberto Ierusalimschy 2003-08-27 17:57:52 -03:00
parent b114142799
commit 885961be1d
1 changed files with 7 additions and 2 deletions

9
lzio.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lzio.c,v 1.25 2003/08/25 19:51:54 roberto Exp roberto $
** $Id: lzio.c,v 1.26 2003/08/25 20:00:50 roberto Exp roberto $
** a generic input stream interface
** See Copyright Notice in lua.h
*/
@ -13,12 +13,17 @@
#include "llimits.h"
#include "lmem.h"
#include "lstate.h"
#include "lzio.h"
int luaZ_fill (ZIO *z) {
size_t size;
const char *buff = z->reader(z->L, z->data, &size);
lua_State *L = z->L;
const char *buff;
lua_unlock(L);
buff = z->reader(L, z->data, &size);
lua_lock(L);
if (buff == NULL || size == 0) return EOZ;
z->n = size - 1;
z->p = buff;