summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2017-02-02 16:24:48 (GMT)
committerRaymond Hettinger <python@rcn.com>2017-02-02 16:24:48 (GMT)
commite1af6964b48671e3ac47ee60688a1b74fa272845 (patch)
treed48b98ee22b5514aa10f98ee57b235a764bcb0fe /Objects/setobject.c
parent196a7bc1ea8842b8c73954a625a0f5a80ef011b9 (diff)
downloadcpython-e1af6964b48671e3ac47ee60688a1b74fa272845.zip
cpython-e1af6964b48671e3ac47ee60688a1b74fa272845.tar.gz
cpython-e1af6964b48671e3ac47ee60688a1b74fa272845.tar.bz2
Remove unnecessary variables.
* so->used never gets changed during a resize * so->filled only changes when dummies are present and being eliminated
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 59ed795..c72c0fa 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -296,8 +296,6 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
{
Py_ssize_t newsize;
setentry *oldtable, *newtable, *entry;
- Py_ssize_t oldfill = so->fill;
- Py_ssize_t oldused = so->used;
Py_ssize_t oldmask = so->mask;
size_t newmask;
int is_oldtable_malloced;
@@ -352,21 +350,20 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
/* Make the set empty, using the new table. */
assert(newtable != oldtable);
memset(newtable, 0, sizeof(setentry) * newsize);
- so->fill = oldused;
- so->used = oldused;
so->mask = newsize - 1;
so->table = newtable;
/* Copy the data over; this is refcount-neutral for active entries;
dummy entries aren't copied over, of course */
newmask = (size_t)so->mask;
- if (oldfill == oldused) {
+ if (so->fill == so->used) {
for (entry = oldtable; entry <= oldtable + oldmask; entry++) {
if (entry->key != NULL) {
set_insert_clean(newtable, newmask, entry->key, entry->hash);
}
}
} else {
+ so->fill = so->used;
for (entry = oldtable; entry <= oldtable + oldmask; entry++) {
if (entry->key != NULL && entry->key != dummy) {
set_insert_clean(newtable, newmask, entry->key, entry->hash);