[jruby-joni] 02/31: backref opcode cleanup

Hideki Yamane henrich at moszumanska.debian.org
Sat Feb 24 10:44:57 UTC 2018


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 f160ae9ae75f1f7866bba3af8cb23702b673decb
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date:   Sat Jan 27 18:22:56 2018 +0100

    backref opcode cleanup
---
 src/org/joni/ByteCodeMachine.java | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index a64c712..603b9d6 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -1368,24 +1368,17 @@ class ByteCodeMachine extends StackMachine {
     }
 
     private void backref(int mem) {
-        /* if you want to remove following line,
-        you should check in parse and compile time. (numMem) */
         if (mem > regex.numMem || backrefInvalid(mem)) {opFail(); return;}
-
         int pstart = backrefStart(mem);
         int pend = backrefEnd(mem);
-
         int n = pend - pstart;
         if (s + n > range) {opFail(); return;}
         sprev = s;
 
-        // STRING_CMP
-        while(n-- > 0) if (bytes[pstart++] != bytes[s++]) {opFail(); return;}
+        while (n-- > 0) if (bytes[pstart++] != bytes[s++]) {opFail(); return;}
 
-        int len;
-
-        // beyond string check
-        if (sprev < range) {
+        if (sprev < range) { // beyond string check
+            int len;
             while (sprev + (len = enc.length(bytes, sprev, end)) < s) sprev += len;
         }
     }
@@ -1404,13 +1397,9 @@ class ByteCodeMachine extends StackMachine {
 
     private void opBackRefNIC() {
         int mem = code[ip++];
-        /* if you want to remove following line,
-        you should check in parse and compile time. (numMem) */
         if (mem > regex.numMem || backrefInvalid(mem)) {opFail(); return;}
-
         int pstart = backrefStart(mem);
         int pend = backrefEnd(mem);
-
         int n = pend - pstart;
         if (s + n > range) {opFail(); return;}
         sprev = s;

-- 
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