From 6601b076e29e6ea41f72068dee03298e2a860caa Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 29 Aug 2007 23:12:21 +0000 Subject: * include/ruby/intern.h: declare rb_hash_tbl. * include/ruby/ruby.h (RHash): delay st_table allocation. rename tbl field to ntbl to detect direct reference to the st_table as a compile error. (RHASH_TBL): abstract accessor defined. (RHASH_ITER_LEV): ditto. (RHASH_IFNONE): ditto. (RHASH_SIZE): ditto. (RHASH_EMPTY_P): ditto. * hash.c: delay st_table allocation. * gc.c: replace tbl by ntbl. * array.c: replace direct field accessor by abstract field accessor such as RHASH(hash)->tbl to RHASH_TBL(hash). * marshal.c: ditto. * insns.def: ditto. * ext/iconv/iconv.c: ditto. * ext/json/ext/generator/generator.c: ditto. * ext/json/ext/parser/parser.c: ditto. * ext/syck/rubyext.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/ruby/ruby.h') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 2dbf29956..63cb7b417 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -478,10 +478,15 @@ struct RRegexp { struct RHash { struct RBasic basic; - struct st_table *tbl; + struct st_table *ntbl; /* maybe 0 */ int iter_lev; VALUE ifnone; }; +#define RHASH_TBL(h) rb_hash_tbl(h) +#define RHASH_ITER_LEV(h) RHASH(h)->iter_lev +#define RHASH_IFNONE(h) RHASH(h)->ifnone +#define RHASH_SIZE(h) (RHASH(h)->ntbl ? RHASH(h)->ntbl->num_entries : 0) +#define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0) struct RFile { struct RBasic basic; -- cgit