OBJ_bsearch_

Binary-search a sorted array of fixed-size elements using a comparator.

Synopsis

Declared in <openssl/objects.h>

void const*
OBJ_bsearch_(
    void const* key,
    void const* base,
    int num,
    int size,
    int(* cmp)(void const*, void const*));

Description

Used internally by the OBJ_bsearch_* helpers; prefer those type-safe wrappers.

Return Value

Pointer to the matching element, or NULL if not found.

Parameters

NameDescription
keyPointer to the search key passed as the first argument to cmp.
baseBase address of the sorted array.
numNumber of elements in the array.
sizeSize of each element in bytes.
cmpComparison callback returning negative, zero, or positive like strcmp.