summaryrefslogtreecommitdiff
path: root/auto_tests/self_conference_title_change_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-28 21:30:39 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-30 23:35:50 +0000
commit92ffad1a72bc8c422426d52ac408bd71242dd047 (patch)
treef592f353068dd2043525dd2cc04d6124a4ed4bc4 /auto_tests/self_conference_title_change_test.c
parent623e9ac331df7323660e21c8a2226523a5ee713b (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/self_conference_title_change_test.c')
-rw-r--r--auto_tests/self_conference_title_change_test.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/auto_tests/self_conference_title_change_test.c b/auto_tests/self_conference_title_change_test.c
index c780f320..a8ba7aab 100644
--- a/auto_tests/self_conference_title_change_test.c
+++ b/auto_tests/self_conference_title_change_test.c
@@ -21,7 +21,9 @@
21 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 21 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
22 * 22 *
23 */ 23 */
24#define _XOPEN_SOURCE 500 24#ifndef _XOPEN_SOURCE
25#define _XOPEN_SOURCE 600
26#endif
25 27
26#include <stdio.h> 28#include <stdio.h>
27#include <stdlib.h> 29#include <stdlib.h>
@@ -38,7 +40,7 @@ static const char *newtitle = "kitten over darknet";
38static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title, 40static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title,
39 size_t length, void *user_data) 41 size_t length, void *user_data)
40{ 42{
41 if (!memcmp(title, newtitle, tox_conference_get_title_size(tox, conference_number, NULL))) { 43 if (!memcmp(title, newtitle, tox_conference_get_title_size(tox, conference_number, nullptr))) {
42 printf("success: title was changed and updated in the conference"); 44 printf("success: title was changed and updated in the conference");
43 exit(0); 45 exit(0);
44 } 46 }
@@ -47,12 +49,12 @@ static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_nu
47int main(void) 49int main(void)
48{ 50{
49 uint32_t conference_number; 51 uint32_t conference_number;
50 struct Tox_Options *to = tox_options_new(NULL); 52 struct Tox_Options *to = tox_options_new(nullptr);
51 Tox *t; 53 Tox *t;
52 TOX_ERR_CONFERENCE_NEW conference_err; 54 TOX_ERR_CONFERENCE_NEW conference_err;
53 TOX_ERR_CONFERENCE_TITLE title_err; 55 TOX_ERR_CONFERENCE_TITLE title_err;
54 56
55 t = tox_new(to, NULL); 57 t = tox_new(to, nullptr);
56 tox_options_free(to); 58 tox_options_free(to);
57 59
58 tox_callback_conference_title(t, &cbtitlechange); 60 tox_callback_conference_title(t, &cbtitlechange);
@@ -63,7 +65,7 @@ int main(void)
63 return 2; 65 return 2;
64 } 66 }
65 67
66 tox_iterate(t, NULL); 68 tox_iterate(t, nullptr);
67 c_sleep(tox_iteration_interval(t)); 69 c_sleep(tox_iteration_interval(t));
68 70
69 if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) { 71 if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) {
@@ -72,9 +74,9 @@ int main(void)
72 return 3; 74 return 3;
73 } 75 }
74 76
75 tox_iterate(t, NULL); 77 tox_iterate(t, nullptr);
76 c_sleep(tox_iteration_interval(t)); 78 c_sleep(tox_iteration_interval(t));
77 tox_iterate(t, NULL); 79 tox_iterate(t, nullptr);
78 80
79 fprintf(stderr, "error: title was not changed in callback. exiting.\n"); 81 fprintf(stderr, "error: title was not changed in callback. exiting.\n");
80 82