perf tools: Use perf_evlist__{first,last}, perf_evsel__next
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 13 Nov 2013 18:54:30 +0000 (15:54 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 14 Nov 2013 19:00:10 +0000 (16:00 -0300)
In a few remaining places where the equivalent open coded variant was
still being used.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-4vjnloi5fisilykwxalb5nel@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/parse-events.c
tools/perf/ui/browsers/hists.c

index ef671cd41bb3ef554478db74cecc61c6df28afca..3cbd104960871705778f37450f0e33d117430f07 100644 (file)
@@ -441,9 +441,8 @@ static int test__checkevent_pmu_name(struct perf_evlist *evlist)
 
 static int test__checkevent_pmu_events(struct perf_evlist *evlist)
 {
-       struct perf_evsel *evsel;
+       struct perf_evsel *evsel = perf_evlist__first(evlist);
 
-       evsel = list_entry(evlist->entries.next, struct perf_evsel, node);
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
        TEST_ASSERT_VAL("wrong exclude_user",
index 16848bb4c41842355be8c7a36d2df574a9c90214..089fd3713783872121403dcf40d645116b149ff5 100644 (file)
@@ -1847,13 +1847,13 @@ browse_hists:
                        switch (key) {
                        case K_TAB:
                                if (pos->node.next == &evlist->entries)
-                                       pos = list_entry(evlist->entries.next, struct perf_evsel, node);
+                                       pos = perf_evlist__first(evlist);
                                else
-                                       pos = list_entry(pos->node.next, struct perf_evsel, node);
+                                       pos = perf_evsel__next(pos);
                                goto browse_hists;
                        case K_UNTAB:
                                if (pos->node.prev == &evlist->entries)
-                                       pos = list_entry(evlist->entries.prev, struct perf_evsel, node);
+                                       pos = perf_evlist__last(evlist);
                                else
                                        pos = list_entry(pos->node.prev, struct perf_evsel, node);
                                goto browse_hists;
@@ -1943,8 +1943,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
 
 single_entry:
        if (nr_entries == 1) {
-               struct perf_evsel *first = list_entry(evlist->entries.next,
-                                                     struct perf_evsel, node);
+               struct perf_evsel *first = perf_evlist__first(evlist);
                const char *ev_name = perf_evsel__name(first);
 
                return perf_evsel__hists_browse(first, nr_entries, help,