summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2015-11-18 11:04:52 -0800
committerMark Wielaard <mjw@redhat.com>2016-01-03 22:43:08 +0100
commit9d1e2365db8499b50ffc767ec42fbd6e49d669ac (patch)
tree2a135cbfb8b64826ce29a1827ecb1b0f0da2f38f
parentf59c89a49068ff875873debaa26055e6a636c828 (diff)
downloadelfutils-9d1e2365db8499b50ffc767ec42fbd6e49d669ac.tar.gz
Move nested functions in linux-proc-maps.c to file scope.
* Move nested function 'report' to file scope to compile with clang. Signed-off-by: Chih-Hung Hsieh <chh@google.com>
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/linux-proc-maps.c31
2 files changed, 22 insertions, 14 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 36b2123a..06b8469d 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
2015-11-18 Chih-Hung Hsieh <chh@google.com>
+ * linux-proc-maps.c (proc_maps_report): Move nested function
+ 'report' to file scope.
+
+2015-11-18 Chih-Hung Hsieh <chh@google.com>
+
* core-file.c (elf_begin_rand): Move nested function 'fail' to file
scope.
* core-file.c (dwfl_elf_phdr_memory_callback): Move nested functions
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index 2e2c8f92..9e7b2a21 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;