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:
40
dix/window.c
40
dix/window.c
@@ -359,7 +359,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
||||
BoxRec box;
|
||||
PixmapFormatRec *format;
|
||||
|
||||
pWin = xalloc(sizeof(WindowRec));
|
||||
pWin = malloc(sizeof(WindowRec));
|
||||
if (!pWin)
|
||||
return FALSE;
|
||||
|
||||
@@ -386,7 +386,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
||||
pWin->parent = NullWindow;
|
||||
SetWindowToDefaults(pWin);
|
||||
|
||||
pWin->optional = xalloc (sizeof (WindowOptRec));
|
||||
pWin->optional = malloc(sizeof (WindowOptRec));
|
||||
if (!pWin->optional)
|
||||
return FALSE;
|
||||
|
||||
@@ -639,7 +639,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
|
||||
return NullWindow;
|
||||
}
|
||||
|
||||
pWin = xalloc(sizeof(WindowRec));
|
||||
pWin = malloc(sizeof(WindowRec));
|
||||
if (!pWin)
|
||||
{
|
||||
*error = BadAlloc;
|
||||
@@ -670,7 +670,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
|
||||
{
|
||||
if (!MakeWindowOptional (pWin))
|
||||
{
|
||||
xfree (pWin);
|
||||
free(pWin);
|
||||
*error = BadAlloc;
|
||||
return NullWindow;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
|
||||
*error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin,
|
||||
RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess);
|
||||
if (*error != Success) {
|
||||
xfree(pWin);
|
||||
free(pWin);
|
||||
return NullWindow;
|
||||
}
|
||||
|
||||
@@ -809,12 +809,12 @@ DisposeWindowOptional (WindowPtr pWin)
|
||||
FreeCursor(pList->cursor, (XID)0);
|
||||
pPrev = pList;
|
||||
pList = pList->next;
|
||||
xfree(pPrev);
|
||||
free(pPrev);
|
||||
}
|
||||
pWin->optional->deviceCursors = NULL;
|
||||
}
|
||||
|
||||
xfree (pWin->optional);
|
||||
free(pWin->optional);
|
||||
pWin->optional = NULL;
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ CrushTree(WindowPtr pWin)
|
||||
}
|
||||
FreeWindowResources(pChild);
|
||||
dixFreePrivates(pChild->devPrivates);
|
||||
xfree(pChild);
|
||||
free(pChild);
|
||||
if ( (pChild = pSib) )
|
||||
break;
|
||||
pChild = pParent;
|
||||
@@ -934,9 +934,9 @@ DeleteWindow(pointer value, XID wid)
|
||||
if (pWin->prevSib)
|
||||
pWin->prevSib->nextSib = pWin->nextSib;
|
||||
}
|
||||
xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
|
||||
free(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
|
||||
dixFreePrivates(pWin->devPrivates);
|
||||
xfree(pWin);
|
||||
free(pWin);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -2996,7 +2996,7 @@ HandleSaveSet(ClientPtr client)
|
||||
MapWindow(pWin, client);
|
||||
}
|
||||
}
|
||||
xfree(client->saveSet);
|
||||
free(client->saveSet);
|
||||
client->numSaved = 0;
|
||||
client->saveSet = (SaveSetElt *)NULL;
|
||||
}
|
||||
@@ -3298,12 +3298,12 @@ TileScreenSaver(int i, int kind)
|
||||
cm.height=16;
|
||||
cm.xhot=8;
|
||||
cm.yhot=8;
|
||||
srcbits = xalloc( BitmapBytePad(32)*16);
|
||||
mskbits = xalloc( BitmapBytePad(32)*16);
|
||||
srcbits = malloc( BitmapBytePad(32)*16);
|
||||
mskbits = malloc( BitmapBytePad(32)*16);
|
||||
if (!srcbits || !mskbits)
|
||||
{
|
||||
xfree(srcbits);
|
||||
xfree(mskbits);
|
||||
free(srcbits);
|
||||
free(mskbits);
|
||||
cursor = 0;
|
||||
}
|
||||
else
|
||||
@@ -3325,8 +3325,8 @@ TileScreenSaver(int i, int kind)
|
||||
}
|
||||
else
|
||||
{
|
||||
xfree (srcbits);
|
||||
xfree (mskbits);
|
||||
free(srcbits);
|
||||
free(mskbits);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3456,7 +3456,7 @@ MakeWindowOptional (WindowPtr pWin)
|
||||
|
||||
if (pWin->optional)
|
||||
return TRUE;
|
||||
optional = xalloc (sizeof (WindowOptRec));
|
||||
optional = malloc(sizeof (WindowOptRec));
|
||||
if (!optional)
|
||||
return FALSE;
|
||||
optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
|
||||
@@ -3547,7 +3547,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
|
||||
/* first item in list */
|
||||
pWin->optional->deviceCursors = pNode->next;
|
||||
|
||||
xfree(pNode);
|
||||
free(pNode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -3559,7 +3559,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
|
||||
if (!pCursor)
|
||||
return Success;
|
||||
|
||||
pNewNode = xalloc(sizeof(DevCursNodeRec));
|
||||
pNewNode = malloc(sizeof(DevCursNodeRec));
|
||||
pNewNode->dev = pDev;
|
||||
pNewNode->next = pWin->optional->deviceCursors;
|
||||
pWin->optional->deviceCursors = pNewNode;
|
||||
|
||||
Reference in New Issue
Block a user