Use C99 uint32_t rather than u_int32_t
[onak.git] / ll.h
diff --git a/ll.h b/ll.h
index 3890ca9c9c5f019b2b1e3375c3dce650f03e7c80..fcdbc5a37759af488e935c63c2eab841ebbe4627 100644 (file)
--- a/ll.h
+++ b/ll.h
@@ -1,9 +1,20 @@
 /*
  * ll.h - various things of used for dealing with linked lists.
  *
- * Jonathan McDowell <noodles@earth.li>
+ * Copyright 2000-2004 Jonathan McDowell <noodles@earth.li>
  *
- * Copyright 2002 Project Purple
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifndef __LL_H__
@@ -50,13 +61,35 @@ struct ll {
 struct ll *lladd(struct ll *curll, void *object);
 
 /**
+ *     lladdend - Add an item to the end of a linked list.
+ *     @curll: The list to add to. Can be NULL to create a new list.
+ *     @object: The object to add.
  *
+ *     Returns a pointer to the head of the new list.
+ */
+struct ll *lladdend(struct ll *curll, void *object);
+
+/**
+ *     lldel - Remove an item from a linked list.
+ *     @curll: The list to remove the item from.
+ *     @object: The object to remove.
+ *     @objectcmp: A pointer to a comparision function for the object type.
+ *
+ *     Trawls through the list looking for the object. If it's found then it
+ *     is removed from the list. Only one occurance is searched for. Returns
+ *     a pointer to the head of the new list.
  */
 struct ll *lldel(struct ll *curll, void *object,
        int (*objectcmp) (const void *object1, const void *object2));
 
 /**
+ *     llfind - Find an item in a linked list.
+ *     @curll: The list to look in.
+ *     @object: The object to look for.
+ *     @objectcmp: A pointer to a comparision function for the object type.
  *
+ *     Searches through a list for an object. Returns a pointer to the object
+ *     if it's found, otherwise NULL.
  */
 struct ll *llfind(struct ll *curll, void *object,
        int (*objectcmp) (const void *object1, const void *object2));
@@ -69,4 +102,15 @@ struct ll *llfind(struct ll *curll, void *object,
  */
 unsigned long llsize(struct ll *curll);
 
+/**
+ *     llfree - Frees a linked list.
+ *     @curll: The list to free.
+ *     @objectfree: A pointer to a free function for the object.
+ *
+ *     Walks through a list and free it. If a function is provided for
+ *     objectfree then it's called for each element to free them, if it's NULL
+ *     just the list is freed.
+ */
+void llfree(struct ll *curll, void (*objectfree) (void *object));
+
 #endif /* __LL_H__ */