While I was trying to understand how Wine uses named pipes internally, I came across a loop that had been partially unrolled for no good reason. Seems trivially correct, and 'make check' still passes... Changelog * 10 Feb 2003 dlls/ole32/rpc.c - roll loop back up to avoid code duplication GPL/BSD -- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
Index: rpc.c =================================================================== RCS file: /home/wine/wine/dlls/ole32/rpc.c,v retrieving revision 1.8 diff -u -p -d -u -r1.8 rpc.c --- rpc.c 7 Jan 2003 20:36:27 -0000 1.8 +++ rpc.c 12 Feb 2003 08:05:25 -0000 @@ -652,28 +652,7 @@ _StubMgrThread(LPVOID param) { sprintf(pipefn,OLESTUBMGR"_%08lx",GetCurrentProcessId()); TRACE("Stub Manager Thread starting on (%s)\n",pipefn); - listenPipe = CreateNamedPipeA( - pipefn, - PIPE_ACCESS_DUPLEX, - PIPE_TYPE_BYTE|PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, - 4096, - 4096, - NMPWAIT_USE_DEFAULT_WAIT, - NULL - ); - if (listenPipe == INVALID_HANDLE_VALUE) { - FIXME("pipe creation failed for %s, le is %lx\n",pipefn,GetLastError()); - return 1; /* permanent failure, so quit stubmgr thread */ - } - while (1) { - if (!ConnectNamedPipe(listenPipe,NULL)) { - ERR("Failure during ConnectNamedPipe %lx!\n",GetLastError()); - CloseHandle(listenPipe); - continue; - } - PIPE_StartRequestThread(listenPipe); listenPipe = CreateNamedPipeA( pipefn, PIPE_ACCESS_DUPLEX, @@ -688,6 +667,12 @@ _StubMgrThread(LPVOID param) { FIXME("pipe creation failed for %s, le is %lx\n",pipefn,GetLastError()); return 1; /* permanent failure, so quit stubmgr thread */ } + if (!ConnectNamedPipe(listenPipe,NULL)) { + ERR("Failure during ConnectNamedPipe %lx!\n",GetLastError()); + CloseHandle(listenPipe); + continue; + } + PIPE_StartRequestThread(listenPipe); } return 0; }