summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc-standard
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc-standard')
-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
5 files changed, 18 insertions, 16 deletions
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);
}
}