You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/05/07 00:02:00 UTC
[lucy-commits] git commit: refs/heads/master - Compatibility with older PCRE versions
Updated Branches:
refs/heads/master 16051063a -> 8feab195e
Compatibility with older PCRE versions
PCRE_BSR_UNICODE is available since 7.4 and PCRE_NEWLINE_LF since 6.7.
Both options aren't critical, so only use them if they're supported.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8feab195
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8feab195
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8feab195
Branch: refs/heads/master
Commit: 8feab195edef68133ed81bee055c4317f2eb6c1c
Parents: 1605106
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 6 23:56:03 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 6 23:56:03 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Analysis/RegexTokenizer.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/8feab195/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index 2e2ebfc..add76f2 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -57,10 +57,15 @@ RegexTokenizer_init(RegexTokenizer *self, const CharBuf *pattern) {
= CB_new_from_trusted_utf8(pattern_ptr, strlen(pattern_ptr));
}
- int options = PCRE_BSR_UNICODE
- | PCRE_NEWLINE_LF
- | PCRE_UTF8
- | PCRE_NO_UTF8_CHECK;
+ int options = PCRE_UTF8 | PCRE_NO_UTF8_CHECK;
+#ifdef PCRE_BSR_UNICODE
+ // Available since PCRE 7.4
+ options |= PCRE_BSR_UNICODE;
+#endif
+#ifdef PCRE_NEWLINE_LF
+ // Available since PCRE 6.7
+ options |= PCRE_NEWLINE_LF;
+#endif
const char *err_ptr;
int err_offset;
pcre *re = pcre_compile(pattern_ptr, options, &err_ptr, &err_offset, NULL);