diff --git a/opcode.c b/opcode.c index 4f488bb0..39cc3651 100644 --- a/opcode.c +++ b/opcode.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 3.31 1994/12/30 17:45:11 roberto Exp celes $"; +char *rcs_opcode="$Id: opcode.c,v 3.32 1995/01/27 17:19:06 celes Exp roberto $"; #include #include @@ -373,7 +373,7 @@ static int do_protectedmain (void) */ int lua_callfunction (lua_Object function) { - if (function == NULL) + if (function == LUA_NOOBJECT) return 1; else return do_protectedrun (Address(function), MULT_RET); diff --git a/strlib.c b/strlib.c index f3d2f41d..f6de70fc 100644 --- a/strlib.c +++ b/strlib.c @@ -3,12 +3,13 @@ ** String library to LUA */ -char *rcs_strlib="$Id: strlib.c,v 1.8 1995/01/06 20:31:10 roberto Exp roberto $"; +char *rcs_strlib="$Id: strlib.c,v 1.10 1995/02/02 18:54:58 roberto Exp $"; #include +#include +#include #include -#include "mem.h" #include "lua.h" #include "lualib.h" @@ -87,7 +88,7 @@ static void str_sub (void) lua_error ("incorrect third argument to function `strsub'"); s = lua_copystring(o1); start = lua_getnumber (o2); - end = o3 == NULL ? strlen(s) : lua_getnumber (o3); + end = o3 == LUA_NOOBJECT ? strlen(s) : lua_getnumber (o3); if (end < start || start < 1 || end > strlen(s)) lua_pushliteral(""); else @@ -95,7 +96,7 @@ static void str_sub (void) s[end] = 0; lua_pushstring (&s[start-1]); } - luaI_free(s); + free(s); } /* @@ -109,14 +110,14 @@ static void str_lower (void) lua_Object o = lua_getparam (1); if (!lua_isstring(o)) lua_error ("incorrect arguments to function `strlower'"); - c = s = luaI_strdup(lua_getstring(o)); + c = s = lua_copystring(o); while (*c != 0) { *c = tolower(*c); c++; } lua_pushstring(s); - luaI_free(s); + free(s); } @@ -131,14 +132,14 @@ static void str_upper (void) lua_Object o = lua_getparam (1); if (!lua_isstring(o)) lua_error ("incorrect arguments to function `strlower'"); - c = s = luaI_strdup(lua_getstring(o)); + c = s = lua_copystring(o); while (*c != 0) { *c = toupper(*c); c++; } lua_pushstring(s); - luaI_free(s); + free(s); }