summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-26 01:09:17 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-26 01:09:17 +0900
commit79ba1ed1370a3b3fdc70185fca31ff573fc2c533 (patch)
tree3d01f7cc1465d6bf674b3afb330a290c2803d275 /src/string.c
parentbfd2a539edab8ef7935a75de8a6885d74ff9e8ef (diff)
parent2220fb2a91cda5c10cf453d935b7aa27b75a6544 (diff)
downloadmruby-79ba1ed1370a3b3fdc70185fca31ff573fc2c533.tar.gz
mruby-79ba1ed1370a3b3fdc70185fca31ff573fc2c533.zip
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/string.c b/src/string.c
index bd46a684b..266db4989 100644
--- a/src/string.c
+++ b/src/string.c
@@ -129,7 +129,7 @@ mrb_str_modify(mrb_state *mrb, struct RString *s)
return;
}
if (s->flags & MRB_STR_NOFREE) {
- char *p = STR_PTR(s);
+ char *p = s->as.heap.ptr;
s->as.heap.ptr = (char *)mrb_malloc(mrb, (size_t)s->as.heap.len+1);
if (p) {
@@ -382,16 +382,16 @@ str_make_shared(mrb_state *mrb, struct RString *s)
}
else if (s->flags & MRB_STR_NOFREE) {
shared->nofree = TRUE;
- shared->ptr = STR_PTR(s);
+ shared->ptr = s->as.heap.ptr;
s->flags &= ~MRB_STR_NOFREE;
}
else {
shared->nofree = FALSE;
if (s->as.heap.aux.capa > s->as.heap.len) {
- s->as.heap.ptr = shared->ptr = (char *)mrb_realloc(mrb, STR_PTR(s), s->as.heap.len+1);
+ s->as.heap.ptr = shared->ptr = (char *)mrb_realloc(mrb, s->as.heap.ptr, s->as.heap.len+1);
}
else {
- shared->ptr = STR_PTR(s);
+ shared->ptr = s->as.heap.ptr;
}
}
shared->len = s->as.heap.len;
@@ -1441,7 +1441,7 @@ str_replace(mrb_state *mrb, struct RString *s1, struct RString *s2)
else {
if (len <= RSTRING_EMBED_LEN_MAX) {
STR_SET_EMBED_FLAG(s1);
- memcpy(STR_PTR(s1), STR_PTR(s2), len);
+ memcpy(s1->as.ary, STR_PTR(s2), len);
STR_SET_EMBED_LEN(s1, len);
}
else {