Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mruby/mruby
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 12, 2014
2 parents 18ee842 + fcd6e4a commit 63eddaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/state.c
Expand Up @@ -134,9 +134,7 @@ mrb_irep_free(mrb_state *mrb, mrb_irep *irep)
mrb_free(mrb, irep->iseq);
for (i=0; i<irep->plen; i++) {
if (mrb_type(irep->pool[i]) == MRB_TT_STRING) {
if ((mrb_str_ptr(irep->pool[i])->flags & (MRB_STR_NOFREE|MRB_STR_EMBED)) == 0) {
mrb_free(mrb, RSTRING_PTR(irep->pool[i]));
}
mrb_gc_free_str(mrb, RSTRING(irep->pool[i]));
mrb_free(mrb, mrb_obj_ptr(irep->pool[i]));
}
#ifdef MRB_WORD_BOXING
Expand Down
5 changes: 3 additions & 2 deletions src/string.c
Expand Up @@ -796,10 +796,11 @@ mrb_str_index(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int offset)
mrb_value
mrb_str_dup(mrb_state *mrb, mrb_value str)
{
/* should return shared string */
struct RString *s = mrb_str_ptr(str);
struct RString *dup = str_new(mrb, 0, 0);

return mrb_str_new(mrb, STR_PTR(s), STR_LEN(s));
str_with_class(mrb, dup, str);
return str_replace(mrb, dup, s);
}

static mrb_value
Expand Down

0 comments on commit 63eddaa

Please sign in to comment.