summaryrefslogtreecommitdiff
path: root/libgcompat
diff options
context:
space:
mode:
Diffstat (limited to 'libgcompat')
-rw-r--r--libgcompat/malloc.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/libgcompat/malloc.c b/libgcompat/malloc.c
index dc9d25e..14fbf66 100644
--- a/libgcompat/malloc.c
+++ b/libgcompat/malloc.c
@@ -1,4 +1,5 @@
-/* struct mallinfo pulled from mallinfo.3:
+/*
+ * struct mallinfo pulled from mallinfo.3:
*
* Copyright (c) 2012 by Michael Kerrisk <mtk.manpages@gmail.com>
*
@@ -42,30 +43,29 @@ struct mallinfo {
int keepcost; /* Top-most, releasable space (bytes) */
};
-struct mallinfo mallinfo(void)
+void *__libc_calloc(size_t nmemb, size_t size)
{
- struct mallinfo my_info;
- memset(&my_info, 0, sizeof(struct mallinfo));
- return my_info;
+ return calloc(nmemb, size);
}
+alias(__libc_calloc, __calloc);
-void *__libc_malloc(size_t size)
+void __libc_free(void *ptr)
{
- return malloc(size);
+ free(ptr);
}
-alias(__libc_malloc, __malloc);
+alias(__libc_free, __free);
-void __libc_free(void *ptr)
+void *__libc_malloc(size_t size)
{
- return free(ptr);
+ return malloc(size);
}
-alias(__libc_free, __free);
+alias(__libc_malloc, __malloc);
-void *__libc_calloc(size_t nmemb, size_t size)
+void *__libc_memalign(size_t align, size_t len)
{
- return calloc(nmemb, size);
+ return memalign(align, len);
}
-alias(__libc_calloc, __calloc);
+alias(__libc_memalign, __memalign);
void *__libc_realloc(void *ptr, size_t size)
{
@@ -73,7 +73,9 @@ void *__libc_realloc(void *ptr, size_t size)
}
alias(__libc_realloc, __realloc);
-void *__libc_memalign(size_t align, size_t len)
+struct mallinfo mallinfo(void)
{
- return memalign(align, len);
+ struct mallinfo info;
+ memset(&info, 0, sizeof(info));
+ return info;
}