summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9236b0d)
raw | patch | inline | side by side (parent: 9236b0d)
author | Florian Forster <octo@verplant.org> | |
Thu, 9 Sep 2010 07:55:58 +0000 (09:55 +0200) | ||
committer | Florian Forster <octo@verplant.org> | |
Thu, 9 Sep 2010 07:55:58 +0000 (09:55 +0200) |
src/graph_ident.c | patch | blob | history |
diff --git a/src/graph_ident.c b/src/graph_ident.c
index e2d3cd68c9f76c05f399b50c1099cf03289da076..9c8bc6e2ed6e6be999e051a22fc069a1df152d99 100644 (file)
--- a/src/graph_ident.c
+++ b/src/graph_ident.c
* Florian octo Forster <ff at octo.it>
**/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h> /* PATH_MAX */
#include <sys/types.h>
#include <sys/stat.h>
+#include <math.h>
#include "graph_ident.h"
#include "common.h"
ident_data_to_json__data_t *data = user_data;
size_t i;
- yajl_gen_map_open (data->handler);
+ yajl_gen_array_open (data->handler);
for (i = 0; i < dp_num; i++)
{
- yajl_gen_map_open (data->handler);
+ yajl_gen_array_open (data->handler);
yajl_gen_integer (data->handler, (long) dp[i].time.tv_sec);
- yajl_gen_double (data->handler, dp[i].value);
- yajl_gen_map_close (data->handler);
+ if (isnan (dp[i].value))
+ yajl_gen_null (data->handler);
+ else
+ yajl_gen_double (data->handler, dp[i].value);
+ yajl_gen_array_close (data->handler);
}
- yajl_gen_map_close (data->handler);
+ yajl_gen_array_close (data->handler);
return (0);
} /* }}} int ident_data_to_json__get_ident_data */