diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2022-03-11 14:12:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 14:12:58 -0500 |
| commit | 89ee4bbb21d628b7cabbc54c9cf23064d3295484 (patch) | |
| tree | 21a2d809c1ba608f14b8a3908f17ffdb3c104a18 /lib/json.c | |
| parent | 1b387a2894a812676d7e51fc39e668c03dbc5384 (diff) | |
| parent | 41490e0ede9ad9e09b51151ccc2cf7321e491603 (diff) | |
Merge pull request #10774 from opensourcerouting/pim6-fixes-20220311
pim6d: fix a bunch of IPv6 confusion
Diffstat (limited to 'lib/json.c')
| -rw-r--r-- | lib/json.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/json.c b/lib/json.c index 854a3d59d1..d85a21215c 100644 --- a/lib/json.c +++ b/lib/json.c @@ -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)); |
