Mercurial > hg > Members > innparusu > Gears
diff src/allocate/allocate.c @ 8:714d0ce1efd7
change configuring directory
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 01 Apr 2015 22:56:51 +0900 |
parents | src/allocate.c@ad48a076a8e5 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/allocate/allocate.c Wed Apr 01 22:56:51 2015 +0900 @@ -0,0 +1,17 @@ +#include <stdlib.h> + +#include "allocate.h" + +__code allocate(Context* context, int size, int num, __code (*next)()) { + goto meta_allocate(context, size, num, next); +} + +__code meta_allocate(Context* context, int size, int num, __code (*next)()) { + context->next = next; + void* ds = context->ds; + context->ds += size*num; + ((mdata*)context->mds)->ds = ds; + ((mdata*)context->mds)->size = size; + context->mds = (mdata*)context->mds+1; + goto context->next(context, (data1*)ds, 0); +}