"\0",
};
-#define NUM_POSITIVE_STRS_SIZE \
- (sizeof(num_valid_positive_strs) / sizeof(num_valid_positive_strs[0]))
-#define NUM_NEGATIVE_STRS_SIZE \
- (sizeof(num_valid_negative_strs) / sizeof(num_valid_negative_strs[0]))
-#define NUM_POSITIVE_GARBAGE_STRS_SIZE \
- (sizeof(num_garbage_positive_strs) / sizeof(num_garbage_positive_strs[0]))
-#define NUM_NEGATIVE_GARBAGE_STRS_SIZE \
- (sizeof(num_garbage_negative_strs) / sizeof(num_garbage_negative_strs[0]))
-#define NUM_INVALID_STRS_SIZE \
- (sizeof(num_invalid_strs) / sizeof(num_invalid_strs[0]))
-
-
-
static int
can_parse_unsigned(uint64_t expected_result, enum cmdline_numtype type)
{
token.num_data.type = UINT32;
/* copy string to buffer */
- snprintf(buf, sizeof(buf), "%s",
- num_valid_positive_strs[0].str);
+ strlcpy(buf, num_valid_positive_strs[0].str, sizeof(buf));
/* try all null */
ret = cmdline_parse_num(NULL, NULL, NULL, 0);
token.num_data.type = type;
/* test full strings */
- for (i = 0; i < NUM_INVALID_STRS_SIZE; i++) {
+ for (i = 0; i < RTE_DIM(num_invalid_strs); i++) {
memset(&result, 0, sizeof(uint64_t));
memset(&buf, 0, sizeof(buf));
token.num_data.type = type;
/* test positive strings */
- for (i = 0; i < NUM_POSITIVE_STRS_SIZE; i++) {
+ for (i = 0; i < RTE_DIM(num_valid_positive_strs); i++) {
result = 0;
memset(&buf, 0, sizeof(buf));
}
/* test negative strings */
- for (i = 0; i < NUM_NEGATIVE_STRS_SIZE; i++) {
+ for (i = 0; i < RTE_DIM(num_valid_negative_strs); i++) {
result = 0;
memset(&buf, 0, sizeof(buf));
token.num_data.type = type;
/* test positive garbage strings */
- for (i = 0; i < NUM_POSITIVE_GARBAGE_STRS_SIZE; i++) {
+ for (i = 0; i < RTE_DIM(num_garbage_positive_strs); i++) {
result = 0;
memset(&buf, 0, sizeof(buf));
}
/* test negative strings */
- for (i = 0; i < NUM_NEGATIVE_GARBAGE_STRS_SIZE; i++) {
+ for (i = 0; i < RTE_DIM(num_garbage_negative_strs); i++) {
result = 0;
memset(&buf, 0, sizeof(buf));