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

ruby-changes:31368

From: nobu <ko1@a...>
Date: Mon, 28 Oct 2013 13:17:26 +0900 (JST)
Subject: [ruby-changes:31368] nobu:r43447 (trunk): error.c: remove NameError#to_s

nobu	2013-10-28 13:17:20 +0900 (Mon, 28 Oct 2013)

  New Revision: 43447

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

  Log:
    error.c: remove NameError#to_s
    
    * error.c (name_err_to_s): remove no longer needed overriding, since
      r30455 which made exc_to_s almost same.  Fixes [GH-413].

  Modified files:
    trunk/ChangeLog
    trunk/error.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43446)
+++ ChangeLog	(revision 43447)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Oct 28 13:17:17 2013  Or Cohen  <orc@f...>
+
+	* error.c (name_err_to_s): remove no longer needed overriding, since
+	  r30455 which made exc_to_s almost same.  Fixes [GH-413].
+
 Mon Oct 28 12:42:11 2013  Tanaka Akira  <akr@f...>
 
 	* common.mk, ext/objspace/depend, ext/coverage/depend,
Index: error.c
===================================================================
--- error.c	(revision 43446)
+++ error.c	(revision 43447)
@@ -641,11 +641,9 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/error.c#L641
 exc_to_s(VALUE exc)
 {
     VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
-    VALUE r = Qnil;
 
     if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
-    r = rb_String(mesg);
-    return r;
+    return rb_String(mesg);
 }
 
 /*
@@ -993,24 +991,6 @@ name_err_name(VALUE self) https://github.com/ruby/ruby/blob/trunk/error.c#L991
 
 /*
  * call-seq:
- *  name_error.to_s   -> string
- *
- * Produce a nicely-formatted string representing the +NameError+.
- */
-
-static VALUE
-name_err_to_s(VALUE exc)
-{
-    VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
-    VALUE str = mesg;
-
-    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
-    StringValue(str);
-    return str;
-}
-
-/*
- * call-seq:
  *   NoMethodError.new(msg, name [, args])  -> no_method_error
  *
  * Construct a NoMethodError exception for a method of the given name
@@ -1790,7 +1770,6 @@ Init_Exception(void) https://github.com/ruby/ruby/blob/trunk/error.c#L1770
     rb_eNameError     = rb_define_class("NameError", rb_eStandardError);
     rb_define_method(rb_eNameError, "initialize", name_err_initialize, -1);
     rb_define_method(rb_eNameError, "name", name_err_name, 0);
-    rb_define_method(rb_eNameError, "to_s", name_err_to_s, 0);
     rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cData);
     rb_define_singleton_method(rb_cNameErrorMesg, "!", rb_name_err_mesg_new, NAME_ERR_MESG_COUNT);
     rb_define_method(rb_cNameErrorMesg, "==", name_err_mesg_equal, 1);

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

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