@@ -12,6 +12,7 @@
#include <rte_string_fns.h>
#include <rte_comp.h>
+#include <rte_os_shim.h>
#include "comp_perf_options.h"
@@ -177,6 +178,7 @@ parse_range(const char *arg, uint8_t *min, uint8_t *max, uint8_t *inc)
{
char *token;
uint8_t number;
+ char *sp = NULL;
char *copy_arg = strdup(arg);
@@ -184,7 +186,7 @@ parse_range(const char *arg, uint8_t *min, uint8_t *max, uint8_t *inc)
return -1;
errno = 0;
- token = strtok(copy_arg, ":");
+ token = strtok_r(copy_arg, ":", &sp);
/* Parse minimum value */
if (token != NULL) {
@@ -197,7 +199,7 @@ parse_range(const char *arg, uint8_t *min, uint8_t *max, uint8_t *inc)
} else
goto err_range;
- token = strtok(NULL, ":");
+ token = strtok_r(NULL, ":", &sp);
/* Parse increment value */
if (token != NULL) {
@@ -211,7 +213,7 @@ parse_range(const char *arg, uint8_t *min, uint8_t *max, uint8_t *inc)
} else
goto err_range;
- token = strtok(NULL, ":");
+ token = strtok_r(NULL, ":", &sp);
/* Parse maximum value */
if (token != NULL) {
@@ -225,7 +227,7 @@ parse_range(const char *arg, uint8_t *min, uint8_t *max, uint8_t *inc)
} else
goto err_range;
- if (strtok(NULL, ":") != NULL)
+ if (strtok_r(NULL, ":", &sp) != NULL)
goto err_range;
free(copy_arg);
@@ -244,6 +246,7 @@ parse_list(const char *arg, uint8_t *list, uint8_t *min, uint8_t *max)
uint8_t count = 0;
uint32_t temp_min;
uint32_t temp_max;
+ char *sp = NULL;
char *copy_arg = strdup(arg);
@@ -251,7 +254,7 @@ parse_list(const char *arg, uint8_t *list, uint8_t *min, uint8_t *max)
return -1;
errno = 0;
- token = strtok(copy_arg, ",");
+ token = strtok_r(copy_arg, ",", &sp);
/* Parse first value */
if (token != NULL) {
@@ -266,7 +269,7 @@ parse_list(const char *arg, uint8_t *list, uint8_t *min, uint8_t *max)
} else
goto err_list;
- token = strtok(NULL, ",");
+ token = strtok_r(NULL, ",", &sp);
while (token != NULL) {
if (count == MAX_LIST) {
@@ -288,7 +291,7 @@ parse_list(const char *arg, uint8_t *list, uint8_t *min, uint8_t *max)
if (number > temp_max)
temp_max = number;
- token = strtok(NULL, ",");
+ token = strtok_r(NULL, ",", &sp);
}
if (min)