| 1 | #cxx . . $ `<file>/src/util/pm_memchr.c`/include "prism/util/pm_memchr.h"cxx . . $ `<file>/include/prism/util/pm_memchr.h`/ |
| 2 | |
| 3 | #define PRISM_MEMCHR_TRAILING_BYTE_MINIMUMcxx . . $ `src/util/pm_memchr.c:3:9`! 0x40 |
| 4 | |
| 5 | /** |
| 6 | * We need to roll our own memchr to handle cases where the encoding changes and |
| 7 | * we need to search for a character in a buffer that could be the trailing byte |
| 8 | * of a multibyte character. |
| 9 | */ |
| 10 | void * |
| 11 | pm_memchrcxx . . $ pm_memchr(fccc166115c7ad11).(const void *memory, int character, size_t number, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! encoding_changed, const pm_encoding_tcxx . . $ pm_encoding_t# *encoding) { |
| 12 | if (encoding_changed && encoding->multibytecxx . . $ $anonymous_type_f1726b61bf0350fa_0#multibyte. && character >= PRISM_MEMCHR_TRAILING_BYTE_MINIMUMcxx . . $ `src/util/pm_memchr.c:3:9`!) { |
| 13 | const uint8_tcxx . . $ uint8_t# *source = (const uint8_tcxx . . $ uint8_t# *) memory; |
| 14 | size_t index = 0; |
| 15 | |
| 16 | while (index < number) { |
| 17 | if (source[index] == character) { |
| 18 | return (void *) (source + index); |
| 19 | } |
| 20 | |
| 21 | size_t width = encoding->char_widthcxx . . $ $anonymous_type_f1726b61bf0350fa_0#char_width.(source + index, (ptrdiff_t) (number - index)); |
| 22 | if (width == 0) { |
| 23 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 24 | } |
| 25 | |
| 26 | index += width; |
| 27 | } |
| 28 | |
| 29 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 30 | } else { |
| 31 | return memchrcxx . . $ memchr(3976b00ca259a364).(memory, character, number); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | #undef PRISM_MEMCHR_TRAILING_BYTE_MINIMUMcxx . . $ `src/util/pm_memchr.c:3:9`! |