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.
This commit is contained in:
Michael Stapelberg 2012-03-31 10:53:04 +02:00
parent d519659ea7
commit 206b96202c
34 changed files with 53 additions and 53 deletions

View File

@ -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

View File

@ -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

View File

@ -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
/**

View File

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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -16,6 +16,6 @@
* Setup signal handlers to safely handle SIGSEGV and SIGFPE
*
*/
void setup_signal_handler();
void setup_signal_handler(void);
#endif

View File

@ -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().

View File

@ -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

View File

@ -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

View File

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

View File

@ -19,6 +19,6 @@
* Xinerama information to setup workspaces for each screen.
*
*/
void xinerama_init();
void xinerama_init(void);
#endif

View File

@ -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)

View File

@ -51,7 +51,7 @@ void yyerror(const char *error_message) {
ELOG("\n");
}
int yywrap() {
int yywrap(void) {
return 1;
}

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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"

View File

@ -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};

View File

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

View File

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

View File

@ -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");

View File

@ -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. */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -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;

View File

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

View File

@ -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");

View File

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