diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-12-02 20:55:38 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-12-02 20:55:38 +0100 |
commit | 5742f90fdcbeda996e2dd69c5c3da2da99c44a41 (patch) | |
tree | 53073ae0528824fe0f2a435ac10db070722a67fb /FICS/lists.c | |
parent | a5b487dfe4b4b065a6cde35f9385926719478c91 (diff) |
list_find: changed while loop
Diffstat (limited to 'FICS/lists.c')
-rw-r--r-- | FICS/lists.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/FICS/lists.c b/FICS/lists.c index 5f93baf..c76e645 100644 --- a/FICS/lists.c +++ b/FICS/lists.c @@ -89,11 +89,9 @@ list_find(int p, enum ListWhich l) rfree(tempList); return NULL; } - while (!feof(fp)) { - if (fgets(listmember, 100, fp) != NULL) { - listmember[strlen(listmember) - 1] = '\0'; - tempList->member[count++] = xstrdup(listmember); - } + while (fgets(listmember, ARRAY_SIZE(listmember), fp) != NULL) { + listmember[strcspn(listmember, "\n")] = '\0'; + tempList->member[count++] = xstrdup(listmember); } fclose(fp); |