From eec92f309d2b0c24946e0aebffabd80a91594840 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 21 Nov 2016 14:29:36 +0100 Subject: Fix 64 bits compilation warnings --- src/compat.h | 1 + src/keeper.c | 4 ++-- src/keeper.h | 6 +++--- src/lanes.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compat.h b/src/compat.h index 6048974..998edef 100644 --- a/src/compat.h +++ b/src/compat.h @@ -43,6 +43,7 @@ void luaL_requiref (lua_State* L, const char* modname, lua_CFunction openf, int #endif // lua_lessthan #define luaG_registerlibfuncs( L, _funcs) luaL_setfuncs( L, _funcs, 0) #define lua503_dump lua_dump +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) #endif // LUA_VERSION_NUM == 503 #endif // __COMPAT_H__ diff --git a/src/keeper.c b/src/keeper.c index ea061ce..ef0bacf 100644 --- a/src/keeper.c +++ b/src/keeper.c @@ -183,7 +183,7 @@ static void push_table( lua_State* L, int idx_) STACK_END( L, 1); } -int keeper_push_linda_storage( struct s_Universe* U, lua_State* L, void* ptr_, unsigned long magic_) +int keeper_push_linda_storage( struct s_Universe* U, lua_State* L, void* ptr_, ptrdiff_t magic_) { struct s_Keeper* const K = keeper_acquire( U->keepers, magic_); lua_State* const KL = K ? K->L : NULL; @@ -717,7 +717,7 @@ void init_keepers( struct s_Universe* U, lua_State* L) STACK_END( L, 0); } -struct s_Keeper* keeper_acquire( struct s_Keepers* keepers_, unsigned long magic_) +struct s_Keeper* keeper_acquire( struct s_Keepers* keepers_, ptrdiff_t magic_) { int const nbKeepers = keepers_->nb_keepers; // can be 0 if this happens during main state shutdown (lanes is being GC'ed -> no keepers) diff --git a/src/keeper.h b/src/keeper.h index 6ca4ad4..7dbbc16 100644 --- a/src/keeper.h +++ b/src/keeper.h @@ -17,11 +17,11 @@ struct s_Keepers void init_keepers( struct s_Universe* U, lua_State* L); void close_keepers( struct s_Universe* U, lua_State* L); -struct s_Keeper* keeper_acquire( struct s_Keepers* keepers_, unsigned long magic_); +struct s_Keeper* keeper_acquire( struct s_Keepers* keepers_, ptrdiff_t magic_); #define KEEPER_MAGIC_SHIFT 3 void keeper_release( struct s_Keeper* K); -void keeper_toggle_nil_sentinels( lua_State* L, int _val_i, enum eLookupMode const mode_); -int keeper_push_linda_storage( struct s_Universe* U, lua_State* L, void* ptr, unsigned long magic_); +void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, enum eLookupMode const mode_); +int keeper_push_linda_storage( struct s_Universe* U, lua_State* L, void* ptr_, ptrdiff_t magic_); #define NIL_SENTINEL ((void*)keeper_toggle_nil_sentinels) diff --git a/src/lanes.c b/src/lanes.c index 2cb1af8..ef08e3a 100644 --- a/src/lanes.c +++ b/src/lanes.c @@ -413,11 +413,11 @@ struct s_Linda SIGNAL_T read_happened; SIGNAL_T write_happened; struct s_Universe* U; // the universe this linda belongs to + ptrdiff_t group; // a group to control keeper allocation between lindas enum e_cancel_request simulate_cancel; - unsigned long group; // a group to control keeper allocation between lindas char name[1]; }; -#define LINDA_KEEPER_HASHSEED( linda) (linda->group ? linda->group : (unsigned long)linda) +#define LINDA_KEEPER_HASHSEED( linda) (linda->group ? linda->group : (ptrdiff_t)linda) static void* linda_id( lua_State*, enum eDeepOp); -- cgit v1.2.3-55-g6feb