diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-24 10:54:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-24 10:54:49 -0300 |
commit | ef62b340e0a6b7b18931000dcbb19c4703bfe0e8 (patch) | |
tree | d9d995116a8a686b798d1b625b06ead26f28ba58 /lauxlib.c | |
parent | 5c2dd7a9e0a5b871a71ba66c4683cd88fe4f5aa4 (diff) | |
download | lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.tar.gz lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.tar.bz2 lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.zip |
code cleaner for 16 bits.
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.26 2000/02/08 16:34:31 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.27 2000/03/30 17:19:48 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -51,18 +51,20 @@ static void type_error (lua_State *L, int narg, const char *type_name, | |||
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | static const char *checkstr (lua_State *L, lua_Object o, int narg, long *len) { | 54 | static const char *checkstr (lua_State *L, lua_Object o, int narg, |
55 | size_t *len) { | ||
55 | const char *s = lua_getstring(L, o); | 56 | const char *s = lua_getstring(L, o); |
56 | if (!s) type_error(L, narg, "string", o); | 57 | if (!s) type_error(L, narg, "string", o); |
57 | if (len) *len = lua_strlen(L, o); | 58 | if (len) *len = lua_strlen(L, o); |
58 | return s; | 59 | return s; |
59 | } | 60 | } |
60 | 61 | ||
61 | const char *luaL_check_lstr (lua_State *L, int narg, long *len) { | 62 | const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) { |
62 | return checkstr(L, lua_getparam(L, narg), narg, len); | 63 | return checkstr(L, lua_getparam(L, narg), narg, len); |
63 | } | 64 | } |
64 | 65 | ||
65 | const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, long *len) { | 66 | const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, |
67 | size_t *len) { | ||
66 | lua_Object o = lua_getparam(L, narg); | 68 | lua_Object o = lua_getparam(L, narg); |
67 | if (o == LUA_NOOBJECT) { | 69 | if (o == LUA_NOOBJECT) { |
68 | if (len) *len = def ? strlen(def) : 0; | 70 | if (len) *len = def ? strlen(def) : 0; |