]> git.ipfire.org Git - thirdparty/glibc.git/commit
argp: Avoid undefined behaviour when invoking qsort().
authorBruno Haible <bruno@clisp.org>
Thu, 7 Jan 2021 01:06:20 +0000 (02:06 +0100)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 4 Feb 2021 19:44:29 +0000 (16:44 -0300)
commit1e3d9c1e4dc3ad4d6eba2ecec86c97b0ccac2794
tree353fd00012a6f5e247c3ca63a55fa59129e528f5
parentbbf15241dbaf56e2590203771b1e39d35b6d3701
argp: Avoid undefined behaviour when invoking qsort().

This fixes a Gnulib 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>.

* argp/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.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
argp/argp-help.c