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/operand.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/operand.c')
-rw-r--r-- | src/arch/operand.c | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/src/arch/operand.c b/src/arch/operand.c index ede3cdd..5b36e13 100644 --- a/src/arch/operand.c +++ b/src/arch/operand.c @@ -38,6 +38,12 @@ static void g_arch_operand_class_init(GArchOperandClass *); /* Initialise une instance d'opérande d'architecture. */ static void g_arch_operand_init(GArchOperand *); +/* Supprime toutes les références externes. */ +static void g_arch_operand_dispose(GArchOperand *); + +/* Procède à la libération totale de la mémoire. */ +static void g_arch_operand_finalize(GArchOperand *); + /* Indique le type défini pour un opérande d'architecture. */ @@ -59,6 +65,12 @@ G_DEFINE_TYPE(GArchOperand, g_arch_operand, G_TYPE_OBJECT); static void g_arch_operand_class_init(GArchOperandClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_arch_operand_dispose; + object->finalize = (GObjectFinalizeFunc)g_arch_operand_finalize; } @@ -83,6 +95,46 @@ static void g_arch_operand_init(GArchOperand *operand) /****************************************************************************** * * +* Paramètres : operand = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_arch_operand_dispose(GArchOperand *operand) +{ + G_OBJECT_CLASS(g_arch_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_arch_operand_finalize(GArchOperand *operand) +{ + g_arch_operand_set_alt_text(operand, NULL, RTT_COUNT); + + G_OBJECT_CLASS(g_arch_operand_parent_class)->finalize(G_OBJECT(operand)); + +} + + +/****************************************************************************** +* * * Paramètres : a = premier opérande à consulter. * * b = second opérande à consulter. * * * @@ -101,7 +153,7 @@ bool g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b) result = (G_OBJECT_TYPE(G_OBJECT(a)) == G_OBJECT_TYPE(G_OBJECT(b))); if (result) - result = a->compare(a, b); + result = G_ARCH_OPERAND_GET_CLASS(a)->compare(a, b); return result; @@ -166,6 +218,6 @@ void g_arch_operand_print(const GArchOperand *operand, GBufferLine *line, AsmSyn operand->alt_tag); else - operand->print(operand, line, syntax); + G_ARCH_OPERAND_GET_CLASS(operand)->print(operand, line, syntax); } |