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

ruby-changes:31909

From: nobu <ko1@a...>
Date: Wed, 4 Dec 2013 13:20:20 +0900 (JST)
Subject: [ruby-changes:31909] nobu:r43988 (trunk): string.c: fix declaration-after-statement

nobu	2013-12-04 13:20:15 +0900 (Wed, 04 Dec 2013)

  New Revision: 43988

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

  Log:
    string.c: fix declaration-after-statement
    
    * string.c (fstr_update_callback): move a variable declaration since
      ISO C90 forbids mixed declarations and code.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 43987)
+++ string.c	(revision 43988)
@@ -136,6 +136,8 @@ static int https://github.com/ruby/ruby/blob/trunk/string.c#L136
 fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
 {
     VALUE *fstr = (VALUE *)arg;
+    VALUE str = (VALUE)*key;
+
     if (existing) {
 	/* because of lazy sweep, str may be unmarked already and swept
 	 * at next time */
@@ -143,7 +145,6 @@ fstr_update_callback(st_data_t *key, st_ https://github.com/ruby/ruby/blob/trunk/string.c#L145
 	return ST_STOP;
     }
 
-    VALUE str = *key;
     if (STR_SHARED_P(str)) {
 	/* str should not be shared */
 	str = rb_enc_str_new(RSTRING_PTR(str), RSTRING_LEN(str), STR_ENC_GET(str));

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

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