From d1cbce88d7e4c7f9c183da79d92d9b6183e0c343 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Wed, 17 Feb 2021 09:43:48 +0100 Subject: [PATCH] unstrip: Remove nested next() function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is a simple one-liner, so inline this into the few callers. Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/ChangeLog | 6 ++++++ src/unstrip.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9e0ebd89c..833d05e4f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2021-02-17 Timm Bäder + + * unstrip.c (handle_implicit_modules): Inline the next function + in three places. This is simply dwfl_getmodules with match_module + callback providing mmi. + 2021-02-17 Timm Bäder * unstrip.c (handle_explicit_files): Move warn function... diff --git a/src/unstrip.c b/src/unstrip.c index 612b7cbf5..f7742ebd0 100644 --- a/src/unstrip.c +++ b/src/unstrip.c @@ -2498,21 +2498,18 @@ static void handle_implicit_modules (const struct arg_info *info) { struct match_module_info mmi = { info->args, NULL, info->match_files }; - inline ptrdiff_t next (ptrdiff_t offset) - { - return dwfl_getmodules (info->dwfl, &match_module, &mmi, offset); - } - ptrdiff_t offset = next (0); + ptrdiff_t offset = dwfl_getmodules (info->dwfl, &match_module, &mmi, 0); if (offset == 0) error (EXIT_FAILURE, 0, _("no matching modules found")); if (info->list) do list_module (mmi.found); - while ((offset = next (offset)) > 0); + while ((offset = dwfl_getmodules (info->dwfl, &match_module, &mmi, + offset)) > 0); else if (info->output_dir == NULL) { - if (next (offset) != 0) + if (dwfl_getmodules (info->dwfl, &match_module, &mmi, offset) != 0) error (EXIT_FAILURE, 0, _("matched more than one module")); handle_dwfl_module (info->output_file, false, info->force, mmi.found, info->all, info->ignore, info->relocate); @@ -2522,7 +2519,8 @@ handle_implicit_modules (const struct arg_info *info) handle_output_dir_module (info->output_dir, mmi.found, info->force, info->all, info->ignore, info->modnames, info->relocate); - while ((offset = next (offset)) > 0); + while ((offset = dwfl_getmodules (info->dwfl, &match_module, &mmi, + offset)) > 0); } int -- 2.47.2