diff options
author | iphydf <iphydf@users.noreply.github.com> | 2017-06-04 12:59:34 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2017-06-04 17:48:23 +0000 |
commit | 1e8fa85aadf602bdca3a540de09a8184f7139a6c (patch) | |
tree | 4caab80957f7f9a2098fb97e776be763defc44ab /toxcore/onion_client.c | |
parent | 03f99bde2ecee3722d47a5b6a1031fc88e7210b7 (diff) |
Add a monolith_test that includes all toxcore sources.
This requires that every symbol, even if static (file-scope), is unique.
The idea is that we can easily run "whole" program static analysis on
programs that include monolith.h ("whole" is in quotes, as we don't
include dependencies like libsodium in this static analysis).
Diffstat (limited to 'toxcore/onion_client.c')
-rw-r--r-- | toxcore/onion_client.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index ddae84e5..3c14a101 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -474,13 +474,13 @@ static int client_send_announce_request(Onion_Client *onion_c, uint32_t num, IP_ | |||
474 | typedef struct { | 474 | typedef struct { |
475 | const uint8_t *base_public_key; | 475 | const uint8_t *base_public_key; |
476 | Onion_Node entry; | 476 | Onion_Node entry; |
477 | } Cmp_data; | 477 | } Onion_Client_Cmp_data; |
478 | 478 | ||
479 | static int cmp_entry(const void *a, const void *b) | 479 | static int onion_client_cmp_entry(const void *a, const void *b) |
480 | { | 480 | { |
481 | Cmp_data cmp1, cmp2; | 481 | Onion_Client_Cmp_data cmp1, cmp2; |
482 | memcpy(&cmp1, a, sizeof(Cmp_data)); | 482 | memcpy(&cmp1, a, sizeof(Onion_Client_Cmp_data)); |
483 | memcpy(&cmp2, b, sizeof(Cmp_data)); | 483 | memcpy(&cmp2, b, sizeof(Onion_Client_Cmp_data)); |
484 | Onion_Node entry1 = cmp1.entry; | 484 | Onion_Node entry1 = cmp1.entry; |
485 | Onion_Node entry2 = cmp2.entry; | 485 | Onion_Node entry2 = cmp2.entry; |
486 | const uint8_t *cmp_public_key = cmp1.base_public_key; | 486 | const uint8_t *cmp_public_key = cmp1.base_public_key; |
@@ -517,14 +517,14 @@ static void sort_onion_node_list(Onion_Node *list, unsigned int length, const ui | |||
517 | { | 517 | { |
518 | // Pass comp_public_key to qsort with each Client_data entry, so the | 518 | // Pass comp_public_key to qsort with each Client_data entry, so the |
519 | // comparison function can use it as the base of comparison. | 519 | // comparison function can use it as the base of comparison. |
520 | VLA(Cmp_data, cmp_list, length); | 520 | VLA(Onion_Client_Cmp_data, cmp_list, length); |
521 | 521 | ||
522 | for (uint32_t i = 0; i < length; i++) { | 522 | for (uint32_t i = 0; i < length; i++) { |
523 | cmp_list[i].base_public_key = comp_public_key; | 523 | cmp_list[i].base_public_key = comp_public_key; |
524 | cmp_list[i].entry = list[i]; | 524 | cmp_list[i].entry = list[i]; |
525 | } | 525 | } |
526 | 526 | ||
527 | qsort(cmp_list, length, sizeof(Cmp_data), cmp_entry); | 527 | qsort(cmp_list, length, sizeof(Onion_Client_Cmp_data), onion_client_cmp_entry); |
528 | 528 | ||
529 | for (uint32_t i = 0; i < length; i++) { | 529 | for (uint32_t i = 0; i < length; i++) { |
530 | list[i] = cmp_list[i].entry; | 530 | list[i] = cmp_list[i].entry; |