diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-08-20 22:00:54 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-08-20 22:00:54 +0900 |
| commit | 942c076938e86cad1dba8f63a123cfac748b9175 (patch) | |
| tree | 3fbec1e5e92d6c1a5fc3f28d9f649f2a17ea2fdc /src | |
| parent | b836fd05dd084ac9e61c918cf1757b425c4d271b (diff) | |
| parent | 8157672a29e50756b9709022e8f66da73cd92c2b (diff) | |
| download | mruby-942c076938e86cad1dba8f63a123cfac748b9175.tar.gz mruby-942c076938e86cad1dba8f63a123cfac748b9175.zip | |
Merge pull request #4646 from shuujii/use-RBasic-padding-for-embedded-string-on-64-bit-CPU
Use `RBasic` padding for embedded string on 64-bit CPU
Diffstat (limited to 'src')
| -rw-r--r-- | src/gc.c | 2 | ||||
| -rw-r--r-- | src/string.c | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -521,7 +521,7 @@ MRB_API struct RBasic* mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls) { struct RBasic *p; - static const RVALUE RVALUE_zero = { { { MRB_TT_FALSE } } }; + static const RVALUE RVALUE_zero = { { { NULL, NULL, MRB_TT_FALSE } } }; mrb_gc *gc = &mrb->gc; if (cls) { diff --git a/src/string.c b/src/string.c index 72e14ede9..cacf48821 100644 --- a/src/string.c +++ b/src/string.c @@ -54,8 +54,8 @@ str_init_normal(mrb_state *mrb, struct RString *s, const char *p, size_t len) static void str_init_embed(struct RString *s, const char *p, size_t len) { - if (p) memcpy(s->as.ary, p, len); - s->as.ary[len] = '\0'; + if (p) memcpy(RSTR_EMBED_PTR(s), p, len); + RSTR_EMBED_PTR(s)[len] = '\0'; RSTR_SET_TYPE_FLAG(s, EMBED); RSTR_SET_EMBED_LEN(s, len); } @@ -188,7 +188,7 @@ resize_capa(mrb_state *mrb, struct RString *s, size_t capacity) #endif if (RSTR_EMBED_P(s)) { if (!RSTR_EMBEDDABLE_P(capacity)) { - str_init_normal_capa(mrb, s, s->as.ary, RSTR_EMBED_LEN(s), capacity); + str_init_normal_capa(mrb, s, RSTR_EMBED_PTR(s), RSTR_EMBED_LEN(s), capacity); } } else { |
