drw: minor improvement to the nomatches cache
commit7ab0cb5ef0e19352fc5d64ae0d57a5cf4540acbf
authorNRK <nrk@disroot.org>
Fri, 7 Jul 2023 11:00:42 +0000 (7 17:00 +0600)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 7 Jul 2023 13:03:57 +0000 (7 15:03 +0200)
tree9d68f06933733c75cceca65a19f1a16501946327
parent0fe460dbd469a1d5b6a7140d0e1801935e4a923b
drw: minor improvement to the nomatches cache

1. use `unsigned int` to store the codepoints, this avoids waste on
   common case where `long` is 64bits. and POSIX guarantees `int` to be
   at least 32bits so there's no risk of truncation.
2. since switching to `unsigned int` cuts down the memory requirement by
   half, double the cache size from 64 to 128.
3. instead of a linear search, use a simple hash-table for O(1) lookups.
dmenu.c
drw.c
util.h