compile.c: avoid allocating 0 length call_data
if `body->ci_size` is `0`, there's no point allocating 0B, it just wastes an entry in the allocator.
This commit is contained in:
parent
fab133e629
commit
4aa74b605c
Notes:
git
2025-04-03 14:58:14 +00:00
11
compile.c
11
compile.c
@ -2596,7 +2596,13 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
|||||||
else {
|
else {
|
||||||
body->is_entries = NULL;
|
body->is_entries = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (body->ci_size) {
|
||||||
body->call_data = ZALLOC_N(struct rb_call_data, body->ci_size);
|
body->call_data = ZALLOC_N(struct rb_call_data, body->ci_size);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
body->call_data = NULL;
|
||||||
|
}
|
||||||
ISEQ_COMPILE_DATA(iseq)->ci_index = 0;
|
ISEQ_COMPILE_DATA(iseq)->ci_index = 0;
|
||||||
|
|
||||||
// Calculate the bitmask buffer size.
|
// Calculate the bitmask buffer size.
|
||||||
@ -13370,6 +13376,11 @@ ibf_load_ci_entries(const struct ibf_load *load,
|
|||||||
unsigned int ci_size,
|
unsigned int ci_size,
|
||||||
struct rb_call_data **cd_ptr)
|
struct rb_call_data **cd_ptr)
|
||||||
{
|
{
|
||||||
|
if (!ci_size) {
|
||||||
|
*cd_ptr = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ibf_offset_t reading_pos = ci_entries_offset;
|
ibf_offset_t reading_pos = ci_entries_offset;
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user