Add -Wmissing-prototypes

This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
This commit is contained in:
Simon Ser 2019-11-20 00:45:19 +01:00 committed by Scott Anderson
parent 685a5a11a9
commit 16e5e9541b
24 changed files with 66 additions and 123 deletions

View file

@ -68,7 +68,7 @@ struct sample_keyboard {
struct wl_listener destroy;
};
void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device,
static void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device,
struct sample_state *sample) {
struct sample_output *output;
wlr_log(WLR_ERROR, "Configuring cursor %p for device %p", cursor, device);
@ -88,7 +88,7 @@ void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device
}
}
void output_frame_notify(struct wl_listener *listener, void *data) {
static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sample_output *output = wl_container_of(listener, output, frame);
struct sample_state *sample = output->sample;
struct wlr_output *wlr_output = output->output;
@ -127,27 +127,7 @@ static void cursor_destroy(struct sample_cursor *cursor) {
free(cursor);
}
void input_remove_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data;
struct sample_cursor *sample_cursor = wl_container_of(listener, sample_cursor, destroy);
struct sample_state *sample = sample_cursor->sample;
struct sample_cursor *cursor;
wl_list_for_each(cursor, &sample->cursors, link) {
if (cursor->device == device) {
cursor_destroy(cursor);
break;
}
}
struct sample_pointer *pointer;
wl_list_for_each(pointer, &sample->pointers, link) {
if (pointer->device == device) {
free(pointer);
break;
}
}
}
void output_remove_notify(struct wl_listener *listener, void *data) {
static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
struct sample_state *sample = sample_output->sample;
wl_list_remove(&sample_output->frame.link);
@ -161,7 +141,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) {
}
}
void new_output_notify(struct wl_listener *listener, void *data) {
static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -193,7 +173,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
wl_list_insert(&sample->outputs, &sample_output->link);
}
void keyboard_key_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data;
@ -209,14 +189,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
}
}
void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link);
free(keyboard);
}
void new_input_notify(struct wl_listener *listener, void *data) {
static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) {