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

ruby-changes:34642

From: nobu <ko1@a...>
Date: Mon, 7 Jul 2014 00:23:50 +0900 (JST)
Subject: [ruby-changes:34642] nobu:r46725 (trunk): st.c: fix uninitialized variable

nobu	2014-07-07 00:22:19 +0900 (Mon, 07 Jul 2014)

  New Revision: 46725

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

  Log:
    st.c: fix uninitialized variable
    
    * st.c (st_update): old_key is uninitialized by jump to the label
      unpacked.

  Modified files:
    trunk/st.c
Index: st.c
===================================================================
--- st.c	(revision 46724)
+++ st.c	(revision 46725)
@@ -821,7 +821,7 @@ st_update(st_table *table, st_data_t key https://github.com/ruby/ruby/blob/trunk/st.c#L821
 {
     st_index_t hash_val, bin_pos;
     register st_table_entry *ptr, **last, *tmp;
-    st_data_t value = 0;
+    st_data_t value = 0, old_key;
     int retval, existing = 0;
 
     hash_val = do_hash(key, table);
@@ -834,7 +834,7 @@ st_update(st_table *table, st_data_t key https://github.com/ruby/ruby/blob/trunk/st.c#L834
 	    existing = 1;
 	}
 	{
-	    const st_data_t old_key = key;
+	    old_key = key;
 	    retval = (*func)(&key, &value, arg, existing);
 	    if (!table->entries_packed) {
 		FIND_ENTRY(table, ptr, hash_val, bin_pos);
@@ -867,7 +867,7 @@ st_update(st_table *table, st_data_t key https://github.com/ruby/ruby/blob/trunk/st.c#L867
 	existing = 1;
     }
     {
-	const st_data_t old_key = key;
+	old_key = key;
 	retval = (*func)(&key, &value, arg, existing);
       unpacked:
 	switch (retval) {

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

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