1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-31 14:50:15 +03:00

conf-parser: shorten config_parse_string() by using free_and_strdup() and empty_to_null()

This commit is contained in:
Lennart Poettering 2018-05-07 18:18:11 +02:00
parent bf428efb07
commit 5a4ff98840

View File

@ -708,7 +708,7 @@ int config_parse_string(
void *data,
void *userdata) {
char **s = data, *n;
char **s = data;
assert(filename);
assert(lvalue);
@ -720,16 +720,8 @@ int config_parse_string(
return 0;
}
if (isempty(rvalue))
n = NULL;
else {
n = strdup(rvalue);
if (!n)
return log_oom();
}
free(*s);
*s = n;
if (free_and_strdup(s, empty_to_null(rvalue)) < 0)
return log_oom();
return 0;
}