diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-12-30 18:28:18 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-12-30 18:44:35 (GMT) |
commit | 945e0c9ecce02155555387aad672e272f5646362 (patch) | |
tree | 3d35bdb25012a9ef710a13c9e733b5a80f6641b1 /plugins/arm/v7/operands/shift.c | |
parent | 98570719ff25a4dcde917056e55490bf2a6b1453 (diff) |
Create generic functions to load and store operands.
Diffstat (limited to 'plugins/arm/v7/operands/shift.c')
-rw-r--r-- | plugins/arm/v7/operands/shift.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/plugins/arm/v7/operands/shift.c b/plugins/arm/v7/operands/shift.c index 55f2a22..ccdfe5c 100644 --- a/plugins/arm/v7/operands/shift.c +++ b/plugins/arm/v7/operands/shift.c @@ -537,8 +537,10 @@ static void g_armv7_shift_operand_update_inner_instances(GArmV7ShiftOperand *ope { assert(count == 1); - g_object_unref(G_OBJECT(operand->shift_value)); + g_clear_object(&operand->shift_value); + operand->shift_value = instances[0]; + g_object_ref(G_OBJECT(instances[0])); } @@ -603,7 +605,6 @@ static bool g_armv7_shift_operand_load(GArmV7ShiftOperand *operand, GObjectStora GArchOperandClass *parent; /* Classe parente à consulter */ a7shiftop_extra_data_t *extra; /* Données insérées à modifier */ uleb128_t value; /* Valeur ULEB128 à charger */ - GSerializableObject *shift_value; /* Valeur du décalage */ parent = G_ARCH_OPERAND_CLASS(g_armv7_shift_operand_parent_class); @@ -613,27 +614,15 @@ static bool g_armv7_shift_operand_load(GArmV7ShiftOperand *operand, GObjectStora { extra = GET_ARMV7_SHIFT_OP_EXTRA(operand); - LOCK_GOBJECT_EXTRA(extra); - result = unpack_uleb128(&value, pbuf); if (result) extra->shift_type = value; - UNLOCK_GOBJECT_EXTRA(extra); - } if (result) - { - shift_value = g_object_storage_unpack_object(storage, "operands", pbuf); - - result = (shift_value != NULL); - - if (result) - operand->shift_value = G_ARCH_OPERAND(shift_value); - - } + result = _g_arch_operand_load_inner_instances(G_ARCH_OPERAND(operand), storage, pbuf, 1); return result; @@ -659,7 +648,6 @@ static bool g_armv7_shift_operand_store(GArmV7ShiftOperand *operand, GObjectStor bool result; /* Bilan à retourner */ GArchOperandClass *parent; /* Classe parente à consulter */ a7shiftop_extra_data_t *extra; /* Données insérées à modifier */ - GSerializableObject *shift_value; /* Valeur du décalage */ parent = G_ARCH_OPERAND_CLASS(g_armv7_shift_operand_parent_class); @@ -669,19 +657,12 @@ static bool g_armv7_shift_operand_store(GArmV7ShiftOperand *operand, GObjectStor { extra = GET_ARMV7_SHIFT_OP_EXTRA(operand); - LOCK_GOBJECT_EXTRA(extra); - result = pack_uleb128((uleb128_t []){ extra->shift_type }, pbuf); - UNLOCK_GOBJECT_EXTRA(extra); - } if (result) - { - shift_value = G_SERIALIZABLE_OBJECT(operand->shift_value); - result = g_object_storage_pack_object(storage, "operands", shift_value, pbuf); - } + result = _g_arch_operand_store_inner_instances(G_ARCH_OPERAND(operand), storage, pbuf, true); return result; |