diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-08 13:48:32 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-08 13:48:32 -0300 |
| commit | 4905fdd1350bde68cd818b9198f28f5a47c208b0 (patch) | |
| tree | 5056c5792537c09262a026e8c6f27c6bec8d010b | |
| parent | 0267168675cb21f19e685749e1737dfd2884bdf2 (diff) | |
| download | lua-4905fdd1350bde68cd818b9198f28f5a47c208b0.tar.gz lua-4905fdd1350bde68cd818b9198f28f5a47c208b0.tar.bz2 lua-4905fdd1350bde68cd818b9198f28f5a47c208b0.zip | |
C++ warning
| -rw-r--r-- | liolib.c | 13 |
1 files changed, 5 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 1.113 2001/06/06 18:00:19 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.114 2001/06/07 13:46:29 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 | */ |
| @@ -135,13 +135,10 @@ static void resetfile (lua_State *L, int inout) { | |||
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | static int io_close (lua_State *L) { | 137 | static int io_close (lua_State *L) { |
| 138 | FILE *f; | 138 | FILE *f = (FILE *)luaL_check_userdata(L, 1, FILEHANDLE); |
| 139 | int status; | 139 | int status = 1; |
| 140 | lua_settop(L, 1); | 140 | if (f != stdin && f != stdout && f != stderr) { |
| 141 | f = luaL_check_userdata(L, 1, FILEHANDLE); | 141 | lua_settop(L, 1); /* make sure file is on top */ |
| 142 | if (f == stdin || f == stdout || f == stderr) | ||
| 143 | status = 1; | ||
| 144 | else { | ||
| 145 | lua_settag(L, lua_name2tag(L, CLOSEDFILEHANDLE)); | 142 | lua_settag(L, lua_name2tag(L, CLOSEDFILEHANDLE)); |
| 146 | status = (CLOSEFILE(L, f) == 0); | 143 | status = (CLOSEFILE(L, f) == 0); |
| 147 | } | 144 | } |
