argp: Avoid undefined behaviour when invoking qsort().
commitc6b798d3754a4ee18c3e5e0fff4310105d7894b2
authorBruno Haible <bruno@clisp.org>
Tue, 8 Dec 2020 20:28:18 +0000 (8 21:28 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 8 Dec 2020 20:28:18 +0000 (8 21:28 +0100)
treefe7b9a0d12f59382669e8b96a0baaf05367f73d9
parentff62d4047b07dd51eb48b0d0e52805ca74bf3faa
argp: Avoid undefined behaviour when invoking qsort().

This fixes a test-argp-2.sh test failure on macOS and FreeBSD.

Reported by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00085.html>.

* lib/argp-help.c (group_cmp): Remove third argument.
(hol_sibling_cluster_cmp, hol_cousin_cluster_cmp): New functions, based
upon hol_cluster_cmp.
(hol_cluster_cmp): Use hol_cousin_cluster_cmp.
(hol_entry_cmp): Rewritten to implement a total order.
ChangeLog
lib/argp-help.c