From ff4430b2a397ecb5064f2a1aec0af725af27ce9b Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 4 Oct 2018 17:03:24 +0200 Subject: [PATCH] Declare fun(void) functions with no parameters This is not C++. --- app/src/command.c | 2 +- app/tests/test_control_event_queue.c | 8 ++++---- app/tests/test_control_event_serialize.c | 13 ++++++------- app/tests/test_strutil.c | 18 +++++++++--------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/src/command.c b/app/src/command.c index cc11a0de..e6e63ca7 100644 --- a/app/src/command.c +++ b/app/src/command.c @@ -9,7 +9,7 @@ static const char *adb_command; -static inline const char *get_adb_command() { +static inline const char *get_adb_command(void) { if (!adb_command) { adb_command = getenv("ADB"); if (!adb_command) diff --git a/app/tests/test_control_event_queue.c b/app/tests/test_control_event_queue.c index 07e547c1..a27181b6 100644 --- a/app/tests/test_control_event_queue.c +++ b/app/tests/test_control_event_queue.c @@ -3,7 +3,7 @@ #include "control_event.h" -static void test_control_event_queue_empty() { +static void test_control_event_queue_empty(void) { struct control_event_queue queue; SDL_bool init_ok = control_event_queue_init(&queue); assert(init_ok); @@ -25,7 +25,7 @@ static void test_control_event_queue_empty() { control_event_queue_destroy(&queue); } -static void test_control_event_queue_full() { +static void test_control_event_queue_full(void) { struct control_event_queue queue; SDL_bool init_ok = control_event_queue_init(&queue); assert(init_ok); @@ -43,7 +43,7 @@ static void test_control_event_queue_full() { control_event_queue_destroy(&queue); } -static void test_control_event_queue_push_take() { +static void test_control_event_queue_push_take(void) { struct control_event_queue queue; SDL_bool init_ok = control_event_queue_init(&queue); assert(init_ok); @@ -87,7 +87,7 @@ static void test_control_event_queue_push_take() { control_event_queue_destroy(&queue); } -int main() { +int main(void) { test_control_event_queue_empty(); test_control_event_queue_full(); test_control_event_queue_push_take(); diff --git a/app/tests/test_control_event_serialize.c b/app/tests/test_control_event_serialize.c index ad472776..21d7909b 100644 --- a/app/tests/test_control_event_serialize.c +++ b/app/tests/test_control_event_serialize.c @@ -3,7 +3,7 @@ #include "control_event.h" -static void test_serialize_keycode_event() { +static void test_serialize_keycode_event(void) { struct control_event event = { .type = CONTROL_EVENT_TYPE_KEYCODE, .keycode_event = { @@ -26,7 +26,7 @@ static void test_serialize_keycode_event() { assert(!memcmp(buf, expected, sizeof(expected))); } -static void test_serialize_text_event() { +static void test_serialize_text_event(void) { struct control_event event = { .type = CONTROL_EVENT_TYPE_TEXT, .text_event = { @@ -46,7 +46,7 @@ static void test_serialize_text_event() { assert(!memcmp(buf, expected, sizeof(expected))); } -static void test_serialize_long_text_event() { +static void test_serialize_long_text_event(void) { struct control_event event; event.type = CONTROL_EVENT_TYPE_TEXT; char text[TEXT_MAX_LENGTH]; @@ -66,7 +66,7 @@ static void test_serialize_long_text_event() { assert(!memcmp(buf, expected, sizeof(expected))); } -static void test_serialize_mouse_event() { +static void test_serialize_mouse_event(void) { struct control_event event = { .type = CONTROL_EVENT_TYPE_MOUSE, .mouse_event = { @@ -99,7 +99,7 @@ static void test_serialize_mouse_event() { assert(!memcmp(buf, expected, sizeof(expected))); } -static void test_serialize_scroll_event() { +static void test_serialize_scroll_event(void) { struct control_event event = { .type = CONTROL_EVENT_TYPE_SCROLL, .scroll_event = { @@ -132,11 +132,10 @@ static void test_serialize_scroll_event() { assert(!memcmp(buf, expected, sizeof(expected))); } -int main() { +int main(void) { test_serialize_keycode_event(); test_serialize_text_event(); test_serialize_long_text_event(); test_serialize_mouse_event(); test_serialize_scroll_event(); - return 0; } diff --git a/app/tests/test_strutil.c b/app/tests/test_strutil.c index b00e01fe..1dd7fbbe 100644 --- a/app/tests/test_strutil.c +++ b/app/tests/test_strutil.c @@ -3,7 +3,7 @@ #include "str_util.h" -static void test_xstrncpy_simple() { +static void test_xstrncpy_simple(void) { char s[] = "xxxxxxxxxx"; size_t w = xstrncpy(s, "abcdef", sizeof(s)); @@ -20,7 +20,7 @@ static void test_xstrncpy_simple() { assert(!strcmp("abcdef", s)); } -static void test_xstrncpy_just_fit() { +static void test_xstrncpy_just_fit(void) { char s[] = "xxxxxx"; size_t w = xstrncpy(s, "abcdef", sizeof(s)); @@ -34,7 +34,7 @@ static void test_xstrncpy_just_fit() { assert(!strcmp("abcdef", s)); } -static void test_xstrncpy_truncated() { +static void test_xstrncpy_truncated(void) { char s[] = "xxx"; size_t w = xstrncpy(s, "abcdef", sizeof(s)); @@ -48,7 +48,7 @@ static void test_xstrncpy_truncated() { assert(!strncmp("abcdef", s, 3)); } -static void test_xstrjoin_simple() { +static void test_xstrjoin_simple(void) { const char *const tokens[] = { "abc", "de", "fghi", NULL }; char s[] = "xxxxxxxxxxxxxx"; size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); @@ -66,7 +66,7 @@ static void test_xstrjoin_simple() { assert(!strcmp("abc de fghi", s)); } -static void test_xstrjoin_just_fit() { +static void test_xstrjoin_just_fit(void) { const char *const tokens[] = { "abc", "de", "fghi", NULL }; char s[] = "xxxxxxxxxxx"; size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); @@ -81,7 +81,7 @@ static void test_xstrjoin_just_fit() { assert(!strcmp("abc de fghi", s)); } -static void test_xstrjoin_truncated_in_token() { +static void test_xstrjoin_truncated_in_token(void) { const char *const tokens[] = { "abc", "de", "fghi", NULL }; char s[] = "xxxxx"; size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); @@ -96,7 +96,7 @@ static void test_xstrjoin_truncated_in_token() { assert(!strcmp("abc d", s)); } -static void test_xstrjoin_truncated_before_sep() { +static void test_xstrjoin_truncated_before_sep(void) { const char *const tokens[] = { "abc", "de", "fghi", NULL }; char s[] = "xxxxxx"; size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); @@ -111,7 +111,7 @@ static void test_xstrjoin_truncated_before_sep() { assert(!strcmp("abc de", s)); } -static void test_xstrjoin_truncated_after_sep() { +static void test_xstrjoin_truncated_after_sep(void) { const char *const tokens[] = { "abc", "de", "fghi", NULL }; char s[] = "xxxxxxx"; size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); @@ -126,7 +126,7 @@ static void test_xstrjoin_truncated_after_sep() { assert(!strcmp("abc de ", s)); } -int main() { +int main(void) { test_xstrncpy_simple(); test_xstrncpy_just_fit(); test_xstrncpy_truncated();