summaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-13 03:59:36 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-13 03:59:36 -0400
commit26832d045f46e68b79277916edbad7512d253704 (patch)
treef09be22ac676a2419d7a7dc571d1223580ecb942 /src/internal
parent54222d1efc5239d3fc8c528672bd52bfd8dad813 (diff)
downloadmusl-26832d045f46e68b79277916edbad7512d253704.tar.gz
musl-26832d045f46e68b79277916edbad7512d253704.tar.bz2
musl-26832d045f46e68b79277916edbad7512d253704.tar.xz
musl-26832d045f46e68b79277916edbad7512d253704.zip
use macros instead of inline functions in shgetc.h
at -Os optimization level, gcc refuses to inline these functions even though the inlined code would roughly the same size as the function call, and much faster. the easy solution is to make them into macros.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/shgetc.h24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/internal/shgetc.h b/src/internal/shgetc.h
index 3434cdaa..0543cb0d 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)->rend ? (void)(f)->rpos-- : (void)0)