From 8f7623339beb1ba07a41a016fa0a1507da92a03e Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 16 Jan 2019 17:11:04 +0100 Subject: Remove useless magic number check This check is now deprecated since it complicates the mechanism and is not needed. If the retrieved struct isn't a good pointer then you got a bigger problem and that should fail then. Change-Id: If14b766ad3c96568625209043a6658fc8f17dc5f Signed-off-by: Romain Forlot --- ctl-lib/ctl-lua.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c index 37db05c..e290ec1 100644 --- a/ctl-lib/ctl-lua.c +++ b/ctl-lib/ctl-lua.c @@ -48,12 +48,6 @@ static int CTX_MAGIC = CTX_MAGIC_VALUE; static int CTX_MAGIC; #endif -#if TIMER_MAGIC_VALUE -static int TIMER_MAGIC = TIMER_MAGIC_VALUE; -#else -static int TIMER_MAGIC; -#endif - typedef struct { char *name; int count; @@ -1017,7 +1011,7 @@ static TimerHandleT *LuaTimerPop(lua_State *luaState, int index) { luaL_checktype(luaState, index, LUA_TLIGHTUSERDATA); timerHandle = (TimerHandleT *) lua_touserdata(luaState, index); - if (timerHandle == NULL && timerHandle->magic != TIMER_MAGIC) { + if (timerHandle == NULL) { luaL_error(luaState, "Invalid source handle"); fprintf(stderr, "LuaSourcePop error retrieving afbSource"); return NULL; @@ -1156,7 +1150,6 @@ static int LuaTimerSet(lua_State* luaState) { // everything look fine create timer structure TimerHandleT *timerHandle = malloc(sizeof (TimerHandleT)); - timerHandle->magic = TIMER_MAGIC; timerHandle->delay = delay; timerHandle->count = count; timerHandle->uid = uid; -- cgit 1.2.3-korg