Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r1170 committed - Replace tight gotos with equivalent do-while.

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r1170 committed - Replace tight gotos with equivalent do-while.


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r1170 committed - Replace tight gotos with equivalent do-while.
  • Date: Thu, 20 Nov 2014 00:29:56 +0000

Revision: 1170
Author:

Date: Thu Nov 20 00:29:27 2014 UTC
Log: Replace tight gotos with equivalent do-while.
https://code.google.com/p/ndt/source/detail?r=1170

Modified:
/trunk/src/web100srv.c

=======================================
--- /trunk/src/web100srv.c Wed May 28 11:17:18 2014 UTC
+++ /trunk/src/web100srv.c Thu Nov 20 00:29:27 2014 UTC
@@ -2116,22 +2116,21 @@
sel_tv.tv_sec = 3; // 3 seconds == WAIT_TIME_SRVR
sel_tv.tv_usec = 0;
log_println(3, "Waiting for new connection, timer running");
-sel_11: retcode = select(listenfd + 1, &rfd, NULL, NULL, &sel_tv);
- if ((retcode == -1) && (errno == EINTR))
- /* continue; */ // a signal caused the select() to exit, re-enter
- // loop & check
- goto sel_11;
- tt = time(0);
+ do {
+ retcode = select(listenfd + 1, &rfd, NULL, NULL, &sel_tv);
+ // retry if a signal caused select() to exit.
+ } while ((retcode == -1) && (errno == EINTR));
+ tt = time(0);

} else {
// Nothing is in the queue, so wait forever until a new connection
// request arrives
log_println(3, "Timer not running, waiting for new connection");
mclients = 0;
-sel_12: retcode = select(listenfd + 1, &rfd, NULL, NULL, NULL);
- if ((retcode == -1) && (errno == EINTR))
- goto sel_12;
- // a signal caused the select() to exit, re-enter loop & check
+ do {
+ retcode = select(listenfd + 1, &rfd, NULL, NULL, NULL);
+ // retry if a signal caused the select() to exit
+ } while ((retcode == -1) && (errno == EINTR));
}

if (retcode < 0) {


  • [ndt-dev] [ndt] r1170 committed - Replace tight gotos with equivalent do-while., ndt, 11/20/2014

Archive powered by MHonArc 2.6.16.

Top of Page