aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-29 23:12:21 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-29 23:12:21 +0000
commit2a4c4f7b0c147585119036c43c1d04f73621e510 (patch)
treea25d27ffdd53b0b5912e6746131b97a245a3732d /include
parent3d7f8c2320d13fcc0c12e8910d70a812dab2f681 (diff)
downloadruby-2a4c4f7b0c147585119036c43c1d04f73621e510.tar.gz
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@13309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/intern.h1
-rw-r--r--include/ruby/ruby.h7
2 files changed, 7 insertions, 1 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 78ac3f9d00..829d732893 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -326,6 +326,7 @@ VALUE rb_hash_lookup(VALUE, VALUE);
VALUE rb_hash_aset(VALUE, VALUE, VALUE);
VALUE rb_hash_delete_if(VALUE);
VALUE rb_hash_delete(VALUE,VALUE);
+struct st_table *rb_hash_tbl(VALUE);
int rb_path_check(const char*);
int rb_env_path_tainted(void);
/* io.c */
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 2dbf29956e..63cb7b417e 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;