summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-02-18 18:27:32 +0100
committerLennart Poettering <lennart@poettering.net>2015-02-18 18:56:27 +0100
commit1cfa9a4cbb41ef770614fa97961cc056a63c1b7c (patch)
treeb0d9a36bd4ac9a1c5a57e54880606c040ab45136 /src
parent1d22e9068c52c1cf935bcdff70b9b9654e3c939e (diff)
systemctl: let's make use of FOREACH_STRING() where we can
Diffstat (limited to 'src')
-rw-r--r--src/shared/log.h12
-rw-r--r--src/systemctl/systemctl.c26
2 files changed, 19 insertions, 19 deletions
diff --git a/src/shared/log.h b/src/shared/log.h
index 2889e1e77f..b323b2f7d4 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -156,12 +156,12 @@ void log_assert_failed_return(
const char *func);
/* Logging with level */
-#define log_full_errno(level, error, ...) \
- ({ \
- int _l = (level), _e = (error); \
- (log_get_max_level() >= LOG_PRI(_l)) \
- ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
- : -abs(_e); \
+#define log_full_errno(level, error, ...) \
+ ({ \
+ int _level = (level), _e = (error); \
+ (log_get_max_level() >= LOG_PRI(_level)) \
+ ? log_internal(_level, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
+ : -abs(_e); \
})
#define log_full(level, ...) log_full_errno(level, 0, __VA_ARGS__)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 21cb898b9a..773b4ccd87 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5771,7 +5771,6 @@ static int get_file_to_edit(const char *name, const char *user_home, const char
return 0;
}
-
static int unit_file_create_dropin(const char *unit_name, const char *user_home, const char *user_runtime, char **ret_new_path, char **ret_tmp_path) {
char *tmp_new_path, *ending;
char *tmp_tmp_path;
@@ -5798,12 +5797,14 @@ static int unit_file_create_dropin(const char *unit_name, const char *user_home,
return 0;
}
-static int unit_file_create_copy(const char *unit_name,
- const char *fragment_path,
- const char *user_home,
- const char *user_runtime,
- char **ret_new_path,
- char **ret_tmp_path) {
+static int unit_file_create_copy(
+ const char *unit_name,
+ const char *fragment_path,
+ const char *user_home,
+ const char *user_runtime,
+ char **ret_new_path,
+ char **ret_tmp_path) {
+
char *tmp_new_path;
char *tmp_tmp_path;
int r;
@@ -5859,9 +5860,8 @@ static int run_editor(char **paths) {
if (pid == 0) {
const char **args;
- char **backup_editors = STRV_MAKE("nano", "vim", "vi");
char *editor;
- char **tmp_path, **original_path, **p;
+ char **tmp_path, **original_path, *p;
unsigned i = 1;
size_t argc;
@@ -5890,9 +5890,9 @@ static int run_editor(char **paths) {
execvp(editor, (char* const*) args);
}
- STRV_FOREACH(p, backup_editors) {
- args[0] = *p;
- execvp(*p, (char* const*) args);
+ FOREACH_STRING(p, "nano", "vim", "vi") {
+ args[0] = p;
+ execvp(p, (char* const*) args);
/* We do not fail if the editor doesn't exist
* because we want to try each one of them before
* failing.
@@ -5903,7 +5903,7 @@ static int run_editor(char **paths) {
}
}
- log_error("Cannot edit unit(s), no editor available. Please set either $SYSTEMD_EDITOR or $EDITOR or $VISUAL.");
+ log_error("Cannot edit unit(s), no editor available. Please set either $SYSTEMD_EDITOR, $EDITOR or $VISUAL.");
_exit(EXIT_FAILURE);
}