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

@@ -420,7 +420,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
"(unnamed)");
return !Success;
}
xfree(pi->driverPrivate);
free(pi->driverPrivate);
pi->driverPrivate = NULL;
}
@@ -433,12 +433,12 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return !Success;
}
btn_labels = xcalloc(pi->nButtons, sizeof(Atom));
btn_labels = calloc(pi->nButtons, sizeof(Atom));
if (!btn_labels)
return BadAlloc;
axes_labels = xcalloc(pi->nAxes, sizeof(Atom));
axes_labels = calloc(pi->nAxes, sizeof(Atom));
if (!axes_labels) {
xfree(btn_labels);
free(btn_labels);
return BadAlloc;
}
@@ -472,8 +472,8 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), pi->nAxes, axes_labels);
xfree(btn_labels);
xfree(axes_labels);
free(btn_labels);
free(axes_labels);
if (pi->inputClass == KD_TOUCHSCREEN) {
InitAbsoluteClassDeviceStruct(pDevice);
@@ -736,7 +736,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
"(unnamed)");
return !Success;
}
xfree(ki->driverPrivate);
free(ki->driverPrivate);
ki->driverPrivate = NULL;
}
@@ -887,7 +887,7 @@ KdRemoveKeyboardDriver (KdKeyboardDriver *driver)
KdKeyboardInfo *
KdNewKeyboard (void)
{
KdKeyboardInfo *ki = xcalloc(sizeof(KdKeyboardInfo), 1);
KdKeyboardInfo *ki = calloc(sizeof(KdKeyboardInfo), 1);
if (!ki)
return NULL;
@@ -915,7 +915,7 @@ KdAddConfigKeyboard (char *keyboard)
if (!keyboard)
return Success;
new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
new = (struct KdConfigDevice *) calloc(sizeof(struct KdConfigDevice), 1);
if (!new)
return BadAlloc;
@@ -983,7 +983,7 @@ KdAddConfigPointer (char *pointer)
if (!pointer)
return Success;
new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
new = (struct KdConfigDevice *) calloc(sizeof(struct KdConfigDevice), 1);
if (!new)
return BadAlloc;
@@ -1053,7 +1053,7 @@ KdGetOptions (InputOption **options, char *string)
InputOption *newopt = NULL, **tmpo = NULL;
int tam_key = 0;
newopt = xcalloc(1, sizeof (InputOption));
newopt = calloc(1, sizeof (InputOption));
if (!newopt)
return FALSE;
@@ -1064,7 +1064,7 @@ KdGetOptions (InputOption **options, char *string)
if (strchr(string, '='))
{
tam_key = (strchr(string, '=') - string);
newopt->key = (char *)xalloc(tam_key);
newopt->key = (char *)malloc(tam_key);
strncpy(newopt->key, string, tam_key);
newopt->key[tam_key] = '\0';
newopt->value = xstrdup(strchr(string, '=') + 1);