Replace X-allocation functions with their C89 counterparts

The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Mikhail Gusarov
2010-05-06 01:44:06 +07:00
parent 96c7ab27c3
commit 3f3ff971ec
345 changed files with 3011 additions and 3011 deletions

View File

@@ -252,7 +252,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
close (fd);
return BadMatch;
}
ke = xcalloc (1, sizeof (Kevdev));
ke = calloc(1, sizeof (Kevdev));
if (!ke)
{
close (fd);
@@ -264,7 +264,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
ke->keybits) < 0)
{
perror ("EVIOCGBIT EV_KEY");
xfree (ke);
free(ke);
close (fd);
return BadMatch;
}
@@ -275,7 +275,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
ke->relbits) < 0)
{
perror ("EVIOCGBIT EV_REL");
xfree (ke);
free(ke);
close (fd);
return BadMatch;
}
@@ -291,7 +291,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
ke->absbits) < 0)
{
perror ("EVIOCGBIT EV_ABS");
xfree (ke);
free(ke);
close (fd);
return BadMatch;
}
@@ -310,13 +310,13 @@ EvdevPtrEnable (KdPointerInfo *pi)
}
if (i <= ke->max_abs)
{
xfree (ke);
free(ke);
close (fd);
return BadValue;
}
}
if (!KdRegisterFd (fd, EvdevPtrRead, pi)) {
xfree (ke);
free(ke);
close (fd);
return BadAlloc;
}
@@ -341,7 +341,7 @@ EvdevPtrDisable (KdPointerInfo *pi)
if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
perror ("Ungrabbing evdev mouse device failed");
xfree (ke);
free(ke);
pi->driverPrivate = 0;
}
@@ -440,14 +440,14 @@ EvdevKbdEnable (KdKeyboardInfo *ki)
return BadMatch;
}
ke = xcalloc (1, sizeof (Kevdev));
ke = calloc(1, sizeof (Kevdev));
if (!ke) {
close (fd);
return BadAlloc;
}
if (!KdRegisterFd (fd, EvdevKbdRead, ki)) {
xfree (ke);
free(ke);
close (fd);
return BadAlloc;
}
@@ -509,7 +509,7 @@ EvdevKbdDisable (KdKeyboardInfo *ki)
if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
perror ("Ungrabbing evdev keyboard device failed");
xfree (ke);
free(ke);
ki->driverPrivate = 0;
}

View File

@@ -737,9 +737,9 @@ LinuxKeyboardInit (KdKeyboardInfo *ki)
if (!ki)
return !Success;
xfree(ki->path);
free(ki->path);
ki->path = strdup("console");
xfree(ki->name);
free(ki->name);
ki->name = strdup("Linux console keyboard");
readKernelMapping (ki);

View File

@@ -958,7 +958,7 @@ MouseInit (KdPointerInfo *pi)
close(fd);
km = (Kmouse *) xalloc (sizeof (Kmouse));
km = (Kmouse *) malloc(sizeof (Kmouse));
if (km) {
km->iob.avail = km->iob.used = 0;
MouseFirstProtocol(km, pi->protocol ? pi->protocol : "exps/2");
@@ -1016,7 +1016,7 @@ MouseDisable (KdPointerInfo *pi)
static void
MouseFini (KdPointerInfo *pi)
{
xfree (pi->driverPrivate);
free(pi->driverPrivate);
pi->driverPrivate = NULL;
}

View File

@@ -157,7 +157,7 @@ TslibInit (KdPointerInfo *pi)
return !Success;
pi->driverPrivate = (struct TslibPrivate *)
xcalloc(sizeof(struct TslibPrivate), 1);
calloc(sizeof(struct TslibPrivate), 1);
if (!pi->driverPrivate)
return !Success;
@@ -175,7 +175,7 @@ TslibInit (KdPointerInfo *pi)
static void
TslibFini (KdPointerInfo *pi)
{
xfree(pi->driverPrivate);
free(pi->driverPrivate);
pi->driverPrivate = NULL;
}