From be06ed5d1e2c038a4cccb8fb3b0e70869505447f Mon Sep 17 00:00:00 2001 From: cat Date: Sat, 11 Dec 2021 14:23:29 +0500 Subject: [PATCH 126/N] Remove unnecessary strlen() in Py_NormalizeSepsW(). --- Python/pathconfig.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Python/pathconfig.c b/Python/pathconfig.c index 7d75216..d47cb6f 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -83,10 +83,11 @@ Py_GetAltSepA(const char *name) void Py_NormalizeSepsA(char *name) { + assert(name != NULL); char sep = Py_GetSepA(name); char altsep = Py_GetAltSepA(name); char* seps; - if (strlen(name) > 1 && name[1] == ':') { + if (name[0] != '\0' && name[1] == ':') { name[0] = toupper(name[0]); } seps = strchr(name, altsep); @@ -135,10 +136,11 @@ Py_GetAltSepW(const wchar_t *name) void Py_NormalizeSepsW(wchar_t *name) { + assert(name != NULL); wchar_t sep = Py_GetSepW(name); wchar_t altsep = Py_GetAltSepW(name); wchar_t* seps; - if (wcslen(name) > 1 && name[1] == L':') { + if (name[0] != L'\0' && name[1] == L':') { name[0] = towupper(name[0]); } seps = wcschr(name, altsep); -- 2.35.1