aboutsummaryrefslogtreecommitdiff
path: root/src/deep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/deep.c')
-rw-r--r--src/deep.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/deep.c b/src/deep.c
index 82350f4..fe7a21f 100644
--- a/src/deep.c
+++ b/src/deep.c
@@ -44,6 +44,7 @@ THE SOFTWARE.
44#include "deep.h" 44#include "deep.h"
45#include "tools.h" 45#include "tools.h"
46#include "universe.h" 46#include "universe.h"
47#include "uniquekey.h"
47 48
48/*-- Metatable copying --*/ 49/*-- Metatable copying --*/
49 50
@@ -59,19 +60,19 @@ THE SOFTWARE.
59/* 60/*
60* Does what the original 'push_registry_subtable' function did, but adds an optional mode argument to it 61* Does what the original 'push_registry_subtable' function did, but adds an optional mode argument to it
61*/ 62*/
62void push_registry_subtable_mode( lua_State* L, void* key_, const char* mode_) 63static void push_registry_subtable_mode( lua_State* L, UniqueKey key_, const char* mode_)
63{ 64{
64 STACK_GROW( L, 3); 65 STACK_GROW( L, 3);
65 STACK_CHECK( L); 66 STACK_CHECK( L);
66 67
67 lua_pushlightuserdata( L, key_); // key 68 push_unique_key( L, key_); // key
68 lua_rawget( L, LUA_REGISTRYINDEX); // {}|nil 69 lua_rawget( L, LUA_REGISTRYINDEX); // {}|nil
69 70
70 if( lua_isnil( L, -1)) 71 if( lua_isnil( L, -1))
71 { 72 {
72 lua_pop( L, 1); // 73 lua_pop( L, 1); //
73 lua_newtable( L); // {} 74 lua_newtable( L); // {}
74 lua_pushlightuserdata( L, key_); // {} key 75 push_unique_key( L, key_); // {} key
75 lua_pushvalue( L, -2); // {} key {} 76 lua_pushvalue( L, -2); // {} key {}
76 77
77 // _R[key_] = {} 78 // _R[key_] = {}
@@ -96,7 +97,7 @@ void push_registry_subtable_mode( lua_State* L, void* key_, const char* mode_)
96* Push a registry subtable (keyed by unique 'key_') onto the stack. 97* Push a registry subtable (keyed by unique 'key_') onto the stack.
97* If the subtable does not exist, it is created and chained. 98* If the subtable does not exist, it is created and chained.
98*/ 99*/
99void push_registry_subtable( lua_State* L, void* key_) 100void push_registry_subtable( lua_State* L, UniqueKey key_)
100{ 101{
101 push_registry_subtable_mode( L, key_, NULL); 102 push_registry_subtable_mode( L, key_, NULL);
102} 103}
@@ -121,15 +122,14 @@ void luaG_pushdeepversion( lua_State* L) { (void) lua_pushliteral( L, "ab8743e5-
121* metatable -> idfunc 122* metatable -> idfunc
122* idfunc -> metatable 123* idfunc -> metatable
123*/ 124*/
124// crc64/we of string "DEEP_LOOKUP_KEY" generated at https://www.nitrxgen.net/hashgen/ 125// crc64/we of string "DEEP_LOOKUP_KEY" generated at http://www.nitrxgen.net/hashgen/
125#define DEEP_LOOKUP_KEY ((void*)0x9fb9b4f3f633d83d) 126static DECLARE_CONST_UNIQUE_KEY( DEEP_LOOKUP_KEY, (void*)0x9fb9b4f3f633d83d);
126
127 127
128/* 128/*
129 * The deep proxy cache is a weak valued table listing all deep UD proxies indexed by the deep UD that they are proxying 129 * The deep proxy cache is a weak valued table listing all deep UD proxies indexed by the deep UD that they are proxying
130 * crc64/we of string "DEEP_PROXY_CACHE_KEY" generated at https://www.nitrxgen.net/hashgen/ 130 * crc64/we of string "DEEP_PROXY_CACHE_KEY" generated at http://www.nitrxgen.net/hashgen/
131*/ 131*/
132#define DEEP_PROXY_CACHE_KEY ((void*)0x05773d6fc26be106) 132static DECLARE_CONST_UNIQUE_KEY( DEEP_PROXY_CACHE_KEY, (void*)0x05773d6fc26be106);
133 133
134/* 134/*
135* Sets up [-1]<->[-2] two-way lookups, and ensures the lookup table exists. 135* Sets up [-1]<->[-2] two-way lookups, and ensures the lookup table exists.
@@ -158,7 +158,7 @@ static void get_deep_lookup( lua_State* L)
158{ 158{
159 STACK_GROW( L, 1); 159 STACK_GROW( L, 1);
160 STACK_CHECK( L); // a 160 STACK_CHECK( L); // a
161 lua_pushlightuserdata( L, DEEP_LOOKUP_KEY); // a DLK 161 push_unique_key( L, DEEP_LOOKUP_KEY); // a DLK
162 lua_rawget( L, LUA_REGISTRYINDEX); // a {} 162 lua_rawget( L, LUA_REGISTRYINDEX); // a {}
163 163
164 if( !lua_isnil( L, -1)) 164 if( !lua_isnil( L, -1))