mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
render: 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:
committed by
Enrico Weigelt, metux IT consult .
parent
2263e514c4
commit
d481c8311a
@@ -1316,14 +1316,14 @@ ProcRenderCompositeGlyphs(ClientPtr client)
|
||||
if (nglyph <= NLOCALGLYPH)
|
||||
glyphsBase = glyphsLocal;
|
||||
else {
|
||||
glyphsBase = xallocarray(nglyph, sizeof(GlyphPtr));
|
||||
glyphsBase = calloc(nglyph, sizeof(GlyphPtr));
|
||||
if (!glyphsBase)
|
||||
return BadAlloc;
|
||||
}
|
||||
if (nlist <= NLOCALDELTA)
|
||||
listsBase = listsLocal;
|
||||
else {
|
||||
listsBase = xallocarray(nlist, sizeof(GlyphListRec));
|
||||
listsBase = calloc(nlist, sizeof(GlyphListRec));
|
||||
if (!listsBase) {
|
||||
rc = BadAlloc;
|
||||
goto bail;
|
||||
@@ -1799,7 +1799,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
|
||||
ncursor =
|
||||
(client->req_len -
|
||||
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
|
||||
cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
|
||||
cursors = calloc(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
|
||||
if (!cursors)
|
||||
return BadAlloc;
|
||||
deltas = (CARD32 *) (cursors + ncursor);
|
||||
|
||||
Reference in New Issue
Block a user