From 565c37fca091c01a296179722b2abc3a3420a94a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 28 May 2016 18:42:45 +0100 Subject: [PATCH] [Fix] Link lpeg to rspamd lua library --- CMakeLists.txt | 1 + contrib/lpeg/lptree.c | 4 +--- contrib/lpeg/lptree.h | 6 +++--- src/lua/lua_common.c | 2 ++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19da2632d..219fdce41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -486,6 +486,7 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/contrib/librdns" "${CMAKE_SOURCE_DIR}/contrib/aho-corasick" "${CMAKE_SOURCE_DIR}/contrib/lc-btrie" + "${CMAKE_SOURCE_DIR}/contrib/lpeg" "${CMAKE_BINARY_DIR}/src" #Stored in the binary dir "${CMAKE_BINARY_DIR}/src/libcryptobox") diff --git a/contrib/lpeg/lptree.c b/contrib/lpeg/lptree.c index ac5f51503..bc82ae8da 100644 --- a/contrib/lpeg/lptree.c +++ b/contrib/lpeg/lptree.c @@ -21,7 +21,7 @@ /* number of siblings for each tree */ const byte numsiblings[] = { 0, 0, 0, /* char, set, any */ - 0, 0, /* true, false */ + 0, 0, /* true, false */ 1, /* rep */ 2, 2, /* seq, choice */ 1, 1, /* not, and */ @@ -1280,8 +1280,6 @@ static struct luaL_Reg metareg[] = { {NULL, NULL} }; - -int luaopen_lpeg (lua_State *L); int luaopen_lpeg (lua_State *L) { luaL_newmetatable(L, PATTERN_T); lua_pushnumber(L, MAXBACK); /* initialize maximum backtracking */ diff --git a/contrib/lpeg/lptree.h b/contrib/lpeg/lptree.h index b69528a6f..38a668e9f 100644 --- a/contrib/lpeg/lptree.h +++ b/contrib/lpeg/lptree.h @@ -1,4 +1,4 @@ -/* +/* ** $Id: lptree.h,v 1.2 2013/03/24 13:51:12 roberto Exp $ */ @@ -6,7 +6,7 @@ #define lptree_h -#include "lptypes.h" +#include "lptypes.h" /* @@ -69,7 +69,7 @@ extern const byte numsiblings[]; #define sib2(t) ((t) + (t)->u.ps) - +int luaopen_lpeg (lua_State *L); diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index ad77b0602..4c5051aeb 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -15,6 +15,7 @@ */ #include "lua_common.h" #include "lua/global_functions.lua.h" +#include "lptree.h" /* Lua module init function */ #define MODULE_INIT_FUNC "module_init" @@ -242,6 +243,7 @@ rspamd_lua_init () luaopen_fann (L); luaopen_sqlite3 (L); luaopen_cryptobox (L); + luaopen_lpeg (L); rspamd_lua_add_preload (L, "ucl", luaopen_ucl); -- 2.39.5