diff options
author | Hongbo Li <lihongbo22@huawei.com> | 2024-08-27 10:45:15 +0800 |
---|---|---|
committer | Kees Cook <kees@kernel.org> | 2024-09-05 09:48:40 -0700 |
commit | 6ff4cd1160afafc12ad1603e3d2f39256e4b708d (patch) | |
tree | 02925873a4cd33b9759b6e529b3d9e9222aa0717 | |
parent | 559048d156ff3391c4b793779a824c9193e20442 (diff) |
lib/string_choices: Add str_true_false()/str_false_true() helper
Add str_true_false()/str_false_true() helper to return "true" or
"false" string literal.
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20240827024517.914100-2-lihongbo22@huawei.com
Signed-off-by: Kees Cook <kees@kernel.org>
-rw-r--r-- | include/linux/string_choices.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index 1320bcdcb89c..ebcc56b28ede 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v) } #define str_down_up(v) str_up_down(!(v)) +static inline const char *str_true_false(bool v) +{ + return v ? "true" : "false"; +} +#define str_false_true(v) str_true_false(!(v)) + /** * str_plural - Return the simple pluralization based on English counts * @num: Number used for deciding pluralization |