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
+4 -6
View File
@@ -79,22 +79,20 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
log_debug("apply: %s", pp);
for (;;) {
_cleanup_free_ char *line = NULL;
char *l;
int k;
k = read_line(f, LONG_LINE_MAX, &line);
k = read_stripped_line(f, LONG_LINE_MAX, &line);
if (k < 0)
return log_error_errno(k, "Failed to read file '%s': %m", pp);
if (k == 0)
break;
l = strstrip(line);
if (isempty(l))
if (isempty(line))
continue;
if (strchr(COMMENTS, *l))
if (strchr(COMMENTS, *line))
continue;
k = module_load_and_warn(ctx, l, true);
k = module_load_and_warn(ctx, line, true);
if (k == -ENOENT)
continue;
RET_GATHER(r, k);