X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Finternal%2Fshgetc.h;h=7beb8ce62182b64bb6f7349640b6f2d833b113c3;hb=fcaec912ed406659832f452e71a6c965308362dd;hp=3434cdaa132e197c36753c9efea8907066345e5f;hpb=cc00f05632e5d7cbfb8ce49f4b0dfd59c3cf611d;p=musl diff --git a/src/internal/shgetc.h b/src/internal/shgetc.h index 3434cdaa..7beb8ce6 100644 --- a/src/internal/shgetc.h +++ b/src/internal/shgetc.h @@ -3,23 +3,7 @@ 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--; -} +#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->rend)) +#define shlim(f, lim) __shlim((f), (lim)) +#define shgetc(f) (((f)->rpos < (f)->shend) ? *(f)->rpos++ : __shgetc(f)) +#define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0)