aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h51
1 files changed, 14 insertions, 37 deletions
diff --git a/util.h b/util.h
index 3c13cc4..2043557 100644
--- a/util.h
+++ b/util.h
@@ -23,52 +23,29 @@
#ifndef _BRANDT_UTIL_H
#define _BRANDT_UTIL_H
-void setlog (FILE *stream);
-void eprintf (const char *fmt, ...);
-void weprintf (const char *fmt, ...);
-#undef brandt_assert
-#undef brandt_assert_perror
-#undef brandt_assert_gpgerr
+#define brandt_assert(cond) do { if (!(cond)) { GNUNET_log_from ( \
+ GNUNET_ERROR_TYPE_ERROR, \
+ "libbrandt", \
+ "Assertion failed at %s:%d.\n", \
+ __FILE__, \
+ __LINE__); GNUNET_abort_ (); \
+ } } while (0)
-#ifdef NDEBUG
-
-#define brandt_assert(expr) do { \
- (expr) ? (void)(0) : eprintf ( \
- "Assertion failed in file %s line %d function %s: %s", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- (# expr)); \
-} while (0)
-
-#define brandt_assert_perror(errnum) do { \
- !(errnum) ? (void)(0) : eprintf ( \
- "Assertion failed in file %s line %d function %s:", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__); \
-} while (0)
-#define brandt_assert_gpgerr(errnum) do { \
- !(errnum) ? (void)(0) : eprintf ( \
- "Assertion failed in file %s line %d function %s: %s", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- gcry_strerror ((errnum))); \
-} while (0)
+#ifdef NDEBUG
#define DP(point) ((void)(gcry_log_debugpnt (# point, point, ec_ctx)))
-#define DM(mpi) ((void)(gcry_log_debugmpi (# mpi, mpi)))
-#define DS(sexp) ((void)(gcry_log_debugsxp (# sexp, sexp)))
+#define DM(mpi) ((void)(gcry_log_debugmpi (# mpi, mpi)))
+#define DS(sexp) ((void)(gcry_log_debugsxp (# sexp, sexp)))
#else /* ifdef NDEBUG */
-#define brandt_assert(expr) ((void)(expr))
-#define brandt_assert_perror(errnum) ((void)(errnum))
-#define brandt_assert_gpgerr(errnum) ((void)(errnum))
+#define DP(point) ((void)(0))
+#define DM(mpi) ((void)(0))
+#define DS(sexp) ((void)(0))
#endif /* ifdef NDEBUG */
+
#endif /* ifndef _BRANDT_UTIL_H */