diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-01-07 11:12:48 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-01-11 06:07:13 +0100 |
commit | e85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294 (patch) | |
tree | 0483cdb3c5770ca75eeeb0cc2de787b0e7bdbd3c /core/dive.h | |
parent | 86ef9fce7517313570838ca8e853132876035611 (diff) | |
download | subsurface-e85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294.tar.gz |
Introduce helper function empty_string()
There are ca. 50 constructs of the kind
same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.h')
-rw-r--r-- | core/dive.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/dive.h b/core/dive.h index cd48aee30..294620df7 100644 --- a/core/dive.h +++ b/core/dive.h @@ -38,6 +38,11 @@ static inline bool same_string_caseinsensitive(const char *a, const char *b) return !strcasecmp(a ?: "", b ?: ""); } +static inline bool empty_string(const char *s) +{ + return !s || !*s; +} + static inline bool includes_string_caseinsensitive(const char *haystack, const char *needle) { if (!needle) |