Skip to content
Browse files

added a rb_hash_tbl() of MRI API.

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4815 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent dd4184a commit 5df1f234f249fc1b60afcd6df005bfb87a7c4568 @Watson1978 Watson1978 committed Oct 23, 2010
Showing with 10 additions and 0 deletions.
  1. +9 −0 hash.c
  2. +1 −0 include/ruby/ruby.h
View
9 hash.c
@@ -219,6 +219,15 @@ rb_hash_new_fast(int argc, ...)
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
View
1 include/ruby/ruby.h
@@ -536,6 +536,7 @@ long rb_str_clen(VALUE);
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)

0 comments on commit 5df1f23

Please sign in to comment.
Something went wrong with that request. Please try again.