diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-07 11:48:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-07 11:48:56 +0000 |
commit | 724bfacf4c03ed0fdd290ae800eae030031db5b6 (patch) | |
tree | c9975713b4a9c8935006ea34593f838658ddb005 /src/hello/address.c | |
parent | 0ecd945a968543984a5757b938f5ff872c1c2da3 (diff) | |
download | gnunet-724bfacf4c03ed0fdd290ae800eae030031db5b6.tar.gz gnunet-724bfacf4c03ed0fdd290ae800eae030031db5b6.zip |
-ensure result is +- 1
Diffstat (limited to 'src/hello/address.c')
-rw-r--r-- | src/hello/address.c | 6 |
1 files 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, | |||
143 | if (0 != ret) | 143 | if (0 != ret) |
144 | return ret; | 144 | return ret; |
145 | if (a1->local_info != a2->local_info) | 145 | if (a1->local_info != a2->local_info) |
146 | return ((int) a1->local_info) - ((int) a2->local_info); | 146 | return (((int) a1->local_info) - ((int) a2->local_info) < 0) -1 : 1; |
147 | if (a1->address_length < a2->address_length) | 147 | if (a1->address_length < a2->address_length) |
148 | return -1; | 148 | return -1; |
149 | if (a1->address_length > a2->address_length) | 149 | if (a1->address_length > a2->address_length) |
150 | return 1; | 150 | return 1; |
151 | return memcmp (a1->address, a2->address, a1->address_length); | 151 | return memcmp (a1->address, |
152 | a2->address, | ||
153 | a1->address_length); | ||
152 | } | 154 | } |
153 | 155 | ||
154 | 156 | ||