summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/format/elf/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/format/elf/elf.c')
-rw-r--r--plugins/pychrysa/format/elf/elf.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/plugins/pychrysa/format/elf/elf.c b/plugins/pychrysa/format/elf/elf.c
index 2787702..8778d56 100644
--- a/plugins/pychrysa/format/elf/elf.c
+++ b/plugins/pychrysa/format/elf/elf.c
@@ -36,6 +36,7 @@
#include "../executable.h"
#include "../../analysis/content.h"
+#include "../../helpers.h"
@@ -147,25 +148,16 @@ PyTypeObject *get_python_elf_format_type(void)
bool register_python_elf_format(PyObject *module)
{
PyTypeObject *py_elf_format_type; /* Type Python 'ElfFormat' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_elf_format_type = get_python_elf_format_type();
- py_elf_format_type->tp_base = get_python_executable_format_type();
- py_elf_format_type->tp_basicsize = py_elf_format_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_elf_format_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_ELF_FORMAT,
+ py_elf_format_type, get_python_executable_format_type()))
return false;
- Py_INCREF(py_elf_format_type);
- ret = PyModule_AddObject(module, "ElfFormat", (PyObject *)py_elf_format_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ElfFormat", G_TYPE_ELF_FORMAT, py_elf_format_type,
- Py_BuildValue("(O)", py_elf_format_type->tp_base));
-
return true;
}