diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2016-06-19 18:55:35 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-19 18:55:35 -0300 |
commit | 0fa03322a935a6ffc564852068f13302f3dd1e72 (patch) | |
tree | 2f7fc7ef742e55a46cec55fac9114256c68cb002 /Settings.c | |
parent | 52f814481cdfa4be2290953978a81014f8bfd391 (diff) |
Dynamically adjust the size of line reads
* Dynamically adjust the size of line reads.
* Remove some more uses of fgets with arbitrary sizes.
* Fix reading of lines and width of n column.
Fixes #514.
Diffstat (limited to 'Settings.c')
-rw-r--r-- | Settings.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -173,12 +173,15 @@ static bool Settings_read(Settings* this, const char* fileName) { if (!fd) return false; - const int maxLine = 2048; - char buffer[maxLine]; bool readMeters = false; - while (fgets(buffer, maxLine, fd)) { + for (;;) { + char* line = String_readLine(fd); + if (!line) { + break; + } int nOptions; - char** option = String_split(buffer, '=', &nOptions); + char** option = String_split(line, '=', &nOptions); + free (line); if (nOptions < 2) { String_freeArray(option); continue; |