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/immediate.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/immediate.c')
-rw-r--r-- | src/arch/immediate.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c index 88a0f4b..574fc3d 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -88,6 +88,12 @@ static void g_imm_operand_class_init(GImmOperandClass *); /* Initialise la classe des lignes de descriptions initiales. */ static void g_imm_operand_init(GImmOperand *); +/* Supprime toutes les références externes. */ +static void g_imm_operand_dispose(GImmOperand *); + +/* Procède à la libération totale de la mémoire. */ +static void g_imm_operand_finalize(GImmOperand *); + /* Construit la chaîne de caractères correspondant à l'opérande. */ static size_t g_imm_operand_to_string(const GImmOperand *, AsmSyntax, char [VMPA_MAX_SIZE]); @@ -115,6 +121,16 @@ G_DEFINE_TYPE(GImmOperand, g_imm_operand, G_TYPE_ARCH_OPERAND); static void g_imm_operand_class_init(GImmOperandClass *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_imm_operand_dispose; + object->finalize = (GObjectFinalizeFunc)g_imm_operand_finalize; + + operand->print = (operand_print_fc)g_imm_operand_print; } @@ -133,14 +149,46 @@ static void g_imm_operand_class_init(GImmOperandClass *klass) static void g_imm_operand_init(GImmOperand *operand) { - GArchOperand *arch; /* Instance parente */ + operand->zpad = false; + operand->display = IOD_HEX; - arch = G_ARCH_OPERAND(operand); +} - arch->print = (operand_print_fc)g_imm_operand_print; - operand->zpad = false; - operand->display = IOD_HEX; +/****************************************************************************** +* * +* Paramètres : operand = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_imm_operand_dispose(GImmOperand *operand) +{ + G_OBJECT_CLASS(g_imm_operand_parent_class)->dispose(G_OBJECT(operand)); + +} + + +/****************************************************************************** +* * +* Paramètres : operand = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_imm_operand_finalize(GImmOperand *operand) +{ + G_OBJECT_CLASS(g_imm_operand_parent_class)->finalize(G_OBJECT(operand)); } |