diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 23 |
1 files changed, 9 insertions, 14 deletions
@@ -2505,7 +2505,7 @@ primary : literal NODE *args, *scope, *internal_var = NEW_DVAR(id, &@2); ID *tbl = ALLOC_N(ID, 2); tbl[0] = 1 /* length of local var table */; tbl[1] = id /* internal id */; - add_mark_object(p, (VALUE)rb_imemo_alloc_new(tbl)); + add_mark_object(p, rb_imemo_alloc_auto_free_pointer(tbl)); switch (nd_type($2)) { case NODE_LASGN: @@ -9988,7 +9988,7 @@ new_args_tail(struct parser_params *p, NODE *kw_args, ID kw_rest_arg, ID block, NODE *node; args = ZALLOC(struct rb_args_info); - add_mark_object(p, (VALUE)rb_imemo_alloc_new(args)); + add_mark_object(p, rb_imemo_alloc_auto_free_pointer(args)); node = NEW_NODE(NODE_ARGS, 0, 0, args, &NULL_LOC); if (p->error_p) return node; @@ -10350,7 +10350,7 @@ local_tbl(struct parser_params *p) if (--j < cnt) REALLOC_N(buf, ID, (cnt = j) + 1); buf[0] = cnt; - add_mark_object(p, (VALUE)rb_imemo_alloc_new(buf)); + add_mark_object(p, rb_imemo_alloc_auto_free_pointer(buf)); return buf; } @@ -10975,10 +10975,8 @@ rb_parser_malloc(struct parser_params *p, size_t size) { size_t cnt = HEAPCNT(1, size); void *ptr = xmalloc(size); - rb_imemo_alloc_t *n = rb_imemo_alloc_new(ptr); - n->next = p->heap; - - return ADD2HEAP(n, cnt, ptr); + p->heap = rb_imemo_alloc_parser_heap(ptr, p->heap, cnt); + return p->heap->ptr; } void * @@ -10986,10 +10984,8 @@ rb_parser_calloc(struct parser_params *p, size_t nelem, size_t size) { size_t cnt = HEAPCNT(nelem, size); void *ptr = xcalloc(nelem, size); - rb_imemo_alloc_t *n = rb_imemo_alloc_new(ptr); - n->next = p->heap; - - return ADD2HEAP(n, cnt, ptr); + p->heap = rb_imemo_alloc_parser_heap(ptr, p->heap, cnt); + return p->heap->ptr; } void * @@ -11008,9 +11004,8 @@ rb_parser_realloc(struct parser_params *p, void *ptr, size_t size) } while ((n = n->next) != NULL); } ptr = xrealloc(ptr, size); - n = rb_imemo_alloc_new(ptr); - n->next = p->heap; - return ADD2HEAP(n, cnt, ptr); + p->heap = rb_imemo_alloc_parser_heap(ptr, p->heap, cnt); + return p->heap->ptr; } void |