#include <Core/Memory/Allocator.h>

namespace Juliet
{
    // Uninitialized allocation
    void* Malloc(size_t total_size)
    {
        // Cant allocate 0
        if (!total_size)
        {
            total_size = 1;
        }

        void* retMemory = malloc(total_size);
        Assert(retMemory && "Out of memory");

        return retMemory;
    }

    // Initialized to 0 allocation
    void* Calloc(size_t nb_elem, size_t elem_size)
    {
        // cant allocate 0
        if (!nb_elem || !elem_size)
        {
            nb_elem   = 1;
            elem_size = 1;
        }

        void* retMemory = calloc(nb_elem, elem_size);
        Assert(retMemory && "Out of memory");

        return retMemory;
    }
\
    void* Realloc(void* memory, size_t newSize)
    {
        if (!newSize)
        {
            newSize = 1;
        }

        void* retMemory = realloc(memory, newSize);
        Assert(retMemory && "Out of memory");

        return retMemory;
    }
} // namespace Juliet
