mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
pool.c (mrb_pool_realloc): add comments in reallocation code
This commit is contained in:
@@ -139,8 +139,12 @@ mrb_pool_realloc(mrb_pool *pool, void *p, size_t oldlen, size_t newlen)
|
||||
if (page->last == p) {
|
||||
/* if p is a last allocation from the page */
|
||||
size_t beg = (char*)p - page->page;
|
||||
/* check beg + oldlen points bottom */
|
||||
/* assert(beg + oldlen == page->offset) */
|
||||
if (beg + oldlen != page->offset) break;
|
||||
if (beg + newlen > page->len) {
|
||||
/* new allocation need more space */
|
||||
/* abandon this space */
|
||||
page->offset = beg;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user