Move #includes of system headers to top of file
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 11 Apr 2018 07:41:22 +0000 (09:41 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 12 Apr 2018 07:14:22 +0000 (09:14 +0200)
Including system headers after having #defined other stuff sometimes gives
problems, if the header uses variables with names equal to a macro. Use of
names not starting with '_' should be consiered a bug in the header, but
it happens. To guard against this the platform-dependent time reading
was moved to the beginning of the file.

dropper.c

index 5d521cf..3236717 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -9,6 +9,20 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef WIN32 
+#    include <windows.h>
+#    define CPUtime 1000.*clock
+#else
+#    include <sys/time.h>
+#    include <sys/times.h>
+#    include <unistd.h>
+     int GetTickCount() // with thanks to Tord
+     { struct timeval t;
+       gettimeofday(&t, NULL);
+       return t.tv_sec*1000 + t.tv_usec/1000;
+     }
+#endif
+
 #define DEBUG 0
 #define IDQS /* Iteratively deepening QS */
 #define LMR 2
@@ -1715,20 +1729,6 @@ int ponder;
 int resign;         // engine-defined option
 int contemptFactor; // likewise
 
-#ifdef WIN32 
-#    include <windows.h>
-#    define CPUtime 1000.*clock
-#else
-#    include <sys/time.h>
-#    include <sys/times.h>
-#    include <unistd.h>
-     int GetTickCount() // with thanks to Tord
-     { struct timeval t;
-       gettimeofday(&t, NULL);
-       return t.tv_sec*1000 + t.tv_usec/1000;
-     }
-#endif
-
 int
 ReadClock (int start)
 {