Skip to content

Commit a3b1f10

Browse files
committed
Remove a warning from discarded-qualifiers
I've been seeing this for a while now: ``` ../../../../ext/prism/../../src/memchr.c: In function ‘pm_memchr’: ../../../../ext/prism/../../src/memchr.c:35:16: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 35 | return memchr(memory, character, number); | ^~~~~~ ```
1 parent 7534097 commit a3b1f10

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/prism/internal/memchr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
* we need to search for a character in a buffer that could be the trailing byte
1111
* of a multibyte character.
1212
*/
13-
void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
13+
const void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
1414

1515
#endif

src/memchr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* we need to search for a character in a buffer that could be the trailing byte
1212
* of a multibyte character.
1313
*/
14-
void *
14+
const void *
1515
pm_memchr(const void *memory, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding) {
1616
if (encoding_changed && encoding->multibyte && character >= TRAILING_BYTE_MINIMUM) {
1717
const uint8_t *source = (const uint8_t *) memory;

0 commit comments

Comments
 (0)