diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-01-16 18:42:29 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-01-16 18:42:29 (GMT) |
commit | eb9b7fd76451db5c9f07a800c0394480e4b88c9c (patch) | |
tree | 0ed8261cffd4a40f4f7924f4dc12cc37c00bf554 /src | |
parent | 23b9c6e68bbe5f0531f9a9408c2deb9f897701dc (diff) |
Improved the removal of format symbols.
Diffstat (limited to 'src')
-rw-r--r-- | src/format/format.c | 15 |
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); } |