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:
Matt Turner
2012-09-04 22:52:36 -07:00
parent 17a574d7cd
commit 7c7b7b068b
31 changed files with 191 additions and 192 deletions

View File

@@ -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);