aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Germain <b n t DOT g e r m a i n AT g m a i l DOT c o m>2018-10-31 12:19:00 +0100
committerBenoit Germain <b n t DOT g e r m a i n AT g m a i l DOT c o m>2018-10-31 12:19:00 +0100
commit4b9c5a59a823df610c8c871d5c0cb47cbb7c42cd (patch)
treec2692434fefaecdf1e71e7608ddafa2cc6fa40af /src
parent41766577f53a53542e8ea6b1d1a8f753b0885214 (diff)
downloadlanes-4b9c5a59a823df610c8c871d5c0cb47cbb7c42cd.tar.gz
lanes-4b9c5a59a823df610c8c871d5c0cb47cbb7c42cd.tar.bz2
lanes-4b9c5a59a823df610c8c871d5c0cb47cbb7c42cd.zip
Another lua_pushlightuserdata->push_unique_key internal replacement
Diffstat (limited to 'src')
-rw-r--r--src/lanes.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lanes.c b/src/lanes.c
index 5a1f94a..aeba5fb 100644
--- a/src/lanes.c
+++ b/src/lanes.c
@@ -275,7 +275,8 @@ static DECLARE_CONST_UNIQUE_KEY( STACK_TRACE_KEY, 0x024d5411677ce879);
275* error (and maybe stack trace) parameters to the finalizer functions would 275* error (and maybe stack trace) parameters to the finalizer functions would
276* anyways complicate that approach. 276* anyways complicate that approach.
277*/ 277*/
278#define FINALIZER_REG_KEY ((void*)LG_set_finalizer) 278// crc64/we of string "STACK_TRACE_KEY" generated at http://www.nitrxgen.net/hashgen/
279static DECLARE_CONST_UNIQUE_KEY( FINALIZER_REG_KEY, 0x7902972781c7e365);
279 280
280struct s_Linda; 281struct s_Linda;
281 282
@@ -301,11 +302,11 @@ struct s_Linda;
301* Returns: TRUE if a table was pushed 302* Returns: TRUE if a table was pushed
302* FALSE if no table found, not created, and nothing pushed 303* FALSE if no table found, not created, and nothing pushed
303*/ 304*/
304static bool_t push_registry_table( lua_State* L, void* key, bool_t create) 305static bool_t push_registry_table( lua_State* L, UniqueKey key, bool_t create)
305{ 306{
306 STACK_GROW( L, 3); 307 STACK_GROW( L, 3);
307 STACK_CHECK( L); 308 STACK_CHECK( L);
308 lua_pushlightuserdata( L, key); // key 309 push_unique_key( L, key); // key
309 lua_rawget( L, LUA_REGISTRYINDEX); // t? 310 lua_rawget( L, LUA_REGISTRYINDEX); // t?
310 311
311 if( lua_isnil( L, -1)) // nil? 312 if( lua_isnil( L, -1)) // nil?
@@ -318,7 +319,7 @@ static bool_t push_registry_table( lua_State* L, void* key, bool_t create)
318 } 319 }
319 320
320 lua_newtable( L); // t 321 lua_newtable( L); // t
321 lua_pushlightuserdata( L, key); // t key 322 push_unique_key( L, key); // t key
322 lua_pushvalue( L, -2); // t key t 323 lua_pushvalue( L, -2); // t key t
323 lua_rawset( L, LUA_REGISTRYINDEX); // t 324 lua_rawset( L, LUA_REGISTRYINDEX); // t
324 } 325 }