diff options
Diffstat (limited to 'Mac/Modules/list')
-rw-r--r-- | Mac/Modules/list/_Listmodule.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c index bfea8a3..21a7f02 100644 --- a/Mac/Modules/list/_Listmodule.c +++ b/Mac/Modules/list/_Listmodule.c @@ -50,9 +50,9 @@ PyObject *ListObj_New(ListHandle itself) { ListObject *it; if (itself == NULL) { - PyErr_SetString(List_Error,"Cannot create null List"); - return NULL; - } + PyErr_SetString(List_Error,"Cannot create null List"); + return NULL; + } it = PyObject_NEW(ListObject, &List_Type); if (it == NULL) return NULL; it->ob_itself = itself; @@ -61,6 +61,7 @@ PyObject *ListObj_New(ListHandle itself) SetListRefCon(itself, (long)it); return (PyObject *)it; } + int ListObj_Convert(PyObject *v, ListHandle *p_itself) { if (!ListObj_Check(v)) @@ -738,16 +739,16 @@ static PyGetSetDef ListObj_getsetlist[] = { #define ListObj_tp_alloc PyType_GenericAlloc -static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) { - PyObject *self; + PyObject *_self; ListHandle itself; char *kw[] = {"itself", 0}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ListObj_Convert, &itself)) return NULL; - if ((self = type->tp_alloc(type, 0)) == NULL) return NULL; - ((ListObject *)self)->ob_itself = itself; - return self; + if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ListObj_Convert, &itself)) return NULL; + if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; + ((ListObject *)_self)->ob_itself = itself; + return _self; } #define ListObj_tp_free PyObject_Del @@ -826,10 +827,10 @@ static PyObject *List_CreateCustomList(PyObject *_self, PyObject *_args) &hasGrow, &scrollHoriz, &scrollVert)) - return NULL; + return NULL; - /* Carbon applications use the CreateCustomList API */ + /* Carbon applications use the CreateCustomList API */ theSpec.u.userProc = myListDefFunctionUPP; CreateCustomList(&rView, &dataBounds, @@ -845,7 +846,7 @@ static PyObject *List_CreateCustomList(PyObject *_self, PyObject *_args) _res = ListObj_New(outList); if (_res == NULL) - return NULL; + return NULL; Py_INCREF(listDefFunc); ((ListObject*)_res)->ob_ldef_func = listDefFunc; return _res; @@ -1024,7 +1025,7 @@ static PyObject *List_as_List(PyObject *_self, PyObject *_args) Handle h; ListObject *l; if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h)) - return NULL; + return NULL; l = (ListObject *)ListObj_New(as_List(h)); l->ob_must_be_disposed = 0; _res = Py_BuildValue("O", l); @@ -1066,34 +1067,34 @@ static void myListDefFunction(SInt16 message, Cell theCell, SInt16 dataOffset, SInt16 dataLen, - ListHandle theList) + ListHandle theList) { - PyObject *listDefFunc, *args, *rv=NULL; - ListObject *self; - - self = (ListObject*)GetListRefCon(theList); - if (self == NULL || self->ob_itself != theList) - return; /* nothing we can do */ - listDefFunc = self->ob_ldef_func; - if (listDefFunc == NULL) - return; /* nothing we can do */ - args = Py_BuildValue("hbO&O&hhO", message, - selected, - PyMac_BuildRect, cellRect, - PyMac_BuildPoint, theCell, - dataOffset, - dataLen, - self); - if (args != NULL) { - rv = PyEval_CallObject(listDefFunc, args); - Py_DECREF(args); - } - if (rv == NULL) { - PySys_WriteStderr("error in list definition callback:\n"); - PyErr_Print(); - } else { - Py_DECREF(rv); - } + PyObject *listDefFunc, *args, *rv=NULL; + ListObject *self; + + self = (ListObject*)GetListRefCon(theList); + if (self == NULL || self->ob_itself != theList) + return; /* nothing we can do */ + listDefFunc = self->ob_ldef_func; + if (listDefFunc == NULL) + return; /* nothing we can do */ + args = Py_BuildValue("hbO&O&hhO", message, + selected, + PyMac_BuildRect, cellRect, + PyMac_BuildPoint, theCell, + dataOffset, + dataLen, + self); + if (args != NULL) { + rv = PyEval_CallObject(listDefFunc, args); + Py_DECREF(args); + } + if (rv == NULL) { + PySys_WriteStderr("error in list definition callback:\n"); + PyErr_Print(); + } else { + Py_DECREF(rv); + } } |