Commit 4d1a8718 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #513 from monaka/pr-not-use-memset-in-structure-initialization3

Use substitution instead of memset in structure initialization.
parents cfc1269d f3090c30
......@@ -326,6 +326,7 @@ struct RBasic*
mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
{
struct RBasic *p;
static const RVALUE RVALUE_zero = { { { 0 } } };
#ifdef MRB_GC_STRESS
mrb_garbage_collect(mrb);
......@@ -345,7 +346,7 @@ mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
mrb->live++;
gc_protect(mrb, p);
memset(p, 0, sizeof(RVALUE));
*(RVALUE *)p = RVALUE_zero;
p->tt = ttype;
p->c = cls;
paint_partial_white(mrb, p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment