mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: normalize binary path/nick empty strings
If we get an empty string, just normalize that to NULL so that we can be more likely to match equality checks via hash comparison. Additionally, break hashes out into two so that we can improve the situation where some symbols do not have paths but still match. This can happen with bundled symbols.
This commit is contained in:
@ -30,6 +30,7 @@ struct _SysprofSymbol
|
||||
GObject parent_instance;
|
||||
|
||||
guint hash;
|
||||
guint simple_hash;
|
||||
|
||||
GRefString *name;
|
||||
GRefString *binary_path;
|
||||
@ -71,14 +72,22 @@ _sysprof_symbol_equal (const SysprofSymbol *a,
|
||||
if (a == b)
|
||||
return TRUE;
|
||||
|
||||
if (a->hash != b->hash)
|
||||
if (a->simple_hash != b->simple_hash)
|
||||
return FALSE;
|
||||
|
||||
if (a->kind != b->kind)
|
||||
return FALSE;
|
||||
|
||||
if (a->name == NULL || b->name == NULL)
|
||||
return FALSE;
|
||||
if (a->hash != b->hash)
|
||||
{
|
||||
/* Special case symbols w/o binary_path which can happen
|
||||
* when we have symbols decoded from a bundled symbols.
|
||||
*/
|
||||
if (a->binary_path == NULL || b->binary_path == NULL)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return strcmp (a->name, b->name) == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user