mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
5235f1facf
Sometimes you want to find the place where an item would be in a sorted list, whether or not it is actually there. The BINARY_ARRAY_SEARCH_GTE macro takes an extra 'next' pointer argument over the other binsearch macros. This will end up pointing to the next element in the case where there is not an exact match, or NULL when there is. That is, searching the list { 2, 3, 4, 4, 9} with a standard integer compare should give the following results: search term *result *next 1 - 2 3 3 - 4 4 [1] - 7 - 9 9 9 - 10 - - [2] Notes [1] There are two fours, but you will always get the first one. [2] The both NULL case means the search term is beyond the last list item. You can safely use the same pointer for both 'result' and 'next', if you don't care to distinguish between the 'greater-than' and 'equals' cases. There is a torture test for this. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> |
||
---|---|---|
.. | ||
dbspeed.c | ||
fsrvp_state.c | ||
local.c | ||
nss_tests.c | ||
torture.c | ||
verif_trailer.c | ||
wscript_build |