From dc2b6e5f3985354d42ea015afc15be2258d6b660 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 1 Apr 2012 12:28:28 +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. --- i3lock.c | 6 +++--- unlock_indicator.c | 6 +++--- unlock_indicator.h | 6 +++--- xinerama.c | 4 ++-- xinerama.h | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/i3lock.c b/i3lock.c index 895d50a..9c55db2 100644 --- a/i3lock.c +++ b/i3lock.c @@ -75,7 +75,7 @@ bool tile = false; * cold-boot attacks. * */ -static void clear_password_memory() { +static void clear_password_memory(void) { /* A volatile pointer to the password buffer to prevent the compiler from * optimizing this out. */ volatile char *vpassword = password; @@ -105,7 +105,7 @@ static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) { clear_pam_wrong_timeout = NULL; } -static void input_done() { +static void input_done(void) { if (input_position == 0) return; @@ -406,7 +406,7 @@ static void handle_mapping_notify(xcb_mapping_notify_event_t *event) { * and also redraw the image, if any. * */ -void handle_screen_resize() { +void handle_screen_resize(void) { xcb_get_geometry_cookie_t geomc; xcb_get_geometry_reply_t *geom; geomc = xcb_get_geometry(conn, screen->root); diff --git a/unlock_indicator.c b/unlock_indicator.c index d603531..3a33ca9 100644 --- a/unlock_indicator.c +++ b/unlock_indicator.c @@ -272,7 +272,7 @@ xcb_pixmap_t draw_image(uint32_t *resolution) { * Calls draw_image on a new pixmap and swaps that with the current pixmap * */ -void redraw_screen() { +void redraw_screen(void) { xcb_pixmap_t bg_pixmap = draw_image(last_resolution); xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[1]){ bg_pixmap }); /* XXX: Possible optimization: Only update the area in the middle of the @@ -303,7 +303,7 @@ static void clear_indicator(EV_P_ ev_timer *w, int revents) { * after an unsuccessful authentication attempt. * */ -void start_clear_indicator_timeout() { +void start_clear_indicator_timeout(void) { if (clear_indicator_timeout) { ev_timer_stop(main_loop, clear_indicator_timeout); ev_timer_set(clear_indicator_timeout, 1.0, 0.); @@ -322,7 +322,7 @@ void start_clear_indicator_timeout() { * Stops the clear_indicator timeout. * */ -void stop_clear_indicator_timeout() { +void stop_clear_indicator_timeout(void) { if (clear_indicator_timeout) { ev_timer_stop(main_loop, clear_indicator_timeout); free(clear_indicator_timeout); diff --git a/unlock_indicator.h b/unlock_indicator.h index 8f039d2..e07c2a0 100644 --- a/unlock_indicator.h +++ b/unlock_indicator.h @@ -17,8 +17,8 @@ typedef enum { } pam_state_t; xcb_pixmap_t draw_image(uint32_t* resolution); -void redraw_screen(); -void start_clear_indicator_timeout(); -void stop_clear_indicator_timeout(); +void redraw_screen(void); +void start_clear_indicator_timeout(void); +void stop_clear_indicator_timeout(void); #endif diff --git a/xinerama.c b/xinerama.c index 6a3557c..e4b87a4 100644 --- a/xinerama.c +++ b/xinerama.c @@ -26,7 +26,7 @@ Rect *xr_resolutions; static bool xinerama_active; extern bool debug_mode; -void xinerama_init() { +void xinerama_init(void) { if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) { DEBUG("Xinerama extension not found, disabling.\n"); return; @@ -48,7 +48,7 @@ void xinerama_init() { xinerama_active = true; } -void xinerama_query_screens() { +void xinerama_query_screens(void) { if (!xinerama_active) return; diff --git a/xinerama.h b/xinerama.h index 207a9a8..a0de3c1 100644 --- a/xinerama.h +++ b/xinerama.h @@ -11,7 +11,7 @@ typedef struct Rect { extern int xr_screens; extern Rect *xr_resolutions; -void xinerama_init(); -void xinerama_query_screens(); +void xinerama_init(void); +void xinerama_query_screens(void); #endif -- 2.39.5