Rob Shearman : ole32: Use the standard list functions for the global interface table implementation .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 10 05:35:56 CST 2007


Module: wine
Branch: master
Commit: 43d0d85f6713440a4a3370596b7a88772ea57872
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=43d0d85f6713440a4a3370596b7a88772ea57872

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Jan  9 17:15:06 2007 +0000

ole32: Use the standard list functions for the global interface table implementation.

---

 dlls/ole32/git.c |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/dlls/ole32/git.c b/dlls/ole32/git.c
index fbfa95f..4f8d17d 100644
--- a/dlls/ole32/git.c
+++ b/dlls/ole32/git.c
@@ -47,6 +47,7 @@
 
 #include "compobj_private.h" 
 
+#include "wine/list.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -65,8 +66,7 @@ typedef struct StdGITEntry
   IID iid;         /* IID of the interface */
   IStream* stream; /* Holds the marshalled interface */
 
-  struct StdGITEntry* next;
-  struct StdGITEntry* prev;  
+  struct list entry;
 } StdGITEntry;
 
 /* Class data */
@@ -75,8 +75,7 @@ typedef struct StdGlobalInterfaceTableIm
   const IGlobalInterfaceTableVtbl *lpVtbl;
 
   ULONG ref;
-  struct StdGITEntry* firstEntry;
-  struct StdGITEntry* lastEntry;
+  struct list list;
   ULONG nextCookie;
   
 } StdGlobalInterfaceTableImpl;
@@ -116,13 +115,11 @@ StdGlobalInterfaceTable_FindEntry(IGloba
   TRACE("iface=%p, cookie=0x%x\n", iface, (UINT)cookie);
 
   EnterCriticalSection(&git_section);
-  e = self->firstEntry;
-  while (e != NULL) {
+  LIST_FOR_EACH_ENTRY(e, &self->list, StdGITEntry, entry) {
     if (e->cookie == cookie) {
       LeaveCriticalSection(&git_section);
       return e;
     }
-    e = e->next;
   }
   LeaveCriticalSection(&git_section);
   
@@ -224,11 +221,7 @@ StdGlobalInterfaceTable_RegisterInterfac
   self->nextCookie++; /* inc the cookie count */
 
   /* insert the new entry at the end of the list */
-  entry->next = NULL;
-  entry->prev = self->lastEntry;
-  if (entry->prev) entry->prev->next = entry;
-  else self->firstEntry = entry;
-  self->lastEntry = entry;
+  list_add_tail(&self->list, &entry->entry);
 
   /* and return the cookie */
   *pdwCookie = entry->cookie;
@@ -243,7 +236,6 @@ static HRESULT WINAPI
 StdGlobalInterfaceTable_RevokeInterfaceFromGlobal(
                IGlobalInterfaceTable* iface, DWORD dwCookie)
 {
-  StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface;
   StdGITEntry* entry;
   HRESULT hr;
 
@@ -266,10 +258,7 @@ StdGlobalInterfaceTable_RevokeInterfaceF
 		    
   /* chop entry out of the list, and free the memory */
   EnterCriticalSection(&git_section);
-  if (entry->prev) entry->prev->next = entry->next;
-  else self->firstEntry = entry->next;
-  if (entry->next) entry->next->prev = entry->prev;
-  else self->lastEntry = entry->prev;
+  list_remove(&entry->entry);
   LeaveCriticalSection(&git_section);
 
   HeapFree(GetProcessHeap(), 0, entry);
@@ -400,8 +389,7 @@ void* StdGlobalInterfaceTable_Construct(
 
   newGIT->lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl;
   newGIT->ref = 1;      /* Initialise the reference count */
-  newGIT->firstEntry = NULL; /* we start with an empty table   */
-  newGIT->lastEntry  = NULL;
+  list_init(&newGIT->list);
   newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */
   TRACE("Created the GIT at %p\n", newGIT);
 




More information about the wine-cvs mailing list