]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Turn bool_neq and bool_eq into macros.
authorNick Mathewson <nickm@torproject.org>
Thu, 29 Mar 2007 02:37:06 +0000 (02:37 +0000)
committerNick Mathewson <nickm@torproject.org>
Thu, 29 Mar 2007 02:37:06 +0000 (02:37 +0000)
svn:r9914

src/common/util.h
src/or/dirserv.c

index 1d524cf66f1fc64a08bee5d242e543aedc23340d..7a0335935b746d8516c688cabd9def072bf10b89 100644 (file)
@@ -136,6 +136,12 @@ extern int dmalloc_free(const char *file, const int line, void *pnt,
 #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. */
index fa6ecef318d321adb773d288894c09c413bd4d33..0ee7fc067f62300446b220b9f86364dd90b8d729 100644 (file)
@@ -582,14 +582,6 @@ dirserv_add_descriptor(const char *desc, const char **msg)
   }
 }
 
-/** 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.)