dwarves: Introduce cu__find_struct_by_sname
Out of cu__find_struct_by_name so that we can do a string__find once and lookup the string id on multiple cus. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2d01f5adb1
commit
489e3b585c
21
dwarves.c
21
dwarves.c
|
@ -699,16 +699,12 @@ struct tag *cu__find_base_type_by_name_and_size(const struct cu *self,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct tag *cu__find_struct_by_name(const struct cu *self, const char *name,
|
||||
const int include_decls, uint16_t *idp)
|
||||
struct tag *cu__find_struct_by_sname(const struct cu *self, strings_t sname,
|
||||
const int include_decls, uint16_t *idp)
|
||||
{
|
||||
uint16_t id;
|
||||
struct tag *pos;
|
||||
|
||||
if (self == NULL || name == NULL)
|
||||
return NULL;
|
||||
|
||||
strings_t sname = strings__find(strings, name);
|
||||
if (sname == 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -736,6 +732,19 @@ found:
|
|||
|
||||
}
|
||||
|
||||
struct tag *cu__find_struct_by_name(const struct cu *self, const char *name,
|
||||
const int include_decls, uint16_t *idp)
|
||||
{
|
||||
if (self == NULL || name == NULL)
|
||||
return NULL;
|
||||
|
||||
strings_t sname = strings__find(strings, name);
|
||||
if (sname == 0)
|
||||
return NULL;
|
||||
|
||||
return cu__find_struct_by_sname(self, sname, include_decls, idp);
|
||||
}
|
||||
|
||||
struct tag *cus__find_struct_by_name(const struct cus *self,
|
||||
struct cu **cu, const char *name,
|
||||
const int include_decls, uint16_t *id)
|
||||
|
|
|
@ -699,6 +699,8 @@ struct tag *cu__find_base_type_by_name_and_size(const struct cu *self,
|
|||
const char *name,
|
||||
uint16_t bit_size,
|
||||
uint16_t *id);
|
||||
struct tag *cu__find_struct_by_sname(const struct cu *self, strings_t sname,
|
||||
const int include_decls, uint16_t *idp);
|
||||
extern struct tag *cus__find_struct_by_name(const struct cus *self,
|
||||
struct cu **cu,
|
||||
const char *name,
|
||||
|
|
Loading…
Reference in New Issue