43 lines
1.2 KiB
Diff
43 lines
1.2 KiB
Diff
From 473806045dc48fa00d29c6000b03210ddd700bf6 Mon Sep 17 00:00:00 2001
|
|
From: cat <cat@wolfgirl.org>
|
|
Date: Sat, 11 Dec 2021 14:23:29 +0500
|
|
Subject: [PATCH 127/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.34.1
|
|
|