summaryrefslogtreecommitdiff
path: root/src/decomp/expr/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decomp/expr/block.c')
-rw-r--r--src/decomp/expr/block.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/decomp/expr/block.c b/src/decomp/expr/block.c
index 3c56ef6..b58972d 100644
--- a/src/decomp/expr/block.c
+++ b/src/decomp/expr/block.c
@@ -25,6 +25,7 @@
#include <malloc.h>
+#include <string.h>
#include "../expression-int.h"
@@ -163,7 +164,8 @@ static bool g_expr_block_visit(GExprBlock *block, dec_instr_visitor_cb callback,
result = true;
for (i = 0; i < block->count && result; i++)
- result = g_dec_instruction_visit(block->list[i], callback, flags, data);
+ result = _g_dec_instruction_visit(block->list[i], G_DEC_INSTRUCTION(block),
+ callback, flags, data);
return result;
@@ -270,3 +272,40 @@ void g_expr_block_add_item(GExprBlock *block, GDecInstruction *item)
block->list[block->count - 1] = item;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : block = ensemble à faire évoluer. *
+* item = nouvel élément à retirer de l'ensemble. *
+* *
+* Description : Supprime une instruction décompilée du conteneur existant. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_expr_block_delete_item(GExprBlock *block, GDecInstruction *item)
+{
+ size_t i; /* Boucle de parcours */
+
+ for (i = 0; i < block->count; i++)
+ if (block->list[i] == item)
+ break;
+
+ if (i < block->count)
+ {
+ if ((i + 1) < block->count)
+ memmove(&block->list[i], &block->list[i + 1],
+ (block->count - i - 1) * sizeof(GDecInstruction *));
+
+ block->list = (GDecInstruction **)realloc(block->list,
+ --block->count * sizeof(GDecInstruction *));
+
+ g_object_unref(G_OBJECT(item));
+
+ }
+
+}