[PATCH 4/5] fix wrong printf formatting of signed/unsigned integers

David Bremner david at tethera.net
Mon Jun 26 06:04:25 PDT 2017


Piotr Trojanek <piotr.trojanek at 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


More information about the notmuch mailing list