diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-21 04:57:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-21 04:57:06 +0000 |
commit | 2b1cbac0ed37ec5927b1f7d69855b480b87693f2 (patch) | |
tree | 7c3fe3ec472d45157bed689117372b761498f885 | |
parent | 1be6cc2388e963b99d50d6fe725dceb6a1ba48c8 (diff) |
* hash.c (st_foreach_func, rb_foreach_func): typedefed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | hash.c | 12 |
2 files changed, 11 insertions, 5 deletions
@@ -1,4 +1,6 @@ -Tue Aug 21 13:46:59 2007 Nobuyoshi Nakada <[email protected]> +Tue Aug 21 13:57:04 2007 Nobuyoshi Nakada <[email protected]> + + * hash.c (st_foreach_func, rb_foreach_func): typedefed. * hash.c (rb_hash_clear): use st_clear() unless iterating. @@ -99,9 +99,11 @@ static const struct st_hash_type objhash = { rb_any_hash, }; +typedef int st_foreach_func(st_data_t, st_data_t, st_data_t); + struct foreach_safe_arg { st_table *tbl; - int (*func)(); + st_foreach_func *func; st_data_t arg; }; @@ -124,16 +126,18 @@ st_foreach_safe(st_table *table, int (*func)(ANYARGS), st_data_t a) struct foreach_safe_arg arg; arg.tbl = table; - arg.func = func; + arg.func = (st_foreach_func *)func; arg.arg = a; if (st_foreach(table, foreach_safe_i, (st_data_t)&arg)) { rb_raise(rb_eRuntimeError, "hash modified during iteration"); } } +typedef int rb_foreach_func(VALUE, VALUE, VALUE); + struct hash_foreach_arg { VALUE hash; - int (*func)(); + rb_foreach_func *func; VALUE arg; }; @@ -191,7 +195,7 @@ rb_hash_foreach(VALUE hash, int (*func)(ANYARGS), VALUE farg) RHASH(hash)->iter_lev++; arg.hash = hash; - arg.func = func; + arg.func = (rb_foreach_func *)func; arg.arg = farg; rb_ensure(hash_foreach_call, (VALUE)&arg, hash_foreach_ensure, hash); } |