diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-02-27 01:22:01 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-03-14 17:49:37 +0900 |
commit | cd774f4ab916290128924a3eb121b9e56fb587d2 (patch) | |
tree | 8965c99f08621d9826abd51daee26c33f47ba82c /hash.c | |
parent | c1279a3da53d2869181cbc232213213b8bd99db7 (diff) |
Extract `RHASH_STRING_KEY_P`
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 { |