Skip to content

Commit c83bb27

Browse files
committed
Revert unicode_compare_eq() changes
1 parent 8592ef1 commit c83bb27

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Objects/unicodeobject.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10971,19 +10971,22 @@ unicode_compare(PyObject *str1, PyObject *str2)
1097110971
static int
1097210972
unicode_compare_eq(PyObject *str1, PyObject *str2)
1097310973
{
10974-
Py_ssize_t len = PyUnicode_GET_LENGTH(str1);
10975-
if (PyUnicode_GET_LENGTH(str2) != len) {
10976-
return 0;
10977-
}
10974+
int kind;
10975+
const void *data1, *data2;
10976+
Py_ssize_t len;
10977+
int cmp;
1097810978

10979-
int kind = PyUnicode_KIND(str1);
10980-
if (PyUnicode_KIND(str2) != kind) {
10979+
len = PyUnicode_GET_LENGTH(str1);
10980+
if (PyUnicode_GET_LENGTH(str2) != len)
1098110981
return 0;
10982-
}
10982+
kind = PyUnicode_KIND(str1);
10983+
if (PyUnicode_KIND(str2) != kind)
10984+
return 0;
10985+
data1 = PyUnicode_DATA(str1);
10986+
data2 = PyUnicode_DATA(str2);
1098310987

10984-
const void *data1 = PyUnicode_DATA(str1);
10985-
const void *data2 = PyUnicode_DATA(str2);
10986-
return (memcmp(data1, data2, len * kind) == 0);
10988+
cmp = memcmp(data1, data2, len * kind);
10989+
return (cmp == 0);
1098710990
}
1098810991

1098910992
int

0 commit comments

Comments
 (0)