From: Ingo Molnar <mingo@kernel.org>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"mingo@elte.hu" <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Jiri Olsa <jolsa@redhat.com>, Ben Cheng <bccheng@google.com>,
David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH] perf tools: fix bug in usage of the basename() function
Date: Tue, 10 Dec 2013 13:34:11 +0100 [thread overview]
Message-ID: <20131210123411.GA31129@gmail.com> (raw)
In-Reply-To: <CABPqkBR8Q=iV_-0O=BNkxCyuu7C3GUjB+ZjQc-Kysux3pE16vA@mail.gmail.com>
* Stephane Eranian <eranian@google.com> wrote:
> >> + base = strdup(basename(lname));
> >> +
> >> + free(lname);
> >> +
> >> + if (!base)
> >> + return;
> >> +
> >> + if (dso->sname_alloc)
> >> + free((char *)dso->short_name);
> >
> > That cast is probably not needed.
> >
> It is with my compiler. It prints out a warning otherwise.
Yeah, see my previous mail, I think having dso->short_name as 'const'
is a mistake, as there are really just two main usecases for methods
that operate on 'struct dso':
- life time affecting (setup/free) methods which need access to all
fields, which don't want dso->short_name as a const (as evidenced
by the cast).
- actual usage methods that get a 'const struct dso' anyway, so they
don't need dso->short_name as a const.
Thanks,
Ingo
prev parent reply other threads:[~2013-12-10 12:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 1:55 [PATCH] perf tools: fix bug in usage of the basename() function Stephane Eranian
2013-12-05 8:59 ` Ingo Molnar
2013-12-05 18:19 ` Stephane Eranian
2013-12-10 12:34 ` Ingo Molnar [this message]
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=20131210123411.GA31129@gmail.com \
--to=mingo@kernel.org \
--cc=acme@redhat.com \
--cc=bccheng@google.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/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