summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-21 15:09:41 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-21 15:09:41 +0100
commitdfa2058809eb7277b54ced933e7f67dfd8d1dcb6 (patch)
tree99e8234e19321d49b78d7b6612426ad988ff3d47 /src/lua
parent77cc81109229474ccb90fdcfa76569fd7611d921 (diff)
downloadrspamd-dfa2058809eb7277b54ced933e7f67dfd8d1dcb6.tar.gz
rspamd-dfa2058809eb7277b54ced933e7f67dfd8d1dcb6.zip
[Minor] Try to fix moonjit compatibility
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 737c4b817..27f691a4c 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -8,6 +8,10 @@
#include <lualib.h>
#include <stdbool.h>
+#ifdef WITH_LUAJIT
+#include <luajit.h>
+#endif
+
#include "rspamd.h"
#include "ucl.h"
#include "lua_ucl.h"
@@ -41,11 +45,15 @@ luaL_register (lua_State *L, const gchar *name, const struct luaL_reg *methods)
#endif
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM == 501
+
+#ifndef MOONJIT_VERSION
static inline int lua_absindex (lua_State *L, int i) {
if (i < 0 && i > LUA_REGISTRYINDEX)
i += lua_gettop(L) + 1;
return i;
}
+#endif
+
static inline int lua_rawgetp (lua_State *L, int i, const void *p) {
int abs_i = lua_absindex(L, i);
lua_pushlightuserdata(L, (void*)p);