-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 25.01.2014 23:24, Evgeny Grin wrote: > > > 25.01.2014, 18:05, "LRN" <[email protected]>: >> Actually, i meant the error-handling code. Imagine you've called >> accept(), and want to check the errno for possible errors. But >> WS2 version of accept() doesn't set errno, it sets LastError. You >> need to convert LastError to errno, otherwise your errno check >> won't work. Adding conversion function call after the function >> call might work in some (most, actually) cases, if it's hidden >> under a platform-specific macro that expands to nothing on >> non-W32 platforms, but using it might be error-prone (not doing >> this call will result in subtle runtime behaviour change that >> will be difficult to catch, and only affects W32). > > Only small subset of functions really need LastError -> errno > conversion. And select() and accept() are macroses already. So we > are talking about removal of most wrappers and move smaller number > of wrappers from PlibC to MHD code. I believe that this will > improve code quality. > Function that need errno conversion: recv() send() accept() socket()
soft requirements (for error reporting only): setsockopt() bind() listen() select() and socketpair() will be implementations, so they don't pose any questions. Going back to the list of imports: Wrappers that ARE needed (require errno conversion): _win_recv _win_send _win_accept _win_socket Wrappers that are NOT needed, but are good to have for error reporting (again, they do errno conversion): _win_setsockopt _win_bind _win_listen Implementations (may or may not be simplified, depends on the case): _win_mmap _win_munmap _win_select _win_socketpair _win_strerror Wrappers that are not needed: _win_close - define CLOSE(s) closesocket(s) _win_shutdown - define SHUTDOWN(s) shutdown(s) _win_write - wrapper Utility functions that are likely not needed: _SetErrnoFromWinError - client and wrapper/implementation code will be synchronized with regards to error handling (i.e. the function will only convert the errors that the caller checks for), so this generic function is only needed for error reporting (and having actual W32 error codes is usually better for that purpose anyway). plibc_init - they mostly do unneeded stuff, however WS2 startup plibc_shutdown - and cleanup functions may need to be called in MHD. Implementations that are not needed (already in MHD): _win_tdelete _win_tfind _win_tsearch - -- O< ascii ribbon - stop html email! - www.asciiribbon.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) iQEcBAEBAgAGBQJS5FTZAAoJEOs4Jb6SI2Cw2GcH/2OS471bwp/4E8A9lJFWzY/a y3Q856UNhJAxYpAgHA5otVtaeyzAP6tBgDfMhbIDUCUY4o983Z3VTJNL8221Ofo1 ItU1rBvGKodsVp/1XTaNdOii7vB+8Mb78OomntMKdICysZ2BQmEESWg3pK9to9ty P5kktnwuQx7pQT7hMbX520LsM+79aVD7wgWxEzducT+DLJkYZ6n9CqYXUZObQvi3 sVS0Fe6t74ZdodQI6PqETCsCoc1ZGyz2XuiF1HpPeSgH8Rn0c4eciew2l0RF8Aw9 +htCTI+nhqTLzb6lr8SoSji/tUW7dasD1Y34/VbLMkOPbMH9ZbJt1WfinlXEFFU= =UYUx -----END PGP SIGNATURE-----
