Add rb_ident_hash_new_with_size

This commit is contained in:
Nobuyoshi Nakada 2021-10-02 08:40:37 +09:00
parent 601c67e42c
commit 806e7947fe
Notes: git 2021-10-02 11:43:55 +09:00
2 changed files with 9 additions and 0 deletions

8
hash.c
View File

@ -4425,6 +4425,14 @@ rb_ident_hash_new(void)
return hash;
}
VALUE
rb_ident_hash_new_with_size(st_index_t size)
{
VALUE hash = rb_hash_new();
RHASH_ST_TABLE_SET(hash, st_init_table_with_size(&identhash, size));
return hash;
}
st_table *
rb_init_identtable(void)
{

View File

@ -83,6 +83,7 @@ int rb_hash_stlike_delete(VALUE hash, st_data_t *pkey, st_data_t *pval);
int rb_hash_stlike_foreach_with_replace(VALUE hash, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg);
int rb_hash_stlike_update(VALUE hash, st_data_t key, st_update_callback_func *func, st_data_t arg);
extern st_table *rb_hash_st_table(VALUE hash);
VALUE rb_ident_hash_new_with_size(st_index_t size);
static inline unsigned RHASH_AR_TABLE_SIZE_RAW(VALUE h);
static inline VALUE RHASH_IFNONE(VALUE h);