]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/string-util.h
string-util: add strlen_ptr() helper
[thirdparty/systemd.git] / src / basic / string-util.h
index e8a083653892155a5b8c73c7f2c539b025979b29..34eb952ce956eec4d59920f6deae8c5d5012043d 100644 (file)
@@ -200,3 +200,10 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(char *, string_free_erase);
 #define _cleanup_string_free_erase_ _cleanup_(string_free_erasep)
 
 bool string_is_safe(const char *p) _pure_;
+
+static inline size_t strlen_ptr(const char *s) {
+        if (!s)
+                return 0;
+
+        return strlen(s);
+}