diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-11-15 14:10:28 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-11-15 14:10:28 -0500 |
| commit | fc91166ce8590e67404cde79a273d7022ec16f1c (patch) | |
| tree | 00a6331bb6d1570f057e6155f223330eb402af69 /src/stdlib | |
| parent | 412487f2df5f3244c123c468e14d7f5f4c1e4c38 (diff) | |
Make EMPTY_TEXT into a macro
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/text.c | 7 | ||||
| -rw-r--r-- | src/stdlib/text.h | 3 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/stdlib/text.c b/src/stdlib/text.c index d40e1306..f323d88d 100644 --- a/src/stdlib/text.c +++ b/src/stdlib/text.c @@ -146,13 +146,6 @@ static int32_t num_synthetic_graphemes = 0; static Text_t simple_concatenation(Text_t a, Text_t b); -public -Text_t EMPTY_TEXT = { - .length = 0, - .tag = TEXT_ASCII, - .ascii = 0, -}; - PUREFUNC static bool graphemes_equal(const void *va, const void *vb, const TypeInfo_t *info) { (void)info; ucs4_t *a = *(ucs4_t **)va; diff --git a/src/stdlib/text.h b/src/stdlib/text.h index 15630858..2046d667 100644 --- a/src/stdlib/text.h +++ b/src/stdlib/text.h @@ -27,6 +27,8 @@ typedef struct { #define Text(str) ((Text_t){.length = sizeof(str) - 1, .tag = TEXT_ASCII, .ascii = "" str}) +#define EMPTY_TEXT ((Text_t){.length = 0, .tag = TEXT_ASCII, .ascii = 0}) + static inline Text_t Text_from_str_literal(const char *str) { return (Text_t){.length = strlen(str), .tag = TEXT_ASCII, .ascii = str}; } @@ -121,7 +123,6 @@ MACROLIKE int32_t Text$get_grapheme(Text_t text, int64_t index) { } extern const TypeInfo_t Text$info; -extern Text_t EMPTY_TEXT; #define Text$metamethods \ { \ |
