1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <stdbool.h>
5 #include <string.h>
6 
7 #define NULSTR_FOREACH(i, l)                                    \
8         for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
9 
10 #define NULSTR_FOREACH_PAIR(i, j, l)                             \
11         for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
12 
13 const char* nulstr_get(const char *nulstr, const char *needle);
14 
nulstr_contains(const char * nulstr,const char * needle)15 static inline bool nulstr_contains(const char *nulstr, const char *needle) {
16         return nulstr_get(nulstr, needle);
17 }
18