Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/telnet Duh, generate the pollfd arrays outside of lo...



details:   https://anonhg.NetBSD.org/src/rev/a2d73956cc79
branches:  trunk
changeset: 536565:a2d73956cc79
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Wed Sep 18 19:48:58 2002 +0000

description:
Duh, generate the pollfd arrays outside of loops, not that it really matters.

diffstat:

 usr.bin/telnet/network.c   |   8 ++++----
 usr.bin/telnet/tn3270.c    |  12 ++++++------
 usr.bin/telnet/utilities.c |  10 ++++------
 3 files changed, 14 insertions(+), 16 deletions(-)

diffs (117 lines):

diff -r 1f5b68ab2967 -r a2d73956cc79 usr.bin/telnet/network.c
--- a/usr.bin/telnet/network.c  Wed Sep 18 19:40:34 2002 +0000
+++ b/usr.bin/telnet/network.c  Wed Sep 18 19:48:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: network.c,v 1.9 2002/09/18 19:40:34 mycroft Exp $      */
+/*     $NetBSD: network.c,v 1.10 2002/09/18 19:48:58 mycroft Exp $     */
 
 /*
  * Copyright (c) 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)network.c  8.2 (Berkeley) 12/15/93";
 #else
-__RCSID("$NetBSD: network.c,v 1.9 2002/09/18 19:40:34 mycroft Exp $");
+__RCSID("$NetBSD: network.c,v 1.10 2002/09/18 19:48:58 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -89,9 +89,9 @@
     struct pollfd set[0];
     int value;
 
+    set[0].fd = net;
+    set[0].events = POLLPRI;
     do {
-       set[0].fd = net;
-       set[0].events = POLLPRI;
        value = poll(set, 1, 0);
     } while ((value == -1) && (errno == EINTR));
 
diff -r 1f5b68ab2967 -r a2d73956cc79 usr.bin/telnet/tn3270.c
--- a/usr.bin/telnet/tn3270.c   Wed Sep 18 19:40:34 2002 +0000
+++ b/usr.bin/telnet/tn3270.c   Wed Sep 18 19:48:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tn3270.c,v 1.11 2002/09/18 19:40:35 mycroft Exp $      */
+/*     $NetBSD: tn3270.c,v 1.12 2002/09/18 19:48:59 mycroft Exp $      */
 
 /*
  * Copyright (c) 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)tn3270.c   8.2 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: tn3270.c,v 1.11 2002/09/18 19:40:35 mycroft Exp $");
+__RCSID("$NetBSD: tn3270.c,v 1.12 2002/09/18 19:48:59 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,10 +135,10 @@
        if (NETROOM() < 6) {
            struct pollfd set[1];
 
+           set[0].fd = net;
+           set[0].events = POLLOUT;
            netflush();
            while (NETROOM() < 6) {
-               set[0].fd = net;
-               set[0].events = POLLOUT;
                (void) poll(set, 1, INFTIM);
                netflush();
            }
@@ -218,12 +218,12 @@
 #if    defined(unix)
            struct pollfd set[1];
 
+           set[0].fd = tout;
+           set[0].events = POLLOUT;
 #endif /* defined(unix) */
            (void) ttyflush(0);
            while (TTYROOM() == 0) {
 #if    defined(unix)
-               set[0].fd = tout;
-               set[0].events = POLLOUT;
                (void) poll(set, 1, INFTIM);
 #endif /* defined(unix) */
                (void) ttyflush(0);
diff -r 1f5b68ab2967 -r a2d73956cc79 usr.bin/telnet/utilities.c
--- a/usr.bin/telnet/utilities.c        Wed Sep 18 19:40:34 2002 +0000
+++ b/usr.bin/telnet/utilities.c        Wed Sep 18 19:48:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utilities.c,v 1.11 2002/09/18 19:40:35 mycroft Exp $   */
+/*     $NetBSD: utilities.c,v 1.12 2002/09/18 19:48:59 mycroft Exp $   */
 
 /*
  * Copyright (c) 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)utilities.c        8.3 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: utilities.c,v 1.11 2002/09/18 19:40:35 mycroft Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.12 2002/09/18 19:48:59 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -898,20 +898,18 @@
 #if    defined(unix)
     struct pollfd set[1];
 
+    set[0].fd = tout;
+    set[0].events = POLLOUT;
 #endif /* defined(unix) */
 
     if (TTYBYTES() == 0) {
 #if    defined(unix)
-       set[0].fd = tout;
-       set[0].events = POLLOUT;
        (void) poll(set, 1, INFTIM);
 #endif /* defined(unix) */
     } else {
        while (TTYBYTES()) {
            (void) ttyflush(0);
 #if    defined(unix)
-           set[0].fd = tout;
-           set[0].events = POLLOUT;
            (void) poll(set, 1, INFTIM);
 #endif /* defined(unix) */
        }



Home | Main Index | Thread Index | Old Index