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

ruby-changes:46782

From: nobu <ko1@a...>
Date: Fri, 26 May 2017 15:39:53 +0900 (JST)
Subject: [ruby-changes:46782] nobu:r58898 (trunk): sprintf.c: remove redundant condition

nobu	2017-05-26 15:39:49 +0900 (Fri, 26 May 2017)

  New Revision: 58898

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58898

  Log:
    sprintf.c: remove redundant condition
    
    * sprintf.c (rb_str_format): when `t + 1 == end` (or `t < end`),
      `*t == '%'` is always true.  [ruby-core:80153] [Bug #13315]

  Modified files:
    trunk/sprintf.c
Index: sprintf.c
===================================================================
--- sprintf.c	(revision 58897)
+++ sprintf.c	(revision 58898)
@@ -521,8 +521,7 @@ rb_str_format(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/sprintf.c#L521
 
 	for (t = p; t < end && *t != '%'; t++) ;
 	if (t + 1 == end) {
-	    if (*t == '%') rb_raise(rb_eArgError, "incomplete format specifier");
-	    ++t;
+	    rb_raise(rb_eArgError, "incomplete format specifier");
 	}
 	PUSH(p, t - p);
 	if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {

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

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