Skip to content

Commit

Permalink
Use (void) instead of () for functions without args (Thanks fernandotcl)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stapelberg committed Apr 1, 2012
1 parent 3c2436c commit dc2b6e5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions i3lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions unlock_indicator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions unlock_indicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions xinerama.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -48,7 +48,7 @@ void xinerama_init() {
xinerama_active = true;
}

void xinerama_query_screens() {
void xinerama_query_screens(void) {
if (!xinerama_active)
return;

Expand Down
4 changes: 2 additions & 2 deletions xinerama.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dc2b6e5

Please sign in to comment.