From d3bbb34c24cfe3e5296c6a5d3faacf6c8679fe70 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 5 Sep 2013 16:31:49 -0300 Subject: back to open hashing for the string table (but with a different 'hnext' field, to strings are still collected like all other objects) --- ltests.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index 9edeb515..7d6d3e19 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 2.153 2013/09/03 15:37:10 roberto Exp roberto $ +** $Id: ltests.c,v 2.154 2013/09/04 15:34:24 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -730,17 +730,21 @@ static int table_query (lua_State *L) { static int string_query (lua_State *L) { stringtable *tb = &G(L)->strt; - int s = luaL_optint(L, 2, 0) - 1; - if (s < 0) { - lua_pushinteger(L ,tb->nuse); + int s = luaL_optint(L, 1, 0) - 1; + if (s == -1) { lua_pushinteger(L ,tb->size); + lua_pushinteger(L ,tb->nuse); return 2; } else if (s < tb->size) { - TString *ts = tb->hash[s]; - setsvalue2s(L, L->top, ts); - api_incr_top(L); - return 1; + TString *ts; + int n = 0; + for (ts = tb->hash[s]; ts != NULL; ts = ts->tsv.hnext) { + setsvalue2s(L, L->top, ts); + api_incr_top(L); + n++; + } + return n; } else return 0; } -- cgit v1.2.3-55-g6feb