mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
basic/log: merge two big log_struct_internal invocations into one
We can take advantage of the fact a NULL argument terminates the list.
This commit is contained in:
parent
ba9534535e
commit
c2dec70292
@ -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);
|
||||
unit_fmt = getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s";
|
||||
|
||||
return r;
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user