Zero rx_multi_lock before initializing it
[openafs.git] / src / rx / rx_multi.c
index 96fbda8..c6af54a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
-
 #ifdef KERNEL
 #include "afs/sysincludes.h"
-#include "rx/rx.h"
 #else /* KERNEL */
-# include "rx.h"
+# include <roken.h>
 #endif /* KERNEL */
 
+#include "rx.h"
+
 /*
  * multi.c and multi.h, together with some rxgen hooks, provide a way of
  * making multiple, but similar, rx calls to multiple hosts simultaneously
  */
 
 struct multi_handle *
-multi_Init(struct rx_connection **conns, register int nConns)
+multi_Init(struct rx_connection **conns, int nConns)
 {
-    register struct rx_call **calls;
-    register short *ready;
-    register struct multi_handle *mh;
-    register int i;
+    struct rx_call **calls;
+    short *ready;
+    struct multi_handle *mh;
+    int i;
 
     /*
      * Note: all structures that are possibly referenced by other
@@ -44,16 +42,18 @@ multi_Init(struct rx_connection **conns, register int nConns)
     mh = (struct multi_handle *)osi_Alloc(sizeof(struct multi_handle));
     if (!calls || !ready || !mh)
        osi_Panic("multi_Rx: no mem\n");
+    memset(mh, 0, sizeof(struct multi_handle));
     mh->calls = calls;
     mh->nextReady = mh->firstNotReady = mh->ready = ready;
     mh->nReady = 0;
     mh->nConns = nConns;
+
 #ifdef RX_ENABLE_LOCKS
     MUTEX_INIT(&mh->lock, "rx_multi_lock", MUTEX_DEFAULT, 0);
     CV_INIT(&mh->cv, "rx_multi_cv", CV_DEFAULT, 0);
 #endif /* RX_ENABLE_LOCKS */
     for (i = 0; i < nConns; i++) {
-       register struct rx_call *call;
+       struct rx_call *call;
        call = mh->calls[i] = rx_NewCall(conns[i]);
        rx_SetArrivalProc(call, multi_Ready, (void *) mh, i);
     }
@@ -62,7 +62,7 @@ multi_Init(struct rx_connection **conns, register int nConns)
 
 /* Return the user's connection index of the most recently ready call; that is, a call that has received at least one reply packet */
 int
-multi_Select(register struct multi_handle *mh)
+multi_Select(struct multi_handle *mh)
 {
     int index;
     SPLVAR;
@@ -95,10 +95,10 @@ multi_Select(register struct multi_handle *mh)
 
 /* Called by Rx when the first reply packet of a call is received, or the call is aborted. */
 void
-multi_Ready(register struct rx_call *call, register void *amh,
-           register int index)
+multi_Ready(struct rx_call *call, void *amh,
+           int index)
 {
-    register struct multi_handle *mh = (struct multi_handle *)amh;
+    struct multi_handle *mh = (struct multi_handle *)amh;
 #ifdef RX_ENABLE_LOCKS
     MUTEX_ENTER(&mh->lock);
 #endif /* RX_ENABLE_LOCKS */
@@ -114,12 +114,12 @@ multi_Ready(register struct rx_call *call, register void *amh,
 
 /* Called when the multi rx call is over, or when the user aborts it (by using the macro multi_Abort) */
 void
-multi_Finalize(register struct multi_handle *mh)
+multi_Finalize(struct multi_handle *mh)
 {
-    register int i;
-    register int nCalls = mh->nConns;
+    int i;
+    int nCalls = mh->nConns;
     for (i = 0; i < nCalls; i++) {
-       register struct rx_call *call = mh->calls[i];
+       struct rx_call *call = mh->calls[i];
        if (call)
            rx_EndCall(call, RX_USER_ABORT);
     }
@@ -134,12 +134,12 @@ multi_Finalize(register struct multi_handle *mh)
 
 /* ignores all remaining multiRx calls */
 void
-multi_Finalize_Ignore(register struct multi_handle *mh)
+multi_Finalize_Ignore(struct multi_handle *mh)
 {
-    register int i;
-    register int nCalls = mh->nConns;
+    int i;
+    int nCalls = mh->nConns;
     for (i = 0; i < nCalls; i++) {
-       register struct rx_call *call = mh->calls[i];
+       struct rx_call *call = mh->calls[i];
        if (call)
            rx_EndCall(call, 0);
     }