diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-02-04 12:23:04 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-02-04 12:23:04 (GMT) |
commit | ec0f07c0b9468d6798befd887b02d9668faf806b (patch) | |
tree | f8b243f9b08006a4206b29b9af5b73a5d25361c7 /src/arch/operand.c | |
parent | 296b4ed15fd074f80266e1d22ef4ade7ee11905e (diff) |
Created a new interface for renamed operands.
Diffstat (limited to 'src/arch/operand.c')
-rw-r--r-- | src/arch/operand.c | 112 |
1 files changed, 3 insertions, 109 deletions
diff --git a/src/arch/operand.c b/src/arch/operand.c index 5936979..e5bfb0a 100644 --- a/src/arch/operand.c +++ b/src/arch/operand.c @@ -152,8 +152,6 @@ static void g_arch_operand_dispose(GArchOperand *operand) static void g_arch_operand_finalize(GArchOperand *operand) { - g_arch_operand_set_alt_text(operand, NULL, RTT_COUNT); - G_OBJECT_CLASS(g_arch_operand_parent_class)->finalize(G_OBJECT(operand)); } @@ -196,51 +194,6 @@ int g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b) /****************************************************************************** * * * Paramètres : operand = opérande à traiter. * -* text = représentation lisible alternative. * -* tag = style d'impression pour le remplacement. * -* * -* Description : Définit une autre représentation textuelle pour l'opérande. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_arch_operand_set_alt_text(GArchOperand *operand, const char *text, RenderingTagType tag) -{ - size_t alt_len; /* Taille du texte alternatif */ - - if (operand->alt_info != NULL) - free(operand->alt_info); - - if (text == NULL) - operand->alt_info = NULL; - - else - { - alt_len = strlen(text); - - if (alt_len == 0) - operand->alt_info = NULL; - - else - { - operand->alt_info = (alt_rendering *)malloc(sizeof(RenderingTagType) + alt_len + 1); - - operand->alt_info->tag = tag; - strcpy(operand->alt_info->text, text); - - } - - } - -} - - -/****************************************************************************** -* * -* Paramètres : operand = opérande à traiter. * * line = ligne tampon où imprimer l'opérande donné. * * * * Description : Traduit un opérande en version humainement lisible. * @@ -253,21 +206,7 @@ void g_arch_operand_set_alt_text(GArchOperand *operand, const char *text, Render void g_arch_operand_print(const GArchOperand *operand, GBufferLine *line) { - size_t alt_len; /* Taille du texte alternatif */ - - if (operand->alt_info != NULL) - { - alt_len = strlen(operand->alt_info->text); - - g_buffer_line_append_text(line, BLC_ASSEMBLY, - operand->alt_info->text, - alt_len, - operand->alt_info->tag, - NULL); - - } - else - G_ARCH_OPERAND_GET_CLASS(operand)->print(operand, line); + G_ARCH_OPERAND_GET_CLASS(operand)->print(operand, line); } @@ -326,28 +265,8 @@ char *g_arch_operand_build_tooltip(const GArchOperand *operand, const GLoadedBin static bool g_arch_operand_unserialize(GArchOperand *operand, GAsmStorage *storage, GBinFormat *format, packed_buffer *pbuf) { bool result; /* Bilan à retourner */ - unsigned char len; /* Taille du contenu alternatif*/ - char *text; /* Texte alternatif */ - RenderingTagType tag; /* Type de rendu */ - - result = extract_packed_buffer(pbuf, &len, sizeof(unsigned char), false); - - if (result && len > 0) - { - text = (char *)malloc(len); - - if (result) - result = extract_packed_buffer(pbuf, text, len, false); - - if (result) - result = extract_packed_buffer(pbuf, &tag, sizeof(RenderingTagType), true); - - if (result) - g_arch_operand_set_alt_text(operand, text, tag); - free(text); - - } + result = true; return result; @@ -409,33 +328,8 @@ GArchOperand *g_arch_operand_load(GAsmStorage *storage, GBinFormat *format, pack static bool g_arch_operand_serialize(const GArchOperand *operand, GAsmStorage *storage, packed_buffer *pbuf) { bool result; /* Bilan à retourner */ - size_t len; /* Taille du contenu alternatif*/ - if (operand->alt_info == NULL) - result = extend_packed_buffer(pbuf, (unsigned char []) { 0 }, sizeof(unsigned char), false); - - else - { - len = strlen(operand->alt_info->text) + 1; - assert(len > 1); - - if (len > (2 << (sizeof(unsigned char) * 8 - 1))) - { - log_variadic_message(LMT_ERROR, "Alternative text too long: '%s' (%zu bytes)", - operand->alt_info->text, len); - result = false; - } - - else - result = extend_packed_buffer(pbuf, (unsigned char []) { len }, sizeof(unsigned char), false); - - if (result) - result = extend_packed_buffer(pbuf, operand->alt_info->text, len, false); - - if (result) - result = extend_packed_buffer(pbuf, &operand->alt_info->tag, sizeof(RenderingTagType), true); - - } + result = true; return result; |