crypt: don't include ufc-crypt.h multiple times

Message ID 201406062000.s56K06eu032548@farm-0002.internal.tilera.com
State Committed
Headers

Commit Message

Chris Metcalf June 6, 2014, 7:50 p.m. UTC
  The file has no inclusion guards, and contains typedefs that
cause errors when included multiple times with older (pre-C11)
compilers such as gcc 4.4.

Save the "#ifdef DOS" content to crypt-private.h even though
it's likely not particularly useful.
---
Konstantin Serebryany's commit 8747cd034a to remove a redundant nested
function from the crypt code caused this problem but I think most
folks are using newer compilers and so didn't notice it.

2014-06-06  Chris Metcalf  <cmetcalf@tilera.com>

	* crypt/crypt-private.h [DOS]: Add some includes taken from the
	other files in the crypt directory.
	* crypt/crypt.c: Remove duplicate includes.
	* crypt/crypt-entry.c: Likewise.
	* crypt/crypt_util.c: Likewise.

 crypt/crypt-entry.c   | 10 ----------
 crypt/crypt-private.h |  9 +++++++++
 crypt/crypt.c         |  2 --
 crypt/crypt_util.c    | 11 -----------
  

Comments

Roland McGrath June 6, 2014, 9:55 p.m. UTC | #1
That seems fine.
  

Patch

diff --git a/crypt/crypt-entry.c b/crypt/crypt-entry.c
index 2a6e9504e365..f6444dfc14de 100644
--- a/crypt/crypt-entry.c
+++ b/crypt/crypt-entry.c
@@ -34,16 +34,6 @@ 
 #define STATIC static
 #endif
 
-#ifndef DOS
-#include "ufc-crypt.h"
-#else
-/*
- * Thanks to greg%wind@plains.NoDak.edu (Greg W. Wettstein)
- * for DOS patches
- */
-#include "ufc.h"
-#endif
-#include "crypt.h"
 #include "crypt-private.h"
 
 /* Prototypes for local functions.  */
diff --git a/crypt/crypt-private.h b/crypt/crypt-private.h
index ea46a7f949cd..b6a5e07b369e 100644
--- a/crypt/crypt-private.h
+++ b/crypt/crypt-private.h
@@ -28,7 +28,16 @@ 
 #include <features.h>
 #include <stdbool.h>
 
+#ifndef DOS
 #include "ufc-crypt.h"
+#else
+/*
+ * Thanks to greg%wind@plains.NoDak.edu (Greg W. Wettstein)
+ * for DOS patches
+ */
+#include "pl.h"
+#include "ufc.h"
+#endif
 #include "crypt.h"
 
 /* crypt.c */
diff --git a/crypt/crypt.c b/crypt/crypt.c
index 4fb25780fc8a..1919210daf2b 100644
--- a/crypt/crypt.c
+++ b/crypt/crypt.c
@@ -23,8 +23,6 @@ 
  *
  */
 
-#include "ufc-crypt.h"
-#include "crypt.h"
 #include "crypt-private.h"
 
 #ifdef _UFC_32_
diff --git a/crypt/crypt_util.c b/crypt/crypt_util.c
index 9381d671940b..da0a5aa33b83 100644
--- a/crypt/crypt_util.c
+++ b/crypt/crypt_util.c
@@ -33,17 +33,6 @@ 
 #define STATIC static
 #endif
 
-#ifndef DOS
-#include "ufc-crypt.h"
-#else
-/*
- * Thanks to greg%wind@plains.NoDak.edu (Greg W. Wettstein)
- * for DOS patches
- */
-#include "pl.h"
-#include "ufc.h"
-#endif
-#include "crypt.h"
 #include "crypt-private.h"
 
 /* Prototypes for local functions.  */