chiark / gitweb /
tests: add tests for environment serialization
[elogind.git] / src / basic / string-util.h
index 66e55cb2c615ab8cbab8fce97cd730068d395772..e8c2fc6dd38f55c9b0085d1bdeecfcfd39cf440c 100644 (file)
@@ -66,11 +66,11 @@ static inline bool isempty(const char *p) {
         return !p || !p[0];
 }
 
-#if 0 /// UNNEEDED by elogind
 static inline const char *empty_to_null(const char *p) {
         return isempty(p) ? NULL : p;
 }
 
+#if 0 /// UNNEEDED by elogind
 static inline const char *strdash_if_empty(const char *str) {
         return isempty(str) ? "-" : str;
 }
@@ -111,16 +111,14 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo
 #define FOREACH_WORD_SEPARATOR(word, length, s, separator, state)       \
         _FOREACH_WORD(word, length, s, separator, false, state)
 
-#define FOREACH_WORD_QUOTED(word, length, s, state)                     \
-        _FOREACH_WORD(word, length, s, WHITESPACE, true, state)
-
 #define _FOREACH_WORD(word, length, s, separator, quoted, state)        \
         for ((state) = (s), (word) = split(&(state), &(length), (separator), (quoted)); (word); (word) = split(&(state), &(length), (separator), (quoted)))
 
 char *strappend(const char *s, const char *suffix);
 char *strnappend(const char *s, const char *suffix, size_t length);
 
-char *strjoin(const char *x, ...) _sentinel_;
+char *strjoin_real(const char *x, ...) _sentinel_;
+#define strjoin(a, ...) strjoin_real((a), __VA_ARGS__, NULL)
 
 #define strjoina(a, ...)                                                \
         ({                                                              \
@@ -199,7 +197,10 @@ static inline void *memmem_safe(const void *haystack, size_t haystacklen, const
         return memmem(haystack, haystacklen, needle, needlelen);
 }
 
-void* memory_erase(void *p, size_t l);
+#if !HAVE_DECL_EXPLICIT_BZERO
+void explicit_bzero(void *p, size_t l);
+#endif
+
 char *string_erase(char *x);
 
 char *string_free_erase(char *s);