nulstr-util: Declare NULSTR_FOREACH() iterator inline
This commit is contained in:
@@ -28,7 +28,6 @@ int fs_type_from_string(const char *name, const statfs_f_type_t **ret) {
|
||||
}
|
||||
|
||||
bool fs_in_group(const struct statfs *s, FilesystemGroups fs_group) {
|
||||
const char *fs;
|
||||
int r;
|
||||
|
||||
NULSTR_FOREACH(fs, filesystem_sets[fs_group].value) {
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include "string-util.h"
|
||||
|
||||
const char* nulstr_get(const char *nulstr, const char *needle) {
|
||||
const char *i;
|
||||
|
||||
if (!nulstr)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include <string.h>
|
||||
|
||||
#define NULSTR_FOREACH(i, l) \
|
||||
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
|
||||
for (typeof(*(l)) *(i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
|
||||
|
||||
#define NULSTR_FOREACH_PAIR(i, j, l) \
|
||||
for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
|
||||
for (typeof(*(l)) *(i) = (l), *(j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
|
||||
|
||||
const char* nulstr_get(const char *nulstr, const char *needle);
|
||||
|
||||
|
||||
@@ -880,7 +880,7 @@ char **env_generator_binary_paths(bool is_system) {
|
||||
}
|
||||
|
||||
int find_portable_profile(const char *name, const char *unit, char **ret_path) {
|
||||
const char *p, *dot;
|
||||
const char *dot;
|
||||
|
||||
assert(name);
|
||||
assert(ret_path);
|
||||
|
||||
@@ -679,7 +679,6 @@ char** strv_parse_nulstr(const char *s, size_t l) {
|
||||
}
|
||||
|
||||
char** strv_split_nulstr(const char *s) {
|
||||
const char *i;
|
||||
char **r = NULL;
|
||||
|
||||
NULSTR_FOREACH(i, s)
|
||||
|
||||
Reference in New Issue
Block a user