mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge branch 'master' of github.com:mruby/mruby
This commit is contained in:
@@ -6,7 +6,7 @@ static void
|
||||
printstr(mrb_state *mrb, mrb_value obj)
|
||||
{
|
||||
char *s;
|
||||
int len;
|
||||
mrb_int len;
|
||||
|
||||
if (mrb_string_p(obj)) {
|
||||
s = RSTRING_PTR(obj);
|
||||
|
||||
@@ -713,7 +713,7 @@ retry:
|
||||
str = mrb_obj_as_string(mrb, arg);
|
||||
len = RSTRING_LEN(str);
|
||||
if (RSTRING(result)->flags & MRB_STR_EMBED) {
|
||||
int tmp_n = len;
|
||||
mrb_int tmp_n = len;
|
||||
RSTRING(result)->flags &= ~MRB_STR_EMBED_LEN_MASK;
|
||||
RSTRING(result)->flags |= tmp_n << MRB_STR_EMBED_LEN_SHIFT;
|
||||
} else {
|
||||
|
||||
@@ -506,7 +506,7 @@ mrb_value
|
||||
mrb_struct_init_copy(mrb_state *mrb, mrb_value copy)
|
||||
{
|
||||
mrb_value s;
|
||||
int i, len;
|
||||
mrb_int i, len;
|
||||
|
||||
mrb_get_args(mrb, "o", &s);
|
||||
|
||||
|
||||
+5
-5
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user