]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: add json api to encode double values
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 18 Feb 2020 14:20:28 +0000 (15:20 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 31 Mar 2020 12:38:15 +0000 (14:38 +0200)
this api can be used to encode double values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
lib/json.c
lib/json.h

index 991240639a7d898d568eb7014193a53b323a923f..6bea3982e3e47a7d9011a47eec9b5c3b08f54695 100644 (file)
@@ -50,6 +50,11 @@ void json_object_int_add(struct json_object *obj, const char *key, int64_t i)
        json_object_object_add(obj, key, json_object_new_int64(i));
 }
 
+void json_object_double_add(struct json_object *obj, const char *key, double i)
+{
+       json_object_object_add(obj, key, json_object_new_double(i));
+}
+
 void json_object_boolean_false_add(struct json_object *obj, const char *key)
 {
        json_object_object_add(obj, key, json_object_new_boolean(0));
index c8866c524acfa13f1b0d9362b95fd90f8dc39faa..afe0b175da79618d64cbbbc47bc96bfd00f2b36a 100644 (file)
@@ -48,6 +48,9 @@ extern void json_object_int_add(struct json_object *obj, const char *key,
                                int64_t i);
 void json_object_boolean_add(struct json_object *obj, const char *key,
                             bool val);
+
+extern void json_object_double_add(struct json_object *obj, const char *key,
+                                  double i);
 extern void json_object_boolean_false_add(struct json_object *obj,
                                          const char *key);
 extern void json_object_boolean_true_add(struct json_object *obj,