diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-04 14:58:02 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-04 14:58:02 -0300 |
commit | 1ede98157db12ded9c6be1ed8ab8742bcf6c046d (patch) | |
tree | 51c77da6e65a908bf0ac06362a7f2d4e866ab0fa | |
parent | 3e52573c722190f4e5f9b996fe8eb7927b65e2a8 (diff) | |
download | lua-1ede98157db12ded9c6be1ed8ab8742bcf6c046d.tar.gz lua-1ede98157db12ded9c6be1ed8ab8742bcf6c046d.tar.bz2 lua-1ede98157db12ded9c6be1ed8ab8742bcf6c046d.zip |
strings are always `strong' in weaktables
-rw-r--r-- | lbaselib.c | 6 | ||||
-rw-r--r-- | lgc.c | 9 |
2 files changed, 8 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.88 2002/06/26 20:36:17 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.89 2002/07/01 19:23:58 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -571,11 +571,11 @@ static void base_open (lua_State *L) { | |||
571 | /* `newproxy' needs a weaktable as upvalue */ | 571 | /* `newproxy' needs a weaktable as upvalue */ |
572 | lua_pushliteral(L, "newproxy"); | 572 | lua_pushliteral(L, "newproxy"); |
573 | lua_newtable(L); /* new table `w' */ | 573 | lua_newtable(L); /* new table `w' */ |
574 | lua_newtable(L); /* create `w's metatable */ | 574 | lua_pushvalue(L, -1); /* `w' will be its own metatable */ |
575 | lua_setmetatable(L, -2); | ||
575 | lua_pushliteral(L, "__mode"); | 576 | lua_pushliteral(L, "__mode"); |
576 | lua_pushliteral(L, "k"); | 577 | lua_pushliteral(L, "k"); |
577 | lua_rawset(L, -3); /* metatable(w).__mode = "k" */ | 578 | lua_rawset(L, -3); /* metatable(w).__mode = "k" */ |
578 | lua_setmetatable(L, -2); | ||
579 | lua_pushcclosure(L, luaB_newproxy, 1); | 579 | lua_pushcclosure(L, luaB_newproxy, 1); |
580 | lua_rawset(L, -3); /* set global `newproxy' */ | 580 | lua_rawset(L, -3); /* set global `newproxy' */ |
581 | lua_rawset(L, -1); /* set global _G */ | 581 | lua_rawset(L, -1); /* set global _G */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.139 2002/06/25 19:17:42 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.140 2002/07/01 17:06:58 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -263,15 +263,16 @@ static void propagatemarks (GCState *st) { | |||
263 | 263 | ||
264 | static int hasmark (const TObject *o) { | 264 | static int hasmark (const TObject *o) { |
265 | switch (ttype(o)) { | 265 | switch (ttype(o)) { |
266 | case LUA_TSTRING: | ||
267 | return tsvalue(o)->tsv.marked; | ||
268 | case LUA_TUSERDATA: | 266 | case LUA_TUSERDATA: |
269 | return isudmarked(uvalue(o)); | 267 | return isudmarked(uvalue(o)); |
270 | case LUA_TTABLE: | 268 | case LUA_TTABLE: |
271 | return ismarked(hvalue(o)); | 269 | return ismarked(hvalue(o)); |
272 | case LUA_TFUNCTION: | 270 | case LUA_TFUNCTION: |
273 | return clvalue(o)->c.marked; | 271 | return clvalue(o)->c.marked; |
274 | default: /* number, nil, boolean */ | 272 | case LUA_TSTRING: |
273 | strmark(tsvalue(o)); /* strings are `values', so are never weak */ | ||
274 | /* go through */ | ||
275 | default: /* number, nil, boolean, udataval */ | ||
275 | return 1; | 276 | return 1; |
276 | } | 277 | } |
277 | } | 278 | } |