diff options
author | Matt Turner <[email protected]> | 2012-09-04 22:52:36 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-09-05 22:28:49 -0700 |
commit | 7c7b7b068b1d0dc8e14b87dab5dbd4108f874f74 (patch) | |
tree | 9a6901c4b12cd5b2dbe3c7fce29cfcc7771a84de /src/gallium/state_trackers/egl | |
parent | 17a574d7cd8c541c902cc0da40362a32d965e77b (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/state_trackers/egl')
-rw-r--r-- | src/gallium/state_trackers/egl/x11/glxinit.c | 32 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/x11/x11_screen.c | 6 |
2 files changed, 19 insertions, 19 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); } |