[macruby-changes] [570] MacRuby/trunk/hash.c
source_changes at macosforge.org
source_changes at macosforge.org
Sun Sep 7 16:42:34 PDT 2008
Revision: 570
http://trac.macosforge.org/projects/ruby/changeset/570
Author: lsansonetti at apple.com
Date: 2008-09-07 16:42:34 -0700 (Sun, 07 Sep 2008)
Log Message:
-----------
make sure rb_hash() does not return a bignum
Modified Paths:
--------------
MacRuby/trunk/hash.c
Modified: MacRuby/trunk/hash.c
===================================================================
--- MacRuby/trunk/hash.c 2008-09-07 23:42:14 UTC (rev 569)
+++ MacRuby/trunk/hash.c 2008-09-07 23:42:34 UTC (rev 570)
@@ -37,7 +37,13 @@
VALUE
rb_hash(VALUE obj)
{
- return rb_funcall(obj, id_hash, 0);
+ VALUE v = rb_funcall(obj, id_hash, 0);
+ if (TYPE(v) == T_BIGNUM) {
+ unsigned long l = NUM2ULONG(v);
+ l /= 2.0;
+ v = ULONG2NUM(l);
+ }
+ return v;
}
typedef int st_foreach_func(st_data_t, st_data_t, st_data_t);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080907/035a5edd/attachment.html
More information about the macruby-changes
mailing list