From: Florian Forster Date: Mon, 22 Mar 2010 19:00:17 +0000 (+0100) Subject: amqp plugin: Use the global (and widely used) "sfree" macro … X-Git-Tag: collectd-5.0.0-beta0~28^2~33 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0ee0ac98af046bdf2a4000b43e5dedc4a61e9d73;p=collectd.git amqp plugin: Use the global (and widely used) "sfree" macro … … rather than the private "config_free" function. --- diff --git a/src/amqp.c b/src/amqp.c index 95cded7a..1767b85f 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -62,15 +62,9 @@ static const char *config_keys[] = static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static void config_free(char *var) -{ - if (var != NULL) - free(var); -} - static int config_set(char **var, const char *value) { - config_free(*var); + sfree(*var); if ((*var = strdup(value)) == NULL) return (1); return (0); @@ -177,12 +171,12 @@ static int amqp_write(const data_set_t *ds, const value_list_t *vl, user_data_t static int shutdown(void) { - config_free(host); - config_free(vhost); - config_free(user); - config_free(password); - config_free(exchange); - config_free(routingkey); + sfree(host); + sfree(vhost); + sfree(user); + sfree(password); + sfree(exchange); + sfree(routingkey); return (0); }