summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7046755)
raw | patch | inline | side by side (parent: 7046755)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 27 Jun 2009 10:53:34 +0000 (12:53 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 27 Jun 2009 10:53:34 +0000 (12:53 +0200) |
src/plugin.c | patch | blob | history | |
src/plugin.h | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 6139baf0de05a2145ac5020d73d2bf64ef2814ae..a5ae97b6fd825f857580e548ddaac79117f6474a 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
data_set_t *ds;
+ int free_meta_data = 0;
+
if ((vl == NULL) || (vl->type[0] == 0)
|| (vl->values == NULL) || (vl->values_len < 1))
{
return (-1);
}
+ /* Free meta data only if the calling function didn't specify any. In
+ * this case matches and targets may add some and the calling function
+ * may not expect (and therefore free) that data. */
+ if (vl->meta == NULL)
+ free_meta_data = 1;
+
if (list_write == NULL)
c_complain_once (LOG_WARNING, &no_write_complaint,
"plugin_dispatch_values: No write callback has been "
vl->values_len = saved_values_len;
}
+ if ((free_meta_data != 0) && (vl->meta != NULL))
+ {
+ meta_data_destroy (vl->meta);
+ vl->meta = NULL;
+ }
+
return (0);
} /* int plugin_dispatch_values */
diff --git a/src/plugin.h b/src/plugin.h
index e54b27d69e554628060e08f686e18aa76a45fe70..e8e49567147e70becc9209692cfd93e8d54f47ba 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
#include "collectd.h"
#include "configfile.h"
+#include "meta_data.h"
#define DATA_MAX_NAME_LEN 64
char plugin_instance[DATA_MAX_NAME_LEN];
char type[DATA_MAX_NAME_LEN];
char type_instance[DATA_MAX_NAME_LEN];
+ meta_data_t *meta;
};
typedef struct value_list_s value_list_t;
-#define VALUE_LIST_INIT { NULL, 0, 0, interval_g, "localhost", "", "", "", "" }
-#define VALUE_LIST_STATIC { NULL, 0, 0, 0, "localhost", "", "", "", "" }
+#define VALUE_LIST_INIT { NULL, 0, 0, interval_g, "localhost", "", "", "", "", NULL }
+#define VALUE_LIST_STATIC { NULL, 0, 0, 0, "localhost", "", "", "", "", NULL }
struct data_source_s
{