aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-22 14:15:18 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-22 14:15:18 -0300
commit52ee91dd73199e068d31d3ac138d933ddd4fb9b1 (patch)
tree9f9f1fdc16c8a3464fef14b9946482df688c2ea8 /ldo.c
parent191fd35f0a6cd47ea03417a663395acf5d0e9bf5 (diff)
downloadlua-52ee91dd73199e068d31d3ac138d933ddd4fb9b1.tar.gz
lua-52ee91dd73199e068d31d3ac138d933ddd4fb9b1.tar.bz2
lua-52ee91dd73199e068d31d3ac138d933ddd4fb9b1.zip
better encapsulation of some types
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ldo.c b/ldo.c
index 36304fb7..7ab130af 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.123 2001/02/07 18:13:49 roberto Exp roberto $ 2** $Id: ldo.c,v 1.124 2001/02/20 18:15:33 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*/
@@ -265,12 +265,9 @@ static int parse_file (lua_State *L, const char *filename) {
265 ZIO z; 265 ZIO z;
266 int status; 266 int status;
267 int bin; /* flag for file mode */ 267 int bin; /* flag for file mode */
268 int c; /* look ahead char */
269 FILE *f = (filename == NULL) ? stdin : fopen(filename, "r"); 268 FILE *f = (filename == NULL) ? stdin : fopen(filename, "r");
270 if (f == NULL) return LUA_ERRFILE; /* unable to open file */ 269 if (f == NULL) return LUA_ERRFILE; /* unable to open file */
271 c = fgetc(f); 270 bin = (ungetc(fgetc(f), f) == ID_CHUNK);
272 ungetc(c, f);
273 bin = (c == ID_CHUNK);
274 if (bin && f != stdin) { 271 if (bin && f != stdin) {
275 fclose(f); 272 fclose(f);
276 f = fopen(filename, "rb"); /* reopen in binary mode */ 273 f = fopen(filename, "rb"); /* reopen in binary mode */