lib: use vty_json()

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2021-11-17 12:05:12 +01:00
parent 2c4dfddb01
commit ad9df66ce2
4 changed files with 4 additions and 31 deletions

View 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);
}

View 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*/

View 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,

View 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 */