]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: Use vty_json() for show_ip_ospf_gr_helper_cmd 10328/head
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 12 Jan 2022 20:51:46 +0000 (22:51 +0200)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 12 Jan 2022 20:51:46 +0000 (22:51 +0200)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
ospfd/ospf_vty.c

index 45dbed0abd38cd709bc9fea21daf73f12b609a67..fe3aa0346f24adcb09dad6eb6f3c273f10363ab8 100644 (file)
@@ -10350,12 +10350,8 @@ DEFPY (show_ip_ospf_gr_helper,
                                        vty, ospf, use_vrf, json, uj, detail);
                        }
 
-                       if (uj) {
-                               vty_out(vty, "%s\n",
-                                       json_object_to_json_string_ext(
-                                               json, JSON_C_TO_STRING_PRETTY));
-                               json_object_free(json);
-                       }
+                       if (uj)
+                               vty_json(vty, json);
 
                        return ret;
                }
@@ -10364,12 +10360,9 @@ DEFPY (show_ip_ospf_gr_helper,
 
                if (ospf == NULL || !ospf->oi_running) {
 
-                       if (uj) {
-                               vty_out(vty, "%s\n",
-                                       json_object_to_json_string_ext(
-                                               json, JSON_C_TO_STRING_PRETTY));
-                               json_object_free(json);
-                       } else
+                       if (uj)
+                               vty_json(vty, json);
+                       else
                                vty_out(vty, "%% OSPF instance not found\n");
 
                        return CMD_SUCCESS;
@@ -10381,12 +10374,9 @@ DEFPY (show_ip_ospf_gr_helper,
 
                if (ospf == NULL || !ospf->oi_running) {
 
-                       if (uj) {
-                               vty_out(vty, "%s\n",
-                                       json_object_to_json_string_ext(
-                                               json, JSON_C_TO_STRING_PRETTY));
-                               json_object_free(json);
-                       } else
+                       if (uj)
+                               vty_json(vty, json);
+                       else
                                vty_out(vty, "%% OSPF instance not found\n");
 
                        return CMD_SUCCESS;
@@ -10396,11 +10386,8 @@ DEFPY (show_ip_ospf_gr_helper,
                                            detail);
        }
 
-       if (uj) {
-               vty_out(vty, "%s\n", json_object_to_json_string_ext(
-                                            json, JSON_C_TO_STRING_PRETTY));
-               json_object_free(json);
-       }
+       if (uj)
+               vty_json(vty, json);
 
        return CMD_SUCCESS;
 }