Provide feed back on string length error, matching the handling for the other APIs in the file. Improve the readability of the code.
Signed-off-by: Mike Holmes <[email protected]> --- platform/linux-generic/odp_coremask.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/odp_coremask.c b/platform/linux-generic/odp_coremask.c index 54cd333..5b4e961 100644 --- a/platform/linux-generic/odp_coremask.c +++ b/platform/linux-generic/odp_coremask.c @@ -10,19 +10,21 @@ #include <stdlib.h> #include <string.h> -#define MAX_CORE_NUM 64 +#define MAX_CORE_NUM 64 +#define MASK_STR_LEN 18 +#define BASE_16 16 void odp_coremask_from_str(const char *str, odp_coremask_t *mask) { uint64_t mask_u64; - if (strlen(str) > 18) { - /* more than 64 bits */ + if (strlen(str) > MASK_STR_LEN) { + ODP_ERR("string longer than reqired for bit mask supported"); return; } - mask_u64 = strtoull(str, NULL, 16); + mask_u64 = strtoull(str, NULL, BASE_16); odp_coremask_from_u64(&mask_u64, 1, mask); } -- 2.1.0 _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
