diff options
Diffstat (limited to 'plugins/pychrysalide/analysis')
-rw-r--r-- | plugins/pychrysalide/analysis/block.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/pychrysalide/analysis/block.c b/plugins/pychrysalide/analysis/block.c index 1456e15..c484ba6 100644 --- a/plugins/pychrysalide/analysis/block.c +++ b/plugins/pychrysalide/analysis/block.c @@ -25,6 +25,7 @@ #include "block.h" +#include <malloc.h> #include <pygobject.h> @@ -151,21 +152,20 @@ static PyObject *py_code_block_get_sources(PyObject *self, void *closure) PyObject *result; /* Trouvailles à retourner */ GCodeBlock *block; /* Bloc de code à consulter */ size_t count; /* Quantité de blocs liés */ + block_link_t *links; /* Liens à traiter */ size_t i; /* Boucle de parcours */ - const block_link_t *link; /* Informations conservées */ + block_link_t *link; /* Informations conservées */ PyObject *info; /* Informations à transmettre */ block = G_CODE_BLOCK(pygobject_get(self)); - g_code_block_lock_src(block); - - count = g_code_block_count_sources(block); + links = g_code_block_get_sources(block, &count); result = PyTuple_New(count); for (i = 0; i < count; i++) { - link = g_code_block_get_source(block, i); + link = &links[i]; info = PyTuple_New(2); @@ -178,7 +178,8 @@ static PyObject *py_code_block_get_sources(PyObject *self, void *closure) } - g_code_block_unlock_src(block); + if (links != NULL) + free(links); return result; @@ -203,21 +204,20 @@ static PyObject *py_code_block_get_destinations(PyObject *self, void *closure) PyObject *result; /* Trouvailles à retourner */ GCodeBlock *block; /* Bloc de code à consulter */ size_t count; /* Quantité de blocs liés */ + block_link_t *links; /* Liens à traiter */ size_t i; /* Boucle de parcours */ - const block_link_t *link; /* Informations conservées */ + block_link_t *link; /* Informations conservées */ PyObject *info; /* Informations à transmettre */ block = G_CODE_BLOCK(pygobject_get(self)); - g_code_block_lock_dest(block); - - count = g_code_block_count_destinations(block); + links = g_code_block_get_destinations(block, &count); result = PyTuple_New(count); for (i = 0; i < count; i++) { - link = g_code_block_get_destination(block, i); + link = &links[i]; info = PyTuple_New(2); @@ -230,7 +230,8 @@ static PyObject *py_code_block_get_destinations(PyObject *self, void *closure) } - g_code_block_unlock_dest(block); + if (links != NULL) + free(links); return result; |