mirror of
https://github.com/rkd77/elinks.git
synced 2025-04-18 00:47:36 -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:
parent
73b115d889
commit
caaa7b3d13
@ -949,6 +949,9 @@ fi
|
|||||||
#
|
#
|
||||||
# After any --enable-utf-8 and --disable-utf-8 options have been
|
# After any --enable-utf-8 and --disable-utf-8 options have been
|
||||||
# handled, a separate section decides whether to actually use TRE.
|
# 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]])
|
AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]])
|
||||||
if test "$with_tre" = no; then
|
if test "$with_tre" = no; then
|
||||||
@ -974,11 +977,11 @@ else
|
|||||||
EL_SAVE_FLAGS
|
EL_SAVE_FLAGS
|
||||||
CFLAGS="$TRE_CFLAGS $CFLAGS"
|
CFLAGS="$TRE_CFLAGS $CFLAGS"
|
||||||
LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict
|
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;
|
[regex_t re;
|
||||||
regmatch_t match[1];
|
regmatch_t match[1];
|
||||||
regwcomp(&re, L"zap", REG_ICASE);
|
tre_regwcomp(&re, L"zap", REG_ICASE);
|
||||||
regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
|
tre_regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
|
||||||
[AC_MSG_RESULT([[yes]])
|
[AC_MSG_RESULT([[yes]])
|
||||||
tre_log="available"],
|
tre_log="available"],
|
||||||
[AC_MSG_RESULT([[no]])
|
[AC_MSG_RESULT([[no]])
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef CONFIG_TRE
|
#ifdef CONFIG_TRE
|
||||||
#include <tre/regex.h>
|
#include <tre/tre.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "elinks.h"
|
#include "elinks.h"
|
||||||
@ -55,13 +55,13 @@ static INIT_INPUT_HISTORY(search_history);
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
#define UCHAR unicode_val_T
|
#define UCHAR unicode_val_T
|
||||||
#define PATTERN const wchar_t
|
#define PATTERN const wchar_t
|
||||||
#define Regcomp regwcomp
|
#define Regcomp tre_regwcomp
|
||||||
#define Regexec regwexec
|
#define Regexec tre_regwexec
|
||||||
#else
|
#else
|
||||||
#define UCHAR unsigned char
|
#define UCHAR unsigned char
|
||||||
#define PATTERN const char
|
#define PATTERN const char
|
||||||
#define Regcomp regcomp
|
#define Regcomp tre_regcomp
|
||||||
#define Regexec regexec
|
#define Regexec tre_regexec
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static UCHAR *memacpy_u(unsigned char *text, int textlen, int utf8);
|
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);
|
reg_err = Regcomp(regex, (PATTERN *)pattern, regex_flags);
|
||||||
if (reg_err) {
|
if (reg_err) {
|
||||||
regfree(regex);
|
tre_regfree(regex);
|
||||||
return 0;
|
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 ? */
|
/* Where and how should we display the error dialog ? */
|
||||||
unsigned char regerror_string[MAX_STR_LEN];
|
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
|
#endif
|
||||||
common_ctx->found = -2;
|
common_ctx->found = -2;
|
||||||
return;
|
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);
|
doc = get_search_region_from_search_nodes(common_ctx->s1, common_ctx->s2, common_ctx->textlen, &doclen);
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
regfree(®ex);
|
tre_regfree(®ex);
|
||||||
common_ctx->found = doclen;
|
common_ctx->found = doclen;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ find_next:
|
|||||||
goto find_next;
|
goto find_next;
|
||||||
|
|
||||||
free_stuff:
|
free_stuff:
|
||||||
regfree(®ex);
|
tre_regfree(®ex);
|
||||||
mem_free(doc);
|
mem_free(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user