From 3f3ff971ecff9936cebafc813af9193b97bba89c Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Thu, 6 May 2010 01:44:06 +0700 Subject: 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 Reviewed-by: Peter Hutterer --- composite/compalloc.c | 28 ++++++++++++++-------------- composite/compinit.c | 10 +++++----- composite/compoverlay.c | 4 ++-- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'composite') diff --git a/composite/compalloc.c b/composite/compalloc.c index 73adc72d0..a764972a2 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -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); } } diff --git a/composite/compinit.c b/composite/compinit.c index e8b563de6..a81cc740f 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -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; } diff --git a/composite/compoverlay.c b/composite/compoverlay.c index 6d73f003d..2158cdb5a 100644 --- a/composite/compoverlay.c +++ b/composite/compoverlay.c @@ -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; -- cgit v1.2.3