[tor-commits] [tor/master] Wrap windows-only C files in #ifdef _WIN32

nickm at torproject.org nickm at torproject.org
Thu Jul 30 15:14:37 UTC 2015


commit beac91cf086de0178ef628778a90f3cec7e51e84
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Jul 30 11:14:15 2015 -0400

    Wrap windows-only C files in #ifdef _WIN32
    
    This should make some scripts and IDEs happier.
---
 changes/windows_only_files     |    4 ++++
 src/common/compat_winthreads.c |    4 ++++
 src/or/ntmain.c                |    4 ++++
 3 files changed, 12 insertions(+)

diff --git a/changes/windows_only_files b/changes/windows_only_files
new file mode 100644
index 0000000..0ec64b9
--- /dev/null
+++ b/changes/windows_only_files
@@ -0,0 +1,4 @@
+  o Code simplification and refactoring:
+    - Wrap windows-only C files inside '#ifdef _WIN32' so that tools that
+      try to scan or compile every file on Unix won't decide that they
+      are broken.
diff --git a/src/common/compat_winthreads.c b/src/common/compat_winthreads.c
index 71b994c..465ef3e 100644
--- a/src/common/compat_winthreads.c
+++ b/src/common/compat_winthreads.c
@@ -3,6 +3,8 @@
  * Copyright (c) 2007-2015, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
+#ifdef _WIN32
+
 #include "compat.h"
 #include <windows.h>
 #include <process.h>
@@ -194,3 +196,5 @@ tor_threads_init(void)
   set_main_thread();
 }
 
+#endif
+
diff --git a/src/or/ntmain.c b/src/or/ntmain.c
index 22d381c..b31ed86 100644
--- a/src/or/ntmain.c
+++ b/src/or/ntmain.c
@@ -3,6 +3,8 @@
  * Copyright (c) 2007-2015, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
+#ifdef _WIN32
+
 #include "or.h"
 #include "config.h"
 #include "main.h"
@@ -764,3 +766,5 @@ nt_service_parse_options(int argc, char **argv, int *should_exit)
   return 0;
 }
 
+#endif
+



More information about the tor-commits mailing list