diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/instruction-int.h | 2 | ||||
-rw-r--r-- | src/arch/instruction.c | 8 | ||||
-rw-r--r-- | src/arch/instruction.h | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h index dca63e7..8eb6b68 100644 --- a/src/arch/instruction-int.h +++ b/src/arch/instruction-int.h @@ -63,7 +63,7 @@ struct _GArchInstruction phys_t max_displayed_len; /* Quantité de code affichée */ ArchInstrFlag flags; /* Informations complémentaires*/ - instr_hook_fc hooks[IPH_COUNT]; /* Traitements complémentaires */ + const instr_hook_fc *hooks; /* Traitements complémentaires */ mrange_t range; /* Emplacement en mémoire */ diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 8264f5b..4c0fdb9 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -281,11 +281,9 @@ ArchInstrFlag g_arch_instruction_get_flags(const GArchInstruction *instr) * * ******************************************************************************/ -void g_arch_instruction_set_hook(GArchInstruction *instr, InstrProcessHook type, instr_hook_fc hook) +void g_arch_instruction_set_hooks(GArchInstruction *instr, const instr_hook_fc hooks[IPH_COUNT]) { - assert(type < IPH_COUNT); - - instr->hooks[type] = hook; + instr->hooks = hooks; } @@ -310,7 +308,7 @@ void g_arch_instruction_call_hook(GArchInstruction *instr, InstrProcessHook type { assert(type < IPH_COUNT); - if (instr->hooks[type] != NULL) + if (instr->hooks != NULL && instr->hooks[type] != NULL) instr->hooks[type](instr, proc, context, format); } diff --git a/src/arch/instruction.h b/src/arch/instruction.h index e902849..93dfa52 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -117,7 +117,7 @@ typedef enum _InstrProcessHook typedef void (* instr_hook_fc) (GArchInstruction *, GArchProcessor *, GProcContext *, GBinFormat *); /* Définit un traitement complémentare au désassemblage. */ -void g_arch_instruction_set_hook(GArchInstruction *, InstrProcessHook, instr_hook_fc); +void g_arch_instruction_set_hooks(GArchInstruction *, const instr_hook_fc [IPH_COUNT]); /* Complète un désassemblage accompli pour une instruction. */ void g_arch_instruction_call_hook(GArchInstruction *, InstrProcessHook, GArchProcessor *, GProcContext *, GBinFormat *); |