diff options
author | endoffile78 <endoffile78@yahoo.com> | 2017-01-05 20:20:47 -0600 |
---|---|---|
committer | endoffile78 <endoffile78@yahoo.com> | 2017-01-07 11:47:30 -0600 |
commit | e667ec23b94b908402de1ad18140af89802df332 (patch) | |
tree | 9ee3a85e0eaa8e9b123b847d71f3f703f8cd71a5 /auto_tests | |
parent | 9d56db3a54d54740eca82a92b04fc3a7828f3eee (diff) |
Replace make_quick_sort with qsort
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/crypto_test.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/auto_tests/crypto_test.c b/auto_tests/crypto_test.c index 7c32b43a..e433833e 100644 --- a/auto_tests/crypto_test.c +++ b/auto_tests/crypto_test.c | |||
@@ -2,7 +2,6 @@ | |||
2 | #include "config.h" | 2 | #include "config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include "../toxcore/misc_tools.h" | ||
6 | #include "../toxcore/net_crypto.h" | 5 | #include "../toxcore/net_crypto.h" |
7 | 6 | ||
8 | #include <check.h> | 7 | #include <check.h> |
@@ -343,9 +342,7 @@ END_TEST | |||
343 | #define CRYPTO_TEST_MEMCMP_COUNT 500 | 342 | #define CRYPTO_TEST_MEMCMP_COUNT 500 |
344 | #define CRYPTO_TEST_MEMCMP_EPS 10 | 343 | #define CRYPTO_TEST_MEMCMP_EPS 10 |
345 | 344 | ||
346 | static make_quick_sort(clock_t) | 345 | static int cmp(const void *a, const void *b) |
347 | |||
348 | static int cmp(clock_t a, clock_t b) | ||
349 | { | 346 | { |
350 | if (a < b) { | 347 | if (a < b) { |
351 | return -1; | 348 | return -1; |
@@ -374,7 +371,7 @@ static clock_t memcmp_median(void *a, void *b, size_t len) | |||
374 | results[i] = memcmp_time(a, b, len); | 371 | results[i] = memcmp_time(a, b, len); |
375 | } | 372 | } |
376 | 373 | ||
377 | clock_t_quick_sort(results, CRYPTO_TEST_MEMCMP_COUNT, cmp); | 374 | qsort(results, CRYPTO_TEST_MEMCMP_COUNT, sizeof(results), cmp); |
378 | return results[CRYPTO_TEST_MEMCMP_COUNT / 2]; | 375 | return results[CRYPTO_TEST_MEMCMP_COUNT / 2]; |
379 | } | 376 | } |
380 | 377 | ||