summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-23 11:59:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-23 11:59:26 (GMT)
commit3f05bacd4fec23824489b51d964a7ce3565bb85b (patch)
tree486cb1d96c11a33385a2155d2f326b88aae08e16 /src/arch
parentfa30b0fb42d2e229de9f760bfa842f25738efc18 (diff)
Memorized all creators of line content at the line level and saved memory.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/immediate.c4
-rw-r--r--src/arch/target.c13
2 files changed, 5 insertions, 12 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index 4594e23..777ae14 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -892,12 +892,10 @@ static void g_imm_operand_print(const GImmOperand *operand, GBufferLine *line, A
{
char value[IMM_MAX_SIZE]; /* Chaîne à imprimer */
size_t len; /* Taille de l'élément inséré */
- GBufferSegment *segment; /* Nouveau segment mis en place*/
len = g_imm_operand_to_string(operand, syntax, value);
- segment = g_buffer_line_insert_text(line, BLC_MAIN, value, len, RTT_IMMEDIATE);
- g_buffer_segment_set_creator(segment, G_OBJECT(operand));
+ g_buffer_line_append_text(line, BLC_MAIN, value, len, RTT_IMMEDIATE, G_OBJECT(operand));
}
diff --git a/src/arch/target.c b/src/arch/target.c
index bf4da3a..0517062 100644
--- a/src/arch/target.c
+++ b/src/arch/target.c
@@ -212,7 +212,6 @@ GArchOperand *g_target_operand_new(MemoryDataSize size, virt_t addr)
static void g_target_operand_print(const GTargetOperand *operand, GBufferLine *line, AsmSyntax syntax)
{
const char *label; /* Etiquette liée à un symbole */
- GBufferSegment *segment; /* Nouveau segment mis en place*/
vmpa2t tmp; /* Coquille vide pour argument */
VMPA_BUFFER(value); /* Adresse brute à imprimer */
size_t len; /* Taille de l'élément inséré */
@@ -223,19 +222,16 @@ static void g_target_operand_print(const GTargetOperand *operand, GBufferLine *l
g_buffer_line_insert_text(line, BLC_MAIN, "<", 1, RTT_LTGT);
label = g_binary_symbol_get_label(operand->symbol);
- segment = g_buffer_line_insert_text(line, BLC_MAIN, label, strlen(label), RTT_LABEL);
- g_buffer_segment_set_creator(segment, G_OBJECT(operand));
+ g_buffer_line_append_text(line, BLC_MAIN, label, strlen(label), RTT_LABEL, G_OBJECT(operand));
if (operand->diff > 0)
{
- segment = g_buffer_line_insert_text(line, BLC_MAIN, "+", 1, RTT_SIGNS);
- g_buffer_segment_set_creator(segment, G_OBJECT(operand));
+ g_buffer_line_append_text(line, BLC_MAIN, "+", 1, RTT_SIGNS, G_OBJECT(operand));
init_vmpa(&tmp, operand->diff, VMPA_NO_VIRTUAL);
vmpa2_phys_to_string(&tmp, MDS_4_BITS, value, &len);
- segment = g_buffer_line_insert_text(line, BLC_MAIN, value, len, RTT_LABEL);
- g_buffer_segment_set_creator(segment, G_OBJECT(operand));
+ g_buffer_line_append_text(line, BLC_MAIN, value, len, RTT_LABEL, G_OBJECT(operand));
g_buffer_line_insert_text(line, BLC_MAIN, ">", 1, RTT_LTGT);
@@ -247,8 +243,7 @@ static void g_target_operand_print(const GTargetOperand *operand, GBufferLine *l
init_vmpa(&tmp, VMPA_NO_PHYSICAL, operand->addr);
vmpa2_virt_to_string(&tmp, operand->size, value, &len);
- segment = g_buffer_line_insert_text(line, BLC_MAIN, value, len, RTT_LABEL);
- g_buffer_segment_set_creator(segment, G_OBJECT(operand));
+ g_buffer_line_append_text(line, BLC_MAIN, value, len, RTT_LABEL, G_OBJECT(operand));
}