[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131210123411.GA31129@gmail.com>
Date: Tue, 10 Dec 2013 13:34:11 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Stephane Eranian <eranian@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
"mingo@...e.hu" <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
Jiri Olsa <jolsa@...hat.com>, Ben Cheng <bccheng@...gle.com>,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCH] perf tools: fix bug in usage of the basename() function
* Stephane Eranian <eranian@...gle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists