Fix multi-leg promotions
[xboard.git] / lists.c
diff --git a/lists.c b/lists.c
index a9e0d41..68f1a5d 100644 (file)
--- a/lists.c
+++ b/lists.c
@@ -1,25 +1,30 @@
 /*
- * lists.c -- Functions to implement a double linked list
- * XBoard $Id: lists.c,v 2.1 2003/10/27 19:21:00 mann Exp $
+ * lists.c -- Functions to implement a double linked list XBoard
  *
- * Copyright 1995 Free Software Foundation, Inc.
+ * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
+ * Software Foundation, Inc.
+ *
+ * Enhancements Copyright 2005 Alessandro Scotti
  *
  * ------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
+ *
+ * GNU XBoard 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; either version 2 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
  *
- * 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.
+ * GNU XBoard 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
- * ------------------------------------------------------------------------
+ * along with this program. If not, see http://www.gnu.org/licenses/.  *
  *
+ *------------------------------------------------------------------------
+ ** See the file ChangeLog for a revision history.  */
+
+/*
  * This file could well be a part of backend.c, but I prefer it this
  * way.
  */
@@ -39,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);
 }
@@ -48,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;
@@ -59,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;
@@ -73,8 +78,8 @@ void ListRemove(n)
 
 /* Delete node n.
  */
-void ListNodeFree(n)
-    ListNode *n;
+void
+ListNodeFree (ListNode *n)
 {
     if (n) {
        ListRemove(n);
@@ -85,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;
 
@@ -100,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;
@@ -112,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);
 }
@@ -122,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);
 }
@@ -133,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;