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

ruby-changes:12764

From: nobu <ko1@a...>
Date: Mon, 10 Aug 2009 07:02:47 +0900 (JST)
Subject: [ruby-changes:12764] Ruby:r24489 (trunk): * marshal.c (must_not_be_anonymous): fixed silly miss.

nobu	2009-08-10 07:02:31 +0900 (Mon, 10 Aug 2009)

  New Revision: 24489

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

  Log:
    * marshal.c (must_not_be_anonymous): fixed silly miss.

  Modified files:
    trunk/marshal.c

Index: marshal.c
===================================================================
--- marshal.c	(revision 24488)
+++ marshal.c	(revision 24489)
@@ -168,7 +168,7 @@
     rb_mark_hash(p->compat_tbl);
 }
 
-static void
+static const char *
 must_not_be_anonymous(const char *type, VALUE path)
 {
     char *n = RSTRING_PTR(path);
@@ -178,17 +178,19 @@
 	rb_raise(rb_eTypeError, "can't dump non-ascii %s name", type);
     }
     if (n[0] == '#') {
-	rb_raise(rb_eTypeError, "can't dump anonymous %s %s", type,
+	rb_raise(rb_eTypeError, "can't dump anonymous %s %.*s", type,
 		 (int)RSTRING_LEN(path), n);
     }
+    return n;
 }
 
 static VALUE
 class2path(VALUE klass)
 {
     VALUE path = rb_class_path(klass);
+    const char *n;
 
-    must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
+    n = must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
     if (rb_path_to_class(path) != rb_class_real(klass)) {
 	rb_raise(rb_eTypeError, "%s can't be referred to", n);
     }

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

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