summaryrefslogtreecommitdiff
path: root/libsysfs/dlist.c
diff options
context:
space:
mode:
authorananth@in.ibm.com <ananth@in.ibm.com>2004-03-12 00:57:30 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:09 -0700
commitd1fb871d99db38c7704d8e583ff5e0a00e713837 (patch)
treeca79c3a02e2f45e0b2db5cb4cd4b31629eec8c44 /libsysfs/dlist.c
parent0a5417a0ebe92f96fb103399c9aacdf39c719271 (diff)
[PATCH] Libsysfs updates
Please find attached a _BIG_ patch to update udev's libsysfs. Patch applies on udev-021 and contains: 1. Updates to get udev's libsysfs to the latest (to be released) level. 2. Changes for C++ compatibility (use "char" and not "unsigned char" unless absolutely necessary). 3. More importantly, take care of buffer overflows. Libsysfs now uses a scaled down version of Kay's "safe" macros. Tested using a usb-storage device. I will send you a doc update shortly.
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.