[Python-checkins] python/dist/src/Objects listobject.c,2.194,2.195

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Mar 12 10:30:41 EST 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10397

Modified Files:
	listobject.c 
Log Message:
* 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.



Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.194
retrieving revision 2.195
diff -C2 -d -r2.194 -r2.195
*** listobject.c	12 Mar 2004 08:04:00 -0000	2.194
--- listobject.c	12 Mar 2004 15:30:38 -0000	2.195
***************
*** 651,660 ****
  listextend_internal(PyListObject *self, PyObject *b)
  {
! 	register int selflen = PyList_GET_SIZE(self);
  	int blen;
  	register int i;
  	PyObject **src, **dest;
  
! 	if (PyObject_Size(b) == 0) {
  		/* short circuit when b is empty */
  		Py_DECREF(b);
--- 651,661 ----
  listextend_internal(PyListObject *self, PyObject *b)
  {
! 	int selflen = PyList_GET_SIZE(self);
  	int blen;
  	register int i;
  	PyObject **src, **dest;
  
! 	blen = PyObject_Size(b);
! 	if (blen == 0) {
  		/* short circuit when b is empty */
  		Py_DECREF(b);
***************
*** 680,684 ****
  	}
  
- 	blen = PyObject_Size(b);
  	if (list_resize(self, selflen + blen) == -1) {
  		Py_DECREF(b);
--- 681,684 ----




More information about the Python-checkins mailing list