Skip to content

Commit

Permalink
Add rb_ident_hash_new_with_size
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Oct 2, 2021
1 parent 601c67e commit 806e794
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hash.c
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions internal/hash.h
Expand Up @@ -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);
Expand Down

0 comments on commit 806e794

Please sign in to comment.