util:binsearch: user NUMERIC_CMP()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 3 Apr 2024 02:47:10 +0000 (15:47 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Apr 2024 22:56:33 +0000 (22:56 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/tests/binsearch.c

index b3ecda165f35b58af644b7f52519f9deb6522264..24840156c7336261d1c0bda086fb6249fb82743e 100644 (file)
 
 #include "includes.h"
 #include "lib/util/binsearch.h"
+#include "lib/util/tsort.h"
 #include "torture/torture.h"
 #include "torture/local/proto.h"
 
 static int int_cmp(int a, int b)
 {
-       return a - b;
+       return NUMERIC_CMP(a, b);
 }
 
 static int int_cmp_p(int a, int *b)
 {
-       return a - *b;
+       int _b = *b;
+       return NUMERIC_CMP(a, _b);
 }
 
 static bool test_binsearch_v(struct torture_context *tctx)