annotate Objects/stringlib/eq.h @ 46567:ffeecbebf3ca

Block 2.6-only doc change.
author Georg Brandl <georg@python.org>
date Sat, 26 Apr 2008 18:28:08 +0000
parents 444da08f78a4
children cab14be0ada1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44252
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
1 /* Fast unicode equal function optimized for dictobject.c and setobject.c */
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
2
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
3 /* Return 1 if two unicode objects are equal, 0 if not.
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
4 * unicode_eq() is called when the hash of two unicode objects is equal.
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
5 */
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
6 Py_LOCAL_INLINE(int)
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
7 unicode_eq(PyObject *aa, PyObject *bb)
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
8 {
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
9 register PyUnicodeObject *a = (PyUnicodeObject *)aa;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
10 register PyUnicodeObject *b = (PyUnicodeObject *)bb;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
11
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
12 if (a->length != b->length)
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
13 return 0;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
14 if (a->length == 0)
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
15 return 1;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
16 if (a->str[0] != b->str[0])
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
17 return 0;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
18 if (a->length == 1)
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
19 return 1;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
20 return memcmp(a->str, b->str, a->length * sizeof(Py_UNICODE)) == 0;
444da08f78a4 Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
Christian Heimes <christian@cheimes.de>
parents:
diff changeset
21 }