composed: refactor: break out lookup with collision detection

This commit is contained in:
Daniel Eklöf 2025-01-24 14:15:01 +01:00
parent 1181f74d19
commit e248e73753
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 54 additions and 53 deletions

View file

@ -10,12 +10,16 @@ struct composed {
uint32_t key;
uint8_t count;
uint8_t width;
uint8_t forced_width;
};
uint32_t composed_key_from_chars(const uint32_t chars[], size_t count);
uint32_t composed_key_from_key(uint32_t prev_key, uint32_t next_char);
struct composed *composed_lookup(struct composed *root, uint32_t key);
const struct composed *composed_lookup(struct composed *root, uint32_t key);
const struct composed *composed_lookup_without_collision(
struct composed *root, uint32_t *key,
const char32_t *prefix, size_t prefix_len, char32_t wc, int forced_width);
void composed_insert(struct composed **root, struct composed *node);
void composed_free(struct composed *root);