]> git.sur5r.net Git - i3/i3/commitdiff
use scalloc instead of some places where calloc was still used
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 2 Mar 2010 13:42:24 +0000 (14:42 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 2 Mar 2010 13:42:24 +0000 (14:42 +0100)
src/ipc.c
src/manage.c
src/table.c

index b4356fda74efdff42915b660d572d26b5b68d97c..f7aeccf433dee4cc5346afd418a7ea4b65557824 100644 (file)
--- 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);
index d685a8d24208be598e13e4cd4794a78ca181d01e..93ae48659ff8b525895fc436c95af5a25a728758 100644 (file)
@@ -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 */
index 1660d308a1e8af9dfb06ed802f6cdd5e4d3be680..71081013001c825355279b7eac9a50c1efc82dde 100644 (file)
@@ -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++)