]> git.ozlabs.org Git - ccan/blobdiff - ccan/bytestring/bytestring.h
bytestring: Allow bytestring_from_string to be called on NULL
[ccan] / ccan / bytestring / bytestring.h
index ee4087d44cb4c9dc864e632973e917cafb768ea9..63472fe24d6cdfd6e84802f6103b2658a610b098 100644 (file)
@@ -62,6 +62,8 @@ static inline struct bytestring bytestring(const char *p, size_t l)
  */
 static inline struct bytestring bytestring_from_string(const char *s)
 {
+       if (!s)
+               return bytestring_NULL;
        return bytestring(s, strlen(s));
 }