]> granicus.if.org Git - python/commitdiff
bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)
authorMinmin Gong <gongminmin@msn.com>
Sat, 13 Jul 2019 13:11:43 +0000 (06:11 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 13 Jul 2019 13:11:43 +0000 (16:11 +0300)
Misc/NEWS.d/next/Windows/2019-05-05-05-23-34.bpo-28269.-MOHI7.rst [new file with mode: 0644]
Python/dynload_win.c

diff --git a/Misc/NEWS.d/next/Windows/2019-05-05-05-23-34.bpo-28269.-MOHI7.rst b/Misc/NEWS.d/next/Windows/2019-05-05-05-23-34.bpo-28269.-MOHI7.rst
new file mode 100644 (file)
index 0000000..a531b98
--- /dev/null
@@ -0,0 +1 @@
+Replace use of :c:func:`strcasecmp` for the system function :c:func:`_stricmp`. Patch by Minmin Gong.
index 457d47f5eed50a8f658e9ed5627584d61f5b94cd..5096555e701c49efe319bcbd067835f591541894 100644 (file)
@@ -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
@@ -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.",