summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>2019-11-26 00:13:48 +0900
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>2019-11-26 00:34:49 +0900
commit40938cdec2b99d49ed95c2fb0140c13149348ed6 (patch)
tree0cda8fb8c118b840d07ef7b4f795ba6cafd81027
parentb048455fef67dad4ef96ce0393937322e3165b58 (diff)
downloadfio-40938cdec2b99d49ed95c2fb0140c13149348ed6.tar.gz
fio-40938cdec2b99d49ed95c2fb0140c13149348ed6.tar.bz2
parse: Silence discard-const warning on OpenBSD
This might be overkill just to silence the warnings, but having a common function for const and non-const version makes it discard const pointer at some point. -- CC parse.o parse.c: In function 'find_option_c': parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type parse.c: In function 'get_option': parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type parse.c: In function 'parse_cmd_option': parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
-rw-r--r--parse.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 483a62f6..04b2e198 100644
--- a/parse.c
+++ b/parse.c
@@ -1048,7 +1048,20 @@ struct fio_option *find_option(struct fio_option *options, const char *opt)
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 *