summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/_READ.c5
-rw-r--r--libc/stdio/__fsetlocking.c5
-rw-r--r--libc/stdio/_cs_funcs.c23
-rw-r--r--libc/stdio/_flushlbf.c2
-rw-r--r--libc/stdio/_fopen.c10
-rw-r--r--libc/stdio/_fpmaxtostr.c4
-rw-r--r--libc/stdio/_fwrite.c11
-rw-r--r--libc/stdio/_stdio.c7
-rw-r--r--libc/stdio/_stdio.h70
-rw-r--r--libc/stdio/_trans2w.c4
-rw-r--r--libc/stdio/_uintmaxtostr.c10
-rw-r--r--libc/stdio/_wfwrite.c10
-rw-r--r--libc/stdio/asprintf.c9
-rw-r--r--libc/stdio/clearerr.c7
-rw-r--r--libc/stdio/ctermid.c4
-rw-r--r--libc/stdio/dprintf.c4
-rw-r--r--libc/stdio/fclose.c11
-rw-r--r--libc/stdio/fcloseall.c2
-rw-r--r--libc/stdio/fdopen.c9
-rw-r--r--libc/stdio/feof.c7
-rw-r--r--libc/stdio/ferror.c7
-rw-r--r--libc/stdio/fflush.c20
-rw-r--r--libc/stdio/fgetc.c41
-rw-r--r--libc/stdio/fgetpos.c4
-rw-r--r--libc/stdio/fgetpos64.c2
-rw-r--r--libc/stdio/fgets.c23
-rw-r--r--libc/stdio/fgetwc.c28
-rw-r--r--libc/stdio/fgetws.c15
-rw-r--r--libc/stdio/fileno.c19
-rw-r--r--libc/stdio/fmemopen.c9
-rw-r--r--libc/stdio/fopen.c7
-rw-r--r--libc/stdio/fopen64.c1
-rw-r--r--libc/stdio/fopencookie.c5
-rw-r--r--libc/stdio/fprintf.c10
-rw-r--r--libc/stdio/fputc.c34
-rw-r--r--libc/stdio/fputs.c25
-rw-r--r--libc/stdio/fputwc.c16
-rw-r--r--libc/stdio/fputws.c25
-rw-r--r--libc/stdio/fread.c23
-rw-r--r--libc/stdio/freopen.c2
-rw-r--r--libc/stdio/fseeko.c18
-rw-r--r--libc/stdio/fseeko64.c2
-rw-r--r--libc/stdio/fsetpos.c4
-rw-r--r--libc/stdio/fsetpos64.c2
-rw-r--r--libc/stdio/ftello.c18
-rw-r--r--libc/stdio/ftello64.c2
-rw-r--r--libc/stdio/fwprintf.c4
-rw-r--r--libc/stdio/fwrite.c18
-rw-r--r--libc/stdio/getchar.c10
-rw-r--r--libc/stdio/getdelim.c8
-rw-r--r--libc/stdio/getline.c9
-rw-r--r--libc/stdio/gets.c5
-rw-r--r--libc/stdio/getw.c4
-rw-r--r--libc/stdio/getwchar.c13
-rw-r--r--libc/stdio/old_vfprintf.c23
-rw-r--r--libc/stdio/open_memstream.c17
-rw-r--r--libc/stdio/perror.c10
-rw-r--r--libc/stdio/popen.c36
-rw-r--r--libc/stdio/printf.c9
-rw-r--r--libc/stdio/putchar.c10
-rw-r--r--libc/stdio/puts.c7
-rw-r--r--libc/stdio/putw.c6
-rw-r--r--libc/stdio/putwchar.c14
-rw-r--r--libc/stdio/remove.c11
-rw-r--r--libc/stdio/rewind.c9
-rw-r--r--libc/stdio/scanf.c114
-rw-r--r--libc/stdio/setbuf.c4
-rw-r--r--libc/stdio/setbuffer.c4
-rw-r--r--libc/stdio/setlinebuf.c4
-rw-r--r--libc/stdio/setvbuf.c5
-rw-r--r--libc/stdio/snprintf.c9
-rw-r--r--libc/stdio/sprintf.c9
-rw-r--r--libc/stdio/swprintf.c4
-rw-r--r--libc/stdio/tempnam.c4
-rw-r--r--libc/stdio/tmpfile.c11
-rw-r--r--libc/stdio/tmpnam.c4
-rw-r--r--libc/stdio/ungetc.c5
-rw-r--r--libc/stdio/ungetwc.c5
-rw-r--r--libc/stdio/vasprintf.c22
-rw-r--r--libc/stdio/vdprintf.c12
-rw-r--r--libc/stdio/vfprintf.c51
-rw-r--r--libc/stdio/vprintf.c4
-rw-r--r--libc/stdio/vsnprintf.c23
-rw-r--r--libc/stdio/vsprintf.c4
-rw-r--r--libc/stdio/vswprintf.c9
-rw-r--r--libc/stdio/vwprintf.c4
-rw-r--r--libc/stdio/wprintf.c4
87 files changed, 640 insertions, 474 deletions
diff --git a/libc/stdio/_READ.c b/libc/stdio/_READ.c
index e27309c11..0c7febb3c 100644
--- a/libc/stdio/_READ.c
+++ b/libc/stdio/_READ.c
@@ -5,10 +5,11 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define read __read
-
#include "_stdio.h"
+libc_hidden_proto(read)
+libc_hidden_proto(abort)
+
/* Given a reading stream without its end-of-file indicator set and
* with no buffered input or ungots, read at most 'bufsize' bytes
* into 'buf' (which may be the stream's __bufstart).
diff --git a/libc/stdio/__fsetlocking.c b/libc/stdio/__fsetlocking.c
index 5b6070cc3..74f253626 100644
--- a/libc/stdio/__fsetlocking.c
+++ b/libc/stdio/__fsetlocking.c
@@ -15,7 +15,7 @@
* glibc treats invalid locking_mode args as FSETLOCKING_INTERNAL.
*/
-int attribute_hidden __fsetlocking_internal(FILE *stream, int locking_mode)
+int __fsetlocking(FILE *stream, int locking_mode)
{
#ifdef __UCLIBC_HAS_THREADS__
int current = 1 + (stream->__user_locking & 1);
@@ -44,4 +44,5 @@ int attribute_hidden __fsetlocking_internal(FILE *stream, int locking_mode)
#endif
}
-strong_alias(__fsetlocking_internal,__fsetlocking)
+libc_hidden_proto(__fsetlocking)
+libc_hidden_def(__fsetlocking)
diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c
index ef92048c0..38a8351e5 100644
--- a/libc/stdio/_cs_funcs.c
+++ b/libc/stdio/_cs_funcs.c
@@ -7,20 +7,29 @@
#include "_stdio.h"
+libc_hidden_proto(read)
+libc_hidden_proto(write)
+libc_hidden_proto(close)
+#ifdef __UCLIBC_HAS_LFS__
+libc_hidden_proto(lseek64)
+#else
+libc_hidden_proto(lseek)
+#endif
+
/**********************************************************************/
#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
/**********************************************************************/
ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize)
{
- return __read(*((int *) cookie), buf, bufsize);
+ return read(*((int *) cookie), buf, bufsize);
}
/**********************************************************************/
ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize)
{
- return __write(*((int *) cookie), (char *) buf, bufsize);
+ return write(*((int *) cookie), (char *) buf, bufsize);
}
/**********************************************************************/
@@ -30,9 +39,9 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence
__offmax_t res;
#ifdef __UCLIBC_HAS_LFS__
- res = __lseek64(*((int *) cookie), *pos, whence);
+ res = lseek64(*((int *) cookie), *pos, whence);
#else
- res = __lseek(*((int *) cookie), *pos, whence);
+ res = lseek(*((int *) cookie), *pos, whence);
#endif
return (res >= 0) ? ((*pos = res), 0) : ((int) res);
@@ -42,7 +51,7 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence
int attribute_hidden _cs_close(void *cookie)
{
- return __close(*((int *) cookie));
+ return close(*((int *) cookie));
}
/**********************************************************************/
@@ -54,9 +63,9 @@ int attribute_hidden __stdio_seek(FILE *stream, register __offmax_t *pos, int wh
__offmax_t res;
#ifdef __UCLIBC_HAS_LFS__
- res = __lseek64(stream->__filedes, *pos, whence);
+ res = lseek64(stream->__filedes, *pos, whence);
#else
- res = __lseek(stream->__filedes, *pos, whence);
+ res = lseek(stream->__filedes, *pos, whence);
#endif
return (res >= 0) ? ((*pos = res), 0) : ((int) res);
diff --git a/libc/stdio/_flushlbf.c b/libc/stdio/_flushlbf.c
index 31ed2fc55..8a551a746 100644
--- a/libc/stdio/_flushlbf.c
+++ b/libc/stdio/_flushlbf.c
@@ -8,6 +8,8 @@
#include "_stdio.h"
#include <stdio_ext.h>
+libc_hidden_proto(fflush_unlocked)
+
/* Solaris function --
* Flush all line buffered (writing) streams.
*/
diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c
index b4f4d46c7..02051eff9 100644
--- a/libc/stdio/_fopen.c
+++ b/libc/stdio/_fopen.c
@@ -5,10 +5,12 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define isatty __isatty
-
#include "_stdio.h"
+libc_hidden_proto(isatty)
+libc_hidden_proto(open)
+libc_hidden_proto(fcntl)
+
/*
* Cases:
* fopen64 : filename != NULL, stream == NULL, filedes == -2
@@ -121,7 +123,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode,
/* NOTE: fopencookie needs changing if the basic check changes! */
if (((i & (((int) fname_or_mode) + 1)) != i) /* Basic agreement? */
|| (((open_mode & ~((__mode_t) fname_or_mode)) & O_APPEND)
- && __fcntl(filedes, F_SETFL, O_APPEND)) /* Need O_APPEND. */
+ && fcntl(filedes, F_SETFL, O_APPEND)) /* Need O_APPEND. */
) {
goto DO_EINVAL;
}
@@ -130,7 +132,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode,
& O_LARGEFILE) );
} else {
__STDIO_WHEN_LFS( if (filedes < -1) open_mode |= O_LARGEFILE );
- if ((stream->__filedes = __open(((const char *) fname_or_mode),
+ if ((stream->__filedes = open(((const char *) fname_or_mode),
open_mode, 0666)) < 0) {
goto FREE_STREAM;
}
diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c
index 99fc9a9dd..03fe6b1db 100644
--- a/libc/stdio/_fpmaxtostr.c
+++ b/libc/stdio/_fpmaxtostr.c
@@ -11,6 +11,8 @@
#include <locale.h>
#include <bits/uClibc_fpmax.h>
+libc_hidden_proto(memset)
+
typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len,
intptr_t buf);
@@ -417,7 +419,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info
if (mode == 'f') {
round += exp;
if (round < -1) {
- __memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */
+ memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */
exp = -1;
round = -1;
}
diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c
index 600b15e6d..1e0f7ceee 100644
--- a/libc/stdio/_fwrite.c
+++ b/libc/stdio/_fwrite.c
@@ -5,11 +5,12 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define memrchr __memrchr
-#define memchr __memchr
-
#include "_stdio.h"
+libc_hidden_proto(memchr)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memrchr)
+
#ifdef __STDIO_BUFFERS
/* Either buffer data or (commit buffer if necessary and) write. */
@@ -35,7 +36,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer,
if (pending > bytes) {
pending = bytes;
}
- __memcpy(stream->__bufpos, buffer, pending);
+ memcpy(stream->__bufpos, buffer, pending);
stream->__bufpos += pending;
__STDIO_STREAM_VALIDATE(stream);
return bytes;
@@ -43,7 +44,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer,
/* RETRY: */
if (bytes <= __STDIO_STREAM_BUFFER_WAVAIL(stream)) {
- __memcpy(stream->__bufpos, buffer, bytes);
+ memcpy(stream->__bufpos, buffer, bytes);
stream->__bufpos += bytes;
if (__STDIO_STREAM_IS_LBF(stream)
&& memrchr(buffer, '\n', bytes) /* Search backwards. */
diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c
index 54319118f..6454b3f3b 100644
--- a/libc/stdio/_stdio.c
+++ b/libc/stdio/_stdio.c
@@ -5,10 +5,11 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define isatty __isatty
-
#include "_stdio.h"
+libc_hidden_proto(memcpy)
+libc_hidden_proto(isatty)
+
/* This is pretty much straight from uClibc, but with one important
* difference.
*
@@ -169,7 +170,7 @@ void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m)
static const pthread_mutex_t __stdio_mutex_initializer
= PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
- __memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer));
+ memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer));
}
#endif
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index 0badc9fd1..d6b68b3bb 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -18,36 +18,8 @@
#include <stdlib.h>
#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 __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;
-
#ifdef __UCLIBC_HAS_WCHAR__
#include <wchar.h>
-
-extern int __vfwprintf (__FILE *__restrict __s,
- __const wchar_t *__restrict __format,
- __gnuc_va_list __arg) 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;
#endif
#ifdef __UCLIBC_HAS_THREADS__
@@ -287,8 +259,6 @@ extern int __stdio_trans2w(FILE *__restrict stream) attribute_hidden;
extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag) attribute_hidden;
extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag) attribute_hidden;
-extern int __setvbuf (FILE *__restrict __stream, char *__restrict __buf,
- int __modes, size_t __n) __THROW attribute_hidden;
/**********************************************************************/
#ifdef __STDIO_BUFFERS
@@ -376,46 +346,11 @@ extern int __setvbuf (FILE *__restrict __stream, char *__restrict __buf,
#endif /* __STDIO_BUFFERS */
/**********************************************************************/
-extern int __fputs_unlocked(const char *__restrict s, FILE *__restrict stream) attribute_hidden;
-
-extern int __putchar_unlocked(int c);
-
-
-extern size_t __fwrite_unlocked(const void *__restrict ptr, size_t size,
- size_t nmemb, FILE *__restrict stream) attribute_hidden;
-
-extern size_t __fread_unlocked(void *__restrict ptr, size_t size,
- size_t nmemb, FILE *__restrict stream) attribute_hidden;
-
-extern int __fputc_unlocked_internal(int c, FILE *stream) attribute_hidden;
-
-extern int __fflush_unlocked(FILE *stream) attribute_hidden;
-
extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos) attribute_hidden;
-extern void __clearerr_unlocked(FILE *stream);
-extern int __feof_unlocked(FILE *stream);
-extern int __ferror_unlocked(FILE *stream);
-
-extern int __fgetc_unlocked_internal(FILE *stream) attribute_hidden;
-extern int __getc_unlocked(FILE *stream) attribute_hidden;
-extern char *__fgets_unlocked(char *__restrict s, int n,
- FILE * __restrict stream) attribute_hidden;
-
-extern int __fileno_unlocked(FILE *stream) attribute_hidden;
-
-extern int __getchar_unlocked(void) attribute_hidden;
-
-extern int __fseek(FILE *stream, long int offset, int whence) attribute_hidden;
-extern long int __ftell(FILE *stream) attribute_hidden;
-#ifdef __UCLIBC_HAS_LFS__
-extern int __fseeko64(FILE *stream, __off64_t offset, int whence) attribute_hidden;
-extern __off64_t __ftello64(FILE *stream) attribute_hidden;
-#endif
-
#ifdef __STDIO_HAS_OPENLIST
/* Uses an implementation hack!!! */
-#define __STDIO_FLUSH_LBF_STREAMS __fflush_unlocked((FILE *) &_stdio_openlist)
+#define __STDIO_FLUSH_LBF_STREAMS fflush_unlocked((FILE *) &_stdio_openlist)
#else
#define __STDIO_FLUSH_LBF_STREAMS ((void)0)
#endif
@@ -453,9 +388,6 @@ extern FILE *_stdio_fopen(intptr_t fname_or_mode,
#ifdef __UCLIBC_HAS_WCHAR__
extern size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
FILE *__restrict stream) attribute_hidden;
-
-extern wint_t __fgetwc_unlocked(register FILE *stream) attribute_hidden;
-extern wint_t __fputwc_unlocked(wchar_t wc, FILE *stream) attribute_hidden;
#endif
/**********************************************************************/
diff --git a/libc/stdio/_trans2w.c b/libc/stdio/_trans2w.c
index 650a5e1a0..ed1a583fc 100644
--- a/libc/stdio/_trans2w.c
+++ b/libc/stdio/_trans2w.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(fseek)
+
/* Function to handle transition to writing.
* Initialize or verify the stream's orientation (even if readonly).
* Check that the stream is writable.
@@ -64,7 +66,7 @@ int attribute_hidden __stdio_trans2w(FILE * __restrict stream)
* the end even if not reading.*/
if (((__STDIO_STREAM_BUFFER_RAVAIL(stream))
|| (stream->__modeflags & __FLAG_UNGOT))
- && __fseek(stream, 0L,
+ && fseek(stream, 0L,
((stream->__modeflags & __FLAG_APPEND)
? SEEK_END : SEEK_CUR))
) {
diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c
index bf92506d5..4310d6458 100644
--- a/libc/stdio/_uintmaxtostr.c
+++ b/libc/stdio/_uintmaxtostr.c
@@ -11,6 +11,8 @@
#include <locale.h>
#include <bits/uClibc_uintmaxtostr.h>
+libc_hidden_proto(memcpy)
+
/* Avoid using long long / and % operations to cut down dependencies on
* libgcc.a. Definitely helps on i386 at least. */
#if (INTMAX_MAX > INT_MAX) && (((INTMAX_MAX/INT_MAX)/2) - 2 <= INT_MAX)
@@ -61,7 +63,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
#ifndef __LOCALE_C_ONLY
if (!grouping) { /* Finished a group. */
bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len;
- __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
+ memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
__UCLIBC_CURLOCALE_DATA.thousands_sep_len);
if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */
/* Note: g[1] == -1 means no further grouping. But since
@@ -79,7 +81,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
#ifndef __LOCALE_C_ONLY
if (unlikely(outdigit)) {
bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit];
- __memcpy(bufend,
+ memcpy(bufend,
(&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit],
__UCLIBC_CURLOCALE_DATA.outdigit_length[digit]);
} else
@@ -104,7 +106,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
#ifndef __LOCALE_C_ONLY
if (!grouping) { /* Finished a group. */
bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len;
- __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
+ memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep,
__UCLIBC_CURLOCALE_DATA.thousands_sep_len);
if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */
/* Note: g[1] == -1 means no further grouping. But since
@@ -131,7 +133,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_
#ifndef __LOCALE_C_ONLY
if (unlikely(outdigit)) {
bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit];
- __memcpy(bufend,
+ memcpy(bufend,
(&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit],
__UCLIBC_CURLOCALE_DATA.outdigit_length[digit]);
} else
diff --git a/libc/stdio/_wfwrite.c b/libc/stdio/_wfwrite.c
index 792cff604..fb5c6b3ee 100644
--- a/libc/stdio/_wfwrite.c
+++ b/libc/stdio/_wfwrite.c
@@ -5,8 +5,6 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define wmemcpy __wmemcpy
-
#include "_stdio.h"
#include <wchar.h>
@@ -17,9 +15,9 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning TODO: Fix prototype.
#endif
-extern size_t __wcsnrtombs(char *__restrict dst,
- const wchar_t **__restrict src,
- size_t NWC, size_t len, mbstate_t *__restrict ps) attribute_hidden;
+
+libc_hidden_proto(wmemcpy)
+libc_hidden_proto(wcsnrtombs)
size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
register FILE *__restrict stream)
@@ -55,7 +53,7 @@ size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
pw = ws;
while (n > count) {
- r = __wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->__state);
+ r = wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->__state);
if (r != ((size_t) -1)) { /* No encoding errors */
if (!r) {
++r; /* 0 is returned when nul is reached. */
diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c
index 207b35a3c..98865545e 100644
--- a/libc/stdio/asprintf.c
+++ b/libc/stdio/asprintf.c
@@ -5,16 +5,16 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define vasprintf __vasprintf
-
#include "_stdio.h"
#include <stdarg.h>
+libc_hidden_proto(vasprintf)
+
#ifndef __STDIO_HAS_VSNPRINTF
#warning Skipping asprintf and __asprintf since no vsnprintf!
#else
-int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict format, ...)
+int asprintf(char **__restrict buf, const char * __restrict format, ...)
{
va_list arg;
int rv;
@@ -26,6 +26,7 @@ int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict f
return rv;
}
-strong_alias(__asprintf,asprintf)
+libc_hidden_proto(asprintf)
+libc_hidden_def(asprintf)
#endif
diff --git a/libc/stdio/clearerr.c b/libc/stdio/clearerr.c
index cf1e623c7..a96ecaa89 100644
--- a/libc/stdio/clearerr.c
+++ b/libc/stdio/clearerr.c
@@ -7,18 +7,19 @@
#include "_stdio.h"
+#undef clearerr
#ifdef __DO_UNLOCKED
-void __clearerr_unlocked(register FILE *stream)
+#undef clearerr_unlocked
+void clearerr_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
__CLEARERR_UNLOCKED(stream);
}
-weak_alias(__clearerr_unlocked,clearerr_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__clearerr_unlocked,clearerr)
+strong_alias(clearerr_unlocked,clearerr)
#endif
#elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/ctermid.c b/libc/stdio/ctermid.c
index 11e43f336..1cb8a0845 100644
--- a/libc/stdio/ctermid.c
+++ b/libc/stdio/ctermid.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(strcpy)
+
char *ctermid(register char *s)
{
static char sbuf[L_ctermid];
@@ -21,6 +23,6 @@ char *ctermid(register char *s)
return s;
#else
/* glibc always returns /dev/tty for linux. */
- return __strcpy((s ? s : sbuf), "/dev/tty");
+ return strcpy((s ? s : sbuf), "/dev/tty");
#endif
}
diff --git a/libc/stdio/dprintf.c b/libc/stdio/dprintf.c
index 1fc46c722..6e24374cd 100644
--- a/libc/stdio/dprintf.c
+++ b/libc/stdio/dprintf.c
@@ -5,11 +5,11 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define vdprintf __vdprintf
-
#include "_stdio.h"
#include <stdarg.h>
+libc_hidden_proto(vdprintf)
+
int dprintf(int filedes, const char * __restrict format, ...)
{
va_list arg;
diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c
index e019ad53e..fc770dce8 100644
--- a/libc/stdio/fclose.c
+++ b/libc/stdio/fclose.c
@@ -9,8 +9,10 @@
#include "_stdio.h"
-#undef fclose
-int attribute_hidden __fclose(register FILE *stream)
+libc_hidden_proto(close)
+libc_hidden_proto(fflush_unlocked)
+
+int fclose(register FILE *stream)
{
int rv = 0;
__STDIO_AUTO_THREADLOCK_VAR;
@@ -47,7 +49,7 @@ int attribute_hidden __fclose(register FILE *stream)
#ifdef __STDIO_BUFFERS
/* Write any pending buffered chars. */
if (__STDIO_STREAM_IS_WRITING(stream)) {
- rv = __fflush_unlocked(stream);
+ rv = fflush_unlocked(stream);
}
#endif
@@ -87,4 +89,5 @@ int attribute_hidden __fclose(register FILE *stream)
return rv;
}
-strong_alias(__fclose,fclose)
+libc_hidden_proto(fclose)
+libc_hidden_def(fclose)
diff --git a/libc/stdio/fcloseall.c b/libc/stdio/fcloseall.c
index dbb600067..5be9b553e 100644
--- a/libc/stdio/fcloseall.c
+++ b/libc/stdio/fcloseall.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(fclose)
+
/* NOTE: GLIBC difference!!! -- fcloseall
* According to the info pages, glibc actually fclose()s all open files.
* Apparently, glibc's new version only fflush()s and unbuffers all
diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c
index bca7f23fb..acf6231b2 100644
--- a/libc/stdio/fdopen.c
+++ b/libc/stdio/fdopen.c
@@ -7,12 +7,15 @@
#include "_stdio.h"
-FILE attribute_hidden *__fdopen(int filedes, const char *mode)
+libc_hidden_proto(fdopen)
+libc_hidden_proto(fcntl)
+
+FILE *fdopen(int filedes, const char *mode)
{
intptr_t cur_mode;
- return (((cur_mode = __fcntl(filedes, F_GETFL))) != -1)
+ return (((cur_mode = fcntl(filedes, F_GETFL))) != -1)
? _stdio_fopen(cur_mode, mode, NULL, filedes)
: NULL;
}
-strong_alias(__fdopen,fdopen)
+libc_hidden_def(fdopen)
diff --git a/libc/stdio/feof.c b/libc/stdio/feof.c
index b0528d5ae..e5f03b720 100644
--- a/libc/stdio/feof.c
+++ b/libc/stdio/feof.c
@@ -7,18 +7,19 @@
#include "_stdio.h"
+#undef feof
#ifdef __DO_UNLOCKED
-int __feof_unlocked(register FILE *stream)
+#undef feof_unlocked
+int feof_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
return __FEOF_UNLOCKED(stream);
}
-weak_alias(__feof_unlocked,feof_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__feof_unlocked,feof)
+strong_alias(feof_unlocked,feof)
#endif
#elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/ferror.c b/libc/stdio/ferror.c
index e8d19bfa4..947b89ed1 100644
--- a/libc/stdio/ferror.c
+++ b/libc/stdio/ferror.c
@@ -7,18 +7,19 @@
#include "_stdio.h"
+#undef ferror
#ifdef __DO_UNLOCKED
-int __ferror_unlocked(register FILE *stream)
+#undef ferror_unlocked
+int ferror_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
return __FERROR_UNLOCKED(stream);
}
-weak_alias(__ferror_unlocked,ferror_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__ferror_unlocked,ferror)
+strong_alias(ferror_unlocked,ferror)
#endif
#elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c
index 0a74afe3f..e33a0065a 100644
--- a/libc/stdio/fflush.c
+++ b/libc/stdio/fflush.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(fflush_unlocked)
+
#ifdef __DO_UNLOCKED
#ifdef __UCLIBC_MJN3_ONLY__
@@ -31,7 +33,7 @@
#endif
-int attribute_hidden __fflush_unlocked(register FILE *stream)
+int fflush_unlocked(register FILE *stream)
{
#ifdef __STDIO_BUFFERS
@@ -125,16 +127,17 @@ int attribute_hidden __fflush_unlocked(register FILE *stream)
return 0;
#endif /* __STDIO_BUFFERS */
}
+libc_hidden_def(fflush_unlocked)
-weak_alias(__fflush_unlocked,fflush_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fflush_unlocked,__fflush)
-weak_alias(__fflush_unlocked,fflush)
+strong_alias(fflush_unlocked,fflush)
+libc_hidden_proto(fflush)
+libc_hidden_def(fflush)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int attribute_hidden __fflush(register FILE *stream)
+int fflush(register FILE *stream)
{
int retval;
__STDIO_AUTO_THREADLOCK_VAR;
@@ -147,15 +150,16 @@ int attribute_hidden __fflush(register FILE *stream)
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fflush_unlocked(stream);
+ retval = fflush_unlocked(stream);
__STDIO_AUTO_THREADUNLOCK(stream);
} else {
- retval = __fflush_unlocked(stream);
+ retval = fflush_unlocked(stream);
}
return retval;
}
-strong_alias(__fflush,fflush)
+libc_hidden_proto(fflush)
+libc_hidden_def(fflush)
#endif
diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c
index d83b6c92a..599d12b30 100644
--- a/libc/stdio/fgetc.c
+++ b/libc/stdio/fgetc.c
@@ -1,6 +1,7 @@
/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
@@ -14,7 +15,9 @@
#ifdef __DO_UNLOCKED
-int attribute_hidden __fgetc_unlocked_internal(FILE *stream)
+libc_hidden_proto(fflush_unlocked)
+
+int __fgetc_unlocked(FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -68,20 +71,32 @@ int attribute_hidden __fgetc_unlocked_internal(FILE *stream)
return EOF;
}
+libc_hidden_proto(__fgetc_unlocked)
+libc_hidden_def(__fgetc_unlocked)
+
+strong_alias(__fgetc_unlocked,fgetc_unlocked)
+libc_hidden_proto(fgetc_unlocked)
+libc_hidden_def(fgetc_unlocked)
+
+//strong_alias(__fgetc_unlocked,__getc_unlocked)
+//libc_hidden_proto(__getc_unlocked)
+//libc_hidden_def(__getc_unlocked)
+strong_alias(__fgetc_unlocked,getc_unlocked)
+libc_hidden_proto(getc_unlocked)
+libc_hidden_def(getc_unlocked)
-strong_alias(__fgetc_unlocked_internal,__fgetc_unlocked)
-weak_alias(__fgetc_unlocked_internal,fgetc_unlocked)
-hidden_strong_alias(__fgetc_unlocked_internal,__getc_unlocked)
-weak_alias(__fgetc_unlocked_internal,getc_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fgetc_unlocked_internal,__fgetc)
-weak_alias(__fgetc_unlocked_internal,fgetc)
-weak_alias(__fgetc_unlocked_internal,getc)
+strong_alias(__fgetc_unlocked,fgetc)
+libc_hidden_proto(fgetc)
+libc_hidden_def(fgetc)
+strong_alias(__fgetc_unlocked,getc)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int attribute_hidden __fgetc(register FILE *stream)
+libc_hidden_proto(__fgetc_unlocked)
+
+int fgetc(register FILE *stream)
{
if (stream->__user_locking != 0) {
return __GETC_UNLOCKED_MACRO(stream);
@@ -93,7 +108,9 @@ int attribute_hidden __fgetc(register FILE *stream)
return retval;
}
}
-strong_alias(__fgetc,fgetc)
-weak_alias(__fgetc,getc)
+libc_hidden_proto(fgetc)
+libc_hidden_def(fgetc)
+
+strong_alias(fgetc,getc)
#endif
diff --git a/libc/stdio/fgetpos.c b/libc/stdio/fgetpos.c
index 03c18ab93..610737d36 100644
--- a/libc/stdio/fgetpos.c
+++ b/libc/stdio/fgetpos.c
@@ -8,9 +8,11 @@
#include "_stdio.h"
#ifndef __DO_LARGEFILE
-#define FTELL __ftell
+#define FTELL ftell
#endif
+libc_hidden_proto(FTELL)
+
int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos)
{
#ifdef __STDIO_MBSTATE
diff --git a/libc/stdio/fgetpos64.c b/libc/stdio/fgetpos64.c
index 6f46746b1..32b7120aa 100644
--- a/libc/stdio/fgetpos64.c
+++ b/libc/stdio/fgetpos64.c
@@ -10,5 +10,5 @@
#define __DO_LARGEFILE
#define fgetpos fgetpos64
#define fpos_t fpos64_t
-#define FTELL __ftello64
+#define FTELL ftello64
#include "fgetpos.c"
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index 5baf63a58..031eadaaf 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -7,9 +7,13 @@
#include "_stdio.h"
+libc_hidden_proto(fgets_unlocked)
+
#ifdef __DO_UNLOCKED
-char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
+libc_hidden_proto(__fgetc_unlocked)
+
+char *fgets_unlocked(char *__restrict s, int n,
register FILE * __restrict stream)
{
register char *p;
@@ -34,7 +38,7 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
break;
}
} else {
- if ((c = __fgetc_unlocked_internal(stream)) == EOF) {
+ if ((c = __fgetc_unlocked(stream)) == EOF) {
if (__FERROR_UNLOCKED(stream)) {
goto ERROR;
}
@@ -57,17 +61,17 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
ERROR:
return NULL;
}
-
-weak_alias(__fgets_unlocked,fgets_unlocked)
+libc_hidden_def(fgets_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fgets_unlocked,__fgets)
-weak_alias(__fgets_unlocked,fgets)
+strong_alias(fgets_unlocked,fgets)
+libc_hidden_proto(fgets)
+libc_hidden_def(fgets)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-char attribute_hidden *__fgets(char *__restrict s, int n,
+char *fgets(char *__restrict s, int n,
register FILE * __restrict stream)
{
char *retval;
@@ -75,12 +79,13 @@ char attribute_hidden *__fgets(char *__restrict s, int n,
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fgets_unlocked(s, n, stream);
+ retval = fgets_unlocked(s, n, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fgets,fgets)
+libc_hidden_proto(fgets)
+libc_hidden_def(fgets)
#endif
diff --git a/libc/stdio/fgetwc.c b/libc/stdio/fgetwc.c
index 45ff86b80..dbcf6bec6 100644
--- a/libc/stdio/fgetwc.c
+++ b/libc/stdio/fgetwc.c
@@ -5,10 +5,12 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define mbrtowc __mbrtowc
-
#include "_stdio.h"
+libc_hidden_proto(fgetwc_unlocked)
+
+libc_hidden_proto(mbrtowc)
+
#ifdef __DO_UNLOCKED
static void munge_stream(register FILE *stream, unsigned char *buf)
@@ -19,7 +21,7 @@ static void munge_stream(register FILE *stream, unsigned char *buf)
__STDIO_STREAM_DISABLE_PUTC(stream);
}
-wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream)
+wint_t fgetwc_unlocked(register FILE *stream)
{
wint_t wi;
wchar_t wc[1];
@@ -107,31 +109,33 @@ wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream)
return wi;
}
+libc_hidden_def(fgetwc_unlocked)
-weak_alias(__fgetwc_unlocked,fgetwc_unlocked)
-weak_alias(__fgetwc_unlocked,getwc_unlocked)
+strong_alias(fgetwc_unlocked,getwc_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fgetwc_unlocked,__fgetwc)
-weak_alias(__fgetwc_unlocked,fgetwc)
-weak_alias(__fgetwc_unlocked,getwc)
+strong_alias(fgetwc_unlocked,fgetwc)
+libc_hidden_proto(fgetwc)
+libc_hidden_def(fgetwc)
+strong_alias(fgetwc_unlocked,getwc)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-wint_t attribute_hidden __fgetwc(register FILE *stream)
+wint_t fgetwc(register FILE *stream)
{
wint_t retval;
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fgetwc_unlocked(stream);
+ retval = fgetwc_unlocked(stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fgetwc,fgetwc)
-weak_alias(__fgetwc,getwc)
+libc_hidden_proto(fgetwc)
+libc_hidden_def(fgetwc)
+strong_alias(fgetwc,getwc)
#endif
diff --git a/libc/stdio/fgetws.c b/libc/stdio/fgetws.c
index fe8da002d..c7dcc7d2b 100644
--- a/libc/stdio/fgetws.c
+++ b/libc/stdio/fgetws.c
@@ -7,12 +7,13 @@
#include "_stdio.h"
-extern wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n,
- FILE *__restrict stream) attribute_hidden;
+libc_hidden_proto(fgetws_unlocked)
+
+libc_hidden_proto(fgetwc_unlocked)
#ifdef __DO_UNLOCKED
-wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n,
+wchar_t *fgetws_unlocked(wchar_t *__restrict ws, int n,
FILE *__restrict stream)
{
register wchar_t *p = ws;
@@ -21,7 +22,7 @@ wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n,
__STDIO_STREAM_VALIDATE(stream);
while ((n > 1)
- && ((wi = __fgetwc_unlocked(stream)) != WEOF)
+ && ((wi = fgetwc_unlocked(stream)) != WEOF)
&& ((*p++ = wi) != '\n')
) {
--n;
@@ -36,10 +37,10 @@ wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n,
*p = 0;
return ws;
}
+libc_hidden_def(fgetws_unlocked)
-weak_alias(__fgetws_unlocked,fgetws_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgetws_unlocked,fgetws)
+strong_alias(fgetws_unlocked,fgetws)
#endif
#elif defined __UCLIBC_HAS_THREADS__
@@ -51,7 +52,7 @@ wchar_t *fgetws(wchar_t *__restrict ws, int n, FILE *__restrict stream)
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fgetws_unlocked(ws, n, stream);
+ retval = fgetws_unlocked(ws, n, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c
index bc1ade952..fb895b8a0 100644
--- a/libc/stdio/fileno.c
+++ b/libc/stdio/fileno.c
@@ -7,9 +7,11 @@
#include "_stdio.h"
+libc_hidden_proto(fileno_unlocked)
+
#ifdef __DO_UNLOCKED
-int attribute_hidden __fileno_unlocked(register FILE *stream)
+int fileno_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -20,27 +22,30 @@ int attribute_hidden __fileno_unlocked(register FILE *stream)
__set_errno(EBADF);
return -1;
}
+libc_hidden_def(fileno_unlocked)
-weak_alias(__fileno_unlocked,fileno_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_weak_alias(__fileno_unlocked,__fileno)
-weak_alias(__fileno_unlocked,fileno)
+strong_alias(fileno_unlocked,fileno)
+libc_hidden_proto(fileno)
+libc_hidden_def(fileno)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int attribute_hidden __fileno(register FILE *stream)
+int fileno(register FILE *stream)
{
int retval;
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fileno_unlocked(stream);
+ retval = fileno_unlocked(stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fileno,fileno)
+libc_hidden_proto(fileno)
+libc_hidden_def(fileno)
+
#endif
diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c
index fc7870258..7f6021ca4 100644
--- a/libc/stdio/fmemopen.c
+++ b/libc/stdio/fmemopen.c
@@ -5,10 +5,11 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define fopencookie __fopencookie
-
#include "_stdio.h"
+libc_hidden_proto(memcpy)
+libc_hidden_proto(fopencookie)
+
#ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
#error no custom streams!
#endif
@@ -37,7 +38,7 @@ static ssize_t fmo_read(register void *cookie, char *buf, size_t bufsize)
bufsize = count;
}
- __memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize);
+ memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize);
COOKIE->pos += bufsize;
return bufsize;
@@ -64,7 +65,7 @@ static ssize_t fmo_write(register void *cookie, const char *buf, size_t bufsize)
}
}
- __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
+ memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
COOKIE->pos += bufsize;
if (COOKIE->pos > COOKIE->eof) {
diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c
index ad5d1aa92..d73ce711a 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -9,15 +9,14 @@
#ifndef __DO_LARGEFILE
# define FILEDES_ARG (-1)
-#undef __fopen
#undef fopen
#else
-#undef __fopen64
#undef fopen64
#endif
-FILE attribute_hidden *__fopen(const char * __restrict filename, const char * __restrict mode)
+FILE *fopen(const char * __restrict filename, const char * __restrict mode)
{
return _stdio_fopen(((intptr_t) filename), mode, NULL, FILEDES_ARG);
}
-strong_alias(__fopen,fopen)
+libc_hidden_proto(fopen)
+libc_hidden_def(fopen)
diff --git a/libc/stdio/fopen64.c b/libc/stdio/fopen64.c
index c65e9a4e9..cbdb03d68 100644
--- a/libc/stdio/fopen64.c
+++ b/libc/stdio/fopen64.c
@@ -8,7 +8,6 @@
#include "_stdio.h"
#define __DO_LARGEFILE
-#define __fopen __fopen64
#undef fopen
#define fopen fopen64
#define FILEDES_ARG (-2)
diff --git a/libc/stdio/fopencookie.c b/libc/stdio/fopencookie.c
index a70e17b80..af51f44c9 100644
--- a/libc/stdio/fopencookie.c
+++ b/libc/stdio/fopencookie.c
@@ -28,7 +28,7 @@
/* Currently no real reentrancy issues other than a possible double close(). */
#ifndef __BCC__
-FILE attribute_hidden *__fopencookie(void * __restrict cookie, const char * __restrict mode,
+FILE *fopencookie(void * __restrict cookie, const char * __restrict mode,
cookie_io_functions_t io_functions)
#else
FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode,
@@ -58,5 +58,6 @@ FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode,
return stream;
}
#ifndef __BCC__
-strong_alias(__fopencookie,fopencookie)
+libc_hidden_proto(fopencookie)
+libc_hidden_def(fopencookie)
#endif
diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c
index ee19c85a5..092a64981 100644
--- a/libc/stdio/fprintf.c
+++ b/libc/stdio/fprintf.c
@@ -8,16 +8,18 @@
#include "_stdio.h"
#include <stdarg.h>
-#undef fprintf
-int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...)
+libc_hidden_proto(vfprintf)
+
+int 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)
+libc_hidden_proto(fprintf)
+libc_hidden_def(fprintf)
diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c
index 4cc396e08..c30c0a12a 100644
--- a/libc/stdio/fputc.c
+++ b/libc/stdio/fputc.c
@@ -14,7 +14,7 @@
#ifdef __DO_UNLOCKED
-int attribute_hidden __fputc_unlocked_internal(int c, register FILE *stream)
+int __fputc_unlocked(int c, register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -68,20 +68,27 @@ int attribute_hidden __fputc_unlocked_internal(int c, register FILE *stream)
BAD:
return EOF;
}
+libc_hidden_proto(__fputc_unlocked)
+libc_hidden_def(__fputc_unlocked)
-strong_alias(__fputc_unlocked_internal,__fputc_unlocked)
-weak_alias(__fputc_unlocked_internal,fputc_unlocked)
-weak_alias(__fputc_unlocked_internal,putc_unlocked)
+strong_alias(__fputc_unlocked,fputc_unlocked)
+
+strong_alias(__fputc_unlocked,putc_unlocked)
+libc_hidden_proto(putc_unlocked)
+libc_hidden_def(putc_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fputc_unlocked_internal,__fputc)
-weak_alias(__fputc_unlocked_internal,fputc)
-hidden_strong_alias(__fputc_unlocked_internal,__putc)
-weak_alias(__fputc_unlocked_internal,putc)
+strong_alias(__fputc_unlocked,fputc)
+
+strong_alias(__fputc_unlocked,putc)
+libc_hidden_proto(putc)
+libc_hidden_def(putc)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int attribute_hidden __fputc(int c, register FILE *stream)
+libc_hidden_proto(__fputc_unlocked)
+
+int fputc(int c, register FILE *stream)
{
if (stream->__user_locking != 0) {
return __PUTC_UNLOCKED_MACRO(c, stream);
@@ -93,8 +100,11 @@ int attribute_hidden __fputc(int c, register FILE *stream)
return retval;
}
}
-strong_alias(__fputc,fputc)
-hidden_strong_alias(__fputc,__putc)
-weak_alias(__fputc,putc)
+libc_hidden_proto(fputc)
+libc_hidden_def(fputc)
+
+strong_alias(fputc,putc)
+libc_hidden_proto(putc)
+libc_hidden_def(putc)
#endif
diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c
index 64e7fd57f..b9dabee30 100644
--- a/libc/stdio/fputs.c
+++ b/libc/stdio/fputs.c
@@ -7,6 +7,11 @@
#include "_stdio.h"
+libc_hidden_proto(fputs_unlocked)
+
+libc_hidden_proto(strlen)
+libc_hidden_proto(fwrite_unlocked)
+
/* Note: The standard says fputs returns a nonnegative number on
* success. In this implementation, we return the length of the
* string written on success.
@@ -14,35 +19,37 @@
#ifdef __DO_UNLOCKED
-int attribute_hidden __fputs_unlocked(register const char * __restrict s,
+int fputs_unlocked(register const char * __restrict s,
FILE * __restrict stream)
{
- size_t n = __strlen(s);
+ size_t n = strlen(s);
- return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
+ return ((fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
}
+libc_hidden_def(fputs_unlocked)
-weak_alias(__fputs_unlocked,fputs_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fputs_unlocked,__fputs)
-weak_alias(__fputs_unlocked,fputs)
+strong_alias(fputs_unlocked,fputs)
+libc_hidden_proto(fputs)
+libc_hidden_def(fputs)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int attribute_hidden __fputs(const char * __restrict s, register FILE * __restrict stream)
+int fputs(const char * __restrict s, register FILE * __restrict stream)
{
int retval;
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fputs_unlocked(s, stream);
+ retval = fputs_unlocked(s, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fputs,fputs)
+libc_hidden_proto(fputs)
+libc_hidden_def(fputs)
#endif
diff --git a/libc/stdio/fputwc.c b/libc/stdio/fputwc.c
index 8f1178710..240c1e9c4 100644
--- a/libc/stdio/fputwc.c
+++ b/libc/stdio/fputwc.c
@@ -7,18 +7,20 @@
#include "_stdio.h"
+libc_hidden_proto(fputwc_unlocked)
+
#ifdef __DO_UNLOCKED
-wint_t attribute_hidden __fputwc_unlocked(wchar_t wc, FILE *stream)
+wint_t fputwc_unlocked(wchar_t wc, FILE *stream)
{
return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF;
}
+libc_hidden_def(fputwc_unlocked)
-weak_alias(__fputwc_unlocked,fputwc_unlocked)
-weak_alias(__fputwc_unlocked,putwc_unlocked)
+strong_alias(fputwc_unlocked,putwc_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fputwc_unlocked,fputwc)
-weak_alias(__fputwc_unlocked,putwc)
+strong_alias(fputwc_unlocked,fputwc)
+strong_alias(fputwc_unlocked,putwc)
#endif
#elif defined __UCLIBC_HAS_THREADS__
@@ -30,13 +32,13 @@ wint_t fputwc(wchar_t wc, register FILE *stream)
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fputwc_unlocked(wc, stream);
+ retval = fputwc_unlocked(wc, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-weak_alias(fputwc,putwc)
+strong_alias(fputwc,putwc)
#endif
diff --git a/libc/stdio/fputws.c b/libc/stdio/fputws.c
index 74919d6ea..d00c95797 100644
--- a/libc/stdio/fputws.c
+++ b/libc/stdio/fputws.c
@@ -5,44 +5,45 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define wcslen __wcslen
-
#include "_stdio.h"
+libc_hidden_proto(fputws_unlocked)
+
+libc_hidden_proto(wcslen)
+
#ifdef __DO_UNLOCKED
-int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws,
+int fputws_unlocked(const wchar_t *__restrict ws,
register FILE *__restrict stream)
{
size_t n = wcslen(ws);
return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1;
}
+libc_hidden_def(fputws_unlocked)
-weak_alias(__fputws_unlocked,fputws_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fputws_unlocked,__fputws)
-weak_alias(__fputws_unlocked,fputws)
+strong_alias(fputws_unlocked,fputws)
+libc_hidden_proto(fputws)
+libc_hidden_def(fputws)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-extern int __fputws_unlocked(const wchar_t *__restrict ws,
- FILE *__restrict stream) attribute_hidden;
-
-int attribute_hidden __fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
+int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
{
int retval;
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fputws_unlocked(ws, stream);
+ retval = fputws_unlocked(ws, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fputws,fputws)
+libc_hidden_proto(fputws)
+libc_hidden_def(fputws)
#endif
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index 0defb36a0..417ab2c8d 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -7,9 +7,14 @@
#include "_stdio.h"
+libc_hidden_proto(fread_unlocked)
+
#ifdef __DO_UNLOCKED
-size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb,
+libc_hidden_proto(memcpy)
+libc_hidden_proto(fflush_unlocked)
+
+size_t fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb,
FILE * __restrict stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -44,7 +49,7 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz
if (avail > todo) {
avail = todo;
}
- __memcpy(buffer, stream->__bufpos, avail);
+ memcpy(buffer, stream->__bufpos, avail);
buffer += avail;
stream->__bufpos += avail;
if (!(todo -= avail)) {
@@ -82,16 +87,17 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz
__STDIO_STREAM_VALIDATE(stream);
return 0;
}
+libc_hidden_def(fread_unlocked)
-weak_alias(__fread_unlocked,fread_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fread_unlocked,__fread)
-weak_alias(__fread_unlocked,fread)
+strong_alias(fread_unlocked,fread)
+libc_hidden_proto(fread)
+libc_hidden_def(fread)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb,
+size_t fread(void * __restrict ptr, size_t size, size_t nmemb,
register FILE * __restrict stream)
{
size_t retval;
@@ -99,12 +105,13 @@ size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fread_unlocked(ptr, size, nmemb, stream);
+ retval = fread_unlocked(ptr, size, nmemb, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fread,fread)
+libc_hidden_proto(fread)
+libc_hidden_def(fread)
#endif
diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c
index 7df035d48..7314807d3 100644
--- a/libc/stdio/freopen.c
+++ b/libc/stdio/freopen.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(fclose)
+
#ifndef __DO_LARGEFILE
# define FILEDES_ARG (-1)
#endif
diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c
index 190485775..0ce4acfb7 100644
--- a/libc/stdio/fseeko.c
+++ b/libc/stdio/fseeko.c
@@ -12,15 +12,19 @@
#endif
#ifndef __DO_LARGEFILE
-# define FSEEK __fseek
+# define FSEEK fseek
# define OFFSET_TYPE long int
#endif
-int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
+#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
+libc_hidden_proto(fseeko64)
+#endif
+
+int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
{
#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
- return __fseeko64(stream, offset, whence);
+ return fseeko64(stream, offset, whence);
#else
@@ -74,8 +78,10 @@ int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence
}
#ifdef __DO_LARGEFILE
-strong_alias(__fseeko64,fseeko64)
+libc_hidden_proto(fseeko64)
+libc_hidden_def(fseeko64)
#else
-strong_alias(__fseek,fseek)
-weak_alias(__fseek,fseeko)
+libc_hidden_proto(fseek)
+libc_hidden_def(fseek)
+strong_alias(fseek,fseeko)
#endif
diff --git a/libc/stdio/fseeko64.c b/libc/stdio/fseeko64.c
index 5bc4ae34e..78cab1b5c 100644
--- a/libc/stdio/fseeko64.c
+++ b/libc/stdio/fseeko64.c
@@ -8,6 +8,6 @@
#include "_stdio.h"
#define __DO_LARGEFILE
-#define FSEEK __fseeko64
+#define FSEEK fseeko64
#define OFFSET_TYPE __off64_t
#include "fseeko.c"
diff --git a/libc/stdio/fsetpos.c b/libc/stdio/fsetpos.c
index f33043f3b..d63adc024 100644
--- a/libc/stdio/fsetpos.c
+++ b/libc/stdio/fsetpos.c
@@ -8,9 +8,11 @@
#include "_stdio.h"
#ifndef __DO_LARGEFILE
-#define FSEEK __fseek
+#define FSEEK fseek
#endif
+libc_hidden_proto(FSEEK)
+
int fsetpos(FILE *stream, register const fpos_t *pos)
{
#ifdef __STDIO_MBSTATE
diff --git a/libc/stdio/fsetpos64.c b/libc/stdio/fsetpos64.c
index bf7d574cb..82819a4fe 100644
--- a/libc/stdio/fsetpos64.c
+++ b/libc/stdio/fsetpos64.c
@@ -10,5 +10,5 @@
#define __DO_LARGEFILE
#define fsetpos fsetpos64
#define fpos_t fpos64_t
-#define FSEEK __fseeko64
+#define FSEEK fseeko64
#include "fsetpos.c"
diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c
index 7f5c53126..0a3a53856 100644
--- a/libc/stdio/ftello.c
+++ b/libc/stdio/ftello.c
@@ -7,16 +7,20 @@
#include "_stdio.h"
+#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
+libc_hidden_proto(ftello64)
+#endif
+
#ifndef __DO_LARGEFILE
-# define FTELL __ftell
+# define FTELL ftell
# define OFFSET_TYPE long int
#endif
-OFFSET_TYPE attribute_hidden FTELL(register FILE *stream)
+OFFSET_TYPE FTELL(register FILE *stream)
{
#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
- __offmax_t pos = __ftello64(stream);
+ __offmax_t pos = ftello64(stream);
if ((sizeof(long) >= sizeof(__offmax_t)) || (((long) pos) == pos)) {
return ((long) pos);
@@ -47,8 +51,10 @@ OFFSET_TYPE attribute_hidden FTELL(register FILE *stream)
}
#ifdef __DO_LARGEFILE
-weak_alias(__ftello64,ftello64)
+libc_hidden_proto(ftello64)
+libc_hidden_def(ftello64)
#else
-weak_alias(__ftell,ftell)
-weak_alias(ftell,ftello)
+libc_hidden_proto(ftell)
+libc_hidden_def(ftell)
+strong_alias(ftell,ftello)
#endif
diff --git a/libc/stdio/ftello64.c b/libc/stdio/ftello64.c
index 32a37d368..905834f39 100644
--- a/libc/stdio/ftello64.c
+++ b/libc/stdio/ftello64.c
@@ -8,6 +8,6 @@
#include "_stdio.h"
#define __DO_LARGEFILE
-#define FTELL __ftello64
+#define FTELL ftello64
#define OFFSET_TYPE __off64_t
#include "ftello.c"
diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c
index c81d40482..f2a1afbec 100644
--- a/libc/stdio/fwprintf.c
+++ b/libc/stdio/fwprintf.c
@@ -9,13 +9,15 @@
#include <stdarg.h>
#include <wchar.h>
+libc_hidden_proto(vfwprintf)
+
int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = __vfwprintf(stream, format, arg);
+ rv = vfwprintf(stream, format, arg);
va_end(arg);
return rv;
diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c
index abe24fbb7..106ee5db6 100644
--- a/libc/stdio/fwrite.c
+++ b/libc/stdio/fwrite.c
@@ -7,9 +7,11 @@
#include "_stdio.h"
+libc_hidden_proto(fwrite_unlocked)
+
#ifdef __DO_UNLOCKED
-size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t size,
+size_t fwrite_unlocked(const void * __restrict ptr, size_t size,
size_t nmemb, register FILE * __restrict stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -33,16 +35,17 @@ size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t si
return 0;
}
+libc_hidden_def(fwrite_unlocked)
-weak_alias(__fwrite_unlocked,fwrite_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-hidden_strong_alias(__fwrite_unlocked,__fwrite)
-weak_alias(__fwrite_unlocked,fwrite)
+strong_alias(fwrite_unlocked,fwrite)
+libc_hidden_proto(fwrite)
+libc_hidden_def(fwrite)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size,
+size_t fwrite(const void * __restrict ptr, size_t size,
size_t nmemb, register FILE * __restrict stream)
{
size_t retval;
@@ -50,12 +53,13 @@ size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size,
__STDIO_AUTO_THREADLOCK(stream);
- retval = __fwrite_unlocked(ptr, size, nmemb, stream);
+ retval = fwrite_unlocked(ptr, size, nmemb, stream);
__STDIO_AUTO_THREADUNLOCK(stream);
return retval;
}
-strong_alias(__fwrite,fwrite)
+libc_hidden_proto(fwrite)
+libc_hidden_def(fwrite)
#endif
diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c
index d17704056..6da8307b6 100644
--- a/libc/stdio/getchar.c
+++ b/libc/stdio/getchar.c
@@ -7,21 +7,21 @@
#include "_stdio.h"
-#undef getchar_unlocked
-#undef getchar
+libc_hidden_proto(__fgetc_unlocked)
+#undef getchar
#ifdef __DO_UNLOCKED
-int attribute_hidden __getchar_unlocked(void)
+#undef getchar_unlocked
+int getchar_unlocked(void)
{
register FILE *stream = stdin;
return __GETC_UNLOCKED_MACRO(stream);
}
-weak_alias(__getchar_unlocked,getchar_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getchar_unlocked,getchar)
+strong_alias(getchar_unlocked,getchar)
#endif
#elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c
index e1b808340..7c769dd63 100644
--- a/libc/stdio/getdelim.c
+++ b/libc/stdio/getdelim.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(__fgetc_unlocked)
+
/* Note: There is a defect in this function. (size_t vs ssize_t). */
/* glibc function --
@@ -20,7 +22,7 @@
#define GETDELIM_GROWBY 64
-ssize_t attribute_hidden __getdelim(char **__restrict lineptr, size_t *__restrict n,
+ssize_t getdelim(char **__restrict lineptr, size_t *__restrict n,
int delimiter, register FILE *__restrict stream)
{
register char *buf;
@@ -73,5 +75,5 @@ ssize_t attribute_hidden __getdelim(char **__restrict lineptr, size_t *__restric
return pos;
}
-
-strong_alias(__getdelim,getdelim)
+libc_hidden_proto(getdelim)
+libc_hidden_def(getdelim)
diff --git a/libc/stdio/getline.c b/libc/stdio/getline.c
index 943526abe..0426d37f5 100644
--- a/libc/stdio/getline.c
+++ b/libc/stdio/getline.c
@@ -5,13 +5,14 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define getdelim __getdelim
-
#include "_stdio.h"
-ssize_t attribute_hidden __getline(char **__restrict lineptr, size_t *__restrict n,
+libc_hidden_proto(getdelim)
+
+ssize_t getline(char **__restrict lineptr, size_t *__restrict n,
FILE *__restrict stream)
{
return getdelim(lineptr, n, '\n', stream);
}
-strong_alias(__getline,getline)
+libc_hidden_proto(getline)
+libc_hidden_def(getline)
diff --git a/libc/stdio/gets.c b/libc/stdio/gets.c
index 1badd8152..1c908399c 100644
--- a/libc/stdio/gets.c
+++ b/libc/stdio/gets.c
@@ -11,6 +11,9 @@ link_warning(gets, "the 'gets' function is dangerous and should not be used.")
/* UNSAFE FUNCTION -- do not bother optimizing */
+libc_hidden_proto(getchar_unlocked)
+libc_hidden_proto(__fgetc_unlocked)
+
char *gets(char *s)
{
register char *p = s;
@@ -21,7 +24,7 @@ char *gets(char *s)
/* Note: don't worry about performance here... this shouldn't be used!
* Therefore, force actual function call. */
- while (((c = __getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
+ while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
++p;
}
if ((c == EOF) || (s == p)) {
diff --git a/libc/stdio/getw.c b/libc/stdio/getw.c
index 6b3b9e5e7..e3aeda92c 100644
--- a/libc/stdio/getw.c
+++ b/libc/stdio/getw.c
@@ -7,12 +7,14 @@
#include "_stdio.h"
+libc_hidden_proto(fread_unlocked)
+
/* SUSv2 Legacy function -- need not be reentrant. */
int getw(FILE *stream)
{
int aw;
- return (__fread_unlocked((void *) &aw, sizeof(int), 1, stream) != 0)
+ return (fread_unlocked((void *) &aw, sizeof(int), 1, stream) != 0)
? aw : EOF;
}
diff --git a/libc/stdio/getwchar.c b/libc/stdio/getwchar.c
index 90e5a032e..9c480b564 100644
--- a/libc/stdio/getwchar.c
+++ b/libc/stdio/getwchar.c
@@ -9,23 +9,24 @@
#ifdef __DO_UNLOCKED
-wint_t __getwchar_unlocked(void)
+libc_hidden_proto(fgetwc_unlocked)
+
+wint_t getwchar_unlocked(void)
{
- return __fgetwc_unlocked(stdin);
+ return fgetwc_unlocked(stdin);
}
-weak_alias(__getwchar_unlocked,getwchar_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getwchar_unlocked,getwchar)
+strong_alias(getwchar_unlocked,getwchar)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-extern wint_t __fgetwc (__FILE *__stream) attribute_hidden;
+libc_hidden_proto(fgetwc)
wint_t getwchar(void)
{
- return __fgetwc(stdin);
+ return fgetwc(stdin);
}
#endif
diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c
index ce6bde1a4..9aed79934 100644
--- a/libc/stdio/old_vfprintf.c
+++ b/libc/stdio/old_vfprintf.c
@@ -127,8 +127,6 @@
/**************************************************************************/
-#define strnlen __strnlen
-
#define _ISOC99_SOURCE /* for ULLONG primarily... */
#define _GNU_SOURCE /* for strnlen */
#include "_stdio.h"
@@ -148,6 +146,12 @@
#include <pthread.h>
#endif /* __UCLIBC_HAS_THREADS__ */
+libc_hidden_proto(strlen)
+libc_hidden_proto(strnlen)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(putc_unlocked)
+libc_hidden_proto(__glibc_strerror_r)
+
/* #undef __UCLIBC_HAS_FLOATS__ */
/* #undef WANT_FLOAT_ERROR */
/* #define WANT_FLOAT_ERROR 1 */
@@ -166,7 +170,7 @@
#ifdef __STDIO_BUFFERS
-#define PUTC(C,F) __putc_unlocked((C),(F))
+#define PUTC(C,F) putc_unlocked((C),(F))
#define OUTNSTR _outnstr
#define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream)
@@ -190,7 +194,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n)
if (r > n) {
r = n;
}
- __memcpy(f->bufpos, s, r);
+ memcpy(f->bufpos, s, r);
f->bufpos += r;
}
}
@@ -199,7 +203,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n)
static void putc_unlocked_sprintf(int c, __FILE_vsnprintf *f)
{
if (!__STDIO_STREAM_IS_FAKE_VSNPRINTF_NB(&f->f)) {
- __putc_unlocked(c, &f->f);
+ putc_unlocked(c, &f->f);
} else if (f->bufpos < f->bufend) {
*f->bufpos++ = c;
}
@@ -236,7 +240,7 @@ static void _charpad(FILE * __restrict stream, int padchar, size_t numpad)
static void _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf)
{
if (type & 0x80) { /* Some type of padding needed. */
- int buflen = __strlen((const char *) buf);
+ int buflen = strlen((const char *) buf);
if ((len -= buflen) > 0) {
_charpad(fp, (type & 0x7f), len);
}
@@ -341,7 +345,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 attribute_hidden __vfprintf(FILE * __restrict op, register const char * __restrict fmt,
+int vfprintf(FILE * __restrict op, register const char * __restrict fmt,
va_list ap)
{
union {
@@ -450,7 +454,7 @@ int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __re
if (*fmt == 'm') {
flag[FLAG_PLUS] = '\0';
flag[FLAG_0_PAD] = ' ';
- p = __glibc_strerror_r_internal(errno, tmp, sizeof(tmp));
+ p = __glibc_strerror_r(errno, tmp, sizeof(tmp));
goto print;
}
#endif
@@ -711,4 +715,5 @@ int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __re
return i;
}
-strong_alias(__vfprintf,vfprintf)
+libc_hidden_proto(vfprintf)
+libc_hidden_def(vfprintf)
diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c
index f750cd11c..fd0c74c48 100644
--- a/libc/stdio/open_memstream.c
+++ b/libc/stdio/open_memstream.c
@@ -5,10 +5,12 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define fopencookie __fopencookie
-
#include "_stdio.h"
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memset)
+libc_hidden_proto(fopencookie)
+
#ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
#error no custom streams!
#endif
@@ -53,7 +55,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize)
}
}
- __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
+ memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize);
COOKIE->pos += bufsize;
if (COOKIE->pos > COOKIE->eof) {
@@ -92,7 +94,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence)
if (buf) {
*COOKIE->bufloc = COOKIE->buf = buf;
COOKIE->len = leastlen;
- __memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */
+ memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */
} else {
/* TODO: check glibc errno setting... */
return -1;
@@ -102,7 +104,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence)
*pos = COOKIE->pos = --leastlen;
if (leastlen > COOKIE->eof) {
- __memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0);
+ memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0);
*COOKIE->sizeloc = COOKIE->eof;
}
@@ -126,7 +128,7 @@ static const cookie_io_functions_t _oms_io_funcs = {
* (ie replace the FILE buffer with the cookie buffer and update FILE bufstart,
* etc. whenever we seek). */
-FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc)
+FILE *open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc)
{
register __oms_cookie *cookie;
register FILE *fp;
@@ -162,4 +164,5 @@ FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__rest
return NULL;
}
-strong_alias(__open_memstream,open_memstream)
+libc_hidden_proto(open_memstream)
+libc_hidden_def(open_memstream)
diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c
index 9edcf4efb..f10667cbf 100644
--- a/libc/stdio/perror.c
+++ b/libc/stdio/perror.c
@@ -7,11 +7,14 @@
#include "_stdio.h"
+libc_hidden_proto(fprintf)
+libc_hidden_proto(__glibc_strerror_r)
+
#ifdef __UCLIBC_MJN3_ONLY__
#warning CONSIDER: Increase buffer size for error message (non-%m case)?
#endif
-void attribute_hidden __perror(register const char *s)
+void perror(register const char *s)
{
/* If the program is calling perror, it's a safe bet that printf and
* friends are used as well. It is also possible that the calling
@@ -30,8 +33,9 @@ void attribute_hidden __perror(register const char *s)
{
char buf[64];
fprintf(stderr, "%s%s%s\n", s, sep,
- __glibc_strerror_r_internal(errno, buf, sizeof(buf)));
+ __glibc_strerror_r(errno, buf, sizeof(buf)));
}
#endif
}
-strong_alias(__perror,perror)
+libc_hidden_proto(perror)
+libc_hidden_def(perror)
diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c
index f84a27a3c..501cd415c 100644
--- a/libc/stdio/popen.c
+++ b/libc/stdio/popen.c
@@ -1,6 +1,7 @@
/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
@@ -14,20 +15,23 @@
* Fix failure exit code for failed execve().
*/
-#define waitpid __waitpid
-#define execl __execl
-#define dup2 __dup2
-#define fdopen __fdopen
-#define pipe __pipe
-#define vfork __vfork
-#define fork __fork
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
+libc_hidden_proto(close)
+libc_hidden_proto(_exit)
+libc_hidden_proto(waitpid)
+libc_hidden_proto(execl)
+libc_hidden_proto(dup2)
+libc_hidden_proto(fdopen)
+libc_hidden_proto(pipe)
+libc_hidden_proto(vfork)
+libc_hidden_proto(fork)
+libc_hidden_proto(fclose)
+
/* uClinux-2.0 has vfork, but Linux 2.0 doesn't */
#include <sys/syscall.h>
#if ! defined __NR_vfork
@@ -88,36 +92,36 @@ FILE *popen(const char *command, const char *modes)
parent_fd = pipe_fd[1-child_writing];
if (!(fp = fdopen(parent_fd, modes))) {
- __close(parent_fd);
- __close(child_fd);
+ close(parent_fd);
+ close(child_fd);
goto FREE_PI;
}
VFORK_LOCK;
if ((pid = vfork()) == 0) { /* Child of vfork... */
- __close(parent_fd);
+ close(parent_fd);
if (child_fd != child_writing) {
dup2(child_fd, child_writing);
- __close(child_fd);
+ close(child_fd);
}
/* SUSv3 requires that any previously popen()'d streams in the
* parent shall be closed in the child. */
for (po = popen_list ; po ; po = po->next) {
- __close(po->f->__filedes);
+ close(po->f->__filedes);
}
execl("/bin/sh", "sh", "-c", command, (char *)0);
/* SUSv3 mandates an exit code of 127 for the child if the
* command interpreter can not be invoked. */
- _exit_internal(127);
+ _exit(127);
}
VFORK_UNLOCK;
/* We need to close the child filedes whether vfork failed or
* it succeeded and we're in the parent. */
- __close(child_fd);
+ close(child_fd);
if (pid > 0) { /* Parent of vfork... */
pi->pid = pid;
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 82326a9c3..8c547878e 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -8,15 +8,18 @@
#include "_stdio.h"
#include <stdarg.h>
-int attribute_hidden __printf(const char * __restrict format, ...)
+libc_hidden_proto(vfprintf)
+
+int 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)
+libc_hidden_proto(printf)
+libc_hidden_def(printf)
diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c
index e503b9484..b54a7a815 100644
--- a/libc/stdio/putchar.c
+++ b/libc/stdio/putchar.c
@@ -7,21 +7,21 @@
#include "_stdio.h"
-#undef putchar_unlocked
-#undef putchar
+libc_hidden_proto(__fputc_unlocked)
+#undef putchar
#ifdef __DO_UNLOCKED
-int __putchar_unlocked(int c)
+#undef putchar_unlocked
+int putchar_unlocked(int c)
{
register FILE *stream = stdout;
return __PUTC_UNLOCKED_MACRO(c, stream);
}
-weak_alias(__putchar_unlocked,putchar_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__putchar_unlocked,putchar)
+strong_alias(putchar_unlocked,putchar)
#endif
#elif defined __UCLIBC_HAS_THREADS__
diff --git a/libc/stdio/puts.c b/libc/stdio/puts.c
index 3a510325b..08525b2f6 100644
--- a/libc/stdio/puts.c
+++ b/libc/stdio/puts.c
@@ -7,6 +7,9 @@
#include "_stdio.h"
+libc_hidden_proto(__fputc_unlocked)
+libc_hidden_proto(fputs_unlocked)
+
int puts(register const char * __restrict s)
{
register FILE *stream = stdout; /* This helps bcc optimize. */
@@ -20,9 +23,9 @@ int puts(register const char * __restrict s)
* then we could have a newline in the buffer of an LBF stream. */
/* Note: Nonportable as fputs need only return nonnegative on success. */
- if ((n = __fputs_unlocked(s, stream)) != EOF) {
+ if ((n = fputs_unlocked(s, stream)) != EOF) {
++n;
- if (__fputc_unlocked_internal('\n', stream) == EOF) {
+ if (__fputc_unlocked('\n', stream) == EOF) {
n = EOF;
}
}
diff --git a/libc/stdio/putw.c b/libc/stdio/putw.c
index 5dfa06890..469e44aea 100644
--- a/libc/stdio/putw.c
+++ b/libc/stdio/putw.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(fwrite_unlocked)
+
/* SUSv2 Legacy function -- need not be reentrant. */
int putw(int w, FILE *stream)
@@ -20,9 +22,9 @@ int putw(int w, FILE *stream)
#endif
#if EOF == -1
- return __fwrite_unlocked((void *) PW, sizeof(int), 1, stream) - 1;
+ return fwrite_unlocked((void *) PW, sizeof(int), 1, stream) - 1;
#else
- return (__fwrite_unlocked((void *) PW, sizeof(int), 1, stream) != 0)
+ return (fwrite_unlocked((void *) PW, sizeof(int), 1, stream) != 0)
? 0 : EOF;
#endif
}
diff --git a/libc/stdio/putwchar.c b/libc/stdio/putwchar.c
index d093656e6..e25f35e5e 100644
--- a/libc/stdio/putwchar.c
+++ b/libc/stdio/putwchar.c
@@ -9,23 +9,25 @@
#ifdef __DO_UNLOCKED
-wint_t __putwchar_unlocked(wchar_t wc)
+libc_hidden_proto(fputwc_unlocked)
+
+wint_t putwchar_unlocked(wchar_t wc)
{
- return __fputwc_unlocked(wc, stdout);
+ return fputwc_unlocked(wc, stdout);
}
-weak_alias(__putwchar_unlocked,putwchar_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__putwchar_unlocked,putwchar)
+strong_alias(putwchar_unlocked,putwchar)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-extern int __fputc (int __c, FILE *__stream) attribute_hidden;
+/* psm: should this be fputwc? */
+libc_hidden_proto(fputc)
wint_t putwchar(wchar_t wc)
{
- return __fputc(wc, stdout);
+ return fputc(wc, stdout);
}
#endif
diff --git a/libc/stdio/remove.c b/libc/stdio/remove.c
index 2d4fedcc1..ad9974dff 100644
--- a/libc/stdio/remove.c
+++ b/libc/stdio/remove.c
@@ -5,21 +5,21 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define rmdir __rmdir
-#define unlink __unlink
-
#include "_stdio.h"
#include <unistd.h>
#include <errno.h>
+libc_hidden_proto(rmdir)
+libc_hidden_proto(unlink)
+
/* SUSv3 states:
* If path does not name a directory, remove(path) shall be equivalent
* to unlink(path). If path names a directory, remove(path) shall be
* equivalent to rmdir(path).
*/
-int attribute_hidden __remove(register const char *filename)
+int remove(register const char *filename)
{
int saved_errno = errno;
int rv;
@@ -30,4 +30,5 @@ int attribute_hidden __remove(register const char *filename)
}
return rv;
}
-strong_alias(__remove,remove)
+libc_hidden_proto(remove)
+libc_hidden_def(remove)
diff --git a/libc/stdio/rewind.c b/libc/stdio/rewind.c
index 8e0acc2d0..713b76ec8 100644
--- a/libc/stdio/rewind.c
+++ b/libc/stdio/rewind.c
@@ -7,15 +7,18 @@
#include "_stdio.h"
-void attribute_hidden __rewind(register FILE *stream)
+libc_hidden_proto(fseek)
+
+void rewind(register FILE *stream)
{
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stream);
__STDIO_STREAM_CLEAR_ERROR(stream); /* Clear the error indicator */
- __fseek(stream, 0L, SEEK_SET); /* first since fseek could set it. */
+ fseek(stream, 0L, SEEK_SET); /* first since fseek could set it. */
__STDIO_AUTO_THREADUNLOCK(stream);
}
-strong_alias(__rewind,rewind)
+libc_hidden_proto(rewind)
+libc_hidden_def(rewind)
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index 7fe11514d..8def91c6b 100644
--- a/libc/stdio/scanf.c
+++ b/libc/stdio/scanf.c
@@ -43,14 +43,6 @@
* standards and from an official C standard defect report.
*/
-#define wcslen __wcslen
-#define mbsrtowcs __mbsrtowcs
-#define mbrtowc __mbrtowc
-#define ungetc __ungetc
-#define ungetwc __ungetwc
-#define iswspace __iswspace
-#define wcrtomb __wcrtomb
-
#define _ISOC99_SOURCE /* for LLONG_MAX primarily... */
#define _GNU_SOURCE
#include <features.h>
@@ -86,6 +78,27 @@
#include <bits/uClibc_fpmax.h>
#endif /* __UCLIBC_HAS_FLOATS__ */
+libc_hidden_proto(memcmp)
+libc_hidden_proto(memset)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(strlen)
+libc_hidden_proto(ungetc)
+libc_hidden_proto(vfscanf)
+libc_hidden_proto(vsscanf)
+libc_hidden_proto(fclose)
+libc_hidden_proto(getc_unlocked)
+libc_hidden_proto(__fgetc_unlocked)
+#ifdef __UCLIBC_HAS_WCHAR__
+libc_hidden_proto(wcslen)
+libc_hidden_proto(vfwscanf)
+libc_hidden_proto(vswscanf)
+libc_hidden_proto(mbsrtowcs)
+libc_hidden_proto(mbrtowc)
+libc_hidden_proto(ungetwc)
+libc_hidden_proto(iswspace)
+libc_hidden_proto(fgetwc_unlocked)
+#endif
+
#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
#ifdef L_vfscanf
/* only emit this once */
@@ -147,18 +160,19 @@ _stdlib_strto_l(register const char * __restrict str,
/**********************************************************************/
#ifdef L_fscanf
-int attribute_hidden __fscanf(FILE * __restrict stream, const char * __restrict format, ...)
+int 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)
+libc_hidden_proto(fscanf)
+libc_hidden_def(fscanf)
#endif
/**********************************************************************/
@@ -170,7 +184,7 @@ int scanf(const char * __restrict format, ...)
int rv;
va_start(arg, format);
- rv = __vfscanf(stdin, format, arg);
+ rv = vfscanf(stdin, format, arg);
va_end(arg);
return rv;
@@ -182,18 +196,19 @@ int scanf(const char * __restrict format, ...)
#ifdef __STDIO_HAS_VSSCANF
-int attribute_hidden __sscanf(const char * __restrict str, const char * __restrict format, ...)
+int 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)
+libc_hidden_proto(sscanf)
+libc_hidden_def(sscanf)
#else /* __STDIO_HAS_VSSCANF */
#warning Skipping sscanf since no vsscanf!
@@ -203,11 +218,12 @@ strong_alias(__sscanf,sscanf)
/**********************************************************************/
#ifdef L_vscanf
-int attribute_hidden __vscanf(const char * __restrict format, va_list arg)
+int vscanf(const char * __restrict format, va_list arg)
{
- return __vfscanf(stdin, format, arg);
+ return vfscanf(stdin, format, arg);
}
-strong_alias(__vscanf,vscanf)
+libc_hidden_proto(vscanf)
+libc_hidden_def(vscanf)
#endif
/**********************************************************************/
@@ -219,7 +235,7 @@ strong_alias(__vscanf,vscanf)
#ifdef __STDIO_BUFFERS
-int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
+int vsscanf(__const char *sp, __const char *fmt, va_list ap)
{
FILE f;
@@ -253,22 +269,22 @@ int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
f.__bufstart =
f.__bufpos = (unsigned char *) ((void *) sp);
f.__bufread =
- f.__bufend = f.__bufstart + __strlen(sp);
+ f.__bufend = f.__bufstart + strlen(sp);
__STDIO_STREAM_ENABLE_GETC(&f);
__STDIO_STREAM_DISABLE_PUTC(&f);
- return __vfscanf(&f, fmt, ap);
+ return vfscanf(&f, fmt, ap);
}
-strong_alias(__vsscanf,vsscanf)
+libc_hidden_def(vsscanf)
#elif !defined(__UCLIBC_HAS_WCHAR__)
-int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
+int vsscanf(__const char *sp, __const char *fmt, va_list ap)
{
__FILE_vsscanf f;
f.bufpos = (unsigned char *) ((void *) sp);
- f.bufread = f.bufpos + __strlen(sp);
+ f.bufread = f.bufpos + strlen(sp);
/* __STDIO_STREAM_RESET_GCS(&f.f); */
#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
@@ -296,25 +312,25 @@ int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
#endif
f.f.__nextopen = NULL;
- return __vfscanf(&f.f, fmt, ap);
+ return vfscanf(&f.f, fmt, ap);
}
-strong_alias(__vsscanf,vsscanf)
+libc_hidden_def(vsscanf)
#elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__)
-int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap)
+int 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);
+ if ((f = fmemopen((char *)sp, strlen(sp), "r")) != NULL) {
+ rv = vfscanf(f, fmt, ap);
fclose(f);
}
return rv;
}
-strong_alias(__vsscanf,vsscanf)
+libc_hidden_def(vsscanf)
#else
#warning Skipping vsscanf since no buffering, no custom streams, and wchar enabled!
@@ -333,7 +349,7 @@ int fwscanf(FILE * __restrict stream, const wchar_t * __restrict format, ...)
int rv;
va_start(arg, format);
- rv = __vfwscanf(stream, format, arg);
+ rv = vfwscanf(stream, format, arg);
va_end(arg);
return rv;
@@ -349,7 +365,7 @@ int wscanf(const wchar_t * __restrict format, ...)
int rv;
va_start(arg, format);
- rv = __vfwscanf(stdin, format, arg);
+ rv = vfwscanf(stdin, format, arg);
va_end(arg);
return rv;
@@ -368,7 +384,7 @@ int swscanf(const wchar_t * __restrict str, const wchar_t * __restrict format,
int rv;
va_start(arg, format);
- rv = __vswscanf(str, format, arg);
+ rv = vswscanf(str, format, arg);
va_end(arg);
return rv;
@@ -383,7 +399,7 @@ int swscanf(const wchar_t * __restrict str, const wchar_t * __restrict format,
int vwscanf(const wchar_t * __restrict format, va_list arg)
{
- return __vfwscanf(stdin, format, arg);
+ return vfwscanf(stdin, format, arg);
}
#endif
@@ -392,7 +408,7 @@ int vwscanf(const wchar_t * __restrict format, va_list arg)
#ifdef __STDIO_BUFFERS
-int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format,
+int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format,
va_list arg)
{
FILE f;
@@ -429,9 +445,9 @@ int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t *
#endif
f.__nextopen = NULL;
- return __vfwscanf(&f, format, arg);
+ return vfwscanf(&f, format, arg);
}
-strong_alias(__vswscanf,vswscanf)
+libc_hidden_def(vswscanf)
#else /* __STDIO_BUFFERS */
#warning Skipping vswscanf since no buffering!
#endif /* __STDIO_BUFFERS */
@@ -580,7 +596,6 @@ enum {
#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
@@ -590,12 +605,11 @@ typedef unsigned char __uchar_t;
#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))
#else /* __UCLIBC_HAS_WCHAR__ */
-#define GETC(SC) __getc_unlocked((SC)->fp)
+#define GETC(SC) getc_unlocked((SC)->fp)
#endif /* __UCLIBC_HAS_WCHAR__ */
#endif
@@ -959,7 +973,7 @@ int attribute_hidden __psfs_parse_spec(register psfs_t *psfs)
#ifdef L_vfscanf
static int sc_getc(register struct scan_cookie *sc)
{
- return (__getc_unlocked)(sc->fp); /* Disable the macro. */
+ return (getc_unlocked)(sc->fp); /* Disable the macro. */
}
static int scan_getwc(register struct scan_cookie *sc)
@@ -1031,7 +1045,7 @@ static int sc_getc(register struct scan_cookie *sc)
sc->fp->__modeflags |= __FLAG_EOF;
return EOF;
}
- } else if ((wc = __fgetwc_unlocked(sc->fp)) == WEOF) {
+ } else if ((wc = fgetwc_unlocked(sc->fp)) == WEOF) {
return EOF;
}
@@ -1077,7 +1091,7 @@ static int scan_getwc(register struct scan_cookie *sc)
sc->ungot_flag |= 2;
return -1;
}
- } else if ((wc = __fgetwc_unlocked(sc->fp)) == WEOF) {
+ } else if ((wc = fgetwc_unlocked(sc->fp)) == WEOF) {
sc->ungot_flag |= 2;
return -1;
}
@@ -1148,7 +1162,7 @@ static const char fake_thousands_sep_str[] = ",";
#endif /* L_vfwscanf */
-int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg)
+int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg)
{
const Wuchar *fmt;
unsigned char *b;
@@ -1201,7 +1215,7 @@ int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restric
#if defined(NL_ARGMAX) && (NL_ARGMAX > 0)
psfs.num_pos_args = -1; /* Must start at -1. */
/* Initialize positional arg ptrs to NULL. */
- __memset(psfs.pos_args, 0, sizeof(psfs.pos_args));
+ memset(psfs.pos_args, 0, sizeof(psfs.pos_args));
#endif /* defined(NL_ARGMAX) && (NL_ARGMAX > 0) */
__STDIO_AUTO_THREADLOCK(fp);
@@ -1433,7 +1447,7 @@ int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restric
++fmt;
invert = 1;
}
- __memset(scanset, invert, sizeof(scanset));
+ memset(scanset, invert, sizeof(scanset));
invert = 1-invert;
if (*fmt == ']') {
@@ -1752,7 +1766,7 @@ int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restric
return psfs.cnt;
}
-strong_alias(HIDDEN_VFSCANF,VFSCANF)
+libc_hidden_def(VFSCANF)
#endif
/**********************************************************************/
#ifdef L___psfs_do_numeric
@@ -1983,14 +1997,14 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
if ((psfs->conv_num > CONV_i) /* float conversion */
&& (!pass || (i == nblk1)) /* possible last */
- && !__memcmp(sc->thousands_sep, sc->fake_decpt, k)
+ && !memcmp(sc->thousands_sep, sc->fake_decpt, k)
/* and prefix matched, so could be decpt */
) {
__scan_getc(sc);
p = sc->fake_decpt + k;
do {
if (!*++p) {
- __strcpy(b, sc->decpt);
+ strcpy(b, sc->decpt);
b += sc->decpt_len;
goto GOT_DECPT;
}
@@ -2084,7 +2098,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
p = sc->fake_decpt;
do {
if (!*p) {
- __strcpy(b, sc->decpt);
+ strcpy(b, sc->decpt);
b += sc->decpt_len;
break;
}
diff --git a/libc/stdio/setbuf.c b/libc/stdio/setbuf.c
index 02a4736ac..6de2c91a1 100644
--- a/libc/stdio/setbuf.c
+++ b/libc/stdio/setbuf.c
@@ -7,9 +7,11 @@
#include "_stdio.h"
+libc_hidden_proto(setvbuf)
+
void setbuf(FILE * __restrict stream, register char * __restrict buf)
{
#ifdef __STDIO_BUFFERS
- __setvbuf(stream, buf, ((buf != NULL) ? _IOFBF : _IONBF), BUFSIZ);
+ setvbuf(stream, buf, ((buf != NULL) ? _IOFBF : _IONBF), BUFSIZ);
#endif
}
diff --git a/libc/stdio/setbuffer.c b/libc/stdio/setbuffer.c
index d1f12a1af..3ca4fb7f8 100644
--- a/libc/stdio/setbuffer.c
+++ b/libc/stdio/setbuffer.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(setvbuf)
+
/* A BSD function. The implementation matches the linux man page,
* except that we do not bother calling setvbuf if not configured
* for stream buffering.
@@ -16,6 +18,6 @@ void setbuffer(FILE * __restrict stream, register char * __restrict buf,
size_t size)
{
#ifdef __STDIO_BUFFERS
- __setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), size);
+ setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), size);
#endif
}
diff --git a/libc/stdio/setlinebuf.c b/libc/stdio/setlinebuf.c
index 56e89e11b..29b2bdeac 100644
--- a/libc/stdio/setlinebuf.c
+++ b/libc/stdio/setlinebuf.c
@@ -7,6 +7,8 @@
#include "_stdio.h"
+libc_hidden_proto(setvbuf)
+
/* A BSD function. The implementation matches the linux man page,
* except that we do not bother calling setvbuf if not configured
* for stream buffering.
@@ -15,6 +17,6 @@
void setlinebuf(FILE * __restrict stream)
{
#ifdef __STDIO_BUFFERS
- __setvbuf(stream, NULL, _IOLBF, (size_t) 0);
+ setvbuf(stream, NULL, _IOLBF, (size_t) 0);
#endif
}
diff --git a/libc/stdio/setvbuf.c b/libc/stdio/setvbuf.c
index d12d1576a..2ac258492 100644
--- a/libc/stdio/setvbuf.c
+++ b/libc/stdio/setvbuf.c
@@ -14,7 +14,7 @@
#error Assumption violated for buffering mode flags
#endif
-int attribute_hidden __setvbuf(register FILE * __restrict stream, register char * __restrict buf,
+int setvbuf(register FILE * __restrict stream, register char * __restrict buf,
int mode, size_t size)
{
#ifdef __STDIO_BUFFERS
@@ -104,4 +104,5 @@ int attribute_hidden __setvbuf(register FILE * __restrict stream, register char
#endif
}
-strong_alias(__setvbuf,setvbuf)
+libc_hidden_proto(setvbuf)
+libc_hidden_def(setvbuf)
diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c
index a1ea79fc0..9cfe812ca 100644
--- a/libc/stdio/snprintf.c
+++ b/libc/stdio/snprintf.c
@@ -12,17 +12,20 @@
#warning Skipping snprintf since no vsnprintf!
#else
-int attribute_hidden __snprintf(char *__restrict buf, size_t size,
+libc_hidden_proto(vsnprintf)
+
+int 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)
+libc_hidden_proto(snprintf)
+libc_hidden_def(snprintf)
#endif
diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c
index 5778c011d..bbda86bee 100644
--- a/libc/stdio/sprintf.c
+++ b/libc/stdio/sprintf.c
@@ -12,17 +12,20 @@
#warning Skipping sprintf since no vsnprintf!
#else
-int attribute_hidden __sprintf(char *__restrict buf, const char * __restrict format, ...)
+libc_hidden_proto(vsnprintf)
+
+int 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)
+libc_hidden_proto(sprintf)
+libc_hidden_def(sprintf)
#endif
diff --git a/libc/stdio/swprintf.c b/libc/stdio/swprintf.c
index b373df8bd..0c209fe4b 100644
--- a/libc/stdio/swprintf.c
+++ b/libc/stdio/swprintf.c
@@ -5,12 +5,12 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define vswprintf __vswprintf
-
#include "_stdio.h"
#include <stdarg.h>
#include <wchar.h>
+libc_hidden_proto(vswprintf)
+
#ifndef __STDIO_BUFFERS
#warning Skipping swprintf since no buffering!
#else /* __STDIO_BUFFERS */
diff --git a/libc/stdio/tempnam.c b/libc/stdio/tempnam.c
index d626dc0f8..43cbf781b 100644
--- a/libc/stdio/tempnam.c
+++ b/libc/stdio/tempnam.c
@@ -20,6 +20,8 @@
#include <string.h>
#include "../misc/internals/tempname.h"
+libc_hidden_proto(strdup)
+
/* Generate a unique temporary filename using up to five characters of PFX
if it is not NULL. The directory to put this file in is searched for
as follows: First the environment variable "TMPDIR" is checked.
@@ -38,6 +40,6 @@ tempnam (const char *dir, const char *pfx)
if (__gen_tempname (buf, __GT_NOCREATE))
return NULL;
- return __strdup (buf);
+ return strdup (buf);
}
diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c
index 606fcc436..f83944539 100644
--- a/libc/stdio/tmpfile.c
+++ b/libc/stdio/tmpfile.c
@@ -16,14 +16,15 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define fdopen __fdopen
-#define remove __remove
-
#include <features.h>
#include <stdio.h>
#include <unistd.h>
#include "../misc/internals/tempname.h"
+libc_hidden_proto(fdopen)
+libc_hidden_proto(remove)
+libc_hidden_proto(close)
+
/* This returns a new stream opened on a temporary file (generated
by tmpnam). The file is opened with mode "w+b" (binary read/write).
If we couldn't generate a unique filename or the file couldn't
@@ -45,10 +46,10 @@ FILE * tmpfile (void)
(void) remove (buf);
if ((f = fdopen (fd, "w+b")) == NULL)
- __close (fd);
+ close (fd);
return f;
}
#ifdef __UCLIBC_HAS_LFS__
-weak_alias(tmpfile,tmpfile64)
+strong_alias(tmpfile,tmpfile64)
#endif
diff --git a/libc/stdio/tmpnam.c b/libc/stdio/tmpnam.c
index df2399e66..38475a8ec 100644
--- a/libc/stdio/tmpnam.c
+++ b/libc/stdio/tmpnam.c
@@ -20,6 +20,8 @@
#include <string.h>
#include "../misc/internals/tempname.h"
+libc_hidden_proto(memcpy)
+
static char tmpnam_buffer[L_tmpnam];
/* Generate a unique filename in P_tmpdir.
@@ -41,7 +43,7 @@ char * tmpnam (char *s)
return NULL;
if (s == NULL)
- return (char *) __memcpy (tmpnam_buffer, tmpbuf, L_tmpnam);
+ return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam);
return s;
}
diff --git a/libc/stdio/ungetc.c b/libc/stdio/ungetc.c
index de3f1d16b..5e7db7daa 100644
--- a/libc/stdio/ungetc.c
+++ b/libc/stdio/ungetc.c
@@ -24,7 +24,7 @@
* (See section 7.19.6.2 of the C9X rationale -- WG14/N897.)
*/
-int attribute_hidden __ungetc(int c, register FILE *stream)
+int ungetc(int c, register FILE *stream)
{
__STDIO_AUTO_THREADLOCK_VAR;
@@ -75,4 +75,5 @@ int attribute_hidden __ungetc(int c, register FILE *stream)
return c;
}
-strong_alias(__ungetc,ungetc)
+libc_hidden_proto(ungetc)
+libc_hidden_def(ungetc)
diff --git a/libc/stdio/ungetwc.c b/libc/stdio/ungetwc.c
index c6a99dd9d..082f81bd9 100644
--- a/libc/stdio/ungetwc.c
+++ b/libc/stdio/ungetwc.c
@@ -12,7 +12,7 @@
* as reset stream->__ungot_width[1] for use by _stdio_adjpos().
*/
-wint_t attribute_hidden __ungetwc(wint_t c, register FILE *stream)
+wint_t ungetwc(wint_t c, register FILE *stream)
{
__STDIO_AUTO_THREADLOCK_VAR;
@@ -46,4 +46,5 @@ wint_t attribute_hidden __ungetwc(wint_t c, register FILE *stream)
return c;
}
-strong_alias(__ungetwc,ungetwc)
+libc_hidden_proto(ungetwc)
+libc_hidden_def(ungetwc)
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c
index ca110cbd1..1c184583b 100644
--- a/libc/stdio/vasprintf.c
+++ b/libc/stdio/vasprintf.c
@@ -5,12 +5,11 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define open_memstream __open_memstream
-
#include "_stdio.h"
#include <stdarg.h>
#include <bits/uClibc_va_copy.h>
+
#ifdef __UCLIBC_MJN3_ONLY__
/* Do the memstream stuff inline to avoid fclose and the openlist? */
#warning CONSIDER: avoid open_memstream call?
@@ -20,7 +19,15 @@
#warning Skipping vasprintf since no vsnprintf!
#else
-int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict format,
+#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
+libc_hidden_proto(open_memstream)
+libc_hidden_proto(fclose)
+libc_hidden_proto(vfprintf)
+#else
+libc_hidden_proto(vsnprintf)
+#endif
+
+int vasprintf(char **__restrict buf, const char * __restrict format,
va_list arg)
{
#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
@@ -32,7 +39,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 +61,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;
}
@@ -74,6 +81,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict
#endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */
}
-strong_alias(__vasprintf,vasprintf)
+libc_hidden_proto(vasprintf)
+libc_hidden_def(vasprintf)
#endif
diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c
index 1822f69b7..f36987477 100644
--- a/libc/stdio/vdprintf.c
+++ b/libc/stdio/vdprintf.c
@@ -8,7 +8,10 @@
#include "_stdio.h"
#include <stdarg.h>
-int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_list arg)
+libc_hidden_proto(vfprintf)
+libc_hidden_proto(fflush_unlocked)
+
+int vdprintf(int filedes, const char * __restrict format, va_list arg)
{
FILE f;
int rv;
@@ -47,11 +50,11 @@ 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. */
- if ((rv > 0) && __fflush_unlocked(&f)) {
+ if ((rv > 0) && fflush_unlocked(&f)) {
rv = -1;
}
#endif
@@ -60,4 +63,5 @@ int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_
return rv;
}
-strong_alias(__vdprintf,vdprintf)
+libc_hidden_proto(vdprintf)
+libc_hidden_def(vdprintf)
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index bdbf0c788..f0b402b85 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -88,15 +88,6 @@
* treats this as an error.
*/
-#define strnlen __strnlen
-#define wcslen __wcslen
-#define wcsnlen __wcsnlen
-#define wcsrtombs __wcsrtombs
-#define mbsrtowcs __mbsrtowcs
-#define btowc __btowc
-#define wcrtomb __wcrtomb
-#define fputws __fputws
-
#define _ISOC99_SOURCE /* for ULLONG primarily... */
#define _GNU_SOURCE
#include <features.h>
@@ -127,6 +118,23 @@
#include <bits/uClibc_uintmaxtostr.h>
#include <bits/uClibc_va_copy.h>
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memset)
+libc_hidden_proto(strlen)
+libc_hidden_proto(strnlen)
+libc_hidden_proto(__glibc_strerror_r)
+libc_hidden_proto(fputs_unlocked)
+libc_hidden_proto(abort)
+#ifdef __UCLIBC_HAS_WCHAR__
+libc_hidden_proto(wcslen)
+libc_hidden_proto(wcsnlen)
+libc_hidden_proto(mbsrtowcs)
+libc_hidden_proto(wcsrtombs)
+libc_hidden_proto(btowc)
+libc_hidden_proto(wcrtomb)
+libc_hidden_proto(fputws)
+#endif
+
/* Some older or broken gcc toolchains define LONG_LONG_MAX but not
* LLONG_MAX. Since LLONG_MAX is part of the standard, that's what
* we use. So complain if we do not have it but should.
@@ -510,7 +518,7 @@ int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0)
int r;
/* First, zero out everything... argnumber[], argtype[], argptr[] */
- __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */
+ memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */
#ifdef NL_ARGMAX
--ppfs->maxposarg; /* set to -1 */
#endif /* NL_ARGMAX */
@@ -1116,7 +1124,7 @@ int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs)
} else {
#endif /* NL_ARGMAX */
ppfs->argnumber[2] = 1;
- __memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int));
+ memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int));
#ifdef NL_ARGMAX
}
@@ -1196,13 +1204,12 @@ 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
-#define STRLEN __strlen
+#define STRLEN strlen
#define _PPFS_init _ppfs_init
-#define OUTPUT(F,S) __fputs_unlocked(S,F)
+#define OUTPUT(F,S) fputs_unlocked(S,F)
/* #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) */
#define _outnstr(stream, string, len) ((len > 0) ? __stdio_fwrite(string, len, stream) : 0)
#define FP_OUT _fp_out_narrow
@@ -1214,7 +1221,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf
size_t r = 0;
if (type & 0x80) { /* Some type of padding needed. */
- int buflen = __strlen((const char *) buf);
+ int buflen = strlen((const char *) buf);
if ((len -= buflen) > 0) {
if ((r = _charpad(fp, (type & 0x7f), len)) != len) {
return r;
@@ -1229,7 +1236,6 @@ 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
@@ -1285,7 +1291,7 @@ static size_t _fp_out_wide(FILE *fp, intptr_t type, intptr_t len, intptr_t buf)
int i;
if (type & 0x80) { /* Some type of padding needed */
- int buflen = __strlen(s);
+ int buflen = strlen(s);
if ((len -= buflen) > 0) {
if ((r = _charpad(fp, (type & 0x7f), len)) != len) {
return r;
@@ -1329,7 +1335,7 @@ static int _ppwfs_init(register ppfs_t *ppfs, const wchar_t *fmt0)
int r;
/* First, zero out everything... argnumber[], argtype[], argptr[] */
- __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */
+ memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */
#ifdef NL_ARGMAX
--ppfs->maxposarg; /* set to -1 */
#endif /* NL_ARGMAX */
@@ -1739,7 +1745,7 @@ static int _do_one_spec(FILE * __restrict stream,
#ifdef __UCLIBC_HAS_PRINTF_M_SPEC__
} else if (ppfs->conv_num == CONV_m) {
- s = __glibc_strerror_r_internal(errno, buf, sizeof(buf));
+ s = __glibc_strerror_r(errno, buf, sizeof(buf));
goto SET_STRING_LEN;
#endif
} else {
@@ -1847,7 +1853,9 @@ static int _do_one_spec(FILE * __restrict stream,
return 0;
}
-int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream,
+libc_hidden_proto(fprintf)
+
+int VFPRINTF (FILE * __restrict stream,
register const FMT_TYPE * __restrict format,
va_list arg)
{
@@ -1924,6 +1932,7 @@ int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream,
return count;
}
-strong_alias(HIDDEN_VFPRINTF,VFPRINTF)
+libc_hidden_proto(VFPRINTF)
+libc_hidden_def(VFPRINTF)
#endif
/**********************************************************************/
diff --git a/libc/stdio/vprintf.c b/libc/stdio/vprintf.c
index 9c0e07514..7848a078d 100644
--- a/libc/stdio/vprintf.c
+++ b/libc/stdio/vprintf.c
@@ -8,7 +8,9 @@
#include "_stdio.h"
#include <stdarg.h>
+libc_hidden_proto(vfprintf)
+
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 6fcc84f2b..dc8cfe036 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -8,13 +8,15 @@
#include "_stdio.h"
#include <stdarg.h>
+libc_hidden_proto(vfprintf)
+
#ifdef __UCLIBC_MJN3_ONLY__
#warning WISHLIST: Implement vsnprintf for non-buffered and no custom stream case.
#endif /* __UCLIBC_MJN3_ONLY__ */
#ifdef __STDIO_BUFFERS
-int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
+int vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
{
FILE f;
@@ -57,7 +59,7 @@ int attribute_hidden __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,7 +68,8 @@ int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
}
return rv;
}
-strong_alias(__vsnprintf,vsnprintf)
+libc_hidden_proto(vsnprintf)
+libc_hidden_def(vsnprintf)
#elif defined(__USE_OLD_VFPRINTF__)
@@ -76,7 +79,7 @@ typedef struct {
unsigned char *bufpos;
} __FILE_vsnprintf;
-int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
+int vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
{
__FILE_vsnprintf f;
@@ -114,7 +117,7 @@ int attribute_hidden __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;
@@ -123,7 +126,8 @@ int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
}
return rv;
}
-strong_alias(__vsnprintf,vsnprintf)
+libc_hidden_proto(vsnprintf)
+libc_hidden_def(vsnprintf)
#elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__)
@@ -165,7 +169,7 @@ static ssize_t snpf_write(register void *cookie, const char *buf,
#undef COOKIE
-int attribute_hidden __vsnprintf(char *__restrict buf, size_t size,
+int vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
{
FILE f;
@@ -199,11 +203,12 @@ int attribute_hidden __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)
+libc_hidden_proto(vsnprintf)
+libc_hidden_def(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 a7d5e08f5..8e27c19d9 100644
--- a/libc/stdio/vsprintf.c
+++ b/libc/stdio/vsprintf.c
@@ -12,10 +12,12 @@
#warning Skipping vsprintf since no vsnprintf!
#else
+libc_hidden_proto(vsnprintf)
+
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 d23ba123f..d806c5432 100644
--- a/libc/stdio/vswprintf.c
+++ b/libc/stdio/vswprintf.c
@@ -9,11 +9,13 @@
#include <stdarg.h>
#include <wchar.h>
+libc_hidden_proto(vfwprintf)
+
#ifndef __STDIO_BUFFERS
#warning Skipping vswprintf since no buffering!
#else /* __STDIO_BUFFERS */
-int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size,
+int vswprintf(wchar_t *__restrict buf, size_t size,
const wchar_t * __restrict format, va_list arg)
{
FILE f;
@@ -52,7 +54,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) {
@@ -66,6 +68,7 @@ int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size,
}
return rv;
}
-strong_alias(__vswprintf,vswprintf)
+libc_hidden_proto(vswprintf)
+libc_hidden_def(vswprintf)
#endif /* __STDIO_BUFFERS */
diff --git a/libc/stdio/vwprintf.c b/libc/stdio/vwprintf.c
index 8c3401846..1c32887a4 100644
--- a/libc/stdio/vwprintf.c
+++ b/libc/stdio/vwprintf.c
@@ -9,7 +9,9 @@
#include <stdarg.h>
#include <wchar.h>
+libc_hidden_proto(vfwprintf)
+
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 00f5ef514..9dc274aec 100644
--- a/libc/stdio/wprintf.c
+++ b/libc/stdio/wprintf.c
@@ -9,13 +9,15 @@
#include <stdarg.h>
#include <wchar.h>
+libc_hidden_proto(vfwprintf)
+
int wprintf(const wchar_t * __restrict format, ...)
{
va_list arg;
int rv;
va_start(arg, format);
- rv = __vfwprintf(stdout, format, arg);
+ rv = vfwprintf(stdout, format, arg);
va_end(arg);
return rv;