Declare fun(void) functions with no parameters

This is not C++.
This commit is contained in:
Romain Vimont 2018-10-04 17:03:24 +02:00
parent cea176c210
commit ff4430b2a3
4 changed files with 20 additions and 21 deletions

View file

@ -9,7 +9,7 @@
static const char *adb_command; static const char *adb_command;
static inline const char *get_adb_command() { static inline const char *get_adb_command(void) {
if (!adb_command) { if (!adb_command) {
adb_command = getenv("ADB"); adb_command = getenv("ADB");
if (!adb_command) if (!adb_command)

View file

@ -3,7 +3,7 @@
#include "control_event.h" #include "control_event.h"
static void test_control_event_queue_empty() { static void test_control_event_queue_empty(void) {
struct control_event_queue queue; struct control_event_queue queue;
SDL_bool init_ok = control_event_queue_init(&queue); SDL_bool init_ok = control_event_queue_init(&queue);
assert(init_ok); assert(init_ok);
@ -25,7 +25,7 @@ static void test_control_event_queue_empty() {
control_event_queue_destroy(&queue); 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; struct control_event_queue queue;
SDL_bool init_ok = control_event_queue_init(&queue); SDL_bool init_ok = control_event_queue_init(&queue);
assert(init_ok); assert(init_ok);
@ -43,7 +43,7 @@ static void test_control_event_queue_full() {
control_event_queue_destroy(&queue); 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; struct control_event_queue queue;
SDL_bool init_ok = control_event_queue_init(&queue); SDL_bool init_ok = control_event_queue_init(&queue);
assert(init_ok); assert(init_ok);
@ -87,7 +87,7 @@ static void test_control_event_queue_push_take() {
control_event_queue_destroy(&queue); control_event_queue_destroy(&queue);
} }
int main() { int main(void) {
test_control_event_queue_empty(); test_control_event_queue_empty();
test_control_event_queue_full(); test_control_event_queue_full();
test_control_event_queue_push_take(); test_control_event_queue_push_take();

View file

@ -3,7 +3,7 @@
#include "control_event.h" #include "control_event.h"
static void test_serialize_keycode_event() { static void test_serialize_keycode_event(void) {
struct control_event event = { struct control_event event = {
.type = CONTROL_EVENT_TYPE_KEYCODE, .type = CONTROL_EVENT_TYPE_KEYCODE,
.keycode_event = { .keycode_event = {
@ -26,7 +26,7 @@ static void test_serialize_keycode_event() {
assert(!memcmp(buf, expected, sizeof(expected))); assert(!memcmp(buf, expected, sizeof(expected)));
} }
static void test_serialize_text_event() { static void test_serialize_text_event(void) {
struct control_event event = { struct control_event event = {
.type = CONTROL_EVENT_TYPE_TEXT, .type = CONTROL_EVENT_TYPE_TEXT,
.text_event = { .text_event = {
@ -46,7 +46,7 @@ static void test_serialize_text_event() {
assert(!memcmp(buf, expected, sizeof(expected))); 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; struct control_event event;
event.type = CONTROL_EVENT_TYPE_TEXT; event.type = CONTROL_EVENT_TYPE_TEXT;
char text[TEXT_MAX_LENGTH]; char text[TEXT_MAX_LENGTH];
@ -66,7 +66,7 @@ static void test_serialize_long_text_event() {
assert(!memcmp(buf, expected, sizeof(expected))); assert(!memcmp(buf, expected, sizeof(expected)));
} }
static void test_serialize_mouse_event() { static void test_serialize_mouse_event(void) {
struct control_event event = { struct control_event event = {
.type = CONTROL_EVENT_TYPE_MOUSE, .type = CONTROL_EVENT_TYPE_MOUSE,
.mouse_event = { .mouse_event = {
@ -99,7 +99,7 @@ static void test_serialize_mouse_event() {
assert(!memcmp(buf, expected, sizeof(expected))); assert(!memcmp(buf, expected, sizeof(expected)));
} }
static void test_serialize_scroll_event() { static void test_serialize_scroll_event(void) {
struct control_event event = { struct control_event event = {
.type = CONTROL_EVENT_TYPE_SCROLL, .type = CONTROL_EVENT_TYPE_SCROLL,
.scroll_event = { .scroll_event = {
@ -132,11 +132,10 @@ static void test_serialize_scroll_event() {
assert(!memcmp(buf, expected, sizeof(expected))); assert(!memcmp(buf, expected, sizeof(expected)));
} }
int main() { int main(void) {
test_serialize_keycode_event(); test_serialize_keycode_event();
test_serialize_text_event(); test_serialize_text_event();
test_serialize_long_text_event(); test_serialize_long_text_event();
test_serialize_mouse_event(); test_serialize_mouse_event();
test_serialize_scroll_event(); test_serialize_scroll_event();
return 0;
} }

View file

@ -3,7 +3,7 @@
#include "str_util.h" #include "str_util.h"
static void test_xstrncpy_simple() { static void test_xstrncpy_simple(void) {
char s[] = "xxxxxxxxxx"; char s[] = "xxxxxxxxxx";
size_t w = xstrncpy(s, "abcdef", sizeof(s)); size_t w = xstrncpy(s, "abcdef", sizeof(s));
@ -20,7 +20,7 @@ static void test_xstrncpy_simple() {
assert(!strcmp("abcdef", s)); assert(!strcmp("abcdef", s));
} }
static void test_xstrncpy_just_fit() { static void test_xstrncpy_just_fit(void) {
char s[] = "xxxxxx"; char s[] = "xxxxxx";
size_t w = xstrncpy(s, "abcdef", sizeof(s)); size_t w = xstrncpy(s, "abcdef", sizeof(s));
@ -34,7 +34,7 @@ static void test_xstrncpy_just_fit() {
assert(!strcmp("abcdef", s)); assert(!strcmp("abcdef", s));
} }
static void test_xstrncpy_truncated() { static void test_xstrncpy_truncated(void) {
char s[] = "xxx"; char s[] = "xxx";
size_t w = xstrncpy(s, "abcdef", sizeof(s)); size_t w = xstrncpy(s, "abcdef", sizeof(s));
@ -48,7 +48,7 @@ static void test_xstrncpy_truncated() {
assert(!strncmp("abcdef", s, 3)); assert(!strncmp("abcdef", s, 3));
} }
static void test_xstrjoin_simple() { static void test_xstrjoin_simple(void) {
const char *const tokens[] = { "abc", "de", "fghi", NULL }; const char *const tokens[] = { "abc", "de", "fghi", NULL };
char s[] = "xxxxxxxxxxxxxx"; char s[] = "xxxxxxxxxxxxxx";
size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); size_t w = xstrjoin(s, tokens, ' ', sizeof(s));
@ -66,7 +66,7 @@ static void test_xstrjoin_simple() {
assert(!strcmp("abc de fghi", s)); 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 }; const char *const tokens[] = { "abc", "de", "fghi", NULL };
char s[] = "xxxxxxxxxxx"; char s[] = "xxxxxxxxxxx";
size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); size_t w = xstrjoin(s, tokens, ' ', sizeof(s));
@ -81,7 +81,7 @@ static void test_xstrjoin_just_fit() {
assert(!strcmp("abc de fghi", s)); 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 }; const char *const tokens[] = { "abc", "de", "fghi", NULL };
char s[] = "xxxxx"; char s[] = "xxxxx";
size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); size_t w = xstrjoin(s, tokens, ' ', sizeof(s));
@ -96,7 +96,7 @@ static void test_xstrjoin_truncated_in_token() {
assert(!strcmp("abc d", s)); 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 }; const char *const tokens[] = { "abc", "de", "fghi", NULL };
char s[] = "xxxxxx"; char s[] = "xxxxxx";
size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); size_t w = xstrjoin(s, tokens, ' ', sizeof(s));
@ -111,7 +111,7 @@ static void test_xstrjoin_truncated_before_sep() {
assert(!strcmp("abc de", s)); 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 }; const char *const tokens[] = { "abc", "de", "fghi", NULL };
char s[] = "xxxxxxx"; char s[] = "xxxxxxx";
size_t w = xstrjoin(s, tokens, ' ', sizeof(s)); size_t w = xstrjoin(s, tokens, ' ', sizeof(s));
@ -126,7 +126,7 @@ static void test_xstrjoin_truncated_after_sep() {
assert(!strcmp("abc de ", s)); assert(!strcmp("abc de ", s));
} }
int main() { int main(void) {
test_xstrncpy_simple(); test_xstrncpy_simple();
test_xstrncpy_just_fit(); test_xstrncpy_just_fit();
test_xstrncpy_truncated(); test_xstrncpy_truncated();