From b95e2cdca7355539f5d03f859290e4bc6ec19feb Mon Sep 17 00:00:00 2001 From: HASUMI Hitoshi Date: Sun, 3 Mar 2024 10:35:43 +0900 Subject: [PATCH] [ruby/prism] Additional fix of adding `x` prefix after rebase with main branch https://github.com/ruby/prism/commit/08733438bd --- prism/static_literals.c | 6 +++--- prism/util/pm_constant_pool.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/prism/static_literals.c b/prism/static_literals.c index 64d6ffeec98877..713721bb73acd5 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 5f3b0e92c8365d..19c372e6553c43 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; }