summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-03-12 15:30:38 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-03-12 15:30:38 (GMT)
commit6e058d70efb0acbcc19567f9711e14314c8f20e2 (patch)
treea55f766ee4c6366723f756970eb8906fdc5c9cad /Objects
parent2d783e9b16e5500d4ef6a2783b92051fe9fed154 (diff)
downloadcpython-6e058d70efb0acbcc19567f9711e14314c8f20e2.zip
cpython-6e058d70efb0acbcc19567f9711e14314c8f20e2.tar.gz
cpython-6e058d70efb0acbcc19567f9711e14314c8f20e2.tar.bz2
* Eliminate duplicate call to PyObject_Size().
(Spotted by Michael Hudson.) * Now that "selflen" is no longer inside a loop, it should not be a register variable.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 78def29..9ee5756 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -650,12 +650,13 @@ listappend(PyListObject *self, PyObject *v)
static int
listextend_internal(PyListObject *self, PyObject *b)
{
- register int selflen = PyList_GET_SIZE(self);
+ int selflen = PyList_GET_SIZE(self);
int blen;
register int i;
PyObject **src, **dest;
- if (PyObject_Size(b) == 0) {
+ blen = PyObject_Size(b);
+ if (blen == 0) {
/* short circuit when b is empty */
Py_DECREF(b);
return 0;
@@ -679,7 +680,6 @@ listextend_internal(PyListObject *self, PyObject *b)
}
}
- blen = PyObject_Size(b);
if (list_resize(self, selflen + blen) == -1) {
Py_DECREF(b);
return -1;