+ flist_add_tail(&i->list, &bg->label_list);
+ INIT_PRIO_TREE_ROOT(&i->prio_tree);
+ return i;
+}
+
+static void __graph_value_drop(struct graph_label *l, struct graph_value *v)
+{
+ flist_del_init(&v->list);
+ if (v->tooltip)
+ free(v->tooltip);
+ free(v->value);
+ free(v);
+ l->value_count--;
+}
+
+static void graph_value_drop(struct graph_label *l, struct graph_value *v)
+{
+ if (v->flags & GV_F_PRIO_SKIP) {
+ __graph_value_drop(l, v);
+ return;
+ }
+
+ /*
+ * Find head, the guy that's on the prio tree
+ */
+ while (!(v->flags & GV_F_ON_PRIO)) {
+ assert(!flist_empty(&v->alias));
+ v = flist_entry(v->alias.next, struct graph_value, alias);
+ }
+
+ prio_tree_remove(&l->prio_tree, &v->node);
+
+ /*
+ * Free aliases
+ */
+ while (!flist_empty(&v->alias)) {
+ struct graph_value *a;
+
+ a = flist_entry(v->alias.next, struct graph_value, alias);
+ flist_del_init(&a->alias);
+
+ __graph_value_drop(l, a);
+ }
+
+ __graph_value_drop(l, v);