[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r9914: Turn bool_neq and bool_eq into macros. (in tor/trunk/src: common or)



Author: nickm
Date: 2007-03-28 22:37:06 -0400 (Wed, 28 Mar 2007)
New Revision: 9914

Modified:
   tor/trunk/src/common/util.h
   tor/trunk/src/or/dirserv.c
Log:
Turn bool_neq and bool_eq into macros.

Modified: tor/trunk/src/common/util.h
===================================================================
--- tor/trunk/src/common/util.h	2007-03-29 02:32:00 UTC (rev 9913)
+++ tor/trunk/src/common/util.h	2007-03-29 02:37:06 UTC (rev 9914)
@@ -136,6 +136,12 @@
 #define SUBTYPE_P(p, subtype, basemember) \
   ((void*) ( ((char*)(p)) - STRUCT_OFFSET(subtype, basemember) ))
 
+/* Logic */
+/** Macro: true if two values have the same boolean value. */
+#define bool_eq(a,b) (!(a)==!(b))
+/** Macro: true if two values have different boolean values. */
+#define bool_neq(a,b) (!(a)!=!(b))
+
 /* String manipulation */
 
 /** Allowable characters in a hexadecimal string. */

Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2007-03-29 02:32:00 UTC (rev 9913)
+++ tor/trunk/src/or/dirserv.c	2007-03-29 02:37:06 UTC (rev 9914)
@@ -582,14 +582,6 @@
   }
 }
 
-/** Helper: return true iff the boolean values of <b>a</b> and <b>b</b> are
- * different. */
-static INLINE int
-bool_neq(int a, int b)
-{
-  return (a) ? !b : b;
-}
-
 /** Remove all descriptors whose nicknames or fingerprints no longer
  * are allowed by our fingerprint list. (Descriptors that used to be
  * good can become bad when we reload the fingerprint list.)