From d08ec003294481f5b2299099779fef623240bcfa Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 2 Mar 2010 14:42:24 +0100 Subject: [PATCH] use scalloc instead of some places where calloc was still used --- src/ipc.c | 4 ++-- src/manage.c | 2 +- src/table.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index b4356fda..f7aeccf4 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -201,13 +201,13 @@ void ipc_new_client(EV_P_ struct ev_io *w, int revents) { set_nonblock(client); - struct ev_io *package = calloc(sizeof(struct ev_io), 1); + struct ev_io *package = scalloc(sizeof(struct ev_io)); ev_io_init(package, ipc_receive_message, client, EV_READ); ev_io_start(EV_A_ package); DLOG("IPC: new client connected\n"); - struct ipc_client *new = calloc(sizeof(struct ipc_client), 1); + struct ipc_client *new = scalloc(sizeof(struct ipc_client)); new->fd = client; TAILQ_INSERT_TAIL(&all_clients, new, clients); diff --git a/src/manage.c b/src/manage.c index d685a8d2..93ae4865 100644 --- a/src/manage.c +++ b/src/manage.c @@ -160,7 +160,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child, LOG("Managing window 0x%08x\n", child); DLOG("x = %d, y = %d, width = %d, height = %d\n", x, y, width, height); - new = calloc(sizeof(Client), 1); + new = scalloc(sizeof(Client)); new->force_reconfigure = true; /* Update the data structures */ diff --git a/src/table.c b/src/table.c index 1660d308..71081013 100644 --- a/src/table.c +++ b/src/table.c @@ -53,7 +53,7 @@ void init_table() { static void new_container(Workspace *workspace, Container **container, int col, int row, bool skip_layout_switch) { Container *new; - new = *container = calloc(sizeof(Container), 1); + new = *container = scalloc(sizeof(Container)); CIRCLEQ_INIT(&(new->clients)); new->colspan = 1; new->rowspan = 1; @@ -131,7 +131,7 @@ void expand_table_cols(Workspace *workspace) { workspace->width_factor[workspace->cols-1] = 0; workspace->table = realloc(workspace->table, sizeof(Container**) * workspace->cols); - workspace->table[workspace->cols-1] = calloc(sizeof(Container*) * workspace->rows, 1); + workspace->table[workspace->cols-1] = scalloc(sizeof(Container*) * workspace->rows); for (int c = 0; c < workspace->rows; c++) new_container(workspace, &(workspace->table[workspace->cols-1][c]), workspace->cols-1, c, true); @@ -158,7 +158,7 @@ void expand_table_cols_at_head(Workspace *workspace) { workspace->width_factor[0] = 0; workspace->table = realloc(workspace->table, sizeof(Container**) * workspace->cols); - workspace->table[workspace->cols-1] = calloc(sizeof(Container*) * workspace->rows, 1); + workspace->table[workspace->cols-1] = scalloc(sizeof(Container*) * workspace->rows); /* Move the other columns */ for (int rows = 0; rows < workspace->rows; rows++)