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:
@@ -81,7 +81,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||
MALFORMED_MESSAGE();
|
||||
}
|
||||
|
||||
options = xcalloc(sizeof(*options), 1);
|
||||
options = calloc(sizeof(*options), 1);
|
||||
if (!options) {
|
||||
ErrorF("[config/dbus] couldn't allocate option\n");
|
||||
return BadAlloc;
|
||||
@@ -97,7 +97,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||
|
||||
/* signature should be [ss][ss]... */
|
||||
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
||||
tmpo = xcalloc(sizeof(*tmpo), 1);
|
||||
tmpo = calloc(sizeof(*tmpo), 1);
|
||||
if (!tmpo) {
|
||||
ErrorF("[config/dbus] couldn't allocate option\n");
|
||||
ret = BadAlloc;
|
||||
@@ -185,10 +185,10 @@ unwind:
|
||||
tmpo = options;
|
||||
options = options->next;
|
||||
if (tmpo->key)
|
||||
xfree(tmpo->key);
|
||||
free(tmpo->key);
|
||||
if (tmpo->value)
|
||||
xfree(tmpo->value);
|
||||
xfree(tmpo);
|
||||
free(tmpo->value);
|
||||
free(tmpo);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user