diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /config/hal.c | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
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>
Diffstat (limited to 'config/hal.c')
-rw-r--r-- | config/hal.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/config/hal.c b/config/hal.c index d3daa84cd..6a2232364 100644 --- a/config/hal.c +++ b/config/hal.c @@ -63,14 +63,14 @@ device_removed(LibHalContext *ctx, const char *udi) { char *value; - value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */ + value = malloc(strlen(udi) + 5); /* "hal:" + NULL */ if (!value) return; sprintf(value, "hal:%s", udi); remove_devices("hal", value); - xfree(value); + free(value); } static char * @@ -102,7 +102,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) for (i = 0; props[i]; i++) len += strlen(props[i]); - ret = xcalloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */ + ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */ if (!ret) { libhal_free_string_array(props); return NULL; @@ -179,7 +179,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL)) attrs.flags |= ATTR_TOUCHSCREEN; - options = xcalloc(sizeof(*options), 1); + options = calloc(sizeof(*options), 1); if (!options){ LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n"); goto unwind; @@ -200,7 +200,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) add_option(&options, "driver", driver); add_option(&options, "name", name); - config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */ + config_info = malloc(strlen(udi) + 5); /* "hal:" and NULL */ if (!config_info) { LogMessage(X_ERROR, "config/hal: couldn't allocate name\n"); goto unwind; @@ -252,34 +252,34 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (!strcasecmp(&tmp[3], "layout")) { if (xkb_opts.layout) - xfree(xkb_opts.layout); + free(xkb_opts.layout); xkb_opts.layout = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "model")) { if (xkb_opts.model) - xfree(xkb_opts.model); + free(xkb_opts.model); xkb_opts.model = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "rules")) { if (xkb_opts.rules) - xfree(xkb_opts.rules); + free(xkb_opts.rules); xkb_opts.rules = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "variant")) { if (xkb_opts.variant) - xfree(xkb_opts.variant); + free(xkb_opts.variant); xkb_opts.variant = strdup(tmp_val); } else if (!strcasecmp(&tmp[3], "options")) { if (xkb_opts.options) - xfree(xkb_opts.options); + free(xkb_opts.options); xkb_opts.options = strdup(tmp_val); } } else { /* all others */ add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val); - xfree(tmp_val); + free(tmp_val); } } else { @@ -290,7 +290,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key))) { if (xkb_opts.options) - xfree(xkb_opts.options); + free(xkb_opts.options); xkb_opts.options = strdup(tmp_val); } } @@ -325,7 +325,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (!xkb_opts.options) xkb_opts.options = strdup(tmp_val); } - xfree(tmp_val); + free(tmp_val); } else { /* server 1.4 had xkb options as strlist */ @@ -367,7 +367,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) for (; dev; dev = dev->next){ if (dev->config_info) - xfree(dev->config_info); + free(dev->config_info); dev->config_info = xstrdup(config_info); } @@ -375,42 +375,42 @@ unwind: if (set) libhal_free_property_set(set); if (path) - xfree(path); + free(path); if (driver) - xfree(driver); + free(driver); if (name) - xfree(name); + free(name); if (config_info) - xfree(config_info); + free(config_info); while (!dev && (tmpo = options)) { options = tmpo->next; - xfree(tmpo->key); - xfree(tmpo->value); - xfree(tmpo); + free(tmpo->key); + free(tmpo->value); + free(tmpo); } - xfree(attrs.product); - xfree(attrs.vendor); - xfree(attrs.device); + free(attrs.product); + free(attrs.vendor); + free(attrs.device); if (attrs.tags) { char **tag = attrs.tags; while (*tag) { - xfree(*tag); + free(*tag); tag++; } - xfree(attrs.tags); + free(attrs.tags); } if (xkb_opts.layout) - xfree(xkb_opts.layout); + free(xkb_opts.layout); if (xkb_opts.rules) - xfree(xkb_opts.rules); + free(xkb_opts.rules); if (xkb_opts.model) - xfree(xkb_opts.model); + free(xkb_opts.model); if (xkb_opts.variant) - xfree(xkb_opts.variant); + free(xkb_opts.variant); if (xkb_opts.options) - xfree(xkb_opts.options); + free(xkb_opts.options); dbus_error_free(&error); |