aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-21 16:21:16 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-21 16:21:16 -0300
commitae800656c9f82b54f6fae1497022d3484ad0c920 (patch)
treee3124387f4e29fc452ebb3c15b7e6cd0c1f4bbb7 /ltests.c
parent8c688639605f3ec0b5a57d906cacc27981b066da (diff)
downloadlua-ae800656c9f82b54f6fae1497022d3484ad0c920.tar.gz
lua-ae800656c9f82b54f6fae1497022d3484ad0c920.tar.bz2
lua-ae800656c9f82b54f6fae1497022d3484ad0c920.zip
change in string table: string table is now independent of GC lists; all
strings live in 'normal' GC lists
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/ltests.c b/ltests.c
index 36e7be3f..f6061213 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.145 2013/08/19 14:16:33 roberto Exp roberto $ 2** $Id: ltests.c,v 2.146 2013/08/20 17:46:34 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*/
@@ -661,7 +661,7 @@ static int gc_local (lua_State *L) {
661 661
662static int gc_state (lua_State *L) { 662static int gc_state (lua_State *L) {
663 static const char *statenames[] = {"propagate", "atomic", 663 static const char *statenames[] = {"propagate", "atomic",
664 "sweepstring", "sweepudata", "sweep", "pause", ""}; 664 "sweepudata", "sweep", "pause", ""};
665 int option = luaL_checkoption(L, 1, "", statenames); 665 int option = luaL_checkoption(L, 1, "", statenames);
666 if (option == GCSpause + 1) { 666 if (option == GCSpause + 1) {
667 lua_pushstring(L, statenames[G(L)->gcstate]); 667 lua_pushstring(L, statenames[G(L)->gcstate]);
@@ -742,22 +742,18 @@ static int table_query (lua_State *L) {
742static int string_query (lua_State *L) { 742static int string_query (lua_State *L) {
743 stringtable *tb = &G(L)->strt; 743 stringtable *tb = &G(L)->strt;
744 int s = luaL_optint(L, 2, 0) - 1; 744 int s = luaL_optint(L, 2, 0) - 1;
745 if (s==-1) { 745 if (s < 0) {
746 lua_pushinteger(L ,tb->nuse); 746 lua_pushinteger(L ,tb->nuse);
747 lua_pushinteger(L ,tb->size); 747 lua_pushinteger(L ,tb->size);
748 return 2; 748 return 2;
749 } 749 }
750 else if (s < tb->size) { 750 else if ((unsigned int)s < tb->size) {
751 GCObject *ts; 751 TString *ts = tb->hash[s];
752 int n = 0; 752 setsvalue2s(L, L->top, ts);
753 for (ts = tb->hash[s]; ts; ts = gch(ts)->next) { 753 api_incr_top(L);
754 setsvalue2s(L, L->top, rawgco2ts(ts)); 754 return 1;
755 api_incr_top(L);
756 n++;
757 }
758 return n;
759 } 755 }
760 return 0; 756 else return 0;
761} 757}
762 758
763 759