Commit 8fbd44fde6c54e5f646e619e51a6e846e3c6f95b

Ran Benita 2012-04-06T03:12:50

Implicitly include config.h in all files The definitions in config.h should be available in all files an implementation detail; it can be included through the build system instead of having each file pull it every time. This is especially helpful with AC_USE_SYSTEM_EXTENSIONS, as _GNU_SOURCE and friends can have an effect by merely being defined, which can lead to some confusion if its effective for only half the files. And we don't really support a build _without_ config.h; so, one less thing to worry about. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/Makefile.am b/Makefile.am
index 6aa5b8e..0564a7c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,8 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src \
 	-I$(top_srcdir)/src/xkbcomp \
-	-Isrc/xkbcomp
+	-Isrc/xkbcomp/ \
+	-include $(top_srcdir)/src/config.h
 
 AM_CFLAGS = \
 	$(BASE_CFLAGS) \
diff --git a/src/alloc.c b/src/alloc.c
index a2a1330..91b010b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -23,9 +23,6 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
 THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include "utils.h"
 #include "xkballoc.h"
 #include "xkbcommon/xkbcommon.h"
diff --git a/src/atom.c b/src/atom.c
index d4076c4..181744d 100644
--- a/src/atom.c
+++ b/src/atom.c
@@ -70,9 +70,6 @@ SOFTWARE.
 
  ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include "xkbmisc.h"
 #include "xkbcommon/xkbcommon.h"
 #include "XKBcommonint.h"
diff --git a/src/context.c b/src/context.c
index 8878b16..9acb416 100644
--- a/src/context.c
+++ b/src/context.c
@@ -23,10 +23,6 @@
  * Author: Daniel Stone <daniel@fooishbar.org>
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
diff --git a/src/keysym.c b/src/keysym.c
index 8f6515d..5079419 100644
--- a/src/keysym.c
+++ b/src/keysym.c
@@ -25,9 +25,6 @@ sale, use or other dealings in this Software without prior written
 authorization from the authors.
 */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/src/map.c b/src/map.c
index f41beb4..c82fb61 100644
--- a/src/map.c
+++ b/src/map.c
@@ -49,10 +49,6 @@
  *
  * ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "utils.h"
 #include "xkbcommon/xkbcommon.h"
 #include "XKBcommonint.h"
diff --git a/src/maprules.c b/src/maprules.c
index 6a6e616..dd80bd3 100644
--- a/src/maprules.c
+++ b/src/maprules.c
@@ -24,9 +24,6 @@
 
  ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include "utils.h"
 #include "xkbrules.h"
 #include "xkbcommon/xkbcommon.h"
diff --git a/src/misc.c b/src/misc.c
index f0e4546..90c00bb 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -24,12 +24,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <X11/X.h>
-
 #include "xkballoc.h"
 #include "xkbmisc.h"
 #include "xkbcommon/xkbcommon.h"
diff --git a/src/state.c b/src/state.c
index 2feaeb5..45820b6 100644
--- a/src/state.c
+++ b/src/state.c
@@ -58,10 +58,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *   - messages (very unlikely)
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <assert.h>
 
 #include "xkbcommon/xkbcommon.h"
diff --git a/src/text.c b/src/text.c
index dd755ea..e4f74b3 100644
--- a/src/text.c
+++ b/src/text.c
@@ -24,9 +24,6 @@
 
  ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include "xkbmisc.h"
 #include "xkbcommon/xkbcommon.h"
 #include "XKBcommonint.h"
diff --git a/src/utils.h b/src/utils.h
index 630fa48..01c6ba4 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -33,10 +33,6 @@
 #include <X11/Xdefs.h>
 #include <X11/Xfuncproto.h>
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 extern void *
 recalloc(void *ptr, size_t old_size, size_t new_size);
 
diff --git a/src/xkb.c b/src/xkb.c
index 5336885..7a7daf6 100644
--- a/src/xkb.c
+++ b/src/xkb.c
@@ -24,9 +24,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <stdio.h>
 
 #include "xkbmisc.h"