]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: use vty_json()
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 17 Nov 2021 11:05:12 +0000 (12:05 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 17 Nov 2021 15:01:30 +0000 (16:01 +0100)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/ferr.c
lib/filter.c
lib/plist.c
lib/routemap.c

index 513ef5ebec4fda359244a89b03da155578037fe3..e5b6d7552d825fc9b83db70040c1efbbba15dfb8 100644 (file)
@@ -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);
 }
 
index 9c80808fe8c38a1292fdc7f63fc77928da54193c..2de5bd657cc93e0684391cc19ea5eb8eb6bc22d7 100644 (file)
@@ -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*/
index a53b087a4605247a31af9a85a2597c304403ab21..0b3de88d9fa7eb400639e3b34266f8811a9c79e9 100644 (file)
@@ -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,
index 6227ebf15804f0ae15dfc33b3d41ba65abfc7741..a004e23b868dc0031be74bda30755cfd91db24ed 100644 (file)
@@ -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 */