| 20 | /* Bump */ |
| 21 | |
| 22 | static void *bump_acquire(struct hc_malloc *a, size_t size) { |
| 23 | if (size <= 0) { |
| 24 | hc_throw(HC_INVALID_SIZE); |
| 25 | } |
| 26 | |
| 27 | struct hc_bump_alloc *ba = hc_baseof(a, struct hc_bump_alloc, malloc); |
| 28 | |
| 29 | if (ba->size - ba->offset < size) { |
| 30 | hc_throw(HC_NO_MEMORY); |
| 31 | } |
| 32 | |
| 33 | uint8_t *p = ba->memory + ba->offset; |
| 34 | uint8_t *pa = hc_align(p, size); |
| 35 | ba->offset = ba->offset + pa - p + size; |
| 36 | return pa; |
| 37 | } |
| 38 | |
| 39 | static void bump_release(struct hc_malloc *a, void *p) { |
| 40 | //Do nothing |
nothing calls this directly
no outgoing calls
no test coverage detected