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:
@@ -61,7 +61,7 @@ fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
|
||||
{
|
||||
FbScreenPrivPtr pScreenPriv;
|
||||
|
||||
pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec));
|
||||
pScreenPriv = (FbScreenPrivPtr) malloc(sizeof (FbScreenPrivRec));
|
||||
if (!pScreenPriv)
|
||||
return FALSE;
|
||||
dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
|
||||
|
||||
14
fb/fbcmap.c
14
fb/fbcmap.c
@@ -388,7 +388,7 @@ fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
|
||||
{
|
||||
fbVisualsPtr new, *prev, v;
|
||||
|
||||
new = (fbVisualsPtr) xalloc (sizeof *new);
|
||||
new = (fbVisualsPtr) malloc(sizeof *new);
|
||||
if (!new)
|
||||
return FALSE;
|
||||
if (!redMask || !greenMask || !blueMask)
|
||||
@@ -485,12 +485,12 @@ fbInitVisuals (VisualPtr *visualp,
|
||||
ndepth++;
|
||||
nvisual += visuals->count;
|
||||
}
|
||||
depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec));
|
||||
visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec));
|
||||
depth = (DepthPtr) malloc(ndepth * sizeof (DepthRec));
|
||||
visual = (VisualPtr) malloc(nvisual * sizeof (VisualRec));
|
||||
if (!depth || !visual)
|
||||
{
|
||||
xfree (depth);
|
||||
xfree (visual);
|
||||
free(depth);
|
||||
free(visual);
|
||||
return FALSE;
|
||||
}
|
||||
*depthp = depth;
|
||||
@@ -506,7 +506,7 @@ fbInitVisuals (VisualPtr *visualp,
|
||||
vid = NULL;
|
||||
if (nvtype)
|
||||
{
|
||||
vid = (VisualID *) xalloc (nvtype * sizeof (VisualID));
|
||||
vid = (VisualID *) malloc(nvtype * sizeof (VisualID));
|
||||
if (!vid)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -547,7 +547,7 @@ fbInitVisuals (VisualPtr *visualp,
|
||||
vid++;
|
||||
visual++;
|
||||
}
|
||||
xfree (visuals);
|
||||
free(visuals);
|
||||
}
|
||||
fbVisuals = NULL;
|
||||
visual = *visualp;
|
||||
|
||||
@@ -275,7 +275,7 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
|
||||
height = pbox->y2 - pbox->y1;
|
||||
|
||||
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
|
||||
tmp = xalloc (tmpStride * height * sizeof (FbStip));
|
||||
tmp = malloc(tmpStride * height * sizeof (FbStip));
|
||||
if (!tmp)
|
||||
return;
|
||||
|
||||
@@ -313,7 +313,7 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
|
||||
|
||||
pPriv->and, pPriv->xor,
|
||||
pPriv->bgand, pPriv->bgxor);
|
||||
xfree (tmp);
|
||||
free(tmp);
|
||||
|
||||
fbFinishAccess (pDstDrawable);
|
||||
fbFinishAccess (pSrcDrawable);
|
||||
|
||||
@@ -348,7 +348,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
||||
VisualID defaultVisual;
|
||||
FbOverlayScrPrivPtr pScrPriv;
|
||||
|
||||
pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec));
|
||||
pScrPriv = malloc(sizeof (FbOverlayScrPrivRec));
|
||||
if (!pScrPriv)
|
||||
return FALSE;
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ fbDestroyPixmap (PixmapPtr pPixmap)
|
||||
if(--pPixmap->refcnt)
|
||||
return TRUE;
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
free(pPixmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ fbPixmapToRegion(PixmapPtr pPix)
|
||||
pReg->extents.y2 = REGION_END(pReg)->y2;
|
||||
if (pReg->data->numRects == 1)
|
||||
{
|
||||
xfree(pReg->data);
|
||||
free(pReg->data);
|
||||
pReg->data = (RegDataPtr)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ fbCloseScreen (int index, ScreenPtr pScreen)
|
||||
DepthPtr depths = pScreen->allowedDepths;
|
||||
|
||||
for (d = 0; d < pScreen->numDepths; d++)
|
||||
xfree (depths[d].vids);
|
||||
xfree (depths);
|
||||
xfree (pScreen->visuals);
|
||||
xfree (pScreen->devPrivate);
|
||||
free(depths[d].vids);
|
||||
free(depths);
|
||||
free(pScreen->visuals);
|
||||
free(pScreen->devPrivate);
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
xfree (dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
|
||||
free(dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
@@ -229,8 +229,8 @@ fbFinishScreenInit(ScreenPtr pScreen,
|
||||
if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
||||
&defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
|
||||
{
|
||||
xfree (visuals);
|
||||
xfree (depths);
|
||||
free(visuals);
|
||||
free(depths);
|
||||
return FALSE;
|
||||
}
|
||||
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
|
||||
|
||||
Reference in New Issue
Block a user