Extract RHASH_STRING_KEY_P
This commit is contained in:
parent
c1279a3da5
commit
cd774f4ab9
3
hash.c
3
hash.c
@ -395,6 +395,7 @@ const struct st_hash_type rb_hashtype_ident = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define RHASH_IDENTHASH_P(hash) (RHASH_TYPE(hash) == &identhash)
|
#define RHASH_IDENTHASH_P(hash) (RHASH_TYPE(hash) == &identhash)
|
||||||
|
#define RHASH_STRING_KEY_P(hash, key) (!RHASH_IDENTHASH_P(hash) && (rb_obj_class(key) == rb_cString))
|
||||||
|
|
||||||
typedef st_index_t st_hash_t;
|
typedef st_index_t st_hash_t;
|
||||||
|
|
||||||
@ -2958,7 +2959,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
|
|||||||
|
|
||||||
rb_hash_modify(hash);
|
rb_hash_modify(hash);
|
||||||
|
|
||||||
if (RHASH_IDENTHASH_P(hash) || rb_obj_class(key) != rb_cString) {
|
if (!RHASH_STRING_KEY_P(hash, key)) {
|
||||||
RHASH_UPDATE_ITER(hash, iter_p, key, hash_aset, val);
|
RHASH_UPDATE_ITER(hash, iter_p, key, hash_aset, val);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user