From 12076aa0007a686e76ad1e746aaeca9ee05732e6 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 10 Mar 2024 18:43:34 +0100 Subject: Make mkoptparser() [[gnu::always_inline]] --- include/optparse.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') 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 */ -- cgit v1.2.3