Committer: Miika Komu <miika@xxxxxx> Date: Sun Feb 14 14:32:17 2010 +0200 Revision: 3628 Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: Doxygen for linked lists in the firewall. Modified: M firewall/dlist.c M firewall/hslist.c M firewall/hslist.c.doxyme === modified file 'firewall/dlist.c' --- firewall/dlist.c 2010-02-11 17:21:17 +0000 +++ firewall/dlist.c 2010-02-14 12:32:17 +0000 @@ -3,13 +3,14 @@ * * Distributed under <a href="http://www.gnu.org/licenses/gpl2.txt";>GNU/GPL</a>. * - * Linked list implementation operating based on pointers. It is + * Two-way linked list implementation operating based on pointers. It is * recommended to use lib/core/list.h implementation which supports * searching based on indexes (rather than pointers) can later also be * easily changed into a hashtable if needed. * * @brief Simple linked list implementation * + * @author Essi Vehmersalo */ #include "dlist.h" === modified file 'firewall/hslist.c' --- firewall/hslist.c 2010-02-10 23:02:52 +0000 +++ firewall/hslist.c 2010-02-14 12:32:17 +0000 @@ -1,5 +1,25 @@ +/** + * @file firewall/hslist.c + * + * Distributed under <a href="http://www.gnu.org/licenses/gpl2.txt";>GNU/GPL</a> + * + * One-way linked list implementation operating based on pointers. It is + * recommended to use lib/core/list.h implementation which supports + * searching based on indexes (rather than pointers) can later also be + * easily changed into a hashtable if needed. + * + * @brief a simple linked list implementation + * + * @author Essi Vehmersalo + */ + #include "hslist.h" +/** + * allocate a new linked list element + * + * @return the allocated linked list element (caller frees) + */ SList *alloc_slist(void) { SList *list = (SList *) malloc(sizeof(SList)); @@ -8,6 +28,11 @@ return list; } +/** + * deallocate and unlink a linked list element + * + * @param the linked list element to be deallocated + */ void free_slist(SList *list) { SList *tmp_list = NULL; @@ -20,6 +45,13 @@ } } +/** + * append an element to the linked list + * + * @param list the linked list + * @param data contents of the linked list element (stored as a pointer) + * @return a pointer to the appended element in the linked list + */ SList *append_to_slist(SList *list, void *data) { @@ -39,6 +71,12 @@ } } +/** + * traverse to the last element of the linked list + * + * @param list the linked list to be traversed + * @return the last element of the linked list + */ SList *slist_last(SList *list) { if (list) { @@ -49,6 +87,13 @@ return list; } +/** + * remove a linked list item from a list (no deallocation) + * + * @param list the linked list + * @param link the link to be unlinked from the list + * @return a pointer to the linked list + */ SList *remove_link_slist(SList *list, SList *link) { @@ -79,6 +124,13 @@ return list; } +/** + * remove and deallocated an element from the linked list + * + * @list the linked list + * @param data a pointer to the contents of an element to be removed + * @return a pointer to the linked list + */ SList *remove_from_slist(SList *list, const void *data) { === modified file 'firewall/hslist.c.doxyme' --- firewall/hslist.c.doxyme 2010-02-11 17:34:50 +0000 +++ firewall/hslist.c.doxyme 2010-02-14 12:32:17 +0000 @@ -96,4 +96,4 @@ * * @param autogen.sh * @return - */ +r*/