From f87acfaf739f7b6361d6299549a897b03b0cc8c6 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 23 Mar 2022 17:36:56 +0100 Subject: vppinfra: change vlib_register_node so it takes format string for node name This allows specifying both c string and vector for node name and removes need for crafting temporary string. Type: improvement Change-Id: I0b016cd70aeda0f68eb6f9171c5152f303be7369 Signed-off-by: Damjan Marion --- src/plugins/hs_apps/http_cli.c | 6 +----- src/plugins/nat/pnat/tests/pnat_test.c | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/hs_apps/http_cli.c b/src/plugins/hs_apps/http_cli.c index a4698c52caf..fec1427994c 100644 --- a/src/plugins/hs_apps/http_cli.c +++ b/src/plugins/hs_apps/http_cli.c @@ -262,7 +262,6 @@ alloc_cli_process (hcs_cli_args_t *args) vlib_main_t *vm = hcm->vlib_main; hcs_cli_args_t **save_args; vlib_node_t *n; - char *name; uword l; l = vec_len (hcm->free_http_cli_process_node_indices); @@ -281,10 +280,7 @@ alloc_cli_process (hcs_cli_args_t *args) .runtime_data_bytes = sizeof (void *), }; - name = (char *) format (0, "http-cli-%d", l); - r.name = name; - vlib_register_node (vm, &r); - vec_free (name); + vlib_register_node (vm, &r, "http-cli-%d", l); n = vlib_get_node (vm, r.index); } diff --git a/src/plugins/nat/pnat/tests/pnat_test.c b/src/plugins/nat/pnat/tests/pnat_test.c index e7d946941b9..f6579dc5ca9 100644 --- a/src/plugins/nat/pnat/tests/pnat_test.c +++ b/src/plugins/nat/pnat/tests/pnat_test.c @@ -569,7 +569,8 @@ int main(int argc, char **argv) { ip_checksum_init(vm); - u32 node_index = vlib_register_node(vm, &pnat_input_node); + u32 node_index = + vlib_register_node(vm, &pnat_input_node, "%s", pnat_input_node.name); node = vlib_node_get_runtime(vm, node_index); assert(node); -- cgit 1.2.3-korg