Changeset 41633
- Timestamp:
- 09/28/2017 01:58:23 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Text/Diff/Engine/native.php
r24362 r41633 19 19 * code was written by him, and is used/adapted with his permission. 20 20 * 21 * Copyright 2004-201 0 The Horde Project(http://www.horde.org/)21 * Copyright 2004-2017 Horde LLC (http://www.horde.org/) 22 22 * 23 23 * See the enclosed file COPYING for license information (LGPL). If you did 24 * not receive this file, see http:// opensource.org/licenses/lgpl-license.php.24 * not receive this file, see http://www.horde.org/licenses/lgpl21. 25 25 * 26 26 * @author Geoffrey T. Dairiki <dairiki@dairiki.org> … … 190 190 } 191 191 $matches = $ymatches[$line]; 192 reset($matches); 193 while (list(, $y) = each($matches)) { 192 foreach ($matches as $y) { 194 193 if (empty($this->in_seq[$y])) { 195 194 $k = $this->_lcsPos($y); … … 197 196 $ymids[$k] = $ymids[$k - 1]; 198 197 break; 199 } 200 } 201 while (list(, $y) = each($matches)) { 202 if ($y > $this->seq[$k - 1]) { 198 } elseif ($y > $this->seq[$k - 1]) { 203 199 assert($y <= $this->seq[$k]); 204 /* Optimization: this is a common case: next match is205 * just replacing previous match. */206 200 $this->in_seq[$this->seq[$k]] = false; 207 201 $this->seq[$k] = $y; 208 202 $this->in_seq[$y] = 1; 209 } elseif (empty($this->in_seq[$y])) {210 $k = $this->_lcsPos($y);211 assert($k > 0);212 $ymids[$k] = $ymids[$k - 1];213 203 } 214 204 } … … 331 321 $j = 0; 332 322 333 assert( 'count($lines) == count($changed)');323 assert(count($lines) == count($changed)); 334 324 $len = count($lines); 335 325 $other_len = count($other_changed); … … 352 342 353 343 while ($i < $len && ! $changed[$i]) { 354 assert( '$j < $other_len && ! $other_changed[$j]');344 assert($j < $other_len && ! $other_changed[$j]); 355 345 $i++; $j++; 356 346 while ($j < $other_len && $other_changed[$j]) { … … 384 374 $start--; 385 375 } 386 assert( '$j > 0');376 assert($j > 0); 387 377 while ($other_changed[--$j]) { 388 378 continue; 389 379 } 390 assert( '$j >= 0 && !$other_changed[$j]');380 assert($j >= 0 && !$other_changed[$j]); 391 381 } 392 382 … … 409 399 } 410 400 411 assert( '$j < $other_len && ! $other_changed[$j]');401 assert($j < $other_len && ! $other_changed[$j]); 412 402 $j++; 413 403 if ($j < $other_len && $other_changed[$j]) { … … 425 415 $changed[--$start] = 1; 426 416 $changed[--$i] = 0; 427 assert( '$j > 0');417 assert($j > 0); 428 418 while ($other_changed[--$j]) { 429 419 continue; 430 420 } 431 assert( '$j >= 0 && !$other_changed[$j]');421 assert($j >= 0 && !$other_changed[$j]); 432 422 } 433 423 }
Note: See TracChangeset
for help on using the changeset viewer.