diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-01-13 22:37:31 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-01-13 22:37:31 (GMT) |
commit | 23b9c6e68bbe5f0531f9a9408c2deb9f897701dc (patch) | |
tree | 3804d6c21c9cd5e291cb8c7853607cdda992d125 /src/gui/dialogs | |
parent | a6975c1d754a1ba5bfb9e23f0b26692c746e6f9c (diff) |
Created a real iterator for symbols.
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/gotox.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gui/dialogs/gotox.c b/src/gui/dialogs/gotox.c index 00ad356..31123ff 100644 --- a/src/gui/dialogs/gotox.c +++ b/src/gui/dialogs/gotox.c @@ -32,6 +32,7 @@ #include "../../format/format.h" +#include "../../format/symiter.h" #include "../../gtkext/easygtk.h" #include "../../gtkext/support.h" @@ -213,10 +214,9 @@ GtkWidget *create_gotox_dialog_for_entry_points(GtkWindow *parent, GLoadedBinary GtkWidget *result; /* Fenêtre à renvoyer */ GtkTreeStore *store; /* Modèle de gestion */ GBinFormat *format; /* Format associé au binaire */ - GBinSymbol **symbols; /* Symboles à représenter */ - size_t sym_count; /* Qté de symboles présents */ + sym_iter_t *siter; /* Parcours des symboles */ + GBinSymbol *symbol; /* Symbole manipulé */ bool has_entry_points; /* Présences d'insertions ? */ - size_t i; /* Boucle de parcours */ vmpa2t addr; /* Localisation de symbole */ /* Mise en place de la boîte de dialogue */ @@ -229,23 +229,31 @@ GtkWidget *create_gotox_dialog_for_entry_points(GtkWindow *parent, GLoadedBinary format = G_BIN_FORMAT(g_loaded_binary_get_format(binary)); - symbols = g_binary_format_get_symbols(format, &sym_count); + siter = create_symbol_iterator(format, 0); has_entry_points = false; - for (i = 0; i < sym_count; i++) + for (symbol = get_symbol_iterator_current(siter); + symbol != NULL; + symbol = get_symbol_iterator_next(siter)) { - if (g_binary_symbol_get_target_type(symbols[i]) != STP_ENTRY_POINT) - continue; + if (g_binary_symbol_get_target_type(symbol) != STP_ENTRY_POINT) + goto cgdfep_next; - copy_vmpa(&addr, get_mrange_addr(g_binary_symbol_get_range(symbols[i]))); + copy_vmpa(&addr, get_mrange_addr(g_binary_symbol_get_range(symbol))); - add_new_location_to_list(store, binary, &addr, symbols[i]); + add_new_location_to_list(store, binary, &addr, symbol); has_entry_points = true; + cgdfep_next: + + g_object_unref(G_OBJECT(symbol)); + } + delete_symbol_iterator(siter); + g_object_unref(G_OBJECT(format)); g_object_unref(G_OBJECT(store)); |