# HG changeset patch # User ib # Date 1328797572 0 # Node ID dba158d9b986ae7181908518f6d34bf11562b705 # Parent 065029b847e5a3dc5f440e00aa3b7b0244c18fdd Simplify end-of-file detection. Don't double-check foef() and fgetstr(), because fgetstr() already reports EOF. diff -r 065029b847e5 -r dba158d9b986 gui/cfg.c --- a/gui/cfg.c Thu Feb 09 14:14:39 2012 +0000 +++ b/gui/cfg.c Thu Feb 09 14:26:12 2012 +0000 @@ -273,12 +273,9 @@ file = fopen(fname, "rt"); if (file) { - while (!feof(file)) { + while (fgetstr(line, sizeof(line), file)) { plItem *item; - if (fgetstr(line, sizeof(line), file) == NULL) - continue; - item = calloc(1, sizeof(plItem)); item->path = strdup(line); fgetstr(line, sizeof(line), file); @@ -297,12 +294,9 @@ file = fopen(fname, "rt"); if (file) { - while (!feof(file)) { + while (fgetstr(line, sizeof(line), file)) { urlItem *item; - if (fgetstr(line, sizeof(line), file) == NULL) - continue; - item = calloc(1, sizeof(urlItem)); item->url = strdup(line); listSet(gtkAddURLItem, item); @@ -321,12 +315,8 @@ if (file) { int i = 0; - while (!feof(file)) { - if (fgetstr(line, sizeof(line), file) == NULL) - continue; - + while (fgetstr(line, sizeof(line), file)) fsHistory[i++] = gstrdup(line); - } fclose(file); }