Extract RHASH_STRING_KEY_P

This commit is contained in:
Nobuyoshi Nakada 2024-02-27 01:22:01 +09:00
parent c1279a3da5
commit cd774f4ab9

3
hash.c
View File

@ -395,6 +395,7 @@ const struct st_hash_type rb_hashtype_ident = {
};
#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;
@ -2958,7 +2959,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
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);
}
else {