X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fmeta_data.c;fp=src%2Fdaemon%2Fmeta_data.c;h=9e4fd07ecfdf99716a11e64532a8ccb6d5654041;hb=2761915bed8c6caea41018be3e675aa712cc0b0a;hp=73c6046d82d036f60dcc263a68e0b23517ba95b2;hpb=cd2238b8b4f4ecd80c45862b5aeed3d3d73eddfe;p=collectd.git diff --git a/src/daemon/meta_data.c b/src/daemon/meta_data.c index 73c6046d..9e4fd07e 100644 --- a/src/daemon/meta_data.c +++ b/src/daemon/meta_data.c @@ -333,8 +333,6 @@ meta_data_t *meta_data_clone (meta_data_t *orig) /* {{{ */ int meta_data_clone_merge (meta_data_t **dest, meta_data_t *orig) /* {{{ */ { - meta_entry_t *e; - if (orig == NULL) return (0); @@ -344,7 +342,7 @@ int meta_data_clone_merge (meta_data_t **dest, meta_data_t *orig) /* {{{ */ } pthread_mutex_lock (&orig->lock); - for (e=orig->head; e != NULL; e = e->next) + for (meta_entry_t *e=orig->head; e != NULL; e = e->next) { md_entry_insert_clone((*dest), e); } @@ -365,14 +363,12 @@ void meta_data_destroy (meta_data_t *md) /* {{{ */ int meta_data_exists (meta_data_t *md, const char *key) /* {{{ */ { - meta_entry_t *e; - if ((md == NULL) || (key == NULL)) return (-EINVAL); pthread_mutex_lock (&md->lock); - for (e = md->head; e != NULL; e = e->next) + for (meta_entry_t *e = md->head; e != NULL; e = e->next) { if (strcasecmp (key, e->key) == 0) { @@ -387,14 +383,12 @@ int meta_data_exists (meta_data_t *md, const char *key) /* {{{ */ int meta_data_type (meta_data_t *md, const char *key) /* {{{ */ { - meta_entry_t *e; - if ((md == NULL) || (key == NULL)) return -EINVAL; pthread_mutex_lock (&md->lock); - for (e = md->head; e != NULL; e = e->next) + for (meta_entry_t *e = md->head; e != NULL; e = e->next) { if (strcasecmp (key, e->key) == 0) { @@ -410,14 +404,13 @@ int meta_data_type (meta_data_t *md, const char *key) /* {{{ */ int meta_data_toc (meta_data_t *md, char ***toc) /* {{{ */ { int i = 0, count = 0; - meta_entry_t *e; if ((md == NULL) || (toc == NULL)) return -EINVAL; pthread_mutex_lock (&md->lock); - for (e = md->head; e != NULL; e = e->next) + for (meta_entry_t *e = md->head; e != NULL; e = e->next) ++count; if (count == 0) @@ -427,7 +420,7 @@ int meta_data_toc (meta_data_t *md, char ***toc) /* {{{ */ } *toc = calloc(count, sizeof(**toc)); - for (e = md->head; e != NULL; e = e->next) + for (meta_entry_t *e = md->head; e != NULL; e = e->next) (*toc)[i++] = strdup(e->key); pthread_mutex_unlock (&md->lock);