summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9c52b4f)
raw | patch | inline | side by side (parent: 9c52b4f)
author | Sven Trenkel <collectd@semidefinite.de> | |
Wed, 9 Dec 2009 12:53:14 +0000 (13:53 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 10 Dec 2009 09:17:18 +0000 (10:17 +0100) |
src/meta_data.c | patch | blob | history | |
src/meta_data.h | patch | blob | history |
diff --git a/src/meta_data.c b/src/meta_data.c
index a7c11c10607352d9cbf0a938a185a54895bfd970..80b6dd1edee89e5eaca7f759f3d8c27228a4d9d7 100644 (file)
--- a/src/meta_data.c
+++ b/src/meta_data.c
return 0;
} /* }}} int meta_data_type */
+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 -1;
+
+ pthread_mutex_lock (&md->lock);
+
+ for (e = md->head; e != NULL; e = e->next)
+ ++count;
+
+ *toc = malloc(count * sizeof(**toc));
+ for (e = md->head; e != NULL; e = e->next)
+ (*toc)[i++] = strdup(e->key);
+
+ pthread_mutex_unlock (&md->lock);
+ return count;
+} /* }}} int meta_data_toc */
+
int meta_data_delete (meta_data_t *md, const char *key) /* {{{ */
{
meta_entry_t *this;
diff --git a/src/meta_data.h b/src/meta_data.h
index 7a9afee589db5945a9800662fb0d85ba004fa304..9ef7b0a8ddb58cbf654cca2a3ddc1e722b2d7b2e 100644 (file)
--- a/src/meta_data.h
+++ b/src/meta_data.h
int meta_data_exists (meta_data_t *md, const char *key);
int meta_data_type (meta_data_t *md, const char *key);
+int meta_data_toc (meta_data_t *md, char ***toc);
int meta_data_delete (meta_data_t *md, const char *key);
int meta_data_add_string (meta_data_t *md,