summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-22 14:55:57 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-22 14:55:57 -0200
commit88ff582fd8f94dd8ba751142f12bc048815ae20e (patch)
tree8d7a69d7f6ca16963778b89082b204586d27fa65
parent6b12b8253247079941e6303e9bb47aaeec03331b (diff)
downloadlua-github-5.3-beta.tar.gz
detail (using 'sizeof' instead of 'strlen' for length of a constantv5.3-betav5-3-beta
string)
-rw-r--r--liolib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/liolib.c b/liolib.c
index d03c99d7..863cd2b1 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
/*
-** $Id: liolib.c,v 2.134 2014/10/17 19:17:55 roberto Exp roberto $
+** $Id: liolib.c,v 2.135 2014/10/22 11:44:20 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@@ -135,6 +135,7 @@
#define IO_PREFIX "_IO_"
+#define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1)
#define IO_INPUT (IO_PREFIX "input")
#define IO_OUTPUT (IO_PREFIX "output")
@@ -290,7 +291,7 @@ static FILE *getiofile (lua_State *L, const char *findex) {
lua_getfield(L, LUA_REGISTRYINDEX, findex);
p = (LStream *)lua_touserdata(L, -1);
if (isclosed(p))
- luaL_error(L, "standard %s file is closed", findex + strlen(IO_PREFIX));
+ luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN);
return p->f;
}