summaryrefslogtreecommitdiff
path: root/hw/xquartz
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-05-06 01:44:06 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-05-13 00:22:37 +0700
commit3f3ff971ecff9936cebafc813af9193b97bba89c (patch)
treefdbbad794a42488b7ffe41eed7aba4e498335f55 /hw/xquartz
parent96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff)
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>
Diffstat (limited to 'hw/xquartz')
-rw-r--r--hw/xquartz/GL/glcontextmodes.c6
-rw-r--r--hw/xquartz/GL/indirect.c18
-rw-r--r--hw/xquartz/GL/visualConfigs.c2
-rw-r--r--hw/xquartz/applewm.c16
-rw-r--r--hw/xquartz/darwin.c2
-rw-r--r--hw/xquartz/pseudoramiX.c2
-rw-r--r--hw/xquartz/quartz.c2
-rw-r--r--hw/xquartz/xpr/dri.c30
-rw-r--r--hw/xquartz/xpr/driWrap.c2
-rw-r--r--hw/xquartz/xpr/x-hook.c8
-rw-r--r--hw/xquartz/xpr/xprCursor.c8
-rw-r--r--hw/xquartz/xpr/xprScreen.c4
12 files changed, 50 insertions, 50 deletions
diff --git a/hw/xquartz/GL/glcontextmodes.c b/hw/xquartz/GL/glcontextmodes.c
index 326c8b235..eee7103ae 100644
--- a/hw/xquartz/GL/glcontextmodes.c
+++ b/hw/xquartz/GL/glcontextmodes.c
@@ -53,14 +53,14 @@
# ifdef XFree86Server
# include <os.h>
# include <string.h>
-# define _mesa_malloc(b) xalloc(b)
-# define _mesa_free(m) xfree(m)
+# define _mesa_malloc(b) malloc(b)
+# define _mesa_free(m) free(m)
# define _mesa_memset memset
# else
# include <X11/Xlibint.h>
# define _mesa_memset memset
# define _mesa_malloc(b) Xmalloc(b)
-# define _mesa_free(m) Xfree(m)
+# define _mesa_free(m) free(m)
# endif /* XFree86Server */
#endif /* !defined(IN_MINI_GLX) */
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 8092cfa4f..f769ff2ec 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -222,7 +222,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
- context = xcalloc(1, sizeof (__GLXAquaContext));
+ context = calloc(1, sizeof (__GLXAquaContext));
if (context == NULL)
return NULL;
@@ -241,7 +241,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
context->pixelFormat = makeFormat(conf);
if (!context->pixelFormat) {
- xfree(context);
+ free(context);
return NULL;
}
@@ -253,7 +253,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
if (gl_err != 0) {
ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
CGLDestroyPixelFormat(context->pixelFormat);
- xfree(context);
+ free(context);
return NULL;
}
@@ -286,7 +286,7 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
if (context->pixelFormat != NULL)
CGLDestroyPixelFormat(context->pixelFormat);
- xfree(context);
+ free(context);
}
}
@@ -566,7 +566,7 @@ static void __glXAquaScreenDestroy(__GLXscreen *screen) {
GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen);
__glXScreenDestroy(screen);
- xfree(screen);
+ free(screen);
}
/* This is called by __glXInitScreens(). */
@@ -578,7 +578,7 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
if (pScreen == NULL)
return NULL;
- screen = xcalloc(1, sizeof *screen);
+ screen = calloc(1, sizeof *screen);
if(NULL == screen)
return NULL;
@@ -635,7 +635,7 @@ static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
*to validate the test, beyond using gdb with print.
*/
- xfree(glxPriv);
+ free(glxPriv);
}
static __GLXdrawable *
@@ -648,7 +648,7 @@ __glXAquaScreenCreateDrawable(ClientPtr client,
__GLXconfig *conf) {
__GLXAquaDrawable *glxPriv;
- glxPriv = xalloc(sizeof *glxPriv);
+ glxPriv = malloc(sizeof *glxPriv);
if(glxPriv == NULL)
return NULL;
@@ -656,7 +656,7 @@ __glXAquaScreenCreateDrawable(ClientPtr client,
memset(glxPriv, 0, sizeof *glxPriv);
if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
- xfree(glxPriv);
+ free(glxPriv);
return NULL;
}
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index cecc90265..b209b7656 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -115,7 +115,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
if(numConfigsPtr)
*numConfigsPtr = numConfigs;
- visualConfigs = xcalloc(sizeof(*visualConfigs), numConfigs);
+ visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
if(NULL == visualConfigs) {
ErrorF("xcalloc failure when allocating visualConfigs\n");
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 15c86de00..8750f5d00 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -229,7 +229,7 @@ WMFreeClient (pointer data, XID id) {
}
updateEventMask (pHead);
}
- xfree ((pointer) pEvent);
+ free((pointer) pEvent);
return 1;
}
@@ -242,9 +242,9 @@ WMFreeEvents (pointer data, XID id) {
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
FreeResource (pCur->clientResource, ClientType);
- xfree ((pointer) pCur);
+ free((pointer) pCur);
}
- xfree ((pointer) pHead);
+ free((pointer) pHead);
eventMask = 0;
return 1;
}
@@ -274,7 +274,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
}
/* build the entry */
- pNewEvent = (WMEventPtr) xalloc (sizeof (WMEventRec));
+ pNewEvent = (WMEventPtr) malloc(sizeof (WMEventRec));
if (!pNewEvent)
return BadAlloc;
pNewEvent->next = 0;
@@ -296,7 +296,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
*/
if (i != Success || !pHead)
{
- pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
+ pHead = (WMEventPtr *) malloc(sizeof (WMEventPtr));
if (!pHead ||
!AddResource (eventResource, EventType, (pointer)pHead))
{
@@ -323,7 +323,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
pNewEvent->next = pEvent->next;
else
*pHead = pEvent->next;
- xfree (pEvent);
+ free(pEvent);
updateEventMask (pHead);
}
}
@@ -414,8 +414,8 @@ ProcAppleWMSetWindowMenu(
REQUEST_AT_LEAST_SIZE(xAppleWMSetWindowMenuReq);
nitems = stuff->nitems;
- items = xalloc (sizeof (char *) * nitems);
- shortcuts = xalloc (sizeof (char) * nitems);
+ items = malloc(sizeof (char *) * nitems);
+ shortcuts = malloc(sizeof (char) * nitems);
max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
bytes = (char *) &stuff[1];
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 1fb158b26..580fe4ae0 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -194,7 +194,7 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
}
// allocate space for private per screen storage
- dfb = xalloc(sizeof(DarwinFramebufferRec));
+ dfb = malloc(sizeof(DarwinFramebufferRec));
// SCREEN_PRIV(pScreen) = dfb;
dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 1de7af6dc..c3154b948 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -94,7 +94,7 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
- pseudoramiXScreens = xrealloc(pseudoramiXScreens,
+ pseudoramiXScreens = realloc(pseudoramiXScreens,
pseudoramiXScreensAllocated *
sizeof(PseudoramiXScreenRec));
}
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index a8c0d4b47..462be8794 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -122,7 +122,7 @@ Bool QuartzAddScreen(
ScreenPtr pScreen)
{
// allocate space for private per screen Quartz specific storage
- QuartzScreenPtr displayInfo = xcalloc(sizeof(QuartzScreenRec), 1);
+ QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1);
// QUARTZ_PRIV(pScreen) = displayInfo;
dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo);
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 0a58b29f3..3b14581d0 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -205,7 +205,7 @@ DRIScreenInit(ScreenPtr pScreen)
DRIScreenPrivPtr pDRIPriv;
int i;
- pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
+ pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
return FALSE;
@@ -269,7 +269,7 @@ DRICloseScreen(ScreenPtr pScreen)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
- xfree(pDRIPriv);
+ free(pDRIPriv);
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
}
}
@@ -381,7 +381,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
xp_window_changes wc;
/* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = xalloc(sizeof(*pDRIDrawablePriv)))) {
+ if (!(pDRIDrawablePriv = malloc(sizeof(*pDRIDrawablePriv)))) {
return NULL;
}
@@ -395,7 +395,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
if (wid == 0) {
- xfree(pDRIDrawablePriv);
+ free(pDRIDrawablePriv);
return NULL;
}
@@ -403,7 +403,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
if (err != Success) {
- xfree(pDRIDrawablePriv);
+ free(pDRIDrawablePriv);
return NULL;
}
@@ -414,7 +414,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
if (err != Success) {
xp_destroy_surface(pDRIDrawablePriv->sid);
- xfree(pDRIDrawablePriv);
+ free(pDRIDrawablePriv);
return NULL;
}
@@ -439,7 +439,7 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
xp_error err;
/* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = xcalloc(1, sizeof(*pDRIDrawablePriv)))) {
+ if (!(pDRIDrawablePriv = calloc(1, sizeof(*pDRIDrawablePriv)))) {
return NULL;
}
@@ -454,7 +454,7 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
err = xp_create_surface(0, &pDRIDrawablePriv->sid);
if (err != Success) {
- xfree(pDRIDrawablePriv);
+ free(pDRIDrawablePriv);
return NULL;
}
@@ -519,7 +519,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
client_id, key);
if (err != Success) {
xp_destroy_surface(pDRIDrawablePriv->sid);
- xfree(pDRIDrawablePriv);
+ free(pDRIDrawablePriv);
/*
* Now set the dix privates to NULL that were previously set.
@@ -637,7 +637,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
if (pDRIDrawablePriv->notifiers != NULL)
x_hook_free(pDRIDrawablePriv->notifiers);
- xfree(pDRIDrawablePriv);
+ free(pDRIDrawablePriv);
if (pDrawable->type == DRAWABLE_WINDOW) {
dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
@@ -828,7 +828,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
pPix = (PixmapPtr)pDrawable;
- shared = xalloc(sizeof(*shared));
+ shared = malloc(sizeof(*shared));
if(NULL == shared) {
FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__);
}
@@ -856,7 +856,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
if(-1 == shared->fd) {
- xfree(shared);
+ free(shared);
return FALSE;
}
@@ -866,7 +866,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
ErrorF("failed to ftruncate (extend) file.");
shm_unlink(shared->shmPath);
close(shared->fd);
- xfree(shared);
+ free(shared);
return FALSE;
}
@@ -878,7 +878,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
ErrorF("failed to mmap shared memory.");
shm_unlink(shared->shmPath);
close(shared->fd);
- xfree(shared);
+ free(shared);
return FALSE;
}
@@ -938,7 +938,7 @@ DRIFreePixmapImp(DrawablePtr pDrawable) {
close(shared->fd);
munmap(shared->buffer, shared->length);
shm_unlink(shared->shmPath);
- xfree(shared);
+ free(shared);
dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL);
diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c
index 8c57fd4bd..f1a5c83f5 100644
--- a/hw/xquartz/xpr/driWrap.c
+++ b/hw/xquartz/xpr/driWrap.c
@@ -533,7 +533,7 @@ DRIWrapInit(ScreenPtr pScreen) {
if(!dixRequestPrivate(driWrapScreenKey, sizeof(DRIWrapScreenRec)))
return FALSE;
- pScreenPriv = xalloc(sizeof(*pScreenPriv));
+ pScreenPriv = malloc(sizeof(*pScreenPriv));
if(NULL == pScreenPriv)
return FALSE;
diff --git a/hw/xquartz/xpr/x-hook.c b/hw/xquartz/xpr/x-hook.c
index 5b850fe88..d9f011553 100644
--- a/hw/xquartz/xpr/x-hook.c
+++ b/hw/xquartz/xpr/x-hook.c
@@ -83,8 +83,8 @@ X_PFX (hook_run) (x_list *lst, void *arg)
return;
length = X_PFX (list_length) (lst);
- fun = xalloc (sizeof (x_hook_function *) * length);
- data = xalloc (sizeof (void *) * length);
+ fun = malloc(sizeof (x_hook_function *) * length);
+ data = malloc(sizeof (void *) * length);
if(!fun || !data) {
FatalError("Failed to allocate memory in %s\n", __func__);
@@ -102,8 +102,8 @@ X_PFX (hook_run) (x_list *lst, void *arg)
(*fun[i]) (arg, data[i]);
}
- xfree(fun);
- xfree(data);
+ free(fun);
+ free(data);
}
X_EXTERN void
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index fbaf825de..c1c8b2005 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -95,7 +95,7 @@ load_cursor(CursorPtr src, int screen)
const uint32_t *be_data=(uint32_t *) src->bits->argb;
unsigned i;
rowbytes = src->bits->width * sizeof (CARD32);
- data = xalloc(rowbytes * src->bits->height);
+ data = malloc(rowbytes * src->bits->height);
if(!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
@@ -121,7 +121,7 @@ load_cursor(CursorPtr src, int screen)
/* round up to 8 pixel boundary so we can convert whole bytes */
rowbytes = ((src->bits->width * 4) + 31) & ~31;
- data = xalloc(rowbytes * src->bits->height);
+ data = malloc(rowbytes * src->bits->height);
if(!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
@@ -174,7 +174,7 @@ load_cursor(CursorPtr src, int screen)
}
err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes);
- xfree(data);
+ free(data);
return err == Success;
}
@@ -360,7 +360,7 @@ QuartzInitCursor(ScreenPtr pScreen)
if (!miDCInitialize(pScreen, &quartzScreenFuncsRec))
return FALSE;
- ScreenPriv = xcalloc(1, sizeof(QuartzCursorScreenRec));
+ ScreenPriv = calloc(1, sizeof(QuartzCursorScreenRec));
if (ScreenPriv == NULL)
return FALSE;
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 735b2ba67..d574721b3 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -195,7 +195,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
return;
}
- displayList = xalloc(displayCount * sizeof(CGDirectDisplayID));
+ displayList = malloc(displayCount * sizeof(CGDirectDisplayID));
if(!displayList)
FatalError("Unable to allocate memory for list of displays.\n");
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
@@ -232,7 +232,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
frame.size.width, frame.size.height);
}
- xfree(displayList);
+ free(displayList);
}
/*