mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
dix: replace xallocarray() by calloc()
Only key difference that calloc(), in contrast to rellocarray(),
is zero-initializing. The overhead is hard to measure on today's
machines, and it's safer programming practise to always allocate
zero-initialized, so one can't forget to do it explicitly.
Cocci rule:
@@
expression COUNT;
expression LEN;
@@
- xallocarray(COUNT,LEN)
+ calloc(COUNT,LEN)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -1041,7 +1041,7 @@ ProcQueryTree(ClientPtr client)
|
||||
if (numChildren) {
|
||||
int curChild = 0;
|
||||
|
||||
childIDs = xallocarray(numChildren, sizeof(Window));
|
||||
childIDs = calloc(numChildren, sizeof(Window));
|
||||
if (!childIDs)
|
||||
return BadAlloc;
|
||||
for (pChild = pWin->lastChild; pChild != pHead;
|
||||
|
||||
Reference in New Issue
Block a user