From 502343b40230dfb00efc37bdbaa5c5576f3a5aa5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 17 Dec 1997 18:48:58 -0200 Subject: new scheme for buffers, centralized in auxlib. --- liolib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index 4befcfa6..46c4e87c 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 1.8 1997/11/28 12:40:37 roberto Exp roberto $ +** $Id: liolib.c,v 1.9 1997/12/09 13:50:08 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -190,7 +190,7 @@ static void io_read (void) char *p = luaL_opt_string(arg, "[^\n]*{\n}"); int inskip = 0; /* to control {skips} */ int c = NEED_OTHER; - luaI_emptybuff(); + luaL_resetbuffer(); while (*p) { if (*p == '{') { inskip++; @@ -208,7 +208,7 @@ static void io_read (void) if (c == NEED_OTHER) c = getc(f); m = luaI_singlematch((c == EOF) ? 0 : (char)c, p, &ep); if (m) { - if (inskip == 0) luaI_addchar(c); + if (inskip == 0) luaL_addchar(c); c = NEED_OTHER; } switch (*ep) { @@ -227,7 +227,8 @@ static void io_read (void) } break_while: if (c >= 0) /* not EOF nor NEED_OTHER? */ ungetc(c, f); - buff = luaI_addchar(0); + luaL_addchar(0); + buff = luaL_buffer(); if (*buff != 0 || *p == 0) /* read something or did not fail? */ lua_pushstring(buff); } -- cgit v1.2.3-55-g6feb