Commit 7dbe3b37 authored by Hongbo Li's avatar Hongbo Li Committed by Hao Chen
Browse files

lib/string_choices: Add str_true_false()/str_false_true() helper

maillist inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IBM1QO
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=6ff4cd1160afafc12ad1603e3d2f39256e4b708d



----------------------------------------------------------------------

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.com


Signed-off-by: default avatarKees Cook <kees@kernel.org>
Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
parent 7173d438
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -42,4 +42,10 @@ static inline const char *str_yes_no(bool v)
	return v ? "yes" : "no";
}

static inline const char *str_true_false(bool v)
{
	return v ? "true" : "false";
}
#define str_false_true(v)		str_true_false(!(v))

#endif