#endif
if (rc == 1) {
+ char *endptr;
+
if (strstr(str, "0x") || strstr(str, "0X"))
base = 16;
else
base = 10;
- *val = strtoll(str, NULL, base);
+ *val = strtoll(str, &endptr, base);
+ if (*val == 0 && endptr == str)
+ return 1;
if (*val == LONG_MAX && errno == ERANGE)
return 1;
}
static const char *opt_type_name(const struct fio_option *o)
{
- compiletime_assert(ARRAY_SIZE(opt_type_names) - 1 == FIO_OPT_UNSUPPORTED,
+ compiletime_assert(FIO_ARRAY_SIZE(opt_type_names) - 1 == FIO_OPT_UNSUPPORTED,
"opt_type_names[] index");
if (o->type <= FIO_OPT_UNSUPPORTED)
}
case FIO_OPT_STR_VAL_TIME:
is_time = 1;
- /* fall through */
+ fallthrough;
case FIO_OPT_ULL:
case FIO_OPT_INT:
case FIO_OPT_STR_VAL: {
}
case FIO_OPT_DEPRECATED:
ret = 1;
- /* fall through */
+ fallthrough;
case FIO_OPT_SOFT_DEPRECATED:
log_info("Option %s is deprecated\n", o->name);
break;
const struct fio_option *
find_option_c(const struct fio_option *options, const char *opt)
{
- return find_option((struct fio_option *)options, opt);
+ const struct fio_option *o;
+
+ for (o = &options[0]; o->name; o++) {
+ if (!o_match(o, opt))
+ continue;
+ if (o->type == FIO_OPT_UNSUPPORTED) {
+ log_err("Option <%s>: %s\n", o->name, o->help);
+ continue;
+ }
+
+ return o;
+ }
+
+ return NULL;
}
static const struct fio_option *