diff options
Diffstat (limited to 'src/gstore.c')
| -rw-r--r-- | src/gstore.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gstore.c b/src/gstore.c index d2bc57f..813ea7d 100644 --- a/src/gstore.c +++ b/src/gstore.c @@ -72,11 +72,11 @@ int term_gstore_expand(const struct gstore *g, uint32_t handle, uint32_t *cps, i { if (cap <= 0) return 0; - if (!g || !grapheme_is_handle(handle)) { + if (!g || !term_grapheme_is_handle(handle)) { cps[0] = handle; return 1; } - uint32_t idx = handle - GRAPHEME_HANDLE_BASE; + uint32_t idx = handle - TERM_GRAPHEME_HANDLE_BASE; if (idx >= g->entries_count || !g->entries[idx].allocated) { cps[0] = 0xFFFD; return 1; @@ -124,8 +124,8 @@ static bool grow_slots(struct gstore *g) struct gentry *e = &g->entries[i]; if (!e->allocated) continue; - uint32_t cps_buf[GRAPHEME_MAX_LEN]; - int n = term_gstore_expand(g, GRAPHEME_HANDLE_BASE + i, cps_buf, GRAPHEME_MAX_LEN); + uint32_t cps_buf[TERM_GRAPHEME_MAX_LEN]; + int n = term_gstore_expand(g, TERM_GRAPHEME_HANDLE_BASE + i, cps_buf, TERM_GRAPHEME_MAX_LEN); uint64_t h = hash_cps(cps_buf, n); uint32_t h32 = (uint32_t)h ? (uint32_t)h : 1; gstore_insert_slot(g, h32, i); @@ -147,7 +147,7 @@ static uint32_t gstore_find(const struct gstore *g, const uint32_t *cps, int n, uint32_t e_idx = slot->entry_idx - 1; const struct gentry *e = &g->entries[e_idx]; if (e->allocated && gentry_matches(g, e, cps, n)) - return GRAPHEME_HANDLE_BASE + e_idx; + return TERM_GRAPHEME_HANDLE_BASE + e_idx; } idx = (idx + 1) & mask; } @@ -193,9 +193,9 @@ void term_gstore_unpin(struct gstore *g) void term_gstore_mark(struct gstore *g, uint32_t handle) { - if (!g || !grapheme_is_handle(handle)) + if (!g || !term_grapheme_is_handle(handle)) return; - uint32_t idx = handle - GRAPHEME_HANDLE_BASE; + uint32_t idx = handle - TERM_GRAPHEME_HANDLE_BASE; if (idx < g->entries_count && g->entries[idx].allocated) g->entries[idx].mark = true; } @@ -204,7 +204,7 @@ static void sweep_mark_row(struct gstore *g, const struct cell *cells, int len) { for (int x = 0; x < len; x++) { uint32_t c = cells[x].c; - if (grapheme_is_handle(c)) + if (term_grapheme_is_handle(c)) term_gstore_mark(g, c); } } @@ -215,7 +215,7 @@ void term_gstore_sweep(struct gstore *g, struct term *t) return; if (t) { - if (grapheme_is_handle(t->last_char)) + if (term_grapheme_is_handle(t->last_char)) term_gstore_mark(g, t->last_char); struct screen *s = &t->scr; @@ -266,8 +266,8 @@ void term_gstore_sweep(struct gstore *g, struct term *t) live++; e->mark = false; if (g->slots) { - uint32_t cps_buf[GRAPHEME_MAX_LEN]; - int n = term_gstore_expand(g, GRAPHEME_HANDLE_BASE + i, cps_buf, GRAPHEME_MAX_LEN); + uint32_t cps_buf[TERM_GRAPHEME_MAX_LEN]; + int n = term_gstore_expand(g, TERM_GRAPHEME_HANDLE_BASE + i, cps_buf, TERM_GRAPHEME_MAX_LEN); uint64_t h = hash_cps(cps_buf, n); uint32_t h32 = (uint32_t)h ? (uint32_t)h : 1; gstore_insert_slot(g, h32, i); @@ -300,8 +300,8 @@ uint32_t term_gstore_intern(struct gstore *g, const uint32_t *cps, int n) return 0; if (n == 1) return cps[0]; - if (n > GRAPHEME_MAX_LEN) - n = GRAPHEME_MAX_LEN; + if (n > TERM_GRAPHEME_MAX_LEN) + n = TERM_GRAPHEME_MAX_LEN; uint64_t h = hash_cps(cps, n); uint32_t h32 = (uint32_t)h ? (uint32_t)h : 1; @@ -375,5 +375,5 @@ uint32_t term_gstore_intern(struct gstore *g, const uint32_t *cps, int n) gstore_insert_slot(g, h32, entry_idx); g->live_count++; - return GRAPHEME_HANDLE_BASE + entry_idx; + return TERM_GRAPHEME_HANDLE_BASE + entry_idx; } |
