]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
lua: move lua includes to util-lua.h
authorJason Ish <jason.ish@oisf.net>
Wed, 22 Sep 2021 01:54:03 +0000 (19:54 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 22 Sep 2021 01:54:03 +0000 (19:54 -0600)
Moves Lua includes to util-lua.h instead of suricata-common
so plugins (or library users) don't need to be aware of the
Lua that Suricata was built with. Instead only source files
that need to be Lua aware can include util-lua.h.

src/detect-lua.h
src/rust.h
src/suricata-common.h
src/util-lua.h

index 8f275c311d97d6c8828a79d0f957ac909eb63c61..5faa9241e608bc332fac9903a5d42b12568465df 100644 (file)
@@ -26,6 +26,8 @@
 
 #ifdef HAVE_LUA
 
+#include "util-lua.h"
+
 typedef struct DetectLuaThreadData {
     lua_State *luastate;
     uint32_t flags;
index b0b94f7f41647a67ab8595f52c82f96f4fa77987..6888460039ea8741f23e9b9e7fc3afdbf87d5882 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef __RUST_H__
 #define __RUST_H__
 
+#include "util-lua.h"
 #include "rust-context.h"
 #include "rust-bindings.h"
 
index 8e8964ec6e67c0808d3094964cde4a76ff6833d1..ff813c39262bd5d2a01cb3a0f50f84bd11b30c81 100644 (file)
@@ -503,16 +503,6 @@ typedef enum {
 #include "util-path.h"
 #include "util-conf.h"
 
-#ifdef HAVE_LUA
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-#else
-/* If we don't have Lua, create a typedef for lua_State so the
- * exported Lua functions don't fail the build. */
-typedef void lua_State;
-#endif
-
 #ifndef HAVE_STRLCAT
 size_t strlcat(char *, const char *src, size_t siz);
 #endif
index d6a9838cd8968e16418e22ad4cb15d3d37eba0dd..7d655a6aab57c926e436c6ab564c3b8f54fcec89 100644 (file)
 #ifndef __UTIL_LUA_H__
 #define __UTIL_LUA_H__
 
-#ifdef HAVE_LUA
+#ifndef HAVE_LUA
+
+/* If we don't have Lua, create a typedef for lua_State so the
+ * exported Lua functions don't fail the build. */
+typedef void lua_State;
+
+#else
+
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
 
 #include "util-luajit.h"