summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-11-17 12:05:12 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2021-11-17 16:01:30 +0100
commitad9df66ce244c9e062319970e980cc70f9543f29 (patch)
treed6f951a2adba9376ee0b98a0efa24cab709727db /lib
parent2c4dfddb01cd7dfb28f410dca866738486981ca6 (diff)
lib: use vty_json()
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ferr.c8
-rw-r--r--lib/filter.c9
-rw-r--r--lib/plist.c9
-rw-r--r--lib/routemap.c9
4 files changed, 4 insertions, 31 deletions
diff --git a/lib/ferr.c b/lib/ferr.c
index 513ef5ebec..e5b6d7552d 100644
--- a/lib/ferr.c
+++ b/lib/ferr.c
@@ -157,13 +157,7 @@ void log_ref_display(struct vty *vty, uint32_t code, bool json)
}
}
- if (json) {
- const char *str = json_object_to_json_string_ext(
- top, JSON_C_TO_STRING_PRETTY);
- vty_out(vty, "%s\n", str);
- json_object_free(top);
- }
-
+ vty_json(vty, top);
list_delete(&errlist);
}
diff --git a/lib/filter.c b/lib/filter.c
index 9c80808fe8..2de5bd657c 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -589,14 +589,7 @@ static int filter_show(struct vty *vty, const char *name, afi_t afi,
}
}
- if (json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
-
- return CMD_SUCCESS;
+ return vty_json(vty, json);
}
/* show MAC access list - this only has MAC filters for now*/
diff --git a/lib/plist.c b/lib/plist.c
index a53b087a46..0b3de88d9f 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -1127,14 +1127,7 @@ static int vty_show_prefix_list(struct vty *vty, afi_t afi, const char *name,
master, dtype, seqnum);
}
- if (uj) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
-
- return CMD_SUCCESS;
+ return vty_json(vty, json);
}
static int vty_show_prefix_list_prefix(struct vty *vty, afi_t afi,
diff --git a/lib/routemap.c b/lib/routemap.c
index 6227ebf158..a004e23b86 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -1026,14 +1026,7 @@ static int vty_show_route_map(struct vty *vty, const char *name, bool use_json)
list_delete(&maplist);
}
- if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
-
- return CMD_SUCCESS;
+ return vty_json(vty, json);
}
/* Unused route map details */