if (!*l)
return 0;
- if (strchr(COMMENTS "\n", *l))
+ if (*l == '\n')
return 0;
include = first_word(l, ".include");
return r;
}
+ if (strchr(COMMENTS, *buf))
+ continue;
+
l = buf;
if (!(flags & CONFIG_PARSE_REFUSE_BOM)) {
char *q;
"2\\\n"
"3\n",
+ "[Section]\n"
+ "#hogehoge\\\n" /* continuation is ignored in comment */
+ "setting1=1\\\n" /* normal continuation */
+ "2\\\n"
+ "3\n",
+
+ "[Section]\n"
+ "setting1=1\\\n" /* normal continuation */
+ "#hogehoge\\\n" /* commented out line in continuation is ignored */
+ "2\\\n"
+ "3\n",
+
"[Section]\n"
"setting1=1\\\n" /* continuation with extra trailing backslash at the end */
"2\\\n"
assert_se(streq(setting1, "1"));
break;
- case 4 ... 5:
+ case 4 ... 7:
assert_se(r == 0);
assert_se(streq(setting1, "1 2 3"));
break;
- case 6:
+ case 8:
assert_se(r == 0);
assert_se(streq(setting1, "1\\\\ \\\\2"));
break;
- case 7:
+ case 9:
assert_se(r == 0);
assert_se(streq(setting1, x1000("ABCD")));
break;
- case 8 ... 9:
+ case 10 ... 11:
assert_se(r == 0);
assert_se(streq(setting1, x1000("ABCD") " foobar"));
break;
- case 10 ... 11:
+ case 12 ... 13:
assert_se(r == -ENOBUFS);
assert_se(setting1 == NULL);
break;