[Python-checkins] cpython: Tighten-up code in set_next() to use an entry pointer rather than indexing.
raymond.hettinger
python-checkins at python.org
Mon Jul 6 17:53:56 CEST 2015
https://hg.python.org/cpython/rev/e0b398869e16
changeset: 96856:e0b398869e16
user: Raymond Hettinger <python at rcn.com>
date: Mon Jul 06 08:43:37 2015 -0700
summary:
Tighten-up code in set_next() to use an entry pointer rather than indexing.
files:
Objects/setobject.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -518,20 +518,22 @@
{
Py_ssize_t i;
Py_ssize_t mask;
- setentry *table;
+ setentry *entry;
assert (PyAnySet_Check(so));
i = *pos_ptr;
assert(i >= 0);
- table = so->table;
mask = so->mask;
- while (i <= mask && (table[i].key == NULL || table[i].key == dummy))
+ entry = &so->table[i];
+ while (i <= mask && (entry->key == NULL || entry->key == dummy)) {
i++;
+ entry++;
+ }
*pos_ptr = i+1;
if (i > mask)
return 0;
- assert(table[i].key != NULL);
- *entry_ptr = &table[i];
+ assert(entry != NULL);
+ *entry_ptr = entry;
return 1;
}
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list