]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make node_assert_ok less duplicatey
authorNick Mathewson <nickm@torproject.org>
Fri, 24 Aug 2012 16:48:23 +0000 (12:48 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 24 Aug 2012 16:48:23 +0000 (12:48 -0400)
This comes at the cost of making its failure message a little less
friendly, but since when do assertion failures count as
user-friendly?

src/or/nodelist.h

index c93b67a252ce6daed98a65b16097b972a9cf350c..555882796195450f65abfeb85ec548eacaf396fd 100644 (file)
 #ifndef _TOR_NODELIST_H
 #define _TOR_NODELIST_H
 
-/* XXX duplicating code from tor_assert(). */
-#define node_assert_ok(n) STMT_BEGIN                            \
-  if (PREDICT_UNLIKELY((n)->ri == NULL && (n)->rs == NULL)) {   \
-    log_err(LD_BUG, "%s:%d: %s: Node is invalid; aborting.",    \
-            _SHORT_FILE_, __LINE__, __func__);                  \
-    fprintf(stderr, "%s:%d: %s: Node is invalid; aborting.\n",  \
-            _SHORT_FILE_, __LINE__, __func__);                  \
-    abort();                                                    \
+#define node_assert_ok(n) STMT_BEGIN {                          \
+    tor_assert((n)->ri || (n)->rs);                             \
   } STMT_END
 
 node_t *node_get_mutable_by_id(const char *identity_digest);