REMHEAD(), REMTAIL(): Move to list.h as inline functions.
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 18 Jul 2004 22:01:58 +0000 (22:01 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 18 Jul 2004 22:01:58 +0000 (22:01 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@56 38d2e660-2303-0410-9eaa-f027e97ec537

mware/list.c [deleted file]
mware/list.h

diff --git a/mware/list.c b/mware/list.c
deleted file mode 100755 (executable)
index 1970724..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*!
- * \file
- * <!--
- * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
- * Copyright 2001 Bernardo Innocenti <bernie@develer.com>
- * This file is part of DevLib - See devlib/README for information.
- * -->
- *
- * \version $Id$
- *
- * \author Bernardo Innocenti <bernie@develer.com>
- *
- * \brief List handling functions
- */
-
-/*
- * $Log$
- * Revision 1.2  2004/06/03 11:27:09  bernie
- * Add dual-license information.
- *
- * Revision 1.1  2004/05/23 15:43:16  bernie
- * Import mware modules.
- *
- */
-
-#include "list.h"
-
-
-Node *_list_rem_head(List *l)
-{
-       Node *n;
-
-       if (ISLISTEMPTY(l))
-               return (Node *)0;
-
-       n = l->head;
-       l->head = n->succ;
-       n->succ->pred = (Node *)l;
-       return n;
-}
-
-
-Node *_list_rem_tail(List *l)
-{
-       Node *n;
-
-       if (ISLISTEMPTY(l))
-               return (Node *)0;
-
-       n = l->tail;
-       l->tail = n->pred;
-       n->pred->succ = (Node *)&l->null;
-       return n;
-}
index 2d8e737aecf4e3fe078c897742bfc5f48a296de9..08d45aca6b8b99c06bba30e3633d2cf865dabb87 100755 (executable)
@@ -13,6 +13,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2004/07/18 22:01:43  bernie
+ * REMHEAD(), REMTAIL(): Move to list.h as inline functions.
+ *
  * Revision 1.2  2004/06/03 11:27:09  bernie
  * Add dual-license information.
  *
@@ -111,15 +114,38 @@ typedef struct _List
 /*! Tell whether a list is empty */
 #define ISLISTEMPTY(l)  ( (l)->head == (Node *)(&(l)->null) )
 
-/*! \name Extract an element from the head/tail of the list. If the list empty, return NULL. */
-/*\{*/
-#define REMHEAD(l) _list_rem_head(l)
-#define REMTAIL(l) _list_rem_tail(l)
-/*\}*/
+/*!
+ * \name Unlink a node from the head of the list \a l.
+ * \return Pointer to node, or NULL if the list was empty.
+ */
+INLINE Node *REMHEAD(List *l)
+{
+       Node *n;
+
+       if (ISLISTEMPTY(l))
+               return (Node *)0;
+
+       n = l->head;
+       l->head = n->succ;
+       n->succ->pred = (Node *)l;
+       return n;
+}
+
+/*!
+ * \name Unlink a node from the tail of the list \a l.
+ * \return Pointer to node, or NULL if the list was empty.
+ */
+INLINE Node *REMTAIL(List *l)
+{
+       Node *n;
 
-/* Prototypes for out-of-line functions */
-Node *_list_rem_head(List *l);
-Node *_list_rem_tail(List *l);
+       if (ISLISTEMPTY(l))
+               return (Node *)0;
 
+       n = l->tail;
+       l->tail = n->pred;
+       n->pred->succ = (Node *)&l->null;
+       return n;
+}
 
 #endif /* MWARE_LIST_H */