nulstr-util: Declare NULSTR_FOREACH() iterator inline
This commit is contained in:
@@ -135,7 +135,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||
continue;
|
||||
|
||||
if (table[i].target) {
|
||||
const char *target = NULL, *s;
|
||||
const char *target = NULL;
|
||||
|
||||
/* check if one of the targets exists */
|
||||
NULSTR_FOREACH(s, table[i].target) {
|
||||
|
||||
@@ -211,7 +211,6 @@ static int show_cgroup_name(
|
||||
|
||||
if (FLAGS_SET(flags, OUTPUT_CGROUP_XATTRS) && fd >= 0) {
|
||||
_cleanup_free_ char *nl = NULL;
|
||||
char *xa;
|
||||
|
||||
r = flistxattr_malloc(fd, &nl);
|
||||
if (r < 0)
|
||||
|
||||
@@ -211,7 +211,6 @@ static int parse_line(
|
||||
|
||||
if (sections && !nulstr_contains(sections, n)) {
|
||||
bool ignore;
|
||||
const char *t;
|
||||
|
||||
ignore = (flags & CONFIG_PARSE_RELAXED) || startswith(n, "X-");
|
||||
|
||||
|
||||
@@ -1555,7 +1555,6 @@ int copy_rights_with_fallback(int fdf, int fdt, const char *patht) {
|
||||
int copy_xattr(int fdf, int fdt, CopyFlags copy_flags) {
|
||||
_cleanup_free_ char *names = NULL;
|
||||
int ret = 0, r;
|
||||
const char *p;
|
||||
|
||||
r = flistxattr_malloc(fdf, &names);
|
||||
if (r < 0)
|
||||
|
||||
@@ -22,7 +22,6 @@ int dev_setup(const char *prefix, uid_t uid, gid_t gid) {
|
||||
"/proc/self/fd/1\0" "/dev/stdout\0"
|
||||
"/proc/self/fd/2\0" "/dev/stderr\0";
|
||||
|
||||
const char *j, *k;
|
||||
int r;
|
||||
|
||||
NULSTR_FOREACH_PAIR(j, k, symlinks) {
|
||||
|
||||
@@ -429,7 +429,6 @@ int image_find(ImageClass class,
|
||||
const char *root,
|
||||
Image **ret) {
|
||||
|
||||
const char *path;
|
||||
int r;
|
||||
|
||||
assert(class >= 0);
|
||||
@@ -533,7 +532,6 @@ int image_discover(
|
||||
const char *root,
|
||||
Hashmap *h) {
|
||||
|
||||
const char *path;
|
||||
int r;
|
||||
|
||||
assert(class >= 0);
|
||||
@@ -1262,8 +1260,6 @@ bool image_in_search_path(
|
||||
const char *root,
|
||||
const char *image) {
|
||||
|
||||
const char *path;
|
||||
|
||||
assert(image);
|
||||
|
||||
NULSTR_FOREACH(path, image_search_path[class]) {
|
||||
|
||||
@@ -2869,7 +2869,6 @@ int dissected_image_acquire_metadata(DissectedImage *m, DissectImageFlags extra_
|
||||
|
||||
for (unsigned k = 0; k < _META_MAX; k++) {
|
||||
_cleanup_close_ int fd = -ENOENT;
|
||||
const char *p;
|
||||
|
||||
if (!paths[k])
|
||||
continue;
|
||||
|
||||
@@ -88,7 +88,7 @@ int fstab_filter_options(
|
||||
char ***ret_values,
|
||||
char **ret_filtered) {
|
||||
|
||||
const char *name, *namefound = NULL, *x;
|
||||
const char *namefound = NULL, *x;
|
||||
_cleanup_strv_free_ char **stor = NULL, **values = NULL;
|
||||
_cleanup_free_ char *value = NULL, **filtered = NULL;
|
||||
int r;
|
||||
@@ -127,17 +127,17 @@ int fstab_filter_options(
|
||||
if (!x)
|
||||
continue;
|
||||
/* Match name, but when ret_values, only when followed by assignment. */
|
||||
if (*x == '=' || (!ret_values && *x == '\0'))
|
||||
if (*x == '=' || (!ret_values && *x == '\0')) {
|
||||
/* Keep the last occurrence found */
|
||||
namefound = name;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
*t = *s;
|
||||
t++;
|
||||
continue;
|
||||
found:
|
||||
/* Keep the last occurrence found */
|
||||
namefound = name;
|
||||
|
||||
if (ret_value || ret_values) {
|
||||
assert(IN_SET(*x, '=', '\0'));
|
||||
|
||||
|
||||
@@ -652,7 +652,7 @@ int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool co
|
||||
|
||||
int hwdb_query(const char *modalias, const char *root) {
|
||||
_cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
|
||||
const char *key, *value, *p;
|
||||
const char *key, *value;
|
||||
int r;
|
||||
|
||||
assert(modalias);
|
||||
@@ -682,7 +682,6 @@ int hwdb_query(const char *modalias, const char *root) {
|
||||
|
||||
bool hwdb_should_reload(sd_hwdb *hwdb) {
|
||||
bool found = false;
|
||||
const char* p;
|
||||
struct stat st;
|
||||
|
||||
if (!hwdb)
|
||||
|
||||
@@ -179,7 +179,6 @@ int raw_strip_suffixes(const char *p, char **ret) {
|
||||
return -ENOMEM;
|
||||
|
||||
for (;;) {
|
||||
const char *sfx;
|
||||
bool changed = false;
|
||||
|
||||
NULSTR_FOREACH(sfx, suffixes) {
|
||||
|
||||
@@ -71,7 +71,6 @@ int get_keymaps(char ***ret) {
|
||||
if (!keymaps)
|
||||
return -ENOMEM;
|
||||
|
||||
const char *dir;
|
||||
NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) {
|
||||
r = recurse_dir_at(
|
||||
AT_FDCWD,
|
||||
@@ -135,7 +134,6 @@ int keymap_exists(const char *name) {
|
||||
if (!keymap_is_valid(name))
|
||||
return -EINVAL;
|
||||
|
||||
const char *dir;
|
||||
NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) {
|
||||
r = recurse_dir_at(
|
||||
AT_FDCWD,
|
||||
|
||||
@@ -1039,7 +1039,6 @@ static int add_syscall_filter_set(
|
||||
bool log_missing,
|
||||
char ***added) {
|
||||
|
||||
const char *sys;
|
||||
int r;
|
||||
|
||||
/* Any syscalls that are handled are added to the *added strv. It needs to be initialized. */
|
||||
@@ -1169,7 +1168,6 @@ int seccomp_parse_syscall_filter(
|
||||
|
||||
if (name[0] == '@') {
|
||||
const SyscallFilterSet *set;
|
||||
const char *i;
|
||||
|
||||
set = syscall_filter_set_find(name);
|
||||
if (!set) {
|
||||
@@ -1909,7 +1907,6 @@ int parse_syscall_archs(char **l, Set **ret_archs) {
|
||||
}
|
||||
|
||||
int seccomp_filter_set_add(Hashmap *filter, bool add, const SyscallFilterSet *set) {
|
||||
const char *i;
|
||||
int r;
|
||||
|
||||
assert(set);
|
||||
@@ -2308,7 +2305,6 @@ int seccomp_suppress_sync(void) {
|
||||
|
||||
SECCOMP_FOREACH_LOCAL_ARCH(arch) {
|
||||
_cleanup_(seccomp_releasep) scmp_filter_ctx seccomp = NULL;
|
||||
const char *c;
|
||||
|
||||
r = seccomp_init_for_arch(&seccomp, arch, SCMP_ACT_ALLOW);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user