summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2005-09-22 00:43:18 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2005-09-22 00:43:18 +0000
commitf8d5244380826053b8c75b3c302d39bdd1f9a121 (patch)
tree3c9d81358dce8e98a9b85ab840f0c657db7b4c17 /libc
parent3ae4f469bfd1fd10fc3e148f75cb9ba4eff9ecdb (diff)
weaks moved after the related function so gcc4 won't warn
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/pthread/weaks.c24
-rw-r--r--libc/misc/time/time.c8
-rw-r--r--libc/misc/wchar/wchar.c22
-rw-r--r--libc/stdio/asprintf.c4
-rw-r--r--libc/stdio/clearerr.c10
-rw-r--r--libc/stdio/feof.c10
-rw-r--r--libc/stdio/ferror.c10
-rw-r--r--libc/stdio/fflush.c12
-rw-r--r--libc/stdio/fgetc.c20
-rw-r--r--libc/stdio/fgets.c12
-rw-r--r--libc/stdio/fgetwc.c18
-rw-r--r--libc/stdio/fgetws.c10
-rw-r--r--libc/stdio/fileno.c10
-rw-r--r--libc/stdio/fputc.c18
-rw-r--r--libc/stdio/fputs.c10
-rw-r--r--libc/stdio/fputwc.c14
-rw-r--r--libc/stdio/fputws.c10
-rw-r--r--libc/stdio/fread.c10
-rw-r--r--libc/stdio/fseeko.c10
-rw-r--r--libc/stdio/ftello.c10
-rw-r--r--libc/stdio/fwrite.c10
-rw-r--r--libc/stdio/getchar.c10
-rw-r--r--libc/stdio/getdelim.c4
-rw-r--r--libc/stdio/getwchar.c12
-rw-r--r--libc/stdio/putchar.c10
-rw-r--r--libc/stdio/putwchar.c12
-rw-r--r--libc/stdlib/stdlib.c136
-rw-r--r--libc/string/generic/strcmp.c8
-rw-r--r--libc/string/wstring.c88
29 files changed, 269 insertions, 273 deletions
diff --git a/libc/misc/pthread/weaks.c b/libc/misc/pthread/weaks.c
index 89c26110c..b17b13143 100644
--- a/libc/misc/pthread/weaks.c
+++ b/libc/misc/pthread/weaks.c
@@ -24,6 +24,18 @@
static int __pthread_return_0 __P ((void));
static int __pthread_return_1 __P ((void));
+static int
+__pthread_return_0 (void)
+{
+ return 0;
+}
+
+static int
+__pthread_return_1 (void)
+{
+ return 1;
+}
+
/**********************************************************************/
/* Weaks for application/library use.
*
@@ -105,15 +117,3 @@ weak_alias (__pthread_return_0, __pthread_mutex_trylock)
weak_alias (__pthread_return_0, __pthread_mutex_unlock)
/**********************************************************************/
-
-static int
-__pthread_return_0 (void)
-{
- return 0;
-}
-
-static int
-__pthread_return_1 (void)
-{
- return 1;
-}
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index 57ef2217a..914277698 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -713,15 +713,15 @@ struct tm *__time_localtime_tzi(register const time_t *__restrict timer,
/**********************************************************************/
#ifdef L_mktime
-/* Another name for `mktime'. */
-/* time_t timelocal(struct tm *tp) */
-weak_alias(mktime,timelocal);
-
time_t mktime(struct tm *timeptr)
{
return _time_mktime(timeptr, 1);
}
+/* Another name for `mktime'. */
+/* time_t timelocal(struct tm *tp) */
+weak_alias(mktime,timelocal);
+
#endif
/**********************************************************************/
#ifdef L_timegm
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index d1383c99f..e3553166d 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -261,9 +261,6 @@ int mbsinit(const mbstate_t *ps)
/**********************************************************************/
#ifdef L_mbrlen
-size_t mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)
- __attribute__ ((__weak__, __alias__("__mbrlen")));
-
size_t __mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)
{
static mbstate_t mbstate; /* Rely on bss 0-init. */
@@ -271,6 +268,9 @@ size_t __mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)
return mbrtowc(NULL, s, n, (ps != NULL) ? ps : &mbstate);
}
+size_t mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)
+ __attribute__ ((__weak__, __alias__("__mbrlen")));
+
#endif
/**********************************************************************/
#ifdef L_mbrtowc
@@ -679,10 +679,6 @@ size_t _wchar_wcsntoutf8s(char *__restrict s, size_t n,
/* WARNING: We treat len as SIZE_MAX when dst is NULL! */
-size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
- size_t NMC, size_t len, mbstate_t *__restrict ps)
- __attribute__ ((__weak__, __alias__("__mbsnrtowcs")));
-
size_t __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
size_t NMC, size_t len, mbstate_t *__restrict ps)
{
@@ -782,6 +778,10 @@ size_t __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
return len - count;
}
+size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
+ size_t NMC, size_t len, mbstate_t *__restrict ps)
+ __attribute__ ((__weak__, __alias__("__mbsnrtowcs")));
+
#endif
/**********************************************************************/
#ifdef L___wcsnrtombs
@@ -791,10 +791,6 @@ size_t __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
/* Note: We completely ignore ps in all currently supported conversions.
* TODO: Check for valid state anyway? */
-size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
- size_t NWC, size_t len, mbstate_t *__restrict ps)
- __attribute__ ((__weak__, __alias__("__wcsnrtombs")));
-
size_t __wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
size_t NWC, size_t len, mbstate_t *__restrict ps)
{
@@ -904,6 +900,10 @@ size_t __wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
return len - count;
}
+size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
+ size_t NWC, size_t len, mbstate_t *__restrict ps)
+ __attribute__ ((__weak__, __alias__("__wcsnrtombs")));
+
#endif
/**********************************************************************/
#ifdef L_wcswidth
diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c
index 54998fa1d..36ed807a4 100644
--- a/libc/stdio/asprintf.c
+++ b/libc/stdio/asprintf.c
@@ -12,8 +12,6 @@
#warning Skipping asprintf and __asprintf since no vsnprintf!
#else
-weak_alias(__asprintf,asprintf)
-
int __asprintf(char **__restrict buf, const char * __restrict format, ...)
{
va_list arg;
@@ -26,4 +24,6 @@ int __asprintf(char **__restrict buf, const char * __restrict format, ...)
return rv;
}
+weak_alias(__asprintf,asprintf)
+
#endif
diff --git a/libc/stdio/clearerr.c b/libc/stdio/clearerr.c
index 177088a77..2772bed3c 100644
--- a/libc/stdio/clearerr.c
+++ b/libc/stdio/clearerr.c
@@ -9,11 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__clearerr_unlocked,clearerr_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__clearerr_unlocked,clearerr);
-#endif
-
void __clearerr_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -21,6 +16,11 @@ void __clearerr_unlocked(register FILE *stream)
__CLEARERR_UNLOCKED(stream);
}
+weak_alias(__clearerr_unlocked,clearerr_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__clearerr_unlocked,clearerr);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
void clearerr(register FILE *stream)
diff --git a/libc/stdio/feof.c b/libc/stdio/feof.c
index e98e7e1c2..907872f7f 100644
--- a/libc/stdio/feof.c
+++ b/libc/stdio/feof.c
@@ -9,11 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__feof_unlocked,feof_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__feof_unlocked,feof);
-#endif
-
int __feof_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -21,6 +16,11 @@ int __feof_unlocked(register FILE *stream)
return __FEOF_UNLOCKED(stream);
}
+weak_alias(__feof_unlocked,feof_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__feof_unlocked,feof);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int feof(register FILE *stream)
diff --git a/libc/stdio/ferror.c b/libc/stdio/ferror.c
index 3bfaf68ee..95014d3b0 100644
--- a/libc/stdio/ferror.c
+++ b/libc/stdio/ferror.c
@@ -9,11 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__ferror_unlocked,ferror_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__ferror_unlocked,ferror);
-#endif
-
int __ferror_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -21,6 +16,11 @@ int __ferror_unlocked(register FILE *stream)
return __FERROR_UNLOCKED(stream);
}
+weak_alias(__ferror_unlocked,ferror_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__ferror_unlocked,ferror);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int ferror(register FILE *stream)
diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c
index 6baa0ec82..fa50db15a 100644
--- a/libc/stdio/fflush.c
+++ b/libc/stdio/fflush.c
@@ -7,19 +7,12 @@
#include "_stdio.h"
-extern int __fflush_unlocked(register FILE *stream);
-
#ifdef __DO_UNLOCKED
#ifdef __UCLIBC_MJN3_ONLY__
#warning WISHLIST: Add option to test for undefined behavior of fflush.
#endif /* __UCLIBC_MJN3_ONLY__ */
-weak_alias(__fflush_unlocked,fflush_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fflush_unlocked,fflush);
-#endif
-
#ifdef __UCLIBC_HAS_THREADS__
/* Even if the stream is set to user-locking, we still need to lock
* when all (lbf) writing streams are flushed. */
@@ -133,6 +126,11 @@ int __fflush_unlocked(register FILE *stream)
#endif /* __STDIO_BUFFERS */
}
+weak_alias(__fflush_unlocked,fflush_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fflush_unlocked,fflush);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int fflush(register FILE *stream)
diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c
index c672d9fe9..c68c1fdb5 100644
--- a/libc/stdio/fgetc.c
+++ b/libc/stdio/fgetc.c
@@ -12,17 +12,8 @@
#undef getc
#undef getc_unlocked
-extern int __fgetc_unlocked(FILE *stream);
-
#ifdef __DO_UNLOCKED
-weak_alias(__fgetc_unlocked,fgetc_unlocked);
-weak_alias(__fgetc_unlocked,getc_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgetc_unlocked,fgetc);
-weak_alias(__fgetc_unlocked,getc);
-#endif
-
int __fgetc_unlocked(FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -78,9 +69,14 @@ int __fgetc_unlocked(FILE *stream)
return EOF;
}
-#elif defined __UCLIBC_HAS_THREADS__
+weak_alias(__fgetc_unlocked,fgetc_unlocked);
+weak_alias(__fgetc_unlocked,getc_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fgetc_unlocked,fgetc);
+weak_alias(__fgetc_unlocked,getc);
+#endif
-weak_alias(fgetc,getc);
+#elif defined __UCLIBC_HAS_THREADS__
int fgetc(register FILE *stream)
{
@@ -95,4 +91,6 @@ int fgetc(register FILE *stream)
}
}
+weak_alias(fgetc,getc);
+
#endif
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index 6bcfc2957..4b32ad612 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -9,12 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fgets_unlocked,fgets_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgets_unlocked,fgets);
-#endif
-
-
char *__fgets_unlocked(char *__restrict s, int n,
register FILE * __restrict stream)
{
@@ -64,6 +58,12 @@ char *__fgets_unlocked(char *__restrict s, int n,
return NULL;
}
+weak_alias(__fgets_unlocked,fgets_unlocked);
+
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fgets_unlocked,fgets);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
char *fgets(char *__restrict s, int n,
diff --git a/libc/stdio/fgetwc.c b/libc/stdio/fgetwc.c
index 9f1f9c481..a78f52212 100644
--- a/libc/stdio/fgetwc.c
+++ b/libc/stdio/fgetwc.c
@@ -9,13 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fgetwc_unlocked,fgetwc_unlocked);
-weak_alias(__fgetwc_unlocked,getwc_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgetwc_unlocked,fgetwc);
-weak_alias(__fgetwc_unlocked,getwc);
-#endif
-
static void munge_stream(register FILE *stream, unsigned char *buf)
{
stream->__bufend = stream->__bufstart = buf;
@@ -113,9 +106,14 @@ wint_t __fgetwc_unlocked(register FILE *stream)
return wi;
}
-#elif defined __UCLIBC_HAS_THREADS__
+weak_alias(__fgetwc_unlocked,fgetwc_unlocked);
+weak_alias(__fgetwc_unlocked,getwc_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fgetwc_unlocked,fgetwc);
+weak_alias(__fgetwc_unlocked,getwc);
+#endif
-weak_alias(fgetwc,getwc);
+#elif defined __UCLIBC_HAS_THREADS__
wint_t fgetwc(register FILE *stream)
{
@@ -131,4 +129,6 @@ wint_t fgetwc(register FILE *stream)
return retval;
}
+weak_alias(fgetwc,getwc);
+
#endif
diff --git a/libc/stdio/fgetws.c b/libc/stdio/fgetws.c
index ec8547e25..16f8873b3 100644
--- a/libc/stdio/fgetws.c
+++ b/libc/stdio/fgetws.c
@@ -12,11 +12,6 @@ extern wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n,
#ifdef __DO_UNLOCKED
-weak_alias(__fgetws_unlocked,fgetws_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgetws_unlocked,fgetws);
-#endif
-
wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n,
FILE *__restrict stream)
{
@@ -42,6 +37,11 @@ wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n,
return ws;
}
+weak_alias(__fgetws_unlocked,fgetws_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fgetws_unlocked,fgetws);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
wchar_t *fgetws(wchar_t *__restrict ws, int n, FILE *__restrict stream)
diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c
index fbfa66551..30ae90ad3 100644
--- a/libc/stdio/fileno.c
+++ b/libc/stdio/fileno.c
@@ -9,11 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fileno_unlocked,fileno_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fileno_unlocked,fileno);
-#endif
-
int __fileno_unlocked(register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -26,6 +21,11 @@ int __fileno_unlocked(register FILE *stream)
return -1;
}
+weak_alias(__fileno_unlocked,fileno_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fileno_unlocked,fileno);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int fileno(register FILE *stream)
diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c
index 0cfb4f943..ad3c95517 100644
--- a/libc/stdio/fputc.c
+++ b/libc/stdio/fputc.c
@@ -14,13 +14,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fputc_unlocked,fputc_unlocked);
-weak_alias(__fputc_unlocked,putc_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fputc_unlocked,fputc);
-weak_alias(__fputc_unlocked,putc);
-#endif
-
int __fputc_unlocked(int c, register FILE *stream)
{
__STDIO_STREAM_VALIDATE(stream);
@@ -76,9 +69,14 @@ int __fputc_unlocked(int c, register FILE *stream)
return EOF;
}
-#elif defined __UCLIBC_HAS_THREADS__
+weak_alias(__fputc_unlocked,fputc_unlocked);
+weak_alias(__fputc_unlocked,putc_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fputc_unlocked,fputc);
+weak_alias(__fputc_unlocked,putc);
+#endif
-weak_alias(fputc,putc);
+#elif defined __UCLIBC_HAS_THREADS__
int fputc(int c, register FILE *stream)
{
@@ -93,4 +91,6 @@ int fputc(int c, register FILE *stream)
}
}
+weak_alias(fputc,putc);
+
#endif
diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c
index b3d77fa46..e4d10659f 100644
--- a/libc/stdio/fputs.c
+++ b/libc/stdio/fputs.c
@@ -14,11 +14,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fputs_unlocked,fputs_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fputs_unlocked,fputs);
-#endif
-
int __fputs_unlocked(register const char * __restrict s,
FILE * __restrict stream)
{
@@ -27,6 +22,11 @@ int __fputs_unlocked(register const char * __restrict s,
return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
}
+weak_alias(__fputs_unlocked,fputs_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fputs_unlocked,fputs);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int fputs(const char * __restrict s, register FILE * __restrict stream)
diff --git a/libc/stdio/fputwc.c b/libc/stdio/fputwc.c
index fc980dcef..ef7a6d627 100644
--- a/libc/stdio/fputwc.c
+++ b/libc/stdio/fputwc.c
@@ -9,6 +9,11 @@
#ifdef __DO_UNLOCKED
+wint_t __fputwc_unlocked(wchar_t wc, FILE *stream)
+{
+ return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF;
+}
+
weak_alias(__fputwc_unlocked,fputwc_unlocked);
weak_alias(__fputwc_unlocked,putwc_unlocked);
#ifndef __UCLIBC_HAS_THREADS__
@@ -16,15 +21,8 @@ weak_alias(__fputwc_unlocked,fputwc);
weak_alias(__fputwc_unlocked,putwc);
#endif
-wint_t __fputwc_unlocked(wchar_t wc, FILE *stream)
-{
- return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF;
-}
-
#elif defined __UCLIBC_HAS_THREADS__
-weak_alias(fputwc,putwc);
-
wint_t fputwc(wchar_t wc, register FILE *stream)
{
wint_t retval;
@@ -39,4 +37,6 @@ wint_t fputwc(wchar_t wc, register FILE *stream)
return retval;
}
+weak_alias(fputwc,putwc);
+
#endif
diff --git a/libc/stdio/fputws.c b/libc/stdio/fputws.c
index 7b6456a09..f3270fde8 100644
--- a/libc/stdio/fputws.c
+++ b/libc/stdio/fputws.c
@@ -12,11 +12,6 @@ extern int __fputws_unlocked(const wchar_t *__restrict ws,
#ifdef __DO_UNLOCKED
-weak_alias(__fputws_unlocked,fputws_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fputws_unlocked,fputws);
-#endif
-
int __fputws_unlocked(const wchar_t *__restrict ws,
register FILE *__restrict stream)
{
@@ -25,6 +20,11 @@ int __fputws_unlocked(const wchar_t *__restrict ws,
return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1;
}
+weak_alias(__fputws_unlocked,fputws_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fputws_unlocked,fputws);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index 875c82616..73414e26c 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -9,11 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fread_unlocked,fread_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fread_unlocked,fread);
-#endif
-
size_t __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb,
FILE * __restrict stream)
{
@@ -88,6 +83,11 @@ size_t __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb,
return 0;
}
+weak_alias(__fread_unlocked,fread_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fread_unlocked,fread);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
size_t fread(void * __restrict ptr, size_t size, size_t nmemb,
diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c
index fed425730..48979a06b 100644
--- a/libc/stdio/fseeko.c
+++ b/libc/stdio/fseeko.c
@@ -19,15 +19,11 @@
# define FSEEK __fseeko64
# define OFFSET_TYPE __off64_t
-weak_alias(__fseeko64,fseeko64);
-
#else
# define FSEEK fseek
# define OFFSET_TYPE long int
-weak_alias(fseek,fseeko);
-
#endif
@@ -87,3 +83,9 @@ int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
#endif
}
+
+#ifdef __DO_LARGEFILE
+weak_alias(__fseeko64,fseeko64);
+#else
+weak_alias(fseek,fseeko);
+#endif
diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c
index 7092f34cf..38517acbd 100644
--- a/libc/stdio/ftello.c
+++ b/libc/stdio/ftello.c
@@ -15,15 +15,11 @@
# define FTELL __ftello64
# define OFFSET_TYPE __off64_t
-weak_alias(__ftello64,ftello64);
-
#else
# define FTELL ftell
# define OFFSET_TYPE long int
-weak_alias(ftell,ftello);
-
#endif
OFFSET_TYPE FTELL(register FILE *stream)
@@ -59,3 +55,9 @@ OFFSET_TYPE FTELL(register FILE *stream)
#endif
}
+
+#ifdef __DO_LARGEFILE
+weak_alias(__ftello64,ftello64);
+#else
+weak_alias(ftell,ftello);
+#endif
diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c
index a5e8fd6bf..7bb0a8022 100644
--- a/libc/stdio/fwrite.c
+++ b/libc/stdio/fwrite.c
@@ -9,11 +9,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__fwrite_unlocked,fwrite_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fwrite_unlocked,fwrite);
-#endif
-
size_t __fwrite_unlocked(const void * __restrict ptr, size_t size,
size_t nmemb, register FILE * __restrict stream)
{
@@ -39,6 +34,11 @@ size_t __fwrite_unlocked(const void * __restrict ptr, size_t size,
return 0;
}
+weak_alias(__fwrite_unlocked,fwrite_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__fwrite_unlocked,fwrite);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
size_t fwrite(const void * __restrict ptr, size_t size,
diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c
index 49414eb70..902cec16e 100644
--- a/libc/stdio/getchar.c
+++ b/libc/stdio/getchar.c
@@ -12,11 +12,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__getchar_unlocked,getchar_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getchar_unlocked,getchar);
-#endif
-
int __getchar_unlocked(void)
{
register FILE *stream = stdin;
@@ -24,6 +19,11 @@ int __getchar_unlocked(void)
return __GETC_UNLOCKED_MACRO(stream);
}
+weak_alias(__getchar_unlocked,getchar_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__getchar_unlocked,getchar);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int getchar(void)
diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c
index fe388ee11..cf3cf4c10 100644
--- a/libc/stdio/getdelim.c
+++ b/libc/stdio/getdelim.c
@@ -18,8 +18,6 @@
* a reading. So space may be allocated even if initially at EOF.
*/
-weak_alias(__getdelim,getdelim);
-
#define GETDELIM_GROWBY 64
ssize_t __getdelim(char **__restrict lineptr, size_t *__restrict n,
@@ -75,3 +73,5 @@ ssize_t __getdelim(char **__restrict lineptr, size_t *__restrict n,
return pos;
}
+
+weak_alias(__getdelim,getdelim);
diff --git a/libc/stdio/getwchar.c b/libc/stdio/getwchar.c
index 98d9fcba0..642162fed 100644
--- a/libc/stdio/getwchar.c
+++ b/libc/stdio/getwchar.c
@@ -7,20 +7,18 @@
#include "_stdio.h"
-wint_t __getwchar_unlocked(void);
-
#ifdef __DO_UNLOCKED
-weak_alias(__getwchar_unlocked,getwchar_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getwchar_unlocked,getwchar);
-#endif
-
wint_t __getwchar_unlocked(void)
{
return __fgetwc_unlocked(stdin);
}
+weak_alias(__getwchar_unlocked,getwchar_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__getwchar_unlocked,getwchar);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
wint_t getwchar(void)
diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c
index 20f5aadcc..fa6d6c372 100644
--- a/libc/stdio/putchar.c
+++ b/libc/stdio/putchar.c
@@ -12,11 +12,6 @@
#ifdef __DO_UNLOCKED
-weak_alias(__putchar_unlocked,putchar_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__putchar_unlocked,putchar);
-#endif
-
int __putchar_unlocked(int c)
{
register FILE *stream = stdout;
@@ -24,6 +19,11 @@ int __putchar_unlocked(int c)
return __PUTC_UNLOCKED_MACRO(c, stream);
}
+weak_alias(__putchar_unlocked,putchar_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__putchar_unlocked,putchar);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
int putchar(int c)
diff --git a/libc/stdio/putwchar.c b/libc/stdio/putwchar.c
index 9a563dcf0..47bc173e1 100644
--- a/libc/stdio/putwchar.c
+++ b/libc/stdio/putwchar.c
@@ -7,20 +7,18 @@
#include "_stdio.h"
-extern wint_t __putwchar_unlocked(wchar_t wc);
-
#ifdef __DO_UNLOCKED
-weak_alias(__putwchar_unlocked,putwchar_unlocked);
-#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__putwchar_unlocked,putwchar);
-#endif
-
wint_t __putwchar_unlocked(wchar_t wc)
{
return __fputwc_unlocked(wc, stdout);
}
+weak_alias(__putwchar_unlocked,putwchar_unlocked);
+#ifndef __UCLIBC_HAS_THREADS__
+weak_alias(__putwchar_unlocked,putwchar);
+#endif
+
#elif defined __UCLIBC_HAS_THREADS__
wint_t putwchar(wchar_t wc)
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 9e78fb24e..a749955e2 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -207,6 +207,11 @@ int abs(int j)
/**********************************************************************/
#ifdef L_labs
+long int labs(long int j)
+{
+ return (j >= 0) ? j : -j;
+}
+
#if UINT_MAX == ULONG_MAX
strong_alias(labs,abs)
#endif
@@ -219,26 +224,21 @@ strong_alias(labs,llabs)
strong_alias(labs,imaxabs)
#endif
-long int labs(long int j)
-{
- return (j >= 0) ? j : -j;
-}
-
#endif
/**********************************************************************/
#ifdef L_llabs
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-#if (ULLONG_MAX == UINTMAX_MAX)
-strong_alias(llabs,imaxabs)
-#endif
-
long long int llabs(long long int j)
{
return (j >= 0) ? j : -j;
}
+#if (ULLONG_MAX == UINTMAX_MAX)
+strong_alias(llabs,imaxabs)
+#endif
+
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
#endif
@@ -258,6 +258,11 @@ int atoi(const char *nptr)
/**********************************************************************/
#ifdef L_atol
+long atol(const char *nptr)
+{
+ return strtol(nptr, (char **) NULL, 10);
+}
+
#if UINT_MAX == ULONG_MAX
strong_alias(atol,atoi)
#endif
@@ -266,11 +271,6 @@ strong_alias(atol,atoi)
strong_alias(atol,atoll)
#endif
-long atol(const char *nptr)
-{
- return strtol(nptr, (char **) NULL, 10);
-}
-
#endif
/**********************************************************************/
#ifdef L_atoll
@@ -288,6 +288,12 @@ long long atoll(const char *nptr)
/**********************************************************************/
#if defined(L_strtol) || defined(L_strtol_l)
+long __XL(strtol)(const char * __restrict str, char ** __restrict endptr,
+ int base __LOCALE_PARAM )
+{
+ return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 1 __LOCALE_ARG );
+}
+
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtol_l)
strong_alias(strtol,strtoimax)
#endif
@@ -296,12 +302,6 @@ strong_alias(strtol,strtoimax)
strong_alias(__XL(strtol),__XL(strtoll))
#endif
-long __XL(strtol)(const char * __restrict str, char ** __restrict endptr,
- int base __LOCALE_PARAM )
-{
- return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 1 __LOCALE_ARG );
-}
-
__XL_ALIAS(strtol)
#endif
@@ -310,13 +310,6 @@ __XL_ALIAS(strtol)
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-#if !defined(L_strtoll_l)
-#if (ULLONG_MAX == UINTMAX_MAX)
-strong_alias(strtoll,strtoimax)
-#endif
-strong_alias(strtoll,strtoq)
-#endif
-
long long __XL(strtoll)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
@@ -325,6 +318,13 @@ long long __XL(strtoll)(const char * __restrict str,
__LOCALE_ARG );
}
+#if !defined(L_strtoll_l)
+#if (ULLONG_MAX == UINTMAX_MAX)
+strong_alias(strtoll,strtoimax)
+#endif
+strong_alias(strtoll,strtoq)
+#endif
+
__XL_ALIAS(strtoll)
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
@@ -333,6 +333,13 @@ __XL_ALIAS(strtoll)
/**********************************************************************/
#if defined(L_strtoul) || defined(L_strtoul_l)
+unsigned long __XL(strtoul)(const char * __restrict str,
+ char ** __restrict endptr, int base
+ __LOCALE_PARAM )
+{
+ return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 0 __LOCALE_ARG );
+}
+
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtoul_l)
strong_alias(strtoul,strtoumax)
#endif
@@ -341,13 +348,6 @@ strong_alias(strtoul,strtoumax)
strong_alias(__XL(strtoul),__XL(strtoull))
#endif
-unsigned long __XL(strtoul)(const char * __restrict str,
- char ** __restrict endptr, int base
- __LOCALE_PARAM )
-{
- return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 0 __LOCALE_ARG );
-}
-
__XL_ALIAS(strtoul)
#endif
@@ -356,13 +356,6 @@ __XL_ALIAS(strtoul)
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-#if !defined(L_strtoull_l)
-#if (ULLONG_MAX == UINTMAX_MAX)
-strong_alias(strtoull,strtoumax)
-#endif
-strong_alias(strtoull,strtouq)
-#endif
-
unsigned long long __XL(strtoull)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
@@ -370,6 +363,13 @@ unsigned long long __XL(strtoull)(const char * __restrict str,
return __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG );
}
+#if !defined(L_strtoull_l)
+#if (ULLONG_MAX == UINTMAX_MAX)
+strong_alias(strtoull,strtoumax)
+#endif
+strong_alias(strtoull,strtouq)
+#endif
+
__XL_ALIAS(strtoull)
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
@@ -953,6 +953,12 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
/**********************************************************************/
#if defined(L_wcstol) || defined(L_wcstol_l)
+long __XL(wcstol)(const wchar_t * __restrict str,
+ wchar_t ** __restrict endptr, int base __LOCALE_PARAM )
+{
+ return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG );
+}
+
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l)
strong_alias(wcstol,wcstoimax)
#endif
@@ -961,12 +967,6 @@ strong_alias(wcstol,wcstoimax)
strong_alias(__XL(wcstol),__XL(wcstoll))
#endif
-long __XL(wcstol)(const wchar_t * __restrict str,
- wchar_t ** __restrict endptr, int base __LOCALE_PARAM )
-{
- return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG );
-}
-
__XL_ALIAS(wcstol)
#endif
@@ -975,13 +975,6 @@ __XL_ALIAS(wcstol)
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-#if !defined(L_wcstoll_l)
-#if (ULLONG_MAX == UINTMAX_MAX)
-strong_alias(wcstoll,wcstoimax)
-#endif
-strong_alias(wcstoll,wcstoq)
-#endif
-
long long __XL(wcstoll)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
@@ -990,6 +983,13 @@ long long __XL(wcstoll)(const wchar_t * __restrict str,
__LOCALE_ARG );
}
+#if !defined(L_wcstoll_l)
+#if (ULLONG_MAX == UINTMAX_MAX)
+strong_alias(wcstoll,wcstoimax)
+#endif
+strong_alias(wcstoll,wcstoq)
+#endif
+
__XL_ALIAS(wcstoll)
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
@@ -998,6 +998,13 @@ __XL_ALIAS(wcstoll)
/**********************************************************************/
#if defined(L_wcstoul) || defined(L_wcstoul_l)
+unsigned long __XL(wcstoul)(const wchar_t * __restrict str,
+ wchar_t ** __restrict endptr, int base
+ __LOCALE_PARAM )
+{
+ return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG );
+}
+
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l)
strong_alias(wcstoul,wcstoumax)
#endif
@@ -1006,13 +1013,6 @@ strong_alias(wcstoul,wcstoumax)
strong_alias(__XL(wcstoul),__XL(wcstoull))
#endif
-unsigned long __XL(wcstoul)(const wchar_t * __restrict str,
- wchar_t ** __restrict endptr, int base
- __LOCALE_PARAM )
-{
- return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG );
-}
-
__XL_ALIAS(wcstoul)
#endif
@@ -1021,13 +1021,6 @@ __XL_ALIAS(wcstoul)
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-#if !defined(L_wcstoull_l)
-#if (ULLONG_MAX == UINTMAX_MAX)
-strong_alias(wcstoull,wcstoumax)
-#endif
-strong_alias(wcstoull,wcstouq)
-#endif
-
unsigned long long __XL(wcstoull)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
@@ -1035,6 +1028,13 @@ unsigned long long __XL(wcstoull)(const wchar_t * __restrict str,
return __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG );
}
+#if !defined(L_wcstoull_l)
+#if (ULLONG_MAX == UINTMAX_MAX)
+strong_alias(wcstoull,wcstoumax)
+#endif
+strong_alias(wcstoull,wcstouq)
+#endif
+
__XL_ALIAS(wcstoull)
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c
index 2af550d81..c8212f04b 100644
--- a/libc/string/generic/strcmp.c
+++ b/libc/string/generic/strcmp.c
@@ -23,10 +23,6 @@
#undef strcmp
-#ifdef __LOCALE_C_ONLY
-weak_alias(strcmp,strcoll);
-#endif /* __LOCALE_C_ONLY */
-
/* Compare S1 and S2, returning less than, equal to or
greater than zero if S1 is lexicographically less than,
equal to or greater than S2. */
@@ -50,3 +46,7 @@ strcmp (p1, p2)
return c1 - c2;
}
+
+#ifdef __LOCALE_C_ONLY
+weak_alias(strcmp,strcoll);
+#endif /* __LOCALE_C_ONLY */
diff --git a/libc/string/wstring.c b/libc/string/wstring.c
index 6f54ae615..c9c8548fb 100644
--- a/libc/string/wstring.c
+++ b/libc/string/wstring.c
@@ -612,10 +612,6 @@ Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
#ifdef L_memcmp
-#ifndef L_wmemcmp
-weak_alias(memcmp,bcmp);
-#endif
-
int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
{
register const Wuchar *r1 = (const Wuchar *) s1;
@@ -638,6 +634,10 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
#endif
}
+#ifndef L_wmemcmp
+weak_alias(memcmp,bcmp);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_wcscmp
@@ -649,14 +649,6 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
#ifdef L_strcmp
-#ifdef __LOCALE_C_ONLY
-#ifdef L_wcscmp
-weak_alias(wcscmp,wcscoll);
-#else /* L_wcscmp */
-weak_alias(strcmp,strcoll);
-#endif /* L_wcscmp */
-#endif /* __LOCALE_C_ONLY */
-
int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
{
#ifdef WANT_WIDE
@@ -677,6 +669,15 @@ int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
return r;
#endif
}
+
+#ifdef __LOCALE_C_ONLY
+#ifdef L_wcscmp
+weak_alias(wcscmp,wcscoll);
+#else /* L_wcscmp */
+weak_alias(strcmp,strcoll);
+#endif /* L_wcscmp */
+#endif /* __LOCALE_C_ONLY */
+
#endif
/**********************************************************************/
#ifdef L_wcsncmp
@@ -756,10 +757,6 @@ Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
#ifdef L_strchr
-#ifndef L_wcschr
-weak_alias(strchr,index);
-#endif
-
Wchar *Wstrchr(register const Wchar *s, Wint c)
{
do {
@@ -771,6 +768,10 @@ Wchar *Wstrchr(register const Wchar *s, Wint c)
return NULL;
}
+#ifndef L_wcschr
+weak_alias(strchr,index);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_wcscspn
@@ -830,10 +831,6 @@ Wchar *Wstrpbrk(const Wchar *s1, const Wchar *s2)
#ifdef L_strrchr
-#ifndef L_wcsrchr
-weak_alias(strrchr,rindex);
-#endif
-
Wchar *Wstrrchr(register const Wchar *s, Wint c)
{
register const Wchar *p;
@@ -848,6 +845,10 @@ Wchar *Wstrrchr(register const Wchar *s, Wint c)
return (Wchar *) p; /* silence the warning */
}
+#ifndef L_wcsrchr
+weak_alias(strrchr,rindex);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_wcsspn
@@ -886,10 +887,6 @@ size_t Wstrspn(const Wchar *s1, const Wchar *s2)
/* NOTE: This is the simple-minded O(len(s1) * len(s2)) worst-case approach. */
-#ifdef L_wcsstr
-weak_alias(wcsstr,wcswcs);
-#endif
-
Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
{
register const Wchar *s = s1;
@@ -912,6 +909,10 @@ Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
} while (1);
}
+#ifdef L_wcsstr
+weak_alias(wcsstr,wcswcs);
+#endif
+
#endif
/**********************************************************************/
#undef Wstrspn
@@ -930,10 +931,6 @@ Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
#ifdef L_strtok_r
-#ifndef L_wcstok
-weak_alias(__strtok_r,strtok_r);
-#endif
-
Wchar *Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2,
Wchar ** __restrict next_start)
{
@@ -967,6 +964,10 @@ Wchar *Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2,
#endif
}
+#ifndef L_wcstok
+weak_alias(__strtok_r,strtok_r);
+#endif
+
#endif
/**********************************************************************/
/* #ifdef L_wcstok */
@@ -1571,8 +1572,6 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
/**********************************************************************/
#ifdef L___glibc_strerror_r
-weak_alias(__glibc_strerror_r,__strerror_r);
-
char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
{
__xpg_strerror_r(errnum, strerrbuf, buflen);
@@ -1580,6 +1579,7 @@ char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
return strerrbuf;
}
+weak_alias(__glibc_strerror_r,__strerror_r);
#endif
/**********************************************************************/
#ifdef L_memmem
@@ -1625,10 +1625,6 @@ void *memmem(const void *haystack, size_t haystacklen,
#ifdef L_mempcpy
-#ifndef L_wmempcpy
-weak_alias(__mempcpy,mempcpy);
-#endif
-
Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
{
register Wchar *r1 = s1;
@@ -1648,6 +1644,10 @@ Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
return r1;
}
+#ifndef L_wmempcpy
+weak_alias(__mempcpy,mempcpy);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_memrchr
@@ -1737,7 +1737,6 @@ Wchar *Wstpncpy(register Wchar * __restrict s1,
/**********************************************************************/
#ifdef L_bzero
-weak_alias(__bzero,bzero);
void __bzero(void *s, size_t n)
{
register unsigned char *p = s;
@@ -1753,6 +1752,7 @@ void __bzero(void *s, size_t n)
--np;
}
}
+weak_alias(__bzero,bzero);
#undef np
#endif
@@ -1902,15 +1902,13 @@ char *strsep(char ** __restrict s1, const char * __restrict s2)
#ifdef L_strchrnul
-extern Wchar *__Wstrchrnul(register const Wchar *s, Wint c);
-weak_alias(__Wstrchrnul, Wstrchrnul);
-
Wchar *__Wstrchrnul(register const Wchar *s, Wint c)
{
--s;
while (*++s && (*s != ((Wchar)c)));
return (Wchar *) s;
}
+weak_alias(__Wstrchrnul, Wstrchrnul);
#endif
/**********************************************************************/
@@ -2069,18 +2067,12 @@ extern size_t __wcslcpy(wchar_t *__restrict dst,
#ifdef L___wcslcpy
#define L_strlcpy
#define Wstrlcpy __wcslcpy
-#ifdef __LOCALE_C_ONLY
-weak_alias(__wcslcpy,wcsxfrm);
-#endif
#endif
#ifdef L_strlcpy
#ifndef L___wcslcpy
#define Wstrlcpy strlcpy
-#ifdef __LOCALE_C_ONLY
-weak_alias(strlcpy,strxfrm);
-#endif
#endif
/* OpenBSD function:
@@ -2111,6 +2103,14 @@ size_t Wstrlcpy(register Wchar *__restrict dst,
return src - src0;
}
+#ifdef __LOCALE_C_ONLY
+#ifdef L___wcslcpy
+weak_alias(__wcslcpy,wcsxfrm);
+#else
+weak_alias(strlcpy,strxfrm);
+#endif
+#endif
+
#endif
/**********************************************************************/
#if defined(L__string_syssigmsgs) && defined(__UCLIBC_HAS_SIGNUM_MESSAGES__)