summaryrefslogtreecommitdiff
path: root/src/basic/log.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-11 14:34:45 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-11 15:43:16 -0500
commitc2dec7029251d64692d14da800c02200ac621346 (patch)
treeac5122377569555f71608806af3eace004b14817 /src/basic/log.c
parentba9534535e1dfe77b28d281658945d019a171452 (diff)
basic/log: merge two big log_struct_internal invocations into one
We can take advantage of the fact a NULL argument terminates the list.
Diffstat (limited to 'src/basic/log.c')
-rw-r--r--src/basic/log.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index f5cff4cc9f..9febe391ac 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -1134,8 +1134,8 @@ int log_syntax_internal(
PROTECT_ERRNO;
char buffer[LINE_MAX];
- int r;
va_list ap;
+ const char *unit_fmt = NULL;
if (error < 0)
error = -error;
@@ -1154,24 +1154,15 @@ int log_syntax_internal(
va_end(ap);
if (unit)
- r = log_struct_internal(
- level, error,
- file, line, func,
- getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s", unit,
- LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION),
- "CONFIG_FILE=%s", config_file,
- "CONFIG_LINE=%u", config_line,
- LOG_MESSAGE("[%s:%u] %s", config_file, config_line, buffer),
- NULL);
- else
- r = log_struct_internal(
- level, error,
- file, line, func,
- LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION),
- "CONFIG_FILE=%s", config_file,
- "CONFIG_LINE=%u", config_line,
- LOG_MESSAGE("[%s:%u] %s", config_file, config_line, buffer),
- NULL);
-
- return r;
+ unit_fmt = getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s";
+
+ return log_struct_internal(
+ level, error,
+ file, line, func,
+ LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION),
+ "CONFIG_FILE=%s", config_file,
+ "CONFIG_LINE=%u", config_line,
+ LOG_MESSAGE("[%s:%u] %s", config_file, config_line, buffer),
+ unit_fmt, unit,
+ NULL);
}