mirror of
https://github.com/fluencelabs/musl
synced 2025-06-08 04:21:39 +00:00
26 lines
394 B
C
26 lines
394 B
C
|
#include "stdio_impl.h"
|
||
|
|
||
|
void __shlim(FILE *, off_t);
|
||
|
int __shgetc(FILE *);
|
||
|
|
||
|
static inline off_t shcnt(FILE *f)
|
||
|
{
|
||
|
return f->shcnt + (f->rpos - f->rend);
|
||
|
}
|
||
|
|
||
|
static inline void shlim(FILE *f, off_t lim)
|
||
|
{
|
||
|
__shlim(f, lim);
|
||
|
}
|
||
|
|
||
|
static inline int shgetc(FILE *f)
|
||
|
{
|
||
|
if (f->rpos < f->shend) return *f->rpos++;
|
||
|
return __shgetc(f);
|
||
|
}
|
||
|
|
||
|
static inline void shunget(FILE *f)
|
||
|
{
|
||
|
if (f->rend) f->rpos--;
|
||
|
}
|