Piotr Trojanek <piotr.trojanek@gmail.com> writes: > For the second FIXME, I don't quite see why not just use the bsearch > function. It could be called either with strcmp (if exact is true) or > with a simple wrapper around strncmp (if exact is false). This wrapper > could replace the string_cmp routine, so together with bsearch this > could even make the code smaller. AFAIK, bsearch does not guarantee to return the first string matching the key, which is what we need here. > > Also, I don't really understand the intention behind declaring > string_cmp as returning notmuch_bool_t and then, in bsearch_first, > casting its result to int. yes, that looks odd to me also, especially since it really just wraps strcmp / strncmp, which are signed. Probably just an error on my part. d