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

ruby-changes:28364

From: nobu <ko1@a...>
Date: Tue, 23 Apr 2013 11:58:58 +0900 (JST)
Subject: [ruby-changes:28364] nobu:r40416 (trunk): string.c: suppress warnings

nobu	2013-04-23 11:58:48 +0900 (Tue, 23 Apr 2013)

  New Revision: 40416

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

  Log:
    string.c: suppress warnings
    
    * string.c (rb_str_scrub): suppress maybe-uninitialized and empty body
      in an else-statement.  [ruby-dev:45975] [Feature #6752]

  Modified files:
    trunk/string.c

Index: string.c
===================================================================
--- string.c	(revision 40415)
+++ string.c	(revision 40416)
@@ -7815,6 +7815,8 @@ rb_str_scrub(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/string.c#L7815
 	VALUE buf = rb_str_buf_new(RSTRING_LEN(str));
 	if (rb_block_given_p()) {
 	    rep = NULL;
+	    replen = 0;
+	    rep7bit_p = FALSE;
 	}
 	else if (!NIL_P(repl)) {
 	    rep = RSTRING_PTR(repl);
@@ -7866,8 +7868,8 @@ rb_str_scrub(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/string.c#L7868
 		    for (; clen > 1; clen--) {
 			ret = rb_enc_precise_mbclen(q, q + clen, enc);
 			if (MBCLEN_NEEDMORE_P(ret)) break;
-			else if (MBCLEN_INVALID_P(ret)) continue;
-			else UNREACHABLE;
+			if (MBCLEN_INVALID_P(ret)) continue;
+			UNREACHABLE;
 		    }
 		}
 		if (rep) {
@@ -7978,8 +7980,8 @@ rb_str_scrub(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/string.c#L7980
 		    for (; clen > mbminlen; clen-=mbminlen) {
 			ret = rb_enc_precise_mbclen(q, q + clen, enc);
 			if (MBCLEN_NEEDMORE_P(ret)) break;
-			else if (MBCLEN_INVALID_P(ret)) continue;
-			else UNREACHABLE;
+			if (MBCLEN_INVALID_P(ret)) continue;
+			UNREACHABLE;
 		    }
 		}
 		if (rep) {

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

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