diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-03-20 16:23:54 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-03-20 16:23:54 +0100 |
commit | 6556cc558f0602cc99b1a8d1c7212b2e91490cdc (patch) | |
tree | 1763ed796df57a39432f045eccb8d80b2ec02a93 /src/deep.h | |
parent | 0b516e9490b51bdd15c347fcda35b5dbb06b4829 (diff) | |
download | lanes-6556cc558f0602cc99b1a8d1c7212b2e91490cdc.tar.gz lanes-6556cc558f0602cc99b1a8d1c7212b2e91490cdc.tar.bz2 lanes-6556cc558f0602cc99b1a8d1c7212b2e91490cdc.zip |
C++ migration: UniqueKey
Diffstat (limited to 'src/deep.h')
-rw-r--r-- | src/deep.h | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -42,18 +42,17 @@ typedef void* (*luaG_IdFunction)( lua_State* L, DeepOp op_); | |||
42 | // ################################################################################################ | 42 | // ################################################################################################ |
43 | 43 | ||
44 | // fnv164 of string "DEEP_VERSION_2" generated at https://www.pelock.com/products/hash-calculator | 44 | // fnv164 of string "DEEP_VERSION_2" generated at https://www.pelock.com/products/hash-calculator |
45 | static DECLARE_CONST_UNIQUE_KEY( DEEP_VERSION, 0xB4B0119C10642B29); | 45 | static constexpr UniqueKey DEEP_VERSION{ 0xB4B0119C10642B29ull }; |
46 | 46 | ||
47 | // should be used as header for full userdata | 47 | // should be used as header for full userdata |
48 | struct s_DeepPrelude | 48 | struct DeepPrelude |
49 | { | 49 | { |
50 | DECLARE_UNIQUE_KEY( magic); // must be filled by the Deep userdata idfunc that allocates it on eDO_new operation | 50 | UniqueKey const magic{ DEEP_VERSION }; |
51 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc | 51 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc |
52 | luaG_IdFunction idfunc; | 52 | luaG_IdFunction idfunc { nullptr }; |
53 | // data is destroyed when refcount is 0 | 53 | // data is destroyed when refcount is 0 |
54 | volatile int refcount; | 54 | volatile int refcount{ 0 }; |
55 | }; | 55 | }; |
56 | typedef struct s_DeepPrelude DeepPrelude; | ||
57 | 56 | ||
58 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_); | 57 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_); |
59 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); | 58 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); |