summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-01-18 20:31:02 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-01-18 20:31:02 (GMT)
commit7049d816fb76611d1b1d0e566dd2350411114fa6 (patch)
treec204e00c99755ead80ec1e419746eaf0b6a4b60a /Objects
parent58eb11cf62dd04ccc2c364b62fd51b4265e2e203 (diff)
downloadcpython-7049d816fb76611d1b1d0e566dd2350411114fa6.zip
cpython-7049d816fb76611d1b1d0e566dd2350411114fa6.tar.gz
cpython-7049d816fb76611d1b1d0e566dd2350411114fa6.tar.bz2
Revert change accidentally checked in as part of a whitespace normalization
patch.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index a18f3d7..3397fbb 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -57,15 +57,13 @@ PyList_New(int size)
{
PyListObject *op;
size_t nbytes;
- int allocated_size = roundupsize(size);
-
if (size < 0) {
PyErr_BadInternalCall();
return NULL;
}
- nbytes = allocated_size * sizeof(PyObject *);
+ nbytes = size * sizeof(PyObject *);
/* Check for overflow */
- if (nbytes / sizeof(PyObject *) != (size_t)allocated_size) {
+ if (nbytes / sizeof(PyObject *) != (size_t)size) {
return PyErr_NoMemory();
}
op = PyObject_GC_New(PyListObject, &PyList_Type);
@@ -80,7 +78,7 @@ PyList_New(int size)
if (op->ob_item == NULL) {
return PyErr_NoMemory();
}
- memset(op->ob_item, 0, sizeof(*op->ob_item) * allocated_size);
+ memset(op->ob_item, 0, sizeof(*op->ob_item) * size);
}
op->ob_size = size;
_PyObject_GC_TRACK(op);
@@ -156,8 +154,7 @@ ins1(PyListObject *self, int where, PyObject *v)
return -1;
}
items = self->ob_item;
- if (roundupsize(self->ob_size) - 1 == self->ob_size || items == NULL)
- NRESIZE(items, PyObject *, self->ob_size+1);
+ NRESIZE(items, PyObject *, self->ob_size+1);
if (items == NULL) {
PyErr_NoMemory();
return -1;
@@ -1881,8 +1878,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
saved_ob_size = self->ob_size;
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));
+ self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0);
if (keyfunc != NULL) {
for (i=0 ; i < saved_ob_size ; i++) {