From: Paul Eggert Date: Fri, 3 Dec 2010 23:04:31 +0000 (-0800) Subject: sort: simplify write_unique X-Git-Tag: v8.8~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2d977aff104415832bcb6487943344d03f51450;p=thirdparty%2Fcoreutils.git sort: simplify write_unique * src/sort.c (write_unique): Simplify slightly so that there is just one call to write_line, not two. --- diff --git a/src/sort.c b/src/sort.c index af4b20c3e3..1faf1714df 100644 --- a/src/sort.c +++ b/src/sort.c @@ -3231,13 +3231,14 @@ write_unique (struct line const *line, FILE *tfp, char const *temp_output) { static struct line saved; - if (!unique) - write_line (line, tfp, temp_output); - else if (!saved.text || compare (line, &saved)) + if (unique) { + if (saved.text && ! compare (line, &saved)) + return; saved = *line; - write_line (line, tfp, temp_output); } + + write_line (line, tfp, temp_output); } /* Merge the lines currently available to a NODE in the binary