@@ -116,6 +116,9 @@ typedef struct {
116116
117117 int pending_empty_lines ;
118118
119+ int whitespace_corrected [64 ];
120+ int count_whitespace_corrected ;
121+
119122 char ongoing ;
120123 char skip_this_one ;
121124 char lead_in_active ;
@@ -399,13 +402,16 @@ fixdiff_find_original(dp_t *pdp, int *line_start)
399402 return 1 ;
400403 }
401404
405+ pdp -> count_whitespace_corrected = 0 ;
406+
402407 /*
403408 * Outer loop walks through each line in source.
404409 * Inner loop tries to match starting from that line
405410 */
406411
407412 while (!hit ) {
408413 line_ending_t let , les ;
414+ int n ;
409415
410416 init_lbuf (& lb , "src_comp" );
411417 lb .fd = open (pdp -> pf , OFLAGS (O_RDONLY ));
@@ -484,7 +490,12 @@ fixdiff_find_original(dp_t *pdp, int *line_start)
484490 if ((p1 < p1_end ) != (p2 < p2_end ))
485491 goto record_breakage ;
486492
487- elog ("(fixable whitespace-only difference at stanza line %d)\n" , lb_temp .li );
493+ for (n = 0 ; n < pdp -> count_whitespace_corrected ; n ++ )
494+ if (pdp -> whitespace_corrected [n ] == lb_temp .li )
495+ break ;
496+ if (n == pdp -> count_whitespace_corrected &&
497+ pdp -> count_whitespace_corrected < sizeof (pdp -> whitespace_corrected ) / sizeof (int ))
498+ pdp -> whitespace_corrected [pdp -> count_whitespace_corrected ++ ] = lb_temp .li ;
488499
489500 /*
490501 * We have to take care about picking up windows _TEXT
@@ -592,8 +603,7 @@ fixdiff_find_original(dp_t *pdp, int *line_start)
592603 }
593604
594605 if (lea != LE_ZERO )
595- if (write (lb_temp .fd , "\n" , TO_POSLEN (1 )) !=
596- (ssize_t )1 ) {
606+ if (write (lb_temp .fd , "\n" , TO_POSLEN (1 )) != (ssize_t )1 ) {
597607 close (lb_ef .fd );
598608 pdp -> reason = "failed to write extra "
599609 "stanza trailer to temp file" ;
@@ -614,6 +624,10 @@ fixdiff_find_original(dp_t *pdp, int *line_start)
614624
615625 close (lb_ef .fd );
616626 }
627+
628+ if (pdp -> count_whitespace_corrected )
629+ elog (" (fixed %d whitespace-only differences in stanza)\n" ,
630+ pdp -> count_whitespace_corrected );
617631 }
618632
619633out :
0 commit comments