Move nested functions in dwfl_module.c

* Nested functions in this file are moved to file scope
  to compile with clang. Extra parameters are added to pass
  local variables.

Signed-off-by: Chih-Hung Hsieh <chh@google.com>
This commit is contained in:
Chih-Hung Hsieh
2015-10-21 15:44:56 -07:00
committed by Mark Wielaard
parent 860d4312e6
commit 1ac2041156
2 changed files with 22 additions and 16 deletions
+5
View File
@@ -1,3 +1,8 @@
2015-10-21 Chih-Hung Hsieh <chh@google.com>
* dwfl_module.c (dwfl_report_module): Move nested function 'use' to
file scope.
2015-10-09 Josh Stone <jistone@redhat.com>
* core-file.c (elf_begin_rand): Replace loff_t with off_t.
+17 -16
View File
@@ -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)