diff options
Diffstat (limited to 'plugins/pychrysa/format/dex')
-rw-r--r-- | plugins/pychrysa/format/dex/class.c | 17 | ||||
-rw-r--r-- | plugins/pychrysa/format/dex/dex.c | 16 |
2 files changed, 9 insertions, 24 deletions
diff --git a/plugins/pychrysa/format/dex/class.c b/plugins/pychrysa/format/dex/class.c index 1741b52..59dfe44 100644 --- a/plugins/pychrysa/format/dex/class.c +++ b/plugins/pychrysa/format/dex/class.c @@ -31,6 +31,9 @@ #include <format/dex/class.h> +#include "../../helpers.h" + + /****************************************************************************** * * @@ -90,25 +93,15 @@ PyTypeObject *get_python_dex_class_type(void) bool register_python_dex_class(PyObject *module) { PyTypeObject *py_dex_class_type; /* Type Python 'DexClass' */ - int ret; /* Bilan d'un appel */ PyObject *dict; /* Dictionnaire du module */ py_dex_class_type = get_python_dex_class_type(); - py_dex_class_type->tp_base = &PyGObject_Type; - py_dex_class_type->tp_basicsize = py_dex_class_type->tp_base->tp_basicsize; + dict = PyModule_GetDict(module); - if (PyType_Ready(py_dex_class_type) != 0) + if (!register_class_for_pygobject(dict, G_TYPE_DEX_CLASS, py_dex_class_type, &PyGObject_Type)) return false; - Py_INCREF(py_dex_class_type); - ret = PyModule_AddObject(module, "DexClass", (PyObject *)py_dex_class_type); - if (ret != 0) return false; - - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "DexClass", G_TYPE_DEX_CLASS, py_dex_class_type, - Py_BuildValue("(O)", py_dex_class_type->tp_base)); - return true; } diff --git a/plugins/pychrysa/format/dex/dex.c b/plugins/pychrysa/format/dex/dex.c index dac6c90..6bb1888 100644 --- a/plugins/pychrysa/format/dex/dex.c +++ b/plugins/pychrysa/format/dex/dex.c @@ -34,6 +34,7 @@ #include "../executable.h" #include "../../analysis/content.h" +#include "../../helpers.h" @@ -239,25 +240,16 @@ PyTypeObject *get_python_dex_format_type(void) bool register_python_dex_format(PyObject *module) { PyTypeObject *py_dex_format_type; /* Type Python 'DexFormat' */ - int ret; /* Bilan d'un appel */ PyObject *dict; /* Dictionnaire du module */ py_dex_format_type = get_python_dex_format_type(); - py_dex_format_type->tp_base = get_python_executable_format_type(); - py_dex_format_type->tp_basicsize = py_dex_format_type->tp_base->tp_basicsize; + dict = PyModule_GetDict(module); - if (PyType_Ready(py_dex_format_type) != 0) + if (!register_class_for_pygobject(dict, G_TYPE_DEX_FORMAT, + py_dex_format_type, get_python_executable_format_type())) return false; - Py_INCREF(py_dex_format_type); - ret = PyModule_AddObject(module, "DexFormat", (PyObject *)py_dex_format_type); - if (ret != 0) return false; - - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "DexFormat", G_TYPE_DEX_FORMAT, py_dex_format_type, - Py_BuildValue("(O)", py_dex_format_type->tp_base)); - return true; } |