summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>2020-05-17 19:57:35 +0200
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>2020-10-26 18:33:21 +0100
commita2339ed9e31b88e2f7f83297e270fbb2fe09a88a (patch)
tree423c3898f7d019c4ac5cf5cbff14f5b9a86ffa24
parentzebra: handle local-es bridge port association (diff)
downloadfrr-a2339ed9e31b88e2f7f83297e270fbb2fe09a88a.tar.xz
frr-a2339ed9e31b88e2f7f83297e270fbb2fe09a88a.zip
lib, bgpd: move json_array_string_add to lib
json_array_string_add is used to add a string entry into a JSON list. This API is needed by zebra so moving it from bgpd to lib. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_evpn_mh.c5
-rw-r--r--lib/json.c5
-rw-r--r--lib/json.h1
3 files changed, 6 insertions, 5 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index 2e49e85a7..45cc1e760 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -1658,11 +1658,6 @@ static char *bgp_evpn_es_vteps_str(char *vtep_str, struct bgp_evpn_es *es,
return vtep_str;
}
-static inline void json_array_string_add(json_object *json, const char *str)
-{
- json_object_array_add(json, json_object_new_string(str));
-}
-
static void bgp_evpn_es_json_vtep_fill(json_object *json_vteps,
struct bgp_evpn_es_vtep *es_vtep)
{
diff --git a/lib/json.c b/lib/json.c
index 6bea3982e..cfba6ea3b 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -39,6 +39,11 @@ bool use_json(const int argc, struct cmd_token *argv[])
return false;
}
+void json_array_string_add(json_object *json, const char *str)
+{
+ json_object_array_add(json, json_object_new_string(str));
+}
+
void json_object_string_add(struct json_object *obj, const char *key,
const char *s)
{
diff --git a/lib/json.h b/lib/json.h
index afe0b175d..fe208f4fa 100644
--- a/lib/json.h
+++ b/lib/json.h
@@ -57,6 +57,7 @@ extern void json_object_boolean_true_add(struct json_object *obj,
const char *key);
extern struct json_object *json_object_lock(struct json_object *obj);
extern void json_object_free(struct json_object *obj);
+extern void json_array_string_add(json_object *json, const char *str);
#define JSON_STR "JavaScript Object Notation\n"