From 1000423d2b351f1f5edbb3c9a08898883ba47f3e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 5 Sep 2024 17:06:27 -0400 Subject: [PATCH] Some const stuff --- builtins/datatypes.h | 2 +- builtins/text.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtins/datatypes.h b/builtins/datatypes.h index f8852c3..f7cc23e 100644 --- a/builtins/datatypes.h +++ b/builtins/datatypes.h @@ -81,7 +81,7 @@ typedef struct Text_s { char short_ascii[8]; const char *ascii; int32_t short_graphemes[2]; - int32_t *graphemes; + const int32_t *graphemes; struct Text_s *subtexts; }; } Text_t; diff --git a/builtins/text.c b/builtins/text.c index 3beda82..be30418 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -262,7 +262,7 @@ public int Text$print(FILE *stream, Text_t t) case TEXT_SHORT_ASCII: return fwrite(t.short_ascii, sizeof(char), t.length, stream); case TEXT_ASCII: return fwrite(t.ascii, sizeof(char), t.length, stream); case TEXT_GRAPHEMES: case TEXT_SHORT_GRAPHEMES: { - int32_t *graphemes = t.tag == TEXT_SHORT_GRAPHEMES ? t.short_graphemes : t.graphemes; + const int32_t *graphemes = t.tag == TEXT_SHORT_GRAPHEMES ? t.short_graphemes : t.graphemes; int written = 0; for (int64_t i = 0; i < t.length; i++) { int32_t grapheme = graphemes[i]; @@ -794,7 +794,7 @@ public uint64_t Text$hash(Text_t *text) siphashadd64bits(&sh, tmp.whole); } } else if (subtext.tag == TEXT_GRAPHEMES) { - int32_t *graphemes = subtext.graphemes; + const int32_t *graphemes = subtext.graphemes; int64_t grapheme = 0; if (leftover) { tmp.chunks[0] = leftover;