[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:
parent
54f27549e2
commit
b95e2cdca7
@ -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) {
|
if (hash->size * 2 >= hash->capacity) {
|
||||||
// First, allocate space for the new node list.
|
// First, allocate space for the new node list.
|
||||||
uint32_t new_capacity = hash->capacity == 0 ? 4 : hash->capacity * 2;
|
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;
|
if (new_nodes == NULL) return NULL;
|
||||||
|
|
||||||
// It turns out to be more efficient to mask the hash value than to use
|
// 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.
|
// Finally, free the old node list and update the hash.
|
||||||
free(hash->nodes);
|
xfree(hash->nodes);
|
||||||
hash->nodes = new_nodes;
|
hash->nodes = new_nodes;
|
||||||
hash->capacity = new_capacity;
|
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
|
static void
|
||||||
pm_node_hash_free(pm_node_hash_t *hash) {
|
pm_node_hash_free(pm_node_hash_t *hash) {
|
||||||
if (hash->capacity > 0) free(hash->nodes);
|
if (hash->capacity > 0) xfree(hash->nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@ bool
|
|||||||
pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id) {
|
pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id) {
|
||||||
if (list->size >= list->capacity) {
|
if (list->size >= list->capacity) {
|
||||||
list->capacity = list->capacity == 0 ? 8 : list->capacity * 2;
|
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;
|
if (list->ids == NULL) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user