diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-07-04 12:39:01 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-07-04 12:39:01 (GMT) |
commit | ade3ee4fd3b78e96deb08210838643969f2f6699 (patch) | |
tree | 09003a6f4ac00c09560de9ea9a91c125a7b14f68 /src/arch | |
parent | a0463dfa8fe232d01ea925668f393d7507fa787b (diff) |
Updated the API for building symbol labels.
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/target.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/arch/target.c b/src/arch/target.c index a297a3c..036aad0 100644 --- a/src/arch/target.c +++ b/src/arch/target.c @@ -283,17 +283,18 @@ static int g_target_operand_compare(const GTargetOperand *a, const GTargetOperan static void g_target_operand_print(const GTargetOperand *operand, GBufferLine *line, AsmSyntax syntax) { - const char *label; /* Etiquette liée à un symbole */ + char *label; /* Etiquette liée à un symbole */ vmpa2t tmp; /* Coquille vide pour argument */ VMPA_BUFFER(value); /* Adresse brute à imprimer */ size_t len; /* Taille de l'élément inséré */ - if (operand->symbol != NULL /* FIXME */ && g_binary_symbol_get_label(operand->symbol) != NULL /* FIXME */) + label = g_binary_symbol_get_label(operand->symbol); + + if (operand->symbol != NULL && label != NULL) { if (operand->diff > 0) g_buffer_line_append_text(line, BLC_MAIN, "<", 1, RTT_LTGT, NULL); - label = g_binary_symbol_get_label(operand->symbol); g_buffer_line_append_text(line, BLC_MAIN, label, strlen(label), RTT_LABEL, G_OBJECT(operand)); if (operand->diff > 0) @@ -318,6 +319,9 @@ static void g_target_operand_print(const GTargetOperand *operand, GBufferLine *l } + if (label != NULL) + free(label); + } @@ -510,7 +514,12 @@ bool g_target_operand_resolve(GTargetOperand *operand, GBinFormat *format, bool if (stype == STP_STRING || stype == STP_RO_STRING) { - if (g_binary_symbol_get_label(symbol) == NULL) + label = g_binary_symbol_get_label(symbol); + + if (label != NULL) + free(label); + + else { range = g_binary_symbol_get_range(symbol); |