1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-24 16:24:40 -04:00

Force tre-0.8.0 or higher.

Functions in the tre-0.8.0 have the "tre_" prefix.
They won't collide with Perl.
This commit is contained in:
Witold Filipczyk 2009-11-28 15:45:24 +01:00 committed by Witold Filipczyk
parent 73b115d889
commit caaa7b3d13
2 changed files with 15 additions and 12 deletions

View File

@ -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 <tre/regex.h>],
AC_TRY_LINK([#include <tre/tre.h>],
[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]])

View File

@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef CONFIG_TRE
#include <tre/regex.h>
#include <tre/tre.h>
#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, &regex, regerror_string, sizeof(regerror_string));
tre_regerror(reg_err, &regex, 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(&regex);
tre_regfree(&regex);
common_ctx->found = doclen;
return;
}
@ -418,7 +418,7 @@ find_next:
goto find_next;
free_stuff:
regfree(&regex);
tre_regfree(&regex);
mem_free(doc);
}