[Python-checkins] python/dist/src/Objects listobject.c,2.175,2.176

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sun Jan 18 15:29:57 EST 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv17688/Objects

Modified Files:
	listobject.c 
Log Message:
Whitespace normalization.


Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.175
retrieving revision 2.176
diff -C2 -d -r2.175 -r2.176
*** listobject.c	4 Jan 2004 06:08:16 -0000	2.175
--- listobject.c	18 Jan 2004 20:29:55 -0000	2.176
***************
*** 58,68 ****
  	PyListObject *op;
  	size_t nbytes;
  	if (size < 0) {
  		PyErr_BadInternalCall();
  		return NULL;
  	}
! 	nbytes = size * sizeof(PyObject *);
  	/* Check for overflow */
! 	if (nbytes / sizeof(PyObject *) != (size_t)size) {
  		return PyErr_NoMemory();
  	}
--- 58,70 ----
  	PyListObject *op;
  	size_t nbytes;
+ 	int allocated_size = roundupsize(size);
+ 
  	if (size < 0) {
  		PyErr_BadInternalCall();
  		return NULL;
  	}
! 	nbytes = allocated_size * sizeof(PyObject *);
  	/* Check for overflow */
! 	if (nbytes / sizeof(PyObject *) != (size_t)allocated_size) {
  		return PyErr_NoMemory();
  	}
***************
*** 79,83 ****
  			return PyErr_NoMemory();
  		}
! 		memset(op->ob_item, 0, sizeof(*op->ob_item) * size);
  	}
  	op->ob_size = size;
--- 81,85 ----
  			return PyErr_NoMemory();
  		}
! 		memset(op->ob_item, 0, sizeof(*op->ob_item) * allocated_size);
  	}
  	op->ob_size = size;
***************
*** 155,159 ****
  	}
  	items = self->ob_item;
! 	NRESIZE(items, PyObject *, self->ob_size+1);
  	if (items == NULL) {
  		PyErr_NoMemory();
--- 157,162 ----
  	}
  	items = self->ob_item;
! 	if (roundupsize(self->ob_size) - 1 == self->ob_size || items == NULL)
! 		NRESIZE(items, PyObject *, self->ob_size+1);
  	if (items == NULL) {
  		PyErr_NoMemory();
***************
*** 1879,1883 ****
  	saved_ob_item = self->ob_item;
  	self->ob_size = 0;
! 	self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0);
  
  	if (keyfunc != NULL) {
--- 1882,1887 ----
  	saved_ob_item = self->ob_item;
  	self->ob_size = 0;
! /*	self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0); */
! 	self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, roundupsize(0));
  
  	if (keyfunc != NULL) {





More information about the Python-checkins mailing list