diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/string.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/string.c b/src/string.c index 77f81ecc6..a2e8f155d 100644 --- a/src/string.c +++ b/src/string.c @@ -261,14 +261,7 @@ mrb_str_new_cstr(mrb_state *mrb, const char *p) len = 0; } - s = mrb_obj_alloc_string(mrb); - s->ptr = (char *)mrb_malloc(mrb, len+1); - if (p) { - memcpy(s->ptr, p, len); - } - s->ptr[len] = 0; - s->len = (mrb_int)len; - s->aux.capa = (mrb_int)len; + s = str_new(mrb, p, len); return mrb_obj_value(s); } |
