summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/format/format.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/format/format.c b/src/format/format.c
index a188204..b975a7c 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -654,15 +654,18 @@ static void _g_binary_format_remove_symbol(GBinFormat *format, size_t index)
void g_binary_format_remove_symbol(GBinFormat *format, GBinSymbol *symbol)
{
- size_t i; /* Boucle de parcours */
+ bool found; /* Jeton de présence */
+ size_t index; /* Indice du point de retrait */
+
+ g_binary_format_lock_unlock_symbols_wr(format, true);
- // FIXME : dicho
+ found = bsearch_index(&symbol, format->symbols, format->sym_count,
+ sizeof(GBinSymbol *), (__compar_fn_t)g_binary_symbol_cmp, &index);
- for (i = 0; i < format->sym_count; i++)
- if (format->symbols[i] == symbol)
- break;
+ if (found)
+ _g_binary_format_remove_symbol(format, index);
- _g_binary_format_remove_symbol(format, i);
+ g_binary_format_lock_unlock_symbols_wr(format, false);
}