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

ruby-changes:33680

From: nobu <ko1@a...>
Date: Wed, 30 Apr 2014 21:09:41 +0900 (JST)
Subject: [ruby-changes:33680] nobu:r45761 (trunk): parse.y: use rb_str_ellipsize

nobu	2014-04-30 21:09:35 +0900 (Wed, 30 Apr 2014)

  New Revision: 45761

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

  Log:
    parse.y: use rb_str_ellipsize
    
    * parse.y (next_id): use rb_str_ellipsize to preserve encoding and
      get rid of incomplete multibyte sequence.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 45760)
+++ parse.y	(revision 45761)
@@ -10642,14 +10642,9 @@ next_id(VALUE str) https://github.com/ruby/ruby/blob/trunk/parse.y#L10642
   new_id:
     if (symenc != enc) rb_enc_associate(str, symenc);
     if ((nid = next_id_base()) == (ID)-1) {
-	if (len > 20) {
-	    rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.20s...)",
-		     name);
-	}
-	else {
-	    rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.*s)",
-		     (int)len, name);
-	}
+	str = rb_str_ellipsize(str, 20);
+	rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %"PRIsVALUE")",
+		 str);
     }
     id |= nid;
     id |= ID_STATIC_SYM;

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

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