summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-23 14:54:50 +0900
committerGitHub <noreply@github.com>2023-06-23 14:54:50 +0900
commit73529a12bbf5bb88b2596ca1169bd29dc75aa2e6 (patch)
tree2286fc3c47dbe1593e5c5465d8c4681e0b75308b /hash.c
parent00c1bd66d6fa24bd50bd3f20334ec162d0279f40 (diff)
Declare `RHASH_AR_TABLE` and `RHASH_ST_TABLE` return non-null
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7976 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index ce7f5215d0..f49f881990 100644
--- a/hash.c
+++ b/hash.c
@@ -725,7 +725,8 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
return RHASH_ST_TABLE(hash);
}
- if (RHASH_AR_TABLE(hash)) {
+ RUBY_ASSERT(RHASH_AR_TABLE(hash));
+ {
unsigned i, bound = RHASH_AR_TABLE_BOUND(hash);
rb_st_init_existing_table_with_size(new_tab, &objhash, RHASH_AR_TABLE_SIZE(hash));
@@ -738,9 +739,6 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
}
ar_free_and_clear_table(hash);
}
- else {
- rb_st_init_existing_table_with_size(new_tab, &objhash, 0);
- }
RHASH_ST_TABLE_SET(hash, new_tab);