4 * A custom memchr implementation.
9 #include "prism/defines.h"
10 #include "prism/encoding.h"
15 * We need to roll our own memchr to handle cases where the encoding changes and
16 * we need to search for a character in a buffer that could be the trailing byte
17 * of a multibyte character.
19 * @param source The source string.
20 * @param character The character to search for.
21 * @param number The maximum number of bytes to search.
22 * @param encoding_changed Whether the encoding changed.
23 * @param encoding A pointer to the encoding.
24 * @return A pointer to the first occurrence of the character in the source
25 * string, or NULL if no such character exists.
27 void * pm_memchr(const void *source
, int character
, size_t number
, bool encoding_changed
, const pm_encoding_t
*encoding
);