lkml.org 
[lkml]   [2020]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/9] perf tools: Pass build_id object to dso__set_build_id
On Wed, Oct 14, 2020 at 08:51:44AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Oct 13, 2020 at 09:24:37PM +0200, Jiri Olsa escreveu:
> > Passing build_id object to dso__set_build_id, so it's easier
> > to initialize dos's build id object.
> >
> > Acked-by: Ian Rogers <irogers@google.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/perf/util/dso.c | 4 ++--
> > tools/perf/util/dso.h | 2 +-
> > tools/perf/util/header.c | 4 +++-
> > tools/perf/util/symbol-minimal.c | 2 +-
> > tools/perf/util/symbol.c | 2 +-
> > 5 files changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> > index 2f7f01ead9a1..4415ce83150b 100644
> > --- a/tools/perf/util/dso.c
> > +++ b/tools/perf/util/dso.c
> > @@ -1326,9 +1326,9 @@ void dso__put(struct dso *dso)
> > dso__delete(dso);
> > }
> >
> > -void dso__set_build_id(struct dso *dso, void *build_id)
> > +void dso__set_build_id(struct dso *dso, struct build_id *bid)
> > {
> > - memcpy(dso->bid.data, build_id, sizeof(dso->bid.data));
> > + dso->bid = *bid;
>
> Can't we use bid->size here?
>
> dso->bid.size = bid->size;
> memcpy(dso->bid.data, bid->data, bid->size));
>
> ?
>
> Not worth it? Probably :-)

yea, I wonder compiler will do the same thing in both cases,
but I don't know ;-)

I wanted to demonstrate that it's the same object

jirka

\
 
 \ /
  Last update: 2020-10-14 14:00    [W:0.061 / U:6.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site