From ada2567032f5d72f2a114603981134122f3419a5 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 5 Aug 2024 18:25:21 +0200 Subject: [PATCH] fix -Werror=calloc-transposed-args by swapping calloc args (#361) --- i3lock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i3lock.c b/i3lock.c index 9cae376..2e02893 100644 --- a/i3lock.c +++ b/i3lock.c @@ -205,7 +205,7 @@ ev_timer *start_timer(ev_timer *timer_obj, ev_tstamp timeout, ev_callback_t call } else { /* When there is no memory, we just don’t have a timeout. We cannot * exit() here, since that would effectively unlock the screen. */ - timer_obj = calloc(sizeof(struct ev_timer), 1); + timer_obj = calloc(1, sizeof(struct ev_timer)); if (timer_obj) { ev_timer_init(timer_obj, callback, timeout, 0.); ev_timer_start(main_loop, timer_obj); @@ -1301,9 +1301,9 @@ int main(int argc, char *argv[]) { auth_state = STATE_AUTH_IDLE; redraw_screen(); - struct ev_io *xcb_watcher = calloc(sizeof(struct ev_io), 1); - struct ev_check *xcb_check = calloc(sizeof(struct ev_check), 1); - struct ev_prepare *xcb_prepare = calloc(sizeof(struct ev_prepare), 1); + struct ev_io *xcb_watcher = calloc(1, sizeof(struct ev_io)); + struct ev_check *xcb_check = calloc(1, sizeof(struct ev_check)); + struct ev_prepare *xcb_prepare = calloc(1, sizeof(struct ev_prepare)); ev_io_init(xcb_watcher, xcb_got_event, xcb_get_file_descriptor(conn), EV_READ); ev_io_start(main_loop, xcb_watcher);