diff options
author | Matthew Newhook <matthew@zeroc.com> | 2007-01-10 20:47:46 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2007-01-10 20:47:46 +0000 |
commit | 6030169c1d69fec82a318c26cdbeab354c30964c (patch) | |
tree | 327e33d4ee5c9b0ade77973b0d2b8d80368f916a /rb/src/IceRuby/Util.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1391. Fixed GC bug with (diff) | |
download | ice-6030169c1d69fec82a318c26cdbeab354c30964c.tar.bz2 ice-6030169c1d69fec82a318c26cdbeab354c30964c.tar.xz ice-6030169c1d69fec82a318c26cdbeab354c30964c.zip |
Fixed plug-in to be compatible with ruby 1.8.1
Diffstat (limited to 'rb/src/IceRuby/Util.cpp')
-rw-r--r-- | rb/src/IceRuby/Util.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/rb/src/IceRuby/Util.cpp b/rb/src/IceRuby/Util.cpp index a1bf5a03eb1..272bb95516b 100644 --- a/rb/src/IceRuby/Util.cpp +++ b/rb/src/IceRuby/Util.cpp @@ -228,9 +228,12 @@ IceRuby::contextToHash(const Ice::Context& ctx) } extern "C" -int -IceRuby_Util_hash_foreach_callback(VALUE key, VALUE value, VALUE arg) +VALUE +IceRuby_Util_hash_foreach_callback(VALUE val, VALUE arg) { + VALUE key = rb_ary_entry(val, 0); + VALUE value = rb_ary_entry(val, 1); + // // We can't allow any C++ exceptions to propagate out of this function. // @@ -238,33 +241,21 @@ IceRuby_Util_hash_foreach_callback(VALUE key, VALUE value, VALUE arg) { IceRuby::HashIterator* iter = reinterpret_cast<IceRuby::HashIterator*>(arg); iter->element(key, value); - return ST_CONTINUE; } ICE_RUBY_CATCH - return ST_STOP; -} - -// -// Wrapper for rb_hash_foreach because it doesn't return VALUE. -// -extern "C" -VALUE -IceRuby_Util_rb_hash_foreach(VALUE hash, int (*func)(ANYARGS), VALUE arg) -{ - rb_hash_foreach(hash, func, arg); - return Qnil; + return val; } extern "C" { -typedef int (*ICE_RUBY_HASH_FOREACH_CALLBACK)(...); +typedef VALUE (*ICE_RUBY_HASH_FOREACH_CALLBACK)(...); } void IceRuby::hashIterate(VALUE h, HashIterator& iter) { assert(TYPE(h) == T_HASH); - callRuby(IceRuby_Util_rb_hash_foreach, h, + callRuby(rb_iterate, rb_each, h, reinterpret_cast<ICE_RUBY_HASH_FOREACH_CALLBACK>(IceRuby_Util_hash_foreach_callback), reinterpret_cast<VALUE>(&iter)); } |