Add string_contains_word_strv()

I had to move STRV_MAKE to macro.h. There is a circular dependency between
extract-word.h, strv.h, and string-util.h that makes it hard to define the
inline function otherwise.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-09-04 12:59:26 +02:00
parent 81823e6c12
commit 46bf625aca
6 changed files with 52 additions and 9 deletions
+5 -1
View File
@@ -280,4 +280,8 @@ char* string_erase(char *x);
int string_truncate_lines(const char *s, size_t n_lines, char **ret);
int string_extract_line(const char *s, size_t i, char **ret);
int string_contains_word(const char *string, const char *separators, const char *word);
int string_contains_word_strv(const char *string, const char *separators, char **words, const char **ret_word);
static inline int string_contains_word(const char *string, const char *separators, const char *word) {
return string_contains_word_strv(string, separators, STRV_MAKE(word), NULL);
}