From eb746e9a050fb8032ac213751ba55f9229213c91 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 14 Mar 2011 17:44:39 +0300 Subject: [PATCH] Small fix. --- CMakeLists.txt | 28 +++++++++++++++++++++++++++- src/html.c | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eda84cd41..35c881206 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OPTION(ENABLE_PROFILING "Enable profiling [default: OFF]" OFF) OPTION(ENABLE_GPERF_TOOLS "Enable google perftools [default: OFF]" OFF) OPTION(ENABLE_STATIC "Enable static compiling [default: OFF]" OFF) +OPTION(ENABLE_LUAJIT "Link with libluajit [default: OFF]" OFF) # Build optimized code for following CPU (default i386) #SET(CPU_TUNE "i686") @@ -185,6 +186,27 @@ ENDIF(ENABLE_PERL MATCHES "ON") INCLUDE(FindLua51) +# Check for luajit +IF(ENABLE_LUAJIT MATCHES "ON") + FIND_LIBRARY(LUAJIT_LIBRARY NAMES luajit51 luajit5.1 luajit-5.1 luajit + HINTS + $ENV{LUA_DIR} + PATH_SUFFIXES lib64 lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + ) + IF(NOT LUAJIT_LIBRARY) + MESSAGE(FATAL_ERROR "Luajit not found but enabled in configuration") + ENDIF(NOT LUAJIT_LIBRARY) +ENDIF(ENABLE_LUAJIT MATCHES "ON") + IF(NOT LUA_FOUND) # Automatic check failed, check passed variable IF(LUA_INCLUDE_DIR) @@ -698,7 +720,11 @@ IF(ENABLE_PERL MATCHES "ON") ENDIF(ENABLE_PERL MATCHES "ON") TARGET_LINK_LIBRARIES(rspamd rspamd_lua) -TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}") +IF(ENABLE_LUAJIT MATCHES "ON") + TARGET_LINK_LIBRARIES(rspamd "${LUAJIT_LIBRARY}") +ELSE(ENABLE_LUAJIT MATCHES "ON") + TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}") +ENDIF(ENABLE_LUAJIT MATCHES "ON") IF(LIBJUDY_LIBRARY) TARGET_LINK_LIBRARIES(rspamd Judy) diff --git a/src/html.c b/src/html.c index e99403a8a..29d535564 100644 --- a/src/html.c +++ b/src/html.c @@ -688,7 +688,7 @@ check_phishing (struct worker_task *task, struct uri *href_url, const gchar *url gint off, rc; p = url_text; - while (len < remain - 1) { + while (len < remain) { if (*p == '<' || *p == '>') { break; } -- 2.39.5