replace use of <search.h> (tsearch etc.) with own tree implementation
tsearch(3) can be terribly inefficient on some systems, degrading to linear search. This AA-tree implementation is not measurably slower than e.g. musl's AVL tree implementation. Meanwhile, get rid of the silly tsearch API.
Showing with 242 additions and 127 deletions