diff options
author | Max Kellermann <max@duempel.org> | 2008-12-25 14:09:24 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-25 14:09:24 +0100 |
commit | e131d3f01174e54402c8872d83d9edbc246b38d1 (patch) | |
tree | 8225bed3dcf7291d6043b28bba12ba95e4dd07f9 | |
parent | 4152c4f6b51f576136f901f13605874d951f5ca1 (diff) | |
download | mpd-e131d3f01174e54402c8872d83d9edbc246b38d1.tar.gz mpd-e131d3f01174e54402c8872d83d9edbc246b38d1.tar.xz mpd-e131d3f01174e54402c8872d83d9edbc246b38d1.zip |
conf: use GLib's string stripping functions
-rw-r--r-- | src/conf.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/conf.c b/src/conf.c index 27b202428..0d80ce184 100644 --- a/src/conf.c +++ b/src/conf.c @@ -515,30 +515,10 @@ read_rc_file(char *filename) } 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); |