Merge branch 'for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
[sfrench/cifs-2.6.git] / tools / perf / util / rblist.c
index 0dfe27d99458c845991e490283c067d0d0706221..0efc3258c64865f0a6174280842e34c9447691da 100644 (file)
@@ -101,16 +101,21 @@ void rblist__init(struct rblist *rblist)
        return;
 }
 
+void rblist__exit(struct rblist *rblist)
+{
+       struct rb_node *pos, *next = rb_first(&rblist->entries);
+
+       while (next) {
+               pos = next;
+               next = rb_next(pos);
+               rblist__remove_node(rblist, pos);
+       }
+}
+
 void rblist__delete(struct rblist *rblist)
 {
        if (rblist != NULL) {
-               struct rb_node *pos, *next = rb_first(&rblist->entries);
-
-               while (next) {
-                       pos = next;
-                       next = rb_next(pos);
-                       rblist__remove_node(rblist, pos);
-               }
+               rblist__exit(rblist);
                free(rblist);
        }
 }