From 9549bf6ab9feddec4959de21d3e1a1f59adb15a5 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 14 Jan 2018 21:39:28 -0600 Subject: malloc: Sort functions by name Signed-off-by: Samuel Holland --- libgcompat/malloc.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'libgcompat') 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 * @@ -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; } -- cgit v1.2.3-70-g09d2