summaryrefslogtreecommitdiffstats
path: root/src/plugins/influxdb.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-11 18:31:54 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-10 23:41:14 +0200
commit81829ebead7677ed0d216ecdbbe16b6c5ca84432 (patch)
tree1d11826d861ff6611aa029f57a7c4ecc2765b064 /src/plugins/influxdb.c
parentea8407bf6ccd9398ab18becf44f16039206dc4dd (diff)
Fix: filling the series lists.
Change-Id: I9d114d61e785449d438e1455ac3e64c69aba30fe Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/plugins/influxdb.c')
-rw-r--r--src/plugins/influxdb.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/influxdb.c b/src/plugins/influxdb.c
index b08eb9e..27161ab 100644
--- a/src/plugins/influxdb.c
+++ b/src/plugins/influxdb.c
@@ -80,7 +80,7 @@ int create_database()
void unpack_values(void *l, json_object *valuesJ, const char *key)
{
- struct list *oneList = (struct list *)l;
+ struct list **oneList = (struct list **)l;
/* Append a suffix to be able to differentiate tags and fields at reading
time */
@@ -88,19 +88,20 @@ void unpack_values(void *l, json_object *valuesJ, const char *key)
strcpy(suffixed_key, key);
strcat(suffixed_key, "_f");
- add_elt(&oneList, suffixed_key, valuesJ);
+ add_elt(oneList, suffixed_key, valuesJ);
}
void unpack_metadata(void *l, json_object *valuesJ, const char *key)
{
- struct list *oneList = (struct list *)l;
+ struct list **oneList = (struct list **)l;
/* Append a suffix to be able to differentiate tags and fields at reading
time */
char *suffixed_key = calloc(1, strlen(key) +3);
+ strcat(suffixed_key, key);
strcat(suffixed_key, "_t");
- add_elt(&oneList, suffixed_key, valuesJ);
+ add_elt(oneList, suffixed_key, valuesJ);
}
void unpacking_from_api(void *s, json_object *valueJ, const char *key)
@@ -114,9 +115,9 @@ void unpacking_from_api(void *s, json_object *valueJ, const char *key)
else if(strcasecmp("timestamp", key) == 0)
serie->timestamp = get_ts();
else if(strcasecmp("metadata", key) == 0)
- wrap_json_object_for_all(valueJ, unpack_metadata, (void*)serie->serie_columns.tags);
+ wrap_json_object_for_all(valueJ, unpack_metadata, (void*)&serie->serie_columns.tags);
else if(strcasecmp("value", key) == 0 || strcasecmp("values", key) == 0)
- wrap_json_object_for_all(valueJ, unpack_values, (void*)serie->serie_columns.fields);
+ wrap_json_object_for_all(valueJ, unpack_values, (void*)&serie->serie_columns.fields);
/* Treat all key looking for tag and field object. Those ones could be find
with the last 2 character. '_t' for tag and '_f' that are the keys that
could be indefinite. Cf influxdb documentation: