diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-14 00:58:03 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-14 00:58:03 +0000 |
commit | af0172162f7c653cad6a11ed1c1a5459bc154465 (patch) | |
tree | 70031dad1e7286d58762da7b9e3d3f93d043c278 /libc/stdlib | |
parent | c8609543a9a8bf6559c2931dbbef6b3c41b3fbf2 (diff) |
hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing headers, other jump relocs removed
Diffstat (limited to 'libc/stdlib')
50 files changed, 364 insertions, 311 deletions
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 78f96a0e2..70b65a1b4 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -18,8 +18,6 @@ Cambridge, MA 02139, USA. */ /* Hacked up for uClibc by Erik Andersen */ -#define sigaction __sigaction - #define _GNU_SOURCE #include <features.h> #include <signal.h> @@ -30,6 +28,13 @@ Cambridge, MA 02139, USA. */ #include <signal.h> #include <errno.h> +libc_hidden_proto(abort) + +libc_hidden_proto(memset) +libc_hidden_proto(sigaction) +libc_hidden_proto(sigprocmask) +libc_hidden_proto(raise) +libc_hidden_proto(_exit) /* Our last ditch effort to commit suicide */ #if defined(__alpha__) @@ -80,12 +85,8 @@ static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; #define LOCK __pthread_mutex_lock(&mylock) #define UNLOCK __pthread_mutex_unlock(&mylock) -extern int __raise (int __sig) __THROW attribute_hidden; - /* Cause an abnormal program termination with core-dump */ -#undef __abort -#undef abort -void attribute_hidden __abort(void) +void abort(void) { sigset_t sigset; @@ -94,7 +95,7 @@ void attribute_hidden __abort(void) /* Unmask SIGABRT to be sure we can get it */ if (__sigemptyset(&sigset) == 0 && __sigaddset(&sigset, SIGABRT) == 0) { - __sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); + sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); } while (1) { @@ -114,7 +115,7 @@ void attribute_hidden __abort(void) abort_it: UNLOCK; - __raise(SIGABRT); + raise(SIGABRT); LOCK; } @@ -123,7 +124,7 @@ abort_it: struct sigaction act; been_there_done_that++; - __memset(&act, '\0', sizeof(struct sigaction)); + memset(&act, '\0', sizeof(struct sigaction)); act.sa_handler = SIG_DFL; __sigfillset(&act.sa_mask); act.sa_flags = 0; @@ -141,7 +142,7 @@ abort_it: /* Still here? Try to at least exit */ if (been_there_done_that == 3) { been_there_done_that++; - _exit_internal(127); + _exit(127); } /* Still here? We're screwed. Sleepy time. Good night. */ @@ -150,4 +151,4 @@ abort_it: ABORT_INSTRUCTION; } } -strong_alias(__abort,abort) +libc_hidden_def(abort) diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index db69902c8..c27872f02 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -44,6 +44,9 @@ #include <errno.h> #include <atomic.h> +libc_hidden_proto(exit) +libc_hidden_proto(_exit) + #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> extern pthread_mutex_t mylock; @@ -320,9 +323,7 @@ extern void (*__rtld_fini)(void); /* * Normal program termination */ -#undef exit -#undef __exit -void attribute_hidden __exit(int rv) +void exit(int rv) { /* Perform exit-specific cleanup (atexit and on_exit) */ LOCK; @@ -345,7 +346,7 @@ void attribute_hidden __exit(int rv) if (_stdio_term) _stdio_term(); - _exit_internal(rv); + _exit(rv); } -strong_alias(__exit,exit) +libc_hidden_def(exit) #endif diff --git a/libc/stdlib/drand48.c b/libc/stdlib/drand48.c index 0d82c3543..7fd792fef 100644 --- a/libc/stdlib/drand48.c +++ b/libc/stdlib/drand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define erand48_r __erand48_r - #include <stdlib.h> +libc_hidden_proto(erand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/drand48_r.c b/libc/stdlib/drand48_r.c index 14235e6e0..0f96e59f7 100644 --- a/libc/stdlib/drand48_r.c +++ b/libc/stdlib/drand48_r.c @@ -17,12 +17,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define erand48_r __erand48_r - #include <errno.h> #include <math.h> #include <stdlib.h> +libc_hidden_proto(erand48_r) + int drand48_r (struct drand48_data *buffer, double *result) { return erand48_r (buffer->__x, buffer, result); diff --git a/libc/stdlib/erand48.c b/libc/stdlib/erand48.c index f5c1a50d4..853c2c35a 100644 --- a/libc/stdlib/erand48.c +++ b/libc/stdlib/erand48.c @@ -17,9 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define erand48_r __erand48_r #include <stdlib.h> +libc_hidden_proto(erand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c index 0a69266a7..fec8b5026 100644 --- a/libc/stdlib/erand48_r.c +++ b/libc/stdlib/erand48_r.c @@ -24,7 +24,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int attribute_hidden __erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) +int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) { union ieee754_double temp; @@ -45,4 +45,5 @@ int attribute_hidden __erand48_r (unsigned short int xsubi[3], struct drand48_da return 0; } -strong_alias(__erand48_r,erand48_r) +libc_hidden_proto(erand48_r) +libc_hidden_def(erand48_r) diff --git a/libc/stdlib/gcvt.c b/libc/stdlib/gcvt.c index 75e3bbe70..f1c1f4270 100644 --- a/libc/stdlib/gcvt.c +++ b/libc/stdlib/gcvt.c @@ -1,11 +1,13 @@ #include <stdio.h> #include <stdlib.h> +libc_hidden_proto(sprintf) + #ifdef __UCLIBC_HAS_FLOATS__ #define MAX_NDIGIT 17 char *gcvt (double number, int ndigit, char *buf) { - __sprintf(buf, "%.*g", (ndigit > MAX_NDIGIT)? MAX_NDIGIT : ndigit, number); + sprintf(buf, "%.*g", (ndigit > MAX_NDIGIT)? MAX_NDIGIT : ndigit, number); return buf; } #endif diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index 6cbdc3e65..c7940f398 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -1,42 +1,33 @@ /* getenv.c for uClibc - Erik Andersen <andersen@codepoet.org> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - */ + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <string.h> #include <unistd.h> +#include <stdlib.h> + +libc_hidden_proto(getenv) +libc_hidden_proto(memcmp) +libc_hidden_proto(strlen) /* IEEE Std 1003.1-2001 says getenv need not be thread safe, so * don't bother locking access to __environ */ -char attribute_hidden *__getenv(const char *var) +char *getenv(const char *var) { int len; char **ep; if (!(ep=__environ)) return NULL; - len = __strlen(var); + len = strlen(var); while(*ep) { - if (__memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { + if (memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { return *ep + len + 1; } ep++; } return NULL; } - -strong_alias(__getenv,getenv) +libc_hidden_def(getenv) diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c index 4bd082823..a5fde0fce 100644 --- a/libc/stdlib/getpt.c +++ b/libc/stdlib/getpt.c @@ -42,6 +42,9 @@ extern int __bsd_getpt (void) attribute_hidden; #endif +libc_hidden_proto(open) +libc_hidden_proto(close) + /* Open a master pseudo terminal and return its file descriptor. */ int getpt (void) @@ -55,7 +58,7 @@ getpt (void) if (!have_no_dev_ptmx) #endif { - fd = __open (_PATH_DEVPTMX, O_RDWR); + fd = open (_PATH_DEVPTMX, O_RDWR); if (fd != -1) { #if defined __ASSUME_DEVPTS__ @@ -79,7 +82,7 @@ getpt (void) /* If /dev/pts is not mounted then the UNIX98 pseudo terminals are not usable. */ - __close (fd); + close (fd); #if !defined __UNIX98PTY_ONLY__ have_no_dev_ptmx = 1; #endif diff --git a/libc/stdlib/jrand48.c b/libc/stdlib/jrand48.c index 819e0d986..6f812068b 100644 --- a/libc/stdlib/jrand48.c +++ b/libc/stdlib/jrand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define jrand48_r __jrand48_r - #include <stdlib.h> +libc_hidden_proto(jrand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c index a21bda080..02a082e68 100644 --- a/libc/stdlib/jrand48_r.c +++ b/libc/stdlib/jrand48_r.c @@ -22,7 +22,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int attribute_hidden __jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) +int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ if (__drand48_iterate (xsubi, buffer) < 0) @@ -33,4 +33,5 @@ int attribute_hidden __jrand48_r (unsigned short int xsubi[3], struct drand48_da return 0; } -strong_alias(__jrand48_r,jrand48_r) +libc_hidden_proto(jrand48_r) +libc_hidden_def(jrand48_r) diff --git a/libc/stdlib/ldiv.c b/libc/stdlib/ldiv.c index f8e789a92..88a877116 100644 --- a/libc/stdlib/ldiv.c +++ b/libc/stdlib/ldiv.c @@ -57,5 +57,5 @@ ldiv (long int numer, long int denom) #if __WORDSIZE == 64 #undef imaxdiv -weak_alias (ldiv, imaxdiv) +strong_alias(ldiv,imaxdiv) #endif diff --git a/libc/stdlib/lldiv.c b/libc/stdlib/lldiv.c index 56ccb2612..09cadc691 100644 --- a/libc/stdlib/lldiv.c +++ b/libc/stdlib/lldiv.c @@ -58,5 +58,5 @@ lldiv (long long int numer, long long int denom) #if __WORDSIZE != 64 #undef imaxdiv -weak_alias (lldiv, imaxdiv) +strong_alias(lldiv,imaxdiv) #endif diff --git a/libc/stdlib/lrand48.c b/libc/stdlib/lrand48.c index bdde5f099..863951f07 100644 --- a/libc/stdlib/lrand48.c +++ b/libc/stdlib/lrand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define nrand48_r __nrand48_r - #include <stdlib.h> +libc_hidden_proto(nrand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/lrand48_r.c b/libc/stdlib/lrand48_r.c index 0ff1ef25e..46e99c1e6 100644 --- a/libc/stdlib/lrand48_r.c +++ b/libc/stdlib/lrand48_r.c @@ -17,11 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define nrand48_r __nrand48_r - #include <stdlib.h> -int attribute_hidden __lrand48_r (struct drand48_data *buffer, long int *result) +libc_hidden_proto(nrand48_r) + +int lrand48_r (struct drand48_data *buffer, long int *result) { /* Be generous for the arguments, detect some errors. */ if (buffer == NULL) @@ -29,4 +29,5 @@ int attribute_hidden __lrand48_r (struct drand48_data *buffer, long int *result) return nrand48_r (buffer->__x, buffer, result); } -strong_alias(__lrand48_r,lrand48_r) +libc_hidden_proto(lrand48_r) +libc_hidden_def(lrand48_r) diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index 5a208bf28..595142526 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -6,9 +6,6 @@ * Parts of the memalign code were stolen from malloc-930716. */ -#define mmap __mmap -#define munmap __munmap - #define _GNU_SOURCE #include <features.h> #include <unistd.h> @@ -19,6 +16,10 @@ #include <errno.h> #include <sys/mman.h> +libc_hidden_proto(memcpy) +/*libc_hidden_proto(memset)*/ +libc_hidden_proto(mmap) +libc_hidden_proto(munmap) #ifdef L_malloc void *malloc(size_t size) @@ -67,7 +68,7 @@ void * calloc(size_t nmemb, size_t lsize) * doesn't need to actually zero anything.... */ if (result != NULL) { - __memset(result, 0, size); + memset(result, 0, size); } #endif return result; @@ -88,7 +89,7 @@ void *realloc(void *ptr, size_t size) newptr = malloc(size); if (newptr) { - __memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); + memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); free(ptr); } return newptr; diff --git a/libc/stdlib/malloc-standard/calloc.c b/libc/stdlib/malloc-standard/calloc.c index b8c43d9dc..99e8884ad 100644 --- a/libc/stdlib/malloc-standard/calloc.c +++ b/libc/stdlib/malloc-standard/calloc.c @@ -16,6 +16,7 @@ #include "malloc.h" +libc_hidden_proto(memset) /* ------------------------------ calloc ------------------------------ */ void* calloc(size_t n_elements, size_t elem_size) @@ -54,7 +55,7 @@ void* calloc(size_t n_elements, size_t elem_size) assert(nclears >= 3); if (nclears > 9) - __memset(d, 0, clearsize); + memset(d, 0, clearsize); else { *(d+0) = 0; @@ -83,7 +84,7 @@ void* calloc(size_t n_elements, size_t elem_size) d = (size_t*)mem; /* Note the additional (sizeof(size_t)) */ clearsize = chunksize(p) - 2*(sizeof(size_t)); - __memset(d, 0, clearsize); + memset(d, 0, clearsize); } #endif } diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c index 1b294d706..cfc937c60 100644 --- a/libc/stdlib/malloc-standard/free.c +++ b/libc/stdlib/malloc-standard/free.c @@ -14,10 +14,9 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define munmap __munmap - #include "malloc.h" +libc_hidden_proto(munmap) /* ------------------------- __malloc_trim ------------------------- __malloc_trim is an inverse of sorts to __malloc_alloc. It gives memory diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c index 029ceda1f..8a09487c2 100644 --- a/libc/stdlib/malloc-standard/mallinfo.c +++ b/libc/stdlib/malloc-standard/mallinfo.c @@ -16,9 +16,10 @@ #include "malloc.h" +libc_hidden_proto(fprintf) /* ------------------------------ mallinfo ------------------------------ */ -struct mallinfo attribute_hidden __mallinfo(void) +struct mallinfo mallinfo(void) { mstate av; struct mallinfo mi; @@ -78,7 +79,8 @@ struct mallinfo attribute_hidden __mallinfo(void) UNLOCK; return mi; } -strong_alias(__mallinfo,mallinfo) +libc_hidden_proto(mallinfo) +libc_hidden_def(mallinfo) void malloc_stats(FILE *file) { @@ -88,7 +90,7 @@ void malloc_stats(FILE *file) file = stderr; } - mi = __mallinfo(); + mi = mallinfo(); fprintf(file, "total bytes allocated = %10u\n", (unsigned int)(mi.arena + mi.hblkhd)); fprintf(file, "total bytes in use bytes = %10u\n", (unsigned int)(mi.uordblks + mi.hblkhd)); fprintf(file, "total non-mmapped bytes allocated = %10d\n", mi.arena); diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index 68d38cb3d..6c3067e5d 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -14,10 +14,6 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define mmap __mmap -#define sysconf __sysconf -#define sbrk __sbrk - #include <features.h> #include <stddef.h> #include <unistd.h> @@ -25,7 +21,12 @@ #include <string.h> #include <malloc.h> #include <stdlib.h> +#include <sys/mman.h> +libc_hidden_proto(mmap) +libc_hidden_proto(sysconf) +libc_hidden_proto(sbrk) +libc_hidden_proto(abort) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c index 36bfe4d99..ae2d33bee 100644 --- a/libc/stdlib/malloc-standard/realloc.c +++ b/libc/stdlib/malloc-standard/realloc.c @@ -14,11 +14,10 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define mremap __mremap - #include "malloc.h" - +libc_hidden_proto(mremap) +libc_hidden_proto(memcpy) /* ------------------------------ realloc ------------------------------ */ void* realloc(void* oldmem, size_t bytes) @@ -128,7 +127,7 @@ void* realloc(void* oldmem, size_t bytes) assert(ncopies >= 3); if (ncopies > 9) - __memcpy(d, s, copysize); + memcpy(d, s, copysize); else { *(d+0) = *(s+0); @@ -228,7 +227,7 @@ void* realloc(void* oldmem, size_t bytes) /* Must alloc, copy, free. */ newmem = malloc(nb - MALLOC_ALIGN_MASK); if (newmem != 0) { - __memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); + memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); free(oldmem); } } diff --git a/libc/stdlib/malloc/calloc.c b/libc/stdlib/malloc/calloc.c index 94031ce29..5925a9e0a 100644 --- a/libc/stdlib/malloc/calloc.c +++ b/libc/stdlib/malloc/calloc.c @@ -22,6 +22,8 @@ #include <string.h> #include <errno.h> +libc_hidden_proto(memset) + void * calloc(size_t nmemb, size_t lsize) { void *result; @@ -34,7 +36,7 @@ void * calloc(size_t nmemb, size_t lsize) return NULL; } if ((result=malloc(size)) != NULL) { - __memset(result, 0, size); + memset(result, 0, size); } return result; } diff --git a/libc/stdlib/malloc/free.c b/libc/stdlib/malloc/free.c index 81ec38cd9..81c718376 100644 --- a/libc/stdlib/malloc/free.c +++ b/libc/stdlib/malloc/free.c @@ -11,17 +11,16 @@ * Written by Miles Bader <miles@gnu.org> */ -#define munmap __munmap -#define sbrk __sbrk - #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> +libc_hidden_proto(munmap) +libc_hidden_proto(sbrk) + #include "malloc.h" #include "heap.h" - static void free_to_heap (void *mem, struct heap *heap) { diff --git a/libc/stdlib/malloc/heap_debug.c b/libc/stdlib/malloc/heap_debug.c index 7dab95627..9e5b61c43 100644 --- a/libc/stdlib/malloc/heap_debug.c +++ b/ |