Line data Source code
1 : /* Fast unicode equal function optimized for dictobject.c and setobject.c */ 2 : 3 : /* Return 1 if two unicode objects are equal, 0 if not. 4 : * unicode_eq() is called when the hash of two unicode objects is equal. 5 : */ 6 : Py_LOCAL_INLINE(int) 7 105791200 : unicode_eq(PyObject *a, PyObject *b) 8 : { 9 105791200 : if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b)) 10 377805 : return 0; 11 105413392 : if (PyUnicode_GET_LENGTH(a) == 0) 12 0 : return 1; 13 105413392 : if (PyUnicode_KIND(a) != PyUnicode_KIND(b)) 14 0 : return 0; 15 105413392 : return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b), 16 210827780 : PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0; 17 : }