summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.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/tupleobject.c
parent8d617a60b1d183af24278be8dc1597ee19fe7931 (diff)
downloadcpython-5fe605889a52bc2a34e1d883df14e6cc56ee87a3.zip
cpython-5fe605889a52bc2a34e1d883df14e6cc56ee87a3.tar.gz
cpython-5fe605889a52bc2a34e1d883df14e6cc56ee87a3.tar.bz2
a few peephole optimizations
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 1e5ea13..69c4f95 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -119,9 +119,10 @@ int
settupleitem(op, i, newitem)
register object *op;
register int i;
- register object *newitem;
+ object *newitem;
{
register object *olditem;
+ register object **p;
if (!is_tupleobject(op)) {
XDECREF(newitem);
err_badcall();
@@ -132,8 +133,9 @@ settupleitem(op, i, newitem)
err_setstr(IndexError, "tuple assignment index out of range");
return -1;
}
- olditem = ((tupleobject *)op) -> ob_item[i];
- ((tupleobject *)op) -> ob_item[i] = newitem;
+ p = ((tupleobject *)op) -> ob_item + i;
+ olditem = *p;
+ *p = newitem;
XDECREF(olditem);
return 0;
}