[前][次][番号順一覧][スレッド一覧]

ruby-changes:33525

From: nobu <ko1@a...>
Date: Thu, 17 Apr 2014 11:41:43 +0900 (JST)
Subject: [ruby-changes:33525] nobu:r45606 (trunk): string.c: reduce duplicated code

nobu	2014-04-17 11:41:34 +0900 (Thu, 17 Apr 2014)

  New Revision: 45606

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45606

  Log:
    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.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 45605)
+++ string.c	(revision 45606)
@@ -2066,17 +2066,13 @@ rb_str_buf_cat2(VALUE str, const char *p https://github.com/ruby/ruby/blob/trunk/string.c#L2066
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]