summaryrefslogtreecommitdiff
path: root/gi/pygi-boxed.c
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2010-08-16 21:14:27 -0400
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-25 10:57:24 +0200
commit1ff83a2ccb7301c8f675913f1c4f6118ea50b9c7 (patch)
treed5bd66f633b93e480ecdfc4dc8eabc59dbb84179 /gi/pygi-boxed.c
parent1efa2b12913b194d433c17014bc1077271a6ca32 (diff)
downloadpygobject-1ff83a2ccb7301c8f675913f1c4f6118ea50b9c7.tar.gz
convert to using PYGLIB_DEFINE_TYPE for module objects
https://bugzilla.gnome.org/show_bug.cgi?id=615872
Diffstat (limited to 'gi/pygi-boxed.c')
-rw-r--r--gi/pygi-boxed.c43
1 files changed, 6 insertions, 37 deletions
diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c
index 5edd25ee..2fd446c5 100644
--- a/gi/pygi-boxed.c
+++ b/gi/pygi-boxed.c
@@ -45,7 +45,7 @@ _boxed_dealloc (PyGIBoxed *self)
}
}
- ( (PyGObject *) self)->ob_type->tp_free ( (PyObject *) self);
+ Py_TYPE( (PyGObject *) self)->tp_free ( (PyObject *) self);
}
void *
@@ -133,41 +133,7 @@ _boxed_init (PyObject *self,
return 0;
}
-
-PyTypeObject PyGIBoxed_Type = {
- PyObject_HEAD_INIT (NULL)
- 0,
- "gi.Boxed", /* tp_name */
- sizeof (PyGIBoxed), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor) _boxed_dealloc, /* tp_dealloc */
- (printfunc) NULL, /* tp_print */
- (getattrfunc) NULL, /* tp_getattr */
- (setattrfunc) NULL, /* tp_setattr */
- (cmpfunc) NULL, /* tp_compare */
- (reprfunc) NULL, /* tp_repr */
- NULL, /* tp_as_number */
- NULL, /* tp_as_sequence */
- NULL, /* tp_as_mapping */
- (hashfunc) NULL, /* tp_hash */
- (ternaryfunc) NULL, /* tp_call */
- (reprfunc) NULL, /* tp_str */
- (getattrofunc) NULL, /* tp_getattro */
- (setattrofunc) NULL, /* tp_setattro */
- NULL, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- NULL, /* tp_doc */
- (traverseproc) NULL, /* tp_traverse */
- (inquiry) NULL, /* tp_clear */
- (richcmpfunc) NULL, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- (getiterfunc) NULL, /* tp_iter */
- (iternextfunc) NULL, /* tp_iternext */
- NULL, /* tp_methods */
- NULL, /* tp_members */
- NULL, /* tp_getset */
- (PyTypeObject *) NULL, /* tp_base */
-};
+PYGLIB_DEFINE_TYPE("gi.Boxed", PyGIBoxed_Type, PyGIBoxed);
PyObject *
_pygi_boxed_new (PyTypeObject *type,
@@ -202,10 +168,13 @@ _pygi_boxed_new (PyTypeObject *type,
void
_pygi_boxed_register_types (PyObject *m)
{
- PyGIBoxed_Type.ob_type = &PyType_Type;
+ Py_TYPE(&PyGIBoxed_Type) = &PyType_Type;
PyGIBoxed_Type.tp_base = &PyGBoxed_Type;
PyGIBoxed_Type.tp_new = (newfunc) _boxed_new;
PyGIBoxed_Type.tp_init = (initproc) _boxed_init;
+ PyGIBoxed_Type.tp_dealloc = (destructor) _boxed_dealloc;
+ PyGIBoxed_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE);
+
if (PyType_Ready (&PyGIBoxed_Type))
return;
if (PyModule_AddObject (m, "Boxed", (PyObject *) &PyGIBoxed_Type))