aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2013-06-13 01:50:40 -0700
committerDima Zavin <dima@android.com>2013-08-05 10:04:29 -0700
commit36c77355330cd4f1f4767f4319d81b59623afd10 (patch)
treeda41eb86d0029b3c912eda79d00b1759b822e930
parente8a9b4b7a47682b59a214b2edad63a635c232a4e (diff)
downloadlk-36c77355330cd4f1f4767f4319d81b59623afd10.tar.gz
[libc][stdio] cleanup printf definition and clients
Move implementation to stdio.c to sit next to the other stdio definitions that use the debug output functions. Keep the declaration of it, though, in printf.h to sit next to sprintf, etc. Don't include printf.h directly in other places, rely on stdio.h to properly pull in these functions. Change-Id: I357cb04a5c78185b8fde908193b672326c2ee542 Signed-off-by: Dima Zavin <dima@android.com>
-rw-r--r--app/app.c2
-rw-r--r--app/stringtests/string_tests.c2
-rw-r--r--app/tests/benchmarks.c2
-rw-r--r--app/tests/clock_tests.c2
-rw-r--r--app/tests/fibo.c2
-rw-r--r--app/tests/printf_tests.c2
-rw-r--r--arch/arm/arm-m/exceptions.c1
-rw-r--r--dev/net/smc91c96/smc91c96.c2
-rw-r--r--include/debug.h1
-rw-r--r--include/dev/usbc.h2
-rw-r--r--include/printf.h1
-rw-r--r--include/stdlib.h1
-rw-r--r--include/trace.h2
-rw-r--r--kernel/debug.c1
-rw-r--r--lib/bio/debug.c1
-rw-r--r--lib/cksum/debug.c2
-rw-r--r--lib/debug/debug.c1
-rw-r--r--lib/debugcommands/debugcommands.c2
-rw-r--r--lib/fs/debug.c1
-rw-r--r--lib/libc/printf.c16
-rw-r--r--lib/libc/stdio.c11
-rw-r--r--lib/partition/partition.c2
-rw-r--r--platform/armemu/debug.c2
-rw-r--r--platform/omap3/debug.c2
-rw-r--r--platform/omap5912/debug.c2
-rw-r--r--platform/pc/debug.c2
-rw-r--r--platform/realview-pb/debug.c2
-rw-r--r--platform/sam3/debug.c2
-rw-r--r--platform/stellaris/debug.c2
-rw-r--r--platform/stm32f1xx/debug.c2
-rw-r--r--platform/stm32f2xx/debug.c2
31 files changed, 39 insertions, 38 deletions
diff --git a/app/app.c b/app/app.c
index a6260217..bef75c7d 100644
--- a/app/app.c
+++ b/app/app.c
@@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <debug.h>
+#include <stdio.h>
#include <app.h>
#include <kernel/thread.h>
diff --git a/app/stringtests/string_tests.c b/app/stringtests/string_tests.c
index 3ba121bc..1f6f75a4 100644
--- a/app/stringtests/string_tests.c
+++ b/app/stringtests/string_tests.c
@@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <debug.h>
+#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <app.h>
diff --git a/app/tests/benchmarks.c b/app/tests/benchmarks.c
index 944066bc..77e62530 100644
--- a/app/tests/benchmarks.c
+++ b/app/tests/benchmarks.c
@@ -21,7 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <sys/types.h>
-#include <debug.h>
+#include <stdio.h>
#include <rand.h>
#include <err.h>
#include <stdlib.h>
diff --git a/app/tests/clock_tests.c b/app/tests/clock_tests.c
index 4e870141..971e873c 100644
--- a/app/tests/clock_tests.c
+++ b/app/tests/clock_tests.c
@@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <debug.h>
+#include <stdio.h>
#include <rand.h>
#include <err.h>
#include <app/tests.h>
diff --git a/app/tests/fibo.c b/app/tests/fibo.c
index 48b7b262..b1120a68 100644
--- a/app/tests/fibo.c
+++ b/app/tests/fibo.c
@@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <debug.h>
+#include <stdio.h>
#include <rand.h>
#include <err.h>
#include <app/tests.h>
diff --git a/app/tests/printf_tests.c b/app/tests/printf_tests.c
index 83a8bbea..d63a2f45 100644
--- a/app/tests/printf_tests.c
+++ b/app/tests/printf_tests.c
@@ -21,7 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <app/tests.h>
-#include <debug.h>
+#include <stdio.h>
#include <string.h>
void printf_tests(void)
diff --git a/arch/arm/arm-m/exceptions.c b/arch/arm/arm-m/exceptions.c
index b8c19644..2597dad1 100644
--- a/arch/arm/arm-m/exceptions.c
+++ b/arch/arm/arm-m/exceptions.c
@@ -21,6 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <debug.h>
+#include <stdio.h>
#include <compiler.h>
#include <stdint.h>
#include <kernel/thread.h>
diff --git a/dev/net/smc91c96/smc91c96.c b/dev/net/smc91c96/smc91c96.c
index a9a9c5a3..9c902e00 100644
--- a/dev/net/smc91c96/smc91c96.c
+++ b/dev/net/smc91c96/smc91c96.c
@@ -23,7 +23,7 @@
#include <sys/types.h>
#include <debug.h>
#include <trace.h>
-#include <printf.h>
+#include <stdio.h>
#include <dev/net/smc91c96.h>
#include "smc91c96_p.h"
diff --git a/include/debug.h b/include/debug.h
index fe9efedc..d5344043 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -27,7 +27,6 @@
#include <stddef.h>
#include <compiler.h>
#include <platform/debug.h>
-#include <printf.h>
__BEGIN_CDECLS
diff --git a/include/dev/usbc.h b/include/dev/usbc.h
index f566190c..cba6b321 100644
--- a/include/dev/usbc.h
+++ b/include/dev/usbc.h
@@ -24,7 +24,7 @@
#define __DEV_USBC_H
#include <sys/types.h>
-#include <debug.h>
+#include <stdio.h>
#include <hw/usb.h>
void usbc_init(void);
diff --git a/include/printf.h b/include/printf.h
index 031af79b..0af44b72 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -25,7 +25,6 @@
#include <stdarg.h>
#include <compiler.h>
-#include <debug.h>
#include <stddef.h>
__BEGIN_CDECLS
diff --git a/include/stdlib.h b/include/stdlib.h
index 92275135..00eaf81f 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <stddef.h>
#include <malloc.h>
-#include <printf.h>
#include <endian.h>
#include <rand.h>
#include <arch/defines.h>
diff --git a/include/trace.h b/include/trace.h
index 7d1c1277..39ce62c6 100644
--- a/include/trace.h
+++ b/include/trace.h
@@ -23,7 +23,7 @@
#ifndef __TRACE_H
#define __TRACE_H
-#include <printf.h>
+#include <stdio.h>
/* trace routines */
#define TRACE_ENTRY printf("%s: entry\n", __PRETTY_FUNCTION__)
diff --git a/kernel/debug.c b/kernel/debug.c
index 706fceb8..a5c54ed4 100644
--- a/kernel/debug.c
+++ b/kernel/debug.c
@@ -32,6 +32,7 @@
*/
#include <debug.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <kernel/timer.h>
#include <kernel/debug.h>
diff --git a/lib/bio/debug.c b/lib/bio/debug.c
index 54611e56..e4bd1a0a 100644
--- a/lib/bio/debug.c
+++ b/lib/bio/debug.c
@@ -21,6 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <debug.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <lib/console.h>
diff --git a/lib/cksum/debug.c b/lib/cksum/debug.c
index f335b514..d3c70ab9 100644
--- a/lib/cksum/debug.c
+++ b/lib/cksum/debug.c
@@ -25,7 +25,7 @@
#include <ctype.h>
#include <debug.h>
#include <stdlib.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <platform.h>
#include <lib/cksum.h>
diff --git a/lib/debug/debug.c b/lib/debug/debug.c
index a0fb8129..bf2777e8 100644
--- a/lib/debug/debug.c
+++ b/lib/debug/debug.c
@@ -25,6 +25,7 @@
#include <debug.h>
#include <stdlib.h>
#include <printf.h>
+#include <stdio.h>
#include <list.h>
#include <string.h>
#include <arch/ops.h>
diff --git a/lib/debugcommands/debugcommands.c b/lib/debugcommands/debugcommands.c
index 275f5bc5..5101469d 100644
--- a/lib/debugcommands/debugcommands.c
+++ b/lib/debugcommands/debugcommands.c
@@ -24,7 +24,7 @@
#include <ctype.h>
#include <debug.h>
#include <stdlib.h>
-#include <printf.h>
+#include <stdio.h>
#include <list.h>
#include <string.h>
#include <arch/ops.h>
diff --git a/lib/fs/debug.c b/lib/fs/debug.c
index 657ba792..15d53b1d 100644
--- a/lib/fs/debug.c
+++ b/lib/fs/debug.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <lib/console.h>
#include <lib/fs.h>
+#include <stdio.h>
#include <stdlib.h>
#include <platform.h>
diff --git a/lib/libc/printf.c b/lib/libc/printf.c
index 2a562683..f208bcb1 100644
--- a/lib/libc/printf.c
+++ b/lib/libc/printf.c
@@ -22,25 +22,13 @@
*/
#include <debug.h>
#include <limits.h>
-#include <stdio.h>
+#include <printf.h>
#include <stdarg.h>
#include <sys/types.h>
-#include <printf.h>
+#include <stdio.h>
#include <string.h>
#include <platform/debug.h>
-int _printf(const char *fmt, ...)
-{
- int err;
-
- va_list ap;
- va_start(ap, fmt);
- err = _dvprintf(fmt, ap);
- va_end(ap);
-
- return err;
-}
-
int sprintf(char *str, const char *fmt, ...)
{
int err;
diff --git a/lib/libc/stdio.c b/lib/libc/stdio.c
index 222cd0b5..a65b30b5 100644
--- a/lib/libc/stdio.c
+++ b/lib/libc/stdio.c
@@ -67,3 +67,14 @@ int getchar(void)
return getc(stdin);
}
+int _printf(const char *fmt, ...)
+{
+ int err;
+
+ va_list ap;
+ va_start(ap, fmt);
+ err = _dvprintf(fmt, ap);
+ va_end(ap);
+
+ return err;
+}
diff --git a/lib/partition/partition.c b/lib/partition/partition.c
index 24200a4e..dfda0a75 100644
--- a/lib/partition/partition.c
+++ b/lib/partition/partition.c
@@ -21,7 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <string.h>
#include <compiler.h>
#include <stdlib.h>
diff --git a/platform/armemu/debug.c b/platform/armemu/debug.c
index 1c2a5603..a7a808a7 100644
--- a/platform/armemu/debug.c
+++ b/platform/armemu/debug.c
@@ -22,7 +22,7 @@
*/
#include <stdarg.h>
#include <reg.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <platform/armemu/memmap.h>
#include <platform/debug.h>
diff --git a/platform/omap3/debug.c b/platform/omap3/debug.c
index cc474da6..4a2b1c5e 100644
--- a/platform/omap3/debug.c
+++ b/platform/omap3/debug.c
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <reg.h>
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <platform/debug.h>
#include <arch/ops.h>
diff --git a/platform/omap5912/debug.c b/platform/omap5912/debug.c
index 83331193..ec156832 100644
--- a/platform/omap5912/debug.c
+++ b/platform/omap5912/debug.c
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <reg.h>
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <kernel/timer.h>
#include <platform/debug.h>
diff --git a/platform/pc/debug.c b/platform/pc/debug.c
index c0ba0c72..2d039012 100644
--- a/platform/pc/debug.c
+++ b/platform/pc/debug.c
@@ -22,7 +22,7 @@
*/
#include <stdarg.h>
#include <reg.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <arch/x86.h>
#include <lib/cbuf.h>
diff --git a/platform/realview-pb/debug.c b/platform/realview-pb/debug.c
index 99c413ab..6a7f0a52 100644
--- a/platform/realview-pb/debug.c
+++ b/platform/realview-pb/debug.c
@@ -22,7 +22,7 @@
*/
#include <stdarg.h>
#include <reg.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <platform/debug.h>
#include <platform/realview-pb.h>
diff --git a/platform/sam3/debug.c b/platform/sam3/debug.c
index b5591e9c..0f7b9e3f 100644
--- a/platform/sam3/debug.c
+++ b/platform/sam3/debug.c
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <reg.h>
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <lib/cbuf.h>
#include <kernel/thread.h>
#include <platform/debug.h>
diff --git a/platform/stellaris/debug.c b/platform/stellaris/debug.c
index e32d21f9..8810bfe8 100644
--- a/platform/stellaris/debug.c
+++ b/platform/stellaris/debug.c
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <reg.h>
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <lib/cbuf.h>
#include <kernel/thread.h>
#include <platform/debug.h>
diff --git a/platform/stm32f1xx/debug.c b/platform/stm32f1xx/debug.c
index fcd35046..f33c4618 100644
--- a/platform/stm32f1xx/debug.c
+++ b/platform/stm32f1xx/debug.c
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <reg.h>
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <platform/debug.h>
#include <arch/ops.h>
diff --git a/platform/stm32f2xx/debug.c b/platform/stm32f2xx/debug.c
index c2ee0c5e..8b326a2b 100644
--- a/platform/stm32f2xx/debug.c
+++ b/platform/stm32f2xx/debug.c
@@ -23,7 +23,7 @@
#include <stdarg.h>
#include <reg.h>
#include <debug.h>
-#include <printf.h>
+#include <stdio.h>
#include <kernel/thread.h>
#include <platform/debug.h>
#include <arch/ops.h>