core: Convert cu__find_enumeration_by_sname_and_size to search for a string
It looked for an index into a string table, a string_t, but since for multithreading we'd be growing the string table while looking up stuff, we'd be looking at realloc'ed memory, so lets move to stable char pointer strings. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a16c82f711
commit
f84e8777ea
|
@ -798,7 +798,7 @@ static int tag__recode_dwarf_bitfield(struct tag *tag, struct cu *cu, uint16_t b
|
|||
* the dwarf_cu as in dwarf there are no such things
|
||||
* as enumeration_types of less than 8 bits, etc.
|
||||
*/
|
||||
recoded = cu__find_enumeration_by_sname_and_size(cu, sname, bit_size, &short_id);
|
||||
recoded = cu__find_enumeration_by_name_and_size(cu, name, bit_size, &short_id);
|
||||
if (recoded != NULL)
|
||||
return short_id;
|
||||
|
||||
|
|
10
dwarves.c
10
dwarves.c
|
@ -758,15 +758,13 @@ struct tag *cu__find_base_type_by_sname_and_size(const struct cu *cu,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct tag *cu__find_enumeration_by_sname_and_size(const struct cu *cu,
|
||||
strings_t sname,
|
||||
uint16_t bit_size,
|
||||
type_id_t *idp)
|
||||
struct tag *cu__find_enumeration_by_name_and_size(const struct cu *cu, const char *name,
|
||||
uint16_t bit_size, type_id_t *idp)
|
||||
{
|
||||
uint32_t id;
|
||||
struct tag *pos;
|
||||
|
||||
if (sname == 0)
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
cu__for_each_type(cu, id, pos) {
|
||||
|
@ -774,7 +772,7 @@ struct tag *cu__find_enumeration_by_sname_and_size(const struct cu *cu,
|
|||
const struct type *t = tag__type(pos);
|
||||
|
||||
if (t->size == bit_size &&
|
||||
t->namespace.name == sname) {
|
||||
strcmp(type__name(t, cu), name) == 0) {
|
||||
if (idp != NULL)
|
||||
*idp = id;
|
||||
return pos;
|
||||
|
|
|
@ -356,10 +356,8 @@ struct tag *cu__find_base_type_by_sname_and_size(const struct cu *cu,
|
|||
uint16_t bit_size,
|
||||
type_id_t *idp);
|
||||
struct tag *cu__find_enumeration_by_name(const struct cu *cu, const char *name, type_id_t *idp);
|
||||
struct tag *cu__find_enumeration_by_sname_and_size(const struct cu *cu,
|
||||
strings_t sname,
|
||||
uint16_t bit_size,
|
||||
type_id_t *idp);
|
||||
struct tag *cu__find_enumeration_by_name_and_size(const struct cu *cu, const char* name,
|
||||
uint16_t bit_size, type_id_t *idp);
|
||||
struct tag *cu__find_first_typedef_of_type(const struct cu *cu,
|
||||
const type_id_t type);
|
||||
struct tag *cu__find_function_by_name(const struct cu *cu, const char *name);
|
||||
|
|
Loading…
Reference in New Issue