lib: bsearch - make BINARY_NUMBER_SEARCH more widely usable This template is more widely usable if we do not hard-code into it the method of accessing the value being compared. For the default case we already use, this accessor is just a simple array dereferencing macro.
lib: bsearch - make BINARY_NUMBER_SEARCH more widely usable
This template is more widely usable if we do not hard-code into it the
method of accessing the value being compared. For the default case
we already use, this accessor is just a simple array dereferencing
macro.

As rewriting with the array access happens in the preprocessor, the
code generated is completely unchanged.

Expected future use:

:  #define MY_GETTER(array, index) ((array)[(index)].index_field)
:  #define MY_BINARY_SEARCH(data, count, value, idx_r)                  \
:          BINARY_NUMERIC_SEARCH(MY_GETTER, data, count, value, idx_r);

Signed-off-by: Phil Carmody <e888d2bd6f13f82caa51a37c03d034c76f661ba3@dovecot.fi>

jwm/dovecot-notmuch,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jwm/dovecot-notmuch