comparison src/include/allocate.h @ 13:a765eb7f3b7c

implement delete, traverse
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 07 Apr 2015 15:39:14 +0900
parents
children 907c69e21e56
comparison
equal deleted inserted replaced
12:81411d8f9a77 13:a765eb7f3b7c
1 __code allocate();
2 __code meta_allocate();
3
4 __code allocate(Context* context, int size, int num, __code (*next)()) {
5 goto meta_allocate(context, size, num, next);
6 }
7
8 __code meta_allocate(Context* context, int size, int num, __code (*next)()) {
9 context->next = next;
10 void* ds = context->ds;
11 context->ds += size*num;
12 ((mdata*)context->mds)->ds = ds;
13 ((mdata*)context->mds)->size = size;
14 context->mds = (mdata*)context->mds+1;
15 goto context->next(context, (data1*)ds);
16 }