about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-10 22:18:49 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-10 22:18:49 -0400
commit4c346919a9b238748de2ee85ce6d749fc3cf7059 (patch)
tree85cf458d4e935e8f80f73611f4fca68708872204
parente3ebe7db5de64c193202f1c5b321c9a470e730c5 (diff)
downloadmusl-4c346919a9b238748de2ee85ce6d749fc3cf7059.tar.gz
musl-4c346919a9b238748de2ee85ce6d749fc3cf7059.tar.xz
musl-4c346919a9b238748de2ee85ce6d749fc3cf7059.zip
trivial optimization to printf: avoid wasted call frame
amusingly, this cuts more than 10% off the run time of printf("a"); on
the machine i tested it on.

sadly the same optimization is not possible for snprintf without
duplicating all the pseudo-FILE setup code, which is not worth it.
-rw-r--r--src/stdio/printf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/printf.c b/src/stdio/printf.c
index efeb8b33..7b7c329f 100644
--- a/src/stdio/printf.c
+++ b/src/stdio/printf.c
@@ -6,7 +6,7 @@ int printf(const char *fmt, ...)
 	int ret;
 	va_list ap;
 	va_start(ap, fmt);
-	ret = vprintf(fmt, ap);
+	ret = vfprintf(stdout, fmt, ap);
 	va_end(ap);
 	return ret;
 }