[ofw] [PATCH] dlist: eliminate dlist.c

Sean Hefty sean.hefty at intel.com
Mon Jun 22 11:26:54 PDT 2009


dlist.c only contains 2 functions.  Remove it and implement the
functions inline in the header file.  This simplifies the use of
dlist and matches the implementation of linux list.h.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
I don't know how SVN actually generates a diff for a deleted file,
so just imagine that dlist.c goes away.

Index: dlist.h
===================================================================
--- dlist.h	(revision 2249)
+++ dlist.h	(working copy)
@@ -52,7 +52,13 @@
 	return pHead->Next == pHead;
 }
 
-void DListInsertAfter(DLIST_ENTRY *pNew, DLIST_ENTRY *pHead);
+static void DListInsertAfter(DLIST_ENTRY *pNew, DLIST_ENTRY *pHead)
+{
+	pNew->Next = pHead->Next;
+	pNew->Prev = pHead;
+	pHead->Next->Prev = pNew;
+	pHead->Next = pNew;
+}
 
 static void DListInsertBefore(DLIST_ENTRY *pNew, DLIST_ENTRY *pHead)
 {
@@ -62,7 +68,11 @@
 #define DListInsertHead DListInsertAfter
 #define DListInsertTail DListInsertBefore
 
-void DListRemove(DLIST_ENTRY *pEntry);
+static void DListRemove(DLIST_ENTRY *pEntry)
+{
+	pEntry->Prev->Next = pEntry->Next;
+	pEntry->Next->Prev = pEntry->Prev;
+}
 
 #ifdef __cplusplus
 }




More information about the ofw mailing list