aboutsummaryrefslogtreecommitdiff
path: root/lobject.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-11-22 11:12:07 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-11-22 11:12:07 -0200
commit29ede6aa13144ff7b69c57a87be1ee93f57ae896 (patch)
treeadcfb5dcff7db55481cd675349e23dec0e63c939 /lobject.c
parent951897c09319ae5474a4b86bb7d615136577caa0 (diff)
downloadlua-29ede6aa13144ff7b69c57a87be1ee93f57ae896.tar.gz
lua-29ede6aa13144ff7b69c57a87be1ee93f57ae896.tar.bz2
lua-29ede6aa13144ff7b69c57a87be1ee93f57ae896.zip
first implementation of multiple states (reentrant code).
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lobject.c b/lobject.c
index 2c87b7d0..1e9f99d3 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.23 1999/09/08 20:45:18 roberto Exp roberto $ 2** $Id: lobject.c,v 1.24 1999/10/04 17:51:04 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -7,6 +7,8 @@
7#include <ctype.h> 7#include <ctype.h>
8#include <stdlib.h> 8#include <stdlib.h>
9 9
10#define LUA_REENTRANT
11
10#include "lobject.h" 12#include "lobject.h"
11#include "lua.h" 13#include "lua.h"
12 14
@@ -28,13 +30,13 @@ static const long dimensions[] =
28 1644817L, 3289613L, 6579211L, 13158023L, MAX_INT}; 30 1644817L, 3289613L, 6579211L, 13158023L, MAX_INT};
29 31
30 32
31int luaO_redimension (int oldsize) { 33int luaO_redimension (lua_State *L, int oldsize) {
32 int i; 34 int i;
33 for (i=0; dimensions[i]<MAX_INT; i++) { 35 for (i=0; dimensions[i]<MAX_INT; i++) {
34 if (dimensions[i] > oldsize) 36 if (dimensions[i] > oldsize)
35 return dimensions[i]; 37 return dimensions[i];
36 } 38 }
37 lua_error("tableEM"); 39 lua_error(L, "tableEM");
38 return 0; /* to avoid warnings */ 40 return 0; /* to avoid warnings */
39} 41}
40 42
@@ -49,7 +51,7 @@ int luaO_equalval (const TObject *t1, const TObject *t2) {
49 case LUA_T_CPROTO: return fvalue(t1) == fvalue(t2); 51 case LUA_T_CPROTO: return fvalue(t1) == fvalue(t2);
50 case LUA_T_CLOSURE: return t1->value.cl == t2->value.cl; 52 case LUA_T_CLOSURE: return t1->value.cl == t2->value.cl;
51 default: 53 default:
52 LUA_INTERNALERROR("invalid type"); 54 LUA_INTERNALERROR(L, "invalid type");
53 return 0; /* UNREACHABLE */ 55 return 0; /* UNREACHABLE */
54 } 56 }
55} 57}