浏览代码

Improve readability of previous commit d951b950ec1af5e6ba582a8a964dff2d9192ba41

Evgeny Grin (Karlson2k) 8 年之前
父节点
当前提交
00eb9247fe
共有 1 个文件被更改,包括 30 次插入42 次删除
  1. 30 42
      src/testcurl/test_get.c

+ 30 - 42
src/testcurl/test_get.c

@@ -119,14 +119,12 @@ testInternalGet (int poll_flag)
   struct CBC cbc;
   CURLcode errornum;
 
-  if (0 == global_port)
+  if ( (0 == global_port) &&
+       (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) )
     {
-      if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-	{
-	  global_port = 1220;
-	  if (oneone)
-	    global_port += 20;
-	}
+      global_port = 1220;
+      if (oneone)
+        global_port += 20;
     }
 
   cbc.buf = buf;
@@ -188,14 +186,12 @@ testMultithreadedGet (int poll_flag)
   struct CBC cbc;
   CURLcode errornum;
 
-  if (0 == global_port)
+  if ( (0 == global_port) &&
+       (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) )
     {
-      if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-	{
-	  global_port = 1221;
-	  if (oneone)
-	    global_port += 20;
-	}
+      global_port = 1221;
+      if (oneone)
+        global_port += 20;
     }
 
   cbc.buf = buf;
@@ -257,14 +253,12 @@ testMultithreadedPoolGet (int poll_flag)
   struct CBC cbc;
   CURLcode errornum;
 
-  if (0 == global_port)
+  if ( (0 == global_port) &&
+       (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) )
     {
-      if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-	{
-	  global_port = 1222;
-	  if (oneone)
-	    global_port += 20;
-	}
+      global_port = 1222;
+      if (oneone)
+        global_port += 20;
     }
 
   cbc.buf = buf;
@@ -341,14 +335,12 @@ testExternalGet ()
   time_t start;
   struct timeval tv;
 
-  if (0 == global_port)
+  if ( (0 == global_port) &&
+       (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) )
     {
-      if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-	{
-	  global_port = 1223;
-	  if (oneone)
-	    global_port += 20;
-	}
+      global_port = 1223;
+      if (oneone)
+        global_port += 20;
     }
 
   multi = NULL;
@@ -567,14 +559,12 @@ testStopRace (int poll_flag)
     MHD_socket fd;
     struct MHD_Daemon *d;
 
-    if (0 == global_port)
+    if ( (0 == global_port) &&
+         (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) )
       {
-	if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-	  {
-	    global_port = 1224;
-	    if (oneone)
-	      global_port += 20;
-	  }
+        global_port = 1224;
+        if (oneone)
+          global_port += 20;
       }
 
     d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
@@ -682,14 +672,12 @@ testEmptyGet (int poll_flag)
   CURLcode errornum;
   int excess_found = 0;
 
-  if (0 == global_port)
+  if ( (0 == global_port) &&
+       (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) )
     {
-      if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
-	{
-	  global_port = 1225;
-	  if (oneone)
-	    global_port += 20;
-	}
+      global_port = 1225;
+      if (oneone)
+        global_port += 20;
     }
 
   cbc.buf = buf;