summaryrefslogtreecommitdiff
path: root/src/arch/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-26 09:19:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-26 09:19:53 (GMT)
commitdff8fd4c83d9833d4539e2dd0c9d3f998b73608f (patch)
tree5e1088e0572b1e921df6d31d3db3ef753d97555b /src/arch/instruction.c
parentae3725eae3c1f2008e6f26b1057d97a6b9050a3c (diff)
Extended the Python API.
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r--src/arch/instruction.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 5ce0c12..1d1ccaf 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -585,35 +585,6 @@ GArchOperand *_g_arch_instruction_get_operand(const GArchInstruction *instr, siz
/******************************************************************************
* *
* Paramètres : instr = instance à mettre à jour. *
-* old = ancien opérande à remplacer. *
-* new = nouvel opérande à intégrer. *
-* *
-* Description : Remplace un opérande d'une instruction par un autre. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_arch_instruction_replace_operand(GArchInstruction *instr, GArchOperand *old, GArchOperand *new)
-{
- bool result; /* Bilan à retourner */
-
- g_arch_instruction_lock_operands(instr);
-
- result = _g_arch_instruction_replace_operand(instr, old, new);
-
- g_arch_instruction_unlock_operands(instr);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instance à mettre à jour. *
* old = ancienne opérande à détacher. *
* new = nouvelle opérande à attacher. *
* *
@@ -670,14 +641,15 @@ bool _g_arch_instruction_replace_operand(GArchInstruction *instr, GArchOperand *
* *
* Description : Détache un opérande liée d'une instruction. *
* *
-* Retour : - *
+* Retour : Bilan de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-void _g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *target)
+bool _g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *target)
{
+ bool result; /* Bilan à retourner */
size_t count; /* Nombre d'opérandes en place */
size_t i; /* Boucle de parcours */
GArchOperand *op; /* Opérande à manipuler */
@@ -695,9 +667,17 @@ void _g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *t
}
- rem_item_from_flat_array(&instr->operands, i, sizeof(GArchOperand *));
+ result = (i < count);
+
+ if (result)
+ {
+ rem_item_from_flat_array(&instr->operands, i, sizeof(GArchOperand *));
+
+ g_object_unref(G_OBJECT(target));
+
+ }
- g_object_unref(G_OBJECT(target));
+ return result;
}