mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Removing warnings found by gcc -Wall
This commit is contained in:
parent
92a69138b3
commit
cf703f04ad
2 changed files with 9 additions and 4 deletions
|
|
@ -141,6 +141,7 @@ PyBuffer_FromReadWriteMemory(void *ptr, int size)
|
||||||
PyObject *
|
PyObject *
|
||||||
PyBuffer_New(int size)
|
PyBuffer_New(int size)
|
||||||
{
|
{
|
||||||
|
PyObject *o;
|
||||||
PyBufferObject * b;
|
PyBufferObject * b;
|
||||||
|
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
|
|
@ -149,10 +150,10 @@ PyBuffer_New(int size)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* PyObject_New is inlined */
|
/* PyObject_New is inlined */
|
||||||
b = (PyBufferObject *) PyObject_MALLOC(sizeof(*b) + size);
|
o = PyObject_MALLOC(sizeof(*b) + size);
|
||||||
if ( b == NULL )
|
if ( o == NULL )
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
PyObject_INIT((PyObject *)b, &PyBuffer_Type);
|
b = (PyBufferObject *) PyObject_INIT(o, &PyBuffer_Type);
|
||||||
|
|
||||||
b->b_base = NULL;
|
b->b_base = NULL;
|
||||||
b->b_ptr = (void *)(b + 1);
|
b->b_ptr = (void *)(b + 1);
|
||||||
|
|
@ -162,7 +163,7 @@ PyBuffer_New(int size)
|
||||||
b->b_hash = -1;
|
b->b_hash = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (PyObject *) b;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
|
||||||
|
|
@ -1123,6 +1123,10 @@ _PyTrash_deposit_object(PyObject *op)
|
||||||
typecode = Py_TRASHCAN_FRAME;
|
typecode = Py_TRASHCAN_FRAME;
|
||||||
else if (PyTraceBack_Check(op))
|
else if (PyTraceBack_Check(op))
|
||||||
typecode = Py_TRASHCAN_TRACEBACK;
|
typecode = Py_TRASHCAN_TRACEBACK;
|
||||||
|
else /* We have a bug here -- those are the only types in GC */ {
|
||||||
|
Py_FatalError("Type not supported in GC -- internal bug");
|
||||||
|
return; /* pacify compiler -- execution never here */
|
||||||
|
}
|
||||||
op->ob_refcnt = typecode;
|
op->ob_refcnt = typecode;
|
||||||
|
|
||||||
op->ob_type = (PyTypeObject*)_PyTrash_delete_later;
|
op->ob_type = (PyTypeObject*)_PyTrash_delete_later;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue