From 3c35e2d14d03e57c7b57918e1142f61c5375a9ba Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Mon, 24 Mar 2014 19:37:09 -0600 Subject: [PATCH] xtclient.c, spcd_event.c: stop referencing fds_bits directly --- cde/lib/csa/xtclient.c | 41 +++++++++++++------------------- cde/programs/dtspcd/spcd_event.c | 8 +++---- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/cde/lib/csa/xtclient.c b/cde/lib/csa/xtclient.c index aff5b03a..9e58bc0f 100644 --- a/cde/lib/csa/xtclient.c +++ b/cde/lib/csa/xtclient.c @@ -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))); + } + } } /***************************************************************************** diff --git a/cde/programs/dtspcd/spcd_event.c b/cde/programs/dtspcd/spcd_event.c index 01fdf28b..a79d19f2 100644 --- a/cde/programs/dtspcd/spcd_event.c +++ b/cde/programs/dtspcd/spcd_event.c @@ -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