summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2016-06-19 18:55:35 -0300
committerGitHub <noreply@github.com>2016-06-19 18:55:35 -0300
commit0fa03322a935a6ffc564852068f13302f3dd1e72 (patch)
tree2f7fc7ef742e55a46cec55fac9114256c68cb002 /Settings.c
parent52f814481cdfa4be2290953978a81014f8bfd391 (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.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Settings.c b/Settings.c
index eaca7829..0e296c10 100644
--- a/Settings.c
+++ b/Settings.c
@@ -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;

© 2014-2024 Faster IT GmbH | imprint | privacy policy