From: Nick Mathewson Date: Thu, 29 Mar 2007 02:37:06 +0000 (+0000) Subject: Turn bool_neq and bool_eq into macros. X-Git-Tag: tor-0.2.0.1-alpha~304 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1ad950ca89a648ef4a0d7ab4d8a38978a7a92dc;p=thirdparty%2Ftor.git Turn bool_neq and bool_eq into macros. svn:r9914 --- diff --git a/src/common/util.h b/src/common/util.h index 1d524cf66f..7a0335935b 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -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. */ diff --git a/src/or/dirserv.c b/src/or/dirserv.c index fa6ecef318..0ee7fc067f 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -582,14 +582,6 @@ dirserv_add_descriptor(const char *desc, const char **msg) } } -/** Helper: return true iff the boolean values of a and 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.)