From: Guido van Rossum Date: Tue, 18 Sep 2007 18:39:50 +0000 (+0000) Subject: Thomas Wouters suggested an obvious improvement to unicode_eq(): X-Git-Tag: v3.0a2~385 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4a9e788d367b99162a0b584d23f4fd111bde1cf;p=python Thomas Wouters suggested an obvious improvement to unicode_eq(): use memcmp(). --- diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 8d8a882611..957090f191 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; }