Skip to content

Commit

Permalink
diff: output_ed_diff() tweak
Browse files Browse the repository at this point in the history
* Avoid doing s/// in a loop to add trailing newline to each element of outlist
* I checked that output is not changed for -e and -f options
  • Loading branch information
mknos authored Dec 11, 2023
1 parent dcffaec commit 08dc3d5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions bin/diff
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,7 @@ sub output_ed_diff {

if ($block->insert) {
my @outlist = @$fileref2[$hunk->{"start2"}..$hunk->{"end2"}];
map {s/$/\n/} @outlist; # add \n's
print @outlist;
print ".\n"; # end of ed 'c' or 'a' command
print join("\n", @outlist), "\n.\n"; # '.' signifies end of 'c' or 'a'
}
}

Expand Down

0 comments on commit 08dc3d5

Please sign in to comment.