]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Move nested functions in dwfl_module.c
authorChih-Hung Hsieh <chh@google.com>
Wed, 21 Oct 2015 22:44:56 +0000 (15:44 -0700)
committerMark Wielaard <mjw@redhat.com>
Tue, 3 Nov 2015 14:54:25 +0000 (15:54 +0100)
* 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>
libdwfl/ChangeLog
libdwfl/dwfl_module.c

index 5cae434ec449d45175e4c050499aa480f1f869ee..d30fd3c4410ff1d048a83aadc02f21c02ae89394 100644 (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.
index 8efcfaa594b1dc090d2bcb5ead2e417cf6ecfee5..76d45a831e9a7c243c076cfc1348a36cb1a20be9 100644 (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)