summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/cluster.c
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 /src/gtkext/graph/cluster.c
parent2ed3c9274c8dafb660bc25743a1aac7c72c12965 (diff)
Provided uncached code block links.
Diffstat (limited to 'src/gtkext/graph/cluster.c')
-rw-r--r--src/gtkext/graph/cluster.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/gtkext/graph/cluster.c b/src/gtkext/graph/cluster.c
index 70d58fa..bc8f9dd 100644
--- a/src/gtkext/graph/cluster.c
+++ b/src/gtkext/graph/cluster.c
@@ -1712,8 +1712,9 @@ static void g_graph_cluster_add_sub(GGraphCluster *cluster, GGraphCluster *sub)
static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all)
{
size_t dcount; /* Nombre de liens de dest. */
+ block_link_t *links; /* Liens associés au bloc */
size_t i; /* Boucle de parcours #1 */
- const block_link_t *dest; /* Bloc visé par une autre */
+ block_link_t *dest; /* Bloc visé par un autre */
GGraphCluster *target; /* Bloc ciblé par un lien */
leaving_link_t *leaving; /* Point de départ d'un lien */
incoming_link_t *incoming; /* Définitions d'arrivée */
@@ -1722,12 +1723,11 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
/* Au niveau du bloc courant */
- g_code_block_lock_dest(cluster->block);
- dcount = g_code_block_count_destinations(cluster->block);
+ links = g_code_block_get_destinations(cluster->block, &dcount);
for (i = 0; i < dcount; i++)
{
- dest = g_code_block_get_destination(cluster->block, i);
+ dest = &links[i];
switch (dest->type)
{
@@ -1783,7 +1783,6 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
/* Point d'arrivée */
midpts = malloc(2 * sizeof(GdkPoint));
- midpts = calloc(2, sizeof(GdkPoint));//////////////// REMME
incoming = create_incoming_loop_link(target, midpts, leaving);
@@ -1813,9 +1812,8 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
}
- g_code_block_unlock_dest(cluster->block);
-
-
+ if (links != NULL)
+ free(links);
/* Doit-on forcer un lien strictement vertical ? */
@@ -2634,8 +2632,9 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
gboolean new; /* Bloc déjà traité ? */
#endif
size_t dcount; /* Nombre de liens de dest. */
+ block_link_t *links; /* Liens associés au bloc */
size_t i; /* Boucle de parcours #1 */
- const block_link_t *dest; /* Bloc visé par une autre */
+ block_link_t *dest; /* Bloc visé par un autre */
size_t j; /* Boucle de parcours #2 */
bool changed; /* Un ajout a été effectué ? */
const bitfield_t *dominators; /* Blocs dominant ce même bloc */
@@ -2655,12 +2654,11 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
/* Détermination des blocs suivants */
- g_code_block_lock_dest(block);
- dcount = g_code_block_count_destinations(block);
+ links = g_code_block_get_destinations(block, &dcount);
for (i = 0; i < dcount; i++)
{
- dest = g_code_block_get_destination(block, i);
+ dest = &links[i];
switch (dest->type)
{
@@ -2718,7 +2716,8 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
}
- g_code_block_unlock_dest(block);
+ if (links != NULL)
+ free(links);
g_object_unref(G_OBJECT(block));