summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-04 22:52:36 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:49 -0700
commit7c7b7b068b1d0dc8e14b87dab5dbd4108f874f74 (patch)
tree9a6901c4b12cd5b2dbe3c7fce29cfcc7771a84de /src/gallium
parent17a574d7cd8c541c902cc0da40362a32d965e77b (diff)
Remove Xcalloc/Xmalloc/Xfree calls
These calls allowed Xlib to use a custom memory allocator, but Xlib has used the standard C library functions since at least its initial import into git in 2003. It seems unlikely that it will grow a custom memory allocator. The functions now just add extra overhead. Replacing them will make future Coccinelle patches simpler. This patch has been generated by the following Coccinelle semantic patch: // Remove Xcalloc/Xmalloc/Xfree calls @@ expression E1, E2; @@ - Xcalloc (E1, E2) + calloc (E1, E2) @@ expression E; @@ - Xmalloc (E) + malloc (E) @@ expression E; @@ - Xfree (E) + free (E) @@ expression E; @@ - XFree (E) + free (E) Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c32
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c6
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_api.c2
-rw-r--r--src/gallium/state_trackers/xvmc/context.c2
-rw-r--r--src/gallium/state_trackers/xvmc/subpicture.c4
-rw-r--r--src/gallium/state_trackers/xvmc/tests/test_subpicture.c2
-rw-r--r--src/gallium/state_trackers/xvmc/tests/testlib.c2
-rw-r--r--src/gallium/targets/graw-xlib/graw_xlib.c4
8 files changed, 27 insertions, 27 deletions
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index df8370f8d7d..c88d921a6cd 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -85,7 +85,7 @@ _gl_context_modes_destroy(__GLcontextModes * modes)
while (modes != NULL) {
__GLcontextModes *const next = modes->next;
- Xfree(modes);
+ free(modes);
modes = next;
}
}
@@ -101,7 +101,7 @@ _gl_context_modes_create(unsigned count, size_t minimum_size)
next = &base;
for (i = 0; i < count; i++) {
- *next = (__GLcontextModes *) Xmalloc(size);
+ *next = (__GLcontextModes *) malloc(size);
if (*next == NULL) {
_gl_context_modes_destroy(base);
base = NULL;
@@ -165,7 +165,7 @@ __glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
length = reply.length * 4;
numbytes = reply.size;
- buf = (char *) Xmalloc(numbytes);
+ buf = (char *) malloc(numbytes);
if (buf != NULL) {
_XRead(dpy, buf, numbytes);
length -= numbytes;
@@ -200,9 +200,9 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
_gl_context_modes_destroy(psc->configs);
psc->configs = NULL; /* NOTE: just for paranoia */
}
- Xfree((char *) psc->serverGLXexts);
+ free((char *) psc->serverGLXexts);
}
- XFree((char *) priv->screenConfigs);
+ free((char *) priv->screenConfigs);
priv->screenConfigs = NULL;
}
@@ -218,9 +218,9 @@ __glXFreeDisplayPrivate(XExtData * extension)
priv = (__GLXdisplayPrivate *) extension->private_data;
FreeScreenConfigs(priv);
if (priv->serverGLXversion)
- Xfree((char *) priv->serverGLXversion);
+ free((char *) priv->serverGLXversion);
- Xfree((char *) priv);
+ free((char *) priv);
return 0;
}
@@ -491,7 +491,7 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
if (prop_size <= sizeof(buf))
props = buf;
else
- props = Xmalloc(prop_size);
+ props = malloc(prop_size);
/* Read each config structure and convert it into our format */
m = modes;
@@ -506,7 +506,7 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
}
if (props != buf)
- Xfree(props);
+ free(props);
return modes;
}
@@ -568,7 +568,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
** First allocate memory for the array of per screen configs.
*/
screens = ScreenCount(dpy);
- priv->screenConfigs = Xmalloc(screens * sizeof *priv->screenConfigs);
+ priv->screenConfigs = malloc(screens * sizeof *priv->screenConfigs);
if (!priv->screenConfigs) {
return GL_FALSE;
}
@@ -581,7 +581,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
}
for (i = 0; i < screens; i++) {
- psc = Xcalloc(1, sizeof *psc);
+ psc = calloc(1, sizeof *psc);
if (!psc)
return GL_FALSE;
getFBConfigs(psc, priv, i);
@@ -619,12 +619,12 @@ __glXInitialize(Display * dpy)
/*
** Allocate memory for all the pieces needed for this buffer.
*/
- private = (XExtData *) Xmalloc(sizeof(XExtData));
+ private = (XExtData *) malloc(sizeof(XExtData));
if (!private)
return NULL;
- dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
+ dpyPriv = (__GLXdisplayPrivate *) calloc(1, sizeof(__GLXdisplayPrivate));
if (!dpyPriv) {
- Xfree(private);
+ free(private);
return NULL;
}
@@ -636,8 +636,8 @@ __glXInitialize(Display * dpy)
dpyPriv->dpy = dpy;
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
- Xfree(dpyPriv);
- Xfree(private);
+ free(dpyPriv);
+ free(private);
return NULL;
}
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index f8f9e2ae767..47d9a69c7dd 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -96,9 +96,9 @@ x11_screen_destroy(struct x11_screen *xscr)
if (xscr->dri_fd >= 0)
close(xscr->dri_fd);
if (xscr->dri_driver)
- Xfree(xscr->dri_driver);
+ free(xscr->dri_driver);
if (xscr->dri_device)
- Xfree(xscr->dri_device);
+ free(xscr->dri_device);
#ifdef GLX_DIRECT_RENDERING
/* xscr->glx_dpy will be destroyed with the X display */
@@ -107,7 +107,7 @@ x11_screen_destroy(struct x11_screen *xscr)
#endif
if (xscr->visuals)
- XFree(xscr->visuals);
+ free(xscr->visuals);
FREE(xscr);
}
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 9a487dcc27b..08db6e821ec 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -409,7 +409,7 @@ get_visual( Display *dpy, int scr, unsigned int depth, int xclass )
return vis;
}
else {
- XFree((void *) vis);
+ free((void *) vis);
return NULL;
}
}
diff --git a/src/gallium/state_trackers/xvmc/context.c b/src/gallium/state_trackers/xvmc/context.c
index 366f29bcdfa..23f9d10ca92 100644
--- a/src/gallium/state_trackers/xvmc/context.c
+++ b/src/gallium/state_trackers/xvmc/context.c
@@ -113,7 +113,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
*mc_type, *surface_flags, *subpic_max_w, *subpic_max_h);
}
- XFree(surface_info);
+ free(surface_info);
}
}
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
index b33f16e6a31..f9f646b7496 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -116,7 +116,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, int xvi
subpictures = XvMCListSubpictureTypes(dpy, port, surface_type_id, &num_subpics);
if (num_subpics < 1) {
if (subpictures)
- XFree(subpictures);
+ free(subpictures);
return BadMatch;
}
if (!subpictures)
@@ -161,7 +161,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, int xvi
}
}
- XFree(subpictures);
+ free(subpictures);
return i < num_subpics ? Success : BadMatch;
}
diff --git a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
index 9683a1a2a44..9336bfac446 100644
--- a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
+++ b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
@@ -174,7 +174,7 @@ int main(int argc, char **argv)
assert(XvMCDestroyContext(display, &context) == Success);
- XFree(subpics);
+ free(subpics);
XvUngrabPort(display, port_num, CurrentTime);
XCloseDisplay(display);
diff --git a/src/gallium/state_trackers/xvmc/tests/testlib.c b/src/gallium/state_trackers/xvmc/tests/testlib.c
index 86d4b1c6c28..de3b8da7787 100644
--- a/src/gallium/state_trackers/xvmc/tests/testlib.c
+++ b/src/gallium/state_trackers/xvmc/tests/testlib.c
@@ -102,7 +102,7 @@ int GetPort
}
}
- XFree(surface_info);
+ free(surface_info);
}
}
}
diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c
index b6d798e577c..95b856815db 100644
--- a/src/gallium/targets/graw-xlib/graw_xlib.c
+++ b/src/gallium/targets/graw-xlib/graw_xlib.c
@@ -147,7 +147,7 @@ graw_create_window_and_screen( int x,
if (screen == NULL)
goto fail;
- XFree(visinfo);
+ free(visinfo);
return screen;
fail:
@@ -158,7 +158,7 @@ fail:
FREE(xlib_handle);
if (visinfo)
- XFree(visinfo);
+ free(visinfo);
if (win)
XDestroyWindow(graw.display, win);