diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-21 15:37:51 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-21 15:37:51 -0400 |
| commit | 0b76011a45b421b1473e9be75e538d3ceadf1140 (patch) | |
| tree | 5738f89e0fb55235e0a3fda861db1a2dde2bd063 /stdlib/text.c | |
| parent | 013995b146a5984a7bd053ad33aae88d42838868 (diff) | |
Remove some less-supported code features like static initializers for
variable-sized arrays
Diffstat (limited to 'stdlib/text.c')
| -rw-r--r-- | stdlib/text.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stdlib/text.c b/stdlib/text.c index 9abab57b..966f6ac3 100644 --- a/stdlib/text.c +++ b/stdlib/text.c @@ -138,7 +138,7 @@ static const TypeInfo_t GraphemeClusterInfo = { #pragma GCC diagnostic ignored "-Wstack-protector" public int32_t get_synthetic_grapheme(const ucs4_t *codepoints, int64_t utf32_len) { - ucs4_t length_prefixed[1+utf32_len] = {}; + ucs4_t length_prefixed[1+utf32_len]; length_prefixed[0] = (ucs4_t)utf32_len; for (int i = 0; i < utf32_len; i++) length_prefixed[i+1] = codepoints[i]; @@ -330,7 +330,8 @@ static void insert_balanced_recursive(Text_t balanced_texts[MAX_TEXT_DEPTH], Tex static Text_t rebalanced(Text_t a, Text_t b) { - Text_t balanced_texts[MAX_TEXT_DEPTH] = {}; + Text_t balanced_texts[MAX_TEXT_DEPTH]; + memset(balanced_texts, 0, sizeof(balanced_texts)); insert_balanced_recursive(balanced_texts, a); insert_balanced_recursive(balanced_texts, b); @@ -436,7 +437,7 @@ static Text_t concat2(Text_t a, Text_t b) size_t len = (last_a >= 0) ? 1 : NUM_GRAPHEME_CODEPOINTS(last_a); len += (first_b >= 0) ? 1 : NUM_GRAPHEME_CODEPOINTS(first_b); - ucs4_t codepoints[len] = {}; + ucs4_t codepoints[len]; ucs4_t *dest = codepoints; if (last_a < 0) dest = mempcpy(dest, GRAPHEME_CODEPOINTS(last_a), sizeof(ucs4_t[NUM_GRAPHEME_CODEPOINTS(last_a)])); @@ -451,7 +452,7 @@ static Text_t concat2(Text_t a, Text_t b) // Do a normalization run for these two codepoints and see if it looks different. // Normalization should not exceed 3x in the input length (but if it does, it will be // handled gracefully) - ucs4_t norm_buf[3*len] = {}; + ucs4_t norm_buf[3*len]; size_t norm_length = sizeof(norm_buf)/sizeof(norm_buf[0]); ucs4_t *normalized = u32_normalize(UNINORM_NFC, codepoints, len, norm_buf, &norm_length); bool stable = (norm_length == len && memcmp(codepoints, normalized, sizeof(codepoints)) == 0); |
