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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user