From 649977aae7e5922f992cd69eb84da0a2db368580 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 24 Dec 2025 12:45:29 -0500 Subject: Split out new()/gc logic from stdlib/util.h --- src/stdlib/text.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/stdlib/text.c') diff --git a/src/stdlib/text.c b/src/stdlib/text.c index 411f3546..969c2e51 100644 --- a/src/stdlib/text.c +++ b/src/stdlib/text.c @@ -108,6 +108,7 @@ #include #include +#include "../util.h" #include "bytes.h" #include "datatypes.h" #include "integers.h" @@ -199,9 +200,9 @@ int32_t get_synthetic_grapheme(const ucs4_t *codepoints, int64_t utf32_len) { if (num_synthetic_graphemes >= synthetic_grapheme_capacity) { // If we don't have space, allocate more: synthetic_grapheme_capacity = MAX(128, synthetic_grapheme_capacity * 2); - synthetic_grapheme_t *new = GC_MALLOC_ATOMIC(sizeof(synthetic_grapheme_t[synthetic_grapheme_capacity])); - memcpy(new, synthetic_graphemes, sizeof(synthetic_grapheme_t[num_synthetic_graphemes])); - synthetic_graphemes = new; + synthetic_grapheme_t *synth = GC_MALLOC_ATOMIC(sizeof(synthetic_grapheme_t[synthetic_grapheme_capacity])); + memcpy(synth, synthetic_graphemes, sizeof(synthetic_grapheme_t[num_synthetic_graphemes])); + synthetic_graphemes = synth; } int32_t grapheme_id = -(num_synthetic_graphemes + 1); -- cgit v1.2.3