[前][次][番号順一覧][スレッド一覧]

ruby-changes:68199

From: Nobuyoshi <ko1@a...>
Date: Sat, 2 Oct 2021 11:43:49 +0900 (JST)
Subject: [ruby-changes:68199] 806e7947fe (master): Add rb_ident_hash_new_with_size

https://git.ruby-lang.org/ruby.git/commit/?id=806e7947fe

From 806e7947fec775ce27aa783ee00dbd8f52685db8 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 2 Oct 2021 08:40:37 +0900
Subject: Add rb_ident_hash_new_with_size

---
 hash.c          | 8 ++++++++
 internal/hash.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hash.c b/hash.c
index 42f2f993fb..9c3164c96a 100644
--- a/hash.c
+++ b/hash.c
@@ -4425,6 +4425,14 @@ rb_ident_hash_new(void) https://github.com/ruby/ruby/blob/trunk/hash.c#L4425
     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)
 {
diff --git a/internal/hash.h b/internal/hash.h
index e1f83d5018..f274cbbbd6 100644
--- a/internal/hash.h
+++ b/internal/hash.h
@@ -83,6 +83,7 @@ int rb_hash_stlike_delete(VALUE hash, st_data_t *pkey, st_data_t *pval); https://github.com/ruby/ruby/blob/trunk/internal/hash.h#L83
 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);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]