blob: 5d1fc06ccc29f8fa571fdf1d30c2ae0635d3c2e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/*
* fgetc.c
*/
#include "stdioint.h"
int fgetc(FILE *file)
{
struct _IO_file_pvt *f = stdio_pvt(file);
unsigned char ch;
if (__likely(f->ibytes)) {
f->ibytes--;
return (unsigned char) *f->data++;
} else {
return _fread(&ch, 1, file) == 1 ? ch : EOF;
}
}
__ALIAS(int, fgetc_unlocked, (FILE *), fgetc)
|