* [PATCH] libctf: Remove unused variable initialized to itself
@ 2021-10-06 17:18 Michael Forney
2021-10-08 14:49 ` Nick Alcock
0 siblings, 1 reply; 2+ messages in thread
From: Michael Forney @ 2021-10-06 17:18 UTC (permalink / raw)
To: binutils
2021-10-06 Michael Forney <mforney@mforney.org>
* ctf-link.c: Remove unused variable initialized to itself.
---
libctf/ctf-link.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index cc99f818970..ebb2cffd398 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -1594,7 +1594,6 @@ ctf_link_shuffle_syms (ctf_dict_t *fp)
while ((err = ctf_dynhash_next (fp->ctf_dynsyms, &i, &name_, &sym_)) == 0)
{
- const char *name = (const char *) name;
ctf_link_sym_t *symp = (ctf_link_sym_t *) sym_;
if (!ctf_assert (fp, symp->st_symidx <= fp->ctf_dynsymmax))
--
2.32.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libctf: Remove unused variable initialized to itself
2021-10-06 17:18 [PATCH] libctf: Remove unused variable initialized to itself Michael Forney
@ 2021-10-08 14:49 ` Nick Alcock
0 siblings, 0 replies; 2+ messages in thread
From: Nick Alcock @ 2021-10-08 14:49 UTC (permalink / raw)
To: Michael Forney; +Cc: binutils
On 6 Oct 2021, Michael Forney spake thusly:
> 2021-10-06 Michael Forney <mforney@mforney.org>
>
> * ctf-link.c: Remove unused variable initialized to itself.
Oops! Why didn't that elicit a compiler warning, I wonder...
> libctf/ctf-link.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
> index cc99f818970..ebb2cffd398 100644
> --- a/libctf/ctf-link.c
> +++ b/libctf/ctf-link.c
> @@ -1594,7 +1594,6 @@ ctf_link_shuffle_syms (ctf_dict_t *fp)
>
> while ((err = ctf_dynhash_next (fp->ctf_dynsyms, &i, &name_, &sym_)) == 0)
> {
> - const char *name = (const char *) name;
> ctf_link_sym_t *symp = (ctf_link_sym_t *) sym_;
>
> if (!ctf_assert (fp, symp->st_symidx <= fp->ctf_dynsymmax))
That'll work, but you can improve thins a bit more by dropping the name_
variable as well, and turning the &name_ parameter to ctf_dynhash_next
into a NULL, which is idiomatic for "I'm not using that" in _next()
functions.
(Clearly I thought I was going to use the symbol name at one point when
I wrote this code, then ended up not using it, so didn't notice the
typo: that line was meant to read
const char *name = (const char *) name_;
to get the name into a variable of the right type; but since it's unused
that's useless.)
--
NULL && (void)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-08 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 17:18 [PATCH] libctf: Remove unused variable initialized to itself Michael Forney
2021-10-08 14:49 ` Nick Alcock
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).