Skip to content

Commit

Permalink
Declare fun(void) functions with no parameters
Browse files Browse the repository at this point in the history
This is not C++.
  • Loading branch information
rom1v committed Oct 4, 2018
1 parent cea176c commit ff4430b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions app/tests/test_control_event_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
13 changes: 6 additions & 7 deletions app/tests/test_control_event_serialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand All @@ -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];
Expand All @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
}
18 changes: 9 additions & 9 deletions app/tests/test_strutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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));

Expand All @@ -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));

Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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();
Expand Down

0 comments on commit ff4430b

Please sign in to comment.