Remove Set#to_h
[ruby.git] / prism / util / pm_memchr.h
blobe0671eaed3b9a664ea38cc1cb5c3f84f0ec23d62
1 /**
2 * @file pm_memchr.h
4 * A custom memchr implementation.
5 */
6 #ifndef PRISM_MEMCHR_H
7 #define PRISM_MEMCHR_H
9 #include "prism/defines.h"
10 #include "prism/encoding.h"
12 #include <stddef.h>
14 /**
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);
29 #endif