summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-13 23:44:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-13 23:44:21 (GMT)
commit2a6d92e2d55c0a7826137b2cc2e3148bb298abb9 (patch)
tree55714d85528a4cbe15e802b8a7bc2cdbf861c744 /plugins/pychrysalide/analysis
parent2ed3c9274c8dafb660bc25743a1aac7c72c12965 (diff)
Provided uncached code block links.
Diffstat (limited to 'plugins/pychrysalide/analysis')
-rw-r--r--plugins/pychrysalide/analysis/block.c25
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;