diff options
Diffstat (limited to 'plugins/elf')
-rw-r--r-- | plugins/elf/python/module.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/plugins/elf/python/module.c b/plugins/elf/python/module.c index f986659..5655c18 100644 --- a/plugins/elf/python/module.c +++ b/plugins/elf/python/module.c @@ -29,6 +29,7 @@ #include <plugins/pychrysalide/access.h> +#include <plugins/pychrysalide/helpers.h> #include "format.h" @@ -52,7 +53,6 @@ bool add_format_elf_module_to_python_module(void) bool result; /* Bilan à retourner */ PyObject *super; /* Module à compléter */ PyObject *module; /* Sous-module mis en place */ - int ret; /* Bilan d'un appel */ static PyModuleDef py_chrysalide_elf_module = { @@ -69,22 +69,13 @@ bool add_format_elf_module_to_python_module(void) super = get_access_to_python_module("pychrysalide.format"); - module = PyModule_Create(&py_chrysalide_elf_module); - if (module == NULL) return false; + module = build_python_module(super, &py_chrysalide_elf_module); - ret = PyState_AddModule(super, &py_chrysalide_elf_module); - if (ret != 0) goto loading_failed; + result = (module != NULL); - ret = _PyImport_FixupBuiltin(module, "pychrysalide.format.elf"); - if (ret != 0) goto loading_failed; + if (result) result = register_python_elf_format(module); - Py_INCREF(module); - ret = PyModule_AddObject(super, "elf", module); - if (ret != 0) goto loading_failed; - - result = register_python_elf_format(module); - - loading_failed: + assert(result); return result; |