From 724bfacf4c03ed0fdd290ae800eae030031db5b6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 7 Oct 2015 11:48:56 +0000 Subject: -ensure result is +- 1 --- src/hello/address.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hello/address.c b/src/hello/address.c index 9b7bb2019..2d3a59121 100644 --- a/src/hello/address.c +++ b/src/hello/address.c @@ -143,12 +143,14 @@ GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1, if (0 != ret) return ret; if (a1->local_info != a2->local_info) - return ((int) a1->local_info) - ((int) a2->local_info); + return (((int) a1->local_info) - ((int) a2->local_info) < 0) -1 : 1; if (a1->address_length < a2->address_length) return -1; if (a1->address_length > a2->address_length) return 1; - return memcmp (a1->address, a2->address, a1->address_length); + return memcmp (a1->address, + a2->address, + a1->address_length); } -- cgit v1.2.3