CLEANUP: Do not use a fixed type for 'sizeof' in 'calloc'
Changes performed using the following coccinelle patch:
@@
type T;
expression E;
expression t;
@@
(
t = calloc(E, sizeof(*t))
|
- t = calloc(E, sizeof(T))
+ t = calloc(E, sizeof(*t))
)
Looking through the commit history, grepping for coccinelle shows that the same
replacement with a different patch was already performed in the past in commit
02779b6263a177b1e462e53db6eaf57bcda574bc.
diff --git a/src/fd.c b/src/fd.c
index c72dddd..d05df58 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -655,13 +655,13 @@
int p;
struct poller *bp;
- if ((fdtab = calloc(global.maxsock, sizeof(struct fdtab))) == NULL)
+ if ((fdtab = calloc(global.maxsock, sizeof(*fdtab))) == NULL)
goto fail_tab;
if ((polled_mask = calloc(global.maxsock, sizeof(*polled_mask))) == NULL)
goto fail_polledmask;
- if ((fdinfo = calloc(global.maxsock, sizeof(struct fdinfo))) == NULL)
+ if ((fdinfo = calloc(global.maxsock, sizeof(*fdinfo))) == NULL)
goto fail_info;
update_list.first = update_list.last = -1;