summaryrefslogtreecommitdiff
path: root/src/arch/raw.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-12-04 22:59:30 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-12-04 22:59:30 (GMT)
commit12154652c576144405011b5bd267c15c9667f223 (patch)
treebe552b2b7bc563a58892e8950afd920a45132a6e /src/arch/raw.c
parent6803c5d5b86416d1748d4d37a5cc5cb44fe007b1 (diff)
Provided a new way to build the full name of each instruction and cached it.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@435 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/raw.c')
-rw-r--r--src/arch/raw.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/arch/raw.c b/src/arch/raw.c
index 164086a..9b13dac 100644
--- a/src/arch/raw.c
+++ b/src/arch/raw.c
@@ -24,6 +24,9 @@
#include "raw.h"
+#include <string.h>
+
+
#include "immediate.h"
#include "instruction-int.h"
@@ -64,8 +67,8 @@ static void g_raw_instruction_finalize(GRawInstruction *);
/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
static GBufferLine *g_raw_instruction_print(const GRawInstruction *, GCodeBuffer *, MemoryDataSize, const bin_t *, AsmSyntax);
-/* Fournit le nom humain de l'instruction manipulée. */
-static const char *g_raw_instruction_get_keyword(const GRawInstruction *, AsmSyntax);
+/* Reconstruit le cache complet d'une désignation d'instruction. */
+static void g_raw_instruction_build_keyword(const GRawInstruction *, AsmSyntax);
@@ -103,7 +106,7 @@ static void g_raw_instruction_class_init(GRawInstructionClass *klass)
instr = G_ARCH_INSTRUCTION_CLASS(klass);
instr->print = (print_instruction_fc)g_raw_instruction_print;
- instr->get_key = (get_instruction_keyword_fc)g_raw_instruction_get_keyword;
+ instr->build_key = (build_instruction_keyword_fc)g_raw_instruction_build_keyword;
}
@@ -275,7 +278,7 @@ static GBufferLine *g_raw_instruction_print(const GRawInstruction *instr, GCodeB
* format = format du binaire manipulé. *
* syntax = type de représentation demandée. *
* *
-* Description : Fournit le nom humain de l'instruction manipulée. *
+* Description : Reconstruit le cache complet d'une désignation d'instruction.*
* *
* Retour : Mot clef de bas niveau. *
* *
@@ -283,7 +286,7 @@ static GBufferLine *g_raw_instruction_print(const GRawInstruction *instr, GCodeB
* *
******************************************************************************/
-static const char *g_raw_instruction_get_keyword(const GRawInstruction *instr, AsmSyntax syntax)
+static void g_raw_instruction_build_keyword(const GRawInstruction *instr, AsmSyntax syntax)
{
GArchOperand *operand; /* Octet décodé à afficher */
MemoryDataSize size; /* Taille de valeur associée */
@@ -293,7 +296,7 @@ static const char *g_raw_instruction_get_keyword(const GRawInstruction *instr, A
operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 0);
size = g_imm_operand_get_size(G_IMM_OPERAND(operand));
- return defines[MDS_RANGE(size)];
+ G_ARCH_INSTRUCTION(instr)->cached_keyword = strdup(defines[MDS_RANGE(size)]);
}