[MPlayer-cvslog] r34669 - trunk/gui/cfg.c
ib
subversion at mplayerhq.hu
Thu Feb 9 15:26:12 CET 2012
Author: ib
Date: Thu Feb 9 15:26:12 2012
New Revision: 34669
Log:
Simplify end-of-file detection.
Don't double-check foef() and fgetstr(),
because fgetstr() already reports EOF.
Modified:
trunk/gui/cfg.c
Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c Thu Feb 9 15:14:39 2012 (r34668)
+++ trunk/gui/cfg.c Thu Feb 9 15:26:12 2012 (r34669)
@@ -273,12 +273,9 @@ void cfg_read(void)
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 @@ void cfg_read(void)
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 @@ void cfg_read(void)
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);
}
More information about the MPlayer-cvslog
mailing list