Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -98,9 +98,9 @@ RRCloseScreen (int i, ScreenPtr pScreen)
|
||||
for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
|
||||
RROutputDestroy (pScrPriv->outputs[j]);
|
||||
|
||||
xfree (pScrPriv->crtcs);
|
||||
xfree (pScrPriv->outputs);
|
||||
xfree (pScrPriv);
|
||||
free(pScrPriv->crtcs);
|
||||
free(pScrPriv->outputs);
|
||||
free(pScrPriv);
|
||||
RRNScreens -= 1; /* ok, one fewer screen with RandR running */
|
||||
return (*pScreen->CloseScreen) (i, pScreen);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ Bool RRScreenInit(ScreenPtr pScreen)
|
||||
if (!RRInit ())
|
||||
return FALSE;
|
||||
|
||||
pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec));
|
||||
pScrPriv = (rrScrPrivPtr) calloc(1, sizeof (rrScrPrivRec));
|
||||
if (!pScrPriv)
|
||||
return FALSE;
|
||||
|
||||
@@ -302,7 +302,7 @@ RRFreeClient (pointer data, XID id)
|
||||
*pHead = pRREvent->next;
|
||||
}
|
||||
}
|
||||
xfree ((pointer) pRREvent);
|
||||
free((pointer) pRREvent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -316,9 +316,9 @@ RRFreeEvents (pointer data, XID id)
|
||||
for (pCur = *pHead; pCur; pCur = pNext) {
|
||||
pNext = pCur->next;
|
||||
FreeResource (pCur->clientResource, RRClientType);
|
||||
xfree ((pointer) pCur);
|
||||
free((pointer) pCur);
|
||||
}
|
||||
xfree ((pointer) pHead);
|
||||
free((pointer) pHead);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,15 +64,15 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
|
||||
|
||||
/* make space for the crtc pointer */
|
||||
if (pScrPriv->numCrtcs)
|
||||
crtcs = xrealloc (pScrPriv->crtcs,
|
||||
crtcs = realloc(pScrPriv->crtcs,
|
||||
(pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
|
||||
else
|
||||
crtcs = xalloc (sizeof (RRCrtcPtr));
|
||||
crtcs = malloc(sizeof (RRCrtcPtr));
|
||||
if (!crtcs)
|
||||
return FALSE;
|
||||
pScrPriv->crtcs = crtcs;
|
||||
|
||||
crtc = xcalloc (1, sizeof (RRCrtcRec));
|
||||
crtc = calloc(1, sizeof (RRCrtcRec));
|
||||
if (!crtc)
|
||||
return NULL;
|
||||
crtc->id = FakeClientID (0);
|
||||
@@ -181,17 +181,17 @@ RRCrtcNotify (RRCrtcPtr crtc,
|
||||
if (numOutputs)
|
||||
{
|
||||
if (crtc->numOutputs)
|
||||
newoutputs = xrealloc (crtc->outputs,
|
||||
newoutputs = realloc(crtc->outputs,
|
||||
numOutputs * sizeof (RROutputPtr));
|
||||
else
|
||||
newoutputs = xalloc (numOutputs * sizeof (RROutputPtr));
|
||||
newoutputs = malloc(numOutputs * sizeof (RROutputPtr));
|
||||
if (!newoutputs)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (crtc->outputs)
|
||||
xfree (crtc->outputs);
|
||||
free(crtc->outputs);
|
||||
newoutputs = NULL;
|
||||
}
|
||||
crtc->outputs = newoutputs;
|
||||
@@ -442,10 +442,10 @@ RRCrtcDestroyResource (pointer value, XID pid)
|
||||
}
|
||||
}
|
||||
if (crtc->gammaRed)
|
||||
xfree (crtc->gammaRed);
|
||||
free(crtc->gammaRed);
|
||||
if (crtc->mode)
|
||||
RRModeDestroy (crtc->mode);
|
||||
xfree (crtc);
|
||||
free(crtc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -558,14 +558,14 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
|
||||
return TRUE;
|
||||
if (size)
|
||||
{
|
||||
gamma = xalloc (size * 3 * sizeof (CARD16));
|
||||
gamma = malloc(size * 3 * sizeof (CARD16));
|
||||
if (!gamma)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
gamma = NULL;
|
||||
if (crtc->gammaRed)
|
||||
xfree (crtc->gammaRed);
|
||||
free(crtc->gammaRed);
|
||||
crtc->gammaRed = gamma;
|
||||
crtc->gammaGreen = gamma + size;
|
||||
crtc->gammaBlue = gamma + size*2;
|
||||
@@ -704,7 +704,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
|
||||
extraLen = rep.length << 2;
|
||||
if (extraLen)
|
||||
{
|
||||
extra = xalloc (extraLen);
|
||||
extra = malloc(extraLen);
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -749,7 +749,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
|
||||
if (extraLen)
|
||||
{
|
||||
WriteToClient (client, extraLen, (char *) extra);
|
||||
xfree (extra);
|
||||
free(extra);
|
||||
}
|
||||
|
||||
return client->noClientException;
|
||||
@@ -791,7 +791,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
}
|
||||
if (numOutputs)
|
||||
{
|
||||
outputs = xalloc (numOutputs * sizeof (RROutputPtr));
|
||||
outputs = malloc(numOutputs * sizeof (RROutputPtr));
|
||||
if (!outputs)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
if (rc != Success)
|
||||
{
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;
|
||||
}
|
||||
/* validate crtc for this output */
|
||||
@@ -816,7 +816,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
if (j == outputs[i]->numCrtcs)
|
||||
{
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadMatch;
|
||||
}
|
||||
/* validate mode for this output */
|
||||
@@ -831,7 +831,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
if (j == outputs[i]->numModes + outputs[i]->numUserModes)
|
||||
{
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadMatch;
|
||||
}
|
||||
}
|
||||
@@ -851,7 +851,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
if (k == outputs[i]->numClones)
|
||||
{
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadMatch;
|
||||
}
|
||||
}
|
||||
@@ -901,7 +901,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
*/
|
||||
client->errorValue = stuff->rotation;
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
@@ -914,7 +914,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
*/
|
||||
client->errorValue = stuff->rotation;
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
@@ -944,7 +944,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
{
|
||||
client->errorValue = stuff->x;
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
@@ -952,7 +952,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
{
|
||||
client->errorValue = stuff->y;
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
@@ -980,7 +980,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||
|
||||
sendReply:
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
free(outputs);
|
||||
|
||||
rep.type = X_Reply;
|
||||
/* rep.status has already been filled in */
|
||||
@@ -1196,7 +1196,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
|
||||
len = crtc->gammaSize * 3 * 2;
|
||||
|
||||
if (crtc->gammaSize) {
|
||||
extra = xalloc(len);
|
||||
extra = malloc(len);
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -1216,7 +1216,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
|
||||
memcpy(extra, crtc->gammaRed, len);
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
|
||||
WriteSwappedDataToClient (client, len, extra);
|
||||
xfree(extra);
|
||||
free(extra);
|
||||
}
|
||||
return client->noClientException;
|
||||
}
|
||||
@@ -1354,7 +1354,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
|
||||
nextra = (transform_filter_length (pending) +
|
||||
transform_filter_length (current));
|
||||
|
||||
reply = xalloc (sizeof (xRRGetCrtcTransformReply) + nextra);
|
||||
reply = malloc(sizeof (xRRGetCrtcTransformReply) + nextra);
|
||||
if (!reply)
|
||||
return BadAlloc;
|
||||
|
||||
@@ -1382,6 +1382,6 @@ ProcRRGetCrtcTransform (ClientPtr client)
|
||||
swapl (&reply->length, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply);
|
||||
xfree(reply);
|
||||
free(reply);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ ProcRRSelectInput (ClientPtr client)
|
||||
if (!pRREvent)
|
||||
{
|
||||
/* build the entry */
|
||||
pRREvent = (RREventPtr) xalloc (sizeof (RREventRec));
|
||||
pRREvent = (RREventPtr) malloc(sizeof (RREventRec));
|
||||
if (!pRREvent)
|
||||
return BadAlloc;
|
||||
pRREvent->next = 0;
|
||||
@@ -131,7 +131,7 @@ ProcRRSelectInput (ClientPtr client)
|
||||
*/
|
||||
if (!pHead)
|
||||
{
|
||||
pHead = (RREventPtr *) xalloc (sizeof (RREventPtr));
|
||||
pHead = (RREventPtr *) malloc(sizeof (RREventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
|
||||
{
|
||||
@@ -174,7 +174,7 @@ ProcRRSelectInput (ClientPtr client)
|
||||
pNewRREvent->next = pRREvent->next;
|
||||
else
|
||||
*pHead = pRREvent->next;
|
||||
xfree (pRREvent);
|
||||
free(pRREvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
|
||||
}
|
||||
|
||||
if (output->numModes)
|
||||
modes = xrealloc (output->modes,
|
||||
modes = realloc(output->modes,
|
||||
(output->numModes + 1) * sizeof (RRModePtr));
|
||||
else
|
||||
modes = xalloc (sizeof (RRModePtr));
|
||||
modes = malloc(sizeof (RRModePtr));
|
||||
if (!modes)
|
||||
{
|
||||
RRModeDestroy (mode);
|
||||
@@ -134,7 +134,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
|
||||
newMode = mode;
|
||||
}
|
||||
}
|
||||
xfree (size->pRates);
|
||||
free(size->pRates);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,7 +144,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
|
||||
}
|
||||
}
|
||||
if (pScrPriv->nSizes)
|
||||
xfree (pScrPriv->pSizes);
|
||||
free(pScrPriv->pSizes);
|
||||
pScrPriv->pSizes = NULL;
|
||||
pScrPriv->nSizes = 0;
|
||||
|
||||
@@ -279,7 +279,7 @@ RRRegisterSize (ScreenPtr pScreen,
|
||||
for (i = 0; i < pScrPriv->nSizes; i++)
|
||||
if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
|
||||
return &pScrPriv->pSizes[i];
|
||||
pNew = xrealloc (pScrPriv->pSizes,
|
||||
pNew = realloc(pScrPriv->pSizes,
|
||||
(pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
|
||||
if (!pNew)
|
||||
return 0;
|
||||
@@ -303,7 +303,7 @@ Bool RRRegisterRate (ScreenPtr pScreen,
|
||||
if (pSize->pRates[i].rate == rate)
|
||||
return TRUE;
|
||||
|
||||
pNew = xrealloc (pSize->pRates,
|
||||
pNew = realloc(pSize->pRates,
|
||||
(pSize->nRates + 1) * sizeof (RRScreenRate));
|
||||
if (!pNew)
|
||||
return FALSE;
|
||||
|
||||
@@ -58,7 +58,7 @@ RRModeCreate (xRRModeInfo *modeInfo,
|
||||
if (!RRInit ())
|
||||
return NULL;
|
||||
|
||||
mode = xalloc (sizeof (RRModeRec) + modeInfo->nameLength + 1);
|
||||
mode = malloc(sizeof (RRModeRec) + modeInfo->nameLength + 1);
|
||||
if (!mode)
|
||||
return NULL;
|
||||
mode->refcnt = 1;
|
||||
@@ -69,13 +69,13 @@ RRModeCreate (xRRModeInfo *modeInfo,
|
||||
mode->userScreen = userScreen;
|
||||
|
||||
if (num_modes)
|
||||
newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr));
|
||||
newModes = realloc(modes, (num_modes + 1) * sizeof (RRModePtr));
|
||||
else
|
||||
newModes = xalloc (sizeof (RRModePtr));
|
||||
newModes = malloc(sizeof (RRModePtr));
|
||||
|
||||
if (!newModes)
|
||||
{
|
||||
xfree (mode);
|
||||
free(mode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
|
||||
RRModePtr *screen_modes;
|
||||
int num_screen_modes = 0;
|
||||
|
||||
screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr));
|
||||
screen_modes = malloc((num_modes ? num_modes : 1) * sizeof (RRModePtr));
|
||||
if (!screen_modes)
|
||||
return NULL;
|
||||
|
||||
@@ -243,14 +243,14 @@ RRModeDestroy (RRModePtr mode)
|
||||
num_modes--;
|
||||
if (!num_modes)
|
||||
{
|
||||
xfree (modes);
|
||||
free(modes);
|
||||
modes = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xfree (mode);
|
||||
free(mode);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -63,16 +63,16 @@ RROutputCreate (ScreenPtr pScreen,
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
|
||||
if (pScrPriv->numOutputs)
|
||||
outputs = xrealloc (pScrPriv->outputs,
|
||||
outputs = realloc(pScrPriv->outputs,
|
||||
(pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
|
||||
else
|
||||
outputs = xalloc (sizeof (RROutputPtr));
|
||||
outputs = malloc(sizeof (RROutputPtr));
|
||||
if (!outputs)
|
||||
return FALSE;
|
||||
|
||||
pScrPriv->outputs = outputs;
|
||||
|
||||
output = xalloc (sizeof (RROutputRec) + nameLength + 1);
|
||||
output = malloc(sizeof (RROutputRec) + nameLength + 1);
|
||||
if (!output)
|
||||
return NULL;
|
||||
output->id = FakeClientID (0);
|
||||
@@ -128,14 +128,14 @@ RROutputSetClones (RROutputPtr output,
|
||||
}
|
||||
if (numClones)
|
||||
{
|
||||
newClones = xalloc (numClones * sizeof (RROutputPtr));
|
||||
newClones = malloc(numClones * sizeof (RROutputPtr));
|
||||
if (!newClones)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
newClones = NULL;
|
||||
if (output->clones)
|
||||
xfree (output->clones);
|
||||
free(output->clones);
|
||||
memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
|
||||
output->clones = newClones;
|
||||
output->numClones = numClones;
|
||||
@@ -167,7 +167,7 @@ RROutputSetModes (RROutputPtr output,
|
||||
|
||||
if (numModes)
|
||||
{
|
||||
newModes = xalloc (numModes * sizeof (RRModePtr));
|
||||
newModes = malloc(numModes * sizeof (RRModePtr));
|
||||
if (!newModes)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ RROutputSetModes (RROutputPtr output,
|
||||
{
|
||||
for (i = 0; i < output->numModes; i++)
|
||||
RRModeDestroy (output->modes[i]);
|
||||
xfree (output->modes);
|
||||
free(output->modes);
|
||||
}
|
||||
memcpy (newModes, modes, numModes * sizeof (RRModePtr));
|
||||
output->modes = newModes;
|
||||
@@ -212,10 +212,10 @@ RROutputAddUserMode (RROutputPtr output,
|
||||
return BadMatch;
|
||||
|
||||
if (output->userModes)
|
||||
newModes = xrealloc (output->userModes,
|
||||
newModes = realloc(output->userModes,
|
||||
(output->numUserModes + 1) * sizeof (RRModePtr));
|
||||
else
|
||||
newModes = xalloc (sizeof (RRModePtr));
|
||||
newModes = malloc(sizeof (RRModePtr));
|
||||
if (!newModes)
|
||||
return BadAlloc;
|
||||
|
||||
@@ -274,14 +274,14 @@ RROutputSetCrtcs (RROutputPtr output,
|
||||
}
|
||||
if (numCrtcs)
|
||||
{
|
||||
newCrtcs = xalloc (numCrtcs * sizeof (RRCrtcPtr));
|
||||
newCrtcs = malloc(numCrtcs * sizeof (RRCrtcPtr));
|
||||
if (!newCrtcs)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
newCrtcs = NULL;
|
||||
if (output->crtcs)
|
||||
xfree (output->crtcs);
|
||||
free(output->crtcs);
|
||||
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
|
||||
output->crtcs = newCrtcs;
|
||||
output->numCrtcs = numCrtcs;
|
||||
@@ -398,20 +398,20 @@ RROutputDestroyResource (pointer value, XID pid)
|
||||
{
|
||||
for (m = 0; m < output->numModes; m++)
|
||||
RRModeDestroy (output->modes[m]);
|
||||
xfree (output->modes);
|
||||
free(output->modes);
|
||||
}
|
||||
|
||||
for (m = 0; m < output->numUserModes; m++)
|
||||
RRModeDestroy (output->userModes[m]);
|
||||
if (output->userModes)
|
||||
xfree (output->userModes);
|
||||
free(output->userModes);
|
||||
|
||||
if (output->crtcs)
|
||||
xfree (output->crtcs);
|
||||
free(output->crtcs);
|
||||
if (output->clones)
|
||||
xfree (output->clones);
|
||||
free(output->clones);
|
||||
RRDeleteAllOutputProperties (output);
|
||||
xfree (output);
|
||||
free(output);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ ProcRRGetOutputInfo (ClientPtr client)
|
||||
if (extraLen)
|
||||
{
|
||||
rep.length += bytes_to_int32(extraLen);
|
||||
extra = xalloc (extraLen);
|
||||
extra = malloc(extraLen);
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -524,7 +524,7 @@ ProcRRGetOutputInfo (ClientPtr client)
|
||||
if (extraLen)
|
||||
{
|
||||
WriteToClient (client, extraLen, (char *) extra);
|
||||
xfree (extra);
|
||||
free(extra);
|
||||
}
|
||||
|
||||
return client->noClientException;
|
||||
|
||||
@@ -76,10 +76,10 @@ RRDeleteAllOutputProperties (RROutputPtr output)
|
||||
event.timestamp = currentTime.milliseconds;
|
||||
RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
|
||||
if (prop->current.data)
|
||||
xfree(prop->current.data);
|
||||
free(prop->current.data);
|
||||
if (prop->pending.data)
|
||||
xfree(prop->pending.data);
|
||||
xfree(prop);
|
||||
free(prop->pending.data);
|
||||
free(prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ RRCreateOutputProperty (Atom property)
|
||||
{
|
||||
RRPropertyPtr prop;
|
||||
|
||||
prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec));
|
||||
prop = (RRPropertyPtr)malloc(sizeof(RRPropertyRec));
|
||||
if (!prop)
|
||||
return NULL;
|
||||
prop->next = NULL;
|
||||
@@ -116,14 +116,14 @@ static void
|
||||
RRDestroyOutputProperty (RRPropertyPtr prop)
|
||||
{
|
||||
if (prop->valid_values)
|
||||
xfree (prop->valid_values);
|
||||
free(prop->valid_values);
|
||||
if (prop->current.data)
|
||||
xfree(prop->current.data);
|
||||
free(prop->current.data);
|
||||
if (prop->pending.data)
|
||||
xfree(prop->pending.data);
|
||||
free(prop->pending.data);
|
||||
if (prop->valid_values)
|
||||
xfree(prop->valid_values);
|
||||
xfree(prop);
|
||||
free(prop->valid_values);
|
||||
free(prop);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -201,7 +201,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
|
||||
pointer new_data = NULL, old_data = NULL;
|
||||
|
||||
total_size = total_len * size_in_bytes;
|
||||
new_value.data = (pointer)xalloc (total_size);
|
||||
new_value.data = (pointer)malloc(total_size);
|
||||
if (!new_value.data && total_size)
|
||||
{
|
||||
if (add)
|
||||
@@ -239,11 +239,11 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
|
||||
prop->propertyName, &new_value))
|
||||
{
|
||||
if (new_value.data)
|
||||
xfree (new_value.data);
|
||||
free(new_value.data);
|
||||
return (BadValue);
|
||||
}
|
||||
if (prop_value->data)
|
||||
xfree (prop_value->data);
|
||||
free(prop_value->data);
|
||||
*prop_value = new_value;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
|
||||
if (range && (num_values & 1))
|
||||
return BadMatch;
|
||||
|
||||
new_values = xalloc (num_values * sizeof (INT32));
|
||||
new_values = malloc(num_values * sizeof (INT32));
|
||||
if (!new_values && num_values)
|
||||
return BadAlloc;
|
||||
if (num_values)
|
||||
@@ -385,7 +385,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
|
||||
if (prop->is_pending && !pending)
|
||||
{
|
||||
if (prop->pending.data)
|
||||
xfree (prop->pending.data);
|
||||
free(prop->pending.data);
|
||||
RRInitOutputPropertyValue (&prop->pending);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
|
||||
prop->immutable = immutable;
|
||||
prop->num_valid = num_values;
|
||||
if (prop->valid_values)
|
||||
xfree (prop->valid_values);
|
||||
free(prop->valid_values);
|
||||
prop->valid_values = new_values;
|
||||
|
||||
if (add) {
|
||||
@@ -422,7 +422,7 @@ ProcRRListOutputProperties (ClientPtr client)
|
||||
for (prop = output->properties; prop; prop = prop->next)
|
||||
numProps++;
|
||||
if (numProps)
|
||||
if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
|
||||
if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom))))
|
||||
return(BadAlloc);
|
||||
|
||||
rep.type = X_Reply;
|
||||
@@ -445,7 +445,7 @@ ProcRRListOutputProperties (ClientPtr client)
|
||||
{
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
|
||||
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
|
||||
xfree(pAtoms);
|
||||
free(pAtoms);
|
||||
}
|
||||
return(client->noClientException);
|
||||
}
|
||||
@@ -468,7 +468,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
|
||||
return BadName;
|
||||
|
||||
if (prop->num_valid) {
|
||||
extra = xalloc(prop->num_valid * sizeof(INT32));
|
||||
extra = malloc(prop->num_valid * sizeof(INT32));
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -491,7 +491,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
|
||||
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
|
||||
extra);
|
||||
xfree(extra);
|
||||
free(extra);
|
||||
}
|
||||
return(client->noClientException);
|
||||
}
|
||||
@@ -699,7 +699,7 @@ ProcRRGetOutputProperty (ClientPtr client)
|
||||
len = min(n - ind, 4 * stuff->longLength);
|
||||
|
||||
if (len) {
|
||||
extra = xalloc(len);
|
||||
extra = malloc(len);
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ ProcRRGetOutputProperty (ClientPtr client)
|
||||
}
|
||||
WriteSwappedDataToClient(client, len,
|
||||
extra);
|
||||
xfree(extra);
|
||||
free(extra);
|
||||
}
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
|
||||
@@ -383,10 +383,10 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
||||
extraLen = rep.length << 2;
|
||||
if (extraLen)
|
||||
{
|
||||
extra = xalloc (extraLen);
|
||||
extra = malloc(extraLen);
|
||||
if (!extra)
|
||||
{
|
||||
xfree (modes);
|
||||
free(modes);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
@@ -450,7 +450,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
||||
mode->mode.nameLength);
|
||||
names += mode->mode.nameLength;
|
||||
}
|
||||
xfree (modes);
|
||||
free(modes);
|
||||
assert (bytes_to_int32((char *) names - (char *) extra) == rep.length);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
||||
if (extraLen)
|
||||
{
|
||||
WriteToClient (client, extraLen, (char *) extra);
|
||||
xfree (extra);
|
||||
free(extra);
|
||||
}
|
||||
return client->noClientException;
|
||||
}
|
||||
@@ -666,10 +666,10 @@ ProcRRGetScreenInfo (ClientPtr client)
|
||||
|
||||
if (extraLen)
|
||||
{
|
||||
extra = (CARD8 *) xalloc (extraLen);
|
||||
extra = (CARD8 *) malloc(extraLen);
|
||||
if (!extra)
|
||||
{
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
@@ -715,7 +715,7 @@ ProcRRGetScreenInfo (ClientPtr client)
|
||||
}
|
||||
}
|
||||
}
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
|
||||
data8 = (CARD8 *) rates;
|
||||
|
||||
@@ -738,7 +738,7 @@ ProcRRGetScreenInfo (ClientPtr client)
|
||||
if (extraLen)
|
||||
{
|
||||
WriteToClient (client, extraLen, (char *) extra);
|
||||
xfree (extra);
|
||||
free(extra);
|
||||
}
|
||||
return (client->noClientException);
|
||||
}
|
||||
@@ -831,7 +831,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||
* Invalid size ID
|
||||
*/
|
||||
client->errorValue = stuff->sizeID;
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
return BadValue;
|
||||
}
|
||||
pSize = &pData->sizes[stuff->sizeID];
|
||||
@@ -853,7 +853,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||
* Invalid rotation
|
||||
*/
|
||||
client->errorValue = stuff->rotation;
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||
* requested rotation or reflection not supported by screen
|
||||
*/
|
||||
client->errorValue = stuff->rotation;
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||
* Invalid rate
|
||||
*/
|
||||
client->errorValue = rate;
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
return BadValue;
|
||||
}
|
||||
mode = pSize->pRates[i].mode;
|
||||
@@ -954,7 +954,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||
sendReply:
|
||||
|
||||
if (pData)
|
||||
xfree (pData);
|
||||
free(pData);
|
||||
|
||||
rep.type = X_Reply;
|
||||
/* rep.status has already been filled in */
|
||||
@@ -997,7 +997,7 @@ RR10CurrentSizeID (ScreenPtr pScreen)
|
||||
sizeID = (CARD16) i;
|
||||
break;
|
||||
}
|
||||
xfree (data);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
return sizeID;
|
||||
|
||||
@@ -38,7 +38,7 @@ void
|
||||
RRTransformFini (RRTransformPtr transform)
|
||||
{
|
||||
if (transform->params)
|
||||
xfree (transform->params);
|
||||
free(transform->params);
|
||||
}
|
||||
|
||||
Bool
|
||||
@@ -75,7 +75,7 @@ RRTransformSetFilter (RRTransformPtr dst,
|
||||
|
||||
if (nparams)
|
||||
{
|
||||
new_params = xalloc (nparams * sizeof (xFixed));
|
||||
new_params = malloc(nparams * sizeof (xFixed));
|
||||
if (!new_params)
|
||||
return FALSE;
|
||||
memcpy (new_params, params, nparams * sizeof (xFixed));
|
||||
@@ -83,7 +83,7 @@ RRTransformSetFilter (RRTransformPtr dst,
|
||||
else
|
||||
new_params = NULL;
|
||||
if (dst->params)
|
||||
xfree (dst->params);
|
||||
free(dst->params);
|
||||
dst->filter = filter;
|
||||
dst->params = new_params;
|
||||
dst->nparams = nparams;
|
||||
|
||||
Reference in New Issue
Block a user