Skip to contentSkip to conversation

string_choices: Add wrapper for str_down_up()

PATCH In review Kees Cook 2 participants 2 messages Aug 12, 2024 Generic string library

lore
Share & tools
lore

Kees Cook

author maintainer
#0 lore raw

PATCH 1/1 string_choices: Add wrapper for str_down_up()

The string choice functions which are not clearly true/false synonyms also have inverted wrappers. Add this for str_down_up() as well.

---
Cc: Andy Shevchenko <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Cc: [email protected]

---
 include/linux/string_choices.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/string_choices.h +1 -0
index bcde3c9cff81..1320bcdcb89c 100644
@@ -46,6 +46,7 @@ static inline const char *str_up_down(bool v)
 {
 	return v ? "up" : "down";
 }
+#define str_down_up(v)		str_up_down(!(v))
 
 /**
  * str_plural - Return the simple pluralization based on English counts
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Kees Cook

The string choice functions which are not clearly true/false synonyms also have inverted wrappers. Add this for str_down_up() as well.

Signature · 2 lines
With Best Regards,
Andy Shevchenko