Some const stuff
This commit is contained in:
parent
bac14fa6c7
commit
1000423d2b
@ -81,7 +81,7 @@ typedef struct Text_s {
|
|||||||
char short_ascii[8];
|
char short_ascii[8];
|
||||||
const char *ascii;
|
const char *ascii;
|
||||||
int32_t short_graphemes[2];
|
int32_t short_graphemes[2];
|
||||||
int32_t *graphemes;
|
const int32_t *graphemes;
|
||||||
struct Text_s *subtexts;
|
struct Text_s *subtexts;
|
||||||
};
|
};
|
||||||
} Text_t;
|
} Text_t;
|
||||||
|
@ -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_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_ASCII: return fwrite(t.ascii, sizeof(char), t.length, stream);
|
||||||
case TEXT_GRAPHEMES: case TEXT_SHORT_GRAPHEMES: {
|
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;
|
int written = 0;
|
||||||
for (int64_t i = 0; i < t.length; i++) {
|
for (int64_t i = 0; i < t.length; i++) {
|
||||||
int32_t grapheme = graphemes[i];
|
int32_t grapheme = graphemes[i];
|
||||||
@ -794,7 +794,7 @@ public uint64_t Text$hash(Text_t *text)
|
|||||||
siphashadd64bits(&sh, tmp.whole);
|
siphashadd64bits(&sh, tmp.whole);
|
||||||
}
|
}
|
||||||
} else if (subtext.tag == TEXT_GRAPHEMES) {
|
} else if (subtext.tag == TEXT_GRAPHEMES) {
|
||||||
int32_t *graphemes = subtext.graphemes;
|
const int32_t *graphemes = subtext.graphemes;
|
||||||
int64_t grapheme = 0;
|
int64_t grapheme = 0;
|
||||||
if (leftover) {
|
if (leftover) {
|
||||||
tmp.chunks[0] = leftover;
|
tmp.chunks[0] = leftover;
|
||||||
|
Loading…
Reference in New Issue
Block a user