Function ndpi_memmem
Defined in File ndpi_api.h
Function Documentation
-
void *ndpi_memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
Finds the first occurrence of the sequence
needle
in the arrayhaystack
.This function searches for the first occurrence of the sequence
needle
of lengthneedle_len
in the arrayhaystack
of lengthhaystack_len
. Ifhaystack
orneedle
isNULL
, orhaystack_len
is less thanneedle_len
, orneedle_len
is 0, the function returnsNULL
.For optimization, if
needle_len
is 1, thememchr
function is used.- Parameters:
haystack – Pointer to the array in which the search is performed.
haystack_len – Length of the
haystack
array.needle – Pointer to the array to be searched for in
haystack
.needle_len – Length of the
needle
array.
- Returns:
Pointer to the first occurrence of
needle
inhaystack
orNULL
ifneedle
is not found.