diff options
author | Joshua Haberman <joshua@reverberate.org> | 2010-07-21 11:58:32 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2010-07-21 11:58:32 -0700 |
commit | 71ac83fe7a15b27f34e9da452eaeee8df460a2aa (patch) | |
tree | 5d2d79d168c786de3b9229686e156fd2cca5fb98 /lang_ext/lua/upb.c | |
parent | 4a38d38f96c561d1e0797e23ed97fd2657c21da0 (diff) |
Make object cache weak.
Diffstat (limited to 'lang_ext/lua/upb.c')
-rw-r--r-- | lang_ext/lua/upb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lang_ext/lua/upb.c b/lang_ext/lua/upb.c index 7241dc5..bfc1355 100644 --- a/lang_ext/lua/upb.c +++ b/lang_ext/lua/upb.c @@ -71,6 +71,7 @@ static void lupb_def_getorcreate(lua_State *L, upb_def *def) { break; default: luaL_error(L, "unknown deftype %d", def->type); + type_name = NULL; // Placate the compiler. } return lupb_cache_getorcreate(L, def, type_name, lupb_def_unref); } @@ -219,6 +220,9 @@ int luaopen_upb(lua_State *L) { // Create our object cache. TODO: need to make this table weak! lua_createtable(L, 0, 0); + lua_createtable(L, 0, 1); // Cache metatable. + lua_pushstring(L, "v"); // Values are weak. + lua_setfield(L, -2, "__mode"); lua_setfield(L, LUA_REGISTRYINDEX, "upb.objcache"); luaL_register(L, "upb", lupb_toplevel_m); |