projects
/
oweals
/
musl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
minor but worthwhile optimization in printf: avoid expensive strspn
[oweals/musl.git]
/
src
/
stdio
/
puts.c
diff --git
a/src/stdio/puts.c
b/src/stdio/puts.c
index eb70efdc217bedb99c9db217d96bc706f688d150..5a38a49b975adcad3192eda3148ef1acf55ad0df 100644
(file)
--- a/
src/stdio/puts.c
+++ b/
src/stdio/puts.c
@@
-2,5
+2,9
@@
int puts(const char *s)
{
- return -(fputs(s, stdout) < 0 || putchar('\n') < 0);
+ int r;
+ FLOCK(stdout);
+ r = -(fputs(s, stdout) < 0 || putc_unlocked('\n', stdout) < 0);
+ FUNLOCK(stdout);
+ return r;
}