Skip to content

Commit faea32b

Browse files
authored
gh-145092: Fix compiler warning for memchr() and wcschr() returning const pointer (GH-145093)
1 parent 2be2dd5 commit faea32b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Objects/stringlib/fastsearch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ STRINGLIB(find_char)(const STRINGLIB_CHAR* s, Py_ssize_t n, STRINGLIB_CHAR ch)
6969
and UCS4 representations. */
7070
if (needle != 0) {
7171
do {
72-
void *candidate = memchr(p, needle,
73-
(e - p) * sizeof(STRINGLIB_CHAR));
72+
const void *candidate = memchr(p, needle,
73+
(e - p) * sizeof(STRINGLIB_CHAR));
7474
if (candidate == NULL)
7575
return -1;
7676
s1 = p;

Python/preconfig.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ _Py_get_xoption(const PyWideStringList *xoptions, const wchar_t *name)
584584
for (Py_ssize_t i=0; i < xoptions->length; i++) {
585585
const wchar_t *option = xoptions->items[i];
586586
size_t len;
587-
wchar_t *sep = wcschr(option, L'=');
587+
const wchar_t *sep = wcschr(option, L'=');
588588
if (sep != NULL) {
589589
len = (sep - option);
590590
}
@@ -615,7 +615,7 @@ preconfig_init_utf8_mode(PyPreConfig *config, const _PyPreCmdline *cmdline)
615615
const wchar_t *xopt;
616616
xopt = _Py_get_xoption(&cmdline->xoptions, L"utf8");
617617
if (xopt) {
618-
wchar_t *sep = wcschr(xopt, L'=');
618+
const wchar_t *sep = wcschr(xopt, L'=');
619619
if (sep) {
620620
xopt = sep + 1;
621621
if (wcscmp(xopt, L"1") == 0) {

0 commit comments

Comments
 (0)