diff options
Diffstat (limited to 'plugins/arm/v7/operands/offset.c')
-rw-r--r-- | plugins/arm/v7/operands/offset.c | 76 |
1 files changed, 30 insertions, 46 deletions
diff --git a/plugins/arm/v7/operands/offset.c b/plugins/arm/v7/operands/offset.c index 1634230..79c5cf9 100644 --- a/plugins/arm/v7/operands/offset.c +++ b/plugins/arm/v7/operands/offset.c @@ -24,6 +24,7 @@ #include "offset.h" +#include <assert.h> #include <stdio.h> #include <string.h> @@ -85,11 +86,11 @@ static GArchOperand *g_armv7_offset_operand_get_inner_operand_from_path(const GA /* Traduit un opérande en version humainement lisible. */ static void g_armv7_offset_operand_print(const GArmV7OffsetOperand *, GBufferLine *); -/* Charge un contenu depuis une mémoire tampon. */ -static bool g_armv7_offset_operand_load(GArmV7OffsetOperand *, GObjectStorage *, packed_buffer_t *); +/* Fournit une liste de candidats embarqués par un candidat. */ +static GArchOperand **g_armv7_offset_operand_list_inner_instances(const GArmV7OffsetOperand *, size_t *); -/* Sauvegarde un contenu dans une mémoire tampon. */ -static bool g_armv7_offset_operand_store(GArmV7OffsetOperand *, GObjectStorage *, packed_buffer_t *); +/* Met à jour une liste de candidats embarqués par un candidat. */ +static void g_armv7_offset_operand_update_inner_instances(GArmV7OffsetOperand *, GArchOperand **, size_t); @@ -132,8 +133,11 @@ static void g_armv7_offset_operand_class_init(GArmV7OffsetOperandClass *klass) operand->print = (operand_print_fc)g_armv7_offset_operand_print; - operand->load = (load_operand_fc)g_armv7_offset_operand_load; - operand->store = (store_operand_fc)g_armv7_offset_operand_store; + operand->list_inner = (operand_list_inners_fc)g_armv7_offset_operand_list_inner_instances; + operand->update_inner = (operand_update_inners_fc)g_armv7_offset_operand_update_inner_instances; + + operand->load = g_arch_operand_load_generic_fixed_1; + operand->store = g_arch_operand_store_generic_fixed; } @@ -379,38 +383,27 @@ static void g_armv7_offset_operand_print(const GArmV7OffsetOperand *operand, GBu /****************************************************************************** * * -* Paramètres : operand = élément GLib à constuire. * -* storage = conservateur de données à manipuler ou NULL. * -* pbuf = zone tampon à lire. * +* Paramètres : operand = objet dont l'instance se veut unique. * +* count = quantité d'instances à l'unicité internes. * * * -* Description : Charge un contenu depuis une mémoire tampon. * +* Description : Fournit une liste de candidats embarqués par un candidat. * * * -* Retour : Bilan de l'opération. * +* Retour : Liste de candidats internes ou NULL si aucun. * * * * Remarques : - * * * ******************************************************************************/ -static bool g_armv7_offset_operand_load(GArmV7OffsetOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf) +static GArchOperand **g_armv7_offset_operand_list_inner_instances(const GArmV7OffsetOperand *operand, size_t *count) { - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - GSerializableObject *value; /* Valeur du décalage */ - - parent = G_ARCH_OPERAND_CLASS(g_armv7_offset_operand_parent_class); + GArchOperand **result; /* Instances à retourner */ - result = parent->load(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - { - value = g_object_storage_unpack_object(storage, "operands", pbuf); + *count = 1; - result = (value != NULL); + result = malloc(*count * sizeof(GArchOperand *)); - if (result) - operand->value = G_ARCH_OPERAND(value); - - } + result[0] = operand->value; + g_object_ref(G_OBJECT(result[0])); return result; @@ -419,34 +412,25 @@ static bool g_armv7_offset_operand_load(GArmV7OffsetOperand *operand, GObjectSto /****************************************************************************** * * -* Paramètres : operand = élément GLib à consulter. * -* storage = conservateur de données à manipuler ou NULL. * -* pbuf = zone tampon à remplir. * +* Paramètres : operand = objet dont l'instance se veut unique. * +* instances = liste de candidats internes devenus singletons. * +* count = quantité d'instances à l'unicité internes. * * * -* Description : Sauvegarde un contenu dans une mémoire tampon. * +* Description : Met à jour une liste de candidats embarqués par un candidat. * * * -* Retour : Bilan de l'opération. * +* Retour : - * * * * Remarques : - * * * ******************************************************************************/ -static bool g_armv7_offset_operand_store(GArmV7OffsetOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf) +static void g_armv7_offset_operand_update_inner_instances(GArmV7OffsetOperand *operand, GArchOperand **instances, size_t count) { - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - GSerializableObject *value; /* Valeur du décalage */ + assert(count == 1); - parent = G_ARCH_OPERAND_CLASS(g_armv7_offset_operand_parent_class); - - result = parent->store(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - { - value = G_SERIALIZABLE_OBJECT(operand->value); - result = g_object_storage_pack_object(storage, "operands", value, pbuf); - } + g_clear_object(&operand->value); - return result; + operand->value = instances[0]; + g_object_ref(G_OBJECT(instances[0])); } |