[Live-devel] RTSPServer: redeclaration and one cycle only
Renato MAURO (Libero)
renatomauro at libero.it
Fri Jul 25 10:15:13 PDT 2008
Hi Ross.
Don't worry, this is not an help request, only an explanation one.
Watching this code
TSPServer*
RTSPServer::createNew(UsageEnvironment& env, Port ourPort,
UserAuthenticationDatabase* authDatabase,
unsigned reclamationTestSeconds) {
int ourSocket = -1;
do {
int ourSocket = setUpOurSocket(env, ourPort);
if (ourSocket == -1) break;
return new RTSPServer(env, ourSocket, ourPort, authDatabase,
reclamationTestSeconds);
} while (0);
if (ourSocket != -1) ::closeSocket(ourSocket);
return NULL;
}
we see that 'ourSocket' is redeclared in the do-while loop.
1) I'm wondering if the redeclaration is intentional or not and so if the
last 'if' is useful or not.
2) Maybe it's my lack of knowledge: why write a single do-while cicle
instead of use an if-else structure?
Thank you very much,
Renato MAURO
More information about the live-devel
mailing list