string.c: reduce duplicated code

* string.c (rb_str_cat, rb_str_cat2): reduce duplicated code, they
  are same as rb_str_buf_cat and rb_str_buf_cat2 respectively now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-17 02:41:34 +00:00
parent 6239e99d2d
commit df66229230

View File

@ -2066,17 +2066,13 @@ rb_str_buf_cat2(VALUE str, const char *ptr)
VALUE
rb_str_cat(VALUE str, const char *ptr, long len)
{
if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
return rb_str_buf_cat(str, ptr, len);
}
VALUE
rb_str_cat2(VALUE str, const char *ptr)
{
return rb_str_cat(str, ptr, strlen(ptr));
return rb_str_buf_cat2(str, ptr);
}
static VALUE