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

@@ -783,7 +783,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
unwrap(pExaScr, ps, Triangles);
unwrap(pExaScr, ps, AddTraps);
xfree (pExaScr);
free(pExaScr);
return (*pScreen->CloseScreen) (i, pScreen);
}
@@ -794,14 +794,14 @@ exaCloseScreen(int i, ScreenPtr pScreen)
* without breaking ABI between EXA and the drivers. The driver's
* responsibility is to check beforehand that the EXA module has a matching
* major number and sufficient minor. Drivers are responsible for freeing the
* driver structure using xfree().
* driver structure using free().
*
* @return a newly allocated, zero-filled driver structure
*/
ExaDriverPtr
exaDriverAlloc(void)
{
return xcalloc(1, sizeof(ExaDriverRec));
return calloc(1, sizeof(ExaDriverRec));
}
/**
@@ -889,7 +889,7 @@ exaDriverInit (ScreenPtr pScreen,
ps = GetPictureScreenIfSet(pScreen);
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
pExaScr = calloc(sizeof (ExaScreenPrivRec), 1);
if (!pExaScr) {
LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
pScreen->myNum);

View File

@@ -394,7 +394,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
rects = xalloc(nbox * sizeof(xRectangle));
rects = malloc(nbox * sizeof(xRectangle));
if (rects) {
int i;
@@ -417,7 +417,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
ordering = CT_UNSORTED;
srcregion = RECTS_TO_REGION(pScreen, nbox, rects, ordering);
xfree(rects);
free(rects);
if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
pGC->fillStyle, pGC->alu,
@@ -626,7 +626,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
return;
}
prect = xalloc(sizeof(xRectangle) * npt);
prect = malloc(sizeof(xRectangle) * npt);
for (i = 0; i < npt; i++) {
prect[i].x = ppt[i].x;
prect[i].y = ppt[i].y;
@@ -638,7 +638,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
prect[i].height = 1;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect);
xfree(prect);
free(prect);
}
/**
@@ -667,7 +667,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
return;
}
prect = xalloc(sizeof(xRectangle) * (npt - 1));
prect = malloc(sizeof(xRectangle) * (npt - 1));
x1 = ppt[0].x;
y1 = ppt[0].y;
/* If we have any non-horizontal/vertical, fall back. */
@@ -681,7 +681,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
}
if (x1 != x2 && y1 != y2) {
xfree(prect);
free(prect);
ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
return;
}
@@ -705,7 +705,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
y1 = y2;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect);
xfree(prect);
free(prect);
}
/**
@@ -737,7 +737,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
}
}
prect = xalloc(sizeof(xRectangle) * nseg);
prect = malloc(sizeof(xRectangle) * nseg);
for (i = 0; i < nseg; i++) {
if (pSeg[i].x1 < pSeg[i].x2) {
prect[i].x = pSeg[i].x1;
@@ -763,7 +763,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
}
}
pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
xfree(prect);
free(prect);
}
static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,

View File

@@ -128,12 +128,12 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
}
if (cache->hashEntries) {
xfree(cache->hashEntries);
free(cache->hashEntries);
cache->hashEntries = NULL;
}
if (cache->glyphs) {
xfree(cache->glyphs);
free(cache->glyphs);
cache->glyphs = NULL;
}
cache->glyphCount = 0;
@@ -213,8 +213,8 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
cache->picture = pPicture;
cache->picture->refcnt++;
cache->hashEntries = xalloc(sizeof(int) * cache->hashSize);
cache->glyphs = xalloc(sizeof(ExaCachedGlyphRec) * cache->size);
cache->hashEntries = malloc(sizeof(int) * cache->hashSize);
cache->glyphs = malloc(sizeof(ExaCachedGlyphRec) * cache->size);
cache->glyphCount = 0;
if (!cache->hashEntries || !cache->glyphs)

View File

@@ -245,7 +245,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
/* save extra space in new area */
if (real_size < area->size)
{
ExaOffscreenArea *new_area = xalloc (sizeof (ExaOffscreenArea));
ExaOffscreenArea *new_area = malloc(sizeof (ExaOffscreenArea));
if (!new_area)
return NULL;
new_area->base_offset = area->base_offset;
@@ -408,7 +408,7 @@ ExaOffscreenMerge (ExaScreenPrivPtr pExaScr, ExaOffscreenArea *area)
area->next->prev = area;
else
pExaScr->info->offScreenAreas->prev = area;
xfree (next);
free(next);
pExaScr->numOffscreenAvailable--;
}
@@ -655,7 +655,7 @@ exaOffscreenInit (ScreenPtr pScreen)
ExaOffscreenArea *area;
/* Allocate a big free area */
area = xalloc (sizeof (ExaOffscreenArea));
area = malloc(sizeof (ExaOffscreenArea));
if (!area)
return FALSE;
@@ -691,6 +691,6 @@ ExaOffscreenFini (ScreenPtr pScreen)
while ((area = pExaScr->info->offScreenAreas))
{
pExaScr->info->offScreenAreas = area->next;
xfree (area);
free(area);
}
}