diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
commit | fb315963527f6412273829f09513325e446eb6c9 (patch) | |
tree | 361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/arm/python/v7 | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/arm/python/v7')
-rw-r--r-- | plugins/arm/python/v7/module.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/plugins/arm/python/v7/module.c b/plugins/arm/python/v7/module.c index 9188ae4..e7971bc 100644 --- a/plugins/arm/python/v7/module.c +++ b/plugins/arm/python/v7/module.c @@ -25,6 +25,10 @@ #include "module.h" +#include <plugins/pychrysalide/access.h> +#include <plugins/pychrysalide/helpers.h> + + #include "instruction.h" #include "processor.h" @@ -46,7 +50,6 @@ bool add_arch_arm_v7_module_to_python_module(PyObject *super) { bool result; /* Bilan à retourner */ PyObject *module; /* Sous-module mis en place */ - int ret; /* Bilan d'un appel */ static PyModuleDef py_chrysalide_v7_module = { @@ -59,34 +62,14 @@ bool add_arch_arm_v7_module_to_python_module(PyObject *super) }; - result = false; - - module = PyModule_Create(&py_chrysalide_v7_module); - if (module == NULL) return false; - - ret = PyState_AddModule(super, &py_chrysalide_v7_module); - if (ret != 0) goto aaamtpm_exit; - - ret = _PyImport_FixupBuiltin(module, "pychrysalide.arch.arm.v7"); - if (ret != 0) goto aaamtpm_exit; - - Py_INCREF(module); - ret = PyModule_AddObject(super, "v7", module); - if (ret != 0) goto aaamtpm_exit; - - result = true; - - result &= register_python_armv7_instruction(module); - result &= register_python_armv7_processor(module); + module = build_python_module(super, &py_chrysalide_v7_module); - aaamtpm_exit: + result = (module != NULL); - if (!result) - { - printf("something went wrong in %s...\n", __FUNCTION__); - /* ... */ + if (result) result = register_python_armv7_instruction(module); + if (result) result = register_python_armv7_processor(module); - } + assert(result); return result; |