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

ruby-changes:49778

From: nobu <ko1@a...>
Date: Thu, 18 Jan 2018 10:27:50 +0900 (JST)
Subject: [ruby-changes:49778] nobu:r61896 (trunk): marshal.c: initialize keywords

nobu	2018-01-18 10:27:45 +0900 (Thu, 18 Jan 2018)

  New Revision: 61896

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

  Log:
    marshal.c: initialize keywords
    
    * marshal.c (r_object0): initialize `keywords` and removed
      `keyword_init` flag, to get rid of maybe-uninitialized warning.

  Modified files:
    trunk/marshal.c
Index: marshal.c
===================================================================
--- marshal.c	(revision 61895)
+++ marshal.c	(revision 61896)
@@ -1813,9 +1813,8 @@ r_object0(struct load_arg *arg, int *ivp https://github.com/ruby/ruby/blob/trunk/marshal.c#L1813
 	    v = r_entry0(v, idx, arg);
 	    values = rb_ary_new2(len);
 	    {
-		VALUE keywords;
-		int keyword_init = RTEST(rb_struct_s_keyword_init(klass));
-		if (keyword_init) {
+		VALUE keywords = Qfalse;
+		if (RTEST(rb_struct_s_keyword_init(klass))) {
 		    keywords = rb_hash_new();
 		    rb_ary_push(values, keywords);
 		}
@@ -1829,7 +1828,7 @@ r_object0(struct load_arg *arg, int *ivp https://github.com/ruby/ruby/blob/trunk/marshal.c#L1828
 				 rb_class_name(klass),
 				 slot, n);
 		    }
-		    if (keyword_init) {
+		    if (keywords) {
 			rb_hash_aset(keywords, RARRAY_AREF(mem, i), r_object(arg));
 		    }
 		    else {

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

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