Staging
v0.5.1
https://github.com/python/cpython
Revision 076ca6c3c8df3030307e548d9be792ce3c1c6eea authored by Martin Panter on 14 July 2016, 01:31:46 UTC, committed by Martin Panter on 14 July 2016, 01:31:46 UTC
1 parent 2cdcaf1
Raw File
Tip revision: 076ca6c3c8df3030307e548d9be792ce3c1c6eea authored by Martin Panter on 14 July 2016, 01:31:46 UTC
Issue #27369: Don’t test error message detail that changed in Expat 2.2.0
Tip revision: 076ca6c
eq.h
/* Fast unicode equal function optimized for dictobject.c and setobject.c */

/* Return 1 if two unicode objects are equal, 0 if not.
 * unicode_eq() is called when the hash of two unicode objects is equal.
 */
Py_LOCAL_INLINE(int)
unicode_eq(PyObject *aa, PyObject *bb)
{
    register PyUnicodeObject *a = (PyUnicodeObject *)aa;
    register PyUnicodeObject *b = (PyUnicodeObject *)bb;

    if (a->length != b->length)
        return 0;
    if (a->length == 0)
        return 1;
    if (a->str[0] != b->str[0])
        return 0;
    if (a->length == 1)
        return 1;
    return memcmp(a->str, b->str, a->length * sizeof(Py_UNICODE)) == 0;
}
back to top