From c7bd34d154729521cf1ea959550957759207dcf2 Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Fri, 2 Dec 2016 10:41:46 +0100 Subject: [PATCH] libgnunetutil: add GNUNET_assert_from() --- src/include/gnunet_common.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index dcd0c6056..897502155 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -652,6 +652,16 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); #define GNUNET_assert_at(cond, f, l) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l); GNUNET_abort_(); } } while(0) +/** + * @ingroup logging + * Use this for fatal errors that cannot be handled + * + * @param cond Condition to evaluate + * @param comp Component string to use for logging + */ +#define GNUNET_assert_from(cond, comp) do { if (! (cond)) { GNUNET_log_from(GNUNET_ERROR_TYPE_ERROR, comp, _("Assertion failed at %s:%d.\n"), __FILE__, __LINE__); GNUNET_abort_(); } } while(0) + + /** * @ingroup logging * Use this for internal assertion violations that are -- 2.25.1