diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-02-03 18:50:00 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-02-03 20:00:12 +0000 |
| commit | 8df7af9c9ecf7fc0b1c664f3d95893a9fcc16fcd (patch) | |
| tree | 022ec57a1cfcf90dbba337260f55f61fdf82b5ca | |
| parent | 2d0564b9daf49c46e0e4ef6c7d162c73fc8b35d7 (diff) | |
LinuxKPI: string_choices.h: use ternary operator
Switch from using if () else to a direct return (?:) code.
No functional changes.
Suggested by: kib (D55029)
Sponosred by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste (before removing more () as suggested by him)
Differential Revision: https://reviews.freebsd.org/D55088
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/string_choices.h | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/string_choices.h b/sys/compat/linuxkpi/common/include/linux/string_choices.h index 18842dbd86a2..db540d3e7d40 100644 --- a/sys/compat/linuxkpi/common/include/linux/string_choices.h +++ b/sys/compat/linuxkpi/common/include/linux/string_choices.h @@ -33,37 +33,25 @@ static inline const char * str_yes_no(bool value) { - if (value) - return "yes"; - else - return "no"; + return (value ? "yes" : "no"); } static inline const char * str_on_off(bool value) { - if (value) - return "on"; - else - return "off"; + return (value ? "on" : "off"); } static inline const char * str_enabled_disabled(bool value) { - if (value) - return "enabled"; - else - return "disabled"; + return (value ? "enabled" : "disabled"); } static inline const char * str_enable_disable(bool value) { - if (value) - return "enable"; - else - return "disable"; + return (value ? "enable" : "disable"); } #define str_disable_enable(_v) str_enable_disable(!(_v)) @@ -71,10 +59,7 @@ str_enable_disable(bool value) static inline const char * str_read_write(bool value) { - if (value) - return "read"; - else - return "write"; + return (value ? "read" : "write"); } #endif |
