libbrandt/util.h

52 lines
1.5 KiB
C
Raw Normal View History

2016-06-22 23:18:46 +02:00
/* This file is part of libbrandt.
* Copyright (C) 2016 GNUnet e.V.
*
* libbrandt is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* libbrandt is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* libbrandt. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file util.h
2016-07-13 12:21:40 +02:00
* @brief Interface for the common utility functions.
2016-06-22 23:18:46 +02:00
* @author Markus Teich
*/
2016-06-07 15:49:22 +02:00
#ifndef _BRANDT_UTIL_H
#define _BRANDT_UTIL_H
2016-06-12 00:55:09 +02:00
2016-12-02 09:43:04 +01:00
#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)
2016-06-12 00:55:09 +02:00
2016-07-13 12:21:40 +02:00
2016-12-02 09:43:04 +01:00
#ifdef NDEBUG
2016-07-13 12:21:40 +02:00
2016-07-13 12:22:23 +02:00
#define DP(point) ((void)(gcry_log_debugpnt (# point, point, ec_ctx)))
2016-12-02 09:43:04 +01:00
#define DM(mpi) ((void)(gcry_log_debugmpi (# mpi, mpi)))
#define DS(sexp) ((void)(gcry_log_debugsxp (# sexp, sexp)))
2016-07-13 12:22:23 +02:00
#else /* ifdef NDEBUG */
2016-06-28 16:21:13 +02:00
2016-12-02 09:43:04 +01:00
#define DP(point) ((void)(0))
#define DM(mpi) ((void)(0))
#define DS(sexp) ((void)(0))
2016-06-28 16:21:13 +02:00
2016-07-13 12:22:23 +02:00
#endif /* ifdef NDEBUG */
2016-06-07 15:49:22 +02:00
2016-12-02 09:43:04 +01:00
2016-07-13 12:22:23 +02:00
#endif /* ifndef _BRANDT_UTIL_H */