Compare commits

..

No commits in common. "79ea8dda648c3c702fc894ab04820df2c2090ce9" and "bba9be1c9c6d50cb38e6565488e4dab2b91fe138" have entirely different histories.

2 changed files with 6 additions and 27 deletions

View file

@ -24,14 +24,10 @@
#define HALLOCY_ALLOCATOR
#include <stddef.h>
#include <stdbool.h>
#include "../Utils/Error.h"
void *hallocy_allocate(size_t size, bool zero_memory);
static inline void *hallocy_malloc(size_t size) { return hallocy_allocate(size, false); }
static inline void *hallocy_calloc(size_t size, size_t count) { return hallocy_allocate(size * count, true); }
void *hallocy_malloc(size_t size);
HallocyError hallocy_free(void *pointer);
#endif

View file

@ -21,7 +21,8 @@
* -----------------------------------------------------------------------------
*/
#include "../../Include/Hallocy/Core/Allocator.h"
#include "../../Include/Hallocy/Core/Memory.h"
#include <stdbool.h>
#if defined(_WIN32)
#include <windows.h>
@ -69,7 +70,7 @@ static BOOL CALLBACK hallocy_initialize_mutex(PINIT_ONCE init_once, PVOID parame
}
#endif
void *hallocy_allocate(size_t size, bool zero_memory) {
void *hallocy_malloc(size_t size) {
if (page_size == 0) {
#if defined(_WIN32)
SYSTEM_INFO system_info;
@ -101,10 +102,6 @@ void *hallocy_allocate(size_t size, bool zero_memory) {
}
memory_pointer->next = NULL;
if (zero_memory) {
hallocy_set_memory(memory_pointer + 1, 0, aligned_size - sizeof(HallocyMemoryHeader));
}
return (void*)(memory_pointer + 1);
}
@ -117,12 +114,7 @@ void *hallocy_allocate(size_t size, bool zero_memory) {
hallocy_heap = GetProcessHeap();
}
if (zero_memory) {
memory_pointer = HeapAlloc(hallocy_heap, HEAP_ZERO_MEMORY, aligned_size);
} else {
memory_pointer = HeapAlloc(hallocy_heap, 0, aligned_size);
}
memory_pointer = HeapAlloc(hallocy_heap, 0, aligned_size);
if (memory_pointer == NULL) {
return NULL;
}
@ -170,10 +162,6 @@ void *hallocy_allocate(size_t size, bool zero_memory) {
#endif
memory_pointer->next = NULL;
if (zero_memory) {
hallocy_set_memory(memory_pointer + 1, 0, aligned_size - sizeof(HallocyMemoryHeader));
}
return (void*)(memory_pointer + 1);
}
@ -186,12 +174,7 @@ void *hallocy_allocate(size_t size, bool zero_memory) {
hallocy_heap = GetProcessHeap();
}
if (zero_memory) {
memory_pointer = HeapAlloc(hallocy_heap, HEAP_ZERO_MEMORY, aligned_size);
} else {
memory_pointer = HeapAlloc(hallocy_heap, 0, aligned_size);
}
memory_pointer = HeapAlloc(hallocy_heap, 0, aligned_size);
if (memory_pointer == NULL) {
return NULL;
}