summaryrefslogtreecommitdiff
path: root/src/gui/panels/symbols.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/panels/symbols.c')
-rw-r--r--src/gui/panels/symbols.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index 94605b3..0c88bce 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -727,7 +727,7 @@ static void reload_symbols_for_new_list_view(const GSymbolsPanel *panel, GtkStat
cairo_surface_t *icon; /* Image associée au symbole */
regmatch_t match; /* Récupération des trouvailles*/
bool matched; /* Correspondance de sélection */
- const char *original; /* Etiquette brute d'origine */
+ char *original; /* Etiquette brute d'origine */
char *name; /* Etiquette mise en relief */
const vmpa2t *addr; /* Localisation d'un symbole */
VMPA_BUFFER(virt); /* Version humainement lisible */
@@ -775,6 +775,8 @@ static void reload_symbols_for_new_list_view(const GSymbolsPanel *panel, GtkStat
else
name = NULL;
+ free(original);
+
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
vmpa2_virt_to_string(addr, size, virt, NULL);
@@ -939,8 +941,7 @@ static GtkTreeIter ensure_symbol_node_exist(const GSymbolsPanel *panel, GtkTreeI
static bool find_parent_for_symbol(const GSymbolsPanel *panel, const GBinSymbol *symbol, GtkTreeIter *parent, const regmatch_t *match, size_t *last)
{
bool result; /* Bilan à retourner */
- const char *label; /* Etiquette immuable */
- char *string; /* Etiquette modifiable */
+ char *label; /* Etiquette modifiable */
char *start; /* Début de boucle de parcours */
char *token; /* Partie de texte isolée */
char *next; /* Prochaine partie à traiter */
@@ -952,24 +953,22 @@ static bool find_parent_for_symbol(const GSymbolsPanel *panel, const GBinSymbol
label = g_binary_symbol_get_label(symbol);
if (label == NULL) return false;
- string = strdup(label);
-
- for (start = string, token = strtok_w(&start, panel->sep); ; token = next)
+ for (start = label, token = strtok_w(&start, panel->sep); ; token = next)
{
next = strtok_w(&start, panel->sep);
if (next == NULL)
{
- *last = (token - string);
+ *last = (token - label);
break;
}
- *parent = ensure_symbol_node_exist(panel, (token == string ? NULL : parent), token, match, token - string);
+ *parent = ensure_symbol_node_exist(panel, (token == label ? NULL : parent), token, match, token - label);
result = true;
}
- free(string);
+ free(label);
return result;
@@ -1005,7 +1004,7 @@ static void reload_symbols_for_new_tree_view(const GSymbolsPanel *panel, GtkStat
bool matched; /* Correspondance de sélection */
GtkTreeIter parent; /* Point d'insertion parent */
size_t last; /* Position du dernier élément */
- const char *original; /* Etiquette brute d'origine */
+ char *original; /* Etiquette brute d'origine */
char *name; /* Etiquette mise en relief */
const vmpa2t *addr; /* Localisation d'un symbole */
char virt[VMPA_MAX_LEN]; /* Version humainement lisible */
@@ -1066,6 +1065,8 @@ static void reload_symbols_for_new_tree_view(const GSymbolsPanel *panel, GtkStat
else
name = NULL;
+ free(original);
+
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
vmpa2_virt_to_string(addr, size, virt, NULL);
@@ -1258,8 +1259,7 @@ static GtkTreeIter update_symbol_partial_name_in_tree_view(GtkTreeStore *store,
static void update_symbol_name_in_tree_view(const GSymbolsPanel *panel, GtkTreeStore *store, const GBinSymbol *symbol, const regmatch_t *match)
{
- const char *label; /* Etiquette immuable */
- char *string; /* Etiquette modifiable */
+ char *label; /* Etiquette modifiable */
GtkTreeIter parent; /* Point d'analyse courant */
char *start; /* Début de boucle de parcours */
char *token; /* Partie de texte isolée */
@@ -1268,17 +1268,15 @@ static void update_symbol_name_in_tree_view(const GSymbolsPanel *panel, GtkTreeS
if (label != NULL)
{
- string = strdup(label);
-
- for (start = string, token = strtok_w(&start, panel->sep);
+ for (start = label, token = strtok_w(&start, panel->sep);
token != NULL;
token = strtok_w(&start, panel->sep))
{
- parent = update_symbol_partial_name_in_tree_view(store, (token == string ? NULL : &parent),
- token, match, token - string);
+ parent = update_symbol_partial_name_in_tree_view(store, (token == label ? NULL : &parent),
+ token, match, token - label);
}
- free(string);
+ free(label);
}
@@ -1420,6 +1418,7 @@ static bool is_symbol_matching(const symbols_update_data *data, const GBinSymbol
#ifndef NDEBUG
SymbolType type; /* Type associé au symbole */
#endif
+ char *label; /* Etiquette à analyser */
#ifndef NDEBUG
@@ -1429,7 +1428,16 @@ static bool is_symbol_matching(const symbols_update_data *data, const GBinSymbol
#endif
- result = is_content_matching(data->filter, g_binary_symbol_get_label(symbol), match);
+ label = g_binary_symbol_get_label(symbol);
+
+ if (label == NULL)
+ result = false;
+
+ else
+ {
+ result = is_content_matching(data->filter, label, match);
+ free(label);
+ }
return result;