diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-03-10 18:43:34 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-03-10 18:43:34 +0100 |
commit | 12076aa0007a686e76ad1e746aaeca9ee05732e6 (patch) | |
tree | e552c1c121a49a297379a4e30943d4c27a140e8e | |
parent | dedc542a003c53024b800c183c0d640016ea300d (diff) |
Make mkoptparser() [[gnu::always_inline]]
-rw-r--r-- | include/optparse.h | 11 | ||||
-rw-r--r-- | lib/optparse/optparse.c | 9 |
2 files changed, 10 insertions, 10 deletions
diff --git a/include/optparse.h b/include/optparse.h index 5d16e67..6863980 100644 --- a/include/optparse.h +++ b/include/optparse.h @@ -30,6 +30,15 @@ struct op_option { }; rune optparse(struct optparse *, const struct op_option *, size_t); -struct optparse mkoptparser(char **); + +[[gnu::always_inline]] +static inline struct optparse +mkoptparser(char **argv) +{ + return (struct optparse){ + ._argv = argv, + .optind = argv[0] != nullptr, + }; +} #endif /* !MLIB_OPTPARSE_H */ diff --git a/lib/optparse/optparse.c b/lib/optparse/optparse.c index 931bf09..cf0c7dc 100644 --- a/lib/optparse/optparse.c +++ b/lib/optparse/optparse.c @@ -20,15 +20,6 @@ static rune error_r(struct optparse *, const char *, rune); static rune error_s(struct optparse *, const char *, struct u8view); static rune shortopt(struct optparse *, const struct op_option *, size_t); -struct optparse -mkoptparser(char **argv) -{ - return (struct optparse){ - ._argv = argv, - .optind = argv[0] != nullptr, - }; -} - rune optparse(struct optparse *st, const struct op_option *opts, size_t nopts) { |