File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -824,21 +824,17 @@ pm_locals_hash(pm_constant_id_t name) {
824
824
*/
825
825
static void
826
826
pm_locals_resize(pm_locals_t *locals) {
827
- pm_local_t *next_locals;
828
827
uint32_t next_capacity = locals->capacity == 0 ? 4 : (locals->capacity * 2);
829
828
assert(next_capacity > locals->capacity);
830
829
831
- if (next_capacity < PM_LOCALS_HASH_THRESHOLD) {
832
- next_locals = xmalloc(next_capacity * sizeof(pm_local_t));
833
- if (next_locals == NULL) abort();
830
+ pm_local_t *next_locals = xcalloc(next_capacity, sizeof(pm_local_t));
831
+ if (next_locals == NULL) abort();
834
832
833
+ if (next_capacity < PM_LOCALS_HASH_THRESHOLD) {
835
834
if (locals->size > 0) {
836
835
memcpy(next_locals, locals->locals, locals->size * sizeof(pm_local_t));
837
836
}
838
837
} else {
839
- next_locals = xcalloc(next_capacity, sizeof(pm_local_t));
840
- if (next_locals == NULL) abort();
841
-
842
838
// If we just switched from a list to a hash, then we need to fill in
843
839
// the hash values of all of the locals.
844
840
bool hash_needed = locals->locals[0].hash == 0;
You can’t perform that action at this time.
0 commit comments