summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-06-24 08:22:19 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-06-24 08:22:19 (GMT)
commit38bb95e49d36754b9e9a45c0b1d6d7e1f9a82f03 (patch)
treeb0915e5ae7111888cff5022d38601339799115fb /Objects
parent049030b06aa3bd80b0e85916059f8e085eda3021 (diff)
downloadcpython-38bb95e49d36754b9e9a45c0b1d6d7e1f9a82f03.zip
cpython-38bb95e49d36754b9e9a45c0b1d6d7e1f9a82f03.tar.gz
cpython-38bb95e49d36754b9e9a45c0b1d6d7e1f9a82f03.tar.bz2
Minor code cleanup.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/setobject.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 70ec644..5b430b3 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -53,7 +53,7 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
{
setentry *table = so->table;
setentry *entry;
- size_t perturb = hash;
+ size_t perturb;
size_t mask = so->mask;
size_t i = (size_t)hash & mask; /* Unsigned for defined overflow behavior */
size_t j;
@@ -63,6 +63,8 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
if (entry->key == NULL)
return entry;
+ perturb = hash;
+
while (1) {
if (entry->hash == hash) {
PyObject *startkey = entry->key;
@@ -132,9 +134,9 @@ static int
set_insert_key(PySetObject *so, PyObject *key, Py_hash_t hash)
{
setentry *table = so->table;
- setentry *freeslot = NULL;
+ setentry *freeslot;
setentry *entry;
- size_t perturb = hash;
+ size_t perturb;
size_t mask = so->mask;
size_t i = (size_t)hash & mask; /* Unsigned for defined overflow behavior */
size_t j;