Skip to content

Commit a05075a

Browse files
committed
Read int from fgetc for EOF comparison - fixes #365
Signed-off-by: Benn Snyder <benn.snyder@gmail.com>
1 parent 9abd651 commit a05075a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

fakenect/fakenect.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ static char *one_line(FILE *fp)
9898
{
9999
int pos = 0;
100100
char *out = NULL;
101-
char c;
102-
while ((c = fgetc(fp))) {
103-
if (c == '\n' || c == EOF)
104-
break;
101+
for (int c = fgetc(fp); !(c == '\n' || c == EOF); c = fgetc(fp))
102+
{
105103
out = realloc(out, pos + 1);
106104
out[pos++] = c;
107105
}

0 commit comments

Comments
 (0)