diff options
Diffstat (limited to 'plugins/pychrysa/arch/instruction.c')
-rw-r--r-- | plugins/pychrysa/arch/instruction.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/plugins/pychrysa/arch/instruction.c b/plugins/pychrysa/arch/instruction.c index 2a06ede..5e4c19d 100644 --- a/plugins/pychrysa/arch/instruction.c +++ b/plugins/pychrysa/arch/instruction.c @@ -369,26 +369,16 @@ PyTypeObject *get_python_arch_instruction_type(void) bool register_python_arch_instruction(PyObject *module) { PyTypeObject *py_arch_instruction_type; /* Type Python 'BinContent' */ - int ret; /* Bilan d'un appel */ PyObject *dict; /* Dictionnaire du module */ py_arch_instruction_type = get_python_arch_instruction_type(); - py_arch_instruction_type->tp_base = &PyGObject_Type; - py_arch_instruction_type->tp_basicsize = py_arch_instruction_type->tp_base->tp_basicsize; - APPLY_ABSTRACT_FLAG(py_arch_instruction_type); - if (PyType_Ready(py_arch_instruction_type) != 0) - return false; - - Py_INCREF(py_arch_instruction_type); - ret = PyModule_AddObject(module, "ArchInstruction", (PyObject *)py_arch_instruction_type); - if (ret != 0) return false; - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "ArchInstruction", G_TYPE_ARCH_INSTRUCTION, py_arch_instruction_type, - Py_BuildValue("(O)", py_arch_instruction_type->tp_base)); + + if (!register_class_for_pygobject(dict, G_TYPE_ARCH_INSTRUCTION, py_arch_instruction_type, &PyGObject_Type)) + return false; return true; @@ -781,7 +771,7 @@ bool register_python_arch_instruction(PyObject *module) Py_INCREF(&py_arch_instruction_type); ret = PyModule_AddObject(module, "ArchInstruction", (PyObject *)&py_arch_instruction_type); - pygobject_register_class(module, "GArchInstruction", G_TYPE_ARCH_INSTRUCTION, + register_class_for_pygobject(module, "GArchInstruction", G_TYPE_ARCH_INSTRUCTION, &py_arch_instruction_type, Py_BuildValue("(O)", py_arch_instruction_type.tp_base)); |