diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-10-22 14:55:57 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-10-22 14:55:57 -0200 |
commit | 88ff582fd8f94dd8ba751142f12bc048815ae20e (patch) | |
tree | 8d7a69d7f6ca16963778b89082b204586d27fa65 | |
parent | 6b12b8253247079941e6303e9bb47aaeec03331b (diff) | |
download | lua-5.3-beta.tar.gz lua-5.3-beta.tar.bz2 lua-5.3-beta.zip |
detail (using 'sizeof' instead of 'strlen' for length of a constantv5.3-beta
string)
-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 | ||