summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHASUMI Hitoshi <hasumikin@gmail.com>2024-03-03 10:35:43 +0900
committergit <svn-admin@ruby-lang.org>2024-03-04 16:40:24 +0000
commitb95e2cdca7355539f5d03f859290e4bc6ec19feb (patch)
treeb97374c83b84b1d6fa1969a145a1da47ca126ecb
parent54f27549e2cd7cdbd83d3e6a2079108fe225c0b5 (diff)
[ruby/prism] Additional fix of adding `x` prefix after rebase with main branch
https://github.com/ruby/prism/commit/08733438bd
-rw-r--r--prism/static_literals.c6
-rw-r--r--prism/util/pm_constant_pool.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/prism/static_literals.c b/prism/static_literals.c
index 64d6ffeec9..713721bb73 100644
--- a/prism/static_literals.c
+++ b/prism/static_literals.c
@@ -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);
}
/**
diff --git a/prism/util/pm_constant_pool.c b/prism/util/pm_constant_pool.c
index 5f3b0e92c8..19c372e655 100644
--- a/prism/util/pm_constant_pool.c
+++ b/prism/util/pm_constant_pool.c
@@ -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;
}