[macruby-changes] [4815] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Sat Oct 23 05:45:47 PDT 2010


Revision: 4815
          http://trac.macosforge.org/projects/ruby/changeset/4815
Author:   watson1978 at gmail.com
Date:     2010-10-23 05:45:44 -0700 (Sat, 23 Oct 2010)
Log Message:
-----------
added a rb_hash_tbl() of MRI API.

Modified Paths:
--------------
    MacRuby/trunk/hash.c
    MacRuby/trunk/include/ruby/ruby.h

Modified: MacRuby/trunk/hash.c
===================================================================
--- MacRuby/trunk/hash.c	2010-10-23 11:46:52 UTC (rev 4814)
+++ MacRuby/trunk/hash.c	2010-10-23 12:45:44 UTC (rev 4815)
@@ -219,6 +219,15 @@
     return hash;
 }
 
+struct st_table *
+rb_hash_tbl(VALUE hash)
+{
+    if (!RHASH(hash)->tbl) {
+        RHASH(hash)->tbl = st_init_table(&objhash);
+    }
+    return RHASH(hash)->tbl;
+}
+
 /*
  *  call-seq:
  *     Hash.new                          => hash

Modified: MacRuby/trunk/include/ruby/ruby.h
===================================================================
--- MacRuby/trunk/include/ruby/ruby.h	2010-10-23 11:46:52 UTC (rev 4814)
+++ MacRuby/trunk/include/ruby/ruby.h	2010-10-23 12:45:44 UTC (rev 4815)
@@ -536,6 +536,7 @@
 const VALUE *rb_ary_ptr(VALUE);
 #define RARRAY_PTR(a) (rb_ary_ptr((VALUE)a)) 
 
+#define RHASH_TBL(h) rb_hash_tbl(h)
 #define RHASH_SIZE(h) rb_hash_size(h)
 #define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101023/4cda94ff/attachment.html>


More information about the macruby-changes mailing list