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