commit dd28b830e9a4104fe78094fc6baf15cf601c1b6b
parent 572ee14b523a666d2be896825f55e6d05a260f7b
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 2 Feb 1995 18:05:18 -0200
a null lua_Object is LUA_NOOBJECT, not NULL.
Diffstat:
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git 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 <setjmp.h>
#include <stdio.h>
@@ -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
@@ -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 <string.h>
+#include <strings.h>
+#include <stdlib.h>
#include <ctype.h>
-#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);
}