Browse Source

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.
master
Michael Stapelberg 13 years ago
parent
commit
dc2b6e5f39
  1. 6
      i3lock.c
  2. 6
      unlock_indicator.c
  3. 6
      unlock_indicator.h
  4. 4
      xinerama.c
  5. 4
      xinerama.h

6
i3lock.c

@ -75,7 +75,7 @@ bool tile = false;
* cold-boot attacks. * 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 /* A volatile pointer to the password buffer to prevent the compiler from
* optimizing this out. */ * optimizing this out. */
volatile char *vpassword = password; 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; clear_pam_wrong_timeout = NULL;
} }
static void input_done() { static void input_done(void) {
if (input_position == 0) if (input_position == 0)
return; return;
@ -406,7 +406,7 @@ static void handle_mapping_notify(xcb_mapping_notify_event_t *event) {
* and also redraw the image, if any. * 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_cookie_t geomc;
xcb_get_geometry_reply_t *geom; xcb_get_geometry_reply_t *geom;
geomc = xcb_get_geometry(conn, screen->root); geomc = xcb_get_geometry(conn, screen->root);

6
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 * 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_pixmap_t bg_pixmap = draw_image(last_resolution);
xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[1]){ bg_pixmap }); 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 /* 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. * after an unsuccessful authentication attempt.
* *
*/ */
void start_clear_indicator_timeout() { void start_clear_indicator_timeout(void) {
if (clear_indicator_timeout) { if (clear_indicator_timeout) {
ev_timer_stop(main_loop, clear_indicator_timeout); ev_timer_stop(main_loop, clear_indicator_timeout);
ev_timer_set(clear_indicator_timeout, 1.0, 0.); ev_timer_set(clear_indicator_timeout, 1.0, 0.);
@ -322,7 +322,7 @@ void start_clear_indicator_timeout() {
* Stops the clear_indicator timeout. * Stops the clear_indicator timeout.
* *
*/ */
void stop_clear_indicator_timeout() { void stop_clear_indicator_timeout(void) {
if (clear_indicator_timeout) { if (clear_indicator_timeout) {
ev_timer_stop(main_loop, clear_indicator_timeout); ev_timer_stop(main_loop, clear_indicator_timeout);
free(clear_indicator_timeout); free(clear_indicator_timeout);

6
unlock_indicator.h

@ -17,8 +17,8 @@ typedef enum {
} pam_state_t; } pam_state_t;
xcb_pixmap_t draw_image(uint32_t* resolution); xcb_pixmap_t draw_image(uint32_t* resolution);
void redraw_screen(); void redraw_screen(void);
void start_clear_indicator_timeout(); void start_clear_indicator_timeout(void);
void stop_clear_indicator_timeout(); void stop_clear_indicator_timeout(void);
#endif #endif

4
xinerama.c

@ -26,7 +26,7 @@ Rect *xr_resolutions;
static bool xinerama_active; static bool xinerama_active;
extern bool debug_mode; extern bool debug_mode;
void xinerama_init() { void xinerama_init(void) {
if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) { if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) {
DEBUG("Xinerama extension not found, disabling.\n"); DEBUG("Xinerama extension not found, disabling.\n");
return; return;
@ -48,7 +48,7 @@ void xinerama_init() {
xinerama_active = true; xinerama_active = true;
} }
void xinerama_query_screens() { void xinerama_query_screens(void) {
if (!xinerama_active) if (!xinerama_active)
return; return;

4
xinerama.h

@ -11,7 +11,7 @@ typedef struct Rect {
extern int xr_screens; extern int xr_screens;
extern Rect *xr_resolutions; extern Rect *xr_resolutions;
void xinerama_init(); void xinerama_init(void);
void xinerama_query_screens(); void xinerama_query_screens(void);
#endif #endif

Loading…
Cancel
Save