зеркало из https://github.com/github/ruby.git
* include/ruby/ruby.h (struct RHash): no longer. [Feature #9889]
* include/ruby/ruby.h (RHASH): ditto. * include/ruby/ruby.h (RHASH_ITER_LEV): deprecated. Will be deleted later. * include/ruby/ruby.h (RHASH_IFNONE): ditto. * internal.h (struct RHash): moved here. * internal.h (RHASH): ditto. * hash.c (rb_hash_iter_lev): do not use this. * hash.c (rb_hash_ifnone): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
62bfc4f24e
Коммит
8250aa2df0
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Mon Jun 23 16:22:50 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (struct RHash): no longer. [Feature #9889]
|
||||
|
||||
* include/ruby/ruby.h (RHASH): ditto.
|
||||
|
||||
* include/ruby/ruby.h (RHASH_ITER_LEV): deprecated. Will be deleted later.
|
||||
|
||||
* include/ruby/ruby.h (RHASH_IFNONE): ditto.
|
||||
|
||||
* internal.h (struct RHash): moved here.
|
||||
|
||||
* internal.h (RHASH): ditto.
|
||||
|
||||
* hash.c (rb_hash_iter_lev): do not use this.
|
||||
|
||||
* hash.c (rb_hash_ifnone): ditto.
|
||||
|
||||
Mon Jun 23 13:30:11 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
|
||||
|
|
16
hash.c
16
hash.c
|
@ -69,6 +69,12 @@ VALUE rb_cHash;
|
|||
static VALUE envtbl;
|
||||
static ID id_hash, id_yield, id_default, id_flatten_bang;
|
||||
|
||||
VALUE
|
||||
rb_hash_ifnone(VALUE h)
|
||||
{
|
||||
return RHASH_IFNONE(h);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
|
||||
{
|
||||
|
@ -156,6 +162,12 @@ rb_objid_hash(st_index_t index)
|
|||
return hnum;
|
||||
}
|
||||
|
||||
int
|
||||
rb_hash_iter_lev(VALUE h)
|
||||
{
|
||||
return RHASH_ITER_LEV(h);
|
||||
}
|
||||
|
||||
static const struct st_hash_type objhash = {
|
||||
rb_any_cmp,
|
||||
rb_any_hash,
|
||||
|
@ -1068,8 +1080,6 @@ delete_if_i(VALUE key, VALUE value, VALUE hash)
|
|||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static VALUE rb_hash_size(VALUE hash);
|
||||
|
||||
static VALUE
|
||||
hash_enum_size(VALUE hash, VALUE args, VALUE eobj)
|
||||
{
|
||||
|
@ -1478,7 +1488,7 @@ rb_hash_replace(VALUE hash, VALUE hash2)
|
|||
* h.length #=> 3
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
VALUE
|
||||
rb_hash_size(VALUE hash)
|
||||
{
|
||||
return INT2FIX(RHASH_SIZE(hash));
|
||||
|
|
|
@ -508,6 +508,9 @@ struct st_table *rb_hash_tbl(VALUE);
|
|||
int rb_path_check(const char*);
|
||||
int rb_env_path_tainted(void);
|
||||
VALUE rb_env_clear(void);
|
||||
VALUE rb_hash_size(VALUE);
|
||||
DEPRECATED(int rb_hash_iter_lev(VALUE));
|
||||
DEPRECATED(VALUE rb_hash_ifnone(VALUE));
|
||||
/* io.c */
|
||||
#define rb_defout rb_stdout
|
||||
RUBY_EXTERN VALUE rb_fs;
|
||||
|
|
|
@ -919,17 +919,11 @@ struct RRegexp {
|
|||
#define RREGEXP_SRC_LEN(r) RSTRING_LEN(RREGEXP(r)->src)
|
||||
#define RREGEXP_SRC_END(r) RSTRING_END(RREGEXP(r)->src)
|
||||
|
||||
struct RHash {
|
||||
struct RBasic basic;
|
||||
struct st_table *ntbl; /* possibly 0 */
|
||||
int iter_lev;
|
||||
const VALUE ifnone;
|
||||
};
|
||||
/* RHASH_TBL allocates st_table if not available. */
|
||||
#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 ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
|
||||
#define RHASH_ITER_LEV(h) rb_hash_iter_lev(h)
|
||||
#define RHASH_IFNONE(h) rb_hash_ifnone(h)
|
||||
#define RHASH_SIZE(h) NUM2SIZET(rb_hash_size(h))
|
||||
#define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
|
||||
#define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
|
||||
|
||||
|
@ -1069,7 +1063,6 @@ struct RStruct {
|
|||
#define RSTRING(obj) (R_CAST(RString)(obj))
|
||||
#define RREGEXP(obj) (R_CAST(RRegexp)(obj))
|
||||
#define RARRAY(obj) (R_CAST(RArray)(obj))
|
||||
#define RHASH(obj) (R_CAST(RHash)(obj))
|
||||
#define RDATA(obj) (R_CAST(RData)(obj))
|
||||
#define RTYPEDDATA(obj) (R_CAST(RTypedData)(obj))
|
||||
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
|
||||
|
|
18
internal.h
18
internal.h
|
@ -442,6 +442,24 @@ struct RComplex {
|
|||
#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
|
||||
#endif
|
||||
|
||||
struct RHash {
|
||||
struct RBasic basic;
|
||||
struct st_table *ntbl; /* possibly 0 */
|
||||
int iter_lev;
|
||||
const VALUE ifnone;
|
||||
};
|
||||
|
||||
#define RHASH(obj) (R_CAST(RHash)(obj))
|
||||
|
||||
#ifdef RHASH_ITER_LEV
|
||||
#undef RHASH_ITER_LEV
|
||||
#undef RHASH_IFNONE
|
||||
#undef RHASH_SIZE
|
||||
#define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
|
||||
#define RHASH_IFNONE(h) (RHASH(h)->ifnone)
|
||||
#define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
|
||||
#endif
|
||||
|
||||
/* class.c */
|
||||
void rb_class_subclass_add(VALUE super, VALUE klass);
|
||||
void rb_class_remove_from_super_subclasses(VALUE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче