summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-09 12:12:50 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-09 12:12:50 (GMT)
commit5fe605889a52bc2a34e1d883df14e6cc56ee87a3 (patch)
tree338857070fb7a49a861c7dbb33fd47200ba35324 /Objects/listobject.c
parent8d617a60b1d183af24278be8dc1597ee19fe7931 (diff)
downloadcpython-5fe605889a52bc2a34e1d883df14e6cc56ee87a3.zip
cpython-5fe605889a52bc2a34e1d883df14e6cc56ee87a3.tar.gz
cpython-5fe605889a52bc2a34e1d883df14e6cc56ee87a3.tar.bz2
a few peephole optimizations
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index a367ed1..44003bc 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -120,6 +120,7 @@ setlistitem(op, i, newitem)
register object *newitem;
{
register object *olditem;
+ register object **p;
if (!is_listobject(op)) {
XDECREF(newitem);
err_badcall();
@@ -130,8 +131,9 @@ setlistitem(op, i, newitem)
err_setstr(IndexError, "list assignment index out of range");
return -1;
}
- olditem = ((listobject *)op) -> ob_item[i];
- ((listobject *)op) -> ob_item[i] = newitem;
+ p = ((listobject *)op) -> ob_item + i;
+ olditem = *p;
+ *p = newitem;
XDECREF(olditem);
return 0;
}