mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
Make *printf() return "int" instead of "void"
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>
This commit is contained in:
parent
c0c15379e2
commit
d9c27253ce
4 changed files with 18 additions and 12 deletions
|
@ -201,7 +201,7 @@ static inline void console_doenv(int file, struct stdio_dev *dev)
|
||||||
|
|
||||||
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
|
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
|
||||||
|
|
||||||
void serial_printf(const char *fmt, ...)
|
int serial_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -216,6 +216,7 @@ void serial_printf(const char *fmt, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
serial_puts(printbuffer);
|
serial_puts(printbuffer);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgetc(int file)
|
int fgetc(int file)
|
||||||
|
@ -269,7 +270,7 @@ void fputs(int file, const char *s)
|
||||||
console_puts(file, s);
|
console_puts(file, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fprintf(int file, const char *fmt, ...)
|
int fprintf(int file, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -285,6 +286,7 @@ void fprintf(int file, const char *fmt, ...)
|
||||||
|
|
||||||
/* Send to desired file */
|
/* Send to desired file */
|
||||||
fputs(file, printbuffer);
|
fputs(file, printbuffer);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/
|
/** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/
|
||||||
|
@ -363,7 +365,7 @@ void puts(const char *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printf(const char *fmt, ...)
|
int printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -379,9 +381,10 @@ void printf(const char *fmt, ...)
|
||||||
|
|
||||||
/* Print the string */
|
/* Print the string */
|
||||||
puts(printbuffer);
|
puts(printbuffer);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vprintf(const char *fmt, va_list args)
|
int vprintf(const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
char printbuffer[CONFIG_SYS_PBSIZE];
|
char printbuffer[CONFIG_SYS_PBSIZE];
|
||||||
|
@ -393,6 +396,7 @@ void vprintf(const char *fmt, va_list args)
|
||||||
|
|
||||||
/* Print the string */
|
/* Print the string */
|
||||||
puts(printbuffer);
|
puts(printbuffer);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test if ctrl-c was pressed */
|
/* test if ctrl-c was pressed */
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
/*
|
/*
|
||||||
* printf() and vprintf() are stolen from u-boot/common/console.c
|
* printf() and vprintf() are stolen from u-boot/common/console.c
|
||||||
*/
|
*/
|
||||||
void printf (const char *fmt, ...)
|
int printf (const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -53,9 +53,10 @@ void printf (const char *fmt, ...)
|
||||||
|
|
||||||
/* Print the string */
|
/* Print the string */
|
||||||
ub_puts (printbuffer);
|
ub_puts (printbuffer);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vprintf (const char *fmt, va_list args)
|
int vprintf (const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
char printbuffer[256];
|
char printbuffer[256];
|
||||||
|
@ -67,6 +68,7 @@ void vprintf (const char *fmt, va_list args)
|
||||||
|
|
||||||
/* Print the string */
|
/* Print the string */
|
||||||
ub_puts (printbuffer);
|
ub_puts (printbuffer);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void putc (const char c)
|
void putc (const char c)
|
||||||
|
|
|
@ -663,7 +663,7 @@ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
|
||||||
* STDIO based functions (can always be used)
|
* STDIO based functions (can always be used)
|
||||||
*/
|
*/
|
||||||
/* serial stuff */
|
/* serial stuff */
|
||||||
void serial_printf (const char *fmt, ...)
|
int serial_printf (const char *fmt, ...)
|
||||||
__attribute__ ((format (__printf__, 1, 2)));
|
__attribute__ ((format (__printf__, 1, 2)));
|
||||||
/* stdin */
|
/* stdin */
|
||||||
int getc(void);
|
int getc(void);
|
||||||
|
@ -672,9 +672,9 @@ int tstc(void);
|
||||||
/* stdout */
|
/* stdout */
|
||||||
void putc(const char c);
|
void putc(const char c);
|
||||||
void puts(const char *s);
|
void puts(const char *s);
|
||||||
void printf(const char *fmt, ...)
|
int printf(const char *fmt, ...)
|
||||||
__attribute__ ((format (__printf__, 1, 2)));
|
__attribute__ ((format (__printf__, 1, 2)));
|
||||||
void vprintf(const char *fmt, va_list args);
|
int vprintf(const char *fmt, va_list args);
|
||||||
|
|
||||||
/* stderr */
|
/* stderr */
|
||||||
#define eputc(c) fputc(stderr, c)
|
#define eputc(c) fputc(stderr, c)
|
||||||
|
@ -689,7 +689,7 @@ void vprintf(const char *fmt, va_list args);
|
||||||
#define stderr 2
|
#define stderr 2
|
||||||
#define MAX_FILES 3
|
#define MAX_FILES 3
|
||||||
|
|
||||||
void fprintf(int file, const char *fmt, ...)
|
int fprintf(int file, const char *fmt, ...)
|
||||||
__attribute__ ((format (__printf__, 2, 3)));
|
__attribute__ ((format (__printf__, 2, 3)));
|
||||||
void fputs(int file, const char *s);
|
void fputs(int file, const char *s);
|
||||||
void fputc(int file, const char c);
|
void fputc(int file, const char c);
|
||||||
|
|
|
@ -11,14 +11,14 @@ int getc(void);
|
||||||
int tstc(void);
|
int tstc(void);
|
||||||
void putc(const char);
|
void putc(const char);
|
||||||
void puts(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 install_hdlr(int, interrupt_handler_t*, void*);
|
||||||
void free_hdlr(int);
|
void free_hdlr(int);
|
||||||
void *malloc(size_t);
|
void *malloc(size_t);
|
||||||
void free(void*);
|
void free(void*);
|
||||||
void __udelay(unsigned long);
|
void __udelay(unsigned long);
|
||||||
unsigned long get_timer(unsigned long);
|
unsigned long get_timer(unsigned long);
|
||||||
void vprintf(const char *, va_list);
|
int vprintf(const char *, va_list);
|
||||||
void do_reset (void);
|
void do_reset (void);
|
||||||
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
|
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
|
||||||
char *getenv (char *name);
|
char *getenv (char *name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue