diff --git a/mi/miarc.c b/mi/miarc.c index d8e7e325f..de869d2f7 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -1191,9 +1191,9 @@ miFillSppPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points */ y = ymax - ymin + 1; if ((count < 3) || (y <= 0)) return; - ptsOut = FirstPoint = xallocarray(y, sizeof(DDXPointRec)); - width = FirstWidth = xallocarray(y, sizeof(int)); - Marked = xallocarray(count, sizeof(int)); + ptsOut = FirstPoint = calloc(y, sizeof(DDXPointRec)); + width = FirstWidth = calloc(y, sizeof(int)); + Marked = calloc(count, sizeof(int)); if (!ptsOut || !width || !Marked) { free(Marked); @@ -1893,10 +1893,10 @@ miComputeArcs(xArc * parcs, int narcs, GCPtr pGC) isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashOffset = pGC->dashOffset; - data = xallocarray(narcs, sizeof(struct arcData)); + data = calloc(narcs, sizeof(struct arcData)); if (!data) return NULL; - arcs = xallocarray(isDoubleDash ? 2 : 1, sizeof(*arcs)); + arcs = calloc(isDoubleDash ? 2 : 1, sizeof(*arcs)); if (!arcs) { free(data); return NULL; @@ -3083,8 +3083,8 @@ fillSpans(DrawablePtr pDrawable, GCPtr pGC) if (nspans == 0) return; - xSpan = xSpans = xallocarray(nspans, sizeof(DDXPointRec)); - xWidth = xWidths = xallocarray(nspans, sizeof(int)); + xSpan = xSpans = calloc(nspans, sizeof(DDXPointRec)); + xWidth = xWidths = calloc(nspans, sizeof(int)); if (xSpans && xWidths) { i = 0; f = finalSpans; @@ -3138,7 +3138,7 @@ realFindSpan(int y) else change = SPAN_REALLOC; newSize = finalSize + change; - newSpans = xallocarray(newSize, sizeof(struct finalSpan *)); + newSpans = calloc(newSize, sizeof(struct finalSpan *)); if (!newSpans) return NULL; newMiny = finalMiny; diff --git a/mi/micmap.c b/mi/micmap.c index c0dc27b77..2e6aba7a4 100644 --- a/mi/micmap.c +++ b/mi/micmap.c @@ -467,9 +467,9 @@ miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp, ndepth++; nvisual += visuals->count; } - depth = xallocarray(ndepth, sizeof(DepthRec)); - visual = xallocarray(nvisual, sizeof(VisualRec)); - preferredCVCs = xallocarray(ndepth, sizeof(int)); + depth = calloc(ndepth, sizeof(DepthRec)); + visual = calloc(nvisual, sizeof(VisualRec)); + preferredCVCs = calloc(ndepth, sizeof(int)); if (!depth || !visual || !preferredCVCs) { free(depth); free(visual); @@ -490,7 +490,7 @@ miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp, prefp++; vid = NULL; if (nvtype) { - vid = xallocarray(nvtype, sizeof(VisualID)); + vid = calloc(nvtype, sizeof(VisualID)); if (!vid) { free(depth); free(visual); diff --git a/mi/micopy.c b/mi/micopy.c index f2bc9deef..24b0a77b5 100644 --- a/mi/micopy.c +++ b/mi/micopy.c @@ -60,7 +60,7 @@ miCopyRegion(DrawablePtr pSrcDrawable, if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ - pboxNew1 = xallocarray(nbox, sizeof(BoxRec)); + pboxNew1 = calloc(nbox, sizeof(BoxRec)); if (!pboxNew1) return; pboxBase = pboxNext = pbox + nbox - 1; @@ -91,7 +91,7 @@ miCopyRegion(DrawablePtr pSrcDrawable, if (nbox > 1) { /* reverse order of rects in each band */ - pboxNew2 = xallocarray(nbox, sizeof(BoxRec)); + pboxNew2 = calloc(nbox, sizeof(BoxRec)); if (!pboxNew2) { free(pboxNew1); return; diff --git a/mi/miexpose.c b/mi/miexpose.c index 3c322e60d..9b3ea4ef4 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -519,7 +519,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) regionnumrects = RegionNumRects(prgn); if (regionnumrects == 0) return; - prect = xallocarray(regionnumrects, sizeof(xRectangle)); + prect = calloc(regionnumrects, sizeof(xRectangle)); if (!prect) return; diff --git a/mi/miglblt.c b/mi/miglblt.c index a3e625a20..230f29200 100644 --- a/mi/miglblt.c +++ b/mi/miglblt.c @@ -130,7 +130,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int ngly gcvals); nbyLine = BitmapBytePad(width); - pbits = xallocarray(height, nbyLine); + pbits = calloc(height, nbyLine); if (!pbits) { dixDestroyPixmap(pPixmap, 0); FreeScratchGC(pGCtmp); diff --git a/mi/mipoly.c b/mi/mipoly.c index 559c6b607..806980970 100644 --- a/mi/mipoly.c +++ b/mi/mipoly.c @@ -410,8 +410,8 @@ miFillConvexPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn) dy = ymax - ymin + 1; if ((count < 3) || (dy < 0)) return TRUE; - ptsOut = FirstPoint = xallocarray(dy, sizeof(DDXPointRec)); - width = FirstWidth = xallocarray(dy, sizeof(int)); + ptsOut = FirstPoint = calloc(dy, sizeof(DDXPointRec)); + width = FirstWidth = calloc(dy, sizeof(int)); if (!FirstPoint || !FirstWidth) { free(FirstWidth); free(FirstPoint); diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c index 1f688a028..1a508bfbd 100644 --- a/mi/mipolypnt.c +++ b/mi/mipolypnt.c @@ -65,7 +65,7 @@ miPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */ int i; xPoint *ppt; - if (!(pwidthInit = xallocarray(npt, sizeof(int)))) + if (!(pwidthInit = calloc(npt, sizeof(int)))) return; /* make pointlist origin relative */ diff --git a/mi/mipolyrect.c b/mi/mipolyrect.c index acec81fb3..1f38ae2af 100644 --- a/mi/mipolyrect.c +++ b/mi/mipolyrect.c @@ -86,7 +86,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects) offset2 = pGC->lineWidth; offset1 = offset2 >> 1; offset3 = offset2 - offset1; - tmp = xallocarray(ntmp, sizeof(xRectangle)); + tmp = calloc(ntmp, sizeof(xRectangle)); if (!tmp) return; t = tmp; diff --git a/mi/miwideline.c b/mi/miwideline.c index cefd2552e..85864e1bb 100644 --- a/mi/miwideline.c +++ b/mi/miwideline.c @@ -443,8 +443,8 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup) ylength = spanGroup->ymax - ymin + 1; /* Allocate Spans for y buckets */ - yspans = xallocarray(ylength, sizeof(Spans)); - ysizes = xallocarray(ylength, sizeof(int)); + yspans = calloc(ylength, sizeof(Spans)); + ysizes = calloc(ylength, sizeof(int)); if (!yspans || !ysizes) { free(yspans); @@ -511,8 +511,8 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup) } /* for i thorough Spans */ /* Now sort by x and uniquify each bucket into the final array */ - points = xallocarray(count, sizeof(DDXPointRec)); - widths = xallocarray(count, sizeof(int)); + points = calloc(count, sizeof(DDXPointRec)); + widths = calloc(count, sizeof(int)); if (!points || !widths) { for (i = 0; i < ylength; i++) { free(yspans[i].points); @@ -559,10 +559,10 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup) static Bool InitSpans(Spans * spans, size_t nspans) { - spans->points = xallocarray(nspans, sizeof(*spans->points)); + spans->points = calloc(nspans, sizeof(*spans->points)); if (!spans->points) return FALSE; - spans->widths = xallocarray(nspans, sizeof(*spans->widths)); + spans->widths = calloc(nspans, sizeof(*spans->widths)); if (!spans->widths) { free(spans->points); return FALSE; diff --git a/mi/mizerarc.c b/mi/mizerarc.c index 90dde9f8b..f52107ce9 100644 --- a/mi/mizerarc.c +++ b/mi/mizerarc.c @@ -671,7 +671,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) numPts = maxPts << 2; dospans = (pGC->fillStyle != FillSolid); if (dospans) { - widths = xallocarray(numPts, sizeof(int)); + widths = calloc(numPts, sizeof(int)); if (!widths) return; maxw = 0; @@ -687,7 +687,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs) (unsigned char *) pGC->dash, (int) pGC->numInDashList, &dinfo.dashOffsetInit); } - points = xallocarray(numPts, sizeof(DDXPointRec)); + points = calloc(numPts, sizeof(DDXPointRec)); if (!points) { if (dospans) { free(widths); diff --git a/mi/mizerline.c b/mi/mizerline.c index dc4790ba8..338df518c 100644 --- a/mi/mizerline.c +++ b/mi/mizerline.c @@ -148,8 +148,8 @@ miZeroLine(DrawablePtr pDraw, GCPtr pGC, int mode, /* Origin or Previous */ width = xright - xleft + 1; height = ybottom - ytop + 1; list_len = (height >= width) ? height : width; - pspanInit = xallocarray(list_len, sizeof(DDXPointRec)); - pwidthInit = xallocarray(list_len, sizeof(int)); + pspanInit = calloc(list_len, sizeof(DDXPointRec)); + pwidthInit = calloc(list_len, sizeof(int)); if (!pspanInit || !pwidthInit) { free(pspanInit); free(pwidthInit);