diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2024-02-23 15:26:55 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2024-04-26 15:16:11 +0300 |
commit | a05674d72c9089ead4099a10e08769d24da8b0cd (patch) | |
tree | adbaababc9a5c3b1fbc2ee62ab351bd621bf6ee0 | |
parent | ead9d5508ee6e96815942c902a10380e9880a545 (diff) |
helper: use odph_strcpy() instead of strncpy()
Use odph_strcpy() instead of strncpy().
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | helper/hashtable.c | 3 | ||||
-rw-r--r-- | helper/lineartable.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/helper/hashtable.c b/helper/hashtable.c index 5770dc43b..faeea4ff9 100644 --- a/helper/hashtable.c +++ b/helper/hashtable.c @@ -9,6 +9,7 @@ #include <odp/helper/odph_hashtable.h> #include <odp/helper/odph_debug.h> +#include <odp/helper/string.h> #include "odph_list_internal.h" #include <odp_api.h> @@ -99,7 +100,7 @@ odph_table_t odph_hash_table_create(const char *name, uint32_t capacity, memset(tbl, 0, capacity << 20); tbl->init_cap = capacity << 20; - strncpy(tbl->name, name, ODPH_TABLE_NAME_LEN - 1); + odph_strcpy(tbl->name, name, ODPH_TABLE_NAME_LEN); tbl->key_size = key_size; tbl->value_size = value_size; diff --git a/helper/lineartable.c b/helper/lineartable.c index 290a90c02..32242a12a 100644 --- a/helper/lineartable.c +++ b/helper/lineartable.c @@ -8,6 +8,7 @@ #include <odp/helper/odph_lineartable.h> #include <odp/helper/odph_debug.h> +#include <odp/helper/string.h> #include <odp_api.h> #define ODPH_SUCCESS 0 @@ -71,7 +72,7 @@ odph_table_t odph_linear_table_create(const char *name, uint32_t capacity, tbl->init_cap = capacity < 20; - strncpy(tbl->name, name, ODPH_TABLE_NAME_LEN - 1); + odph_strcpy(tbl->name, name, ODPH_TABLE_NAME_LEN); /* for linear table, the key is just the index, without conflict * so we just need to record the value content |