diff options
author | Suzuki K. Poulose <suzuki@in.ibm.com> | 2012-08-31 12:39:18 +0530 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-24 14:20:11 -0200 |
commit | 03f2f93ae00762eb881424df1c688d034fd341ee (patch) | |
tree | d0f58d63e0447ff86c9e1c24ec226a0adcce4e8d /tools/perf/util | |
parent | 68e94f4eb56d92ccb617a98fcac5e575702ec4fd (diff) |
Account the nr_entries in rblist properly
The nr_entries in rblist is never decremented when an element
is deleted. Also, use rblist__remove_node to delete a node in
rblist__delete(). This would keep the nr_entries sane.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Acked-by: David S. Ahern <dsahern@gmail.com>
Cc: David S. Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/20120831070834.14806.87398.stgit@suzukikp.in.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/rblist.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/rblist.c b/tools/perf/util/rblist.c index 0171fb61100..a16cdd2625a 100644 --- a/tools/perf/util/rblist.c +++ b/tools/perf/util/rblist.c @@ -44,6 +44,7 @@ int rblist__add_node(struct rblist *rblist, const void *new_entry) void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node) { rb_erase(rb_node, &rblist->entries); + --rblist->nr_entries; rblist->node_delete(rblist, rb_node); } @@ -87,8 +88,7 @@ void rblist__delete(struct rblist *rblist) while (next) { pos = next; next = rb_next(pos); - rb_erase(pos, &rblist->entries); - rblist->node_delete(rblist, pos); + rblist__remove_node(rblist, pos); } free(rblist); } |