From 206b96202c6cae83a1867e3266edafa5a10e327f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 31 Mar 2012 10:53:04 +0200 Subject: [PATCH] Use (void) instead of () for functions without args (Thanks fernandotcl) See also: http://article.gmane.org/gmane.linux.kernel/1268792 The C compiler will handle (void) as "no arguments" and () as "variadic function" (equivalent to (...)) which might lead to subtle errors, such as the one which was fixed with commit 0ea64ae4. --- include/config.h | 2 +- include/ewmh.h | 4 ++-- include/handlers.h | 2 +- include/ipc.h | 2 +- include/libi3.h | 2 +- include/log.h | 2 +- include/manage.h | 2 +- include/randr.h | 4 ++-- include/sighandler.h | 2 +- include/tree.h | 6 +++--- include/workspace.h | 10 +++++----- include/x.h | 2 +- include/xcursor.h | 2 +- include/xinerama.h | 2 +- libi3/font.c | 2 +- src/cfgparse.y | 2 +- src/commands.c | 2 +- src/commands_parser.c | 2 +- src/config.c | 2 +- src/ewmh.c | 6 +++--- src/floating.c | 2 +- src/handlers.c | 2 +- src/ipc.c | 2 +- src/log.c | 4 ++-- src/main.c | 2 +- src/manage.c | 2 +- src/randr.c | 4 ++-- src/sighandler.c | 2 +- src/tree.c | 8 ++++---- src/util.c | 2 +- src/workspace.c | 10 +++++----- src/x.c | 2 +- src/xcursor.c | 2 +- src/xinerama.c | 2 +- 34 files changed, 53 insertions(+), 53 deletions(-) diff --git a/include/config.h b/include/config.h index c1705d4f..e959a2dc 100644 --- a/include/config.h +++ b/include/config.h @@ -277,7 +277,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configfile, * Translates keysymbols to keycodes for all bindings which use keysyms. * */ -void translate_keysyms(); +void translate_keysyms(void); /** * Ungrabs all keys, to be called before re-grabbing the keys because of a diff --git a/include/ewmh.h b/include/ewmh.h index aacd1510..a786069a 100644 --- a/include/ewmh.h +++ b/include/ewmh.h @@ -17,7 +17,7 @@ * and _NET_NUMBER_OF_DESKTOPS - 1. * */ -void ewmh_update_current_desktop(); +void ewmh_update_current_desktop(void); /** * Updates _NET_ACTIVE_WINDOW with the currently focused window. @@ -44,6 +44,6 @@ void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows); * Set up the EWMH hints on the root window. * */ -void ewmh_setup_hints(); +void ewmh_setup_hints(void); #endif diff --git a/include/handlers.h b/include/handlers.h index ebec34cf..bcebf9ff 100644 --- a/include/handlers.h +++ b/include/handlers.h @@ -43,7 +43,7 @@ void handle_event(int type, xcb_generic_event_t *event); * received from X11 * */ -void property_handlers_init(); +void property_handlers_init(void); #if 0 /** diff --git a/include/ipc.h b/include/ipc.h index 9b59fb01..af80fa4b 100644 --- a/include/ipc.h +++ b/include/ipc.h @@ -78,7 +78,7 @@ void ipc_send_event(const char *event, uint32_t message_type, const char *payloa * when exiting or restarting only! * */ -void ipc_shutdown(); +void ipc_shutdown(void); void dump_node(yajl_gen gen, Con *con, bool inplace_restart); diff --git a/include/libi3.h b/include/libi3.h index 7b7cf576..b88bcb67 100644 --- a/include/libi3.h +++ b/include/libi3.h @@ -197,7 +197,7 @@ void set_font(i3Font *font); * Frees the resources taken by the current font. * */ -void free_font(); +void free_font(void); /** * Converts the given string to UTF-8 from UCS-2 big endian. The return value diff --git a/include/log.h b/include/log.h index 0eb55744..e5e20dc1 100644 --- a/include/log.h +++ b/include/log.h @@ -29,7 +29,7 @@ extern int shmlog_size; * XDG_RUNTIME_DIR, see get_process_filename()). * */ -void init_logging(); +void init_logging(void); /** * Enables the given loglevel. diff --git a/include/manage.h b/include/manage.h index 833d614f..c16d295f 100644 --- a/include/manage.h +++ b/include/manage.h @@ -27,7 +27,7 @@ void manage_existing_windows(xcb_window_t root); * side-effects which are to be expected when continuing to run i3. * */ -void restore_geometry(); +void restore_geometry(void); /** * Do some sanity checks and then reparent the window. diff --git a/include/randr.h b/include/randr.h index 4cefba80..ac527bcc 100644 --- a/include/randr.h +++ b/include/randr.h @@ -61,13 +61,13 @@ void init_ws_for_output(Output *output, Con *content); * (Re-)queries the outputs via RandR and stores them in the list of outputs. * */ -void randr_query_outputs(); +void randr_query_outputs(void); /** * Returns the first output which is active. * */ -Output *get_first_output(); +Output *get_first_output(void); /** * Returns the output with the given name if it is active (!) or NULL. diff --git a/include/sighandler.h b/include/sighandler.h index 5ffef2a3..571070b0 100644 --- a/include/sighandler.h +++ b/include/sighandler.h @@ -16,6 +16,6 @@ * Setup signal handlers to safely handle SIGSEGV and SIGFPE * */ -void setup_signal_handler(); +void setup_signal_handler(void); #endif diff --git a/include/tree.h b/include/tree.h index 81fdbe6a..b9159e3b 100644 --- a/include/tree.h +++ b/include/tree.h @@ -42,20 +42,20 @@ void tree_split(Con *con, orientation_t orientation); * Moves focus one level up. * */ -void level_up(); +void level_up(void); /** * Moves focus one level down. * */ -void level_down(); +void level_down(void); /** * Renders the tree, that is rendering all outputs using render_con() and * pushing the changes to X11 using x_push_changes(). * */ -void tree_render(); +void tree_render(void); /** * Closes the current container using tree_close(). diff --git a/include/workspace.h b/include/workspace.h index 8e682bb0..1b25b425 100644 --- a/include/workspace.h +++ b/include/workspace.h @@ -69,31 +69,31 @@ void workspace_show_by_name(const char *num); * Returns the next workspace. * */ -Con* workspace_next(); +Con* workspace_next(void); /** * Returns the previous workspace. * */ -Con* workspace_prev(); +Con* workspace_prev(void); /** * Returns the next workspace on the same output * */ -Con* workspace_next_on_output(); +Con* workspace_next_on_output(void); /** * Returns the previous workspace on the same output * */ -Con* workspace_prev_on_output(); +Con* workspace_prev_on_output(void); /** * Focuses the previously focused workspace. * */ -void workspace_back_and_forth(); +void workspace_back_and_forth(void); #if 0 diff --git a/include/x.h b/include/x.h index 36c77431..cb4a8a96 100644 --- a/include/x.h +++ b/include/x.h @@ -108,7 +108,7 @@ void x_set_name(Con *con, const char *name); * Sets up i3 specific atoms (I3_SOCKET_PATH and I3_CONFIG_PATH) * */ -void x_set_i3_atoms(); +void x_set_i3_atoms(void); /** * Set warp_to coordinates. This will trigger on the next call to diff --git a/include/xcursor.h b/include/xcursor.h index 2a67bcb7..c341f90b 100644 --- a/include/xcursor.h +++ b/include/xcursor.h @@ -20,7 +20,7 @@ enum xcursor_cursor_t { XCURSOR_CURSOR_MAX }; -void xcursor_load_cursors(); +void xcursor_load_cursors(void); Cursor xcursor_get_cursor(enum xcursor_cursor_t c); int xcursor_get_xcb_cursor(enum xcursor_cursor_t c); diff --git a/include/xinerama.h b/include/xinerama.h index e6304b56..8c879c07 100644 --- a/include/xinerama.h +++ b/include/xinerama.h @@ -19,6 +19,6 @@ * Xinerama information to setup workspaces for each screen. * */ -void xinerama_init(); +void xinerama_init(void); #endif diff --git a/libi3/font.c b/libi3/font.c index 4b308efb..0b276b0b 100644 --- a/libi3/font.c +++ b/libi3/font.c @@ -87,7 +87,7 @@ void set_font(i3Font *font) { * Frees the resources taken by the current font. * */ -void free_font() { +void free_font(void) { /* Close the font and free the info */ xcb_close_font(conn, savedFont->id); if (savedFont->info) diff --git a/src/cfgparse.y b/src/cfgparse.y index 676e0d11..7aeb0a7e 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -51,7 +51,7 @@ void yyerror(const char *error_message) { ELOG("\n"); } -int yywrap() { +int yywrap(void) { return 1; } diff --git a/src/commands.c b/src/commands.c index 8111b54c..2df26f6c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -108,7 +108,7 @@ static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) { } #endif -void cmd_MIGRATION_start_nagbar() { +void cmd_MIGRATION_start_nagbar(void) { if (migration_pid != -1) { fprintf(stderr, "i3-nagbar already running.\n"); return; diff --git a/src/commands_parser.c b/src/commands_parser.c index 27a782a2..d15fea35 100644 --- a/src/commands_parser.c +++ b/src/commands_parser.c @@ -110,7 +110,7 @@ static char *get_string(const char *identifier) { return NULL; } -static void clear_stack() { +static void clear_stack(void) { DLOG("clearing stack.\n"); for (int c = 0; c < 10; c++) { if (stack[c].str != NULL) diff --git a/src/config.c b/src/config.c index de59420a..50ec2823 100644 --- a/src/config.c +++ b/src/config.c @@ -81,7 +81,7 @@ Binding *get_binding(uint16_t modifiers, xcb_keycode_t keycode) { * Translates keysymbols to keycodes for all bindings which use keysyms. * */ -void translate_keysyms() { +void translate_keysyms(void) { Binding *bind; xcb_keysym_t keysym; int col; diff --git a/src/ewmh.c b/src/ewmh.c index a11d4658..1c6d918b 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -16,7 +16,7 @@ * and _NET_NUMBER_OF_DESKTOPS - 1. * */ -void ewmh_update_current_desktop() { +void ewmh_update_current_desktop(void) { Con *focused_ws = con_get_workspace(focused); Con *output; uint32_t idx = 0; @@ -59,7 +59,7 @@ void ewmh_update_active_window(xcb_window_t window) { * desktop applications to place desktop icons appropriately. * */ -void ewmh_update_workarea() { +void ewmh_update_workarea(void) { int num_workspaces = 0, count = 0; Rect last_rect = {0, 0, 0, 0}; Con *output; @@ -131,7 +131,7 @@ void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows) { * Set up the EWMH hints on the root window. * */ -void ewmh_setup_hints() { +void ewmh_setup_hints(void) { xcb_atom_t supported_atoms[] = { #define xmacro(atom) A_ ## atom, #include "atoms.xmacro" diff --git a/src/floating.c b/src/floating.c index 0b246847..3b691169 100644 --- a/src/floating.c +++ b/src/floating.c @@ -15,7 +15,7 @@ extern xcb_connection_t *conn; * Calculates sum of heights and sum of widths of all currently active outputs * */ -Rect total_outputs_dimensions() { +static Rect total_outputs_dimensions(void) { Output *output; /* Use Rect to encapsulate dimensions, ignoring x/y */ Rect outputs_dimensions = {0, 0, 0, 0}; diff --git a/src/handlers.c b/src/handlers.c index 688cf2f6..490bf6eb 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -1007,7 +1007,7 @@ static struct property_handler_t property_handlers[] = { * received from X11 * */ -void property_handlers_init() { +void property_handlers_init(void) { sn_monitor_context_new(sndisplay, conn_screen, startup_monitor_event, NULL, NULL); diff --git a/src/ipc.c b/src/ipc.c index 3733034d..40ad8684 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -97,7 +97,7 @@ void ipc_send_event(const char *event, uint32_t message_type, const char *payloa * when exiting or restarting only! * */ -void ipc_shutdown() { +void ipc_shutdown(void) { ipc_client *current; while (!TAILQ_EMPTY(&all_clients)) { current = TAILQ_FIRST(&all_clients); diff --git a/src/log.c b/src/log.c index 7b7eca50..fd98081b 100644 --- a/src/log.c +++ b/src/log.c @@ -59,7 +59,7 @@ static int logbuffer_shm; * Necessary to print the i3 SHM log in the correct order. * */ -static void store_log_markers() { +static void store_log_markers(void) { i3_shmlog_header *header = (i3_shmlog_header*)logbuffer; header->offset_next_write = (logwalk - logbuffer); @@ -74,7 +74,7 @@ static void store_log_markers() { * Will be called twice if --shmlog-size is specified. * */ -void init_logging() { +void init_logging(void) { if (!errorfilename) { if (!(errorfilename = get_process_filename("errorlog"))) ELOG("Could not initialize errorlog\n"); diff --git a/src/main.c b/src/main.c index c4cffa5c..0d724607 100644 --- a/src/main.c +++ b/src/main.c @@ -212,7 +212,7 @@ static void xkb_got_event(EV_P_ struct ev_io *w, int revents) { * Exit handler which destroys the main_loop. Will trigger cleanup handlers. * */ -static void i3_exit() { +static void i3_exit(void) { /* We need ev >= 4 for the following code. Since it is not *that* important (it * only makes sure that there are no i3-nagbar instances left behind) we still * support old systems with libev 3. */ diff --git a/src/manage.c b/src/manage.c index b0a6aafa..ea060d97 100644 --- a/src/manage.c +++ b/src/manage.c @@ -47,7 +47,7 @@ void manage_existing_windows(xcb_window_t root) { * side-effects which are to be expected when continuing to run i3. * */ -void restore_geometry() { +void restore_geometry(void) { DLOG("Restoring geometry\n"); Con *con; diff --git a/src/randr.c b/src/randr.c index 85f0eab3..73adbf0e 100644 --- a/src/randr.c +++ b/src/randr.c @@ -60,7 +60,7 @@ Output *get_output_by_name(const char *name) { * Returns the first output which is active. * */ -Output *get_first_output() { +Output *get_first_output(void) { Output *output; TAILQ_FOREACH(output, &outputs, outputs) @@ -539,7 +539,7 @@ static void handle_output(xcb_connection_t *conn, xcb_randr_output_t id, * (Re-)queries the outputs via RandR and stores them in the list of outputs. * */ -void randr_query_outputs() { +void randr_query_outputs(void) { Output *output, *other, *first; xcb_randr_get_output_primary_cookie_t pcookie; xcb_randr_get_screen_resources_current_cookie_t rcookie; diff --git a/src/sighandler.c b/src/sighandler.c index 4a0c13b5..fa608ed8 100644 --- a/src/sighandler.c +++ b/src/sighandler.c @@ -192,7 +192,7 @@ void handle_signal(int sig, siginfo_t *info, void *data) { * Setup signal handlers to safely handle SIGSEGV and SIGFPE * */ -void setup_signal_handler() { +void setup_signal_handler(void) { struct sigaction action; action.sa_sigaction = handle_signal; diff --git a/src/tree.c b/src/tree.c index 5559908f..f29369c6 100644 --- a/src/tree.c +++ b/src/tree.c @@ -19,7 +19,7 @@ struct all_cons_head all_cons = TAILQ_HEAD_INITIALIZER(all_cons); * __i3_scratch will live there. * */ -static Con *_create___i3() { +static Con *_create___i3(void) { Con *__i3 = con_new(croot, NULL); FREE(__i3->name); __i3->name = sstrdup("__i3"); @@ -378,7 +378,7 @@ void tree_split(Con *con, orientation_t orientation) { * Moves focus one level up. * */ -void level_up() { +void level_up(void) { /* We cannot go up when we are in fullscreen mode at the moment, that would * be totally not intuitive */ if (focused->fullscreen_mode != CF_NONE) { @@ -399,7 +399,7 @@ void level_up() { * Moves focus one level down. * */ -void level_down() { +void level_down(void) { /* Go down the focus stack of the current node */ Con *next = TAILQ_FIRST(&(focused->focus_head)); if (next == TAILQ_END(&(focused->focus_head))) { @@ -428,7 +428,7 @@ static void mark_unmapped(Con *con) { * pushing the changes to X11 using x_push_changes(). * */ -void tree_render() { +void tree_render(void) { if (croot == NULL) return; diff --git a/src/util.c b/src/util.c index 70984f2b..d337963e 100644 --- a/src/util.c +++ b/src/util.c @@ -222,7 +222,7 @@ char *get_process_filename(const char *prefix) { #define y(x, ...) yajl_gen_ ## x (gen, ##__VA_ARGS__) #define ystr(str) yajl_gen_string(gen, (unsigned char*)str, strlen(str)) -char *store_restart_layout() { +char *store_restart_layout(void) { setlocale(LC_NUMERIC, "C"); #if YAJL_MAJOR >= 2 yajl_gen gen = yajl_gen_alloc(NULL); diff --git a/src/workspace.c b/src/workspace.c index 4fc8ba1b..75b8a7b3 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -393,7 +393,7 @@ void workspace_show_by_name(const char *num) { * Focuses the next workspace. * */ -Con* workspace_next() { +Con* workspace_next(void) { Con *current = con_get_workspace(focused); Con *next = NULL; Con *output; @@ -463,7 +463,7 @@ workspace_next_end: * Focuses the previous workspace. * */ -Con* workspace_prev() { +Con* workspace_prev(void) { Con *current = con_get_workspace(focused); Con *prev = NULL; Con *output; @@ -535,7 +535,7 @@ workspace_prev_end: * Focuses the next workspace on the same output. * */ -Con* workspace_next_on_output() { +Con* workspace_next_on_output(void) { Con *current = con_get_workspace(focused); Con *next = NULL; Con *output = con_get_output(focused); @@ -590,7 +590,7 @@ workspace_next_on_output_end: * Focuses the previous workspace on same output. * */ -Con* workspace_prev_on_output() { +Con* workspace_prev_on_output(void) { Con *current = con_get_workspace(focused); Con *prev = NULL; Con *output = con_get_output(focused); @@ -646,7 +646,7 @@ workspace_prev_on_output_end: * Focuses the previously focused workspace. * */ -void workspace_back_and_forth() { +void workspace_back_and_forth(void) { if (!previous_workspace_name) { DLOG("No previous workspace name set. Not switching."); return; diff --git a/src/x.c b/src/x.c index f2b53251..08eb8fee 100644 --- a/src/x.c +++ b/src/x.c @@ -1013,7 +1013,7 @@ void x_set_name(Con *con, const char *name) { * Sets up i3 specific atoms (I3_SOCKET_PATH and I3_CONFIG_PATH) * */ -void x_set_i3_atoms() { +void x_set_i3_atoms(void) { xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A_I3_SOCKET_PATH, A_UTF8_STRING, 8, (current_socketpath == NULL ? 0 : strlen(current_socketpath)), current_socketpath); diff --git a/src/xcursor.c b/src/xcursor.c index f04a3959..058b7ae0 100644 --- a/src/xcursor.c +++ b/src/xcursor.c @@ -31,7 +31,7 @@ static Cursor load_cursor(const char *name) { return c; } -void xcursor_load_cursors() { +void xcursor_load_cursors(void) { cursors[XCURSOR_CURSOR_POINTER] = load_cursor("left_ptr"); cursors[XCURSOR_CURSOR_RESIZE_HORIZONTAL] = load_cursor("sb_h_double_arrow"); cursors[XCURSOR_CURSOR_RESIZE_VERTICAL] = load_cursor("sb_v_double_arrow"); diff --git a/src/xinerama.c b/src/xinerama.c index c3ad97c3..f377840f 100644 --- a/src/xinerama.c +++ b/src/xinerama.c @@ -90,7 +90,7 @@ static void query_screens(xcb_connection_t *conn) { * information to setup workspaces for each screen. * */ -void xinerama_init() { +void xinerama_init(void) { if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) { DLOG("Xinerama extension not found, disabling.\n"); disable_randr(conn); -- 2.39.2