summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-12-03 15:04:31 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2010-12-03 23:43:31 -0800
commitf2d977aff104415832bcb6487943344d03f51450 (patch)
tree18a85fe9be09062f4dd72c2838f287daba2016aa /src
parent6f4279421d857aedb15d0bb801222c90e4645eee (diff)
downloadcoreutils-f2d977aff104415832bcb6487943344d03f51450.tar.xz
sort: simplify write_unique
* src/sort.c (write_unique): Simplify slightly so that there is just one call to write_line, not two.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sort.c b/src/sort.c
index af4b20c3e..1faf1714d 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