summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-10-18 13:37:05 -0400
committerRich Felker <dalias@aerifal.cx>2018-10-18 13:41:25 -0400
commitd8870dcf385a75ae8df2f8bb5bd5ee59525ed348 (patch)
treec92f8ccffd491650b6b487156c4ddb5fec2442aa /src
parenta21a6092cfc0c7e7cb8c0273e5f94d54c0e0eabd (diff)
downloadmusl-d8870dcf385a75ae8df2f8bb5bd5ee59525ed348.tar.gz
optimize internal putc_unlocked macro used in putc
to check whether flush due to line buffering is needed, the int-type character argument must be truncated to unsigned char for comparison. if the original value is subsequently passed to __overflow, it must be preserved, adding to register pressure. since it doesn't matter, truncate all uses so the original value is no longer live.
Diffstat (limited to 'src')
-rw-r--r--src/internal/stdio_impl.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
index 44497344..055ef718 100644
--- a/src/internal/stdio_impl.h
+++ b/src/internal/stdio_impl.h
@@ -106,7 +106,8 @@ hidden void __getopt_msg(const char *, const char *, const char *, size_t);
#define putc_unlocked(c, f) \
( (((unsigned char)(c)!=(f)->lbf && (f)->wpos!=(f)->wend)) \
- ? *(f)->wpos++ = (c) : __overflow((f),(c)) )
+ ? *(f)->wpos++ = (unsigned char)(c) \
+ : __overflow((f),(unsigned char)(c)) )
/* Caller-allocated FILE * operations */
hidden FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t);