summaryrefslogtreecommitdiff
path: root/src/analysis/blocks
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-04-06 11:09:00 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-04-06 11:09:00 (GMT)
commit944225261e872785366d1df5377f59ea917a2195 (patch)
treefb6d2c12e22f368808bfb92557d647b1e5688a8a /src/analysis/blocks
parente108e192582aa1dbe020dfbc09bee5e6ab2cc534 (diff)
Done some refactoring in order to make the code more GObject-friendly.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@506 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/blocks')
-rw-r--r--src/analysis/blocks/flow.c18
-rw-r--r--src/analysis/blocks/virtual.c17
2 files changed, 16 insertions, 19 deletions
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c
index 305dad0..99d4553 100644
--- a/src/analysis/blocks/flow.c
+++ b/src/analysis/blocks/flow.c
@@ -111,12 +111,20 @@ G_DEFINE_TYPE(GFlowBlock, g_flow_block, G_TYPE_INSTR_BLOCK);
static void g_flow_block_class_init(GFlowBlockClass *class)
{
GObjectClass *object; /* Autre version de la classe */
+ GInstrBlockClass *block_class; /* Version parente du la classe*/
object = G_OBJECT_CLASS(class);
+ block_class = G_INSTR_BLOCK_CLASS(class);
object->dispose = (GObjectFinalizeFunc/* ! */)g_flow_block_dispose;
object->finalize = (GObjectFinalizeFunc)g_flow_block_finalize;
+ block_class->find_by_addr = (find_by_addr_fc)g_flow_block_find_by_addr;
+ block_class->visit_blocks = (visit_all_blocks_fc)g_flow_block_visit;
+ block_class->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks;
+ block_class->list_leafs = (list_leafs_blocks_fc)g_flow_block_list_leafs_blocks;
+ //block_class->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses;
+
}
@@ -134,16 +142,6 @@ static void g_flow_block_class_init(GFlowBlockClass *class)
static void g_flow_block_init(GFlowBlock *block)
{
- GInstrBlock *parent; /* Instance parente */
-
- parent = G_INSTR_BLOCK(block);
-
- parent->find_by_addr = (find_by_addr_fc)g_flow_block_find_by_addr;
- parent->visit_blocks = (visit_all_blocks_fc)g_flow_block_visit;
- parent->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks;
- parent->list_leafs = (list_leafs_blocks_fc)g_flow_block_list_leafs_blocks;
- //parent->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses;
-
g_flow_block_set_rank(block, 0);
block->regs = g_raccess_list_new();
diff --git a/src/analysis/blocks/virtual.c b/src/analysis/blocks/virtual.c
index a3e1695..d5b1b5a 100644
--- a/src/analysis/blocks/virtual.c
+++ b/src/analysis/blocks/virtual.c
@@ -107,12 +107,20 @@ G_DEFINE_TYPE(GVirtualBlock, g_virtual_block, G_TYPE_INSTR_BLOCK);
static void g_virtual_block_class_init(GVirtualBlockClass *class)
{
GObjectClass *object; /* Autre version de la classe */
+ GInstrBlockClass *block_class; /* Version parente du la classe*/
object = G_OBJECT_CLASS(class);
+ block_class = G_INSTR_BLOCK_CLASS(class);
object->dispose = (GObjectFinalizeFunc/* ! */)g_virtual_block_dispose;
object->finalize = (GObjectFinalizeFunc)g_virtual_block_finalize;
+ block_class->find_by_addr = (find_by_addr_fc)g_virtual_block_find_by_addr;
+ block_class->visit_blocks = (visit_all_blocks_fc)g_virtual_block_visit;
+ block_class->list_blocks = (list_all_blocks_fc)g_virtual_block_list_all_blocks;
+ block_class->list_leafs = (list_leafs_blocks_fc)g_virtual_block_list_leafs_blocks;
+ //block_class->list_regs = (list_regs_accesses_fc)g_virtual_block_list_regs_accesses;
+
}
@@ -130,15 +138,6 @@ static void g_virtual_block_class_init(GVirtualBlockClass *class)
static void g_virtual_block_init(GVirtualBlock *block)
{
- GInstrBlock *parent; /* Instance parente */
-
- parent = G_INSTR_BLOCK(block);
-
- parent->find_by_addr = (find_by_addr_fc)g_virtual_block_find_by_addr;
- parent->visit_blocks = (visit_all_blocks_fc)g_virtual_block_visit;
- parent->list_blocks = (list_all_blocks_fc)g_virtual_block_list_all_blocks;
- parent->list_leafs = (list_leafs_blocks_fc)g_virtual_block_list_leafs_blocks;
- //parent->list_regs = (list_regs_accesses_fc)g_virtual_block_list_regs_accesses;
}