diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-01 18:36:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 18:36:53 +0200 |
commit | 578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa (patch) | |
tree | 36df000be6a6d903c51fe5db44e9cf93625cadeb /Python/pystrcmp.c | |
parent | 03c5a685689fd4891d01caff8da01096fcf73d5a (diff) | |
download | cpython-578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa.tar.gz cpython-578ebc5d5fab2e5e0b87636361c6aeb8d2b287fa.zip |
gh-108767: Replace ctype.h functions with pyctype.h functions (#108772)
Replace <ctype.h> locale dependent functions with Python "pyctype.h"
locale independent functions:
* Replace isalpha() with Py_ISALPHA().
* Replace isdigit() with Py_ISDIGIT().
* Replace isxdigit() with Py_ISXDIGIT().
* Replace tolower() with Py_TOLOWER().
Leave Modules/_sre/sre.c unchanged, it uses locale dependent
functions on purpose.
Include explicitly <ctype.h> in _decimal.c to get isascii().
Diffstat (limited to 'Python/pystrcmp.c')
-rw-r--r-- | Python/pystrcmp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/pystrcmp.c b/Python/pystrcmp.c index 9224ce4c706..9796cb013ad 100644 --- a/Python/pystrcmp.c +++ b/Python/pystrcmp.c @@ -11,11 +11,11 @@ PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size) return 0; p1 = (const unsigned char *)s1; p2 = (const unsigned char *)s2; - for (; (--size > 0) && *p1 && *p2 && (tolower(*p1) == tolower(*p2)); + for (; (--size > 0) && *p1 && *p2 && (Py_TOLOWER(*p1) == Py_TOLOWER(*p2)); p1++, p2++) { ; } - return tolower(*p1) - tolower(*p2); + return Py_TOLOWER(*p1) - Py_TOLOWER(*p2); } int @@ -23,8 +23,8 @@ PyOS_mystricmp(const char *s1, const char *s2) { const unsigned char *p1 = (const unsigned char *)s1; const unsigned char *p2 = (const unsigned char *)s2; - for (; *p1 && *p2 && (tolower(*p1) == tolower(*p2)); p1++, p2++) { + for (; *p1 && *p2 && (Py_TOLOWER(*p1) == Py_TOLOWER(*p2)); p1++, p2++) { ; } - return (tolower(*p1) - tolower(*p2)); + return (Py_TOLOWER(*p1) - Py_TOLOWER(*p2)); } |