diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-09-15 12:44:31 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-09-15 13:02:15 +0900 |
| commit | 8619ba6a3850145981c0ee6e86e12a7e25946705 (patch) | |
| tree | 1a953bfcf0facdfee0468e33302daeabaa5f0b64 /src | |
| parent | e5e7bd29efd49c4c207da2985610c9ad878d40b0 (diff) | |
| download | mruby-8619ba6a3850145981c0ee6e86e12a7e25946705.tar.gz mruby-8619ba6a3850145981c0ee6e86e12a7e25946705.zip | |
Use `struct` initializer instead of `memset`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/class.c | 4 | ||||
| -rw-r--r-- | src/vm.c | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/class.c b/src/class.c index b683deda0..402a70f6a 100644 --- a/src/class.c +++ b/src/class.c @@ -1698,7 +1698,9 @@ mrb_define_module_function(mrb_state *mrb, struct RClass *c, const char *name, m static void mc_clear(mrb_state *mrb) { - memset(mrb->cache, 0, MRB_METHOD_CACHE_SIZE*sizeof(mrb->cache[0])); + for (int i=0; i<MRB_METHOD_CACHE_SIZE; i++) { + mrb->cache[i] = (struct mrb_cache_entry){0}; + } } void @@ -86,14 +86,10 @@ void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value static inline void stack_clear(mrb_value *from, size_t count) { -#ifdef MRB_NAN_BOXING while (count-- > 0) { SET_NIL_VALUE(*from); from++; } -#else - memset(from, 0, sizeof(mrb_value)*count); -#endif } static inline void |
