From bf8743c89f67bd0c6016d41ac92ee70e962b74ff Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Feb 2018 20:50:22 +0100 Subject: [PATCH] conf-parse: small prettification Let's use first_word() instead of startswith(), it's more explanatory and a bit more correct. Also, let's use the return value instead of adding +9 when looking for the second part of the directive. --- src/shared/conf-parser.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 8a88820a1..c7b453e8d 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -184,7 +184,7 @@ static int parse_line( char *l, void *userdata) { - char *e; + char *e, *include; assert(filename); assert(line > 0); @@ -198,7 +198,8 @@ static int parse_line( if (strchr(COMMENTS "\n", *l)) return 0; - if (startswith(l, ".include ")) { + include = first_word(l, ".include"); + if (include) { _cleanup_free_ char *fn = NULL; /* .includes are a bad idea, we only support them here @@ -219,7 +220,7 @@ static int parse_line( ".include directives are deprecated, and support for them will be removed in a future version of elogind. " "Please use drop-in files instead."); - fn = file_in_same_dir(filename, strstrip(l+9)); + fn = file_in_same_dir(filename, strstrip(include)); if (!fn) return -ENOMEM; -- 2.30.2