diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-28 21:30:39 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-30 23:35:50 +0000 |
commit | 92ffad1a72bc8c422426d52ac408bd71242dd047 (patch) | |
tree | f592f353068dd2043525dd2cc04d6124a4ed4bc4 /auto_tests/tox_many_test.c | |
parent | 623e9ac331df7323660e21c8a2226523a5ee713b (diff) |
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
Diffstat (limited to 'auto_tests/tox_many_test.c')
-rw-r--r-- | auto_tests/tox_many_test.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/auto_tests/tox_many_test.c b/auto_tests/tox_many_test.c index 7ab0facc..3d3aad6d 100644 --- a/auto_tests/tox_many_test.c +++ b/auto_tests/tox_many_test.c | |||
@@ -1,7 +1,9 @@ | |||
1 | /* Auto Tests: Many clients. | 1 | /* Auto Tests: Many clients. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #ifndef _XOPEN_SOURCE | ||
4 | #define _XOPEN_SOURCE 600 | 5 | #define _XOPEN_SOURCE 600 |
6 | #endif | ||
5 | 7 | ||
6 | #ifdef HAVE_CONFIG_H | 8 | #ifdef HAVE_CONFIG_H |
7 | #include "config.h" | 9 | #include "config.h" |
@@ -25,7 +27,7 @@ static void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8 | |||
25 | } | 27 | } |
26 | 28 | ||
27 | if (length == 7 && memcmp("Gentoo", data, 7) == 0) { | 29 | if (length == 7 && memcmp("Gentoo", data, 7) == 0) { |
28 | tox_friend_add_norequest(m, public_key, 0); | 30 | tox_friend_add_norequest(m, public_key, nullptr); |
29 | } | 31 | } |
30 | } | 32 | } |
31 | 33 | ||
@@ -35,7 +37,7 @@ static void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8 | |||
35 | 37 | ||
36 | START_TEST(test_many_clients) | 38 | START_TEST(test_many_clients) |
37 | { | 39 | { |
38 | long long unsigned int cur_time = time(NULL); | 40 | long long unsigned int cur_time = time(nullptr); |
39 | Tox *toxes[NUM_TOXES]; | 41 | Tox *toxes[NUM_TOXES]; |
40 | uint32_t index[NUM_TOXES]; | 42 | uint32_t index[NUM_TOXES]; |
41 | uint32_t i, j; | 43 | uint32_t i, j; |
@@ -43,8 +45,8 @@ START_TEST(test_many_clients) | |||
43 | 45 | ||
44 | for (i = 0; i < NUM_TOXES; ++i) { | 46 | for (i = 0; i < NUM_TOXES; ++i) { |
45 | index[i] = i + 1; | 47 | index[i] = i + 1; |
46 | toxes[i] = tox_new_log(0, 0, &index[i]); | 48 | toxes[i] = tox_new_log(nullptr, nullptr, &index[i]); |
47 | ck_assert_msg(toxes[i] != 0, "Failed to create tox instances %u", i); | 49 | ck_assert_msg(toxes[i] != nullptr, "Failed to create tox instances %u", i); |
48 | tox_callback_friend_request(toxes[i], accept_friend_request); | 50 | tox_callback_friend_request(toxes[i], accept_friend_request); |
49 | } | 51 | } |
50 | 52 | ||
@@ -107,7 +109,7 @@ loop_top: | |||
107 | 109 | ||
108 | for (i = 0; i < NUM_TOXES; ++i) { | 110 | for (i = 0; i < NUM_TOXES; ++i) { |
109 | for (j = 0; j < tox_self_get_friend_list_size(toxes[i]); ++j) { | 111 | for (j = 0; j < tox_self_get_friend_list_size(toxes[i]); ++j) { |
110 | if (tox_friend_get_connection_status(toxes[i], j, 0) == TOX_CONNECTION_UDP) { | 112 | if (tox_friend_get_connection_status(toxes[i], j, nullptr) == TOX_CONNECTION_UDP) { |
111 | ++counter; | 113 | ++counter; |
112 | } | 114 | } |
113 | } | 115 | } |
@@ -133,7 +135,7 @@ loop_top: | |||
133 | tox_kill(toxes[i]); | 135 | tox_kill(toxes[i]); |
134 | } | 136 | } |
135 | 137 | ||
136 | printf("test_many_clients succeeded, took %llu seconds\n", time(NULL) - cur_time); | 138 | printf("test_many_clients succeeded, took %llu seconds\n", time(nullptr) - cur_time); |
137 | } | 139 | } |
138 | END_TEST | 140 | END_TEST |
139 | 141 | ||
@@ -154,7 +156,7 @@ static Suite *tox_suite(void) | |||
154 | 156 | ||
155 | int main(int argc, char *argv[]) | 157 | int main(int argc, char *argv[]) |
156 | { | 158 | { |
157 | srand((unsigned int) time(NULL)); | 159 | srand((unsigned int) time(nullptr)); |
158 | 160 | ||
159 | Suite *tox = tox_suite(); | 161 | Suite *tox = tox_suite(); |
160 | SRunner *test_runner = srunner_create(tox); | 162 | SRunner *test_runner = srunner_create(tox); |