summaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/format.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-04-15 15:53:17 +0200
committerOle Tr�an <otroan@employees.org>2022-04-26 10:32:11 +0000
commitc5d81b91be30c9a69bb5333f2685f536246dd1f8 (patch)
tree91b1782b6224ab8d256e16d43a5066a4aa61a5e4 /src/vlib/stats/format.c
parent45e05396399b7ead25d87e79a806f0c03b78965b (diff)
stats: string vector and node collector improvements
Type: improvement Change-Id: Ibdadeb4e685f45a93f45504a84709391489abb6a Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/stats/format.c')
-rw-r--r--src/vlib/stats/format.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/vlib/stats/format.c b/src/vlib/stats/format.c
index 419ff6b4657..54c11aff743 100644
--- a/src/vlib/stats/format.c
+++ b/src/vlib/stats/format.c
@@ -9,16 +9,13 @@
u8 *
format_vlib_stats_symlink (u8 *s, va_list *args)
{
- char *input = va_arg (*args, char *);
- char *modified_input = vec_dup (input);
- int i;
- u8 *result;
+ u8 *input = va_arg (*args, u8 *);
- for (i = 0; i < strlen (modified_input); i++)
- if (modified_input[i] == '/')
- modified_input[i] = '_';
+ for (int i = 0; i < vec_len (input); i++)
+ if (input[i] == '/')
+ vec_add1 (s, '_');
+ else
+ vec_add1 (s, input[i]);
- result = format (s, "%s", modified_input);
- vec_free (modified_input);
- return result;
+ return s;
}