@@ -1380,13 +1380,14 @@ static int json_decode(lua_State *l)
13801380
13811381/* ===== INITIALISATION ===== */
13821382
1383- #if !defined(luaL_newlibtable ) \
1384- && (!defined(LUA_VERSION_NUM ) || LUA_VERSION_NUM < 502 )
1383+ #if !defined(LUA_VERSION_NUM ) || LUA_VERSION_NUM < 502
13851384/* Compatibility for Lua 5.1 and older LuaJIT.
13861385 *
1387- * luaL_setfuncs() is used to create a module table where the functions have
1388- * json_config_t as their first upvalue. Code borrowed from Lua 5.2 source. */
1389- static void luaL_setfuncs (lua_State * l , const luaL_Reg * reg , int nup )
1386+ * compat_luaL_setfuncs() is used to create a module table where the functions
1387+ * have json_config_t as their first upvalue. Code borrowed from Lua 5.2
1388+ * source's luaL_setfuncs().
1389+ */
1390+ static void compat_luaL_setfuncs (lua_State * l , const luaL_Reg * reg , int nup )
13901391{
13911392 int i ;
13921393
@@ -1399,6 +1400,8 @@ static void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
13991400 }
14001401 lua_pop (l , nup ); /* remove upvalues */
14011402}
1403+ #else
1404+ #define compat_luaL_setfuncs (L , reg , nup ) luaL_setfuncs(L, reg, nup)
14021405#endif
14031406
14041407/* Call target function in protected mode with all supplied args.
@@ -1479,7 +1482,7 @@ static int lua_cjson_new(lua_State *l)
14791482
14801483 /* Register functions with config data as upvalue */
14811484 json_create_config (l );
1482- luaL_setfuncs (l , reg , 1 );
1485+ compat_luaL_setfuncs (l , reg , 1 );
14831486
14841487 /* Set cjson.null */
14851488 lua_pushlightuserdata (l , NULL );
0 commit comments