Fix a few function signatures in the guarded heap.

* Not including malloc.h caused the memalign() signature to not be a C
  signature, therefore leading to linking errors. Fix the missing
  include and explicitly add extern "C" as well.
* Some remaining asterisk style cleanup.
This commit is contained in:
Michael Lotz
2011-12-10 17:24:10 +01:00
parent 3de380692a
commit 268ddbd76f
@@ -4,6 +4,7 @@
*/ */
#include <malloc.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -952,7 +953,7 @@ sbrk_hook(long)
} }
void* extern "C" void*
memalign(size_t alignment, size_t size) memalign(size_t alignment, size_t size)
{ {
if (size == 0) if (size == 0)
@@ -962,14 +963,14 @@ memalign(size_t alignment, size_t size)
} }
void* extern "C" void*
malloc(size_t size) malloc(size_t size)
{ {
return memalign(0, size); return memalign(0, size);
} }
void extern "C" void
free(void* address) free(void* address)
{ {
if (!guarded_heap_free(address)) if (!guarded_heap_free(address))
@@ -977,7 +978,7 @@ free(void* address)
} }
void* extern "C" void*
realloc(void* address, size_t newSize) realloc(void* address, size_t newSize)
{ {
if (newSize == 0) { if (newSize == 0) {
@@ -992,7 +993,7 @@ realloc(void* address, size_t newSize)
} }
void * extern "C" void*
calloc(size_t numElements, size_t size) calloc(size_t numElements, size_t size)
{ {
void* address = malloc(numElements * size); void* address = malloc(numElements * size);