summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api/client')
-rw-r--r--src/vpp-api/client/stat_client.c14
-rw-r--r--src/vpp-api/client/stat_client.h3
2 files changed, 10 insertions, 7 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index bd9d8ccd933..bb7f240a753 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -321,7 +321,7 @@ stat_segment_ls_r (uint8_t ** patterns, stat_client_main_t * sm)
int i, j;
for (i = 0; i < vec_len (patterns); i++)
{
- int rv = regcomp (&regex[i], (char *) patterns[i], 0);
+ int rv = regcomp (&regex[i], (const char *) patterns[i], 0);
if (rv)
{
fprintf (stderr, "Could not compile regex %s\n", patterns[i]);
@@ -419,12 +419,14 @@ stat_segment_vec_free (void *vec)
}
/* Create a vector from a string (or add to existing) */
-u8 **
-stat_segment_string_vector (u8 ** string_vector, char *string)
+uint8_t **
+stat_segment_string_vector (uint8_t ** string_vector, const char *string)
{
- u8 *name = 0;
- name = vec_dup ((u8 *) string);
- vec_add1 (string_vector, (u8 *) name);
+ uint8_t *name = 0;
+ size_t len = strlen (string);
+
+ vec_validate_init_c_string (name, string, len);
+ vec_add1 (string_vector, name);
return string_vector;
}
diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h
index 52aaa244678..89f6fe53ea4 100644
--- a/src/vpp-api/client/stat_client.h
+++ b/src/vpp-api/client/stat_client.h
@@ -54,7 +54,8 @@ int stat_segment_connect_r (const char *socket_name, stat_client_main_t * sm);
int stat_segment_connect (const char *socket_name);
void stat_segment_disconnect_r (stat_client_main_t * sm);
void stat_segment_disconnect (void);
-uint8_t **stat_segment_string_vector (uint8_t ** string_vector, char *string);
+uint8_t **stat_segment_string_vector (uint8_t ** string_vector,
+ const char *string);
int stat_segment_vec_len (void *vec);
void stat_segment_vec_free (void *vec);
uint32_t *stat_segment_ls_r (uint8_t ** patterns, stat_client_main_t * sm);