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

ruby-changes:23133

From: nobu <ko1@a...>
Date: Sat, 31 Mar 2012 07:41:04 +0900 (JST)
Subject: [ruby-changes:23133] nobu:r35183 (trunk): * hash.c, marshal.c, object.c, variable.c: fix callback argument types

nobu	2012-03-31 07:40:54 +0900 (Sat, 31 Mar 2012)

  New Revision: 35183

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

  Log:
    * hash.c, marshal.c, object.c, variable.c: fix callback argument types
      of iterators.

  Modified files:
    trunk/ChangeLog
    trunk/hash.c
    trunk/marshal.c
    trunk/object.c
    trunk/variable.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35182)
+++ ChangeLog	(revision 35183)
@@ -1,3 +1,8 @@
+Sat Mar 31 07:40:51 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* hash.c, marshal.c, object.c, variable.c: fix callback argument types
+	  of iterators.
+
 Thu Mar 29 23:50:15 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* st.c (st_update): pass pointer to key to the callback function.
Index: variable.c
===================================================================
--- variable.c	(revision 35182)
+++ variable.c	(revision 35183)
@@ -70,8 +70,11 @@
 }
 
 static int
-fc_i(ID key, rb_const_entry_t *ce, struct fc_result *res)
+fc_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID key = (ID)k;
+    rb_const_entry_t *ce = (rb_const_entry_t *)v;
+    struct fc_result *res = (struct fc_result *)a;
     VALUE value = ce->value;
     if (!rb_is_const_id(key)) return ST_CONTINUE;
 
@@ -455,8 +458,10 @@
 }
 
 static int
-mark_global_entry(ID key, struct global_entry *entry)
+mark_global_entry(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID key = (ID)key;
+    struct global_entry *entry = (struct global_entry *)v;
     struct trace_var *trace;
     struct global_variable *var = entry->var;
 
@@ -746,8 +751,10 @@
 }
 
 static int
-gvar_i(ID key, struct global_entry *entry, VALUE ary)
+gvar_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID key = (ID)k;
+    VALUE ary = (VALUE)a;
     rb_ary_push(ary, ID2SYM(key));
     return ST_CONTINUE;
 }
@@ -916,15 +923,18 @@
 }
 
 static int
-givar_mark_i(ID key, VALUE value)
+givar_mark_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    VALUE value = (VALUE)v;
     rb_gc_mark(value);
     return ST_CONTINUE;
 }
 
 static int
-givar_i(VALUE obj, st_table *tbl)
+givar_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    VALUE obj = (VALUE)k;
+    st_table *tbl = (st_table *)v;
     if (rb_special_const_p(obj)) {
 	st_foreach_safe(tbl, givar_mark_i, 0);
     }
@@ -1241,8 +1251,11 @@
 }
 
 static int
-ivar_i(ID key, VALUE val, VALUE ary)
+ivar_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID key = (ID)k;
+    VALUE ary = (VALUE)a;
+
     if (rb_is_instance_id(key)) {
 	rb_ary_push(ary, ID2SYM(key));
     }
@@ -1855,8 +1868,12 @@
 }
 
 static int
-sv_i(ID key, rb_const_entry_t *ce, st_table *tbl)
+sv_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID key = (ID)k;
+    rb_const_entry_t *ce = (rb_const_entry_t *)v;
+    st_table *tbl = (st_table *)a;
+
     if (rb_is_const_id(key)) {
 	if (!st_lookup(tbl, (st_data_t)key, 0)) {
 	    st_insert(tbl, (st_data_t)key, (st_data_t)ce);
@@ -2301,8 +2318,11 @@
 }
 
 static int
-cv_i(ID key, VALUE value, VALUE ary)
+cv_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID key = (ID)k;
+    VALUE ary = (VALUE)a;
+
     if (rb_is_class_id(key)) {
 	VALUE kval = ID2SYM(key);
 	if (!rb_ary_includes(ary, kval)) {
@@ -2334,7 +2354,7 @@
     VALUE ary = rb_ary_new();
 
     if (RCLASS_IV_TBL(obj)) {
-	st_foreach_safe(RCLASS_IV_TBL(obj), cv_i, ary);
+	st_foreach_safe(RCLASS_IV_TBL(obj), cv_i, (st_data_t)ary);
     }
     return ary;
 }
Index: object.c
===================================================================
--- object.c	(revision 35182)
+++ object.c	(revision 35183)
@@ -400,8 +400,11 @@
 }
 
 static int
-inspect_i(ID id, VALUE value, VALUE str)
+inspect_i(st_data_t k, st_data_t v, st_data_t a)
 {
+    ID id = (ID)k;
+    VALUE value = (VALUE)v;
+    VALUE str = (VALUE)a;
     VALUE str2;
     const char *ivname;
 
Index: hash.c
===================================================================
--- hash.c	(revision 35182)
+++ hash.c	(revision 35183)
@@ -184,9 +184,10 @@
 }
 
 static VALUE
-hash_foreach_call(struct hash_foreach_arg *arg)
+hash_foreach_call(VALUE arg)
 {
-    if (st_foreach_check(RHASH(arg->hash)->ntbl, hash_foreach_iter, (st_data_t)arg, Qundef)) {
+    VALUE hash = ((struct hash_foreach_arg *)arg)->hash;
+    if (st_foreach_check(RHASH(hash)->ntbl, hash_foreach_iter, (st_data_t)arg, (st_data_t)Qundef)) {
 	rb_raise(rb_eRuntimeError, "hash modified during iteration");
     }
     return Qnil;
Index: marshal.c
===================================================================
--- marshal.c	(revision 35182)
+++ marshal.c	(revision 35183)
@@ -506,8 +506,12 @@
 }
 
 static int
-w_obj_each(ID id, VALUE value, struct dump_call_arg *arg)
+w_obj_each(st_data_t key, st_data_t val, st_data_t a)
 {
+    ID id = (ID)key;
+    VALUE value = (VALUE)val;
+    struct dump_call_arg *arg = (struct dump_call_arg *)a;
+
     if (id == rb_id_encoding()) return ST_CONTINUE;
     if (id == rb_intern("E")) return ST_CONTINUE;
     w_symbol(id, arg->arg);

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

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