X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=blobdiff_plain;f=lists.c;h=68f1a5d7550d77313681e06c4726658b66e1e89c;hp=08d06e81324a84b65c65cc5fbda4e46846cc1557;hb=HEAD;hpb=e70077aab0199817f37aef9ed0bdba1bbca93b45 diff --git a/lists.c b/lists.c index 08d06e8..68f1a5d 100644 --- a/lists.c +++ b/lists.c @@ -1,7 +1,8 @@ /* * lists.c -- Functions to implement a double linked list XBoard * - * Copyright 1995, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free + * Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -43,8 +44,8 @@ /* Check, if List l is empty; returns TRUE, if it is, FALSE * otherwise. */ -int ListEmpty(l) - List *l; +int +ListEmpty (List *l) { return(l->head == (ListNode *) &l->tail); } @@ -52,8 +53,8 @@ int ListEmpty(l) /* Initialize a list. Must be executed before list is used. */ -void ListNew(l) - List *l; +void +ListNew (List *l) { l->head = (ListNode *) &l->tail; l->tail = NULL; @@ -63,8 +64,8 @@ void ListNew(l) /* Remove node n from the list it is inside. */ -void ListRemove(n) - ListNode *n; +void +ListRemove (ListNode *n) { if (n->succ != NULL) { /* Be safe */ n->pred->succ = n->succ; @@ -77,8 +78,8 @@ void ListRemove(n) /* Delete node n. */ -void ListNodeFree(n) - ListNode *n; +void +ListNodeFree (ListNode *n) { if (n) { ListRemove(n); @@ -89,8 +90,8 @@ void ListNodeFree(n) /* Create a list node with size s. Returns NULL, if out of memory. */ -ListNode *ListNodeCreate(s) - size_t s; +ListNode * +ListNodeCreate (size_t s) { ListNode *n; @@ -104,8 +105,8 @@ ListNode *ListNodeCreate(s) /* Insert node n into the list of node m after m. */ -void ListInsert(m, n) - ListNode *m, *n; +void +ListInsert (ListNode *m, ListNode *n) { n->succ = m->succ; n->pred = m; @@ -116,9 +117,8 @@ void ListInsert(m, n) /* Add node n to the head of list l. */ -void ListAddHead(l, n) - List *l; - ListNode *n; +void +ListAddHead (List *l, ListNode *n) { ListInsert((ListNode *) &l->head, n); } @@ -126,9 +126,8 @@ void ListAddHead(l, n) /* Add node n to the tail of list l. */ -void ListAddTail(l, n) - List *l; - ListNode *n; +void +ListAddTail (List *l, ListNode *n) { ListInsert((ListNode *) l->tailPred, n); } @@ -137,9 +136,8 @@ void ListAddTail(l, n) /* Return element with number n of list l. (NULL, if n doesn't exist.) * Counting starts with 0. */ -ListNode *ListElem(l, n) - List *l; - int n; +ListNode * +ListElem (List *l, int n) { ListNode *ln;