Skip to content

Commit 9d1e236

Browse files
chih-hungMark Wielaard
authored and
Mark Wielaard
committed
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 <[email protected]>
1 parent f59c89a commit 9d1e236

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

libdwfl/ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2015-11-18 Chih-Hung Hsieh <[email protected]>
2+
3+
* linux-proc-maps.c (proc_maps_report): Move nested function
4+
'report' to file scope.
5+
16
2015-11-18 Chih-Hung Hsieh <[email protected]>
27

38
* core-file.c (elf_begin_rand): Move nested function 'fail' to file

libdwfl/linux-proc-maps.c

+17-14
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,23 @@ grovel_auxv (pid_t pid, Dwfl *dwfl, GElf_Addr *sysinfo_ehdr)
175175
return ENOEXEC;
176176
}
177177

178+
static inline bool
179+
do_report (Dwfl *dwfl, char **plast_file, Dwarf_Addr low, Dwarf_Addr high)
180+
{
181+
if (*plast_file != NULL)
182+
{
183+
Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, *plast_file,
184+
low, high);
185+
free (*plast_file);
186+
*plast_file = NULL;
187+
if (unlikely (mod == NULL))
188+
return true;
189+
}
190+
return false;
191+
}
192+
193+
#define report() do_report(dwfl, &last_file, low, high)
194+
178195
static int
179196
proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
180197
{
@@ -183,20 +200,6 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
183200
char *last_file = NULL;
184201
Dwarf_Addr low = 0, high = 0;
185202

186-
inline bool report (void)
187-
{
188-
if (last_file != NULL)
189-
{
190-
Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, last_file,
191-
low, high);
192-
free (last_file);
193-
last_file = NULL;
194-
if (unlikely (mod == NULL))
195-
return true;
196-
}
197-
return false;
198-
}
199-
200203
char *line = NULL;
201204
size_t linesz;
202205
ssize_t len;

0 commit comments

Comments
 (0)