Bladeren bron

Minor readability improvements

Evgeny Grin (Karlson2k) 4 jaren geleden
bovenliggende
commit
280fb849e0
3 gewijzigde bestanden met toevoegingen van 8 en 9 verwijderingen
  1. 3 3
      src/examples/websocket_threaded_example.c
  2. 1 1
      src/microhttpd/daemon.c
  3. 4 5
      src/microhttpd/mhd_threads.h

+ 3 - 3
src/examples/websocket_threaded_example.c

@@ -420,9 +420,9 @@ is_websocket_request (struct MHD_Connection *con, const char *upg_header,
 
   (void) con;  /* Unused. Silent compiler warning. */
 
-  return (upg_header != NULL) && (con_header != NULL)
-         && (0 == strcmp (upg_header, WS_UPGRADE_VALUE))
-         && (NULL != strstr (con_header, "Upgrade"))
+  return ((upg_header != NULL) && (con_header != NULL)
+          && (0 == strcmp (upg_header, WS_UPGRADE_VALUE))
+          && (NULL != strstr (con_header, "Upgrade")))
          ? MHD_YES
          : MHD_NO;
 }

+ 1 - 1
src/microhttpd/daemon.c

@@ -2157,7 +2157,7 @@ thread_main_handle_connection (void *data)
 #else
                          1,
 #endif
-                         (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0)
+                         (NULL == tvp) ? -1 : (tv.tv_sec * 1000)) < 0)
       {
         if (MHD_SCKT_LAST_ERR_IS_ (MHD_SCKT_EINTR_))
           continue;

+ 4 - 5
src/microhttpd/mhd_threads.h

@@ -150,10 +150,9 @@ typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_;
  * @param thread handle to watch
  * @return nonzero on success, zero otherwise
  */
-#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject ( \
-                                    (thread), INFINITE) ? (CloseHandle ( \
-                                                             (thread)), ! 0) : \
-                                  0)
+#define MHD_join_thread_(thread) \
+  ( (WAIT_OBJECT_0 == WaitForSingleObject ( (thread), INFINITE)) ? \
+    (CloseHandle ( (thread)), ! 0) : 0 )
 #endif
 
 #if defined(MHD_USE_POSIX_THREADS)
@@ -239,7 +238,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
  */
 int
 MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
-                          const char*thread_name,
+                          const char *thread_name,
                           size_t stack_size,
                           MHD_THREAD_START_ROUTINE_ start_routine,
                           void *arg);