On Thu, Aug 23, 2012 at 11:14:23AM +0400, Oleg Yarigin wrote:
An original message was sent with wrong author`s name by mistake, so I resend this patch with hope it was the only reason to reject it.
It was not the only reason.
A single loop is a common pattern in C to allow safe encapsulation and handling of blocks, or doing "break;"/"continue;" style things.
One thing that it allows here in Wine is that the variable definitions are at the begin of a { } block and not in the middle of the code to allow old C standard builds to work still.
There is no "break;" usage, although I spotted 1 "goto done;" which could be just a break; ;)
The compiler will optimize everything of those loops away, so this change also brings no performance improvement.
Ciao, Marcus
include/wine/server.h | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/include/wine/server.h b/include/wine/server.h index d573d1f..dcbc7fa 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -124,19 +124,15 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) /* macros for server requests */
#define SERVER_START_REQ(type) \
- do { \
struct __server_request_info __req; \
struct type##_request * const req = &__req.u.req.type##_request; \
const struct type##_reply * const reply = &__req.u.reply.type##_reply; \
memset( &__req.u.req, 0, sizeof(__req.u.req) ); \
__req.u.req.request_header.req = REQ_##type; \
__req.data_count = 0; \
(void)reply; \
do
-#define SERVER_END_REQ \
while(0); \
- } while(0)
- struct __server_request_info __req; \
- struct type##_request * const req = &__req.u.req.type##_request; \
- const struct type##_reply * const reply = &__req.u.reply.type##_reply; \
- memset( &__req.u.req, 0, sizeof(__req.u.req) ); \
- __req.u.req.request_header.req = REQ_##type; \
- __req.data_count = 0; \
- (void)reply;
+#define SERVER_END_REQ
#endif /* __WINE_WINE_SERVER_H */ -- 1.7.9.5