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

ruby-changes:23134

From: nobu <ko1@a...>
Date: Sat, 31 Mar 2012 07:44:41 +0900 (JST)
Subject: [ruby-changes:23134] nobu:r35184 (trunk): * hash.c: Qundef cannot be passed from st_foreach_check().

nobu	2012-03-31 07:44:33 +0900 (Sat, 31 Mar 2012)

  New Revision: 35184

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

  Log:
    * hash.c: Qundef cannot be passed from st_foreach_check().

  Modified files:
    trunk/ChangeLog
    trunk/hash.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35183)
+++ ChangeLog	(revision 35184)
@@ -1,5 +1,7 @@
-Sat Mar 31 07:40:51 2012  Nobuyoshi Nakada  <nobu@r...>
+Sat Mar 31 07:44:30 2012  Nobuyoshi Nakada  <nobu@r...>
 
+	* hash.c: Qundef cannot be passed from st_foreach_check().
+
 	* hash.c, marshal.c, object.c, variable.c: fix callback argument types
 	  of iterators.
 
Index: hash.c
===================================================================
--- hash.c	(revision 35183)
+++ hash.c	(revision 35184)
@@ -131,7 +131,7 @@
     arg.tbl = table;
     arg.func = (st_foreach_func *)func;
     arg.arg = a;
-    if (st_foreach_check(table, foreach_safe_i, (st_data_t)&arg, Qundef)) {
+    if (st_foreach_check(table, foreach_safe_i, (st_data_t)&arg, (st_data_t)Qundef)) {
 	rb_raise(rb_eRuntimeError, "hash modified during iteration");
     }
 }
@@ -152,14 +152,13 @@
     st_table *tbl;
 
     tbl = RHASH(arg->hash)->ntbl;
-    if ((VALUE)key == Qundef) return ST_CONTINUE;
     status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
     if (RHASH(arg->hash)->ntbl != tbl) {
 	rb_raise(rb_eRuntimeError, "rehash occurred during iteration");
     }
     switch (status) {
       case ST_DELETE:
-	st_delete_safe(tbl, &key, 0, Qundef);
+	st_delete_safe(tbl, &key, 0, (st_data_t)Qundef);
 	FL_SET(arg->hash, HASH_DELETED);
       case ST_CONTINUE:
 	break;
@@ -176,7 +175,7 @@
 
     if (RHASH(hash)->iter_lev == 0) {
 	if (FL_TEST(hash, HASH_DELETED)) {
-	    st_cleanup_safe(RHASH(hash)->ntbl, Qundef);
+	    st_cleanup_safe(RHASH(hash)->ntbl, (st_data_t)Qundef);
 	    FL_UNSET(hash, HASH_DELETED);
 	}
     }
@@ -438,7 +437,7 @@
 {
     st_table *tbl = (st_table *)arg;
 
-    if (key != Qundef) st_insert(tbl, key, value);
+    if (key != Qundef) st_insert(tbl, (st_data_t)key, (st_data_t)value);
     return ST_CONTINUE;
 }
 
@@ -767,7 +766,7 @@
     if (!RHASH(hash)->ntbl)
         return Qundef;
     if (RHASH(hash)->iter_lev > 0) {
-	if (st_delete_safe(RHASH(hash)->ntbl, &ktmp, &val, Qundef)) {
+	if (st_delete_safe(RHASH(hash)->ntbl, &ktmp, &val, (st_data_t)Qundef)) {
 	    FL_SET(hash, HASH_DELETED);
 	    return (VALUE)val;
 	}
@@ -819,7 +818,6 @@
 {
     struct shift_var *var = (struct shift_var *)arg;
 
-    if (key == Qundef) return ST_CONTINUE;
     if (var->key != Qundef) return ST_STOP;
     var->key = key;
     var->val = value;
@@ -831,7 +829,6 @@
 {
     struct shift_var *var = (struct shift_var *)arg;
 
-    if (key == Qundef) return ST_CONTINUE;
     var->key = key;
     var->val = value;
     return ST_STOP;

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

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