diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-05 17:06:27 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-05 17:06:27 -0400 |
| commit | 1000423d2b351f1f5edbb3c9a08898883ba47f3e (patch) | |
| tree | 2d759b31e45f27b7dc484a63a34fa94bce8ab44e | |
| parent | bac14fa6c79b6abea50fd5f188799ae8e83cb20d (diff) | |
Some const stuff
| -rw-r--r-- | builtins/datatypes.h | 2 | ||||
| -rw-r--r-- | builtins/text.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/builtins/datatypes.h b/builtins/datatypes.h index f8852c33..f7cc23ee 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 3beda82f..be304184 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; |
