* Move nested function 'report' to file scope to compile with clang.

Signed-off-by: Chih-Hung Hsieh <c...@google.com>
---
 libdwfl/ChangeLog         |  5 +++++
 libdwfl/linux-proc-maps.c | 31 +++++++++++++++++--------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 163a6f1..8d5553c 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-18  Chih-Hung Hsieh <c...@google.com>
+
+       * linux-proc-maps.c (proc_maps_report): Move nested function
+       'report' to file scope.
+
 2015-11-13  Chih-Hung Hsieh <c...@google.com>
 
        * gzip.c (unzip): Move nested functions to file scope.
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index 2e2c8f9..9e7b2a2 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -175,6 +175,23 @@ grovel_auxv (pid_t pid, Dwfl *dwfl, GElf_Addr 
*sysinfo_ehdr)
   return ENOEXEC;
 }
 
+static inline bool
+do_report (Dwfl *dwfl, char **plast_file, Dwarf_Addr low, Dwarf_Addr high)
+{
+  if (*plast_file != NULL)
+    {
+      Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, *plast_file,
+                                                    low, high);
+      free (*plast_file);
+      *plast_file = NULL;
+      if (unlikely (mod == NULL))
+        return true;
+    }
+  return false;
+}
+
+#define report() do_report(dwfl, &last_file, low, high)
+
 static int
 proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
 {
@@ -183,20 +200,6 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr 
sysinfo_ehdr, pid_t pid)
   char *last_file = NULL;
   Dwarf_Addr low = 0, high = 0;
 
-  inline bool report (void)
-    {
-      if (last_file != NULL)
-       {
-         Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, last_file,
-                                                        low, high);
-         free (last_file);
-         last_file = NULL;
-         if (unlikely (mod == NULL))
-           return true;
-       }
-      return false;
-    }
-
   char *line = NULL;
   size_t linesz;
   ssize_t len;
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to