[ruby/prism] Additional fix of adding x prefix after rebase with main branch

https://github.com/ruby/prism/commit/08733438bd
This commit is contained in:
HASUMI Hitoshi 2024-03-03 10:35:43 +09:00 committed by git
parent 54f27549e2
commit b95e2cdca7
2 changed files with 4 additions and 4 deletions

View File

@ -135,7 +135,7 @@ pm_node_hash_insert(pm_node_hash_t *hash, const pm_parser_t *parser, pm_node_t *
if (hash->size * 2 >= hash->capacity) {
// First, allocate space for the new node list.
uint32_t new_capacity = hash->capacity == 0 ? 4 : hash->capacity * 2;
pm_node_t **new_nodes = calloc(new_capacity, sizeof(pm_node_t *));
pm_node_t **new_nodes = xcalloc(new_capacity, sizeof(pm_node_t *));
if (new_nodes == NULL) return NULL;
// It turns out to be more efficient to mask the hash value than to use
@ -155,7 +155,7 @@ pm_node_hash_insert(pm_node_hash_t *hash, const pm_parser_t *parser, pm_node_t *
}
// Finally, free the old node list and update the hash.
free(hash->nodes);
xfree(hash->nodes);
hash->nodes = new_nodes;
hash->capacity = new_capacity;
}
@ -188,7 +188,7 @@ pm_node_hash_insert(pm_node_hash_t *hash, const pm_parser_t *parser, pm_node_t *
*/
static void
pm_node_hash_free(pm_node_hash_t *hash) {
if (hash->capacity > 0) free(hash->nodes);
if (hash->capacity > 0) xfree(hash->nodes);
}
/**

View File

@ -18,7 +18,7 @@ bool
pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id) {
if (list->size >= list->capacity) {
list->capacity = list->capacity == 0 ? 8 : list->capacity * 2;
list->ids = (pm_constant_id_t *) realloc(list->ids, sizeof(pm_constant_id_t) * list->capacity);
list->ids = (pm_constant_id_t *) xrealloc(list->ids, sizeof(pm_constant_id_t) * list->capacity);
if (list->ids == NULL) return false;
}