From: Quentin Young Date: Wed, 20 Feb 2019 19:04:34 +0000 (+0000) Subject: lib: add more convenient boolean adder for json X-Git-Tag: base_7.2~330^2~66 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e91c9247eb43ea5b743ead19edc323bd679c0cd5;p=mirror%2Ffrr.git lib: add more convenient boolean adder for json Signed-off-by: Quentin Young --- diff --git a/lib/json.c b/lib/json.c index 4ea20ba178..efc3794040 100644 --- a/lib/json.c +++ b/lib/json.c @@ -64,6 +64,11 @@ void json_object_boolean_true_add(struct json_object *obj, const char *key) json_object_object_add(obj, key, json_object_new_boolean(1)); } +void json_object_boolean_add(struct json_object *obj, const char *key, bool val) +{ + json_object_object_add(obj, key, json_object_new_boolean(val)); +} + struct json_object *json_object_lock(struct json_object *obj) { return json_object_get(obj); diff --git a/lib/json.h b/lib/json.h index a5251662be..b35f221b99 100644 --- a/lib/json.h +++ b/lib/json.h @@ -61,6 +61,7 @@ extern void json_object_string_add(struct json_object *obj, const char *key, const char *s); 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_boolean_false_add(struct json_object *obj, const char *key); extern void json_object_boolean_true_add(struct json_object *obj,