sort: check global flags on fallback sort
Sort now performs global reverse on fallback sort if -r is set. Before only key local flags were checked. function old new delta compare_keys 712 738 +26 Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
committed by
Denys Vlasenko
parent
1a4d9f6521
commit
5c13ab41bb
@@ -302,10 +302,14 @@ static int compare_keys(const void *xarg, const void *yarg)
|
||||
} /* for */
|
||||
|
||||
/* Perform fallback sort if necessary */
|
||||
if (!retval && !(option_mask32 & FLAG_s))
|
||||
if (!retval && !(option_mask32 & FLAG_s)) {
|
||||
retval = strcmp(*(char **)xarg, *(char **)yarg);
|
||||
flags = option_mask32;
|
||||
}
|
||||
|
||||
if (flags & FLAG_r)
|
||||
return -retval;
|
||||
|
||||
if (flags & FLAG_r) return -retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user