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 <[email protected]>
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> >  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

Reply via email to