tree-wide: port various parsers over to read_stripped_line()

This commit is contained in:
Lennart Poettering
2023-10-17 14:36:54 +02:00
parent c56cb33f09
commit 0ff6ff2b29
26 changed files with 127 additions and 194 deletions
+2 -6
View File
@@ -268,7 +268,7 @@ int deserialize_read_line(FILE *f, char **ret) {
assert(f);
assert(ret);
r = read_line(f, LONG_LINE_MAX, &line);
r = read_stripped_line(f, LONG_LINE_MAX, &line);
if (r < 0)
return log_error_errno(r, "Failed to read serialization line: %m");
if (r == 0) { /* eof */
@@ -276,15 +276,11 @@ int deserialize_read_line(FILE *f, char **ret) {
return 0;
}
const char *l = strstrip(line);
if (isempty(l)) { /* End marker */
if (isempty(line)) { /* End marker */
*ret = NULL;
return 0;
}
if (free_and_strdup(&line, l) < 0)
return log_oom();
*ret = TAKE_PTR(line);
return 1;
}