From 6c8e652aa6b5bf7018ff74473a6ef5bb58e4890e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 16 Jul 2001 17:24:48 -0300 Subject: [PATCH] use macros for 'getc' --- ldo.c | 4 ++-- liolib.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ldo.c b/ldo.c index 874a22b8..ceda04d9 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.136 2001/06/08 19:00:57 roberto Exp roberto $ +** $Id: ldo.c,v 1.137 2001/07/12 19:34:03 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -243,7 +243,7 @@ LUA_API int lua_loadfile (lua_State *L, const l_char *filename) { int nlevel; /* level on the stack of filename */ FILE *f = (filename == NULL) ? stdin : fopen(filename, l_s("r")); if (f == NULL) return LUA_ERRFILE; /* unable to open file */ - bin = (ungetc(fgetc(f), f) == LUA_SIGNATURE[0]); + bin = (ungetc(getc(f), f) == LUA_SIGNATURE[0]); if (bin && f != stdin) { fclose(f); f = fopen(filename, l_s("rb")); /* reopen in binary mode */ diff --git a/liolib.c b/liolib.c index 81d3e05b..942e9388 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 1.118 2001/07/12 14:59:14 roberto Exp roberto $ +** $Id: liolib.c,v 1.119 2001/07/12 18:11:58 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -237,7 +237,7 @@ static int read_until (lua_State *L, FILE *f, const l_char *p, int pl) { luaL_buffinit(L, &b); prep_read_until(next, p, pl); j = 0; - while ((c = fgetc(f)) != EOF) { + while ((c = getc(f)) != EOF) { NoRead: if (c == p[j]) { j++; /* go to next char in pattern */ @@ -272,7 +272,7 @@ static int read_number (lua_State *L, FILE *f) { static int test_eof (lua_State *L, FILE *f) { - l_charint c = fgetc(f); + l_charint c = getc(f); ungetc(c, f); lua_pushlstring(L, NULL, 0); return (c != EOF);