diff options
author | Matt Turner <mattst88@gmail.com> | 2012-09-04 22:52:36 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2012-09-05 22:28:49 -0700 |
commit | 7c7b7b068b1d0dc8e14b87dab5dbd4108f874f74 (patch) | |
tree | 9a6901c4b12cd5b2dbe3c7fce29cfcc7771a84de /src/glx | |
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 <brianp@vmware.com>
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/XF86dri.c | 10 | ||||
-rw-r--r-- | src/glx/apple/glxreply.c | 4 | ||||
-rw-r--r-- | src/glx/applegl_glx.c | 6 | ||||
-rw-r--r-- | src/glx/clientattrib.c | 4 | ||||
-rw-r--r-- | src/glx/clientinfo.c | 2 | ||||
-rw-r--r-- | src/glx/dri2.c | 10 | ||||
-rw-r--r-- | src/glx/dri2_glx.c | 52 | ||||
-rw-r--r-- | src/glx/dri_common.c | 2 | ||||
-rw-r--r-- | src/glx/dri_glx.c | 44 | ||||
-rw-r--r-- | src/glx/drisw_glx.c | 36 | ||||
-rw-r--r-- | src/glx/glx_pbuffer.c | 8 | ||||
-rw-r--r-- | src/glx/glx_query.c | 6 | ||||
-rw-r--r-- | src/glx/glxcmds.c | 12 | ||||
-rw-r--r-- | src/glx/glxext.c | 32 | ||||
-rw-r--r-- | src/glx/glxextensions.c | 2 | ||||
-rw-r--r-- | src/glx/indirect_glx.c | 28 | ||||
-rw-r--r-- | src/glx/render2.c | 16 | ||||
-rw-r--r-- | src/glx/renderpix.c | 8 | ||||
-rw-r--r-- | src/glx/single2.c | 6 | ||||
-rw-r--r-- | src/glx/singlepix.c | 13 | ||||
-rw-r--r-- | src/glx/xfont.c | 4 |
21 files changed, 152 insertions, 153 deletions
diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c index 5c181d6db9e..fe3a1551fa6 100644 --- a/src/glx/XF86dri.c +++ b/src/glx/XF86dri.c @@ -201,7 +201,7 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, } if (rep.length) { - if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) { + if (!(*busIdString = (char *) calloc(rep.busIdStringLength + 1, 1))) { _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -302,7 +302,7 @@ XF86DRIGetClientDriverName(Display * dpy, int screen, if (rep.length) { if (! (*clientDriverName = - (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) { + (char *) calloc(rep.clientDriverNameLength + 1, 1))) { _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -521,7 +521,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, if (*numClipRects) { int len = sizeof(drm_clip_rect_t) * (*numClipRects); - *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); + *pClipRects = (drm_clip_rect_t *) calloc(len, 1); if (*pClipRects) _XRead(dpy, (char *) *pClipRects, len); } @@ -532,7 +532,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, if (*numBackClipRects) { int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); - *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); + *pBackClipRects = (drm_clip_rect_t *) calloc(len, 1); if (*pBackClipRects) _XRead(dpy, (char *) *pBackClipRects, len); } @@ -582,7 +582,7 @@ XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer, *devPrivateSize = rep.devPrivateSize; if (rep.length) { - if (!(*pDevPrivate = (void *) Xcalloc(rep.devPrivateSize, 1))) { + if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) { _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); diff --git a/src/glx/apple/glxreply.c b/src/glx/apple/glxreply.c index f17ebe6b406..240caa738f9 100644 --- a/src/glx/apple/glxreply.c +++ b/src/glx/apple/glxreply.c @@ -79,7 +79,7 @@ __glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim, size = reply.length * 4; if (size != 0) { - void *buf = Xmalloc(size); + void *buf = malloc(size); if (buf == NULL) { _XEatData(dpy, size); @@ -94,7 +94,7 @@ __glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim, } __glEmptyImage(gc, 3, width, height, depth, format, type, buf, dest); - Xfree(buf); + free(buf); } } } diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c index 9be12b0f6b2..c3597cee765 100644 --- a/src/glx/applegl_glx.c +++ b/src/glx/applegl_glx.c @@ -134,12 +134,12 @@ applegl_create_context(struct glx_screen *psc, /* TODO: Integrate this with apple_glx_create_context and make * struct apple_glx_context inherit from struct glx_context. */ - gc = Xcalloc(1, sizeof (*gc)); + gc = calloc(1, sizeof(*gc)); if (gc == NULL) return NULL; if (!glx_context_init(gc, psc, config)) { - Xfree(gc); + free(gc); return NULL; } @@ -173,7 +173,7 @@ applegl_create_screen(int screen, struct glx_display * priv) { struct glx_screen *psc; - psc = Xmalloc(sizeof *psc); + psc = malloc(sizeof *psc); if (psc == NULL) return NULL; diff --git a/src/glx/clientattrib.c b/src/glx/clientattrib.c index 7792fa31f9d..4721fe938fd 100644 --- a/src/glx/clientattrib.c +++ b/src/glx/clientattrib.c @@ -75,7 +75,7 @@ __indirect_glPushClientAttrib(GLuint mask) if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) { if (!(sp = *spp)) { - sp = (__GLXattribute *) Xmalloc(sizeof(__GLXattribute)); + sp = (__GLXattribute *) malloc(sizeof(__GLXattribute)); *spp = sp; } sp->mask = mask; @@ -135,7 +135,7 @@ __glFreeAttributeState(struct glx_context * gc) spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; spp++) { sp = *spp; if (sp) { - XFree((char *) sp); + free((char *) sp); } else { break; diff --git a/src/glx/clientinfo.c b/src/glx/clientinfo.c index 429e9a3bfa7..e90fd796297 100644 --- a/src/glx/clientinfo.c +++ b/src/glx/clientinfo.c @@ -152,5 +152,5 @@ __glX_send_client_info(struct glx_display *glx_dpy) gl_extension_string); } - Xfree(gl_extension_string); + free(gl_extension_string); } diff --git a/src/glx/dri2.c b/src/glx/dri2.c index d6b99db768c..1214cb47a78 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -303,7 +303,7 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName) return False; } - *driverName = Xmalloc(rep.driverNameLength + 1); + *driverName = malloc(rep.driverNameLength + 1); if (*driverName == NULL) { _XEatData(dpy, ((rep.driverNameLength + 3) & ~3) + @@ -315,9 +315,9 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName) _XReadPad(dpy, *driverName, rep.driverNameLength); (*driverName)[rep.driverNameLength] = '\0'; - *deviceName = Xmalloc(rep.deviceNameLength + 1); + *deviceName = malloc(rep.deviceNameLength + 1); if (*deviceName == NULL) { - Xfree(*driverName); + free(*driverName); _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -431,7 +431,7 @@ DRI2GetBuffers(Display * dpy, XID drawable, *height = rep.height; *outCount = rep.count; - buffers = Xmalloc(rep.count * sizeof buffers[0]); + buffers = malloc(rep.count * sizeof buffers[0]); if (buffers == NULL) { _XEatData(dpy, rep.count * sizeof repBuffer); UnlockDisplay(dpy); @@ -490,7 +490,7 @@ DRI2GetBuffersWithFormat(Display * dpy, XID drawable, *height = rep.height; *outCount = rep.count; - buffers = Xmalloc(rep.count * sizeof buffers[0]); + buffers = malloc(rep.count * sizeof buffers[0]); if (buffers == NULL) { _XEatData(dpy, rep.count * sizeof repBuffer); UnlockDisplay(dpy); diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 4e8b3516df4..7978bfd4633 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -127,11 +127,11 @@ dri2_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); - Xfree(pcp); + free(pcp); } static Bool @@ -199,13 +199,13 @@ dri2_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; } @@ -214,7 +214,7 @@ dri2_create_context(struct glx_screen *base, config->driConfig, shared, pcp); if (pcp->driContext == NULL) { - Xfree(pcp); + free(pcp); return NULL; } @@ -262,7 +262,7 @@ dri2_create_context_attribs(struct glx_screen *base, shared = pcp_shared->driContext; } - pcp = Xmalloc(sizeof *pcp); + pcp = malloc(sizeof *pcp); if (pcp == NULL) { *error = __DRI_CTX_ERROR_NO_MEMORY; goto error_exit; @@ -314,7 +314,7 @@ dri2_create_context_attribs(struct glx_screen *base, error_exit: if (pcp != NULL) - Xfree(pcp); + free(pcp); return NULL; } @@ -340,7 +340,7 @@ dri2DestroyDrawable(__GLXDRIdrawable *base) if (pdraw->base.xDrawable != pdraw->base.drawable) DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable); - Xfree(pdraw); + free(pdraw); } static __GLXDRIdrawable * @@ -354,7 +354,7 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable, struct dri2_display *pdp; GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1; - pdraw = Xmalloc(sizeof(*pdraw)); + pdraw = malloc(sizeof(*pdraw)); if (!pdraw) return NULL; @@ -394,14 +394,14 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable, if (!pdraw->driDrawable) { DRI2DestroyDrawable(psc->base.dpy, xDrawable); - Xfree(pdraw); + free(pdraw); return NULL; } if (__glxHashInsert(pdp->dri2Hash, xDrawable, pdraw)) { (*psc->core->destroyDrawable) (pdraw->driDrawable); DRI2DestroyDrawable(psc->base.dpy, xDrawable); - Xfree(pdraw); + free(pdraw); return None; } @@ -633,7 +633,7 @@ dri2DestroyScreen(struct glx_screen *base) (*psc->core->destroyScreen) (psc->driScreen); driDestroyConfigs(psc->driver_configs); close(psc->fd); - Xfree(psc); + free(psc); } /** @@ -765,7 +765,7 @@ dri2GetBuffers(__DRIdrawable * driDrawable, pdraw->height = *height; process_buffers(pdraw, buffers, *out_count); - Xfree(buffers); + free(buffers); return pdraw->buffers; } @@ -790,7 +790,7 @@ dri2GetBuffersWithFormat(__DRIdrawable * driDrawable, pdraw->height = *height; process_buffers(pdraw, buffers, *out_count); - Xfree(buffers); + free(buffers); return pdraw->buffers; } @@ -1020,7 +1020,7 @@ dri2CreateScreen(int screen, struct glx_display * priv) drm_magic_t magic; int i; - psc = Xmalloc(sizeof *psc); + psc = malloc(sizeof *psc); if (psc == NULL) return NULL; @@ -1028,14 +1028,14 @@ dri2CreateScreen(int screen, struct glx_display * priv) psc->fd = -1; if (!glx_screen_init(&psc->base, screen, priv)) { - Xfree(psc); + free(psc); return NULL; } if (!DRI2Connect(priv->dpy, RootWindow(priv->dpy, screen), &driverName, &deviceName)) { glx_screen_cleanup(&psc->base); - XFree(psc); + free(psc); InfoMessageF("screen %d does not appear to be DRI2 capable\n", screen); return NULL; } @@ -1153,8 +1153,8 @@ dri2CreateScreen(int screen, struct glx_display * priv) psp->copySubBuffer = dri2CopySubBuffer; __glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer"); - Xfree(driverName); - Xfree(deviceName); + free(driverName); + free(deviceName); tmp = getenv("LIBGL_SHOW_FPS"); psc->show_fps = tmp && strcmp(tmp, "1") == 0; @@ -1176,10 +1176,10 @@ handle_error: if (psc->driver) dlclose(psc->driver); - Xfree(driverName); - Xfree(deviceName); + free(driverName); + free(deviceName); glx_screen_cleanup(&psc->base); - XFree(psc); + free(psc); return NULL; } @@ -1192,7 +1192,7 @@ dri2DestroyDisplay(__GLXDRIdisplay * dpy) struct dri2_display *pdp = (struct dri2_display *) dpy; __glxHashDestroy(pdp->dri2Hash); - Xfree(dpy); + free(dpy); } _X_HIDDEN __GLXDRIdrawable * @@ -1222,12 +1222,12 @@ dri2CreateDisplay(Display * dpy) if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) return NULL; - pdp = Xmalloc(sizeof *pdp); + pdp = malloc(sizeof *pdp); if (pdp == NULL) return NULL; if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) { - Xfree(pdp); + free(pdp); return NULL; } @@ -1253,7 +1253,7 @@ dri2CreateDisplay(Display * dpy) pdp->dri2Hash = __glxHashCreate(); if (pdp->dri2Hash == NULL) { - Xfree(pdp); + free(pdp); return NULL; } diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index d170aa6f7e2..1bf20ec949d 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -340,7 +340,7 @@ createDriMode(const __DRIcoreExtension * core, if (driConfigs[i] == NULL) return NULL; - driConfig = Xmalloc(sizeof *driConfig); + driConfig = malloc(sizeof *driConfig); if (driConfig == NULL) return NULL; 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; } diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 462be7d9f47..d98fdb903d0 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -118,7 +118,7 @@ static void XDestroyDrawable(struct drisw_drawable * pdp, Display * dpy, XID drawable) { XDestroyImage(pdp->ximage); - XFree(pdp->visinfo); + free(pdp->visinfo); XFreeGC(dpy, pdp->gc); XFreeGC(dpy, pdp->swapgc); @@ -256,11 +256,11 @@ drisw_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); - Xfree(pcp); + free(pcp); } static int @@ -393,13 +393,13 @@ drisw_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; } @@ -407,7 +407,7 @@ drisw_create_context(struct glx_screen *base, (*psc->core->createNewContext) (psc->driScreen, config->driConfig, shared, pcp); if (pcp->driContext == NULL) { - Xfree(pcp); + free(pcp); return NULL; } @@ -458,13 +458,13 @@ drisw_create_context_attribs(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; } @@ -492,7 +492,7 @@ drisw_create_context_attribs(struct glx_screen *base, error, pcp); if (pcp->driContext == NULL) { - Xfree(pcp); + free(pcp); return NULL; } @@ -510,7 +510,7 @@ driswDestroyDrawable(__GLXDRIdrawable * pdraw) (*psc->core->destroyDrawable) (pdp->driDrawable); XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable); - Xfree(pdp); + free(pdp); } static __GLXDRIdrawable * @@ -523,7 +523,7 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable, Bool ret; const __DRIswrastExtension *swrast = psc->swrast; - pdp = Xmalloc(sizeof(*pdp)); + pdp = malloc(sizeof(*pdp)); if (!pdp) return NULL; @@ -534,7 +534,7 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable, ret = XCreateDrawable(pdp, psc->base.dpy, xDrawable, modes->visualID); if (!ret) { - Xfree(pdp); + free(pdp); return NULL; } @@ -544,7 +544,7 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable, if (!pdp->driDrawable) { XDestroyDrawable(pdp, psc->base.dpy, xDrawable); - Xfree(pdp); + free(pdp); return NULL; } @@ -636,13 +636,13 @@ driswCreateScreen(int screen, struct glx_display *priv) struct glx_config *configs = NULL, *visuals = NULL; 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; } @@ -713,7 +713,7 @@ driswCreateScreen(int screen, struct glx_display *priv) if (psc->driver) dlclose(psc->driver); glx_screen_cleanup(&psc->base); - Xfree(psc); + free(psc); CriticalErrorMessageF("failed to load driver: %s\n", SWRAST_DRIVER_NAME); @@ -725,7 +725,7 @@ driswCreateScreen(int screen, struct glx_display *priv) static void driswDestroyDisplay(__GLXDRIdisplay * dpy) { - Xfree(dpy); + free(dpy); } /* @@ -738,7 +738,7 @@ driswCreateDisplay(Display * dpy) { struct drisw_display *pdpyp; - pdpyp = Xmalloc(sizeof *pdpyp); + pdpyp = malloc(sizeof *pdpyp); if (pdpyp == NULL) return NULL; diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 6738252a31d..b5806d62e5b 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -326,7 +326,7 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, length = reply.length; if (length) { num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2; - data = (CARD32 *) Xmalloc(length * sizeof(CARD32)); + data = (CARD32 *) malloc(length * sizeof(CARD32)); if (data == NULL) { /* Throw data on the floor */ _XEatData(dpy, length); @@ -357,7 +357,7 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, } #endif - Xfree(data); + free(data); } } @@ -412,7 +412,7 @@ CreateDrawable(Display *dpy, struct glx_config *config, if (!opcode) return None; - glxDraw = Xmalloc(sizeof(*glxDraw)); + glxDraw = malloc(sizeof(*glxDraw)); if (!glxDraw) return None; @@ -907,7 +907,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, return None; } - XFree(visinfo); + free(visinfo); return win; #else diff --git a/src/glx/glx_query.c b/src/glx/glx_query.c index efad13d376e..bbc2b79d83d 100644 --- a/src/glx/glx_query.c +++ b/src/glx/glx_query.c @@ -56,7 +56,7 @@ __glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name) /* The spec doesn't mention this, but the Xorg server replies with * a string already terminated with '\0'. */ uint32_t len = xcb_glx_query_server_string_string_length(reply); - char *buf = Xmalloc(len); + char *buf = malloc(len); memcpy(buf, xcb_glx_query_server_string_string(reply), len); free(reply); @@ -80,7 +80,7 @@ __glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name) /* The spec doesn't mention this, but the Xorg server replies with * a string already terminated with '\0'. */ uint32_t len = xcb_glx_get_string_string_length(reply); - char *buf = Xmalloc(len); + char *buf = malloc(len); memcpy(buf, xcb_glx_get_string_string(reply), len); free(reply); @@ -146,7 +146,7 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode, length = reply.length * 4; numbytes = reply.size; - buf = (char *) Xmalloc(numbytes); + buf = (char *) malloc(numbytes); if (buf != NULL) { _XRead(dpy, buf, numbytes); length -= numbytes; diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 37c09336749..0b90b4255f9 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -669,7 +669,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) return None; } - glxDraw = Xmalloc(sizeof(*glxDraw)); + glxDraw = malloc(sizeof(*glxDraw)); if (!glxDraw) return None; @@ -1267,7 +1267,7 @@ glXChooseVisual(Display * dpy, int screen, int *attribList) &visualTemplate, &i); if (newList) { - Xfree(visualList); + free(visualList); visualList = newList; best_config = config; } @@ -1392,7 +1392,7 @@ __glXClientInfo(Display * dpy, int opcode) SyncHandle(); #endif /* USE_XCB */ - Xfree(ext_str); + free(ext_str); } @@ -1628,7 +1628,7 @@ glXChooseFBConfig(Display * dpy, int screen, if ((config_list != NULL) && (list_size > 0) && (attribList != NULL)) { list_size = choose_visual(config_list, list_size, attribList, GL_TRUE); if (list_size == 0) { - XFree(config_list); + free(config_list); config_list = NULL; } } @@ -1682,7 +1682,7 @@ glXGetFBConfigs(Display * dpy, int screen, int *nelements) } } - config_list = Xmalloc(num_configs * sizeof *config_list); + config_list = malloc(num_configs * sizeof *config_list); if (config_list != NULL) { *nelements = num_configs; i = 0; @@ -2454,7 +2454,7 @@ _X_HIDDEN char * __glXstrdup(const char *str) { char *copy; - copy = (char *) Xmalloc(strlen(str) + 1); + copy = (char *) malloc(strlen(str) + 1); if (!copy) return NULL; strcpy(copy, str); diff --git a/src/glx/glxext.c b/src/glx/glxext.c index a4e76c1c398..3827b583b7a 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -208,13 +208,13 @@ FreeScreenConfigs(struct glx_display * priv) if (psc->driScreen) { psc->driScreen->destroyScreen(psc); } else { - Xfree(psc); + free(psc); } #else - Xfree(psc); + free(psc); #endif } - XFree((char *) priv->screens); + free((char *) priv->screens); priv->screens = NULL; } @@ -231,9 +231,9 @@ glx_display_free(struct glx_display *priv) FreeScreenConfigs(priv); if (priv->serverGLXvendor) - Xfree((char *) priv->serverGLXvendor); + free((char *) priv->serverGLXvendor); if (priv->serverGLXversion) - Xfree((char *) priv->serverGLXversion); + free((char *) priv->serverGLXversion); __glxHashDestroy(priv->glXDrawHash); @@ -254,7 +254,7 @@ glx_display_free(struct glx_display *priv) priv->dri2Display = NULL; #endif - Xfree((char *) priv); + free((char *) priv); } static int @@ -614,7 +614,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; @@ -638,7 +638,7 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, } if (props != buf) - Xfree(props); + free(props); return modes; } @@ -741,14 +741,14 @@ glx_screen_cleanup(struct glx_screen *psc) if (psc->configs) { glx_config_destroy_list(psc->configs); if (psc->effectiveGLXexts) - Xfree(psc->effectiveGLXexts); + free(psc->effectiveGLXexts); psc->configs = NULL; /* NOTE: just for paranoia */ } if (psc->visuals) { glx_config_destroy_list(psc->visuals); psc->visuals = NULL; /* NOTE: just for paranoia */ } - Xfree((char *) psc->serverGLXexts); + free((char *) psc->serverGLXexts); } /* @@ -765,7 +765,7 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv) ** First allocate memory for the array of per screen configs. */ screens = ScreenCount(dpy); - priv->screens = Xmalloc(screens * sizeof *priv->screens); + priv->screens = malloc(screens * sizeof *priv->screens); if (!priv->screens) return GL_FALSE; @@ -823,13 +823,13 @@ __glXInitialize(Display * dpy) /* Drop the lock while we create the display private. */ _XUnlockMutex(_Xglobal_lock); - dpyPriv = Xcalloc(1, sizeof *dpyPriv); + dpyPriv = calloc(1, sizeof *dpyPriv); if (!dpyPriv) return NULL; dpyPriv->codes = XInitExtension(dpy, __glXExtensionName); if (!dpyPriv->codes) { - Xfree(dpyPriv); + free(dpyPriv); _XUnlockMutex(_Xglobal_lock); return NULL; } @@ -845,7 +845,7 @@ __glXInitialize(Display * dpy) if (!QueryVersion(dpy, dpyPriv->majorOpcode, &dpyPriv->majorVersion, &dpyPriv->minorVersion) || (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion < 1)) { - Xfree(dpyPriv); + free(dpyPriv); _XUnlockMutex(_Xglobal_lock); return NULL; } @@ -881,12 +881,12 @@ __glXInitialize(Display * dpy) #ifdef GLX_USE_APPLEGL if (!applegl_create_display(dpyPriv)) { - Xfree(dpyPriv); + free(dpyPriv); return NULL; } #endif if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) { - Xfree(dpyPriv); + free(dpyPriv); return NULL; } diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c index eb0890e23f1..9332e61b427 100644 --- a/src/glx/glxextensions.c +++ b/src/glx/glxextensions.c @@ -509,7 +509,7 @@ __glXGetStringFromTable(const struct extension_info *ext, } } - ext_str = Xmalloc(ext_str_len + 1); + ext_str = malloc(ext_str_len + 1); if (ext_str != NULL) { point = ext_str; diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index 2399375a9bc..4f23fed3b08 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -46,17 +46,17 @@ indirect_destroy_context(struct glx_context *gc) __glXFreeVertexArrayState(gc); if (gc->vendor) - XFree((char *) gc->vendor); + free((char *) gc->vendor); if (gc->renderer) - XFree((char *) gc->renderer); + free((char *) gc->renderer); if (gc->version) - XFree((char *) gc->version); + free((char *) gc->version); if (gc->extensions) - XFree((char *) gc->extensions); + free((char *) gc->extensions); __glFreeAttributeState(gc); - XFree((char *) gc->buf); - Xfree((char *) gc->client_state_private); - XFree((char *) gc); + free((char *) gc->buf); + free((char *) gc->client_state_private); + free((char *) gc); } static Bool @@ -356,7 +356,7 @@ indirect_create_context(struct glx_screen *psc, } /* Allocate our context record */ - gc = Xmalloc(sizeof *gc); + gc = malloc(sizeof *gc); if (!gc) { /* Out of memory */ return NULL; @@ -366,10 +366,10 @@ indirect_create_context(struct glx_screen *psc, glx_context_init(gc, psc, mode); gc->isDirect = GL_FALSE; gc->vtable = &indirect_context_vtable; - state = Xmalloc(sizeof(struct __GLXattributeRec)); + state = malloc(sizeof(struct __GLXattributeRec)); if (state == NULL) { /* Out of memory */ - Xfree(gc); + free(gc); return NULL; } gc->client_state_private = state; @@ -384,10 +384,10 @@ indirect_create_context(struct glx_screen *psc, */ bufSize = (XMaxRequestSize(psc->dpy) * 4) - sz_xGLXRenderReq; - gc->buf = (GLubyte *) Xmalloc(bufSize); + gc->buf = (GLubyte *) malloc(bufSize); if (!gc->buf) { - Xfree(gc->client_state_private); - Xfree(gc); + free(gc->client_state_private); + free(gc); return NULL; } gc->bufSize = bufSize; @@ -468,7 +468,7 @@ indirect_create_screen(int screen, struct glx_display * priv) { struct glx_screen *psc; - psc = Xmalloc(sizeof *psc); + psc = malloc(sizeof *psc); if (psc == NULL) return NULL; diff --git a/src/glx/render2.c b/src/glx/render2.c index 762950f4ac4..870f0611186 100644 --- a/src/glx/render2.c +++ b/src/glx/render2.c @@ -89,14 +89,14 @@ __indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, if (stride != k) { GLubyte *buf; - buf = (GLubyte *) Xmalloc(compsize); + buf = (GLubyte *) malloc(compsize); if (!buf) { __glXSetError(gc, GL_OUT_OF_MEMORY); return; } __glFillMap1d(k, order, stride, pnts, buf); __glXSendLargeCommand(gc, pc, 32, buf, compsize); - Xfree((char *) buf); + free((char *) buf); } else { /* Data is already packed. Just send it out */ @@ -152,14 +152,14 @@ __indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, if (stride != k) { GLubyte *buf; - buf = (GLubyte *) Xmalloc(compsize); + buf = (GLubyte *) malloc(compsize); if (!buf) { __glXSetError(gc, GL_OUT_OF_MEMORY); return; } __glFillMap1f(k, order, stride, pnts, buf); __glXSendLargeCommand(gc, pc, 24, buf, compsize); - Xfree((char *) buf); + free((char *) buf); } else { /* Data is already packed. Just send it out */ @@ -227,7 +227,7 @@ __indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustr, if ((vstr != k) || (ustr != k * vord)) { GLdouble *buf; - buf = (GLdouble *) Xmalloc(compsize); + buf = (GLdouble *) malloc(compsize); if (!buf) { __glXSetError(gc, GL_OUT_OF_MEMORY); return; @@ -237,7 +237,7 @@ __indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustr, */ __glFillMap2d(k, uord, vord, ustr, vstr, pnts, buf); __glXSendLargeCommand(gc, pc, 52, buf, compsize); - Xfree((char *) buf); + free((char *) buf); } else { /* Data is already packed. Just send it out */ @@ -303,7 +303,7 @@ __indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustr, if ((vstr != k) || (ustr != k * vord)) { GLfloat *buf; - buf = (GLfloat *) Xmalloc(compsize); + buf = (GLfloat *) malloc(compsize); if (!buf) { __glXSetError(gc, GL_OUT_OF_MEMORY); return; @@ -313,7 +313,7 @@ __indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustr, */ __glFillMap2f(k, uord, vord, ustr, vstr, pnts, buf); __glXSendLargeCommand(gc, pc, 36, buf, compsize); - Xfree((char *) buf); + free((char *) buf); } else { /* Data is already packed. Just send it out */ diff --git a/src/glx/renderpix.c b/src/glx/renderpix.c index b54f1155959..508a1e10459 100644 --- a/src/glx/renderpix.c +++ b/src/glx/renderpix.c @@ -84,7 +84,7 @@ __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, GLubyte * pc, GLubyte * modes) { /* Allocate a temporary holding buffer */ - GLubyte *buf = (GLubyte *) Xmalloc(compsize); + GLubyte *buf = (GLubyte *) malloc(compsize); if (!buf) { __glXSetError(gc, GL_OUT_OF_MEMORY); return; @@ -108,7 +108,7 @@ __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); /* Free buffer */ - Xfree((char *) buf); + free((char *) buf); } /************************************************************************/ @@ -178,7 +178,7 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, pc += hdrlen; /* Allocate a temporary holding buffer */ - buf = (GLubyte *) Xmalloc(bufsize); + buf = (GLubyte *) malloc(bufsize); if (!buf) { __glXSetError(gc, GL_OUT_OF_MEMORY); return; @@ -193,6 +193,6 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf, bufsize); /* Free buffer */ - Xfree((char *) buf); + free((char *) buf); } } diff --git a/src/glx/single2.c b/src/glx/single2.c index d422d9dcf1a..993ad3647f9 100644 --- a/src/glx/single2.c +++ b/src/glx/single2.c @@ -721,7 +721,7 @@ __indirect_glGetString(GLenum name) */ const size_t size = 7 + strlen((char *) s) + 4; - gc->version = Xmalloc(size); + gc->version = malloc(size); if (gc->version == NULL) { /* If we couldn't allocate memory for the new string, * make a best-effort and just copy the client-side version @@ -737,7 +737,7 @@ __indirect_glGetString(GLenum name) else { snprintf((char *) gc->version, size, "%u.%u (%s)", client_major, client_minor, s); - Xfree(s); + free(s); s = gc->version; } } @@ -782,7 +782,7 @@ __indirect_glGetString(GLenum name) #endif __glXCalculateUsableGLExtensions(gc, (char *) s, major, minor); - XFree(s); + free(s); s = gc->extensions; break; } diff --git a/src/glx/singlepix.c b/src/glx/singlepix.c index 3c06f8d2150..6348f828580 100644 --- a/src/glx/singlepix.c +++ b/src/glx/singlepix.c @@ -68,7 +68,7 @@ __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, heightsize = __glImageSize(height, 1, 1, format, type, 0); /* Allocate a holding buffer to transform the data from */ - rowBuf = (GLubyte *) Xmalloc(widthsize); + rowBuf = (GLubyte *) malloc(widthsize); if (!rowBuf) { /* Throw data away */ _XEatData(dpy, compsize); @@ -80,9 +80,9 @@ __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, else { __GLX_SINGLE_GET_CHAR_ARRAY(((char *) rowBuf), widthsize); __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row); - Xfree((char *) rowBuf); + free((char *) rowBuf); } - colBuf = (GLubyte *) Xmalloc(heightsize); + colBuf = (GLubyte *) malloc(heightsize); if (!colBuf) { /* Throw data away */ _XEatData(dpy, compsize - __GLX_PAD(widthsize)); @@ -94,7 +94,7 @@ __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, else { __GLX_SINGLE_GET_CHAR_ARRAY(((char *) colBuf), heightsize); __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column); - Xfree((char *) colBuf); + free((char *) colBuf); } } else { @@ -155,8 +155,7 @@ void gl_dispatch_stub_GetSeparableFilterEXT (GLenum target, GLenum format, const GLint heightsize = __glImageSize(height, 1, 1, format, type, 0); GLubyte *const buf = - (GLubyte *) Xmalloc((widthsize > heightsize) ? widthsize : - heightsize); + (GLubyte *) malloc((widthsize > heightsize) ? widthsize : heightsize); if (buf == NULL) { /* Throw data away */ @@ -186,7 +185,7 @@ void gl_dispatch_stub_GetSeparableFilterEXT (GLenum target, GLenum format, __glEmptyImage(gc, 1, height, 1, 1, format, type, buf, column); - Xfree((char *) buf); + free((char *) buf); } } } diff --git a/src/glx/xfont.c b/src/glx/xfont.c index 4ca2c8f868f..065938f0504 100644 --- a/src/glx/xfont.c +++ b/src/glx/xfont.c @@ -245,7 +245,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis max_bm_width = (max_width + 7) / 8; max_bm_height = max_height; - bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof(GLubyte)); + bm = (GLubyte *) malloc((max_bm_width * max_bm_height) * sizeof(GLubyte)); if (!bm) { XFreeFontInfo(NULL, fs, 1); __glXSetError(CC, GL_OUT_OF_MEMORY); @@ -359,7 +359,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis glEndList(); } - Xfree(bm); + free(bm); XFreeFontInfo(NULL, fs, 1); XFreeGC(dpy, gc); |