Commit 6ff4cd11 authored by Hongbo Li's avatar Hongbo Li Committed by Kees Cook

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: default avatarHongbo Li <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20240827024517.914100-2-lihongbo22@huawei.comSigned-off-by: default avatarKees Cook <kees@kernel.org>
parent 559048d1
...@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v) ...@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v)
} }
#define str_down_up(v) str_up_down(!(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 * str_plural - Return the simple pluralization based on English counts
* @num: Number used for deciding pluralization * @num: Number used for deciding pluralization
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment