[Python-checkins] python/dist/src/Objects listobject.c,2.122,2.123

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年7月18日 19:35:47 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv12776/python/Objects
Modified Files:
	listobject.c 
Log Message:
Trimmed trailing whitespace.
Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.122
retrieving revision 2.123
diff -C2 -d -r2.122 -r2.123
*** listobject.c	19 Jul 2002 02:33:08 -0000	2.122
--- listobject.c	19 Jul 2002 02:35:45 -0000	2.123
***************
*** 15,19 ****
 	unsigned int n2 = (unsigned int)n >> 5;
 
! 	/* Round up: 
 	 * If n < 256, to a multiple of 8.
 	 * If n < 2048, to a multiple of 64.
--- 15,19 ----
 	unsigned int n2 = (unsigned int)n >> 5;
 
! 	/* Round up:
 	 * If n < 256, to a multiple of 8.
 	 * If n < 2048, to a multiple of 64.
***************
*** 302,306 ****
 		goto Done;
 	result = _PyString_Join(s, pieces);
! 	Py_DECREF(s);	
 
 Done:
--- 302,306 ----
 		goto Done;
 	result = _PyString_Join(s, pieces);
! 	Py_DECREF(s);
 
 Done:
***************
*** 599,603 ****
 	old_value = a->ob_item[i];
 	a->ob_item[i] = v;
! 	Py_DECREF(old_value); 
 	return 0;
 }
--- 599,603 ----
 	old_value = a->ob_item[i];
 	a->ob_item[i] = v;
! 	Py_DECREF(old_value);
 	return 0;
 }
***************
*** 929,933 ****
 
 We also play lots of low-level tricks to cut the number of compares.
! 
 Very obscure: To avoid using extra memory, the PPs are stored in the
 array and shuffled around as partitioning proceeds. At the start of a
--- 929,933 ----
 
 We also play lots of low-level tricks to cut the number of compares.
! 
 Very obscure: To avoid using extra memory, the PPs are stored in the
 array and shuffled around as partitioning proceeds. At the start of a
***************
*** 1061,1065 ****
 		 extra still makes *sense*, but may be smaller than
 		 we would like (but the array has more than ~= 2**31
! 		 elements in this case!) */ 
 	}
 	/* Now k == extra - 1 + CUTOFFBASE. The smallest value k can
--- 1061,1065 ----
 		 extra still makes *sense*, but may be smaller than
 		 we would like (but the array has more than ~= 2**31
! 		 elements in this case!) */
 	}
 	/* Now k == extra - 1 + CUTOFFBASE. The smallest value k can
***************
*** 1158,1162 ****
 		 [hi, hi+extra) contains the larger PPs.
 		*/
! 		k = extra >>= 1; /* num PPs to move */ 
 		if (extraOnRight) {
 			/* Swap the smaller PPs to the left end.
--- 1158,1162 ----
 		 [hi, hi+extra) contains the larger PPs.
 		*/
! 		k = extra >>= 1; /* num PPs to move */
 		if (extraOnRight) {
 			/* Swap the smaller PPs to the left end.
***************
*** 1712,1716 ****
 			if (!result) return NULL;
 
! 			for (cur = start, i = 0; i < slicelength; 
 			 cur += step, i++) {
 				it = PyList_GET_ITEM(self, cur);
--- 1712,1716 ----
 			if (!result) return NULL;
 
! 			for (cur = start, i = 0; i < slicelength;
 			 cur += step, i++) {
 				it = PyList_GET_ITEM(self, cur);
***************
*** 1718,1722 ****
 				PyList_SET_ITEM(result, i, it);
 			}
! 			
 			return result;
 		}
--- 1718,1722 ----
 				PyList_SET_ITEM(result, i, it);
 			}
! 
 			return result;
 		}
***************
*** 1729,1733 ****
 }
 
! static int 
 list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
 {
--- 1729,1733 ----
 }
 
! static int
 list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
 {
***************
*** 1762,1766 ****
 			PyObject **garbage, **it;
 			int cur, i, j;
! 			
 			if (slicelength <= 0)
 				return 0;
--- 1762,1766 ----
 			PyObject **garbage, **it;
 			int cur, i, j;
! 
 			if (slicelength <= 0)
 				return 0;
***************
*** 1774,1779 ****
 			garbage = (PyObject**)
 				PyMem_MALLOC(slicelength*sizeof(PyObject*));
! 			
! 			/* drawing pictures might help 
 			 understand these for loops */
 			for (cur = start, i = 0;
--- 1774,1779 ----
 			garbage = (PyObject**)
 				PyMem_MALLOC(slicelength*sizeof(PyObject*));
! 
! 			/* drawing pictures might help
 			 understand these for loops */
 			for (cur = start, i = 0;
***************
*** 1784,1788 ****
 
 				for (j = 0; j < step; j++) {
! 					PyList_SET_ITEM(self, cur + j - i, 
 						PyList_GET_ITEM(self,
 								cur + j + 1));
--- 1784,1788 ----
 
 				for (j = 0; j < step; j++) {
! 					PyList_SET_ITEM(self, cur + j - i,
 						PyList_GET_ITEM(self,
 								cur + j + 1));
***************
*** 1829,1836 ****
 
 			/* protect against a[::-1] = a */
! 			if (self == (PyListObject*)value) { 
 				value = list_slice((PyListObject*)value, 0,
 						 PyList_GET_SIZE(value));
! 			} 
 			else {
 				Py_INCREF(value);
--- 1829,1836 ----
 
 			/* protect against a[::-1] = a */
! 			if (self == (PyListObject*)value) {
 				value = list_slice((PyListObject*)value, 0,
 						 PyList_GET_SIZE(value));
! 			}
 			else {
 				Py_INCREF(value);
***************
*** 1839,1847 ****
 			garbage = (PyObject**)
 				PyMem_MALLOC(slicelength*sizeof(PyObject*));
! 			
! 			for (cur = start, i = 0; i < slicelength; 
 			 cur += step, i++) {
 				garbage[i] = PyList_GET_ITEM(self, cur);
! 				
 				ins = PyList_GET_ITEM(value, i);
 				Py_INCREF(ins);
--- 1839,1847 ----
 			garbage = (PyObject**)
 				PyMem_MALLOC(slicelength*sizeof(PyObject*));
! 
! 			for (cur = start, i = 0; i < slicelength;
 			 cur += step, i++) {
 				garbage[i] = PyList_GET_ITEM(self, cur);
! 
 				ins = PyList_GET_ITEM(value, i);
 				Py_INCREF(ins);
***************
*** 1852,1864 ****
 				Py_DECREF(garbage[i]);
 			}
! 			
 			PyMem_FREE(garbage);
 			Py_DECREF(value);
! 			
 			return 0;
 		}
! 	} 
 	else {
! 		PyErr_SetString(PyExc_TypeError, 
 				"list indices must be integers");
 		return -1;
--- 1852,1864 ----
 				Py_DECREF(garbage[i]);
 			}
! 
 			PyMem_FREE(garbage);
 			Py_DECREF(value);
! 
 			return 0;
 		}
! 	}
 	else {
! 		PyErr_SetString(PyExc_TypeError,
 				"list indices must be integers");
 		return -1;

AltStyle によって変換されたページ (->オリジナル) /