]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
sort: simplify write_unique
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Dec 2010 23:04:31 +0000 (15:04 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Dec 2010 07:43:31 +0000 (23:43 -0800)
* src/sort.c (write_unique): Simplify slightly so that there is
just one call to write_line, not two.

src/sort.c

index af4b20c3e351fef962f5c39943f8c8c17ea9f4f0..1faf1714df9b61543ada31f501efae972202add3 100644 (file)
@@ -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