lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [2/2] git commit: refs/heads/ivars-wip1 - Fixup Lucy C bindings IVARS glitches.
Date Sun, 14 Jul 2013 12:14:56 GMT
Fixup Lucy C bindings IVARS glitches.

(Will be folded into earlier commit before merging to master.)


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/422a8a24
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/422a8a24
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/422a8a24

Branch: refs/heads/ivars-wip1
Commit: 422a8a249631665c1308b045bf1d57a333de326d
Parents: 2de870a
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Jul 14 14:12:23 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sun Jul 14 14:12:23 2013 +0200

----------------------------------------------------------------------
 c/src/Lucy/Analysis/RegexTokenizer.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/422a8a24/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index e2e5277..4b2bfe6 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -46,15 +46,16 @@ RegexTokenizer_is_available(void) {
 RegexTokenizer*
 RegexTokenizer_init(RegexTokenizer *self, const CharBuf *pattern) {
     Analyzer_init((Analyzer*)self);
+    RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self);
 
     const char *pattern_ptr;
     if (pattern) {
-        self->pattern = CB_Clone(pattern);
-        pattern_ptr = (char*)CB_Get_Ptr8(self->pattern);
+        ivars->pattern = CB_Clone(pattern);
+        pattern_ptr = (char*)CB_Get_Ptr8(ivars->pattern);
     }
     else {
         pattern_ptr = "\\w+(?:['\\x{2019}]\\w+)*";
-        self->pattern
+        ivars->pattern
             = CB_new_from_trusted_utf8(pattern_ptr, strlen(pattern_ptr));
     }
 
@@ -76,7 +77,7 @@ RegexTokenizer_init(RegexTokenizer *self, const CharBuf *pattern) {
 
     // TODO: Check whether pcre_study improves performance
 
-    self->token_re = re;
+    ivars->token_re = re;
 
     return self;
 }
@@ -90,8 +91,9 @@ RegexTokenizer_set_token_re(RegexTokenizer *self, void *token_re) {
 
 void
 RegexTokenizer_destroy(RegexTokenizer *self) {
-    DECREF(self->pattern);
-    pcre *re = (pcre*)self->token_re;
+    RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self);
+    DECREF(ivars->pattern);
+    pcre *re = (pcre*)ivars->token_re;
     if (re) {
         pcre_free(re);
     }
@@ -102,7 +104,8 @@ void
 RegexTokenizer_tokenize_str(RegexTokenizer *self,
                                  const char *string, size_t string_len,
                                  Inversion *inversion) {
-    pcre      *re          = (pcre*)self->token_re;
+    RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self);
+    pcre      *re          = (pcre*)ivars->token_re;
     int        byte_offset = 0;
     uint32_t   cp_offset   = 0; // Code points
     int        options     = PCRE_NO_UTF8_CHECK;


Mime
View raw message