[macruby-changes] [4817] MacRuby/trunk/hash.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Oct 23 13:20:37 PDT 2010


Revision: 4817
          http://trac.macosforge.org/projects/ruby/changeset/4817
Author:   lsansonetti at apple.com
Date:     2010-10-23 13:20:36 -0700 (Sat, 23 Oct 2010)
Log Message:
-----------
fix rb_hash_tbl() to raise an exception in case it's called with a pure NSDictionary

Modified Paths:
--------------
    MacRuby/trunk/hash.c

Modified: MacRuby/trunk/hash.c
===================================================================
--- MacRuby/trunk/hash.c	2010-10-23 20:18:53 UTC (rev 4816)
+++ MacRuby/trunk/hash.c	2010-10-23 20:20:36 UTC (rev 4817)
@@ -222,10 +222,11 @@
 struct st_table *
 rb_hash_tbl(VALUE hash)
 {
-    if (!RHASH(hash)->tbl) {
-        RHASH(hash)->tbl = st_init_table(&objhash);
+    if (IS_RHASH(hash)) {
+	return RHASH(hash)->tbl;
     }
-    return RHASH(hash)->tbl;
+    rb_raise(rb_eRuntimeError,
+	    "rb_hash_tbl() won't work on pure NSDictionaries");
 }
 
 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101023/4ce23add/attachment.html>


More information about the macruby-changes mailing list