summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis/db/items
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-07-17 16:36:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-07-17 16:36:21 (GMT)
commit24d3836fcf8d443eb654b981f65478cd9923b8f1 (patch)
tree7672a28b864127e8958c3c6cce751dcf646d2fbe /plugins/pychrysa/analysis/db/items
parenta61f089babe336b012da31a494b0f7470b6e1a9a (diff)
Updated the Python bindings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@552 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/analysis/db/items')
-rw-r--r--plugins/pychrysa/analysis/db/items/comment.c5
-rw-r--r--plugins/pychrysa/analysis/db/items/module.c18
2 files changed, 12 insertions, 11 deletions
diff --git a/plugins/pychrysa/analysis/db/items/comment.c b/plugins/pychrysa/analysis/db/items/comment.c
index 1bb2863..951f6ce 100644
--- a/plugins/pychrysa/analysis/db/items/comment.c
+++ b/plugins/pychrysa/analysis/db/items/comment.c
@@ -75,6 +75,9 @@ static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject
ret = PyArg_ParseTuple(args, "Osp", &py_vmpa, &text, &is_volatile);
if (!ret) Py_RETURN_NONE;
+ ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type());
+ if (!ret) return NULL;
+
addr = get_internal_vmpa(py_vmpa);
if (py_vmpa == NULL) Py_RETURN_NONE;
@@ -114,7 +117,7 @@ static PyObject *py_db_comment_get_text(PyObject *self, void *closure)
}
-/*********************d*********************************************************
+/******************************************************************************
* *
* Paramètres : self = objet Python concerné par l'appel. *
* value = valeur fournie à intégrer ou prendre en compte. *
diff --git a/plugins/pychrysa/analysis/db/items/module.c b/plugins/pychrysa/analysis/db/items/module.c
index 3c634e3..009e823 100644
--- a/plugins/pychrysa/analysis/db/items/module.c
+++ b/plugins/pychrysa/analysis/db/items/module.c
@@ -25,6 +25,9 @@
#include "module.h"
+#include <assert.h>
+
+
#include "comment.h"
@@ -64,27 +67,22 @@ bool add_analysis_db_items_module_to_python_module(PyObject *super)
if (module == NULL) return false;
ret = PyState_AddModule(super, &py_chrysalide_items_module);
- if (ret != 0) goto aadimtpm_exit;
+ if (ret != 0) goto loading_failed;
ret = _PyImport_FixupBuiltin(module, "pychrysalide.analysis.db.items");
- if (ret != 0) goto aadimtpm_exit;
+ if (ret != 0) goto loading_failed;
Py_INCREF(module);
ret = PyModule_AddObject(super, "items", module);
- if (ret != 0) goto aadimtpm_exit;
+ if (ret != 0) goto loading_failed;
result = true;
result &= register_python_db_comment(module);
- aadimtpm_exit:
-
- if (!result)
- {
- printf("something went wrong in %s...\n", __FUNCTION__);
- /* ... */
+ loading_failed:
- }
+ assert(result);
return result;