chiark / gitweb /
secnet.h: Change bool_t to a C99 _Bool
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 May 2014 00:31:56 +0000 (01:31 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 May 2014 00:34:42 +0000 (01:34 +0100)
This will (a) stop misleading readers of the code (b) make it possible
to write code expecting an implicit !! to be applied to assignments to
booleans (c) possibly make secnet smaller or faster.

I don't expect this to produce any functional change, but I haven't
reviewed every bool_t in secnet to check.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
secnet.h

index 5f7de1075804b81033f4816c37964126252c35db..b51b541594eb9b41452e2433f8ac7591235921c7 100644 (file)
@@ -1,6 +1,7 @@
 secnet (0.3.2~~) unstable; urgency=low
 
   * Updates to release checklist in Makefile.in.
+  * Use C99 _Bool for bool_t.
 
  --
 
index d5663ff980257ecfcb8b6b0736ee479e7f5eaf5f..29cbac79c6fdd3247c2d982da9db89e04847c829 100644 (file)
--- a/secnet.h
+++ b/secnet.h
 
 typedef char *string_t;
 typedef const char *cstring_t;
-typedef enum {False,True} bool_t;
+
+#define False (_Bool)0
+#define True  (_Bool)1
+typedef _Bool bool_t;
 
 #define ASSERT(x) do { if (!(x)) { fatal("assertion failed line %d file " \
                                         __FILE__,__LINE__); } } while(0)