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:
Mikhail Gusarov
2010-05-06 01:44:06 +07:00
parent 96c7ab27c3
commit 3f3ff971ec
345 changed files with 3011 additions and 3011 deletions

View File

@@ -300,7 +300,7 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
if (j < numnow) /* duplicate */
return(Success);
numnow++;
pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(*pTmp) * numnow);
pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
if (!pTmp)
return(BadAlloc);
client->saveSet = pTmp;
@@ -320,13 +320,13 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
numnow--;
if (numnow)
{
pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(*pTmp) * numnow);
pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
if (pTmp)
client->saveSet = pTmp;
}
else
{
xfree(client->saveSet);
free(client->saveSet);
client->saveSet = (SaveSetElt *)NULL;
}
client->numSaved = numnow;
@@ -453,7 +453,7 @@ RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
if (numHandlers >= sizeHandlers)
{
new = (BlockHandlerPtr) xrealloc (handlers, (numHandlers + 1) *
new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) *
sizeof (BlockHandlerRec));
if (!new)
return FALSE;
@@ -498,7 +498,7 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
void
InitBlockAndWakeupHandlers (void)
{
xfree (handlers);
free(handlers);
handlers = (BlockHandlerPtr) 0;
numHandlers = 0;
sizeHandlers = 0;
@@ -530,7 +530,7 @@ ProcessWorkQueue(void)
{
/* remove q from the list */
*p = q->next; /* don't fetch until after func called */
xfree (q);
free(q);
}
else
{
@@ -553,7 +553,7 @@ ProcessWorkQueueZombies(void)
(void) (*q->function) (q->client, q->closure);
/* remove q from the list */
*p = q->next; /* don't fetch until after func called */
xfree (q);
free(q);
}
else
{
@@ -570,7 +570,7 @@ QueueWorkProc (
{
WorkQueuePtr q;
q = xalloc (sizeof *q);
q = malloc(sizeof *q);
if (!q)
return FALSE;
q->function = function;
@@ -604,7 +604,7 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure)
{
SleepQueuePtr q;
q = xalloc (sizeof *q);
q = malloc(sizeof *q);
if (!q)
return FALSE;
@@ -641,7 +641,7 @@ ClientWakeup (ClientPtr client)
if (q->client == client)
{
*prev = q->next;
xfree (q);
free(q);
if (client->clientGone)
/* Oops -- new zombie cleanup code ensures this only
* happens from inside CloseDownClient; don't want to
@@ -684,7 +684,7 @@ _AddCallback(
{
CallbackPtr cbr;
cbr = xalloc(sizeof(CallbackRec));
cbr = malloc(sizeof(CallbackRec));
if (!cbr)
return FALSE;
cbr->proc = callback;
@@ -724,7 +724,7 @@ _DeleteCallback(
cbl->list = cbr->next;
else
pcbr->next = cbr->next;
xfree(cbr);
free(cbr);
}
return TRUE;
}
@@ -769,12 +769,12 @@ _CallCallbacks(
if (pcbr)
{
cbr = cbr->next;
xfree(pcbr->next);
free(pcbr->next);
pcbr->next = cbr;
} else
{
cbr = cbr->next;
xfree(cbl->list);
free(cbl->list);
cbl->list = cbr;
}
cbl->numDeleted--;
@@ -814,9 +814,9 @@ _DeleteCallbackList(
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr)
{
nextcbr = cbr->next;
xfree(cbr);
free(cbr);
}
xfree(cbl);
free(cbl);
*pcbl = NULL;
}
@@ -827,7 +827,7 @@ CreateCallbackList(CallbackListPtr *pcbl)
int i;
if (!pcbl) return FALSE;
cbl = xalloc(sizeof(CallbackListRec));
cbl = malloc(sizeof(CallbackListRec));
if (!cbl) return FALSE;
cbl->inCallback = 0;
cbl->deleted = FALSE;
@@ -895,7 +895,7 @@ InitCallbackManager(void)
{
DeleteCallbackList(listsToCleanup[i]);
}
if (listsToCleanup) xfree(listsToCleanup);
if (listsToCleanup) free(listsToCleanup);
numCallbackListsToCleanup = 0;
listsToCleanup = NULL;