]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
perf ui: Introduce routine ui_browser__is_current_entry
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 21 Jun 2010 15:44:42 +0000 (12:44 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 21 Jun 2010 16:35:56 +0000 (13:35 -0300)
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

index cf182ca132fef27e54e189cd5a49d9c0a29ab8e1..1e774e7f2281e201f3534c7d28680a98e464b844 100644 (file)
@@ -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);