From d1fb871d99db38c7704d8e583ff5e0a00e713837 Mon Sep 17 00:00:00 2001 From: "ananth@in.ibm.com" Date: Fri, 12 Mar 2004 00:57:30 -0800 Subject: [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. --- libsysfs/dlist.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libsysfs/dlist.c') 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. -- cgit v1.2.3-54-g00ecf