Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1228440

[PATCH 2/2] perf tools: Use rb_entry_safe on first / next symbol lookup

From Alex Snast <asnast@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] perf tools: Use rb_entry_safe on first / next symbol lookup
Date 2015-09-19 15:10 +0200
Message-ID <qaq3U-2gi-23@gated-at.bofh.it> (permalink)
References <qaq3T-2gi-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Alex Snast <asnast@gmail.com>
---
 tools/perf/util/symbol.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 8b3608c..5728121 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -344,20 +344,14 @@ static struct symbol *symbols__first(struct rb_root *symbols)
 {
 	struct rb_node *n = rb_first(symbols);
 
-	if (n)
-		return rb_entry(n, struct symbol, rb_node);
-
-	return NULL;
+	return rb_entry_safe(n, struct symbol, rb_node);
 }
 
 static struct symbol *symbols__next(struct symbol *sym)
 {
 	struct rb_node *n = rb_next(&sym->rb_node);
 
-	if (n)
-		return rb_entry(n, struct symbol, rb_node);
-
-	return NULL;
+	return rb_entry_safe(n, struct symbol, rb_node);
 }
 
 struct symbol_name_rb_node {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf tools: Use postorder rbtree iteration when removing symbols Alex Snast <asnast@gmail.com> - 2015-09-19 15:10 +0200
  [PATCH 2/2] perf tools: Use rb_entry_safe on first / next symbol lookup Alex Snast <asnast@gmail.com> - 2015-09-19 15:10 +0200
  Re: [PATCH 1/2] perf tools: Use postorder rbtree iteration when  removing symbols Ingo Molnar <mingo@kernel.org> - 2015-09-20 10:10 +0200
    Re: [PATCH 1/2] perf tools: Use postorder rbtree iteration when  removing symbols Ingo Molnar <mingo@kernel.org> - 2015-09-21 09:20 +0200

csiph-web