Render: Remove usage of alloca
Replace it with heap-based allocations.
This commit is contained in:
parent
59774af86b
commit
e0491f470e
|
@ -144,7 +144,7 @@ miTriStrip (CARD8 op,
|
||||||
if (npoint < 3)
|
if (npoint < 3)
|
||||||
return;
|
return;
|
||||||
ntri = npoint - 2;
|
ntri = npoint - 2;
|
||||||
tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle));
|
tris = xalloc (ntri * sizeof (xTriangle));
|
||||||
if (!tris)
|
if (!tris)
|
||||||
return;
|
return;
|
||||||
for (tri = tris; npoint >= 3; npoint--, points++, tri++)
|
for (tri = tris; npoint >= 3; npoint--, points++, tri++)
|
||||||
|
@ -154,7 +154,7 @@ miTriStrip (CARD8 op,
|
||||||
tri->p3 = points[2];
|
tri->p3 = points[2];
|
||||||
}
|
}
|
||||||
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
||||||
DEALLOCATE_LOCAL (tris);
|
xfree (tris);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -176,7 +176,7 @@ miTriFan (CARD8 op,
|
||||||
if (npoint < 3)
|
if (npoint < 3)
|
||||||
return;
|
return;
|
||||||
ntri = npoint - 2;
|
ntri = npoint - 2;
|
||||||
tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle));
|
tris = xalloc (ntri * sizeof (xTriangle));
|
||||||
if (!tris)
|
if (!tris)
|
||||||
return;
|
return;
|
||||||
first = points++;
|
first = points++;
|
||||||
|
@ -187,5 +187,5 @@ miTriFan (CARD8 op,
|
||||||
tri->p3 = points[1];
|
tri->p3 = points[1];
|
||||||
}
|
}
|
||||||
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
||||||
DEALLOCATE_LOCAL (tris);
|
xfree (tris);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
||||||
glyphsBase = glyphsLocal;
|
glyphsBase = glyphsLocal;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glyphsBase = (GlyphPtr *) ALLOCATE_LOCAL (nglyph * sizeof (GlyphPtr));
|
glyphsBase = (GlyphPtr *) xalloc (nglyph * sizeof (GlyphPtr));
|
||||||
if (!glyphsBase)
|
if (!glyphsBase)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
@ -1417,7 +1417,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
||||||
listsBase = listsLocal;
|
listsBase = listsLocal;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
listsBase = (GlyphListPtr) ALLOCATE_LOCAL (nlist * sizeof (GlyphListRec));
|
listsBase = (GlyphListPtr) xalloc (nlist * sizeof (GlyphListRec));
|
||||||
if (!listsBase)
|
if (!listsBase)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
@ -1442,9 +1442,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
||||||
{
|
{
|
||||||
client->errorValue = gs;
|
client->errorValue = gs;
|
||||||
if (glyphsBase != glyphsLocal)
|
if (glyphsBase != glyphsLocal)
|
||||||
DEALLOCATE_LOCAL (glyphsBase);
|
xfree (glyphsBase);
|
||||||
if (listsBase != listsLocal)
|
if (listsBase != listsLocal)
|
||||||
DEALLOCATE_LOCAL (listsBase);
|
xfree (listsBase);
|
||||||
return RenderErrBase + BadGlyphSet;
|
return RenderErrBase + BadGlyphSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1498,9 +1498,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
||||||
glyphsBase);
|
glyphsBase);
|
||||||
|
|
||||||
if (glyphsBase != glyphsLocal)
|
if (glyphsBase != glyphsLocal)
|
||||||
DEALLOCATE_LOCAL (glyphsBase);
|
xfree (glyphsBase);
|
||||||
if (listsBase != listsLocal)
|
if (listsBase != listsLocal)
|
||||||
DEALLOCATE_LOCAL (listsBase);
|
xfree (listsBase);
|
||||||
|
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
@ -2965,7 +2965,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
|
||||||
RenderErrBase + BadPicture);
|
RenderErrBase + BadPicture);
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len)))
|
(extra = (char *) xalloc (extra_len)))
|
||||||
{
|
{
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -2991,7 +2991,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
|
||||||
result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
|
result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3016,7 +3016,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
|
||||||
|
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
|
(extra = (char *) xalloc (extra_len))) {
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
|
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -3053,7 +3053,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3078,7 +3078,7 @@ PanoramiXRenderTriangles(ClientPtr client)
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
|
||||||
|
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
|
(extra = (char *) xalloc (extra_len))) {
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
|
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -3111,7 +3111,7 @@ PanoramiXRenderTriangles(ClientPtr client)
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3136,7 +3136,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
|
||||||
|
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
|
(extra = (char *) xalloc (extra_len))) {
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
|
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -3165,7 +3165,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3190,7 +3190,7 @@ PanoramiXRenderTriFan(ClientPtr client)
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
|
||||||
|
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
|
(extra = (char *) xalloc (extra_len))) {
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
|
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -3219,7 +3219,7 @@ PanoramiXRenderTriFan(ClientPtr client)
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3244,7 +3244,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq);
|
||||||
|
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
|
(extra = (char *) xalloc (extra_len))) {
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
|
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -3265,7 +3265,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3288,7 +3288,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq);
|
||||||
|
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
|
(extra = (char *) xalloc (extra_len))) {
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
|
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -3309,7 +3309,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -3332,7 +3332,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
|
||||||
RenderErrBase + BadPicture);
|
RenderErrBase + BadPicture);
|
||||||
extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
|
extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
|
||||||
if (extra_len &&
|
if (extra_len &&
|
||||||
(extra = (char *) ALLOCATE_LOCAL (extra_len)))
|
(extra = (char *) xalloc (extra_len)))
|
||||||
{
|
{
|
||||||
memcpy (extra, stuff + 1, extra_len);
|
memcpy (extra, stuff + 1, extra_len);
|
||||||
x_off = stuff->xOff;
|
x_off = stuff->xOff;
|
||||||
|
@ -3349,7 +3349,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
|
||||||
result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
|
result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
|
||||||
if(result != Success) break;
|
if(result != Success) break;
|
||||||
}
|
}
|
||||||
DEALLOCATE_LOCAL(extra);
|
xfree(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue