@@ -303,6 +303,13 @@ clear_lines_info (struct lines_info *info)
303303 info -> unline = NULL ;
304304}
305305
306+ static void
307+ whitespace_damage (const char * which )
308+ {
309+ error (EXIT_FAILURE , 0 , "Whitespace damage detected in %s" , which );
310+ }
311+
312+
306313static struct lines *
307314create_orig (FILE * f , struct lines_info * file ,
308315 int reverted , int * clash )
@@ -386,6 +393,8 @@ create_orig (FILE *f, struct lines_info *file,
386393 }
387394
388395 switch (first_char ) {
396+ case '\n' :
397+ whitespace_damage ("input" );
389398 case ' ' :
390399 if (leading_context ) context ++ ;
391400 if (new_lines ) new_lines -- ;
@@ -632,6 +641,8 @@ do_output_patch1_only (FILE *p1, FILE *out, int not_reverted)
632641 }
633642
634643 switch (first_char ) {
644+ case '\n' :
645+ whitespace_damage ("patch #1" );
635646 case ' ' :
636647 if (orig_lines ) orig_lines -- ;
637648 if (new_lines ) new_lines -- ;
@@ -911,6 +922,8 @@ trim_context (FILE *f /* positioned at start of @@ line */,
911922
912923 total_count ++ ;
913924 switch (line [0 ]) {
925+ case '\n' :
926+ whitespace_damage ("input" );
914927 case ' ' :
915928 if (orig_count ) orig_count -- ;
916929 if (new_count ) new_count -- ;
@@ -1664,6 +1677,8 @@ flipdiff (FILE *p1, FILE *p2, FILE *flip1, FILE *flip2)
16641677 new_lines -- ;
16651678
16661679 switch (line [0 ]) {
1680+ case '\n' :
1681+ whitespace_damage ("patch #2" );
16671682 case ' ' :
16681683 if (this_offset ) {
16691684 offsets = add_offset (first_linenum ,
0 commit comments