[pacman-dev] [PATCH] pactree: allow comments after repo section header
Allan McRae
allan at archlinux.org
Sat Feb 11 02:31:24 EST 2012
Duplicate the fix in config file parsing from d95c0494.
Signed-off-by: Allan McRae <allan at archlinux.org>
---
src/util/pactree.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/util/pactree.c b/src/util/pactree.c
index a7dab9f..aa02c80 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -168,17 +168,17 @@ static int register_syncs(void) {
size_t linelen;
char *ptr;
+ /* ignore whole line and end of line comments */
+ if((ptr = strchr(line, '#'))) {
+ *ptr = '\0';
+ }
+
linelen = strtrim(line);
- if(line[0] == '#' || !linelen) {
+ if(linelen == 0) {
continue;
}
- if((ptr = strchr(line, '#'))) {
- *ptr = '\0';
- linelen = strtrim(line);
- }
-
if(line[0] == '[' && line[linelen - 1] == ']') {
free(section);
section = strndup(&line[1], linelen - 2);
--
1.7.9
More information about the pacman-dev
mailing list