Declare RHASH_AR_TABLE
and RHASH_ST_TABLE
return non-null
This commit is contained in:
parent
00c1bd66d6
commit
73529a12bb
Notes:
git
2023-06-23 05:55:11 +00:00
Merged: https://github.com/ruby/ruby/pull/7976 Merged-By: nobu <nobu@ruby-lang.org>
6
hash.c
6
hash.c
@ -725,7 +725,8 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
|
|||||||
return RHASH_ST_TABLE(hash);
|
return RHASH_ST_TABLE(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RHASH_AR_TABLE(hash)) {
|
RUBY_ASSERT(RHASH_AR_TABLE(hash));
|
||||||
|
{
|
||||||
unsigned i, bound = RHASH_AR_TABLE_BOUND(hash);
|
unsigned i, bound = RHASH_AR_TABLE_BOUND(hash);
|
||||||
|
|
||||||
rb_st_init_existing_table_with_size(new_tab, &objhash, RHASH_AR_TABLE_SIZE(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);
|
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);
|
RHASH_ST_TABLE_SET(hash, new_tab);
|
||||||
|
|
||||||
|
@ -124,12 +124,14 @@ RHASH_AR_TABLE_P(VALUE h)
|
|||||||
return ! FL_TEST_RAW(h, RHASH_ST_TABLE_FLAG);
|
return ! FL_TEST_RAW(h, RHASH_ST_TABLE_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RBIMPL_ATTR_RETURNS_NONNULL()
|
||||||
static inline struct ar_table_struct *
|
static inline struct ar_table_struct *
|
||||||
RHASH_AR_TABLE(VALUE h)
|
RHASH_AR_TABLE(VALUE h)
|
||||||
{
|
{
|
||||||
return (struct ar_table_struct *)((uintptr_t)h + sizeof(struct RHash));
|
return (struct ar_table_struct *)((uintptr_t)h + sizeof(struct RHash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RBIMPL_ATTR_RETURNS_NONNULL()
|
||||||
static inline st_table *
|
static inline st_table *
|
||||||
RHASH_ST_TABLE(VALUE h)
|
RHASH_ST_TABLE(VALUE h)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user