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

@@ -99,7 +99,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
ccw = xalloc (sizeof (CompClientWindowRec));
ccw = malloc(sizeof (CompClientWindowRec));
if (!ccw)
return BadAlloc;
ccw->id = FakeClientID (pClient->index);
@@ -109,10 +109,10 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
*/
if (!cw)
{
cw = xalloc (sizeof (CompWindowRec));
cw = malloc(sizeof (CompWindowRec));
if (!cw)
{
xfree (ccw);
free(ccw);
return BadAlloc;
}
cw->damage = DamageCreate (compReportDamage,
@@ -123,8 +123,8 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
pWin);
if (!cw->damage)
{
xfree (ccw);
xfree (cw);
free(ccw);
free(cw);
return BadAlloc;
}
if (wasMapped)
@@ -207,7 +207,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
*prev = ccw->next;
if (ccw->update == CompositeRedirectManual)
cw->update = CompositeRedirectAutomatic;
xfree (ccw);
free(ccw);
break;
}
}
@@ -229,7 +229,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
REGION_UNINIT (pScreen, &cw->borderClip);
dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
xfree (cw);
free(cw);
}
else if (cw->update == CompositeRedirectAutomatic &&
!cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
@@ -295,7 +295,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
ccw = xalloc (sizeof (CompClientWindowRec));
ccw = malloc(sizeof (CompClientWindowRec));
if (!ccw)
return BadAlloc;
ccw->id = FakeClientID (pClient->index);
@@ -305,10 +305,10 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
*/
if (!csw)
{
csw = xalloc (sizeof (CompSubwindowsRec));
csw = malloc(sizeof (CompSubwindowsRec));
if (!csw)
{
xfree (ccw);
free(ccw);
return BadAlloc;
}
csw->update = CompositeRedirectAutomatic;
@@ -327,10 +327,10 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
(void) compUnredirectWindow (pClient, pChild, update);
if (!csw->clients)
{
xfree (csw);
free(csw);
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
}
xfree (ccw);
free(ccw);
return ret;
}
}
@@ -391,7 +391,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
(void) compUnredirectWindow (pClient, pChild, ccw->update);
xfree (ccw);
free(ccw);
break;
}
}
@@ -402,7 +402,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
if (!csw->clients)
{
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
xfree (csw);
free(csw);
}
}

View File

@@ -62,7 +62,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
CompScreenPtr cs = GetCompScreen (pScreen);
Bool ret;
xfree (cs->alternateVisuals);
free(cs->alternateVisuals);
pScreen->CloseScreen = cs->CloseScreen;
pScreen->BlockHandler = cs->BlockHandler;
@@ -81,7 +81,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->CopyWindow = cs->CopyWindow;
pScreen->PositionWindow = cs->PositionWindow;
xfree (cs);
free(cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (index, pScreen);
@@ -202,7 +202,7 @@ compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
{
VisualID *p;
p = xrealloc(cs->alternateVisuals,
p = realloc(cs->alternateVisuals,
sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
if(p == NULL)
return FALSE;
@@ -323,7 +323,7 @@ compScreenInit (ScreenPtr pScreen)
if (GetCompScreen (pScreen))
return TRUE;
cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
cs = (CompScreenPtr) malloc(sizeof (CompScreenRec));
if (!cs)
return FALSE;
@@ -337,7 +337,7 @@ compScreenInit (ScreenPtr pScreen)
if (!compAddAlternateVisuals (pScreen, cs))
{
xfree (cs);
free(cs);
return FALSE;
}

View File

@@ -62,7 +62,7 @@ compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
{
if (pOc == pOcToDel) {
*pPrev = pOc->pNext;
xfree (pOc);
free(pOc);
break;
}
}
@@ -97,7 +97,7 @@ compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec));
pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
if (pOc == NULL)
return NULL;