diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-12-03 15:23:43 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-12-03 23:43:31 -0800 |
commit | fb282c7b30ae88ecd73936d035230489e59ae5dd (patch) | |
tree | bf849cfce349e6ba4050bcc2b1894b2168ddccbb | |
parent | fb41e82c77e4887c7892c90584e3a2bc0b3c4895 (diff) | |
download | coreutils-fb282c7b30ae88ecd73936d035230489e59ae5dd.tar.xz |
sort: clarify queue_check_insert
* src/sort.c (queue_check_insert): Clarify body a bit, and remove
no-longer-needed comment.
-rw-r--r-- | src/sort.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/sort.c b/src/sort.c index f7296d67e..3ed7c5b5a 100644 --- a/src/sort.c +++ b/src/sort.c @@ -3319,18 +3319,12 @@ mergelines_node (struct merge_node *restrict node, size_t total_lines, static void queue_check_insert (struct merge_node_queue *queue, struct merge_node *node) { - size_t lo_avail = node->lo - node->end_lo; - size_t hi_avail = node->hi - node->end_hi; - - /* Conditions for insertion: - 1. NODE is not already in heap. - 2. NODE has available lines from both it's children, OR one child has - available lines, but the other has exhausted all its lines. */ - if ((!node->queued) - && ((lo_avail && (hi_avail || !(node->nhi))) - || (hi_avail && !(node->nlo)))) + if (! node->queued) { - queue_insert (queue, node); + bool lo_avail = (node->lo - node->end_lo) != 0; + bool hi_avail = (node->hi - node->end_hi) != 0; + if (lo_avail ? hi_avail || ! node->nhi : hi_avail && ! node->nlo) + queue_insert (queue, node); } } |