aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-07-16 17:24:48 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-07-16 17:24:48 -0300
commit6c8e652aa6b5bf7018ff74473a6ef5bb58e4890e (patch)
tree343aabce9645ac52904ebdff4d5ab0727f360296
parent9f25df02d53f6d31d904957bc411ef72d8378dc8 (diff)
downloadlua-6c8e652aa6b5bf7018ff74473a6ef5bb58e4890e.tar.gz
lua-6c8e652aa6b5bf7018ff74473a6ef5bb58e4890e.tar.bz2
lua-6c8e652aa6b5bf7018ff74473a6ef5bb58e4890e.zip
use macros for 'getc'
-rw-r--r--ldo.c4
-rw-r--r--liolib.c6
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 @@
1/* 1/*
2** $Id: ldo.c,v 1.136 2001/06/08 19:00:57 roberto Exp roberto $ 2** $Id: ldo.c,v 1.137 2001/07/12 19:34:03 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -243,7 +243,7 @@ LUA_API int lua_loadfile (lua_State *L, const l_char *filename) {
243 int nlevel; /* level on the stack of filename */ 243 int nlevel; /* level on the stack of filename */
244 FILE *f = (filename == NULL) ? stdin : fopen(filename, l_s("r")); 244 FILE *f = (filename == NULL) ? stdin : fopen(filename, l_s("r"));
245 if (f == NULL) return LUA_ERRFILE; /* unable to open file */ 245 if (f == NULL) return LUA_ERRFILE; /* unable to open file */
246 bin = (ungetc(fgetc(f), f) == LUA_SIGNATURE[0]); 246 bin = (ungetc(getc(f), f) == LUA_SIGNATURE[0]);
247 if (bin && f != stdin) { 247 if (bin && f != stdin) {
248 fclose(f); 248 fclose(f);
249 f = fopen(filename, l_s("rb")); /* reopen in binary mode */ 249 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 @@
1/* 1/*
2** $Id: liolib.c,v 1.118 2001/07/12 14:59:14 roberto Exp roberto $ 2** $Id: liolib.c,v 1.119 2001/07/12 18:11:58 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -237,7 +237,7 @@ static int read_until (lua_State *L, FILE *f, const l_char *p, int pl) {
237 luaL_buffinit(L, &b); 237 luaL_buffinit(L, &b);
238 prep_read_until(next, p, pl); 238 prep_read_until(next, p, pl);
239 j = 0; 239 j = 0;
240 while ((c = fgetc(f)) != EOF) { 240 while ((c = getc(f)) != EOF) {
241 NoRead: 241 NoRead:
242 if (c == p[j]) { 242 if (c == p[j]) {
243 j++; /* go to next char in pattern */ 243 j++; /* go to next char in pattern */
@@ -272,7 +272,7 @@ static int read_number (lua_State *L, FILE *f) {
272 272
273 273
274static int test_eof (lua_State *L, FILE *f) { 274static int test_eof (lua_State *L, FILE *f) {
275 l_charint c = fgetc(f); 275 l_charint c = getc(f);
276 ungetc(c, f); 276 ungetc(c, f);
277 lua_pushlstring(L, NULL, 0); 277 lua_pushlstring(L, NULL, 0);
278 return (c != EOF); 278 return (c != EOF);