summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/erand48_r.c2
-rw-r--r--libc/stdlib/jrand48_r.c2
-rw-r--r--libc/stdlib/lrand48_r.c2
-rw-r--r--libc/stdlib/malloc-standard/mallinfo.c2
-rw-r--r--libc/stdlib/nrand48_r.c2
-rw-r--r--libc/stdlib/ptsname.c3
-rw-r--r--libc/stdlib/random.c2
-rw-r--r--libc/stdlib/random_r.c8
-rw-r--r--libc/stdlib/seed48_r.c2
-rw-r--r--libc/stdlib/setenv.c4
-rw-r--r--libc/stdlib/srand48_r.c2
-rw-r--r--libc/stdlib/stdlib.c24
-rw-r--r--libc/stdlib/strtod.c6
13 files changed, 31 insertions, 30 deletions
diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c
index fec8b5026..3dd0dfdf0 100644
--- a/libc/stdlib/erand48_r.c
+++ b/libc/stdlib/erand48_r.c
@@ -24,6 +24,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
+libc_hidden_proto(erand48_r)
int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result)
{
union ieee754_double temp;
@@ -45,5 +46,4 @@ int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double
return 0;
}
-libc_hidden_proto(erand48_r)
libc_hidden_def(erand48_r)
diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c
index 02a082e68..912f70c4f 100644
--- a/libc/stdlib/jrand48_r.c
+++ b/libc/stdlib/jrand48_r.c
@@ -22,6 +22,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
+libc_hidden_proto(jrand48_r)
int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
{
/* Compute next state. */
@@ -33,5 +34,4 @@ int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long in
return 0;
}
-libc_hidden_proto(jrand48_r)
libc_hidden_def(jrand48_r)
diff --git a/libc/stdlib/lrand48_r.c b/libc/stdlib/lrand48_r.c
index 46e99c1e6..277fb9ae3 100644
--- a/libc/stdlib/lrand48_r.c
+++ b/libc/stdlib/lrand48_r.c
@@ -21,6 +21,7 @@
libc_hidden_proto(nrand48_r)
+libc_hidden_proto(lrand48_r)
int lrand48_r (struct drand48_data *buffer, long int *result)
{
/* Be generous for the arguments, detect some errors. */
@@ -29,5 +30,4 @@ int lrand48_r (struct drand48_data *buffer, long int *result)
return nrand48_r (buffer->__x, buffer, result);
}
-libc_hidden_proto(lrand48_r)
libc_hidden_def(lrand48_r)
diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c
index 8a09487c2..4f274ed32 100644
--- a/libc/stdlib/malloc-standard/mallinfo.c
+++ b/libc/stdlib/malloc-standard/mallinfo.c
@@ -19,6 +19,7 @@
libc_hidden_proto(fprintf)
/* ------------------------------ mallinfo ------------------------------ */
+libc_hidden_proto(mallinfo)
struct mallinfo mallinfo(void)
{
mstate av;
@@ -79,7 +80,6 @@ struct mallinfo mallinfo(void)
UNLOCK;
return mi;
}
-libc_hidden_proto(mallinfo)
libc_hidden_def(mallinfo)
void malloc_stats(FILE *file)
diff --git a/libc/stdlib/nrand48_r.c b/libc/stdlib/nrand48_r.c
index 6f8afdb77..f45cb1132 100644
--- a/libc/stdlib/nrand48_r.c
+++ b/libc/stdlib/nrand48_r.c
@@ -22,6 +22,7 @@
extern int __drand48_iterate(unsigned short xsubi[3],
struct drand48_data *buffer) attribute_hidden;
+libc_hidden_proto(nrand48_r)
int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result)
{
/* Compute next state. */
@@ -36,5 +37,4 @@ int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long in
return 0;
}
-libc_hidden_proto(nrand48_r)
libc_hidden_def(nrand48_r)
diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c
index 8580143b9..5184c8f82 100644
--- a/libc/stdlib/ptsname.c
+++ b/libc/stdlib/ptsname.c
@@ -18,6 +18,7 @@
02111-1307 USA. */
#define _ISOC99_SOURCE
+#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <paths.h>
@@ -69,6 +70,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. */
+libc_hidden_proto(ptsname_r)
int ptsname_r (int fd, char *buf, size_t buflen)
{
int save_errno = errno;
@@ -186,7 +188,6 @@ int ptsname_r (int fd, char *buf, size_t buflen)
errno = save_errno;
return 0;
}
-libc_hidden_proto(ptsname_r)
libc_hidden_def(ptsname_r)
/* Return the pathname of the pseudo terminal slave assoicated with
diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c
index 115ff2162..38c3ea4d2 100644
--- a/libc/stdlib/random.c
+++ b/libc/stdlib/random.c
@@ -246,6 +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. */
+libc_hidden_proto(random)
long int random (void)
{
int32_t retval;
@@ -255,5 +256,4 @@ long int random (void)
__pthread_mutex_unlock(&lock);
return retval;
}
-libc_hidden_proto(random)
libc_hidden_def(random)
diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c
index 67234048b..faf5cf42e 100644
--- a/libc/stdlib/random_r.c
+++ b/libc/stdlib/random_r.c
@@ -134,6 +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. */
+libc_hidden_proto(random_r)
int random_r(struct random_data *buf, int32_t *result)
{
int32_t *state;
@@ -181,7 +182,6 @@ fail:
__set_errno (EINVAL);
return -1;
}
-libc_hidden_proto(random_r)
libc_hidden_def(random_r)
/* Initialize the random number generator based on the given seed. If the
@@ -192,6 +192,7 @@ libc_hidden_def(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. */
+libc_hidden_proto(srandom_r)
int srandom_r (unsigned int seed, struct random_data *buf)
{
int type;
@@ -246,7 +247,6 @@ done:
fail:
return -1;
}
-libc_hidden_proto(srandom_r)
libc_hidden_def(srandom_r)
/* Initialize the state information in the given array of N bytes for
@@ -260,6 +260,7 @@ libc_hidden_def(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. */
+libc_hidden_proto(initstate_r)
int initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf)
{
int type;
@@ -308,7 +309,6 @@ fail:
__set_errno (EINVAL);
return -1;
}
-libc_hidden_proto(initstate_r)
libc_hidden_def(initstate_r)
/* Restore the state from the given state array.
@@ -319,6 +319,7 @@ libc_hidden_def(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. */
+libc_hidden_proto(setstate_r)
int setstate_r (char *arg_state, struct random_data *buf)
{
int32_t *new_state = 1 + (int32_t *) arg_state;
@@ -362,5 +363,4 @@ fail:
__set_errno (EINVAL);
return -1;
}
-libc_hidden_proto(setstate_r)
libc_hidden_def(setstate_r)
diff --git a/libc/stdlib/seed48_r.c b/libc/stdlib/seed48_r.c
index a6da03015..c88d0f23e 100644
--- a/libc/stdlib/seed48_r.c
+++ b/libc/stdlib/seed48_r.c
@@ -23,6 +23,7 @@
libc_hidden_proto(memcpy)
+libc_hidden_proto(seed48_r)
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. */
@@ -38,5 +39,4 @@ int seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer)
return 0;
}
-libc_hidden_proto(seed48_r)
libc_hidden_def(seed48_r)
diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c
index 5c19143d1..347718237 100644
--- a/libc/stdlib/setenv.c
+++ b/libc/stdlib/setenv.c
@@ -136,13 +136,14 @@ int attribute_hidden __add_to_environ (const char *name, const char *value,
return 0;
}
+libc_hidden_proto(setenv)
int setenv (const char *name, const char *value, int replace)
{
return __add_to_environ (name, value, NULL, replace);
}
-libc_hidden_proto(setenv)
libc_hidden_def(setenv)
+libc_hidden_proto(unsetenv)
int unsetenv (const char *name)
{
size_t len;
@@ -171,7 +172,6 @@ int unsetenv (const char *name)
UNLOCK;
return 0;
}
-libc_hidden_proto(unsetenv)
libc_hidden_def(unsetenv)
/* The `clearenv' was planned to be added to POSIX.1 but probably
diff --git a/libc/stdlib/srand48_r.c b/libc/stdlib/srand48_r.c
index 5f9cf1da3..45bb75f11 100644
--- a/libc/stdlib/srand48_r.c
+++ b/libc/stdlib/srand48_r.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <limits.h>
+libc_hidden_proto(srand48_r)
int srand48_r (long int seedval, struct drand48_data *buffer)
{
/* The standards say we only have 32 bits. */
@@ -36,5 +37,4 @@ int srand48_r (long int seedval, struct drand48_data *buffer)
return 0;
}
-libc_hidden_proto(srand48_r)
libc_hidden_def(srand48_r)
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index a200d8b4b..5d92d572d 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -263,11 +263,11 @@ strong_alias(llabs,imaxabs)
libc_hidden_proto(strtol)
+libc_hidden_proto(atoi)
int atoi(const char *nptr)
{
return (int) strtol(nptr, (char **) NULL, 10);
}
-libc_hidden_proto(atoi)
libc_hidden_def(atoi)
#endif /* INT_MAX < LONG_MAX */
@@ -278,11 +278,11 @@ libc_hidden_def(atoi)
libc_hidden_proto(strtol)
+libc_hidden_proto(atol)
long atol(const char *nptr)
{
return strtol(nptr, (char **) NULL, 10);
}
-libc_hidden_proto(atol)
libc_hidden_def(atol)
#if UINT_MAX == ULONG_MAX
@@ -314,12 +314,12 @@ long long atoll(const char *nptr)
/**********************************************************************/
#if defined(L_strtol) || defined(L_strtol_l)
+libc_hidden_proto(__XL_NPP(strtol))
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 );
}
-libc_hidden_proto(__XL_NPP(strtol))
libc_hidden_def(__XL_NPP(strtol))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtol_l)
@@ -338,6 +338,7 @@ libc_hidden_def(__XL_NPP(strtoll))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
+libc_hidden_proto(__XL_NPP(strtoll))
long long __XL_NPP(strtoll)(const char * __restrict str,
char ** __restrict endptr, int base
__LOCALE_PARAM )
@@ -345,7 +346,6 @@ long long __XL_NPP(strtoll)(const char * __restrict str,
return (long long) __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 1
__LOCALE_ARG );
}
-libc_hidden_proto(__XL_NPP(strtoll))
libc_hidden_def(__XL_NPP(strtoll))
#if !defined(L_strtoll_l)
@@ -361,13 +361,13 @@ strong_alias(strtoll,strtoq)
/**********************************************************************/
#if defined(L_strtoul) || defined(L_strtoul_l)
+libc_hidden_proto(__XL_NPP(strtoul))
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 );
}
-libc_hidden_proto(__XL_NPP(strtoul))
libc_hidden_def(__XL_NPP(strtoul))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtoul_l)
@@ -387,13 +387,13 @@ libc_hidden_def(__XL_NPP(strtoull))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
+libc_hidden_proto(__XL_NPP(strtoull))
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 );
}
-libc_hidden_proto(__XL_NPP(strtoull))
libc_hidden_def(__XL_NPP(strtoull))
#if !defined(L_strtoull_l)
@@ -776,6 +776,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. */
+libc_hidden_proto(qsort)
void qsort (void *base,
size_t nel,
size_t width,
@@ -821,7 +822,6 @@ void qsort (void *base,
} while (wgap);
}
}
-libc_hidden_proto(qsort)
libc_hidden_def(qsort)
/* ---------- original snippets version below ---------- */
@@ -876,6 +876,7 @@ void ssort (void *base,
/**********************************************************************/
#ifdef L__stdlib_mb_cur_max
+libc_hidden_proto(_stdlib_mb_cur_max)
size_t _stdlib_mb_cur_max(void)
{
#ifdef __CTYPE_HAS_UTF_8_LOCALES
@@ -889,7 +890,6 @@ size_t _stdlib_mb_cur_max(void)
return 1;
#endif
}
-libc_hidden_proto(_stdlib_mb_cur_max)
libc_hidden_def(_stdlib_mb_cur_max)
#endif
@@ -1002,12 +1002,12 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
/**********************************************************************/
#if defined(L_wcstol) || defined(L_wcstol_l)
+libc_hidden_proto(__XL_NPP(wcstol))
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 );
}
-libc_hidden_proto(__XL_NPP(wcstol))
libc_hidden_def(__XL_NPP(wcstol))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l)
@@ -1026,6 +1026,7 @@ libc_hidden_def(__XL_NPP(wcstoll))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
+libc_hidden_proto(__XL_NPP(wcstoll))
long long __XL_NPP(wcstoll)(const wchar_t * __restrict str,
wchar_t ** __restrict endptr, int base
__LOCALE_PARAM )
@@ -1033,7 +1034,6 @@ long long __XL_NPP(wcstoll)(const wchar_t * __restrict str,
return (long long) __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 1
__LOCALE_ARG );
}
-libc_hidden_proto(__XL_NPP(wcstoll))
libc_hidden_def(__XL_NPP(wcstoll))
#if !defined(L_wcstoll_l)
@@ -1049,13 +1049,13 @@ strong_alias(wcstoll,wcstoq)
/**********************************************************************/
#if defined(L_wcstoul) || defined(L_wcstoul_l)
+libc_hidden_proto(__XL_NPP(wcstoul))
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 );
}
-libc_hidden_proto(__XL_NPP(wcstoul))
libc_hidden_def(__XL_NPP(wcstoul))
#if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l)
@@ -1074,13 +1074,13 @@ libc_hidden_def(__XL_NPP(wcstoull))
#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
+libc_hidden_proto(__XL_NPP(wcstoull))
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 );
}
-libc_hidden_proto(__XL_NPP(wcstoull))
libc_hidden_def(__XL_NPP(wcstoull))
#if !defined(L_wcstoull_l)
diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c
index cdb50fb75..2ea56ca04 100644
--- a/libc/stdlib/strtod.c
+++ b/libc/stdlib/strtod.c
@@ -518,6 +518,7 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x)
#endif
+libc_hidden_proto(__XL_NPP(strtof))
float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM )
{
#if FPMAX_TYPE == 1
@@ -534,7 +535,6 @@ float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM )
return y;
#endif
}
-libc_hidden_proto(__XL_NPP(strtof))
libc_hidden_def(__XL_NPP(strtof))
#endif
@@ -553,6 +553,7 @@ libc_hidden_def(__XL_NPP(strtof))
#define Wchar char
#endif
+libc_hidden_proto(__XL_NPP(strtod))
double __XL_NPP(strtod)(const Wchar *__restrict str,
Wchar **__restrict endptr __LOCALE_PARAM )
{
@@ -570,7 +571,6 @@ double __XL_NPP(strtod)(const Wchar *__restrict str,
return y;
#endif
}
-libc_hidden_proto(__XL_NPP(strtod))
libc_hidden_def(__XL_NPP(strtod))
#endif
@@ -589,6 +589,7 @@ libc_hidden_def(__XL_NPP(strtod))
#define Wchar char
#endif
+libc_hidden_proto(__XL_NPP(strtold))
long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM )
{
#if FPMAX_TYPE == 3
@@ -605,7 +606,6 @@ long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM
return y;
#endif
}
-libc_hidden_proto(__XL_NPP(strtold))
libc_hidden_def(__XL_NPP(strtold))
#endif