Browse Source

Avoiding conditional directives that split up statements.

Romero Malaquias 9 years ago
parent
commit
0326c3b769
1 changed files with 3 additions and 2 deletions
  1. 3 2
      examples/networklayer_tcp.c

+ 3 - 2
examples/networklayer_tcp.c

@@ -117,10 +117,11 @@ socket_recv(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeou
         UA_ByteString_deleteMembers(response);
 #ifdef _WIN32
         const int last_error = WSAGetLastError();
-        if(last_error == WSAEINTR || last_error == WSAEWOULDBLOCK)
+        #define TEST_RETRY (last_error == WSAEINTR || last_error == WSAEWOULDBLOCK)
 #else
-		if(errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
+        #define TEST_RETRY (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
 #endif
+        if (TEST_RETRY)
             return UA_STATUSCODE_GOOD; /* retry */
         else {
             socket_close(connection);