(1823) fb: 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
a1ff7094e8
commit
90f32aa77b
|
@ -192,7 +192,7 @@ fbCopyNto1(DrawablePtr pSrcDrawable,
|
||||||
height = pbox->y2 - pbox->y1;
|
height = pbox->y2 - pbox->y1;
|
||||||
|
|
||||||
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
|
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
|
||||||
tmp = xallocarray(tmpStride * height, sizeof(FbStip));
|
tmp = calloc(tmpStride * height, sizeof(FbStip));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ fbGlyphs(CARD8 op,
|
||||||
pixman_glyph_cache_freeze (glyphCache);
|
pixman_glyph_cache_freeze (glyphCache);
|
||||||
|
|
||||||
if (n_glyphs > N_STACK_GLYPHS) {
|
if (n_glyphs > N_STACK_GLYPHS) {
|
||||||
if (!(pglyphs = xallocarray(n_glyphs, sizeof(pixman_glyph_t))))
|
if (!(pglyphs = calloc(n_glyphs, sizeof(pixman_glyph_t))))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue