diff options
author | Ondřej Surý <ondrej@sury.org> | 2013-06-28 12:59:40 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2013-06-28 12:59:40 +0200 |
commit | 124965832295a277b9ca6ae9fac4f45a74a36b2a (patch) | |
tree | f299e2335863f74e0be0707f84b85211baaf2d03 /src/libknot/common.h | |
parent | 3d2d198c71a6b844b60fa9ef68801b66bba93361 (diff) | |
download | knot-upstream/1.3.0_rc3.tar.gz |
New upstream version 1.3.0~rc3upstream/1.3.0_rc3
Diffstat (limited to 'src/libknot/common.h')
-rw-r--r-- | src/libknot/common.h | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/libknot/common.h b/src/libknot/common.h index 0bff97e..75acc7b 100644 --- a/src/libknot/common.h +++ b/src/libknot/common.h @@ -1,5 +1,5 @@ /*! - * \file common.h + * \file libknot/common.h * * \author Lubos Slovak <lubos.slovak@nic.cz> * @@ -24,12 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <config.h> #include "common/errcode.h" - -#ifdef HAVE_LIBLDNS -#define TEST_WITH_LDNS -#endif +#include "common/mempattern.h" #ifndef _KNOT_COMMON_H_ #define _KNOT_COMMON_H_ @@ -42,28 +38,17 @@ typedef unsigned int uint; /*!< \brief Unsigned. */ #define UINT_DEFINED #endif -/*! \brief If defined, zone structures will use hash table for lookup. */ -#define USE_HASH_TABLE - /*! \brief Eliminate compiler warning with unused parameters. */ #define UNUSED(param) (void)(param) +#ifndef MIN /*! \brief Type-safe minimum macro. */ #define MIN(a, b) \ - ({ typeof (a) _a = (a); typeof (b) _b = (b); _a < _b ? _a : _b; }) + ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) /*! \brief Type-safe maximum macro. */ #define MAX(a, b) \ - ({ typeof (a) _a = (a); typeof (b) _b = (b); _a > _b ? _a : _b; }) - -/* Optimisation macros. */ -#ifndef knot_likely -/*! \brief Optimize for x to be true value. */ -#define knot_likely(x) __builtin_expect((x),1) -#endif -#ifndef knot_unlikely -/*! \brief Optimize for x to be false value. */ -#define knot_unlikely(x) __builtin_expect((x),0) + ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; }) #endif /* Optimisation macros. */ @@ -78,8 +63,9 @@ typedef unsigned int uint; /*!< \brief Unsigned. */ /*! \todo Refactor theese. We should have an allocator function handling this.*/ #ifndef ERR_ALLOC_FAILED -#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s ver.%s)\n", \ - __FILE__, __LINE__, KNOT_NAME, KNOT_VER) +#define ERR_ALLOC_FAILED fprintf(stderr, \ + "Allocation failed at %s:%d (%s ver.%s)\n", \ + __FILE__, __LINE__, KNOT_NAME, KNOT_VER) #endif #ifndef CHECK_ALLOC_LOG |