xtclient.c, spcd_event.c: stop referencing fds_bits directly
authorJon Trulson <jon@radscan.com>
Tue, 25 Mar 2014 01:37:09 +0000 (19:37 -0600)
committerJon Trulson <jon@radscan.com>
Tue, 25 Mar 2014 01:37:09 +0000 (19:37 -0600)
cde/lib/csa/xtclient.c
cde/programs/dtspcd/spcd_event.c

index aff5b03aebdf9cb9f6898e050ca1222d0ff7393a..9e58bc0fdb4939ef0bfc09eeeade0195d1de90d2 100644 (file)
@@ -59,8 +59,7 @@ extern void
 _DtCm_register_xtcallback(XtAppContext appct)
 {
        XtInputId       id;
-       int     i, j;
-       fd_mask fmask, *bits;
+       int     i;
        fd_set  fdset = svc_fdset;
 
        DP(("xtclient.c: _DtCm_register_xtcallback()\n"));
@@ -69,29 +68,21 @@ _DtCm_register_xtcallback(XtAppContext appct)
                return;
 
        /* assuming only 1 bit is set */
-       bits = fdset.fds_bits;
-
-       for (i = 0; i < FD_SETSIZE; i += NFDBITS) {
-               fmask = *bits;
-               for (j = 0; fmask != 0; j++, fmask >>= 1) {
-                       if (fmask & 0x1) {
-
-                               if ((i + j) >= FD_SETSIZE)
-                                       break;
-
-                               /* register callback with XtAppAddInput
-                                * for rpc input
-                                */
-                               id = XtAppAddInput(appct, ((i *NFDBITS) + j),
-                                       (XtPointer)XtInputReadMask,
-                                       xtcallback, NULL);
-
-                               DP(("xtclient.c: id %d for input at fd %d\n",
-                                       id, ((i * NFDBITS) + j)));
-                       }
-               }
-               bits++;
-       }
+
+       for (i = 0; i < FD_SETSIZE; i++) {
+          if (FD_ISSET(i, &svc_fdset))
+            {
+              /* register callback with XtAppAddInput
+               * for rpc input
+               */
+              id = XtAppAddInput(appct, i,
+                                 (XtPointer)XtInputReadMask,
+                                 xtcallback, NULL);
+
+              DP(("xtclient.c: id %d for input at fd %d\n",
+                  id, ((i * NFDBITS) + j)));
+            }
+        }
 }
 
 /*****************************************************************************
index 01fdf28b13f027e809881e5fea8d9ca9d04d2c6a..a79d19f23849608fc33cf2202f1a23357c2b14c6 100644 (file)
@@ -84,11 +84,11 @@ void SPCD_MainLoopUntil(Boolean *flag)
   fd_set input_mask, except_mask;
   int n, fd;
   int result;
+
   do {
-    for (n=0; n<fd_vec_size; n++) {
-      input_mask.fds_bits[n] = Sb_Input_Mask.fds_bits[n];
-      except_mask.fds_bits[n] = Sb_Except_Mask.fds_bits[n];
-    }
+    memcpy(&input_mask, &Sb_Input_Mask, sizeof(fd_set));
+    memcpy(&except_mask, &Sb_Except_Mask, sizeof(fd_set));
+
     
     do result=select(SPCD_max_fd + 1, FD_SET_CAST(&input_mask),
                     FD_SET_CAST(NULL),