From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: David Ahern <dsahern@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung.kim@lge.com>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 6/7] perf util: Add findnew method to intlist
Date: Tue, 8 Oct 2013 10:22:50 -0300 [thread overview]
Message-ID: <20131008132250.GC4018@ghostprotocols.net> (raw)
In-Reply-To: <1380395584-9025-7-git-send-email-dsahern@gmail.com>
Em Sat, Sep 28, 2013 at 01:13:03PM -0600, David Ahern escreveu:
> Similar to other findnew based methods if the requested
> object is not found, add it to the list.
> +struct int_node *intlist__findnew(struct intlist *ilist, int i)
> +{
> + struct int_node *node = intlist__find(ilist, i);
> +
> + if ((node == NULL) && (intlist__add(ilist, i) == 0))
> + node = intlist__find(ilist, i);
> +
> + return node;
This is what I should have pointed out earlier: Can't we have a
find_and_add_if_not_found routine as we have elsewhere?
Calling intlist__find() after intlist__add() looks really ugly :-\
Please take a look at my perf/core branch, several patches of this
series are there, one with minor change.
- Arnaldo
> +}
> +
> static int intlist__parse_list(struct intlist *ilist, const char *s)
> {
> char *sep;
> diff --git a/tools/perf/util/intlist.h b/tools/perf/util/intlist.h
> index 0eb00ac..aa6877d 100644
> --- a/tools/perf/util/intlist.h
> +++ b/tools/perf/util/intlist.h
> @@ -24,6 +24,7 @@ int intlist__add(struct intlist *ilist, int i);
>
> struct int_node *intlist__entry(const struct intlist *ilist, unsigned int idx);
> struct int_node *intlist__find(struct intlist *ilist, int i);
> +struct int_node *intlist__findnew(struct intlist *ilist, int i);
>
> static inline bool intlist__has_entry(struct intlist *ilist, int i)
> {
> --
> 1.7.10.1
next prev parent reply other threads:[~2013-10-08 13:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-28 19:12 [PATCH 0/7] perf trace enhancements David Ahern
2013-09-28 19:12 ` [PATCH 1/7] perf util: Add machine method to loop over threads and invoke handler David Ahern
2013-10-15 5:30 ` [tip:perf/core] perf machine: Add " tip-bot for David Ahern
2013-09-28 19:12 ` [PATCH 2/7] perf trace: Use new machine method to loop over threads David Ahern
2013-10-15 5:30 ` [tip:perf/core] " tip-bot for David Ahern
2013-09-28 19:13 ` [PATCH 3/7] perf trace: Fix comm resolution when reading events from file David Ahern
2013-10-15 5:30 ` [tip:perf/core] " tip-bot for David Ahern
2013-09-28 19:13 ` [PATCH 4/7] perf trace: Add record option David Ahern
2013-10-15 5:30 ` [tip:perf/core] " tip-bot for David Ahern
2013-09-28 19:13 ` [PATCH 5/7] perf util: Add priv variable to intlist David Ahern
2013-10-15 5:31 ` [tip:perf/core] perf intlist: Add priv member tip-bot for David Ahern
2013-09-28 19:13 ` [PATCH 6/7] perf util: Add findnew method to intlist David Ahern
2013-10-08 13:22 ` Arnaldo Carvalho de Melo [this message]
2013-09-28 19:13 ` [PATCH 7/7] perf trace: Add summary option to dump syscall statistics David Ahern
2013-10-08 1:44 ` [PATCH 0/7] perf trace enhancements David Ahern
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=20131008132250.GC4018@ghostprotocols.net \
--to=acme@ghostprotocols.net \
--cc=a.p.zijlstra@chello.nl \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.