From ead31761db6e9dc7fb2d2b1dda17f8e3475f0ea7 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 Jul 2011 22:25:10 +0000 Subject: [PATCH] Include lagi_pre.h in agi_pre.h and remove all duplicates This eliminates some duplicated logic and potential tr1/non-tr1 header mismatches, and removes the need for the #if defined(AGI_PRE) || defined(LAGI_PRE) guard that was used in a few of the libaegisub headers. Originally committed to SVN as r5515. --- aegisub/libaegisub/lagi_pre.h | 5 +++- aegisub/src/agi_pre.h | 48 +++++++---------------------------- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/aegisub/libaegisub/lagi_pre.h b/aegisub/libaegisub/lagi_pre.h index 5ff08068b..b442d625b 100644 --- a/aegisub/libaegisub/lagi_pre.h +++ b/aegisub/libaegisub/lagi_pre.h @@ -15,11 +15,14 @@ #ifdef HAVE_SYS_TIME_H # include #else -# include +# include #endif // Windows C #ifdef _WIN32 +// "Lean and mean" causes windows.h to include less stuff, mostly rarely-used things. +// We can't build without being "lean and mean", some of the things included by it has +// macros that clash with variable names around Aegisub causing strange build errors. #define WIN32_LEAN_AND_MEAN #include #include diff --git a/aegisub/src/agi_pre.h b/aegisub/src/agi_pre.h index ade575dcf..4865d750f 100644 --- a/aegisub/src/agi_pre.h +++ b/aegisub/src/agi_pre.h @@ -40,12 +40,6 @@ /// @note Make sure that you disable use of precompiled headers on md5.c and /// MatroskaParser.c, as well as any possible future .c files. -#include "config.h" - -///////// -// Setup -#define AGI_PRE - // Block msvc from complaining about not using msvc-specific versions for // insecure C functions. #ifdef _CRT_SECURE_NO_WARNINGS @@ -54,55 +48,31 @@ #define _CRT_SECURE_NO_WARNINGS #endif -/////////////// -// STD headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "config.h" -#ifdef _WIN32 -#include -#include -#else -#include -#include -#endif +#include "../libaegisub/lagi_pre.h" + +///////// +// Setup +#define AGI_PRE + +// Common C++ +#include // General headers -#include #include -#include #include #include #include #include -#include #ifdef _OPENMP // Not all compilers have (example: MSVC Express) #include #endif -#include -#include #include -#include -#include #include #ifdef _WIN32 -// "Lean and mean" causes windows.h to include less stuff, mostly rarely-used things. -// We can't build without being "lean and mean", some of the things included by it has -// macros that clash with variable names around Aegisub causing strange build errors. -#define WIN32_LEAN_AND_MEAN -// Windows.h must always be the first one, it defines a load of important things #include #include #include