diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2005-09-22 00:43:18 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2005-09-22 00:43:18 +0000 |
commit | f8d5244380826053b8c75b3c302d39bdd1f9a121 (patch) | |
tree | 3c9d81358dce8e98a9b85ab840f0c657db7b4c17 | |
parent | 3ae4f469bfd1fd10fc3e148f75cb9ba4eff9ecdb (diff) |
weaks moved after the related function so gcc4 won't warn
-rw-r--r-- | libc/misc/pthread/weaks.c | 24 | ||||
-rw-r--r-- | libc/misc/time/time.c | 8 | ||||
-rw-r--r-- | libc/misc/wchar/wchar.c | 22 | ||||
-rw-r--r-- | libc/stdio/asprintf.c | 4 | ||||
-rw-r--r-- | libc/stdio/clearerr.c | 10 | ||||
-rw-r--r-- | libc/stdio/feof.c | 10 | ||||
-rw-r--r-- | libc/stdio/ferror.c | 10 | ||||
-rw-r--r-- | libc/stdio/fflush.c | 12 | ||||
-rw-r--r-- | libc/stdio/fgetc.c | 20 | ||||
-rw-r--r-- | libc/stdio/fgets.c | 12 | ||||
-rw-r--r-- | libc/stdio/fgetwc.c | 18 | ||||
-rw-r--r-- | libc/stdio/fgetws.c | 10 | ||||
-rw-r--r-- | libc/stdio/fileno.c | 10 | ||||
-rw-r--r-- | libc/stdio/fputc.c | 18 | ||||
-rw-r--r-- | libc/stdio/fputs.c | 10 | ||||
-rw-r--r-- | libc/stdio/fputwc.c | 14 | ||||
-rw-r--r-- | libc/stdio/fputws.c | 10 | ||||
-rw-r--r-- | libc/stdio/fread.c | 10 | ||||
-rw-r--r-- | libc/stdio/fseeko.c | 10 | ||||
-rw-r--r-- | libc/stdio/ftello.c | 10 | ||||
-rw-r--r-- | libc/stdio/fwrite.c | 10 | ||||
-rw-r--r-- | libc/stdio/getchar.c | 10 | ||||
-rw-r--r-- | libc/stdio/getdelim.c | 4 | ||||
-rw-r--r-- | libc/stdio/getwchar.c | 12 | ||||
-rw-r--r-- | libc/stdio/putchar.c | 10 | ||||
-rw-r--r-- | libc/stdio/putwchar.c | 12 | ||||
-rw-r--r-- | libc/stdlib/stdlib.c | 136 | ||||
-rw-r--r-- | libc/string/generic/strcmp.c | 8 | ||||
-rw-r--r-- | libc/string/wstring.c | 88 |
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) /***************************************************** |