summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-14 00:58:03 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-14 00:58:03 +0000
commitaf0172162f7c653cad6a11ed1c1a5459bc154465 (patch)
tree70031dad1e7286d58762da7b9e3d3f93d043c278 /libc/stdlib
parentc8609543a9a8bf6559c2931dbbef6b3c41b3fbf2 (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')
-rw-r--r--libc/stdlib/abort.c25
-rw-r--r--libc/stdlib/atexit.c11
-rw-r--r--libc/stdlib/drand48.c4
-rw-r--r--libc/stdlib/drand48_r.c4
-rw-r--r--libc/stdlib/erand48.c3
-rw-r--r--libc/stdlib/erand48_r.c5
-rw-r--r--libc/stdlib/gcvt.c4
-rw-r--r--libc/stdlib/getenv.c35
-rw-r--r--libc/stdlib/getpt.c7
-rw-r--r--libc/stdlib/jrand48.c4
-rw-r--r--libc/stdlib/jrand48_r.c5
-rw-r--r--libc/stdlib/ldiv.c2
-rw-r--r--libc/stdlib/lldiv.c2
-rw-r--r--libc/stdlib/lrand48.c4
-rw-r--r--libc/stdlib/lrand48_r.c9
-rw-r--r--libc/stdlib/malloc-simple/alloc.c11
-rw-r--r--libc/stdlib/malloc-standard/calloc.c5
-rw-r--r--libc/stdlib/malloc-standard/free.c3
-rw-r--r--libc/stdlib/malloc-standard/mallinfo.c8
-rw-r--r--libc/stdlib/malloc-standard/malloc.h9
-rw-r--r--libc/stdlib/malloc-standard/realloc.c9
-rw-r--r--libc/stdlib/malloc/calloc.c4
-rw-r--r--libc/stdlib/malloc/free.c7
-rw-r--r--libc/stdlib/malloc/heap_debug.c5
-rw-r--r--libc/stdlib/malloc/malloc.c6
-rw-r--r--libc/stdlib/malloc/malloc.h1
-rw-r--r--libc/stdlib/malloc/malloc_debug.c14
-rw-r--r--libc/stdlib/malloc/realloc.c4
-rw-r--r--libc/stdlib/mrand48.c4
-rw-r--r--libc/stdlib/mrand48_r.c4
-rw-r--r--libc/stdlib/nrand48.c4
-rw-r--r--libc/stdlib/nrand48_r.c5
-rw-r--r--libc/stdlib/ptsname.c34
-rw-r--r--libc/stdlib/rand.c4
-rw-r--r--libc/stdlib/random.c17
-rw-r--r--libc/stdlib/random_r.c24
-rw-r--r--libc/stdlib/realpath.c36
-rw-r--r--libc/stdlib/seed48.c4
-rw-r--r--libc/stdlib/seed48_r.c9
-rw-r--r--libc/stdlib/setenv.c46
-rw-r--r--libc/stdlib/srand48.c4
-rw-r--r--libc/stdlib/srand48_r.c5
-rw-r--r--libc/stdlib/stdlib.c162
-rw-r--r--libc/stdlib/strtod.c33
-rw-r--r--libc/stdlib/strtof.c4
-rw-r--r--libc/stdlib/strtold.c4
-rw-r--r--libc/stdlib/system.c21
-rw-r--r--libc/stdlib/unix_grantpt.c34
-rw-r--r--libc/stdlib/unlockpt.c3
-rw-r--r--libc/stdlib/valloc.c4
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/libc/stdlib/malloc/heap_debug.c
@@ -11,13 +11,14 @@
* Written by Miles Bader <miles@gnu.org>
*/
-#define vfprintf __vfprintf
-
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
+libc_hidden_proto(vfprintf)
+libc_hidden_proto(fprintf)
+
#include "malloc.h"
#include "heap.h"
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index 6bc8d8773..329788aec 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -11,14 +11,14 @@
* Written by Miles Bader <miles@gnu.org>
*/
-#define mmap __mmap
-#define sbrk __sbrk
-
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
+libc_hidden_proto(mmap)
+libc_hidden_proto(sbrk)
+
#include "malloc.h"
#include "heap.h"
diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h
index 707cad13d..9360eecda 100644
--- a/libc/stdlib/malloc/malloc.h
+++ b/libc/stdlib/malloc/malloc.h
@@ -16,6 +16,7 @@
/* The system pagesize... */
extern size_t __pagesize;
+libc_hidden_proto(__pagesize)
#define MALLOC_PAGE_SIZE __pagesize
/* The minimum size of block we request from the the system to extend the
diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c
index abe5546ca..6c74d78bb 100644
--- a/libc/stdlib/malloc/malloc_debug.c
+++ b/libc/stdlib/malloc/malloc_debug.c
@@ -11,14 +11,16 @@
* Written by Miles Bader <miles@gnu.org>
*/
-#define atoi __atoi
-#define vfprintf __vfprintf
-
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
+libc_hidden_proto(atoi)
+libc_hidden_proto(vfprintf)
+libc_hidden_proto(putc)
+libc_hidden_proto(getenv)
+
#include "malloc.h"
#include "heap.h"
@@ -42,7 +44,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...)
while (spaces > 0)
{
- __putc (' ', stderr);
+ putc (' ', stderr);
spaces--;
}
@@ -50,7 +52,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...)
vfprintf (stderr, fmt, val);
va_end (val);
- __putc ('\n', stderr);
+ putc ('\n', stderr);
__malloc_debug_indent (indent);
}
@@ -58,7 +60,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...)
void
__malloc_debug_init (void)
{
- char *ev = __getenv ("MALLOC_DEBUG");
+ char *ev = getenv ("MALLOC_DEBUG");
if (ev)
{
int val = atoi (ev);
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c
index 8dcc35360..0cf83e2bd 100644
--- a/libc/stdlib/malloc/realloc.c
+++ b/libc/stdlib/malloc/realloc.c
@@ -15,6 +15,8 @@
#include <string.h>
#include <errno.h>
+libc_hidden_proto(memcpy)
+
#include "malloc.h"
#include "heap.h"
@@ -66,7 +68,7 @@ realloc (void *mem, size_t new_size)
void *new_mem = malloc (new_size - MALLOC_HEADER_SIZE);
if (new_mem)
{
- __memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE);
+ memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE);
free (mem);
}
mem = new_mem;
diff --git a/libc/stdlib/mrand48.c b/libc/stdlib/mrand48.c
index a4667e346..6905545bd 100644
--- a/libc/stdlib/mrand48.c
+++ b/libc/stdlib/mrand48.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/mrand48_r.c b/libc/stdlib/mrand48_r.c
index f79e5f887..ca2bd7bbb 100644
--- a/libc/stdlib/mrand48_r.c
+++ b/libc/stdlib/mrand48_r.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)
+
int mrand48_r (struct drand48_data *buffer, long int *result)
{
/* Be generous for the arguments, detect some errors. */
diff --git a/libc/stdlib/nrand48.c b/libc/stdlib/nrand48.c
index 6e161bcec..0199a30a5 100644
--- a/libc/stdlib/nrand48.c
+++ b/libc/stdlib/nrand48.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/nrand48_r.c b/libc/stdlib/nrand48_r.c
index f72c07030..6f8afdb77 100644
--- a/libc/stdlib/nrand48_r.c
+++ b/libc/stdlib/nrand48_r.c
@@ -22,7 +22,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
-int attribute_hidden __nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
+int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@@ -36,4 +36,5 @@ int attribute_hidden __nrand48_r (unsigned short int xsubi[3], struct drand48_da
return 0;
}
-strong_alias(__nrand48_r,nrand48_r)
+libc_hidden_proto(nrand48_r)
+libc_hidden_def(nrand48_r)
diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c
index 8e18e3989..8580143b9 100644
--- a/libc/stdlib/ptsname.c
+++ b/libc/stdlib/ptsname.c
@@ -17,8 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define isatty __isatty
-
#define _ISOC99_SOURCE
#include <stdio.h>
#include <errno.h>
@@ -32,6 +30,13 @@
#include <unistd.h>
#include <bits/uClibc_uintmaxtostr.h>
+libc_hidden_proto(strcat)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(strlen)
+libc_hidden_proto(isatty)
+libc_hidden_proto(ioctl)
+libc_hidden_proto(fstat)
+libc_hidden_proto(stat)
#if !defined __UNIX98PTY_ONLY__
@@ -64,7 +69,7 @@ extern const char __libc_ptyname2[] attribute_hidden;
/* Store at most BUFLEN characters of the pathname of the slave pseudo
terminal associated with the master FD is open on in BUF.
Return 0 on success, otherwise an error number. */
-int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen)
+int ptsname_r (int fd, char *buf, size_t buflen)
{
int save_errno = errno;
#if !defined __UNIX98PTY_ONLY__
@@ -88,7 +93,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen)
# error "__UNIX98PTY_ONLY__ enabled but TIOCGPTN ioctl not supported by your kernel."
#endif
#ifdef TIOCGPTN
- if (__ioctl (fd, TIOCGPTN, &ptyno) == 0)
+ if (ioctl (fd, TIOCGPTN, &ptyno) == 0)
{
/* Buffer we use to print the number in. */
char numbuf[__BUFLEN_INT10TOSTR];
@@ -103,8 +108,8 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen)
return ERANGE;
}
- __strcpy (buf, devpts);
- __strcat (buf, p);
+ strcpy (buf, devpts);
+ strcat (buf, p);
/* Note: Don't bother with stat on the slave name and checking the
driver's major device number - the ioctl above succeeded so
we know the fd was a Unix'98 master and the /dev/pts/ prefix
@@ -130,13 +135,13 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen)
{
char *p;
- if (buflen < __strlen (_PATH_TTY) + 3)
+ if (buflen < strlen (_PATH_TTY) + 3)
{
errno = ERANGE;
return ERANGE;
}
- if (__fstat (fd, &st) < 0)
+ if (fstat (fd, &st) < 0)
return errno;
/* Check if FD really is a master pseudo terminal. */
@@ -152,20 +157,20 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen)
if (major (st.st_rdev) == 4)
ptyno -= 128;
- if (ptyno / 16 >= __strlen (__libc_ptyname1))
+ if (ptyno / 16 >= strlen (__libc_ptyname1))
{
errno = ENOTTY;
return ENOTTY;
}
- __strcpy (buf, _PATH_TTY);
- p = buf + __strlen (buf);
+ strcpy (buf, _PATH_TTY);
+ p = buf + strlen (buf);
p[0] = __libc_ptyname1[ptyno / 16];
p[1] = __libc_ptyname2[ptyno % 16];
p[2] = '\0';
}
- if (__stat(buf, &st) < 0)
+ if (stat(buf, &st) < 0)
return errno;
/* Check if the name we're about to return really corresponds to a
@@ -181,7 +186,8 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen)
errno = save_errno;
return 0;
}
-strong_alias(__ptsname_r,ptsname_r)
+libc_hidden_proto(ptsname_r)
+libc_hidden_def(ptsname_r)
/* Return the pathname of the pseudo terminal slave assoicated with
the master FD is open on, or NULL on errors.
@@ -191,5 +197,5 @@ ptsname (int fd)
{
static char buffer[sizeof (_PATH_DEVPTS) + 20];
- return __ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer;
+ return ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer;
}
diff --git a/libc/stdlib/rand.c b/libc/stdlib/rand.c
index a4c739c18..cdf58ecc7 100644
--- a/libc/stdlib/rand.c
+++ b/libc/stdlib/rand.c
@@ -17,10 +17,10 @@
* write to the Free Software Foundation, Inc., 675 Mass Ave,
* Cambridge, MA 02139, USA. */
-#define random __random
-
#include <stdlib.h>
+libc_hidden_proto(random)
+
int rand (void)
{
return((int)random());
diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c
index eb146098a..115ff2162 100644
--- a/libc/stdlib/random.c
+++ b/libc/stdlib/random.c
@@ -22,17 +22,17 @@
* Rewritten to use reentrant functions by Ulrich Drepper, 1995.
*/
-#define random_r __random_r
-#define srandom_r __srandom_r
-#define setstate_r __setstate_r
-#define initstate_r __initstate_r
-
#define _GNU_SOURCE
#include <features.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
+libc_hidden_proto(random_r)
+libc_hidden_proto(srandom_r)
+libc_hidden_proto(setstate_r)
+libc_hidden_proto(initstate_r)
+
#ifdef __UCLIBC_HAS_THREADS__
# include <pthread.h>
/* POSIX.1c requires that there is mutual exclusion for the `rand' and
@@ -191,7 +191,7 @@ void srandom (unsigned int x)
srandom_r (x, &unsafe_state);
__pthread_mutex_unlock(&lock);
}
-weak_alias (srandom, srand)
+strong_alias(srandom,srand)
/* Initialize the state information in the given array of N bytes for
future random number generation. Based on the number of bytes we
@@ -246,7 +246,7 @@ char * setstate (char *arg_state)
rear pointers can't wrap on the same call by not testing the rear
pointer if the front one has wrapped. Returns a 31-bit random number. */
-long int attribute_hidden __random (void)
+long int random (void)
{
int32_t retval;
@@ -255,4 +255,5 @@ long int attribute_hidden __random (void)
__pthread_mutex_unlock(&lock);
return retval;
}
-strong_alias(__random,random)
+libc_hidden_proto(random)
+libc_hidden_def(random)
diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c
index b10f29519..67234048b 100644
--- a/libc/stdlib/random_r.c
+++ b/libc/stdlib/random_r.c
@@ -134,7 +134,7 @@ static const struct random_poly_info random_poly_info =
rear pointers can't wrap on the same call by not testing the rear
pointer if the front one has wrapped. Returns a 31-bit random number. */
-int attribute_hidden __random_r(struct random_data *buf, int32_t *result)
+int random_r(struct random_data *buf, int32_t *result)
{
int32_t *state;
@@ -181,7 +181,8 @@ fail:
__set_errno (EINVAL);
return -1;
}
-strong_alias(__random_r,random_r)
+libc_hidden_proto(random_r)
+libc_hidden_def(random_r)
/* Initialize the random number generator based on the given seed. If the
type is the trivial no-state-information type, just remember the seed.
@@ -191,7 +192,7 @@ strong_alias(__random_r,random_r)
information a given number of times to get rid of any initial dependencies
introduced by the L.C.R.N.G. Note that the initialization of randtbl[]
for default usage relies on values produced by this routine. */
-int attribute_hidden __srandom_r (unsigned int seed, struct random_data *buf)
+int srandom_r (unsigned int seed, struct random_data *buf)
{
int type;
int32_t *state;
@@ -236,7 +237,7 @@ int attribute_hidden __srandom_r (unsigned int seed, struct random_data *buf)
while (--kc >= 0)
{
int32_t discard;
- (void) __random_r (buf, &discard);
+ (void) random_r (buf, &discard);
}
done:
@@ -245,7 +246,8 @@ done:
fail:
return -1;
}
-strong_alias(__srandom_r,srandom_r)
+libc_hidden_proto(srandom_r)
+libc_hidden_def(srandom_r)
/* Initialize the state information in the given array of N bytes for
future random number generation. Based on the number of bytes we
@@ -258,7 +260,7 @@ strong_alias(__srandom_r,srandom_r)
Note: The first thing we do is save the current state, if any, just like
setstate so that it doesn't matter when initstate is called.
Returns a pointer to the old state. */
-int attribute_hidden __initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf)
+int initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf)
{
int type;
int degree;
@@ -294,7 +296,7 @@ int attribute_hidden __initstate_r (unsigned int seed, char *arg_state, size_t n
buf->state = state;
- __srandom_r (seed, buf);
+ srandom_r (seed, buf);
state[-1] = TYPE_0;
if (type != TYPE_0)
@@ -306,7 +308,8 @@ fail:
__set_errno (EINVAL);
return -1;
}
-strong_alias(__initstate_r,initstate_r)
+libc_hidden_proto(initstate_r)
+libc_hidden_def(initstate_r)
/* Restore the state from the given state array.
Note: It is important that we also remember the locations of the pointers
@@ -316,7 +319,7 @@ strong_alias(__initstate_r,initstate_r)
to the order in which things are done, it is OK to call setstate with the
same state as the current state
Returns a pointer to the old state information. */
-int attribute_hidden __setstate_r (char *arg_state, struct random_data *buf)
+int setstate_r (char *arg_state, struct random_data *buf)
{
int32_t *new_state = 1 + (int32_t *) arg_state;
int type;
@@ -359,4 +362,5 @@ fail:
__set_errno (EINVAL);
return -1;
}
-strong_alias(__setstate_r,setstate_r)
+libc_hidden_proto(setstate_r)
+libc_hidden_def(setstate_r)
diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c
index 88677f7a7..f82676709 100644
--- a/libc/stdlib/realpath.c
+++ b/libc/stdlib/realpath.c
@@ -1,21 +1,11 @@
/*
* realpath.c -- canonicalize pathname by removing symlinks
* Copyright (C) 1993 Rick Sladkey <jrs@world.std.com>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program 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 Library Public License for more details.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define readlink __readlink
-#define getcwd __getcwd
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -31,6 +21,12 @@
#include <sys/stat.h> /* for S_IFLNK */
+libc_hidden_proto(strcat)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(strlen)
+libc_hidden_proto(readlink)
+libc_hidden_proto(getcwd)
+
#ifndef PATH_MAX
#ifdef _POSIX_VERSION
#define PATH_MAX _POSIX_PATH_MAX
@@ -62,11 +58,11 @@ char resolved_path[];
int n;
/* Make a copy of the source path since we may need to modify it. */
- if (__strlen(path) >= PATH_MAX - 2) {
+ if (strlen(path) >= PATH_MAX - 2) {
__set_errno(ENAMETOOLONG);
return NULL;
}
- __strcpy(copy_path, path);
+ strcpy(copy_path, path);
path = copy_path;
max_path = copy_path + PATH_MAX - 2;
/* If it's a relative pathname use getwd for starters. */
@@ -78,7 +74,7 @@ char resolved_path[];
#else
getwd(new_path);
#endif
- new_path += __strlen(new_path);
+ new_path += strlen(new_path);
if (new_path[-1] != '/')
*new_path++ = '/';
} else {
@@ -132,7 +128,7 @@ char resolved_path[];
if (errno != EINVAL) {
/* Make sure it's null terminated. */
*new_path = '\0';
- __strcpy(resolved_path, got_path);
+ strcpy(resolved_path, got_path);
return NULL;
}
} else {
@@ -145,13 +141,13 @@ char resolved_path[];
/* Otherwise back up over this component. */
while (*(--new_path) != '/');
/* Safe sex check. */
- if (__strlen(path) + n >= PATH_MAX - 2) {
+ if (strlen(path) + n >= PATH_MAX - 2) {
__set_errno(ENAMETOOLONG);
return NULL;
}
/* Insert symlink contents into path. */
- __strcat(link_path, path);
- __strcpy(copy_path, link_path);
+ strcat(link_path, path);
+ strcpy(copy_path, link_path);
path = copy_path;
}
#endif /* S_IFLNK */
@@ -162,6 +158,6 @@ char resolved_path[];
new_path--;
/* Make sure it's null terminated. */
*new_path = '\0';
- __strcpy(resolved_path, got_path);
+ strcpy(resolved_path, got_path);
return resolved_path;
}
diff --git a/libc/stdlib/seed48.c b/libc/stdlib/seed48.c
index eec56cd21..f068b980d 100644
--- a/libc/stdlib/seed48.c
+++ b/libc/stdlib/seed48.c
@@ -17,10 +17,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define seed48_r __seed48_r
-
#include <stdlib.h>
+libc_hidden_proto(seed48_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/seed48_r.c b/libc/stdlib/seed48_r.c
index d1c74f24c..a6da03015 100644
--- a/libc/stdlib/seed48_r.c
+++ b/libc/stdlib/seed48_r.c
@@ -21,10 +21,12 @@
#include <string.h>
#include <limits.h>
-int attribute_hidden __seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer)
+libc_hidden_proto(memcpy)
+
+int seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer)
{
/* Save old value at a private place to be used as return value. */
- __memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x));
+ memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x));
/* Install new state. */
buffer->__x[2] = seed16v[2];
@@ -36,4 +38,5 @@ int attribute_hidden __seed48_r (unsigned short int seed16v[3], struct drand48_d
return 0;
}
-strong_alias(__seed48_r,seed48_r)
+libc_hidden_proto(seed48_r)
+libc_hidden_def(seed48_r)
diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c
index 413ebed9e..5c19143d1 100644
--- a/libc/stdlib/setenv.c
+++ b/libc/stdlib/setenv.c
@@ -19,8 +19,6 @@
modified for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-#define strndup __strndup
-
#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
@@ -28,6 +26,13 @@
#include <string.h>
#include <unistd.h>
+libc_hidden_proto(memcpy)
+libc_hidden_proto(strchr)
+libc_hidden_proto(strlen)
+libc_hidden_proto(strncmp)
+libc_hidden_proto(strndup)
+libc_hidden_proto(unsetenv)
+
#ifdef __UCLIBC_HAS_THREADS__
# include <pthread.h>
static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
@@ -35,7 +40,6 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
#define LOCK __pthread_mutex_lock(&mylock)
#define UNLOCK __pthread_mutex_unlock(&mylock)
-extern int __unsetenv (__const char *__name) attribute_hidden;
/* If this variable is not a null pointer we allocated the current
environment. */
@@ -53,8 +57,8 @@ int attribute_hidden __add_to_environ (const char *name, const char *value,
{
register char **ep;
register size_t size;
- const size_t namelen = __strlen (name);
- const size_t vallen = value != NULL ? __strlen (value) + 1 : 0;
+ const size_t namelen = strlen (name);
+ const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
LOCK;
@@ -65,7 +69,7 @@ int attribute_hidden __add_to_environ (const char *name, const char *value,
size = 0;
if (ep != NULL) {
for (; *ep != NULL; ++ep) {
- if (!__strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
+ if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
break;
else
++size;
@@ -97,13 +101,13 @@ int attribute_hidden __add_to_environ (const char *name, const char *value,
return -1;
}
- __memcpy (new_environ[size], name, namelen);
+ memcpy (new_environ[size], name, namelen);
new_environ[size][namelen] = '=';
- __memcpy (&new_environ[size][namelen + 1], value, vallen);
+ memcpy (&new_environ[size][namelen + 1], value, vallen);
}
if (__environ != last_environ) {
- __memcpy ((char *) new_environ, (char *) __environ,
+ memcpy ((char *) new_environ, (char *) __environ,
size * sizeof (char *));
}
@@ -121,9 +125,9 @@ int attribute_hidden __add_to_environ (const char *name, const char *value,
UNLOCK;
return -1;
}
- __memcpy (np, name, namelen);
+ memcpy (np, name, namelen);
np[namelen] = '=';
- __memcpy (&np[namelen + 1], value, vallen);
+ memcpy (&np[namelen + 1], value, vallen);
}
*ep = np;
}
@@ -132,27 +136,28 @@ int attribute_hidden __add_to_environ (const char *name, const char *value,
return 0;
}
-int attribute_hidden __setenv (const char *name, const char *value, int replace)
+int setenv (const char *name, const char *value, int replace)
{
return __add_to_environ (name, value, NULL, replace);
}
-strong_alias(__setenv,setenv)
+libc_hidden_proto(setenv)
+libc_hidden_def(setenv)
-int attribute_hidden __unsetenv (const char *name)
+int unsetenv (const char *name)
{
size_t len;
char **ep;
- if (name == NULL || *name == '\0' || __strchr (name, '=') != NULL) {
+ if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) {
__set_errno (EINVAL);
return -1;
}
- len = __strlen (name);
+ len = strlen (name);
LOCK;
ep = __environ;
while (*ep != NULL) {
- if (!__strncmp (*ep, name, len) && (*ep)[len] == '=') {
+ if (!strncmp (*ep, name, len) && (*ep)[len] == '=') {
/* Found it. Remove this pointer by moving later ones back. */
char **dp = ep;
do {
@@ -166,7 +171,8 @@ int attribute_hidden __unsetenv (const char *name)
UNLOCK;
return 0;
}
-strong_alias(__unsetenv,unsetenv)
+libc_hidden_proto(unsetenv)
+libc_hidden_def(unsetenv)
/* The `clearenv' was planned to be added to POSIX.1 but probably
never made it. Nevertheless the POSIX.9 standard (POSIX bindings
@@ -189,7 +195,7 @@ int clearenv (void)
int putenv (char *string)
{
int result;
- const char *const name_end = __strchr (string, '=');
+ const char *const name_end = strchr (string, '=');
if (name_end != NULL) {
char *name = strndup(string, name_end - string);
@@ -197,7 +203,7 @@ int putenv (char *string)
free(name);
return(result);
}
- __unsetenv (string);
+ unsetenv (string);
return 0;
}
diff --git a/libc/stdlib/srand48.c b/libc/stdlib/srand48.c
index 26def8e49..42e90c9f9 100644
--- a/libc/stdlib/srand48.c
+++ b/libc/stdlib/srand48.c
@@ -17,10 +17,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define srand48_r __srand48_r
-
#include <stdlib.h>
+libc_hidden_proto(srand48_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/srand48_r.c b/libc/stdlib/srand48_r.c
index d2f959c79..5f9cf1da3 100644
--- a/libc/stdlib/srand48_r.c
+++ b/libc/stdlib/srand48_r.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <limits.h>
-int attribute_hidden __srand48_r (long int seedval, struct drand48_data *buffer)
+int srand48_r (long int seedval, struct drand48_data *buffer)
{
/* The standards say we only have 32 bits. */
if (sizeof (long int) > 4)
@@ -36,4 +36,5 @@ int attribute_hidden __srand48_r (long int seedval, struct drand48_data *buffer)
return 0;
}
-strong_alias(__srand48_r,srand48_r)
+libc_hidden_proto(srand48_r)
+libc_hidden_def(srand48_r)
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 8203881a4..42ebaa47b 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -32,14 +32,6 @@
* Add wscto{inttype} functions.
*/
-#define wcsrtombs __wcsrtombs
-#define mbsrtowcs __mbsrtowcs
-#define mbrtowc __mbrtowc
-#define mbrlen __mbrlen
-#define iswspace __iswspace
-#define iswspace_l __iswspace_l
-#define wcrtomb __wcrtomb
-
#define _ISOC99_SOURCE /* for ULLONG primarily... */
#define _GNU_SOURCE
#include <limits.h>
@@ -73,13 +65,11 @@
#include <stdlib.h>
#include <locale.h>
-extern long int __strtol (__const char *__restrict __nptr,
- char **__restrict __endptr, int __base)
- __THROW __nonnull ((1)) __wur attribute_hidden;
-__extension__
-extern long long int __strtoll (__const char *__restrict __nptr,
- char **__restrict __endptr, int __base)
- __THROW __nonnull ((1)) __wur attribute_hidden;
+#ifdef __UCLIBC_DO_XLOCALE
+libc_hidden_proto(isspace_l)
+#else
+libc_hidden_proto(isspace)
+#endif
#ifdef __UCLIBC_HAS_WCHAR__
@@ -87,6 +77,12 @@ extern long long int __strtoll (__const char *__restrict __nptr,
#include <wctype.h>
#include <bits/uClibc_uwchar.h>
+#ifdef __UCLIBC_DO_XLOCALE
+libc_hidden_proto(iswspace_l)
+#else
+libc_hidden_proto(iswspace)
+#endif
+
#ifdef __UCLIBC_HAS_XLOCALE__
#include <xlocale.h>
#endif /* __UCLIBC_HAS_XLOCALE__ */
@@ -150,26 +146,26 @@ extern long long int __strtoll (__const char *__restrict __nptr,
extern unsigned long
_stdlib_strto_l_l(register const char * __restrict str,
char ** __restrict endptr, int base, int sflag,
- __locale_t locale_arg);
+ __locale_t locale_arg) attribute_hidden;
#if defined(ULLONG_MAX)
extern unsigned long long
_stdlib_strto_ll_l(register const char * __restrict str,
char ** __restrict endptr, int base, int sflag,
- __locale_t locale_arg);
+ __locale_t locale_arg) attribute_hidden;
#endif
#ifdef __UCLIBC_HAS_WCHAR__
extern unsigned long
_stdlib_wcsto_l_l(register const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base, int sflag,
- __locale_t locale_arg);
+ __locale_t locale_arg) attribute_hidden;
#if defined(ULLONG_MAX)
extern unsigned long long
_stdlib_wcsto_ll_l(register const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base, int sflag,
- __locale_t locale_arg);
+ __locale_t locale_arg) attribute_hidden;
#endif
#endif /* __UCLIBC_HAS_WCHAR__ */
@@ -179,35 +175,33 @@ _stdlib_wcsto_ll_l(register const wchar_t * __restrict str,
extern unsigned long
_stdlib_strto_l(register const char * __restrict str,
- char ** __restrict endptr, int base, int sflag);
+ char ** __restrict endptr, int base, int sflag) attribute_hidden;
#if defined(ULLONG_MAX)
extern unsigned long long
_stdlib_strto_ll(register const char * __restrict str,
- char ** __restrict endptr, int base, int sflag);
+ char ** __restrict endptr, int base, int sflag) attribute_hidden;
#endif
#ifdef __UCLIBC_HAS_WCHAR__
extern unsigned long
_stdlib_wcsto_l(register const wchar_t * __restrict str,
- wchar_t ** __restrict endptr, int base, int sflag);
+ wchar_t ** __restrict endptr, int base, int sflag) attribute_hidden;
#if defined(ULLONG_MAX)
extern unsigned long long
_stdlib_wcsto_ll(register const wchar_t * __restrict str,
- wchar_t ** __restrict endptr, int base, int sflag);
+ wchar_t ** __restrict endptr, int base, int sflag) attribute_hidden;
#endif
#endif /* __UCLIBC_HAS_WCHAR__ */
/**********************************************************************/
#ifdef L_atof
-extern double __strtod (__const char *__restrict __nptr,
- char **__restrict __endptr)
- __THROW __nonnull ((1)) __wur attribute_hidden;
+libc_hidden_proto(strtod)
double atof(const char *nptr)
{
- return __strtod(nptr, (char **) NULL);
+ return strtod(nptr, (char **) NULL);
}
#endif
@@ -267,9 +261,11 @@ strong_alias(llabs,imaxabs)
#if INT_MAX < LONG_MAX
-int attribute_hidden __atoi(const char *nptr)
+libc_hidden_proto(strtol)
+
+int atoi(const char *nptr)
{
- return (int) __strtol(nptr, (char **) NULL, 10);
+ return (int) strtol(nptr, (char **) NULL, 10);
}
strong_alias(__atoi,atoi)
@@ -279,19 +275,23 @@ strong_alias(__atoi,atoi)
/**********************************************************************/
#ifdef L_atol
-long attribute_hidden __atol(const char *nptr)
+libc_hidden_proto(strtol)
+
+long atol(const char *nptr)
{
- return __strtol(nptr, (char **) NULL, 10);
+ return strtol(nptr, (char **) NULL, 10);
}
-strong_alias(__atol,atol)
+libc_hidden_proto(atol)
+libc_hidden_def(atol)
#if UINT_MAX == ULONG_MAX
-hidden_strong_alias(__atol,__atoi)
-strong_alias(__atol,atoi)
+strong_alias(atol,atoi)
+libc_hidden_proto(atoi)
+libc_hidden_def(atoi)
#endif
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-strong_alias(__atol,atoll)
+strong_alias(atol,atoll)
#endif
#endif
@@ -300,9 +300,11 @@ strong_alias(__atol,atoll)
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
+libc_hidden_proto(strtoll)
+
long long atoll(const char *nptr)
{
- return __strtoll(nptr, (char **) NULL, 10);
+ return strtoll(nptr, (char **) NULL, 10);
}
#endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
@@ -311,20 +313,22 @@ long long atoll(const char *nptr)
/**********************************************************************/
#if defined(L_strtol) || defined(L_strtol_l)
-long attribute_hidden __UCXL(strtol)(const char * __restrict str, char ** __restrict endptr,
+long __XL_NPP(strtol)(const char * __restrict str, char ** __restrict endptr,
int base __LOCALE_PARAM )
{
return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 1 __LOCALE_ARG );
}
-
-__UCXL_ALIAS(strtol)
+libc_hidden_proto(__XL_NPP(strtol))
+libc_hidden_def(__XL_NPP(strtol))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtol_l)
strong_alias(strtol,strtoimax)
#endif
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-strong_alias(__XL(strtol),__XL(strtoll))
+strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
+libc_hidden_proto(__XL_NPP(strtoll))
+libc_hidden_def(__XL_NPP(strtoll))
#endif
#endif
@@ -333,15 +337,15 @@ strong_alias(__XL(strtol),__XL(strtoll))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-long long attribute_hidden __UCXL(strtoll)(const char * __restrict str,
+long long __XL_NPP(strtoll)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
{
return (long long) __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 1
__LOCALE_ARG );
}
-
-__UCXL_ALIAS(strtoll)
+libc_hidden_proto(__XL_NPP(strtoll))
+libc_hidden_def(__XL_NPP(strtoll))
#if !defined(L_strtoll_l)
#if (ULLONG_MAX == UINTMAX_MAX)
@@ -356,21 +360,23 @@ strong_alias(strtoll,strtoq)
/**********************************************************************/
#if defined(L_strtoul) || defined(L_strtoul_l)
-unsigned long attribute_hidden __UCXL(strtoul)(const char * __restrict str,
+unsigned long __XL_NPP(strtoul)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
{
return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 0 __LOCALE_ARG );
}
-
-__UCXL_ALIAS(strtoul)
+libc_hidden_proto(__XL_NPP(strtoul))
+libc_hidden_def(__XL_NPP(strtoul))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtoul_l)
strong_alias(strtoul,strtoumax)
#endif
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-strong_alias(__XL(strtoul),__XL(strtoull))
+strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull))
+libc_hidden_proto(__XL_NPP(strtoull))
+libc_hidden_def(__XL_NPP(strtoull))
#endif
@@ -380,14 +386,14 @@ strong_alias(__XL(strtoul),__XL(strtoull))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-unsigned long long attribute_hidden __UCXL(strtoull)(const char * __restrict str,
+unsigned long long __XL_NPP(strtoull)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
{
return __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG );
}
-
-__UCXL_ALIAS(strtoull)
+libc_hidden_proto(__XL_NPP(strtoull))
+libc_hidden_def(__XL_NPP(strtoull))
#if !defined(L_strtoull_l)
#if (ULLONG_MAX == UINTMAX_MAX)
@@ -721,10 +727,10 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc
/**********************************************************************/
/* Made _Exit() an alias for _exit(), as per C99. */
/* #ifdef L__Exit */
-
+/* libc_hidden_proto(_exit) */
/* void _Exit(int status) */
/* { */
-/* _exit_internal(status); */
+/* _exit(status); */
/* } */
/* #endif */
@@ -769,7 +775,7 @@ void *bsearch(const void *key, const void *base, size_t /* nmemb */ high,
* calculation, as well as to reduce the generated code size with
* bcc and gcc. */
-void attribute_hidden __qsort (void *base,
+void qsort (void *base,
size_t nel,
size_t width,
int (*comp)(const void *, const void *))
@@ -814,7 +820,8 @@ void attribute_hidden __qsort (void *base,
} while (wgap);
}
}
-strong_alias(__qsort,qsort)
+libc_hidden_proto(qsort)
+libc_hidden_def(qsort)
/* ---------- original snippets version below ---------- */
@@ -868,7 +875,7 @@ void ssort (void *base,
/**********************************************************************/
#ifdef L__stdlib_mb_cur_max
-size_t attribute_hidden _stdlib_mb_cur_max_internal(void)
+size_t _stdlib_mb_cur_max(void)
{
#ifdef __CTYPE_HAS_UTF_8_LOCALES
return __UCLIBC_CURLOCALE_DATA.mb_cur_max;
@@ -881,12 +888,15 @@ size_t attribute_hidden _stdlib_mb_cur_max_internal(void)
return 1;
#endif
}
-strong_alias(_stdlib_mb_cur_max_internal,_stdlib_mb_cur_max)
+libc_hidden_proto(_stdlib_mb_cur_max)
+libc_hidden_def(_stdlib_mb_cur_max)
#endif
/**********************************************************************/
#ifdef L_mblen
+libc_hidden_proto(mbrlen)
+
int mblen(register const char *s, size_t n)
{
static mbstate_t state;
@@ -913,6 +923,8 @@ int mblen(register const char *s, size_t n)
/**********************************************************************/
#ifdef L_mbtowc
+libc_hidden_proto(mbrtowc)
+
int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
{
static mbstate_t state;
@@ -941,6 +953,8 @@ int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
/* Note: We completely ignore state in all currently supported conversions. */
+libc_hidden_proto(wcrtomb)
+
int wctomb(register char *__restrict s, wchar_t swc)
{
return (!s)
@@ -957,6 +971,8 @@ int wctomb(register char *__restrict s, wchar_t swc)
/**********************************************************************/
#ifdef L_mbstowcs
+libc_hidden_proto(mbsrtowcs)
+
size_t mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
{
mbstate_t state;
@@ -972,6 +988,8 @@ size_t mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
/* Note: We completely ignore state in all currently supported conversions. */
+libc_hidden_proto(wcsrtombs)
+
size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
{
const wchar_t *e = pwcs; /* Needed because of restrict. */
@@ -983,20 +1001,22 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
/**********************************************************************/
#if defined(L_wcstol) || defined(L_wcstol_l)
-long __UCXL(wcstol)(const wchar_t * __restrict str,
+long __XL_NPP(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 );
}
-
-__UCXL_ALIAS(wcstol)
+libc_hidden_proto(__XL_NPP(wcstol))
+libc_hidden_def(__XL_NPP(wcstol))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l)
strong_alias(wcstol,wcstoimax)
#endif
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-strong_alias(__XL(wcstol),__XL(wcstoll))
+strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll))
+libc_hidden_proto(__XL_NPP(wcstoll)
+libc_hidden_def(__XL_NPP(wcstoll)
#endif
#endif
@@ -1005,15 +1025,15 @@ strong_alias(__XL(wcstol),__XL(wcstoll))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-long long attribute_hidden __UCXL(wcstoll)(const wchar_t * __restrict str,
+long long __XL_NPP(wcstoll)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
{
return (long long) __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 1
__LOCALE_ARG );
}
-
-__UCXL_ALIAS(wcstoll)
+libc_hidden_proto(__XL_NPP(wcstoll))
+libc_hidden_def(__XL_NPP(wcstoll))
#if !defined(L_wcstoll_l)
#if (ULLONG_MAX == UINTMAX_MAX)
@@ -1028,21 +1048,23 @@ strong_alias(wcstoll,wcstoq)
/**********************************************************************/
#if defined(L_wcstoul) || defined(L_wcstoul_l)
-unsigned long attribute_hidden __UCXL(wcstoul)(const wchar_t * __restrict str,
+unsigned long __XL_NPP(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 );
}
-
-__UCXL_ALIAS(wcstoul)
+libc_hidden_proto(__XL_NPP(wcstoul))
+libc_hidden_def(__XL_NPP(wcstoul))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l)
strong_alias(wcstoul,wcstoumax)
#endif
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-strong_alias(__XL(wcstoul),__XL(wcstoull))
+strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull))
+libc_hidden_proto(__XL_NPP(wcstoull))
+libc_hidden_def(__XL_NPP(wcstoull))
#endif
#endif
@@ -1051,14 +1073,14 @@ strong_alias(__XL(wcstoul),__XL(wcstoull))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
-unsigned long long attribute_hidden __UCXL(wcstoull)(const wchar_t * __restrict str,
+unsigned long long __XL_NPP(wcstoull)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
{
return __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG );
}
-
-__UCXL_ALIAS(wcstoull)
+libc_hidden_proto(__XL_NPP(wcstoull))
+libc_hidden_def(__XL_NPP(wcstoull))
#if !defined(L_wcstoull_l)
#if (ULLONG_MAX == UINTMAX_MAX)
diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c
index 3a5adcd4e..cdb50fb75 100644
--- a/libc/stdlib/strtod.c
+++ b/libc/stdlib/strtod.c
@@ -95,9 +95,6 @@
/**********************************************************************/
-#define iswspace __iswspace
-#define iswspace_l __iswspace_l
-
#define _ISOC99_SOURCE 1
#define _GNU_SOURCE
#include <stdlib.h>
@@ -122,8 +119,6 @@
#include <xlocale.h>
#endif /* __UCLIBC_HAS_XLOCALE__ */
-
-
/* Handle _STRTOD_HEXADECIMAL_FLOATS via uClibc config now. */
#undef _STRTOD_HEXADECIMAL_FLOATS
#ifdef __UCLIBC_HAS_HEXADECIMAL_FLOATS__
@@ -213,6 +208,8 @@ __fpmax_t attribute_hidden __strtofpmax(const Wchar *str, Wchar **endptr, int ex
#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+libc_hidden_proto(memcmp)
+
__fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_power
__LOCALE_PARAM )
{
@@ -317,7 +314,7 @@ __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endp
goto LOOP;
}
#else
- if (!pos0 && !__memcmp(pos, decpt, decpt_len)) { /* First decimal point? */
+ if (!pos0 && !memcmp(pos, decpt, decpt_len)) { /* First decimal point? */
pos0 = (pos += decpt_len);
goto LOOP;
}
@@ -513,8 +510,6 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x)
#if defined(L_wcstof) || defined(L_wcstof_l)
#define strtof wcstof
#define strtof_l wcstof_l
-#define __strtof __wcstof
-#define __strtof_l __wcstof_l
#define __strtofpmax __wcstofpmax
#define __strtofpmax_l __wcstofpmax_l
#define Wchar wchar_t
@@ -523,7 +518,7 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x)
#endif
-float attribute_hidden __UCXL(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM )
+float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM )
{
#if FPMAX_TYPE == 1
return __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG );
@@ -539,8 +534,8 @@ float attribute_hidden __UCXL(strtof)(const Wchar *str, Wchar **endptr __LOCAL
return y;
#endif
}
-
-__UCXL_ALIAS(strtof)
+libc_hidden_proto(__XL_NPP(strtof))
+libc_hidden_def(__XL_NPP(strtof))
#endif
#endif
@@ -551,8 +546,6 @@ __UCXL_ALIAS(strtof)
#if defined(L_wcstod) || defined(L_wcstod_l)
#define strtod wcstod
#define strtod_l wcstod_l
-#define __strtod __wcstod
-#define __strtod_l __wcstod_l
#define __strtofpmax __wcstofpmax
#define __strtofpmax_l __wcstofpmax_l
#define Wchar wchar_t
@@ -560,7 +553,7 @@ __UCXL_ALIAS(strtof)
#define Wchar char
#endif
-double attribute_hidden __UCXL(strtod)(const Wchar *__restrict str,
+double __XL_NPP(strtod)(const Wchar *__restrict str,
Wchar **__restrict endptr __LOCALE_PARAM )
{
#if FPMAX_TYPE == 2
@@ -577,8 +570,8 @@ double attribute_hidden __UCXL(strtod)(const Wchar *__restrict str,
return y;
#endif
}
-
-__UCXL_ALIAS(strtod)
+libc_hidden_proto(__XL_NPP(strtod))
+libc_hidden_def(__XL_NPP(strtod))
#endif
#endif
@@ -589,8 +582,6 @@ __UCXL_ALIAS(strtod)
#if defined(L_wcstold) || defined(L_wcstold_l)
#define strtold wcstold
#define strtold_l wcstold_l
-#define __strtold __wcstold
-#define __strtold_l __wcstold_l
#define __strtofpmax __wcstofpmax
#define __strtofpmax_l __wcstofpmax_l
#define Wchar wchar_t
@@ -598,7 +589,7 @@ __UCXL_ALIAS(strtod)
#define Wchar char
#endif
-long double attribute_hidden __UCXL(strtold)(const Wchar *str, Wchar **endptr __LOCALE_PARAM )
+long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM )
{
#if FPMAX_TYPE == 3
return __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG );
@@ -614,8 +605,8 @@ long double attribute_hidden __UCXL(strtold)(const Wchar *str, Wchar **endptr
return y;
#endif
}
-
-__UCXL_ALIAS(strtold)
+libc_hidden_proto(__XL_NPP(strtold))
+libc_hidden_def(__XL_NPP(strtold))
#endif
#endif
diff --git a/libc/stdlib/strtof.c b/libc/stdlib/strtof.c
index d25a67d05..15863053e 100644
--- a/libc/stdlib/strtof.c
+++ b/libc/stdlib/strtof.c
@@ -23,10 +23,10 @@
* to an internal conversion from a double to a float, thereby wasting a bunch
* of precision. But this is small, and works for now... */
-#define strtod __strtod
-
#include <stdlib.h>
+libc_hidden_proto(strtod)
+
float strtof (const char *str, char **endptr)
{
return(strtod(str,endptr));
diff --git a/libc/stdlib/strtold.c b/libc/stdlib/strtold.c
index 3ef1fc491..ac6cc7e9b 100644
--- a/libc/stdlib/strtold.c
+++ b/libc/stdlib/strtold.c
@@ -23,10 +23,10 @@
* to an internal conversion from a double to a long double, thereby losing
* tons of precision. But this is small, and works for now... */
-#define strtod __strtod
-
#include <stdlib.h>
+libc_hidden_proto(strtod)
+
long double strtold (const char *str, char **endptr)
{
return(strtod(str,endptr));
diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c
index a537156fd..e25831e0b 100644
--- a/libc/stdlib/system.c
+++ b/libc/stdlib/system.c
@@ -1,8 +1,8 @@
-#define wait4 __wait4
-#define execl __execl
-#define signal __signal
-#define vfork __vfork
-#define fork __fork
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <stdio.h>
#include <stddef.h>
@@ -10,6 +10,13 @@
#include <unistd.h>
#include <sys/wait.h>
+libc_hidden_proto(_exit)
+libc_hidden_proto(wait4)
+libc_hidden_proto(execl)
+libc_hidden_proto(signal)
+libc_hidden_proto(vfork)
+libc_hidden_proto(fork)
+
/* uClinux-2.0 has vfork, but Linux 2.0 doesn't */
#include <sys/syscall.h>
#if ! defined __NR_vfork
@@ -40,7 +47,7 @@ int __libc_system(char *command)
signal(SIGCHLD, SIG_DFL);
execl("/bin/sh", "sh", "-c", command, (char *) 0);
- _exit_internal(127);
+ _exit(127);
}
/* Signals are not absolutly guarenteed with vfork */
signal(SIGQUIT, SIG_IGN);
@@ -58,4 +65,4 @@ int __libc_system(char *command)
signal(SIGCHLD, save_chld);
return wait_val;
}
-weak_alias(__libc_system, system)
+strong_alias(__libc_system,system)
diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c
index 0e7d50a99..f88a54bc0 100644
--- a/libc/stdlib/unix_grantpt.c
+++ b/libc/stdlib/unix_grantpt.c
@@ -17,16 +17,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define memchr __memchr
-#define getgid __getgid
-#define getuid __getuid
-#define setrlimit __setrlimit
-#define waitpid __waitpid
-#define dup2 __dup2
-#define chmod __chmod
-#define vfork __vfork
-#define fork __fork
-
#include <assert.h>
#include <errno.h>
#include <grp.h>
@@ -40,6 +30,20 @@
#include <unistd.h>
#include "pty-private.h"
+libc_hidden_proto(memchr)
+libc_hidden_proto(getgid)
+libc_hidden_proto(getuid)
+libc_hidden_proto(setrlimit)
+libc_hidden_proto(waitpid)
+libc_hidden_proto(dup2)
+libc_hidden_proto(chmod)
+libc_hidden_proto(chown)
+libc_hidden_proto(vfork)
+libc_hidden_proto(fork)
+libc_hidden_proto(stat)
+libc_hidden_proto(ptsname_r)
+libc_hidden_proto(execle)
+libc_hidden_proto(_exit)
/* uClinux-2.0 has vfork, but Linux 2.0 doesn't */
#include <sys/syscall.h>
@@ -47,8 +51,6 @@
#define vfork fork
#endif
-extern int __ptsname_r (int fd, char *buf, size_t buflen) attribute_hidden;
-
/* Return the result of ptsname_r in the buffer pointed to by PTS,
which should be of length BUF_LEN. If it is too long to fit in
this buffer, a sufficiently long buffer is allocated using malloc,
@@ -65,7 +67,7 @@ pts_name (int fd, char **pts, size_t buf_len)
if (buf_len)
{
- rv = __ptsname_r (fd, buf, buf_len);
+ rv = ptsname_r (fd, buf, buf_len);
if (rv != 0 || memchr (buf, '\0', buf_len))
/* We either got an error, or we succeeded and the
@@ -122,7 +124,7 @@ grantpt (int fd)
if (pts_name (fd, &buf, sizeof (_buf)))
return -1;
- if (__stat(buf, &st) < 0)
+ if (stat(buf, &st) < 0)
goto cleanup;
/* Make sure that we own the device. */
@@ -168,10 +170,10 @@ grantpt (int fd)
/* We pase the master pseudo terminal as file descriptor PTY_FILENO. */
if (fd != PTY_FILENO)
if (dup2 (fd, PTY_FILENO) < 0)
- _exit_internal (FAIL_EBADF);
+ _exit (FAIL_EBADF);
execle (_PATH_PT_CHOWN, _PATH_PT_CHOWN, NULL, NULL);
- _exit_internal (FAIL_EXEC);
+ _exit (FAIL_EXEC);
}
else
{
diff --git a/libc/stdlib/unlockpt.c b/libc/stdlib/unlockpt.c
index 3f99c1c0b..8c426553c 100644
--- a/libc/stdlib/unlockpt.c
+++ b/libc/stdlib/unlockpt.c
@@ -22,6 +22,7 @@
#include <sys/ioctl.h>
#include <termios.h>
+libc_hidden_proto(ioctl)
/* Unlock the slave pseudo terminal associated with the master pseudo
terminal specified by FD. */
@@ -32,7 +33,7 @@ unlockpt (int fd)
int save_errno = errno;
int unlock = 0;
- if (__ioctl (fd, TIOCSPTLCK, &unlock))
+ if (ioctl (fd, TIOCSPTLCK, &unlock))
{
if (errno == EINVAL)
{
diff --git a/libc/stdlib/valloc.c b/libc/stdlib/valloc.c
index d4f21d121..13dbe0f67 100644
--- a/libc/stdlib/valloc.c
+++ b/libc/stdlib/valloc.c
@@ -20,12 +20,12 @@ Cambridge, MA 02139, USA.
The author may be reached (Email) at the address mike@@ai.mit.edu,
or (US mail) as Mike Haertel c/o Free Software Foundation. */
-#define getpagesize __getpagesize_internal
-
#include <stdlib.h>
#include <unistd.h>
#include <malloc.h>
+libc_hidden_proto(getpagesize)
+
static size_t pagesize;
__ptr_t valloc (size_t size)