From 02b1a85385e7fd18b8bcecfdbbf1acbac703c039 Mon Sep 17 00:00:00 2001 From: Luke Gruber Date: Mon, 10 Jun 2019 16:46:57 -0400 Subject: [PATCH] remove 2 redundant calls to rb_str_dup Because `rb_class_path` calls `rb_str_dup` already. Closes: https://github.com/ruby/ruby/pull/2232 --- error.c | 2 +- object.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/error.c b/error.c index 19265f65cb..ffe34afc11 100644 --- a/error.c +++ b/error.c @@ -1098,7 +1098,7 @@ exc_inspect(VALUE exc) klass = CLASS_OF(exc); exc = rb_obj_as_string(exc); if (RSTRING_LEN(exc) == 0) { - return rb_str_dup(rb_class_name(klass)); + return rb_class_name(klass); } str = rb_str_buf_new2("#<"); diff --git a/object.c b/object.c index 00a70898f3..17964bb5c8 100644 --- a/object.c +++ b/object.c @@ -1800,7 +1800,7 @@ rb_mod_to_s(VALUE klass) rb_str_cat2(s, ">"); return s; } - return rb_str_dup(rb_class_name(klass)); + return rb_class_name(klass); } /*