summaryrefslogtreecommitdiff
path: root/libsysfs/dlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsysfs/dlist.c')
-rw-r--r--libsysfs/dlist.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c
index a94ab1f854..942eccb48c 100644
--- a/libsysfs/dlist.c
+++ b/libsysfs/dlist.c
@@ -260,6 +260,16 @@ void dlist_unshift(Dlist *list,void *data)
dlist_insert(list,data,0);
}
+void dlist_unshift_sorted(Dlist *list, void *data,
+ int (*sorter)(void *new, void *old))
+{
+ if (list->count == 0)
+ dlist_unshift(list, data);
+ else {
+ list->marker=list->head->next;
+ dlist_insert_sorted(list, data, sorter);
+ }
+}
/*
* Remove end node from list.