static __inline int allocator_alloc(allocator* me, const char* loc, int size, int al, void** ppbuf) { if(size < 0) { return -1; } else if (size == 0) { *ppbuf = 0; return 0; } if((_ALIGN_SIZE(me->stackEnd, al) + size) < me->stack + me->nSize) { *ppbuf = _ALIGN_SIZE(me->stackEnd, al); me->stackEnd = _ALIGN_SIZE(me->stackEnd, al) + size; return 0; } else { return _heap_alloc(&me->pheap, loc, size, ppbuf); } }
_ATTRIBUTE_UNUSED static __inline int _allocator_alloc(_allocator* me, const char* loc, int size, unsigned int al, void** ppbuf) { if(size < 0) { return -1; } else if (size == 0) { *ppbuf = 0; return 0; } if((_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size) < (uintptr_t)me->stack + me->nSize) { *ppbuf = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al); me->stackEnd = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size; return 0; } else { return _heap_alloc(&me->pheap, loc, size, ppbuf); } }