Skip to content

Commit 920ec4b

Browse files
bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)
(cherry picked from commit 05f2d84) Co-authored-by: Minmin Gong <[email protected]>
1 parent 076d0b9 commit 920ec4b

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replace use of :c:func:`strcasecmp` for the system function :c:func:`_stricmp`. Patch by Minmin Gong.

Python/dynload_win.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@ const char *_PyImport_DynLoadFiletab[] = {
3838
NULL
3939
};
4040

41-
/* Case insensitive string compare, to avoid any dependencies on particular
42-
C RTL implementations */
43-
44-
static int strcasecmp (const char *string1, const char *string2)
45-
{
46-
int first, second;
47-
48-
do {
49-
first = tolower(*string1);
50-
second = tolower(*string2);
51-
string1++;
52-
string2++;
53-
} while (first && first == second);
54-
55-
return (first - second);
56-
}
57-
58-
5941
/* Function to return the name of the "python" DLL that the supplied module
6042
directly imports. Looks through the list of imported modules and
6143
returns the first entry that starts with "python" (case sensitive) and
@@ -297,7 +279,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
297279
import_python = GetPythonImport(hDLL);
298280

299281
if (import_python &&
300-
strcasecmp(buffer,import_python)) {
282+
_stricmp(buffer,import_python)) {
301283
PyErr_Format(PyExc_ImportError,
302284
"Module use of %.150s conflicts "
303285
"with this version of Python.",

0 commit comments

Comments
 (0)