Skip to content

Commit 6ff4cd1

Browse files
Hongbo Likees
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 559048d commit 6ff4cd1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/linux/string_choices.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v)
4848
}
4949
#define str_down_up(v) str_up_down(!(v))
5050

51+
static inline const char *str_true_false(bool v)
52+
{
53+
return v ? "true" : "false";
54+
}
55+
#define str_false_true(v) str_true_false(!(v))
56+
5157
/**
5258
* str_plural - Return the simple pluralization based on English counts
5359
* @num: Number used for deciding pluralization

0 commit comments

Comments
 (0)