summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/strlist.h
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2012-07-30 22:31:33 -0600
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-03 10:39:51 -0300
commitee8dd3ca43f151d9fbe1edeef68fb8a77eb9f047 (patch)
tree051af5be993ec33515d575580d408a89ee072f86 /tools/perf/util/strlist.h
parent37bbd3fff1480a1f5d57abb9e9e56f468954c1b1 (diff)
downloadop-kernel-dev-ee8dd3ca43f151d9fbe1edeef68fb8a77eb9f047.zip
op-kernel-dev-ee8dd3ca43f151d9fbe1edeef68fb8a77eb9f047.tar.gz
perf tools: Change strlist to use the new rblist
Replaces the direct use of rbtree code with the rblist API. In the end the patch is a no-op on strlist functionality; the API for strlist is not changed, only its implementaton. Signed-off-by: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1343709095-7089-3-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/strlist.h')
-rw-r--r--tools/perf/util/strlist.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/perf/util/strlist.h b/tools/perf/util/strlist.h
index 3ba8390..dd9f922 100644
--- a/tools/perf/util/strlist.h
+++ b/tools/perf/util/strlist.h
@@ -4,14 +4,15 @@
#include <linux/rbtree.h>
#include <stdbool.h>
+#include "rblist.h"
+
struct str_node {
struct rb_node rb_node;
const char *s;
};
struct strlist {
- struct rb_root entries;
- unsigned int nr_entries;
+ struct rblist rblist;
bool dupstr;
};
@@ -32,18 +33,18 @@ static inline bool strlist__has_entry(struct strlist *self, const char *entry)
static inline bool strlist__empty(const struct strlist *self)
{
- return self->nr_entries == 0;
+ return rblist__empty(&self->rblist);
}
static inline unsigned int strlist__nr_entries(const struct strlist *self)
{
- return self->nr_entries;
+ return rblist__nr_entries(&self->rblist);
}
/* For strlist iteration */
static inline struct str_node *strlist__first(struct strlist *self)
{
- struct rb_node *rn = rb_first(&self->entries);
+ struct rb_node *rn = rb_first(&self->rblist.entries);
return rn ? rb_entry(rn, struct str_node, rb_node) : NULL;
}
static inline struct str_node *strlist__next(struct str_node *sn)
OpenPOWER on IntegriCloud