summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-04-20 16:31:02 +0200
committerMark Wielaard <[email protected]>2017-05-02 13:28:54 +0200
commit575198c29a427392823cc8f2400579a23d06a875 (patch)
treef58d3f9bd42e16dfc6c58d26a56e0dfda960c7a0 /lib
parentfd9e7345b41eb2d6c11e0b8679e19df68e20171e (diff)
Avoid double-including config.h
config.h doesn't have include guards, so including it twice is bad. We deal with this by checking for PACKAGE_NAME, but only in some places. Once we start using gnulib, we will need to include config.h before any gnulib-generated headers. This is problematic if we include it transitively through our own private headers. In order to set a clear rule about inclusion of config.h, it is now included in every .c file as first header, but not in any header. This will definitely avoid double-inclusion and satisfy the condition that it has to be included before gnulib headers. It comes at the price of adding some redundancy, but there is no clean way to avoid this. Signed-off-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/crc32.c4
-rw-r--r--lib/system.h4
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 84290f79..8cac7afb 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-20 Ulf Hermann <[email protected]>
+
+ * crc32.c: include config.h.
+ * system.h: Don't include config.h.
+
2017-02-16 Ulf Hermann <[email protected]>
* Makefile.am (libeu_a_SOURCES): Remove version.c, add printversion.c
diff --git a/lib/crc32.c b/lib/crc32.c
index 1a76b1b3..758602ea 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -25,6 +25,10 @@
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdint.h>
#include "system.h"
diff --git a/lib/system.h b/lib/system.h
index 2d057025..92033355 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -29,10 +29,6 @@
#ifndef LIB_SYSTEM_H
#define LIB_SYSTEM_H 1
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <errno.h>
#include <stddef.h>
#include <stdint.h>