Skip to content

bpo-28269: Replace strcasecmp with system function stricmp #13095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace use of :c:func:`strcasecmp` for the system function :c:func:`_stricmp`. Patch by Minmin Gong.
20 changes: 1 addition & 19 deletions Python/dynload_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ const char *_PyImport_DynLoadFiletab[] = {
NULL
};

/* Case insensitive string compare, to avoid any dependencies on particular
C RTL implementations */

static int strcasecmp (const char *string1, const char *string2)
{
int first, second;

do {
first = tolower(*string1);
second = tolower(*string2);
string1++;
string2++;
} while (first && first == second);

return (first - second);
}


/* Function to return the name of the "python" DLL that the supplied module
directly imports. Looks through the list of imported modules and
returns the first entry that starts with "python" (case sensitive) and
Expand Down Expand Up @@ -297,7 +279,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
import_python = GetPythonImport(hDLL);

if (import_python &&
strcasecmp(buffer,import_python)) {
_stricmp(buffer,import_python)) {
PyErr_Format(PyExc_ImportError,
"Module use of %.150s conflicts "
"with this version of Python.",
Expand Down