diff options
author | apolcyn <apolcyn@google.com> | 2018-04-30 17:55:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 17:55:12 -0700 |
commit | 47368045989a3b05a09af76e4634cc7bcab5c492 (patch) | |
tree | ebee1ebe66cce217f8057d7ecc09183981f3897e /third_party | |
parent | e5cb0469f2f8422a4b0d283cd647e8d31b7064fb (diff) | |
parent | 7e1687b3ef79d8213cff6a0df66d33b01013c9ad (diff) |
Merge pull request #15208 from apolcyn/fix_addr_sorting_compare_bug
Fix bug in an address sorting comparison
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/address_sorting/address_sorting.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/third_party/address_sorting/address_sorting.c b/third_party/address_sorting/address_sorting.c index d62aca3424..e4f3b53799 100644 --- a/third_party/address_sorting/address_sorting.c +++ b/third_party/address_sorting/address_sorting.c @@ -225,15 +225,15 @@ static int compare_source_addr_exists(const address_sorting_sortable* first, static int compare_source_dest_scope_matches( const address_sorting_sortable* first, const address_sorting_sortable* second) { - int first_src_dst_scope_matches = 0; + bool first_src_dst_scope_matches = false; if (sockaddr_get_scope(&first->dest_addr) == sockaddr_get_scope(&first->source_addr)) { - first_src_dst_scope_matches = 1; + first_src_dst_scope_matches = true; } - int second_src_dst_scope_matches = 0; + bool second_src_dst_scope_matches = false; if (sockaddr_get_scope(&second->dest_addr) == sockaddr_get_scope(&second->source_addr)) { - second_src_dst_scope_matches = 1; + second_src_dst_scope_matches = true; } if (first_src_dst_scope_matches != second_src_dst_scope_matches) { return first_src_dst_scope_matches ? -1 : 1; @@ -244,18 +244,18 @@ static int compare_source_dest_scope_matches( static int compare_source_dest_labels_match( const address_sorting_sortable* first, const address_sorting_sortable* second) { - int first_label_matches = 0; + bool first_label_matches = false; if (get_label_value(&first->dest_addr) == get_label_value(&first->source_addr)) { - first_label_matches = 1; + first_label_matches = true; } - int second_label_matches = 0; + bool second_label_matches = false; if (get_label_value(&second->dest_addr) == get_label_value(&second->source_addr)) { - second_label_matches = 1; + second_label_matches = true; } if (first_label_matches != second_label_matches) { - return first_label_matches ? 1 : 1; + return first_label_matches ? -1 : 1; } return 0; } |