aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-24 13:45:33 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-24 13:45:33 -0200
commit71ae4801d66d9592b0fb08e4e78138b7a6e993d5 (patch)
treea683b5b3757efb979329bf513f1bd9fde3fb9d1f /ltable.c
parent6fda6a530265268c01a83c31f8fc30e34753bbf1 (diff)
downloadlua-71ae4801d66d9592b0fb08e4e78138b7a6e993d5.tar.gz
lua-71ae4801d66d9592b0fb08e4e78138b7a6e993d5.tar.bz2
lua-71ae4801d66d9592b0fb08e4e78138b7a6e993d5.zip
macros LUA_ENTRY/LUA_EXIT to control exclusive access to Lua core
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ltable.c b/ltable.c
index edf9d320..81406e05 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.64 2001/01/18 15:59:09 roberto Exp roberto $ 2** $Id: ltable.c,v 1.65 2001/01/19 13:20:30 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -20,6 +20,7 @@
20 20
21#include "lua.h" 21#include "lua.h"
22 22
23#include "ldo.h"
23#include "lmem.h" 24#include "lmem.h"
24#include "lobject.h" 25#include "lobject.h"
25#include "lstate.h" 26#include "lstate.h"
@@ -112,7 +113,7 @@ Node *luaH_next (lua_State *L, const Hash *t, const TObject *key) {
112 else { 113 else {
113 const TObject *v = luaH_get(t, key); 114 const TObject *v = luaH_get(t, key);
114 if (v == &luaO_nilobject) 115 if (v == &luaO_nilobject)
115 lua_error(L, "invalid key for `next'"); 116 luaD_error(L, "invalid key for `next'");
116 i = (int)(((const char *)v - 117 i = (int)(((const char *)v -
117 (const char *)(&t->node[0].val)) / sizeof(Node)) + 1; 118 (const char *)(&t->node[0].val)) / sizeof(Node)) + 1;
118 } 119 }
@@ -152,7 +153,7 @@ void luaH_remove (Hash *t, TObject *key) {
152static void setnodevector (lua_State *L, Hash *t, luint32 size) { 153static void setnodevector (lua_State *L, Hash *t, luint32 size) {
153 int i; 154 int i;
154 if (size > MAX_INT) 155 if (size > MAX_INT)
155 lua_error(L, "table overflow"); 156 luaD_error(L, "table overflow");
156 t->node = luaM_newvector(L, size, Node); 157 t->node = luaM_newvector(L, size, Node);
157 for (i=0; i<(int)size; i++) { 158 for (i=0; i<(int)size; i++) {
158 setnilvalue(&t->node[i].key); 159 setnilvalue(&t->node[i].key);
@@ -259,7 +260,7 @@ static TObject *luaH_setany (lua_State *L, Hash *t, const TObject *key) {
259 Node *mp = luaH_mainposition(t, key); 260 Node *mp = luaH_mainposition(t, key);
260 Node *n = mp; 261 Node *n = mp;
261 if (!mp) 262 if (!mp)
262 lua_error(L, "table index is nil"); 263 luaD_error(L, "table index is nil");
263 do { /* check whether `key' is somewhere in the chain */ 264 do { /* check whether `key' is somewhere in the chain */
264 if (luaO_equalObj(key, &n->key)) 265 if (luaO_equalObj(key, &n->key))
265 return &n->val; /* that's all */ 266 return &n->val; /* that's all */