mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Stephane Eranian" <eranian@google.com>,
	"Tom Zanussi" <tzanussi@gmail.com>
Subject: [PATCH 2/6] perf ui: Introduce routine ui_browser__is_current_entry
Date: Fri, 25 Jun 2010 10:59:22 -0300	[thread overview]
Message-ID: <1277474366-7958-3-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1277474366-7958-1-git-send-email-acme@infradead.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Will be used in more places in the new tree widget.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index cf182ca..1e774e7 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -270,6 +270,11 @@ struct ui_browser {
 	u32		nr_entries;
 };
 
+static bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row)
+{
+	return (self->first_visible_entry_idx + row) == self->index;
+}
+
 static void ui_browser__refresh_dimensions(struct ui_browser *self)
 {
 	int cols, rows;
@@ -286,8 +291,8 @@ static void ui_browser__refresh_dimensions(struct ui_browser *self)
 
 static void ui_browser__reset_index(struct ui_browser *self)
 {
-        self->index = self->first_visible_entry_idx = 0;
-        self->first_visible_entry = NULL;
+	self->index = self->first_visible_entry_idx = 0;
+	self->first_visible_entry = NULL;
 }
 
 static int objdump_line__show(struct objdump_line *self, struct list_head *head,
@@ -353,7 +358,7 @@ static int ui_browser__refresh_entries(struct ui_browser *self)
 	pos = list_entry(self->first_visible_entry, struct objdump_line, node);
 
 	list_for_each_entry_from(pos, head, node) {
-		bool current_entry = (self->first_visible_entry_idx + row) == self->index;
+		bool current_entry = ui_browser__is_current_entry(self, row);
 		SLsmg_gotorc(self->top + row, self->left);
 		objdump_line__show(pos, head, self->width,
 				   he, len, current_entry);
-- 
1.6.2.5


  parent reply	other threads:[~2010-06-25 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 13:59 [GIT PULL 0/6] perf/core improvements and fixes for 2.6.36 Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 1/6] perf scripts perl: Makefile fix Arnaldo Carvalho de Melo
2010-06-25 13:59 ` Arnaldo Carvalho de Melo [this message]
2010-06-25 13:59 ` [PATCH 3/6] perf ui: Introduce ui_browser->seek to support multiple list structures Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 4/6] perf ui: Separate showing the entries from running the browser Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 5/6] perf ui: Move objdump_line specific stuff out of ui_browser Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 6/6] perf kvm: Get rid of unused guest_kallsyms Arnaldo Carvalho de Melo
2010-06-25 14:17 ` [GIT PULL 0/6] perf/core improvements and fixes for 2.6.36 Ingo Molnar

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=1277474366-7958-3-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tzanussi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®