diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-09-05 16:31:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-09-05 16:31:49 -0300 |
commit | d3bbb34c24cfe3e5296c6a5d3faacf6c8679fe70 (patch) | |
tree | b245be2289ab4fdbb558a0f52a81dd5631871ee3 /ltests.c | |
parent | 0ad15fc10041f59b5466fe902637b1a2fb64565d (diff) | |
download | lua-d3bbb34c24cfe3e5296c6a5d3faacf6c8679fe70.tar.gz lua-d3bbb34c24cfe3e5296c6a5d3faacf6c8679fe70.tar.bz2 lua-d3bbb34c24cfe3e5296c6a5d3faacf6c8679fe70.zip |
back to open hashing for the string table (but with a different
'hnext' field, to strings are still collected like all other
objects)
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.153 2013/09/03 15:37:10 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.154 2013/09/04 15:34:24 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -730,17 +730,21 @@ static int table_query (lua_State *L) { | |||
730 | 730 | ||
731 | static int string_query (lua_State *L) { | 731 | static int string_query (lua_State *L) { |
732 | stringtable *tb = &G(L)->strt; | 732 | stringtable *tb = &G(L)->strt; |
733 | int s = luaL_optint(L, 2, 0) - 1; | 733 | int s = luaL_optint(L, 1, 0) - 1; |
734 | if (s < 0) { | 734 | if (s == -1) { |
735 | lua_pushinteger(L ,tb->nuse); | ||
736 | lua_pushinteger(L ,tb->size); | 735 | lua_pushinteger(L ,tb->size); |
736 | lua_pushinteger(L ,tb->nuse); | ||
737 | return 2; | 737 | return 2; |
738 | } | 738 | } |
739 | else if (s < tb->size) { | 739 | else if (s < tb->size) { |
740 | TString *ts = tb->hash[s]; | 740 | TString *ts; |
741 | setsvalue2s(L, L->top, ts); | 741 | int n = 0; |
742 | api_incr_top(L); | 742 | for (ts = tb->hash[s]; ts != NULL; ts = ts->tsv.hnext) { |
743 | return 1; | 743 | setsvalue2s(L, L->top, ts); |
744 | api_incr_top(L); | ||
745 | n++; | ||
746 | } | ||
747 | return n; | ||
744 | } | 748 | } |
745 | else return 0; | 749 | else return 0; |
746 | } | 750 | } |