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

@@ -226,7 +226,7 @@ ShmCloseScreen(int i, ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
xfree (screen_priv);
free(screen_priv);
return (*pScreen->CloseScreen) (i, pScreen);
}
@@ -236,7 +236,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
if (!screen_priv)
{
screen_priv = xcalloc (1, sizeof (ShmScrPrivateRec));
screen_priv = calloc(1, sizeof (ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
@@ -454,7 +454,7 @@ ProcShmAttach(ClientPtr client)
}
else
{
shmdesc = xalloc(sizeof(ShmDescRec));
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
shmdesc->addr = shmat(stuff->shmid, 0,
@@ -462,7 +462,7 @@ ProcShmAttach(ClientPtr client)
if ((shmdesc->addr == ((char *)-1)) ||
SHMSTAT(stuff->shmid, &buf))
{
xfree(shmdesc);
free(shmdesc);
return BadAccess;
}
@@ -472,7 +472,7 @@ ProcShmAttach(ClientPtr client)
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
shmdt(shmdesc->addr);
xfree(shmdesc);
free(shmdesc);
return BadAccess;
}
@@ -502,7 +502,7 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
;
*prev = shmdesc->next;
xfree(shmdesc);
free(shmdesc);
return Success;
}
@@ -671,7 +671,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return(BadMatch);
}
drawables = xcalloc(PanoramiXNumScreens, sizeof(DrawablePtr));
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if(!drawables)
return(BadAlloc);
@@ -681,7 +681,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
DixReadAccess);
if (rc != Success)
{
xfree(drawables);
free(drawables);
return rc;
}
}
@@ -722,7 +722,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
}
}
xfree(drawables);
free(drawables);
if (client->swapped) {
int n;
@@ -795,7 +795,7 @@ CreatePmap:
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
if(!(newPix = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@@ -836,7 +836,7 @@ CreatePmap:
(*pScreen->DestroyPixmap)(pMap);
FreeResource(newPix->info[j].id, RT_NONE);
}
xfree(newPix);
free(newPix);
} else
AddResource(stuff->pid, XRT_PIXMAP, newPix);