]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/json.c
Merge pull request #11076 from routingrocks/vrrp_master_ad_cli
[mirror_frr.git] / lib / json.c
index 854a3d59d1a86819920ffd91a1a9b325fe7e231c..d85a21215c4c96679d1a375f5f9dfdafd3ad4acd 100644 (file)
@@ -74,6 +74,19 @@ void json_object_string_addv(struct json_object *obj, const char *key,
        json_object_object_add(obj, key, json_object_new_stringv(fmt, args));
 }
 
+void json_object_object_addv(struct json_object *parent,
+                            struct json_object *child, const char *keyfmt,
+                            va_list args)
+{
+       char *text, buf[256];
+
+       text = vasnprintfrr(MTYPE_TMP, buf, sizeof(buf), keyfmt, args);
+       json_object_object_add(parent, text, child);
+
+       if (text != buf)
+               XFREE(MTYPE_TMP, text);
+}
+
 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));