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>
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user