r102591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102590‎ | r102591 | r102592 >
Date:22:59, 9 November 2011
Author:aaron
Status:ok
Tags:
Comment:
Reverted r101244 changes - these are not equivalent and may have been causing the assertion failures people (timo, myself) were getting.
Modified paths:
  • /trunk/phase3/includes/diff/DairikiDiff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DairikiDiff.php
@@ -371,7 +371,7 @@
372372 }
373373 $matches = $ymatches[$line];
374374 reset( $matches );
375 - foreach ( $matches as $y ) {
 375+ while ( list( , $y ) = each( $matches ) ) {
376376 if ( empty( $this->in_seq[$y] ) ) {
377377 $k = $this->_lcs_pos( $y );
378378 assert( $k > 0 );
@@ -379,7 +379,7 @@
380380 break;
381381 }
382382 }
383 - foreach ( $matches as $y ) {
 383+ while ( list ( , $y ) = each( $matches ) ) {
384384 if ( $y > $this->seq[$k -1] ) {
385385 assert( $y < $this->seq[$k] );
386386 // Optimization: this is a common case:
@@ -493,7 +493,7 @@
494494 // Use the partitions to split this problem into subproblems.
495495 reset( $seps );
496496 $pt1 = $seps[0];
497 - foreach ( $seps as $pt2 ) {
 497+ while ( $pt2 = next( $seps ) ) {
498498 $this->_compareseq ( $pt1[0], $pt2[0], $pt1[1], $pt2[1] );
499499 $pt1 = $pt2;
500500 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101244Remove more assignments in conditionals (while each to foreach)reedy02:04, 29 October 2011

Status & tagging log