Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace make_quick_sort with qsort #397

Merged
merged 3 commits into from
Jan 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ target_link_modules(toxgroup toxmessenger)
apidsl(
toxcore/tox.api.h)
add_module(toxcore
toxcore/misc_tools.h
toxcore/tox_api.c
toxcore/tox.c
toxcore/tox.h)
Expand Down
14 changes: 7 additions & 7 deletions auto_tests/crypto_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "config.h"
#endif

#include "../toxcore/misc_tools.h"
#include "../toxcore/net_crypto.h"

#include <check.h>
Expand Down Expand Up @@ -343,15 +342,16 @@ END_TEST
#define CRYPTO_TEST_MEMCMP_COUNT 500
#define CRYPTO_TEST_MEMCMP_EPS 10

static make_quick_sort(clock_t)

static int cmp(clock_t a, clock_t b)
static int cmp(const void *a, const void *b)
{
if (a < b) {
const clock_t *first = (const clock_t *) a;
const clock_t *second = (const clock_t *) b;

if (*first < *second) {
return -1;
}

if (a > b) {
if (*first > *second) {
return 1;
}

Expand All @@ -374,7 +374,7 @@ static clock_t memcmp_median(void *a, void *b, size_t len)
results[i] = memcmp_time(a, b, len);
}

clock_t_quick_sort(results, CRYPTO_TEST_MEMCMP_COUNT, cmp);
qsort(results, CRYPTO_TEST_MEMCMP_COUNT, sizeof(*results), cmp);
return results[CRYPTO_TEST_MEMCMP_COUNT / 2];
}

Expand Down
1 change: 0 additions & 1 deletion toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

#include "LAN_discovery.h"
#include "logger.h"
#include "misc_tools.h"
#include "network.h"
#include "ping.h"
#include "util.h"
Expand Down
3 changes: 1 addition & 2 deletions toxcore/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ libtoxcore_la_SOURCES = ../toxcore/DHT.h \
../toxcore/TCP_connection.h \
../toxcore/TCP_connection.c \
../toxcore/list.c \
../toxcore/list.h \
../toxcore/misc_tools.h
../toxcore/list.h

libtoxcore_la_CFLAGS = -I$(top_srcdir) \
-I$(top_srcdir)/toxcore \
Expand Down
70 changes: 0 additions & 70 deletions toxcore/misc_tools.h

This file was deleted.