diff --git a/configure.in b/configure.in index 08c4bbc1..f717cbe2 100644 --- a/configure.in +++ b/configure.in @@ -949,6 +949,9 @@ fi # # After any --enable-utf-8 and --disable-utf-8 options have been # handled, a separate section decides whether to actually use TRE. +# +# tre version 0.8.0 or higher is required which have the "tre_" prefix +# for functions. AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]]) if test "$with_tre" = no; then @@ -974,11 +977,11 @@ else EL_SAVE_FLAGS CFLAGS="$TRE_CFLAGS $CFLAGS" LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict - AC_TRY_LINK([#include ], + AC_TRY_LINK([#include ], [regex_t re; regmatch_t match[1]; - regwcomp(&re, L"zap", REG_ICASE); - regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);], + tre_regwcomp(&re, L"zap", REG_ICASE); + tre_regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);], [AC_MSG_RESULT([[yes]]) tre_log="available"], [AC_MSG_RESULT([[no]]) diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index dd264800..cfa39982 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -19,7 +19,7 @@ #include #include #ifdef CONFIG_TRE -#include +#include #endif #include "elinks.h" @@ -55,13 +55,13 @@ static INIT_INPUT_HISTORY(search_history); #ifdef CONFIG_UTF8 #define UCHAR unicode_val_T #define PATTERN const wchar_t -#define Regcomp regwcomp -#define Regexec regwexec +#define Regcomp tre_regwcomp +#define Regexec tre_regwexec #else #define UCHAR unsigned char #define PATTERN const char -#define Regcomp regcomp -#define Regexec regexec +#define Regcomp tre_regcomp +#define Regexec tre_regexec #endif static UCHAR *memacpy_u(unsigned char *text, int textlen, int utf8); @@ -337,7 +337,7 @@ init_regex(regex_t *regex, UCHAR *pattern) reg_err = Regcomp(regex, (PATTERN *)pattern, regex_flags); if (reg_err) { - regfree(regex); + tre_regfree(regex); return 0; } @@ -366,7 +366,7 @@ search_for_pattern(struct regex_match_context *common_ctx, void *data, /* Where and how should we display the error dialog ? */ unsigned char regerror_string[MAX_STR_LEN]; - regerror(reg_err, ®ex, regerror_string, sizeof(regerror_string)); + tre_regerror(reg_err, ®ex, regerror_string, sizeof(regerror_string)); #endif common_ctx->found = -2; return; @@ -374,7 +374,7 @@ search_for_pattern(struct regex_match_context *common_ctx, void *data, doc = get_search_region_from_search_nodes(common_ctx->s1, common_ctx->s2, common_ctx->textlen, &doclen); if (!doc) { - regfree(®ex); + tre_regfree(®ex); common_ctx->found = doclen; return; } @@ -418,7 +418,7 @@ find_next: goto find_next; free_stuff: - regfree(®ex); + tre_regfree(®ex); mem_free(doc); }