summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-19 13:40:20 -0400
committerNick Mathewson <nickm@torproject.org>2013-07-19 13:40:20 -0400
commitf6d8bc9389db72dc654560d0f86fd3edd3b14934 (patch)
tree42ff03d119ebcba66978dfdeb9d9d6a8bbd3d729 /src/common/util.c
parent5343ee1a06ebb959fc77753898015186b94a5daa (diff)
downloadtor-f6d8bc9389db72dc654560d0f86fd3edd3b14934.tar.gz
tor-f6d8bc9389db72dc654560d0f86fd3edd3b14934.zip
Refactor the assertion-failure code into a function
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 25ea133711..814eb1379b 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -94,6 +94,20 @@
#endif
/* =====
+ * Assertion helper.
+ * ===== */
+/** Helper for tor_assert: report the assertion failure. */
+void
+tor_assertion_failed_(const char *fname, unsigned int line,
+ const char *func, const char *expr)
+{
+ log_err(LD_BUG, "%s:%u: %s: Assertion %s failed; aborting.",
+ fname, line, func, expr);
+ fprintf(stderr,"%s:%u: %s: Assertion %s failed; aborting.\n",
+ fname, line, func, expr);
+}
+
+/* =====
* Memory management
* ===== */
#ifdef USE_DMALLOC
@@ -5057,4 +5071,3 @@ tor_weak_random_range(tor_weak_rng_t *rng, int32_t top)
} while (result >= top);
return result;
}
-