INN commit: trunk (5 files)

INN Commit rra at isc.org
Sun Sep 7 10:39:42 UTC 2014


    Date: Sunday, September 7, 2014 @ 03:39:42
  Author: iulius
Revision: 9682

Add new portable/stdbool.h header (extracted from inn/defines.h)

Added:
  trunk/include/portable/stdbool.h
Modified:
  trunk/MANIFEST
  trunk/include/inn/buffer.h
  trunk/include/inn/defines.h
  trunk/include/inn/fdflag.h

----------------------------+
 MANIFEST                   |    1 
 include/inn/buffer.h       |    2 +
 include/inn/defines.h      |   24 ++--------------
 include/inn/fdflag.h       |    2 +
 include/portable/stdbool.h |   63 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 71 insertions(+), 21 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2014-09-06 21:55:35 UTC (rev 9681)
+++ MANIFEST	2014-09-07 10:39:42 UTC (rev 9682)
@@ -420,6 +420,7 @@
 include/portable/mmap.h               Wrapper for <sys/mman.h>
 include/portable/setproctitle.h       Portable setup for setproctitle
 include/portable/socket.h             Wrapper for <sys/socket.h> and friends
+include/portable/stdbool.h            Wrapper for <stdbool.h>
 include/portable/time.h               Wrapper for <time.h> and <sys/time.h>
 include/portable/uio.h                Wrapper for <sys/uio.h>
 include/portable/wait.h               Wrapper for <sys/wait.h>

Modified: include/inn/buffer.h
===================================================================
--- include/inn/buffer.h	2014-09-06 21:55:35 UTC (rev 9681)
+++ include/inn/buffer.h	2014-09-07 10:39:42 UTC (rev 9682)
@@ -45,6 +45,8 @@
 #define INN_BUFFER_H 1
 
 #include "config.h"
+#include "portable/macros.h"
+#include "portable/stdbool.h"
 
 #include <stdarg.h>
 #include <sys/types.h>

Modified: include/inn/defines.h
===================================================================
--- include/inn/defines.h	2014-09-06 21:55:35 UTC (rev 9681)
+++ include/inn/defines.h	2014-09-07 10:39:42 UTC (rev 9682)
@@ -21,27 +21,9 @@
 
 #include <inn/system.h>
 #include "inn/macros.h"
+#include "portable/stdbool.h"
 
-/* Make available the bool type. */
-#if INN_HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
-# if !INN_HAVE__BOOL
-#  ifdef __cplusplus
-typedef bool _Bool;
-#  else
-typedef unsigned char _Bool;
-#  endif
-# endif
-# define bool _Bool
-# define false 0
-# define true 1
-# define __bool_true_false_are_defined 1
-#endif
+// TODO:  Remove this file (defines.h), now that it has been split
+//        into other headers.
 
-/* Tell Perl that we have a bool type. */
-#ifndef HAS_BOOL
-# define HAS_BOOL 1
-#endif
-
 #endif /* !INN_DEFINES_H */

Modified: include/inn/fdflag.h
===================================================================
--- include/inn/fdflag.h	2014-09-06 21:55:35 UTC (rev 9681)
+++ include/inn/fdflag.h	2014-09-07 10:39:42 UTC (rev 9682)
@@ -32,6 +32,8 @@
 #define INN_FDFLAG_H 1
 
 #include "config.h"
+#include "portable/macros.h"
+#include "portable/stdbool.h"
 #include "portable/socket.h"
 
 BEGIN_DECLS

Added: include/portable/stdbool.h
===================================================================
--- include/portable/stdbool.h	                        (rev 0)
+++ include/portable/stdbool.h	2014-09-07 10:39:42 UTC (rev 9682)
@@ -0,0 +1,63 @@
+/* $Id$
+ *
+ * Portability wrapper around <stdbool.h>.
+ *
+ * Provides the bool and _Bool types and the true and false constants,
+ * following the C99 specification, on hosts that don't have stdbool.h.  This
+ * logic is based heavily on the example in the Autoconf manual.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Written by Russ Allbery <eagle at eyrie.org>
+ *
+ * The authors hereby relinquish any claim to any copyright that they may have
+ * in this work, whether granted under contract or by operation of law or
+ * international treaty, and hereby commit to the public, at large, that they
+ * shall not, at any time in the future, seek to enforce any copyright in this
+ * work against any person or entity, or prevent any person or entity from
+ * copying, publishing, distributing or creating derivative works of this
+ * work.
+ */
+
+#ifndef PORTABLE_STDBOOL_H
+#define PORTABLE_STDBOOL_H 1
+
+/*
+ * Allow inclusion of config.h to be skipped, since sometimes we have to use a
+ * stripped-down version of config.h with a different name.
+ */
+#ifndef CONFIG_H_INCLUDED
+# include "config.h"
+#endif
+
+#if INN_HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+# if INN_HAVE__BOOL
+#  define bool _Bool
+# else
+#  ifdef __cplusplus
+typedef bool _Bool;
+#  elif _WIN32
+#   include <windef.h>
+#   define bool BOOL
+#  else
+typedef unsigned char _Bool;
+#   define bool _Bool
+#  endif
+# endif
+# define false 0
+# define true  1
+# define __bool_true_false_are_defined 1
+#endif
+
+/*
+ * If we define bool and don't tell Perl, it will try to define its own and
+ * fail.  Only of interest for programs that also include Perl headers.
+ */
+#ifndef HAS_BOOL
+# define HAS_BOOL 1
+#endif
+
+#endif /* !PORTABLE_STDBOOL_H */


Property changes on: trunk/include/portable/stdbool.h
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision



More information about the inn-committers mailing list