From 9d1e2365db8499b50ffc767ec42fbd6e49d669ac Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 18 Nov 2015 11:04:52 -0800 Subject: 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 --- 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 36b2123a..06b8469d 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2015-11-18 Chih-Hung Hsieh + + * linux-proc-maps.c (proc_maps_report): Move nested function + 'report' to file scope. + 2015-11-18 Chih-Hung Hsieh * core-file.c (elf_begin_rand): Move nested function 'fail' to file 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; -- cgit v1.2.1