diff options
Diffstat (limited to 'libdwfl/dwfl_module.c')
| -rw-r--r-- | libdwfl/dwfl_module.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index 8efcfaa5..76d45a83 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -125,6 +125,21 @@ dwfl_report_begin (Dwfl *dwfl) } INTDEF (dwfl_report_begin) +static inline Dwfl_Module * +use (Dwfl_Module *mod, Dwfl_Module **tailp, Dwfl *dwfl) +{ + mod->next = *tailp; + *tailp = mod; + + if (unlikely (dwfl->lookup_module != NULL)) + { + free (dwfl->lookup_module); + dwfl->lookup_module = NULL; + } + + return mod; +} + /* Report that a module called NAME spans addresses [START, END). Returns the module handle, either existing or newly allocated, or returns a null pointer for an allocation error. */ @@ -134,20 +149,6 @@ dwfl_report_module (Dwfl *dwfl, const char *name, { Dwfl_Module **tailp = &dwfl->modulelist, **prevp = tailp; - inline Dwfl_Module *use (Dwfl_Module *mod) - { - mod->next = *tailp; - *tailp = mod; - - if (unlikely (dwfl->lookup_module != NULL)) - { - free (dwfl->lookup_module); - dwfl->lookup_module = NULL; - } - - return mod; - } - for (Dwfl_Module *m = *prevp; m != NULL; m = *(prevp = &m->next)) { if (m->low_addr == start && m->high_addr == end @@ -157,7 +158,7 @@ dwfl_report_module (Dwfl *dwfl, const char *name, after the last module already reported. */ *prevp = m->next; m->gc = false; - return use (m); + return use (m, tailp, dwfl); } if (! m->gc) @@ -181,7 +182,7 @@ dwfl_report_module (Dwfl *dwfl, const char *name, mod->high_addr = end; mod->dwfl = dwfl; - return use (mod); + return use (mod, tailp, dwfl); } INTDEF (dwfl_report_module) |
