[Olsr-dev] [PATCH v1 112/115] jsoninfo: helpers: use a double as parameter for abuf_json_float

Ferry Huberts (spam-protected)
Wed Dec 2 21:29:25 CET 2015


From: Ferry Huberts <(spam-protected)>

Higher precision

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/jsoninfo/src/olsrd_jsoninfo_helpers.c | 4 ++--
 lib/jsoninfo/src/olsrd_jsoninfo_helpers.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c b/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c
index 36d8282..e61c0c1 100644
--- a/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c
+++ b/lib/jsoninfo/src/olsrd_jsoninfo_helpers.c
@@ -145,10 +145,10 @@ void abuf_json_int(struct autobuf *abuf, const char* key, long value) {
   entrynumber[currentjsondepth]++;
 }
 
-void abuf_json_float(struct autobuf *abuf, const char* key, float value) {
+void abuf_json_float(struct autobuf *abuf, const char* key, double value) {
   abuf_json_insert_comma(abuf);
   abuf_json_new_indent(abuf);
-  abuf_appendf(abuf, "\"%s\": %f", key, (double) value);
+  abuf_appendf(abuf, "\"%s\": %f", key, value);
   entrynumber[currentjsondepth]++;
 }
 
diff --git a/lib/jsoninfo/src/olsrd_jsoninfo_helpers.h b/lib/jsoninfo/src/olsrd_jsoninfo_helpers.h
index 80c3930..1d154da 100644
--- a/lib/jsoninfo/src/olsrd_jsoninfo_helpers.h
+++ b/lib/jsoninfo/src/olsrd_jsoninfo_helpers.h
@@ -66,7 +66,7 @@ void abuf_json_string(struct autobuf *abuf, const char* key, const char* value);
 
 void abuf_json_int(struct autobuf *abuf, const char* key, long value);
 
-void abuf_json_float(struct autobuf *abuf, const char* key, float value);
+void abuf_json_float(struct autobuf *abuf, const char* key, double value);
 
 #ifdef __linux__
 void abuf_json_sys_class_net(struct autobuf *abuf, const char* key, const char* ifname, const char* datapoint);
-- 
2.5.0




More information about the Olsr-dev mailing list