diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-10-28 10:43:31 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-10-28 10:43:31 -0700 |
| commit | 69e2d272457f2f096c2514d8afb90006ed577fc9 (patch) | |
| tree | cda613d41422a763d824ce998b0e6d0cefd4aaa3 /src/gc.c | |
| parent | 559933f577d5073464aa06facc1b754de6225d8a (diff) | |
| parent | 1933e2660c86c0731806993a9a212116bb454622 (diff) | |
| download | mruby-69e2d272457f2f096c2514d8afb90006ed577fc9.tar.gz mruby-69e2d272457f2f096c2514d8afb90006ed577fc9.zip | |
Merge pull request #507 from monaka/pr-not-use-memset-in-structure-initialization
Use substitution instead of memset in structure initializations.
Diffstat (limited to 'src/gc.c')
| -rw-r--r-- | src/gc.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |
