xfixes: 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:
parent
037a595ad7
commit
f55e01f5d8
|
@ -748,7 +748,7 @@ ProcXFixesExpandRegion(ClientPtr client)
|
||||||
nBoxes = RegionNumRects(pSource);
|
nBoxes = RegionNumRects(pSource);
|
||||||
pSrc = RegionRects(pSource);
|
pSrc = RegionRects(pSource);
|
||||||
if (nBoxes) {
|
if (nBoxes) {
|
||||||
pTmp = xallocarray(nBoxes, sizeof(BoxRec));
|
pTmp = calloc(nBoxes, sizeof(BoxRec));
|
||||||
if (!pTmp)
|
if (!pTmp)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
for (i = 0; i < nBoxes; i++) {
|
for (i = 0; i < nBoxes; i++) {
|
||||||
|
|
Loading…
Reference in New Issue