summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4152c4f)
raw | patch | inline | side by side (parent: 4152c4f)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Dec 2008 13:09:24 +0000 (14:09 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Dec 2008 13:09:24 +0000 (14:09 +0100) |
src/conf.c | patch | blob | history |
diff --git a/src/conf.c b/src/conf.c
index 27b20242807795ca60a8c7caee83671d9eaa8ad6..0d80ce18427613244dc3354c3d24ea0805e48a72 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
}
while (fgets(line, sizeof(line), file) != NULL) {
- int i;
- int len;
+ char *p = g_strchug(line);
- i = strlen(line);
-
- /* remove trailing whitespace */
- i--;
- while (i >= 0 && g_ascii_isspace(line[i])) {
- line[i] = '\0';
- i--;
- }
-
- len = i + 1;
- if (len > 0) {
- i = 0;
- /* skip whitespace */
- while (i < len && g_ascii_isspace(line[i]))
- i++;
-
- /* continue if this line is not a comment */
- if (line[i] != COMMENT_TOKEN) {
- parse_line(line + i);
- }
- }
+ if (*p != 0 && *p != COMMENT_TOKEN)
+ parse_line(g_strchomp(p));
}
fclose(file);