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

ruby-changes:71279

From: Nobuyoshi <ko1@a...>
Date: Fri, 25 Feb 2022 20:01:17 +0900 (JST)
Subject: [ruby-changes:71279] 0db5ee5195 (master): [ruby/date] Suppress declaration-after-statement warnings

https://git.ruby-lang.org/ruby.git/commit/?id=0db5ee5195

From 0db5ee519588808bf1942243843551f58e8d3b35 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 25 Feb 2022 17:56:37 +0900
Subject: [ruby/date] Suppress declaration-after-statement warnings

https://github.com/ruby/date/commit/60bd16009d
---
 ext/date/date_core.c | 61 ++++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 50d46e7a0c..c7b4459c89 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -4346,6 +4346,7 @@ get_limit(VALUE opt) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4346
 static void
 check_limit(VALUE str, VALUE opt)
 {
+    size_t slen, limit;
     if (NIL_P(str)) return;
     if (SYMBOL_P(str)) {
 	rb_category_warn(RB_WARN_CATEGORY_DEPRECATED,
@@ -4354,8 +4355,8 @@ check_limit(VALUE str, VALUE opt) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4355
     }
 
     StringValue(str);
-    size_t slen = RSTRING_LEN(str);
-    size_t limit = get_limit(opt);
+    slen = RSTRING_LEN(str);
+    limit = get_limit(opt);
     if (slen > limit) {
 	rb_raise(rb_eArgError,
 		 "string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit);
@@ -4453,11 +4454,11 @@ date_s_parse(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4454
 
     {
         int argc2 = 2;
-	VALUE argv2[3];
+	VALUE argv2[3], hash;
         argv2[0] = str;
         argv2[1] = comp;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__parse(argc2, argv2, klass);
+	hash = date_s__parse(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -4522,10 +4523,10 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4523
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__iso8601(argc2, argv2, klass);
+	hash = date_s__iso8601(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -4581,10 +4582,10 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4582
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__rfc3339(argc2, argv2, klass);
+	hash = date_s__rfc3339(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -4640,10 +4641,10 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4641
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__xmlschema(argc2, argv2, klass);
+	hash = date_s__xmlschema(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -4701,10 +4702,10 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4702
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__rfc2822(argc2, argv2, klass);
+	hash = date_s__rfc2822(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -4760,10 +4761,10 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4761
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__httpdate(argc2, argv2, klass);
+	hash = date_s__httpdate(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -4823,10 +4824,10 @@ date_s_jisx0301(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4824
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         if (!NIL_P(opt)) argv2[argc2++] = opt;
-	VALUE hash = date_s__jisx0301(argc2, argv2, klass);
+	hash = date_s__jisx0301(argc2, argv2, klass);
 	return d_new_by_frags(klass, hash, sg);
     }
 }
@@ -8208,12 +8209,12 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8209
 
     {
         int argc2 = 2;
-        VALUE argv2[3];
+        VALUE argv2[3], hash;
         argv2[0] = str;
         argv2[1] = comp;
         argv2[2] = opt;
         if (!NIL_P(opt)) argc2++;
-	VALUE hash = date_s__parse(argc2, argv2, klass);
+	hash = date_s__parse(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
@@ -8253,11 +8254,11 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8254
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         argv2[1] = opt;
         if (!NIL_P(opt)) argc2--;
-	VALUE hash = date_s__iso8601(argc2, argv2, klass);
+	hash = date_s__iso8601(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
@@ -8293,11 +8294,11 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8294
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         argv2[1] = opt;
         if (!NIL_P(opt)) argc2++;
-	VALUE hash = date_s__rfc3339(argc2, argv2, klass);
+	hash = date_s__rfc3339(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
@@ -8333,11 +8334,11 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8334
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         argv2[1] = opt;
         if (!NIL_P(opt)) argc2++;
-	VALUE hash = date_s__xmlschema(argc2, argv2, klass);
+	hash = date_s__xmlschema(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
@@ -8374,11 +8375,11 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8375
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         argv2[1] = opt;
         if (!NIL_P(opt)) argc2++;
-	VALUE hash = date_s__rfc2822(argc2, argv2, klass);
+	hash = date_s__rfc2822(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
@@ -8414,11 +8415,11 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8415
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         argv2[1] = opt;
         if (!NIL_P(opt)) argc2++;
-	VALUE hash = date_s__httpdate(argc2, argv2, klass);
+	hash = date_s__httpdate(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
@@ -8459,11 +8460,11 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L8460
 
     {
         int argc2 = 1;
-        VALUE argv2[2];
+        VALUE argv2[2], hash;
         argv2[0] = str;
         argv2[1] = opt;
         if (!NIL_P(opt)) argc2++;
-	VALUE hash = date_s__jisx0301(argc2, argv2, klass);
+	hash = date_s__jisx0301(argc2, argv2, klass);
 	return dt_new_by_frags(klass, hash, sg);
     }
 }
-- 
cgit v1.2.1


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

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