mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #11441 from poettering/foreach-string-rework
FOREACH_STRING() rework
This commit is contained in:
@@ -156,17 +156,10 @@ void strv_print(char **l);
|
||||
_found; \
|
||||
})
|
||||
|
||||
#define FOREACH_STRING(x, ...) \
|
||||
for (char **_l = ({ \
|
||||
char **_ll = STRV_MAKE(__VA_ARGS__); \
|
||||
x = _ll ? _ll[0] : NULL; \
|
||||
_ll; \
|
||||
}); \
|
||||
_l && *_l; \
|
||||
x = ({ \
|
||||
_l ++; \
|
||||
_l[0]; \
|
||||
}))
|
||||
#define FOREACH_STRING(x, y, ...) \
|
||||
for (char **_l = STRV_MAKE(({ x = y; }), ##__VA_ARGS__); \
|
||||
x; \
|
||||
x = *(++_l))
|
||||
|
||||
char **strv_reverse(char **l);
|
||||
char **strv_shell_escape(char **l, const char *bad);
|
||||
|
||||
@@ -1964,11 +1964,11 @@ static int setup_hostname(void) {
|
||||
}
|
||||
|
||||
static int setup_journal(const char *directory) {
|
||||
sd_id128_t this_id;
|
||||
_cleanup_free_ char *d = NULL;
|
||||
const char *p, *q;
|
||||
const char *dirname, *p, *q;
|
||||
sd_id128_t this_id;
|
||||
char id[33];
|
||||
bool try;
|
||||
char id[33], *dirname;
|
||||
int r;
|
||||
|
||||
/* Don't link journals in ephemeral mode */
|
||||
|
||||
@@ -6933,9 +6933,9 @@ static int run_editor(char **paths) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0) {
|
||||
char **editor_args = NULL, **tmp_path, **original_path, *p;
|
||||
char **editor_args = NULL, **tmp_path, **original_path;
|
||||
size_t n_editor_args = 0, i = 1, argc;
|
||||
const char **args, *editor;
|
||||
const char **args, *editor, *p;
|
||||
|
||||
argc = strv_length(paths)/2 + 1;
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ static bool check_user_has_group_with_same_name(const char *name) {
|
||||
}
|
||||
|
||||
static bool is_inaccessible_available(void) {
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
FOREACH_STRING(p,
|
||||
"/run/systemd/inaccessible/reg",
|
||||
|
||||
Reference in New Issue
Block a user