* remove function_exists calls for things that functions that always
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 184d1fc..b13c726 100644 (file)
@@ -9,8 +9,6 @@
 // You may copy this code freely under the conditions of the GPL.
 //
 
-define('USE_ASSERTS', function_exists('assert'));
-
 /**
  * @todo document
  * @private
@@ -153,8 +151,8 @@ class _DiffEngine {
                $edits = array();
                $xi = $yi = 0;
                while ($xi < $n_from || $yi < $n_to) {
-                       USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
-                       USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
+                       assert($yi < $n_to || $this->xchanged[$xi]);
+                       assert($xi < $n_from || $this->ychanged[$yi]);
 
                        // Skip matching "snake".
                        $copy = array();
@@ -316,13 +314,13 @@ class _DiffEngine {
                                while (list ($junk, $y) = each($matches))
                                if (empty($this->in_seq[$y])) {
                                        $k = $this->_lcs_pos($y);
-                                       USE_ASSERTS && assert($k > 0);
+                                       assert($k > 0);
                                        $ymids[$k] = $ymids[$k-1];
                                        break;
                                }
                                while (list ( /* $junk */, $y) = each($matches)) {
                                        if ($y > $this->seq[$k-1]) {
-                                               USE_ASSERTS && assert($y < $this->seq[$k]);
+                                               assert($y < $this->seq[$k]);
                                                // Optimization: this is a common case:
                                                //      next match is just replacing previous match.
                                                $this->in_seq[$this->seq[$k]] = false;
@@ -330,7 +328,7 @@ class _DiffEngine {
                                                $this->in_seq[$y] = 1;
                                        } else if (empty($this->in_seq[$y])) {
                                                $k = $this->_lcs_pos($y);
-                                               USE_ASSERTS && assert($k > 0);
+                                               assert($k > 0);
                                                $ymids[$k] = $ymids[$k-1];
                                        }
                                }
@@ -366,7 +364,7 @@ class _DiffEngine {
                        $end = $mid;
                }
 
-               USE_ASSERTS && assert($ypos != $this->seq[$end]);
+               assert($ypos != $this->seq[$end]);
 
                $this->in_seq[$this->seq[$end]] = false;
                $this->seq[$end] = $ypos;
@@ -446,7 +444,7 @@ class _DiffEngine {
                $i = 0;
                $j = 0;
 
-               USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
+               assert('sizeof($lines) == sizeof($changed)');
                $len = sizeof($lines);
                $other_len = sizeof($other_changed);
 
@@ -466,7 +464,7 @@ class _DiffEngine {
                        $j++;
 
                        while ($i < $len && ! $changed[$i]) {
-                               USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
+                               assert('$j < $other_len && ! $other_changed[$j]');
                                $i++; $j++;
                                while ($j < $other_len && $other_changed[$j])
                                $j++;
@@ -498,10 +496,10 @@ class _DiffEngine {
                                        $changed[--$i] = false;
                                        while ($start > 0 && $changed[$start - 1])
                                        $start--;
-                                       USE_ASSERTS && assert('$j > 0');
+                                       assert('$j > 0');
                                        while ($other_changed[--$j])
                                        continue;
-                                       USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
+                                       assert('$j >= 0 && !$other_changed[$j]');
                                }
 
                                /*
@@ -524,7 +522,7 @@ class _DiffEngine {
                                        while ($i < $len && $changed[$i])
                                        $i++;
 
-                                       USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
+                                       assert('$j < $other_len && ! $other_changed[$j]');
                                        $j++;
                                        if ($j < $other_len && $other_changed[$j]) {
                                                $corresponding = $i;
@@ -541,10 +539,10 @@ class _DiffEngine {
                        while ($corresponding < $i) {
                                $changed[--$start] = 1;
                                $changed[--$i] = 0;
-                               USE_ASSERTS && assert('$j > 0');
+                               assert('$j > 0');
                                while ($other_changed[--$j])
                                continue;
-                               USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
+                               assert('$j >= 0 && !$other_changed[$j]');
                        }
                }
                wfProfileOut( __METHOD__ );