diff options
author | Mateusz Kusiak <mateusz.kusiak@intel.com> | 2024-01-18 11:28:41 +0100 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-01-24 16:15:04 +0100 |
commit | b823c8f9d65eb7cf3338036c2a3fedf5128dedbc (patch) | |
tree | 52bc23321dfa6a50733389b78e7e1f3f2ef5d363 /mdadm.h | |
parent | Define sysfs max buffer size (diff) | |
download | mdadm-b823c8f9d65eb7cf3338036c2a3fedf5128dedbc.tar.xz mdadm-b823c8f9d65eb7cf3338036c2a3fedf5128dedbc.zip |
Replace "none" with macro
String "none" is used many times throughout the code.
Replace "none" strings with predefined macro.
Add str_is_none() for comparing strings with "none".
Replace str(n)cmp calls with function.
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Diffstat (limited to 'mdadm.h')
-rw-r--r-- | mdadm.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -2027,3 +2027,19 @@ static inline int is_container(const int level) return 1; return 0; } + +#define STR_COMMON_NONE "none" + +/** + * str_is_none() - check if @str starts with "none". + * @str: string + * + * return: + * true if string starts with "none", false otherwise. + */ +static inline bool str_is_none(char *str) +{ + if (strncmp(str, STR_COMMON_NONE, sizeof(STR_COMMON_NONE) - 1) == 0) + return true; + return false; +} |