diff options
author | Raymond Hettinger <python@rcn.com> | 2013-08-15 09:18:55 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2013-08-15 09:18:55 (GMT) |
commit | 8ad39195775af35c16e4b03b6aa55f131981664e (patch) | |
tree | c4e7882c08345303045409d8b36856be0d2af6a8 | |
parent | 8e4554027b8ba1e6fc3b9e1a67d3333a3399a6d6 (diff) | |
download | cpython-8ad39195775af35c16e4b03b6aa55f131981664e.zip cpython-8ad39195775af35c16e4b03b6aa55f131981664e.tar.gz cpython-8ad39195775af35c16e4b03b6aa55f131981664e.tar.bz2 |
Hoist the global "dummy" lookup outside of the reinsertion loop.
-rw-r--r-- | Objects/setobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index eff91c5..ac501b6 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -280,6 +280,7 @@ set_table_resize(PySetObject *so, Py_ssize_t minused) Py_ssize_t i; int is_oldtable_malloced; setentry small_copy[PySet_MINSIZE]; + PyObject *dummy_entry; assert(minused >= 0); @@ -336,11 +337,12 @@ set_table_resize(PySetObject *so, Py_ssize_t minused) /* Copy the data over; this is refcount-neutral for active entries; dummy entries aren't copied over, of course */ + dummy_entry = dummy; for (entry = oldtable; i > 0; entry++) { if (entry->key == NULL) { /* UNUSED */ ; - } else if (entry->key == dummy) { + } else if (entry->key == dummy_entry) { /* DUMMY */ --i; assert(entry->key == dummy); |