]> granicus.if.org Git - python/commitdiff
Thomas Wouters suggested an obvious improvement to unicode_eq():
authorGuido van Rossum <guido@python.org>
Tue, 18 Sep 2007 18:39:50 +0000 (18:39 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Sep 2007 18:39:50 +0000 (18:39 +0000)
use memcmp().

Objects/dictobject.c

index 8d8a882611e978dbddeeed60c5e1f1c511653a19..957090f19142f9632221dd56c680ecc872ed1ce8 100644 (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;
 }