summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-10 15:50:56 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-10 15:50:56 (GMT)
commit0ded5b54bb499865fb4ab8c0ac3d0977df9a334d (patch)
treea395f726d50a71b1bf363d5a041224ad51e80691 /Objects/dictobject.c
parent110194048e2d6a42f5954c39c8646ba93b66a7e1 (diff)
downloadcpython-0ded5b54bb499865fb4ab8c0ac3d0977df9a334d.zip
cpython-0ded5b54bb499865fb4ab8c0ac3d0977df9a334d.tar.gz
cpython-0ded5b54bb499865fb4ab8c0ac3d0977df9a334d.tar.bz2
Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
I moved the unicode_eq to stringlib/eq.h to keep the function static and possible inline for setobject.c and dictobject.h. I also removed the unused _PyString_Eq method. If it's required in the future it can be added to eq.h
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index ae400b6..05252d7 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -8,6 +8,7 @@
*/
#include "Python.h"
+#include "stringlib/eq.h"
/* Set a key error with the specified argument, wrapping it in a
@@ -327,25 +328,6 @@ lookdict(PyDictObject *mp, PyObject *key, register long hash)
return 0;
}
-/* Return 1 if two unicode objects are equal, 0 if not. */
-static int
-unicode_eq(PyObject *aa, PyObject *bb)
-{
- PyUnicodeObject *a = (PyUnicodeObject *)aa;
- 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;
-}
-
-
/*
* Hacked up version of lookdict which can assume keys are always
* unicodes; this assumption allows testing for errors during