sd-path,strv: add simple helper to wrap oom handling around strv_split_nulstr()

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-03-27 20:12:44 +01:00
parent b35ed5530b
commit a7addf32a5
2 changed files with 13 additions and 8 deletions
+10
View File
@@ -87,6 +87,16 @@ char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
int strv_make_nulstr(char * const *l, char **p, size_t *n);
static inline int strv_from_nulstr(char ***a, const char *nulstr) {
char **t;
t = strv_split_nulstr(nulstr);
if (!t)
return -ENOMEM;
*a = t;
return 0;
}
bool strv_overlap(char * const *a, char * const *b) _pure_;
#define STRV_FOREACH(s, l) \