diff options
-rw-r--r-- | src/tools.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tools.c b/src/tools.c index 773735d..9adb17e 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -265,7 +265,7 @@ static lua_CFunction luaG_tocfunction( lua_State *L, int _i, FuncSubType *_out) | |||
265 | 265 | ||
266 | 266 | ||
267 | // inspired from tconcat() in ltablib.c | 267 | // inspired from tconcat() in ltablib.c |
268 | static char const* luaG_pushFQN(lua_State *L, int t, int last, int* length) | 268 | static char const* luaG_pushFQN(lua_State *L, int t, int last, size_t* length) |
269 | { | 269 | { |
270 | int i = 1; | 270 | int i = 1; |
271 | luaL_Buffer b; | 271 | luaL_Buffer b; |
@@ -355,8 +355,9 @@ static void populate_func_lookup_table_recur( lua_State* L, int _ctx_base, int _ | |||
355 | } | 355 | } |
356 | else if( lua_isfunction( L, -1) && (luaG_getfuncsubtype( L, -1) != FST_Bytecode)) // ... {_i} {bfc} k func | 356 | else if( lua_isfunction( L, -1) && (luaG_getfuncsubtype( L, -1) != FST_Bytecode)) // ... {_i} {bfc} k func |
357 | { | 357 | { |
358 | int prevNameLength, newNameLength; | 358 | size_t prevNameLength, newNameLength; |
359 | char const* prevName, *newName; | 359 | char const* prevName; |
360 | DEBUGSPEW_CODE( char const *newName); | ||
360 | // first, raise an error if the function is already known | 361 | // first, raise an error if the function is already known |
361 | lua_pushvalue( L, -1); // ... {_i} {bfc} k func func | 362 | lua_pushvalue( L, -1); // ... {_i} {bfc} k func func |
362 | lua_rawget( L, dest); // ... {_i} {bfc} k func name? | 363 | lua_rawget( L, dest); // ... {_i} {bfc} k func name? |
@@ -366,7 +367,7 @@ static void populate_func_lookup_table_recur( lua_State* L, int _ctx_base, int _ | |||
366 | ++ _depth; | 367 | ++ _depth; |
367 | lua_rawseti( L, fqn, _depth); // ... {_i} {bfc} k func name? | 368 | lua_rawseti( L, fqn, _depth); // ... {_i} {bfc} k func name? |
368 | // generate name | 369 | // generate name |
369 | newName = luaG_pushFQN( L, fqn, _depth, &newNameLength); // ... {_i} {bfc} k func name? "f.q.n" | 370 | DEBUGSPEW_CODE( newName =) luaG_pushFQN( L, fqn, _depth, &newNameLength); // ... {_i} {bfc} k func name? "f.q.n" |
370 | // Lua 5.2 introduced a hash randomizer seed which causes table iteration to yield a different key order | 371 | // Lua 5.2 introduced a hash randomizer seed which causes table iteration to yield a different key order |
371 | // on different VMs even when the tables are populated the exact same way. | 372 | // on different VMs even when the tables are populated the exact same way. |
372 | // When Lua is built with compatibility options (such as LUA_COMPAT_ALL), | 373 | // When Lua is built with compatibility options (such as LUA_COMPAT_ALL), |
@@ -691,7 +692,7 @@ void set_deep_lookup( lua_State *L ) { | |||
691 | lua_pushlightuserdata( L, DEEP_LOOKUP_KEY ); | 692 | lua_pushlightuserdata( L, DEEP_LOOKUP_KEY ); |
692 | lua_pushvalue(L,-2); | 693 | lua_pushvalue(L,-2); |
693 | // | 694 | // |
694 | // [-3]: {} (2nd ref) | 695 | // [-3]: {} (2nd ref) |
695 | // [-2]: DEEP_LOOKUP_KEY | 696 | // [-2]: DEEP_LOOKUP_KEY |
696 | // [-1]: {} | 697 | // [-1]: {} |
697 | 698 | ||
@@ -1098,7 +1099,7 @@ luaG_IdFunction luaG_copydeep( lua_State *L, lua_State *L2, int index ) | |||
1098 | 1099 | ||
1099 | /* | 1100 | /* |
1100 | * 'reg[ REG_MT_KNOWN ]'= { | 1101 | * 'reg[ REG_MT_KNOWN ]'= { |
1101 | * [ table ]= id_uint, | 1102 | * [ table ]= id_uint, |
1102 | * ... | 1103 | * ... |
1103 | * [ id_uint ]= table, | 1104 | * [ id_uint ]= table, |
1104 | * ... | 1105 | * ... |