diff options
-rw-r--r-- | liolib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.134 2014/10/17 19:17:55 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.135 2014/10/22 11:44:20 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,6 +135,7 @@ | |||
135 | 135 | ||
136 | 136 | ||
137 | #define IO_PREFIX "_IO_" | 137 | #define IO_PREFIX "_IO_" |
138 | #define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) | ||
138 | #define IO_INPUT (IO_PREFIX "input") | 139 | #define IO_INPUT (IO_PREFIX "input") |
139 | #define IO_OUTPUT (IO_PREFIX "output") | 140 | #define IO_OUTPUT (IO_PREFIX "output") |
140 | 141 | ||
@@ -290,7 +291,7 @@ static FILE *getiofile (lua_State *L, const char *findex) { | |||
290 | lua_getfield(L, LUA_REGISTRYINDEX, findex); | 291 | lua_getfield(L, LUA_REGISTRYINDEX, findex); |
291 | p = (LStream *)lua_touserdata(L, -1); | 292 | p = (LStream *)lua_touserdata(L, -1); |
292 | if (isclosed(p)) | 293 | if (isclosed(p)) |
293 | luaL_error(L, "standard %s file is closed", findex + strlen(IO_PREFIX)); | 294 | luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN); |
294 | return p->f; | 295 | return p->f; |
295 | } | 296 | } |
296 | 297 | ||