diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-07-08 19:40:17 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-07-08 19:40:17 -0700 |
| commit | 8cef93d228ec5d2cb57b84cf0ae3945363080546 (patch) | |
| tree | 1b9b689e93466c56e0badf7dbe373d7ce96d6867 /src/vm.c | |
| parent | 78614b2391aec299d3be181ec14671d037bf67b1 (diff) | |
| parent | 611cf71a10051d77a7bb8998d8a7c34e26b0b1b0 (diff) | |
| download | mruby-8cef93d228ec5d2cb57b84cf0ae3945363080546.tar.gz mruby-8cef93d228ec5d2cb57b84cf0ae3945363080546.zip | |
Merge pull request #355 from monaka/pr-use-mrb_calloc
Use mrb_calloc if you want zero cleard buffers.
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -28,16 +28,14 @@ static void stack_init(mrb_state *mrb) { /* assert(mrb->stack == NULL); */ - mrb->stbase = mrb_malloc(mrb, sizeof(mrb_value) * STACK_INIT_SIZE); - memset(mrb->stbase, 0, sizeof(mrb_value) * STACK_INIT_SIZE); + mrb->stbase = mrb_calloc(mrb, STACK_INIT_SIZE, sizeof(mrb_value)); mrb->stend = mrb->stbase + STACK_INIT_SIZE; mrb->stack = mrb->stbase; /* assert(mrb->ci == NULL); */ - mrb->cibase = mrb_malloc(mrb, sizeof(mrb_callinfo)*CALLINFO_INIT_SIZE); + mrb->cibase = mrb_calloc(mrb, CALLINFO_INIT_SIZE, sizeof(mrb_callinfo)); mrb->ciend = mrb->cibase + CALLINFO_INIT_SIZE; mrb->ci = mrb->cibase; - memset(mrb->ci, 0, sizeof(mrb_callinfo)); mrb->ci->target_class = mrb->object_class; } |
