Fix: Backend depends on b->cap instead of MEM_BACKEND_MAX_CAP in backend_reserve()
Style: Remove redundant comments in main.c
This commit is contained in:
@@ -24,8 +24,6 @@ int main(void)
|
|||||||
discovery_discover(&d);
|
discovery_discover(&d);
|
||||||
|
|
||||||
Configuration sample_config;
|
Configuration sample_config;
|
||||||
/* Command cmd = command_create(&a_cmd, &d, &sample_config); */
|
|
||||||
/* command_run(&cmd); */
|
|
||||||
|
|
||||||
Arena a_b = arena_create(&b, 1024*1024*5);
|
Arena a_b = arena_create(&b, 1024*1024*5);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void* backend_reserve(Backend* b, size_t cap)
|
|||||||
{
|
{
|
||||||
assert(b != NULL);
|
assert(b != NULL);
|
||||||
void* ptr = b->last;
|
void* ptr = b->last;
|
||||||
if(b->len + cap >= MEM_BACKEND_MAX_CAP)
|
if(b->len + cap >= b->cap)
|
||||||
DIE("Process out of memory, requested %d (current usage %d out of %d).", cap, b->len, b->cap);
|
DIE("Process out of memory, requested %d (current usage %d out of %d).", cap, b->len, b->cap);
|
||||||
b->last = (char*)b->last + (int)cap;
|
b->last = (char*)b->last + (int)cap;
|
||||||
b->len += cap;
|
b->len += cap;
|
||||||
|
|||||||
Reference in New Issue
Block a user