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

ruby-changes:29088

From: akr <ko1@a...>
Date: Fri, 7 Jun 2013 18:25:58 +0900 (JST)
Subject: [ruby-changes:29088] akr:r41140 (trunk): * bignum.oc (rb_absint_size): Declare a variable, i, just before used

akr	2013-06-07 18:25:47 +0900 (Fri, 07 Jun 2013)

  New Revision: 41140

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

  Log:
    * bignum.oc (rb_absint_size): Declare a variable, i, just before used
      to suppress a warning.
      (rb_int_export): Ditto.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41139)
+++ ChangeLog	(revision 41140)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun  7 18:24:39 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.oc (rb_absint_size): Declare a variable, i, just before used
+	  to suppress a warning.
+	  (rb_int_export): Ditto.
+
 Fri Jun  7 17:41:00 2013  Charlie Somerville  <charliesome@r...>
 
 	* bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit
Index: bignum.c
===================================================================
--- bignum.c	(revision 41139)
+++ bignum.c	(revision 41140)
@@ -458,7 +458,7 @@ rb_absint_size(VALUE val, int *number_of https://github.com/ruby/ruby/blob/trunk/bignum.c#L458
     BDIGIT *dp;
     BDIGIT *de;
     BDIGIT fixbuf[(sizeof(long) + SIZEOF_BDIGITS - 1) / SIZEOF_BDIGITS];
-    int i;
+
     int num_leading_zeros;
 
     val = rb_to_int(val);
@@ -471,9 +471,12 @@ rb_absint_size(VALUE val, int *number_of https://github.com/ruby/ruby/blob/trunk/bignum.c#L471
 #if SIZEOF_BDIGITS == SIZEOF_LONG
         fixbuf[0] = v;
 #else
-        for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
-            fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
-            v >>= SIZEOF_BDIGITS * CHAR_BIT;
+        {
+            int i;
+            for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
+                fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
+                v >>= SIZEOF_BDIGITS * CHAR_BIT;
+            }
         }
 #endif
         dp = fixbuf;
@@ -584,7 +587,6 @@ rb_int_export(VALUE val, int *signp, siz https://github.com/ruby/ruby/blob/trunk/bignum.c#L587
     BDIGIT *dp;
     BDIGIT *de;
     BDIGIT fixbuf[(sizeof(long) + SIZEOF_BDIGITS - 1) / SIZEOF_BDIGITS];
-    int i;
     unsigned char *buf, *bufend;
 
     val = rb_to_int(val);
@@ -622,9 +624,12 @@ rb_int_export(VALUE val, int *signp, siz https://github.com/ruby/ruby/blob/trunk/bignum.c#L624
 #if SIZEOF_BDIGITS == SIZEOF_LONG
         fixbuf[0] = v;
 #else
-        for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
-            fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
-            v >>= SIZEOF_BDIGITS * CHAR_BIT;
+        {
+            int i;
+            for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
+                fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
+                v >>= SIZEOF_BDIGITS * CHAR_BIT;
+            }
         }
 #endif
         dp = fixbuf;

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

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