Robert Shearman : rpcrt4: Convert the protseq list into a standard Wine list.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 16 13:57:39 CDT 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon Oct 16 16:49:29 2006 +0100

rpcrt4: Convert the protseq list into a standard Wine list.

---

 dlls/rpcrt4/rpc_server.c |   33 +++++++++++++--------------------
 dlls/rpcrt4/rpc_server.h |    3 ++-
 2 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c
index b613def..da71ab6 100644
--- a/dlls/rpcrt4/rpc_server.c
+++ b/dlls/rpcrt4/rpc_server.c
@@ -66,7 +66,8 @@ typedef struct _RpcObjTypeMap
 
 static RpcObjTypeMap *RpcObjTypeMaps;
 
-static RpcServerProtseq* protseqs;
+/* list of type RpcServerProtseq */
+static struct list protseqs = LIST_INIT(protseqs);
 static RpcServerInterface* ifs;
 
 static CRITICAL_SECTION server_cs;
@@ -599,16 +600,15 @@ static RPC_STATUS RPCRT4_start_listen(BO
 
   if (std_listen)
   {
-    cps = protseqs;
-    while (cps && status == RPC_S_OK)
+    LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
     {
       status = RPCRT4_start_listen_protseq(cps, TRUE);
+      if (status != RPC_S_OK)
+        break;
       
       /* make sure server is actually listening on the interface before
-      * returning */
-      if (status == RPC_S_OK)
-        RPCRT4_sync_with_server_thread(cps);
-      cps = cps->Next;
+       * returning */
+      RPCRT4_sync_with_server_thread(cps);
     }
   }
 
@@ -626,11 +626,9 @@ static void RPCRT4_stop_listen(BOOL auto
       std_listen = FALSE;
       LeaveCriticalSection(&listen_cs);
 
-      cps = protseqs;
-      while (cps) {
+      LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
         RPCRT4_sync_with_server_thread(cps);
-        cps = cps->Next;
-      }
+
       return;
     }
     assert(listen_count >= 0);
@@ -648,8 +646,7 @@ static RPC_STATUS RPCRT4_use_protseq(Rpc
     return status;
 
   EnterCriticalSection(&server_cs);
-  ps->Next = protseqs;
-  protseqs = ps;
+  list_add_head(&protseqs, &ps->entry);
   LeaveCriticalSection(&server_cs);
 
   if (std_listen)
@@ -680,14 +677,12 @@ RPC_STATUS WINAPI RpcServerInqBindings( 
   EnterCriticalSection(&server_cs);
   /* count connections */
   count = 0;
-  ps = protseqs;
-  while (ps) {
+  LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) {
     conn = ps->conn;
     while (conn) {
       count++;
       conn = conn->Next;
     }
-    ps = ps->Next;
   }
   if (count) {
     /* export bindings */
@@ -696,8 +691,7 @@ RPC_STATUS WINAPI RpcServerInqBindings( 
                               sizeof(RPC_BINDING_HANDLE)*(count-1));
     (*BindingVector)->Count = count;
     count = 0;
-    ps = protseqs;
-    while (ps) {
+    LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) {
       conn = ps->conn;
       while (conn) {
        RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count],
@@ -705,7 +699,6 @@ RPC_STATUS WINAPI RpcServerInqBindings( 
        count++;
        conn = conn->Next;
       }
-      ps = ps->Next;
     }
     status = RPC_S_OK;
   } else {
@@ -1022,7 +1015,7 @@ RPC_STATUS WINAPI RpcServerListen( UINT 
 
   TRACE("(%u,%u,%u)\n", MinimumCallThreads, MaxCalls, DontWait);
 
-  if (!protseqs)
+  if (list_empty(&protseqs))
     return RPC_S_NO_PROTSEQS_REGISTERED;
 
   status = RPCRT4_start_listen(FALSE);
diff --git a/dlls/rpcrt4/rpc_server.h b/dlls/rpcrt4/rpc_server.h
index 9452ace..b2ad8f8 100644
--- a/dlls/rpcrt4/rpc_server.h
+++ b/dlls/rpcrt4/rpc_server.h
@@ -22,13 +22,14 @@ #ifndef __WINE_RPC_SERVER_H
 #define __WINE_RPC_SERVER_H
 
 #include "rpc_binding.h"
+#include "wine/list.h"
 
 struct protseq_ops;
 
 typedef struct _RpcServerProtseq
 {
   const struct protseq_ops *ops;
-  struct _RpcServerProtseq* Next;
+  struct list entry;
   LPSTR Protseq;
   LPSTR Endpoint;
   UINT MaxCalls;




More information about the wine-cvs mailing list