Some const stuff

This commit is contained in:
Bruce Hill 2024-09-05 17:06:27 -04:00
parent bac14fa6c7
commit 1000423d2b
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;