DLIST_CONTAINS
Tom Jansen
tom at ninja.nl
Wed Jun 19 13:47:02 GMT 2002
Hello,
I need to check if an entry is part of a dlinkedlist or not. My searches in
samba code did not give me such a functions.
I'm not a real C-Macro god at all, so I challenge _you_ to write a nice Macro
for the following function :-)
This Macro should become part of include/dlinklist.h
/* check if an element is part of the list. */
int DLIST_CONTAINS(list, p) {
if (!p || !list) return False;
do {
if (p == list) return True;
p = p->next;
} while (p);
return False;
}
Thank you in advance,
Tom
PS Yes Andrew, this is for removing the filedescriptors from libsmbclient.so
--
Tom Jansen -- tom at ninja.nl
Ninja ISD -- www.ninja.nl
More information about the samba-technical
mailing list