[jruby-joni] 48/279: Remove two fields from Matcher.

Hideki Yamane henrich at moszumanska.debian.org
Mon Nov 16 11:26:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository jruby-joni.

commit 7c50901380643393014e40fb7dd221991ce4c623
Author: Marcin Mielżyński <lopx at gazeta.pl>
Date:   Wed Jan 7 21:08:05 2009 +0000

    Remove two fields from Matcher.
    
    git-svn-id: http://svn.codehaus.org/jruby/joni/trunk@8634 961051c9-f516-0410-bf72-c9f7e237a7b7
---
 src/org/joni/ByteCodeMachine.java | 20 ++++++++++----------
 src/org/joni/Matcher.java         | 13 +++----------
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index ad5cadb..23abe04 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -335,7 +335,7 @@ class ByteCodeMachine extends StackMachine {
         
         if (n > bestLen) {
             if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
-                if (isFindLongest(option)) {
+                if (isFindLongest(regex.options)) {
                     if (n > msaBestLen) {
                         msaBestLen = n;
                         msaBestS = sstart;
@@ -380,7 +380,7 @@ class ByteCodeMachine extends StackMachine {
         } else {
             Region region = msaRegion;
             if (Config.USE_POSIX_API_REGION_OPTION) {
-                if (!isPosixRegion(option)) {
+                if (!isPosixRegion(regex.options)) {
                     if (region != null) {
                         region.clear();
                     } else {
@@ -401,12 +401,12 @@ class ByteCodeMachine extends StackMachine {
     }
     
     private boolean endBestLength() {
-        if (isFindCondition(option)) {
-            if (isFindNotEmpty(option) && s == sstart) {
+        if (isFindCondition(regex.options)) {
+            if (isFindNotEmpty(regex.options) && s == sstart) {
                 bestLen = -1;
                 {opFail(); return false;} /* for retry */
             }
-            if (isFindLongest(option) && s < range) {
+            if (isFindLongest(regex.options) && s < range) {
                 {opFail(); return false;} /* for retry */
             }
         }
@@ -564,7 +564,7 @@ class ByteCodeMachine extends StackMachine {
         byte[]lowbuf = cfbuf();
         
         value = s;
-        int len = enc.mbcCaseFold(caseFoldFlag, bytes, this, end, lowbuf);
+        int len = enc.mbcCaseFold(regex.caseFoldFlag, bytes, this, end, lowbuf);
         s = value;
         
         if (s > range) {opFail(); return;}
@@ -594,7 +594,7 @@ class ByteCodeMachine extends StackMachine {
             if (s >= range) {opFail(); return;}
             
             value = s;
-            int len = enc.mbcCaseFold(caseFoldFlag, bytes, this, end, lowbuf);
+            int len = enc.mbcCaseFold(regex.caseFoldFlag, bytes, this, end, lowbuf);
             s = value;
             
             if (s > range) {opFail(); return;}
@@ -1187,7 +1187,7 @@ class ByteCodeMachine extends StackMachine {
         sprev = s;
         
         value = s;        
-        if (!stringCmpIC(caseFoldFlag, pstart, this, n, end)) {opFail(); return;}
+        if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) {opFail(); return;}
         s = value;
         
         int len;
@@ -1248,7 +1248,7 @@ class ByteCodeMachine extends StackMachine {
             sprev = s;
 
             value = s;
-            if (!stringCmpIC(caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC
+            if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC
             s = value;
 
             int len;
@@ -1323,7 +1323,7 @@ class ByteCodeMachine extends StackMachine {
         int tlen    = code[ip++];
         
         sprev = s;
-        if (backrefMatchAtNestedLevel(ic != 0, caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit
+        if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit
             int len;
             while (sprev + (len = enc.length(bytes, sprev, end)) < s) sprev += len;
             ip += tlen; // * SIZE_MEMNUM
diff --git a/src/org/joni/Matcher.java b/src/org/joni/Matcher.java
index b55b0b4..1f0a1dd 100644
--- a/src/org/joni/Matcher.java
+++ b/src/org/joni/Matcher.java
@@ -43,10 +43,6 @@ public abstract class Matcher extends IntHolder {
     protected int msaBegin;
     protected int msaEnd;
 
-    // cached values
-    protected final int option;
-    protected final int caseFoldFlag;
-
     public Matcher(Regex regex, byte[]bytes) {
         this(regex, bytes, 0, bytes.length);
     }
@@ -60,9 +56,6 @@ public abstract class Matcher extends IntHolder {
         this.end = end;
 
         this.msaRegion = regex.numMem == 0 ? null : new Region(regex.numMem + 1);
-
-        this.option = regex.options;
-        this.caseFoldFlag = regex.caseFoldFlag;
     }
 
     // main matching method
@@ -114,7 +107,7 @@ public abstract class Matcher extends IntHolder {
     private boolean forwardSearchRange(byte[]bytes, int str, int end, int s, int range, IntHolder lowPrev) {
         int pprev = -1;
         int p = s;
-        
+
         if (Config.DEBUG_SEARCH) {
             Config.log.println("forward_search_range: "+
                                 "str: " + str +
@@ -289,7 +282,7 @@ public abstract class Matcher extends IntHolder {
             if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
                 //range = upperRange;
                 if (matchAt(upperRange, s, prev) != -1) {
-                    if (!isFindLongest(option)) return true;
+                    if (!isFindLongest(regex.options)) return true;
                 }
             } else {
                 //range = upperRange;
@@ -299,7 +292,7 @@ public abstract class Matcher extends IntHolder {
             if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
                 if (matchAt(end, s, prev) != -1) {
                     //range = upperRange;
-                    if (!isFindLongest(option)) return true;
+                    if (!isFindLongest(regex.options)) return true;
                 }
             } else {
                 //range = upperRange;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git



More information about the pkg-java-commits mailing list