|
@@ -1,5 +1,7 @@
|
|
|
#include "custom_malloc.h"
|
|
|
+#ifdef HAVE_LOCKS
|
|
|
#include "posix_lock.h"
|
|
|
+#endif /* HAVE_LOCKS */
|
|
|
#include "other.h"
|
|
|
#include "sys_alloc.h"
|
|
|
#include "block_header.h"
|
|
@@ -14,7 +16,9 @@ void * custom_malloc(heap_t* heap, size_t size) {
|
|
|
ptr = NULL;
|
|
|
previous_block = NULL;
|
|
|
|
|
|
+#ifdef HAVE_LOCKS
|
|
|
posix_lock(heap);
|
|
|
+#endif /* HAVE_LOCKS */
|
|
|
|
|
|
fixed_list_id = map_size_to_list(heap, size);
|
|
|
|
|
@@ -60,7 +64,9 @@ void * custom_malloc(heap_t* heap, size_t size) {
|
|
|
|
|
|
// End of Stats
|
|
|
|
|
|
+#ifdef HAVE_LOCKS
|
|
|
posix_unlock(heap);
|
|
|
+#endif /* HAVE_LOCKS */
|
|
|
return ptr;
|
|
|
}
|
|
|
previous_block = current_block;
|
|
@@ -88,7 +94,9 @@ void * custom_malloc(heap_t* heap, size_t size) {
|
|
|
state_refresh(heap);
|
|
|
}
|
|
|
|
|
|
+#ifdef HAVE_LOCKS
|
|
|
posix_unlock(heap);
|
|
|
+#endif /* HAVE_LOCKS */
|
|
|
return ptr;
|
|
|
}
|
|
|
|