diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-24 12:45:29 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-24 12:52:48 -0500 |
| commit | 649977aae7e5922f992cd69eb84da0a2db368580 (patch) | |
| tree | e61d35b74d2551901cc8f3f034aca7da1f375a8c /src/stdlib/text.c | |
| parent | 88ccdab43c0a3ee53177e21a28724e496406a376 (diff) | |
Split out new()/gc logic from stdlib/util.h
Diffstat (limited to 'src/stdlib/text.c')
| -rw-r--r-- | src/stdlib/text.c | 7 |
1 files changed, 4 insertions, 3 deletions
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 <unistring/version.h> #include <uniwidth.h> +#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); |
