summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0c1537)
raw | patch | inline | side by side (parent: c0c1537)
author | Wolfgang Denk <wd@denx.de> | |
Sun, 20 Jun 2010 15:14:14 +0000 (17:14 +0200) | ||
committer | Wolfgang Denk <wd@denx.de> | |
Sun, 4 Jul 2010 21:51:49 +0000 (23:51 +0200) |
Change the return type of the *printf() functions to the standard
"int"; no changes are needed but returning the already available
length count.
This will save a few additional strlen() calls later...
Signed-off-by: Wolfgang Denk <wd@denx.de>
"int"; no changes are needed but returning the already available
length count.
This will save a few additional strlen() calls later...
Signed-off-by: Wolfgang Denk <wd@denx.de>
common/console.c | patch | blob | history | |
examples/api/libgenwrap.c | patch | blob | history | |
include/common.h | patch | blob | history | |
include/exports.h | patch | blob | history |
diff --git a/common/console.c b/common/console.c
index b09b7d15dbc83ceda10fdf2ce5489591d56094c8..7e018863bd3e0bdf85a294f74470df446458ef5b 100644 (file)
--- a/common/console.c
+++ b/common/console.c
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
-void serial_printf(const char *fmt, ...)
+int serial_printf(const char *fmt, ...)
{
va_list args;
uint i;
va_end(args);
serial_puts(printbuffer);
+ return i;
}
int fgetc(int file)
console_puts(file, s);
}
-void fprintf(int file, const char *fmt, ...)
+int fprintf(int file, const char *fmt, ...)
{
va_list args;
uint i;
/* Send to desired file */
fputs(file, printbuffer);
+ return i;
}
/** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/
}
}
-void printf(const char *fmt, ...)
+int printf(const char *fmt, ...)
{
va_list args;
uint i;
/* Print the string */
puts(printbuffer);
+ return i;
}
-void vprintf(const char *fmt, va_list args)
+int vprintf(const char *fmt, va_list args)
{
uint i;
char printbuffer[CONFIG_SYS_PBSIZE];
/* Print the string */
puts(printbuffer);
+ return i;
}
/* test if ctrl-c was pressed */
index b435ddecba304a25d828a9495c9f4d4a64ce004c..9733bbc52e32a85e75b35ea1ae56b95f750bc3b1 100644 (file)
/*
* printf() and vprintf() are stolen from u-boot/common/console.c
*/
-void printf (const char *fmt, ...)
+int printf (const char *fmt, ...)
{
va_list args;
uint i;
/* Print the string */
ub_puts (printbuffer);
+ return i;
}
-void vprintf (const char *fmt, va_list args)
+int vprintf (const char *fmt, va_list args)
{
uint i;
char printbuffer[256];
/* Print the string */
ub_puts (printbuffer);
+ return i;
}
void putc (const char c)
diff --git a/include/common.h b/include/common.h
index 8bca04fdd747738e85bc1144f8533452116c8a20..48f6a1a07438092b40fd4e681cbf1558ea4fabb3 100644 (file)
--- a/include/common.h
+++ b/include/common.h
* STDIO based functions (can always be used)
*/
/* serial stuff */
-void serial_printf (const char *fmt, ...)
+int serial_printf (const char *fmt, ...)
__attribute__ ((format (__printf__, 1, 2)));
/* stdin */
int getc(void);
/* stdout */
void putc(const char c);
void puts(const char *s);
-void printf(const char *fmt, ...)
+int printf(const char *fmt, ...)
__attribute__ ((format (__printf__, 1, 2)));
-void vprintf(const char *fmt, va_list args);
+int vprintf(const char *fmt, va_list args);
/* stderr */
#define eputc(c) fputc(stderr, c)
#define stderr 2
#define MAX_FILES 3
-void fprintf(int file, const char *fmt, ...)
+int fprintf(int file, const char *fmt, ...)
__attribute__ ((format (__printf__, 2, 3)));
void fputs(int file, const char *s);
void fputc(int file, const char c);
diff --git a/include/exports.h b/include/exports.h
index c3a5d2f32e76903927e723642401ac29668f0f4b..9588bc94e43cdf3d3989ee1369fb12cb6b0fbfc6 100644 (file)
--- a/include/exports.h
+++ b/include/exports.h
int tstc(void);
void putc(const char);
void puts(const char*);
-void printf(const char* fmt, ...);
+int printf(const char* fmt, ...);
void install_hdlr(int, interrupt_handler_t*, void*);
void free_hdlr(int);
void *malloc(size_t);
void free(void*);
void __udelay(unsigned long);
unsigned long get_timer(unsigned long);
-void vprintf(const char *, va_list);
+int vprintf(const char *, va_list);
void do_reset (void);
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
char *getenv (char *name);