]> granicus.if.org Git - python/commitdiff
_PyObject_GC_Malloc(): split a complicated line in two. As is, there was
authorTim Peters <tim.peters@gmail.com>
Sat, 6 Oct 2001 08:03:20 +0000 (08:03 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 6 Oct 2001 08:03:20 +0000 (08:03 +0000)
no way to talk the debugger into showing me how many bytes were being
allocated.

Modules/gcmodule.c

index 30b6839672dbda3dea6c923fd9a2b3c7665edc8f..43a7bf131f6b87751ab3e986bb19e532673641ca 100644 (file)
@@ -802,8 +802,9 @@ _PyObject_GC_Malloc(PyTypeObject *tp, int size)
 {
        PyObject *op;
 #ifdef WITH_CYCLE_GC
-       PyGC_Head *g = PyObject_MALLOC(_PyObject_VAR_SIZE(tp, size) +
-                                               sizeof(PyGC_Head));
+       const size_t nbytes = sizeof(PyGC_Head) +
+                             (size_t)_PyObject_VAR_SIZE(tp, size);
+       PyGC_Head *g = PyObject_MALLOC(nbytes);                                         
        if (g == NULL)
                return (PyObject *)PyErr_NoMemory();
        g->gc_next = NULL;