summaryrefslogtreecommitdiffstats
path: root/vlib/vlib/node_cli.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2015-12-14 10:31:33 -0500
committerDamjan Marion <damarion@cisco.com>2015-12-15 00:09:46 +0100
commitd2dc3df90d20419dfaee03f3096ed18d20fa391a (patch)
tree3315705df01fdb840ddb828fff779748154930b8 /vlib/vlib/node_cli.c
parentf9bd620dc5299180cb639c4c6f91fadf6b860b08 (diff)
replacing all vec_sort() invocations to vec_sort_with_function()
Change-Id: I05895827ed52be292112484cee7d0a2591b67335 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'vlib/vlib/node_cli.c')
-rw-r--r--vlib/vlib/node_cli.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/vlib/vlib/node_cli.c b/vlib/vlib/node_cli.c
index 58c3776a67b..59f5623eca4 100644
--- a/vlib/vlib/node_cli.c
+++ b/vlib/vlib/node_cli.c
@@ -40,6 +40,15 @@
#include <vlib/vlib.h>
#include <vlib/threads.h>
+static int
+node_cmp (void * a1, void *a2)
+{
+ vlib_node_t ** n1 = a1;
+ vlib_node_t ** n2 = a2;
+
+ return vec_cmp (n1[0]->name, n2[0]->name);
+}
+
static clib_error_t *
show_node_graph (vlib_main_t * vm,
unformat_input_t * input,
@@ -61,8 +70,7 @@ show_node_graph (vlib_main_t * vm,
vlib_node_t ** nodes = vec_dup (nm->nodes);
uword i;
- vec_sort (nodes, n1, n2,
- vec_cmp (n1[0]->name, n2[0]->name));
+ vec_sort_with_function (nodes, node_cmp);
for (i = 0; i < vec_len (nodes); i++)
vlib_cli_output (vm, "%U\n\n", format_vlib_node_graph, nm, nodes[i]);
@@ -282,8 +290,7 @@ show_node_runtime (vlib_main_t * vm,
stat_vm = stat_vms[j];
nodes = node_dups[j];
- vec_sort (nodes, n1, n2,
- vec_cmp (n1[0]->name, n2[0]->name));
+ vec_sort_with_function (nodes, node_cmp);
n_input = n_output = n_drop = n_punt = n_clocks = 0;
n_internal_vectors = n_internal_calls = 0;