]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] More Lua 5.4 compatibility
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 3 Mar 2021 17:17:46 +0000 (17:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 3 Mar 2021 17:17:46 +0000 (17:17 +0000)
Issue: #3656

src/lua/lua_thread_pool.c
test/rspamd_lua_pcall_vs_resume_test.c

index 1fa584c51ac17c4781a7cf01a06c379f09f23f78..8220bb3ffcb098ed5b3811a7d9a07bb2c8b36c64 100644 (file)
@@ -239,7 +239,11 @@ lua_do_resume_full (lua_State *L, gint narg, const gchar *loc)
 #if LUA_VERSION_NUM < 502
        return lua_resume (L, narg);
 #else
+       #if LUA_VERSION_NUM >= 504
+       return lua_resume (L, from, nargs, NULL);
+       #else
        return lua_resume (L, NULL, narg);
+       #endif
 #endif
 }
 
index eb945b92fade7bbb89577af60beb8f5e2f2dc7bf..c06283de11246992cf98e04eed149559e4b7f8b0 100644 (file)
@@ -56,6 +56,8 @@ test_resume(lua_State *L, gint function_call)
                lua_rawgeti (L, LUA_REGISTRYINDEX, function_call);
 #if LUA_VERSION_NUM < 502
                lua_resume (L, 0);
+#elif LUA_VERSION_NUM >= 504
+               lua_resume (L, NULL, 0, NULL);
 #else
                lua_resume (L, NULL, 0);
 #endif
@@ -82,6 +84,8 @@ test_resume_get_thread(gint function_call)
                lua_rawgeti (ent->lua_state, LUA_REGISTRYINDEX, function_call);
 #if LUA_VERSION_NUM < 502
                lua_resume (ent->lua_state, 0);
+#elif LUA_VERSION_NUM >= 504
+               lua_resume (ent->lua_state, NULL, 0, NULL);
 #else
                lua_resume (ent->lua_state, NULL, 0);
 #endif
@@ -110,6 +114,8 @@ test_resume_get_new_thread(gint function_call)
                lua_rawgeti (ent->lua_state, LUA_REGISTRYINDEX, function_call);
 #if LUA_VERSION_NUM < 502
                lua_resume (ent->lua_state, 0);
+#elif LUA_VERSION_NUM >= 504
+               lua_resume (ent->lua_state, NULL, 0, NULL);
 #else
                lua_resume (ent->lua_state, NULL, 0);
 #endif