Commit e0491f47 authored by Daniel Stone's avatar Daniel Stone
Browse files

Render: Remove usage of alloca

Replace it with heap-based allocations.
parent 59774af8
......@@ -144,7 +144,7 @@ miTriStrip (CARD8 op,
if (npoint < 3)
return;
ntri = npoint - 2;
tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle));
tris = xalloc (ntri * sizeof (xTriangle));
if (!tris)
return;
for (tri = tris; npoint >= 3; npoint--, points++, tri++)
......@@ -154,7 +154,7 @@ miTriStrip (CARD8 op,
tri->p3 = points[2];
}
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
DEALLOCATE_LOCAL (tris);
xfree (tris);
}
void
......@@ -176,7 +176,7 @@ miTriFan (CARD8 op,
if (npoint < 3)
return;
ntri = npoint - 2;
tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle));
tris = xalloc (ntri * sizeof (xTriangle));
if (!tris)
return;
first = points++;
......@@ -187,5 +187,5 @@ miTriFan (CARD8 op,
tri->p3 = points[1];
}
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
DEALLOCATE_LOCAL (tris);
xfree (tris);
}
......@@ -1409,7 +1409,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
glyphsBase = glyphsLocal;
else
{
glyphsBase = (GlyphPtr *) ALLOCATE_LOCAL (nglyph * sizeof (GlyphPtr));
glyphsBase = (GlyphPtr *) xalloc (nglyph * sizeof (GlyphPtr));
if (!glyphsBase)
return BadAlloc;
}
......@@ -1417,7 +1417,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
listsBase = listsLocal;
else
{
listsBase = (GlyphListPtr) ALLOCATE_LOCAL (nlist * sizeof (GlyphListRec));
listsBase = (GlyphListPtr) xalloc (nlist * sizeof (GlyphListRec));
if (!listsBase)
return BadAlloc;
}
......@@ -1442,9 +1442,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
{
client->errorValue = gs;
if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase);
xfree (glyphsBase);
if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase);
xfree (listsBase);
return RenderErrBase + BadGlyphSet;
}
}
......@@ -1498,9 +1498,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
glyphsBase);
if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase);
xfree (glyphsBase);
if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase);
xfree (listsBase);
return client->noClientException;
}
......@@ -2965,7 +2965,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
RenderErrBase + BadPicture);
extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len)))
(extra = (char *) xalloc (extra_len)))
{
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -2991,7 +2991,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3016,7 +3016,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
(extra = (char *) xalloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -3053,7 +3053,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3078,7 +3078,7 @@ PanoramiXRenderTriangles(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
(extra = (char *) xalloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -3111,7 +3111,7 @@ PanoramiXRenderTriangles(ClientPtr client)
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3136,7 +3136,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
(extra = (char *) xalloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -3165,7 +3165,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3190,7 +3190,7 @@ PanoramiXRenderTriFan(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
(extra = (char *) xalloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -3219,7 +3219,7 @@ PanoramiXRenderTriFan(ClientPtr client)
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3244,7 +3244,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
(extra = (char *) xalloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -3265,7 +3265,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3288,7 +3288,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
(extra = (char *) xalloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) {
......@@ -3309,7 +3309,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......@@ -3332,7 +3332,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
RenderErrBase + BadPicture);
extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len)))
(extra = (char *) xalloc (extra_len)))
{
memcpy (extra, stuff + 1, extra_len);
x_off = stuff->xOff;
......@@ -3349,7 +3349,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
if(result != Success) break;
}
DEALLOCATE_LOCAL(extra);
xfree(extra);
}
return result;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment