Skip to content

Commit

Permalink
DIX: Remove remaining alloca calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Huddleston committed Nov 21, 2007
1 parent e636673 commit 96c1137
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions dix/dispatch.c
Expand Up @@ -368,7 +368,7 @@ Dispatch(void)
InitSelections();
nClients = 0;

clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients);
clientReady = (int *) xalloc(sizeof(int) * MaxClients);
if (!clientReady)
return;

Expand Down Expand Up @@ -489,7 +489,7 @@ Dispatch(void)
ddxBeforeReset ();
#endif
KillAllClients();
DEALLOCATE_LOCAL(clientReady);
xfree(clientReady);
dispatchException &= ~DE_RESET;
}

Expand Down Expand Up @@ -873,7 +873,7 @@ ProcQueryTree(register ClientPtr client)
{
int curChild = 0;

childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
childIDs = (Window *) xalloc(numChildren * sizeof(Window));
if (!childIDs)
return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
Expand All @@ -888,7 +888,7 @@ ProcQueryTree(register ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
DEALLOCATE_LOCAL(childIDs);
xfree(childIDs);
}

return(client->noClientException);
Expand Down Expand Up @@ -2572,7 +2572,7 @@ ProcListInstalledColormaps(register ClientPtr client)
return(BadWindow);

preply = (xListInstalledColormapsReply *)
ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +
xalloc(sizeof(xListInstalledColormapsReply) +
pWin->drawable.pScreen->maxInstalledCmaps *
sizeof(Colormap));
if(!preply)
Expand All @@ -2587,7 +2587,7 @@ ProcListInstalledColormaps(register ClientPtr client)
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
DEALLOCATE_LOCAL(preply);
xfree(preply);
return(client->noClientException);
}

Expand Down Expand Up @@ -2714,15 +2714,15 @@ ProcAllocColorCells (register ClientPtr client)
}
nmasks = stuff->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
ppixels = (Pixel *)ALLOCATE_LOCAL(length);
ppixels = (Pixel *)xalloc(length);
if(!ppixels)
return(BadAlloc);
pmasks = ppixels + npixels;

if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks,
(Bool)stuff->contiguous, ppixels, pmasks)) )
{
DEALLOCATE_LOCAL(ppixels);
xfree(ppixels);
if (client->noClientException != Success)
return(client->noClientException);
else
Expand All @@ -2741,7 +2741,7 @@ ProcAllocColorCells (register ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
DEALLOCATE_LOCAL(ppixels);
xfree(ppixels);
return (client->noClientException);
}
else
Expand Down Expand Up @@ -2782,15 +2782,15 @@ ProcAllocColorPlanes(register ClientPtr client)
acpr.sequenceNumber = client->sequence;
acpr.nPixels = npixels;
length = (long)npixels * sizeof(Pixel);
ppixels = (Pixel *)ALLOCATE_LOCAL(length);
ppixels = (Pixel *)xalloc(length);
if(!ppixels)
return(BadAlloc);
if( (retval = AllocColorPlanes(client->index, pcmp, npixels,
(int)stuff->red, (int)stuff->green, (int)stuff->blue,
(Bool)stuff->contiguous, ppixels,
&acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
{
DEALLOCATE_LOCAL(ppixels);
xfree(ppixels);
if (client->noClientException != Success)
return(client->noClientException);
else
Expand All @@ -2805,7 +2805,7 @@ ProcAllocColorPlanes(register ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
DEALLOCATE_LOCAL(ppixels);
xfree(ppixels);
return (client->noClientException);
}
else
Expand Down Expand Up @@ -2934,12 +2934,12 @@ ProcQueryColors(register ClientPtr client)
xQueryColorsReply qcr;

count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb));
prgbs = (xrgb *)xalloc(count * sizeof(xrgb));
if(!prgbs && count)
return(BadAlloc);
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
{
if (prgbs) DEALLOCATE_LOCAL(prgbs);
if (prgbs) xfree(prgbs);
if (client->noClientException != Success)
return(client->noClientException);
else
Expand All @@ -2958,7 +2958,7 @@ ProcQueryColors(register ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
if (prgbs) DEALLOCATE_LOCAL(prgbs);
if (prgbs) xfree(prgbs);
return(client->noClientException);

}
Expand Down

0 comments on commit 96c1137

Please sign in to comment.