summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/string.c b/string.c
index 487a863912..a9e90f2848 100644
--- a/string.c
+++ b/string.c
@@ -564,7 +564,9 @@ static VALUE rb_str_replace(VALUE, VALUE);
VALUE
rb_str_dup(VALUE str)
{
- return rb_str_new3(str);
+ VALUE dup = str_alloc(rb_obj_class(str));
+ rb_str_replace(dup, str);
+ return dup;
}