diff options
author | Guido van Rossum <guido@python.org> | 1995-03-09 12:12:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-03-09 12:12:50 (GMT) |
commit | 5fe605889a52bc2a34e1d883df14e6cc56ee87a3 (patch) | |
tree | 338857070fb7a49a861c7dbb33fd47200ba35324 /Objects/tupleobject.c | |
parent | 8d617a60b1d183af24278be8dc1597ee19fe7931 (diff) | |
download | cpython-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.c | 8 |
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; } |