From: Chih-Hung Hsieh Date: Wed, 21 Oct 2015 22:44:56 +0000 (-0700) Subject: Move nested functions in dwfl_module.c X-Git-Tag: elfutils-0.165~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ac2041156c3ecda5932069f1e295cc0b9727f7c;p=thirdparty%2Felfutils.git Move nested functions in dwfl_module.c * 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 --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 5cae434ec..d30fd3c44 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2015-10-21 Chih-Hung Hsieh + + * dwfl_module.c (dwfl_report_module): Move nested function 'use' to + file scope. + 2015-10-09 Josh Stone * 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 8efcfaa59..76d45a831 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)