diff options
author | Vladimir Gavrilov <105977161+0xA50C1A1@users.noreply.github.com> | 2024-05-22 13:47:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 12:47:27 +0200 |
commit | 15643547fed19d8aa28ffcc7ea083092d199d499 (patch) | |
tree | 79f6164ad2575e8b81b426c1cd5d37ea1ed73130 /src/include | |
parent | 5a25f89ab364078dd1478f56da4d3e2154784f1a (diff) |
Replace ndpi_strnstr() implementation with an optimal one (#2447)
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index ca365b8fe..fa1592863 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -115,17 +115,17 @@ extern "C" { u_int32_t ndpi_get_tot_allocated_memory(void); /** - * Search the first occurrence of substring -find- in -s- - * The search is limited to the first -slen- characters of the string + * Finds the first occurrence of the substring 'needle' in the string 'haystack'. * - * @par s = string to parse - * @par find = string to match with -s- - * @par slen = max length to match between -s- and -find- - * @return a pointer to the beginning of the located substring; - * NULL if the substring is not found + * This function is similar to the standard `strstr()` function, but it has an additional parameter `len` that + * specifies the maximum length of the search. * + * @param haystack The string to search in. + * @param needle The substring to search for. + * @param len The maximum length of the search. + * @return Pointer to the first occurrence of 'needle' in 'haystack', or NULL if no match is found. */ - char* ndpi_strnstr(const char *s, const char *find, size_t slen); + char *ndpi_strnstr(const char *haystack, const char *needle, size_t len); /** * Same as ndpi_strnstr but case insensitive |