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
b3ef1fbbd3
commit
e25852fd53
|
@ -192,7 +192,7 @@ fbCopyNto1(DrawablePtr pSrcDrawable,
|
|||
height = pbox->y2 - pbox->y1;
|
||||
|
||||
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
|
||||
tmp = xallocarray(tmpStride * height, sizeof(FbStip));
|
||||
tmp = calloc(tmpStride * height, sizeof(FbStip));
|
||||
if (!tmp)
|
||||
return;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ fbGlyphs(CARD8 op,
|
|||
pixman_glyph_cache_freeze (glyphCache);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue