From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Add file variable in main
Date: Tue, 01 Jan 2019 00:00:00 -0000 [thread overview]
Message-ID: <20191205152849.GA26238@delia> (raw)
Hi,
Factor out variable file in main, and use it in the dwz calls.
Committed to trunk.
Thanks,
- Tom
Add file variable in main
2019-12-03 Tom de Vries <tdevries@suse.de>
* dwz.c (main): Factor out file variable.
---
dwz.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dwz.c b/dwz.c
index 54e1918..1c1ae93 100644
--- a/dwz.c
+++ b/dwz.c
@@ -13287,6 +13287,7 @@ main (int argc, char *argv[])
char *end;
struct file_result res;
bool hardlink = false;
+ const char *file;
if (elf_version (EV_CURRENT) == EV_NONE)
error (1, 0, "library out of date\n");
@@ -13390,6 +13391,7 @@ main (int argc, char *argv[])
if (optind == argc || optind + 1 == argc)
{
+ file = optind == argc ? "a.out" : argv[optind];
if (multifile != NULL)
{
error (0, 0, "Too few files for multifile optimization");
@@ -13398,13 +13400,11 @@ main (int argc, char *argv[])
res.die_count = 0;
ret = (low_mem_die_limit == 0
? 2
- : dwz (optind == argc ? "a.out" : argv[optind], outfile,
- &res, NULL, NULL));
+ : dwz (file, outfile, &res, NULL, NULL));
if (ret == 2)
{
multifile_mode = MULTIFILE_MODE_LOW_MEM;
- ret = dwz (optind == argc ? "a.out" : argv[optind], outfile,
- &res, NULL, NULL);
+ ret = dwz (file, outfile, &res, NULL, NULL);
}
}
else
@@ -13440,14 +13440,16 @@ main (int argc, char *argv[])
}
for (i = optind; i < argc; i++)
{
- int thisret = (low_mem_die_limit == 0
- ? 2
- : dwz (argv[i], NULL, &resa[i - optind],
- hardlinks ? resa : NULL, &argv[optind]));
+ int thisret;
+ file = argv[i];
+ thisret = (low_mem_die_limit == 0
+ ? 2
+ : dwz (file, NULL, &resa[i - optind],
+ hardlinks ? resa : NULL, &argv[optind]));
if (thisret == 2)
{
multifile_mode = MULTIFILE_MODE_LOW_MEM;
- thisret = dwz (argv[i], NULL, &resa[i - optind],
+ thisret = dwz (file, NULL, &resa[i - optind],
hardlinks ? resa : NULL, &argv[optind]);
}
else if (resa[i - optind].res == 0)
@@ -13486,6 +13488,7 @@ main (int argc, char *argv[])
for (i = optind; i < argc; i++)
{
dw_cu_ref cu;
+ file = argv[i];
multifile_mode = MULTIFILE_MODE_FI;
/* Don't process again files that couldn't
be processed successfully. */
@@ -13494,7 +13497,7 @@ main (int argc, char *argv[])
continue;
for (cu = alt_first_cu; cu; cu = cu->cu_next)
alt_clear_dups (cu->cu_die);
- ret |= dwz (argv[i], NULL, &resa[i - optind],
+ ret |= dwz (file, NULL, &resa[i - optind],
hardlinks ? resa : NULL, &argv[optind]);
}
elf_end (dso->elf);
reply other threads:[~2019-12-05 15:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191205152849.GA26238@delia \
--to=tdevries@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).