data: one trie for maps and dictionaries, one loader
The hash map served a single exact-match lookup that the trie already answers, at the price of a second container, a second file loader with its own drift, and a Str-to-UTF-8 conversion on every chain probe. The files are small (kanji.dict is 7.5k lines), so the trie holds both. trieopen validates keys and each space-separated value word against Str and reports path:line; trielookup takes the Str every caller holds and treats a nil trie as an unloaded map; trienew/trieput exist for tests. The overflow guards on growth, Trie.root (always 0) and the per-language init loop written twice are gone.
This commit is contained in:
2
Makefile
2
Makefile
@@ -19,7 +19,7 @@ DOCKER_IMAGE = strans-build
|
||||
DOCKER_RUN = docker run --rm --user "$$(id -u):$$(id -g)" \
|
||||
-v "$(CURDIR):/src" $(DOCKER_IMAGE)
|
||||
|
||||
SRCS = dict.c font.c hash.c ibus.c ipc.c ko.c main.c popup_layout.c \
|
||||
SRCS = dict.c font.c ibus.c ipc.c ko.c main.c popup_layout.c \
|
||||
srv.c str.c strans.c trie.c vi.c win.c
|
||||
XIMSRCS = xim/xim.c xim/keymap.c xim/ximtext.c
|
||||
XIMOBJS = $(XIMSRCS:.c=.o)
|
||||
|
||||
Reference in New Issue
Block a user