summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2005-12-09 13:52:08 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2005-12-09 13:52:08 +0000
commit60acdef20530daeaa65cbce8bb2a14c22bc0ed00 (patch)
tree6d1fff9381cd8f517706bf8de2e0a875f6688b35 /libc/stdio
parent1b3c855bc3dff600ee36bbafc3b3ad2d471d8df4 (diff)
Implement all needed hidden *printf and correct vasprintf, thx blindvt
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/_stdio.h11
-rw-r--r--libc/stdio/fprintf.c5
-rw-r--r--libc/stdio/old_vfprintf.c3
-rw-r--r--libc/stdio/printf.c5
-rw-r--r--libc/stdio/snprintf.c5
-rw-r--r--libc/stdio/sprintf.c5
-rw-r--r--libc/stdio/vasprintf.c8
-rw-r--r--libc/stdio/vdprintf.c2
-rw-r--r--libc/stdio/vfprintf.c5
-rw-r--r--libc/stdio/vprintf.c2
-rw-r--r--libc/stdio/vsnprintf.c15
-rw-r--r--libc/stdio/vsprintf.c2
-rw-r--r--libc/stdio/vswprintf.c2
-rw-r--r--libc/stdio/vwprintf.c2
-rw-r--r--libc/stdio/wprintf.c2
15 files changed, 48 insertions, 26 deletions
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index e4aa5d740..7dd105cce 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -19,6 +19,17 @@
#include <string.h>
#include <unistd.h>
+extern int __vfprintf (FILE *__restrict __s, __const char *__restrict __format,
+ __gnuc_va_list __arg) attribute_hidden;
+
+extern int __vsnprintf (char *__restrict __s, size_t __maxlen,
+ __const char *__restrict __format, __gnuc_va_list __arg)
+ __THROW __attribute__ ((__format__ (__printf__, 3, 0))) attribute_hidden;
+
+extern int __vfwprintf (__FILE *__restrict __s,
+ __const wchar_t *__restrict __format,
+ __gnuc_va_list __arg) attribute_hidden;
+
#ifdef __UCLIBC_HAS_WCHAR__
#include <wchar.h>
#endif
diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c
index 388eb0c3b..07769bb59 100644
--- a/libc/stdio/fprintf.c
+++ b/libc/stdio/fprintf.c
@@ -8,14 +8,15 @@
#include "_stdio.h"
#include <stdarg.h>
-int fprintf(FILE * __restrict stream, const char * __restrict format, ...)
+int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = vfprintf(stream, format, arg);
+ rv = __vfprintf(stream, format, arg);
va_end(arg);
return rv;
}
+strong_alias(__fprintf,fprintf)
diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c
index a9e452880..8b54ca849 100644
--- a/libc/stdio/old_vfprintf.c
+++ b/libc/stdio/old_vfprintf.c
@@ -341,7 +341,7 @@ static const char u_spec[] = "%nbopxXudics";
/* u_radix[i] <-> u_spec[i+2] for unsigned entries only */
static const char u_radix[] = "\x02\x08\x10\x10\x10\x0a";
-int vfprintf(FILE * __restrict op, register const char * __restrict fmt,
+int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __restrict fmt,
va_list ap)
{
union {
@@ -711,3 +711,4 @@ int vfprintf(FILE * __restrict op, register const char * __restrict fmt,
return i;
}
+strong_alias(__vfprintf,vfprintf)
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 67db4b384..82326a9c3 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -8,14 +8,15 @@
#include "_stdio.h"
#include <stdarg.h>
-int printf(const char * __restrict format, ...)
+int attribute_hidden __printf(const char * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = vfprintf(stdout, format, arg);
+ rv = __vfprintf(stdout, format, arg);
va_end(arg);
return rv;
}
+strong_alias(__printf,printf)
diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c
index a827971ba..a1ea79fc0 100644
--- a/libc/stdio/snprintf.c
+++ b/libc/stdio/snprintf.c
@@ -12,16 +12,17 @@
#warning Skipping snprintf since no vsnprintf!
#else
-int snprintf(char *__restrict buf, size_t size,
+int attribute_hidden __snprintf(char *__restrict buf, size_t size,
const char * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = vsnprintf(buf, size, format, arg);
+ rv = __vsnprintf(buf, size, format, arg);
va_end(arg);
return rv;
}
+strong_alias(__snprintf,snprintf)
#endif
diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c
index eb83f424a..5778c011d 100644
--- a/libc/stdio/sprintf.c
+++ b/libc/stdio/sprintf.c
@@ -12,16 +12,17 @@
#warning Skipping sprintf since no vsnprintf!
#else
-int sprintf(char *__restrict buf, const char * __restrict format, ...)
+int attribute_hidden __sprintf(char *__restrict buf, const char * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = vsnprintf(buf, SIZE_MAX, format, arg);
+ rv = __vsnprintf(buf, SIZE_MAX, format, arg);
va_end(arg);
return rv;
}
+strong_alias(__sprintf,sprintf)
#endif
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c
index 8aa2c9a7f..ca110cbd1 100644
--- a/libc/stdio/vasprintf.c
+++ b/libc/stdio/vasprintf.c
@@ -32,7 +32,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict
*buf = NULL;
if ((f = open_memstream(buf, &size)) != NULL) {
- rv = vfprintf(f, format, arg);
+ rv = __vfprintf(f, format, arg);
fclose(f);
if (rv < 0) {
free(*buf);
@@ -54,14 +54,14 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict
int rv;
va_copy(arg2, arg);
- rv = vsnprintf(NULL, 0, format, arg2);
+ rv = __vsnprintf(NULL, 0, format, arg2);
va_end(arg2);
*buf = NULL;
if (rv >= 0) {
if ((*buf = malloc(++rv)) != NULL) {
- if ((rv = vsnprintf(*buf, rv, format, arg)) < 0) {
+ if ((rv = __vsnprintf(*buf, rv, format, arg)) < 0) {
free(*buf);
*buf = NULL;
}
@@ -73,7 +73,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict
return rv;
#endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */
-strong_alias(__vasprintf,vasprintf)
}
+strong_alias(__vasprintf,vasprintf)
#endif
diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c
index 5628738b1..1822f69b7 100644
--- a/libc/stdio/vdprintf.c
+++ b/libc/stdio/vdprintf.c
@@ -47,7 +47,7 @@ int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_
#endif
f.__nextopen = NULL;
- rv = vfprintf(&f, format, arg);
+ rv = __vfprintf(&f, format, arg);
#ifdef __STDIO_BUFFERS
/* If not buffering, then fflush is unnecessary. */
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index 793b991c5..11fe926a0 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -1195,6 +1195,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad);
#ifdef L_vfprintf
+#define HIDDEN_VFPRINTF __vfprintf
#define VFPRINTF vfprintf
#define FMT_TYPE char
#define OUTNSTR _outnstr
@@ -1227,6 +1228,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf
#else /* L_vfprintf */
+#define HIDDEN_VFPRINTF __vfwprintf
#define VFPRINTF vfwprintf
#define FMT_TYPE wchar_t
#define OUTNSTR _outnwcs
@@ -1844,7 +1846,7 @@ static int _do_one_spec(FILE * __restrict stream,
return 0;
}
-int VFPRINTF (FILE * __restrict stream,
+int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream,
register const FMT_TYPE * __restrict format,
va_list arg)
{
@@ -1921,5 +1923,6 @@ int VFPRINTF (FILE * __restrict stream,
return count;
}
+strong_alias(HIDDEN_VFPRINTF,VFPRINTF)
#endif
/**********************************************************************/
diff --git a/libc/stdio/vprintf.c b/libc/stdio/vprintf.c
index 45d580faa..9c0e07514 100644
--- a/libc/stdio/vprintf.c
+++ b/libc/stdio/vprintf.c
@@ -10,5 +10,5 @@
int vprintf(const char * __restrict format, va_list arg)
{
- return vfprintf(stdout, format, arg);
+ return __vfprintf(stdout, format, arg);
}
diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c
index ffe33ada3..6fcc84f2b 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -14,7 +14,7 @@
#ifdef __STDIO_BUFFERS
-int vsnprintf(char *__restrict buf, size_t size,
+int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
{
FILE f;
@@ -57,7 +57,7 @@ int vsnprintf(char *__restrict buf, size_t size,
__STDIO_STREAM_DISABLE_GETC(&f);
__STDIO_STREAM_ENABLE_PUTC(&f);
- rv = vfprintf(&f, format, arg);
+ rv = __vfprintf(&f, format, arg);
if (size) {
if (f.__bufpos == f.__bufend) {
--f.__bufpos;
@@ -66,6 +66,7 @@ int vsnprintf(char *__restrict buf, size_t size,
}
return rv;
}
+strong_alias(__vsnprintf,vsnprintf)
#elif defined(__USE_OLD_VFPRINTF__)
@@ -75,7 +76,7 @@ typedef struct {
unsigned char *bufpos;
} __FILE_vsnprintf;
-int vsnprintf(char *__restrict buf, size_t size,
+int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
{
__FILE_vsnprintf f;
@@ -113,7 +114,7 @@ int vsnprintf(char *__restrict buf, size_t size,
#endif
f.f.__nextopen = NULL;
- rv = vfprintf((FILE *) &f, format, arg);
+ rv = __vfprintf((FILE *) &f, format, arg);
if (size) {
if (f.bufpos == f.bufend) {
--f.bufpos;
@@ -122,6 +123,7 @@ int vsnprintf(char *__restrict buf, size_t size,
}
return rv;
}
+strong_alias(__vsnprintf,vsnprintf)
#elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__)
@@ -163,7 +165,7 @@ static ssize_t snpf_write(register void *cookie, const char *buf,
#undef COOKIE
-int vsnprintf(char *__restrict buf, size_t size,
+int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
{
FILE f;
@@ -197,10 +199,11 @@ int vsnprintf(char *__restrict buf, size_t size,
#endif
f.__nextopen = NULL;
- rv = vfprintf(&f, format, arg);
+ rv = __vfprintf(&f, format, arg);
return rv;
}
+strong_alias(__vsnprintf,vsnprintf)
#else
#warning Skipping vsnprintf since no buffering, no custom streams, and not old vfprintf!
diff --git a/libc/stdio/vsprintf.c b/libc/stdio/vsprintf.c
index 81d3961ad..a7d5e08f5 100644
--- a/libc/stdio/vsprintf.c
+++ b/libc/stdio/vsprintf.c
@@ -15,7 +15,7 @@
int vsprintf(char *__restrict buf, const char * __restrict format,
va_list arg)
{
- return vsnprintf(buf, SIZE_MAX, format, arg);
+ return __vsnprintf(buf, SIZE_MAX, format, arg);
}
#endif
diff --git a/libc/stdio/vswprintf.c b/libc/stdio/vswprintf.c
index d7dca5e49..d23ba123f 100644
--- a/libc/stdio/vswprintf.c
+++ b/libc/stdio/vswprintf.c
@@ -52,7 +52,7 @@ int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size,
__STDIO_STREAM_DISABLE_GETC(&f);
__STDIO_STREAM_DISABLE_PUTC(&f);
- rv = vfwprintf(&f, format, arg);
+ rv = __vfwprintf(&f, format, arg);
/* NOTE: Return behaviour differs from snprintf... */
if (f.__bufpos == f.__bufend) {
diff --git a/libc/stdio/vwprintf.c b/libc/stdio/vwprintf.c
index 2ad6bbdfd..8c3401846 100644
--- a/libc/stdio/vwprintf.c
+++ b/libc/stdio/vwprintf.c
@@ -11,5 +11,5 @@
int vwprintf(const wchar_t * __restrict format, va_list arg)
{
- return vfwprintf(stdout, format, arg);
+ return __vfwprintf(stdout, format, arg);
}
diff --git a/libc/stdio/wprintf.c b/libc/stdio/wprintf.c
index c64fc086a..00f5ef514 100644
--- a/libc/stdio/wprintf.c
+++ b/libc/stdio/wprintf.c
@@ -15,7 +15,7 @@ int wprintf(const wchar_t * __restrict format, ...)
int rv;
va_start(arg, format);
- rv = vfwprintf(stdout, format, arg);
+ rv = __vfwprintf(stdout, format, arg);
va_end(arg);
return rv;