From e71b260a0446cb34eacbd16234691eca41feb9b1 Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Tue, 18 Sep 2012 00:10:23 +0200
Subject: [PATCH] Simplify js_compress() for regular expressions FS#2593

This simplifies a while loop in the js_compress() code. The
functionality of the new code is completely identical to the old code
but it uses less comparisons and according to FS#2593 it is thus a lot
faster.
---
 lib/exe/js.php | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/exe/js.php b/lib/exe/js.php
index 634e21207..42979eeed 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -301,10 +301,8 @@ function js_compress($s){
                 // now move forward and find the end of it
                 $j = 1;
                 while($s{$i+$j} != '/'){
-                    while( ($s{$i+$j} != '\\') && ($s{$i+$j} != '/')){
-                        $j = $j + 1;
-                    }
                     if($s{$i+$j} == '\\') $j = $j + 2;
+                    else $j++;
                 }
                 $result .= substr($s,$i,$j+1);
                 $i = $i + $j + 1;
-- 
GitLab