summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/dwfl_module.c33
2 files changed, 22 insertions, 16 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 5cae434e..d30fd3c4 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-21 Chih-Hung Hsieh <[email protected]>
+
+ * dwfl_module.c (dwfl_report_module): Move nested function 'use' to
+ file scope.
+
2015-10-09 Josh Stone <[email protected]>
* core-file.c (elf_begin_rand): Replace loff_t with off_t.
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)