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/glx/dri_glx.c | |
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/glx/dri_glx.c')
-rw-r--r-- | src/glx/dri_glx.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index 9bfcb0c082a..b2fced95222 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -136,7 +136,7 @@ driGetDriverName(Display * dpy, int scrNum, char **driverName) Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev); if (ret) - Xfree(dev); + free(dev); return ret; } @@ -163,7 +163,7 @@ glXGetScreenDriver(Display * dpy, int scrNum) if (len >= 31) return NULL; memcpy(ret, driverName, len + 1); - Xfree(driverName); + free(driverName); return ret; } return NULL; @@ -354,7 +354,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, fd = drmOpenOnce(NULL, BusID, &newlyopened); - Xfree(BusID); /* No longer needed */ + free(BusID); /* No longer needed */ if (fd < 0) { ErrorMessageF("drmOpenOnce failed (%s)\n", strerror(-fd)); @@ -395,7 +395,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, goto handle_error; } - Xfree(driverName); /* No longer needed. */ + free(driverName); /* No longer needed. */ /* * Get device-specific info. pDevPriv will point to a struct @@ -477,7 +477,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, if (num_visuals > 0 && visuals->depth != DefaultDepth(dpy, scrn)) visual->visualRating = GLX_NON_CONFORMANT_CONFIG; - XFree(visuals); + free(visuals); } } @@ -496,7 +496,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, drmUnmap((drmAddress) framebuffer.base, framebuffer.size); if (framebuffer.dev_priv != NULL) - Xfree(framebuffer.dev_priv); + free(framebuffer.dev_priv); if (fd >= 0) drmCloseOnce(fd); @@ -517,12 +517,12 @@ dri_destroy_context(struct glx_context * context) driReleaseDrawables(&pcp->base); if (context->extensions) - XFree((char *) context->extensions); + free((char *) context->extensions); (*psc->core->destroyContext) (pcp->driContext); XF86DRIDestroyContext(psc->base.dpy, psc->base.scr, pcp->hwContextID); - Xfree(pcp); + free(pcp); } static int @@ -595,20 +595,20 @@ dri_create_context(struct glx_screen *base, shared = pcp_shared->driContext; } - pcp = Xmalloc(sizeof *pcp); + pcp = malloc(sizeof *pcp); if (pcp == NULL) return NULL; memset(pcp, 0, sizeof *pcp); if (!glx_context_init(&pcp->base, &psc->base, &config->base)) { - Xfree(pcp); + free(pcp); return NULL; } if (!XF86DRICreateContextWithConfig(psc->base.dpy, psc->base.scr, config->base.visualID, &pcp->hwContextID, &hwContext)) { - Xfree(pcp); + free(pcp); return NULL; } @@ -618,7 +618,7 @@ dri_create_context(struct glx_screen *base, renderType, shared, hwContext, pcp); if (pcp->driContext == NULL) { XF86DRIDestroyContext(psc->base.dpy, psc->base.scr, pcp->hwContextID); - Xfree(pcp); + free(pcp); return NULL; } @@ -635,7 +635,7 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw) (*psc->core->destroyDrawable) (pdp->driDrawable); XF86DRIDestroyDrawable(psc->base.dpy, psc->base.scr, pdraw->drawable); - Xfree(pdraw); + free(pdraw); } static __GLXDRIdrawable * @@ -653,7 +653,7 @@ driCreateDrawable(struct glx_screen *base, if (xDrawable != drawable) return NULL; - pdp = Xmalloc(sizeof *pdp); + pdp = malloc(sizeof *pdp); if (!pdp) return NULL; @@ -663,7 +663,7 @@ driCreateDrawable(struct glx_screen *base, if (!XF86DRICreateDrawable(psc->base.dpy, psc->base.scr, drawable, &hwDrawable)) { - Xfree(pdp); + free(pdp); return NULL; } @@ -677,7 +677,7 @@ driCreateDrawable(struct glx_screen *base, if (!pdp->driDrawable) { XF86DRIDestroyDrawable(psc->base.dpy, psc->base.scr, drawable); - Xfree(pdp); + free(pdp); return NULL; } @@ -850,13 +850,13 @@ driCreateScreen(int screen, struct glx_display *priv) char *driverName; int i; - psc = Xcalloc(1, sizeof *psc); + psc = calloc(1, sizeof *psc); if (psc == NULL) return NULL; memset(psc, 0, sizeof *psc); if (!glx_screen_init(&psc->base, screen, priv)) { - Xfree(psc); + free(psc); return NULL; } @@ -865,7 +865,7 @@ driCreateScreen(int screen, struct glx_display *priv) } psc->driver = driOpenDriver(driverName); - Xfree(driverName); + free(driverName); if (psc->driver == NULL) goto cleanup; @@ -921,7 +921,7 @@ cleanup: if (psc->driver) dlclose(psc->driver); glx_screen_cleanup(&psc->base); - Xfree(psc); + free(psc); return NULL; } @@ -931,7 +931,7 @@ cleanup: static void driDestroyDisplay(__GLXDRIdisplay * dpy) { - Xfree(dpy); + free(dpy); } /* @@ -954,7 +954,7 @@ driCreateDisplay(Display * dpy) return NULL; } - pdpyp = Xmalloc(sizeof *pdpyp); + pdpyp = malloc(sizeof *pdpyp); if (!pdpyp) { return NULL; } |