summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/operands/pool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/dalvik/operands/pool.c')
-rw-r--r--src/arch/dalvik/operands/pool.c59
1 files changed, 56 insertions, 3 deletions
diff --git a/src/arch/dalvik/operands/pool.c b/src/arch/dalvik/operands/pool.c
index 2c1f653..a1fde2e 100644
--- a/src/arch/dalvik/operands/pool.c
+++ b/src/arch/dalvik/operands/pool.c
@@ -62,6 +62,12 @@ static void g_dalvik_pool_operand_class_init(GDalvikPoolOperandClass *);
/* Initialise une instance d'opérande de constante Dalvik. */
static void g_dalvik_pool_operand_init(GDalvikPoolOperand *);
+/* Supprime toutes les références externes. */
+static void g_dalvik_pool_operand_dispose(GDalvikPoolOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_dalvik_pool_operand_finalize(GDalvikPoolOperand *);
+
/* Traduit un opérande en version humainement lisible. */
static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *, GBufferLine *, AsmSyntax);
@@ -85,6 +91,16 @@ G_DEFINE_TYPE(GDalvikPoolOperand, g_dalvik_pool_operand, G_TYPE_ARCH_OPERAND);
static void g_dalvik_pool_operand_class_init(GDalvikPoolOperandClass *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_pool_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_dalvik_pool_operand_finalize;
+
+ operand->print = (operand_print_fc)g_dalvik_pool_operand_print;
}
@@ -103,11 +119,46 @@ static void g_dalvik_pool_operand_class_init(GDalvikPoolOperandClass *klass)
static void g_dalvik_pool_operand_init(GDalvikPoolOperand *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 : - *
+* *
+******************************************************************************/
- parent->print = (operand_print_fc)g_dalvik_pool_operand_print;
+static void g_dalvik_pool_operand_dispose(GDalvikPoolOperand *operand)
+{
+ g_object_unref(G_OBJECT(operand->format));
+
+ G_OBJECT_CLASS(g_dalvik_pool_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* 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_pool_operand_finalize(GDalvikPoolOperand *operand)
+{
+ G_OBJECT_CLASS(g_dalvik_pool_operand_parent_class)->finalize(G_OBJECT(operand));
}
@@ -155,6 +206,8 @@ GArchOperand *g_dalvik_pool_operand_new(const GDexFormat *format, DalvikPoolType
result = g_object_new(G_TYPE_DALVIK_POOL_OPERAND, NULL);
+ g_object_ref(G_OBJECT(format));
+
result->format = format;
result->type = type;
result->index = (size == MDS_8_BITS ? index8 : index16);