summaryrefslogtreecommitdiff
path: root/src/arch/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-08-12 22:00:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-08-12 22:00:35 (GMT)
commit0daed1fa6212eb83b65ccd10c9f2c80bf12c6d27 (patch)
tree4b7ba8a882f0bf9c482d7ec64a50e8d4c79a3fc9 /src/arch/instruction.c
parent35f435585638fdf74377c3a9c7e7c2413995d4a7 (diff)
Connect a factory for operands to all the instructions.
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r--src/arch/instruction.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 4079e82..cd9ccff 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -35,6 +35,7 @@
#include "instruction-int.h"
#include "storage.h"
#include "../core/logs.h"
+#include "../core/processors.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
#include "../gtkext/gtkblockdisplay.h"
@@ -666,9 +667,19 @@ void g_arch_instruction_unlock_operands(GArchInstruction *instr)
void g_arch_instruction_attach_extra_operand(GArchInstruction *instr, GArchOperand *operand)
{
+ GSingletonFactory *factory; /* Unise à instances uniques */
+ GArchOperand *singleton; /* Instance retenue */
+
+ factory = get_operands_factory();
+
+ singleton = G_ARCH_OPERAND(g_singleton_factory_get_instance(factory, G_SINGLETON_CANDIDATE(operand)));
+
+ g_object_unref(G_OBJECT(operand));
+ g_object_unref(G_OBJECT(factory));
+
g_arch_instruction_lock_operands(instr);
- add_item_to_flat_array(&instr->operands, &operand, sizeof(GArchOperand *));
+ add_item_to_flat_array(&instr->operands, &singleton, sizeof(GArchOperand *));
g_arch_instruction_unlock_operands(instr);