Thomas Wouters suggested an obvious improvement to unicode_eq():

use memcmp().
This commit is contained in:
Guido van Rossum 2007-09-18 18:39:50 +00:00
parent 89d8c60d04
commit e4a9e788d3

View file

@ -340,7 +340,7 @@ unicode_eq(PyObject *aa, PyObject *bb)
return 0;
if (a->length == 1)
return 1;
return PyUnicode_Compare(aa, bb) == 0;
return memcmp(a->str, b->str, a->length * sizeof(Py_UNICODE)) == 0;
}