svn commit: trunk/uClibc/libc/stdio
psm at uclibc.org
psm at uclibc.org
Fri Dec 9 15:33:42 UTC 2005
Author: psm
Date: 2005-12-09 07:33:37 -0800 (Fri, 09 Dec 2005)
New Revision: 12779
Log:
Implement hidden *scanf
Modified:
trunk/uClibc/libc/stdio/_fpmaxtostr.c
trunk/uClibc/libc/stdio/_stdio.h
trunk/uClibc/libc/stdio/fprintf.c
trunk/uClibc/libc/stdio/fwprintf.c
trunk/uClibc/libc/stdio/scanf.c
Changeset:
Modified: trunk/uClibc/libc/stdio/_fpmaxtostr.c
===================================================================
--- trunk/uClibc/libc/stdio/_fpmaxtostr.c 2005-12-09 13:52:08 UTC (rev 12778)
+++ trunk/uClibc/libc/stdio/_fpmaxtostr.c 2005-12-09 15:33:37 UTC (rev 12779)
@@ -694,12 +694,12 @@
cnt += num_groups * tslen; /* Adjust count now for sep chars. */
-/* printf("\n"); */
+/* __printf("\n"); */
do {
if (!blk) { /* Initial group could be 0 digits long! */
blk = nblk2;
} else if (len >= blk) { /* Enough digits for a group. */
-/* printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */
+/* __printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */
if (fp_outfunc(fp, *ppc, blk, (intptr_t) gp) != blk) {
return -1;
}
@@ -709,9 +709,9 @@
}
len -= blk;
} else { /* Transition to 0s. */
-/* printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */
+/* __printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */
if (len) {
-/* printf("len\n"); */
+/* __printf("len\n"); */
if (fp_outfunc(fp, *ppc, len, (intptr_t) gp) != len) {
return -1;
}
@@ -719,7 +719,7 @@
}
if (ppc[3] == FPO_ZERO_PAD) { /* Need to group 0s */
-/* printf("zeropad\n"); */
+/* __printf("zeropad\n"); */
cnt += ppc[1];
ppc += 3;
gp = (const char *) ppc[2];
@@ -742,7 +742,7 @@
}
blk = nblk2;
-/* printf("num_groups=%d blk=%d\n", num_groups, blk); */
+/* __printf("num_groups=%d blk=%d\n", num_groups, blk); */
} while (1);
} else
Modified: trunk/uClibc/libc/stdio/_stdio.h
===================================================================
--- trunk/uClibc/libc/stdio/_stdio.h 2005-12-09 13:52:08 UTC (rev 12778)
+++ trunk/uClibc/libc/stdio/_stdio.h 2005-12-09 15:33:37 UTC (rev 12779)
@@ -30,6 +30,21 @@
__const wchar_t *__restrict __format,
__gnuc_va_list __arg) attribute_hidden;
+extern int __vfscanf (FILE *__restrict __s, __const char *__restrict __format,
+ __gnuc_va_list __arg)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden;
+
+extern int __vsscanf (__const char *__restrict __s,
+ __const char *__restrict __format, __gnuc_va_list __arg)
+ __THROW __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden;
+
+extern int __vfwscanf (__FILE *__restrict __s,
+ __const wchar_t *__restrict __format,
+ __gnuc_va_list __arg) attribute_hidden;
+extern int __vswscanf (__const wchar_t *__restrict __s,
+ __const wchar_t *__restrict __format,
+ __gnuc_va_list __arg) __THROW attribute_hidden;
+
#ifdef __UCLIBC_HAS_WCHAR__
#include <wchar.h>
#endif
Modified: trunk/uClibc/libc/stdio/fprintf.c
===================================================================
--- trunk/uClibc/libc/stdio/fprintf.c 2005-12-09 13:52:08 UTC (rev 12778)
+++ trunk/uClibc/libc/stdio/fprintf.c 2005-12-09 15:33:37 UTC (rev 12779)
@@ -8,6 +8,7 @@
#include "_stdio.h"
#include <stdarg.h>
+#undef fprintf
int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...)
{
va_list arg;
Modified: trunk/uClibc/libc/stdio/fwprintf.c
===================================================================
--- trunk/uClibc/libc/stdio/fwprintf.c 2005-12-09 13:52:08 UTC (rev 12778)
+++ trunk/uClibc/libc/stdio/fwprintf.c 2005-12-09 15:33:37 UTC (rev 12779)
@@ -15,7 +15,7 @@
int rv;
va_start(arg, format);
- rv = vfwprintf(stream, format, arg);
+ rv = __vfwprintf(stream, format, arg);
va_end(arg);
return rv;
Modified: trunk/uClibc/libc/stdio/scanf.c
===================================================================
--- trunk/uClibc/libc/stdio/scanf.c 2005-12-09 13:52:08 UTC (rev 12778)
+++ trunk/uClibc/libc/stdio/scanf.c 2005-12-09 15:33:37 UTC (rev 12779)
@@ -147,17 +147,18 @@
/**********************************************************************/
#ifdef L_fscanf
-int fscanf(FILE * __restrict stream, const char * __restrict format, ...)
+int attribute_hidden __fscanf(FILE * __restrict stream, const char * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = vfscanf(stream, format, arg);
+ rv = __vfscanf(stream, format, arg);
va_end(arg);
return rv;
}
+strong_alias(__fscanf,fscanf)
#endif
/**********************************************************************/
@@ -169,7 +170,7 @@
int rv;
va_start(arg, format);
- rv = vfscanf(stdin, format, arg);
+ rv = __vfscanf(stdin, format, arg);
va_end(arg);
return rv;
@@ -181,17 +182,18 @@
#ifdef __STDIO_HAS_VSSCANF
-int sscanf(const char * __restrict str, const char * __restrict format, ...)
+int attribute_hidden __sscanf(const char * __restrict str, const char * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = vsscanf(str, format, arg);
+ rv = __vsscanf(str, format, arg);
va_end(arg);
return rv;
}
+strong_alias(__sscanf,sscanf)
#else /* __STDIO_HAS_VSSCANF */
#warning Skipping sscanf since no vsscanf!
@@ -201,10 +203,11 @@
/**********************************************************************/
#ifdef L_vscanf
-int vscanf(const char * __restrict format, va_list arg)
+int attribute_hidden __vscanf(const char * __restrict format, va_list arg)
{
- return vfscanf(stdin, format, arg);
+ return __vfscanf(stdin, format, arg);
}
+strong_alias(__vscanf,vscanf)
#endif
/**********************************************************************/
@@ -216,7 +219,7 @@
#ifdef __STDIO_BUFFERS
-int vsscanf(__const char *sp, __const char *fmt, va_list ap)
+int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
{
FILE f;
@@ -254,12 +257,13 @@
__STDIO_STREAM_ENABLE_GETC(&f);
__STDIO_STREAM_DISABLE_PUTC(&f);
- return vfscanf(&f, fmt, ap);
+ return __vfscanf(&f, fmt, ap);
}
+strong_alias(__vsscanf,vsscanf)
#elif !defined(__UCLIBC_HAS_WCHAR__)
-int vsscanf(__const char *sp, __const char *fmt, va_list ap)
+int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
{
__FILE_vsscanf f;
@@ -292,23 +296,25 @@
#endif
f.f.__nextopen = NULL;
- return vfscanf(&f.f, fmt, ap);
+ return __vfscanf(&f.f, fmt, ap);
}
+strong_alias(__vsscanf,vsscanf)
#elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__)
-int vsscanf(__const char *sp, __const char *fmt, va_list ap)
+int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
{
FILE *f;
int rv = EOF;
if ((f = fmemopen((char *)sp, __strlen(sp), "r")) != NULL) {
- rv = vfscanf(f, fmt, ap);
+ rv = __vfscanf(f, fmt, ap);
fclose(f);
}
return rv;
}
+strong_alias(__vsscanf,vsscanf)
#else
#warning Skipping vsscanf since no buffering, no custom streams, and wchar enabled!
@@ -327,7 +333,7 @@
int rv;
va_start(arg, format);
- rv = vfwscanf(stream, format, arg);
+ rv = __vfwscanf(stream, format, arg);
va_end(arg);
return rv;
@@ -343,7 +349,7 @@
int rv;
va_start(arg, format);
- rv = vfwscanf(stdin, format, arg);
+ rv = __vfwscanf(stdin, format, arg);
va_end(arg);
return rv;
@@ -362,7 +368,7 @@
int rv;
va_start(arg, format);
- rv = vswscanf(str, format, arg);
+ rv = __vswscanf(str, format, arg);
va_end(arg);
return rv;
@@ -377,7 +383,7 @@
int vwscanf(const wchar_t * __restrict format, va_list arg)
{
- return vfwscanf(stdin, format, arg);
+ return __vfwscanf(stdin, format, arg);
}
#endif
@@ -386,7 +392,7 @@
#ifdef __STDIO_BUFFERS
-int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format,
+int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format,
va_list arg)
{
FILE f;
@@ -423,8 +429,9 @@
#endif
f.__nextopen = NULL;
- return vfwscanf(&f, format, arg);
+ return __vfwscanf(&f, format, arg);
}
+strong_alias(__vswscanf,vswscanf)
#else /* __STDIO_BUFFERS */
#warning Skipping vswscanf since no buffering!
#endif /* __STDIO_BUFFERS */
@@ -573,6 +580,7 @@
#define Wchar wchar_t
#define Wuchar __uwchar_t
#define ISSPACE(C) iswspace((C))
+#define HIDDEN_VFSCANF __vfwscanf
#define VFSCANF vfwscanf
#define GETC(SC) (SC)->sc_getc((SC))
#else
@@ -582,6 +590,7 @@
#define Wchar char
#define Wuchar __uchar_t
#define ISSPACE(C) isspace((C))
+#define HIDDEN_VFSCANF __vfscanf
#define VFSCANF vfscanf
#ifdef __UCLIBC_HAS_WCHAR__
#define GETC(SC) (SC)->sc_getc((SC))
@@ -1139,7 +1148,7 @@
#endif /* L_vfwscanf */
-int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg)
+int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg)
{
const Wuchar *fmt;
unsigned char *b;
@@ -1743,6 +1752,7 @@
return psfs.cnt;
}
+strong_alias(HIDDEN_VFSCANF,VFSCANF)
#endif
/**********************************************************************/
#ifdef L___psfs_do_numeric
More information about the uClibc-cvs
mailing list