From e4a9e788d367b99162a0b584d23f4fd111bde1cf Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 18 Sep 2007 18:39:50 +0000 Subject: Thomas Wouters suggested an obvious improvement to unicode_eq(): use memcmp(). --- Objects/dictobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 8d8a882..957090f 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -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; } -- cgit v0.12