diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-11-24 21:12:48 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-11-24 21:12:48 (GMT) |
commit | 16f9d3b943e272112e01f5bc51e922e2ea2ddfb8 (patch) | |
tree | 293ed29545a7e097d3b70d3d95d513fc25866fd1 /src/arch/dalvik/operands/target.c | |
parent | 532fc81565104f64b33b3ac94dfcf0762209f751 (diff) |
Cleaned operands, using class functions and destructors.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@426 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik/operands/target.c')
-rw-r--r-- | src/arch/dalvik/operands/target.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/src/arch/dalvik/operands/target.c b/src/arch/dalvik/operands/target.c index f53bb7b..147aaae 100644 --- a/src/arch/dalvik/operands/target.c +++ b/src/arch/dalvik/operands/target.c @@ -52,6 +52,12 @@ static void g_dalvik_target_operand_class_init(GDalvikTargetOperandClass *); /* Initialise une instance d'opérande de ciblage de code Dalvik. */ static void g_dalvik_target_operand_init(GDalvikTargetOperand *); +/* Supprime toutes les références externes. */ +static void g_dalvik_target_operand_dispose(GDalvikTargetOperand *); + +/* Procède à la libération totale de la mémoire. */ +static void g_dalvik_target_operand_finalize(GDalvikTargetOperand *); + /* Traduit un opérande en version humainement lisible. */ static void g_dalvik_target_operand_print(const GDalvikTargetOperand *, GBufferLine *, AsmSyntax); @@ -75,6 +81,16 @@ G_DEFINE_TYPE(GDalvikTargetOperand, g_dalvik_target_operand, G_TYPE_ARCH_OPERAND static void g_dalvik_target_operand_class_init(GDalvikTargetOperandClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + GArchOperandClass *operand; /* Version de classe parente */ + + object = G_OBJECT_CLASS(klass); + operand = G_ARCH_OPERAND_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_target_operand_dispose; + object->finalize = (GObjectFinalizeFunc)g_dalvik_target_operand_finalize; + + operand->print = (operand_print_fc)g_dalvik_target_operand_print; } @@ -93,11 +109,46 @@ static void g_dalvik_target_operand_class_init(GDalvikTargetOperandClass *klass) static void g_dalvik_target_operand_init(GDalvikTargetOperand *operand) { - GArchOperand *parent; /* Instance parente */ - parent = G_ARCH_OPERAND(operand); +} + + +/****************************************************************************** +* * +* Paramètres : binary = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_dalvik_target_operand_dispose(GDalvikTargetOperand *operand) +{ + g_object_unref(G_OBJECT(operand->immediate)); + + G_OBJECT_CLASS(g_dalvik_target_operand_parent_class)->dispose(G_OBJECT(operand)); + +} - parent->print = (operand_print_fc)g_dalvik_target_operand_print; + +/****************************************************************************** +* * +* Paramètres : binary = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_dalvik_target_operand_finalize(GDalvikTargetOperand *operand) +{ + G_OBJECT_CLASS(g_dalvik_target_operand_parent_class)->finalize(G_OBJECT(operand)); } |