X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=87ad317319315b07052f98bd3c0c719e7d3deca2;hp=bd8bbb268f37ac413078fc05b89aa7765bd65c8a;hb=60e6abf16bd8fe6c78b42074f7fb357c02e6ddbd;hpb=5261ba901845c084de5a8fd06500ed09bfb0bd80 diff --git a/src/shared/util.h b/src/shared/util.h index bd8bbb268..87ad31731 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -128,6 +128,8 @@ bool streq_ptr(const char *a, const char *b) _pure_; #define newa(t, n) ((t*) alloca(sizeof(t)*(n))) +#define newa0(t, n) ((t*) alloca0(sizeof(t)*(n))) + #define newdup(t, p, n) ((t*) memdup_multiply(p, sizeof(t), (n))) #define malloc0(n) (calloc((n), 1)) @@ -246,9 +248,6 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo #define FOREACH_WORD_QUOTED(word, length, s, state) \ _FOREACH_WORD(word, length, s, WHITESPACE, true, state) -#define FOREACH_WORD_SEPARATOR_QUOTED(word, length, s, separator, state) \ - _FOREACH_WORD(word, length, s, separator, 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))) @@ -967,4 +966,7 @@ bool is_localhost(const char *hostname); int take_password_lock(const char *root); -int is_symlink(const char *path); \ No newline at end of file +int is_symlink(const char *path); + +int unquote_first_word(const char **p, char **ret); +int unquote_many_words(const char **p, ...) _sentinel_;