diff options
Diffstat (limited to 'plugins/pychrysa/analysis/blocks')
-rw-r--r-- | plugins/pychrysa/analysis/blocks/flow.c | 19 | ||||
-rw-r--r-- | plugins/pychrysa/analysis/blocks/virtual.c | 16 |
2 files changed, 9 insertions, 26 deletions
diff --git a/plugins/pychrysa/analysis/blocks/flow.c b/plugins/pychrysa/analysis/blocks/flow.c index 626d5c8..aa0e3bf 100644 --- a/plugins/pychrysa/analysis/blocks/flow.c +++ b/plugins/pychrysa/analysis/blocks/flow.c @@ -32,6 +32,7 @@ #include "../block.h" +#include "../../helpers.h" @@ -177,8 +178,8 @@ bool register_python_flow_block(PyObject *module) Py_INCREF(&py_flow_block_type); ret = PyModule_AddObject(module, "FlowBlock", (PyObject *)&py_flow_block_type); - pygobject_register_class(module, "GFlowBlock", G_TYPE_FLOW_BLOCK, &py_flow_block_type, - Py_BuildValue("(O)", py_flow_block_type.tp_base)); + register_class_for_pygobject(module, "GFlowBlock", G_TYPE_FLOW_BLOCK, &py_flow_block_type, + Py_BuildValue("(O)", py_flow_block_type.tp_base)); return (ret == 0); @@ -261,25 +262,15 @@ PyTypeObject *get_python_flow_block_type(void) bool register_python_flow_block(PyObject *module) { PyTypeObject *py_flow_block_type; /* Type Python 'FlowBlock' */ - int ret; /* Bilan d'un appel */ PyObject *dict; /* Dictionnaire du module */ py_flow_block_type = get_python_flow_block_type(); - py_flow_block_type->tp_base = get_python_instr_block_type(); - py_flow_block_type->tp_basicsize = py_flow_block_type->tp_base->tp_basicsize; + dict = PyModule_GetDict(module); - if (PyType_Ready(py_flow_block_type) != 0) + if (!register_class_for_pygobject(dict, G_TYPE_FLOW_BLOCK, py_flow_block_type, get_python_instr_block_type())) return false; - Py_INCREF(py_flow_block_type); - ret = PyModule_AddObject(module, "FlowBlock", (PyObject *)py_flow_block_type); - if (ret != 0) return false; - - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "FlowBlock", G_TYPE_FLOW_BLOCK, py_flow_block_type, - Py_BuildValue("(O)", py_flow_block_type->tp_base)); - return true; } diff --git a/plugins/pychrysa/analysis/blocks/virtual.c b/plugins/pychrysa/analysis/blocks/virtual.c index bdc81b0..6a35925 100644 --- a/plugins/pychrysa/analysis/blocks/virtual.c +++ b/plugins/pychrysa/analysis/blocks/virtual.c @@ -32,6 +32,7 @@ #include "../block.h" +#include "../../helpers.h" @@ -92,25 +93,16 @@ PyTypeObject *get_python_virtual_block_type(void) bool register_python_virtual_block(PyObject *module) { PyTypeObject *py_virtual_block_type; /* Type Python 'VirtualBlock' */ - int ret; /* Bilan d'un appel */ PyObject *dict; /* Dictionnaire du module */ py_virtual_block_type = get_python_virtual_block_type(); - py_virtual_block_type->tp_base = get_python_instr_block_type(); - py_virtual_block_type->tp_basicsize = py_virtual_block_type->tp_base->tp_basicsize; + dict = PyModule_GetDict(module); - if (PyType_Ready(py_virtual_block_type) != 0) + if (!register_class_for_pygobject(dict, G_TYPE_VIRTUAL_BLOCK, + py_virtual_block_type, get_python_instr_block_type())) return false; - Py_INCREF(py_virtual_block_type); - ret = PyModule_AddObject(module, "VirtualBlock", (PyObject *)py_virtual_block_type); - if (ret != 0) return false; - - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "VirtualBlock", G_TYPE_VIRTUAL_BLOCK, py_virtual_block_type, - Py_BuildValue("(O)", py_virtual_block_type->tp_base)); - return true; } |