[Pkg-gnupg-commit] [gnupg2] 45/159: common: New file fwddecl.h.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jan 27 13:23:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 98f9e14323bf806f674b3cc259e19ef6219b4378
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 21 11:37:21 2015 +0100

    common: New file fwddecl.h.
    
    * common/util.h (server_control_s, ctrl_t): Move to ...
    * common/fwddecl.h: New file.
    * common/call-gpg.h: Replace typedef by fwddecl.h.  Change include
    protection macro name.
    * common/Makefile.am (common_sources): Add fwddecl.h.
    --
    
    It seems some compilers do not grok a re-declaration.  Thus we factor
    it out into a separate file and use the include protection macro to
    protect against re-declaration.
    
    GnuPG-bug-id: 2200
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 common/Makefile.am |  2 +-
 common/call-gpg.h  |  9 ++++-----
 common/fwddecl.h   | 39 +++++++++++++++++++++++++++++++++++++++
 common/util.h      |  8 +-------
 4 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/common/Makefile.am b/common/Makefile.am
index 54dee54..d09f0df 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -42,7 +42,7 @@ include $(top_srcdir)/am/cmacros.am
 
 common_sources = \
 	common-defs.h \
-	util.h i18n.c i18n.h \
+	util.h fwddecl.h i18n.c i18n.h \
 	types.h host2net.h dynload.h w32help.h \
 	mapstrings.c stringhelp.c stringhelp.h \
 	strlist.c strlist.h \
diff --git a/common/call-gpg.h b/common/call-gpg.h
index 74d3819..19993ef 100644
--- a/common/call-gpg.h
+++ b/common/call-gpg.h
@@ -17,15 +17,14 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef G13_CALL_GPG_H
-#define G13_CALL_GPG_H
+#ifndef GNUPG_COMMON_CALL_GPG_H
+#define GNUPG_COMMON_CALL_GPG_H
 
 #include <gpg-error.h>
 
+#include "fwddecl.h"
 #include "strlist.h"
 
-typedef struct server_control_s *ctrl_t;
-
 gpg_error_t gpg_encrypt_blob (ctrl_t ctrl,
 			      const char *gpg_program,
 			      strlist_t gpg_arguments,
@@ -52,4 +51,4 @@ gpg_error_t gpg_decrypt_stream (ctrl_t ctrl,
 				estream_t cipher_stream,
 				estream_t plain_stream);
 
-#endif /*G13_CALL_GPG_H*/
+#endif /*GNUPG_COMMON_CALL_GPG_H*/
diff --git a/common/fwddecl.h b/common/fwddecl.h
new file mode 100644
index 0000000..92f0453
--- /dev/null
+++ b/common/fwddecl.h
@@ -0,0 +1,39 @@
+/* fwddecl.h - Formward declarations
+ * Copyright (C) 2015 Werner Koch
+ *
+ * This file is part of GnuPG.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either
+ *
+ *   - the GNU Lesser General Public License as published by the Free
+ *     Software Foundation; either version 3 of the License, or (at
+ *     your option) any later version.
+ *
+ * or
+ *
+ *   - the GNU General Public License as published by the Free
+ *     Software Foundation; either version 2 of the License, or (at
+ *     your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GNUPG_COMMON_FWDDECL_H
+#define GNUPG_COMMON_FWDDECL_H
+
+
+/*-- Forward declaration of the commonly used server control structure.  */
+struct server_control_s;
+typedef struct server_control_s *ctrl_t;
+
+
+#endif /*GNUPG_COMMON_FWDDECL_H*/
diff --git a/common/util.h b/common/util.h
index e05cbff..5d94e93 100644
--- a/common/util.h
+++ b/common/util.h
@@ -52,6 +52,7 @@
 #include "../common/dotlock.h"
 #include "../common/utf8conv.h"
 #include "../common/dynload.h"
+#include "../common/fwddecl.h"
 
 #include "gettime.h"
 
@@ -346,11 +347,4 @@ int _gnupg_isatty (int fd);
 #define xtoi_2(p)   ((xtoi_1(p) * 16) + xtoi_1((p)+1))
 #define xtoi_4(p)   ((xtoi_2(p) * 256) + xtoi_2((p)+2))
 
-
-/*-- Forward declaration of the commonly used server control structure.  */
-/*   (We need it here as it is used by some callback prototypes.) */
-struct server_control_s;
-typedef struct server_control_s *ctrl_t;
-
-
 #endif /*GNUPG_COMMON_UTIL_H*/

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list