From a77dc54f876845ebeba1a0280be00e0f81ac6c1e Mon Sep 17 00:00:00 2001 From: Arvydas Sidorenko Date: Thu, 7 Jun 2012 07:38:10 +0200 Subject: [PATCH] Unnecessary #define's to static inline functions Signed-off-by: Arvydas Sidorenko --- common/lualib.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/lualib.h b/common/lualib.h index 7226bac2..6173f8df 100644 --- a/common/lualib.h +++ b/common/lualib.h @@ -28,11 +28,17 @@ /** Lua function to call on dofuction() error */ lua_CFunction lualib_dofunction_on_error; -#define luaA_checkfunction(L, n) \ - do { \ - if(!lua_isfunction(L, n)) \ - luaL_typerror(L, n, "function"); \ - } while(0) +static inline void luaA_checkfunction(lua_State *L, int idx) +{ + if(!lua_isfunction(L, idx)) + luaL_typerror(L, idx, "function"); +} + +static inline void luaA_checktable(lua_State *L, int idx) +{ + if(!lua_istable(L, idx)) + luaL_typerror(L, idx, "table"); +} /** Dump the Lua stack. Useful for debugging. * \param L The Lua VM state. @@ -115,12 +121,6 @@ luaA_dofunction(lua_State *L, int nargs, int nret) return true; } -#define luaA_checktable(L, n) \ - do { \ - if(!lua_istable(L, n)) \ - luaL_typerror(L, n, "table"); \ - } while(0) - #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80