From: Costa Tsaousis (ktsaou) Date: Thu, 19 Jan 2017 20:56:24 +0000 (+0200) Subject: remove statement expressions - they are not faster X-Git-Tag: v1.5.0~7^2~27 X-Git-Url: https://arthur.barton.de/gitweb/?p=netdata.git;a=commitdiff_plain;h=1ffb89de743b8c691fc480b487717f49edf446f7 remove statement expressions - they are not faster --- diff --git a/configure.ac b/configure.ac index 002a3aa5..2d01ac8a 100644 --- a/configure.ac +++ b/configure.ac @@ -129,7 +129,7 @@ AC_C_INLINE AC_FUNC_STRERROR_R AC_C__GENERIC AC_C___ATOMIC -AC_C_STMT_EXPR +# AC_C_STMT_EXPR AC_CHECK_SIZEOF([void *]) AC_CANONICAL_HOST AC_HEADER_MAJOR diff --git a/src/inlined.h b/src/inlined.h index a18564f5..7a3e4bb0 100644 --- a/src/inlined.h +++ b/src/inlined.h @@ -3,35 +3,9 @@ #include "common.h" -#ifdef HAVE_STMT_EXPR_NON_EXISTING -// GCC extension to define a function as a preprocessor macro - -#define simple_hash(name) ({ \ - register unsigned char *__hash_source = (unsigned char *)(name); \ - register uint32_t __hash_value = 0x811c9dc5; \ - while (*__hash_source) { \ - __hash_value *= 16777619; \ - __hash_value ^= (uint32_t) *__hash_source++; \ - } \ - __hash_value; \ -}) - -#define simple_uhash(name) ({ \ - register unsigned char *__hash_source = (unsigned char *)(name); \ - register uint32_t __hash_value = 0x811c9dc5, __hash_char; \ - while ((__hash_char = *__hash_source++)) { \ - if (unlikely(__hash_char >= 'A' && __hash_char <= 'Z')) \ - __hash_char += 'a' - 'A'; \ - __hash_value *= 16777619; \ - __hash_value ^= __hash_char; \ - } \ - __hash_value; \ -}) - -#else /* ! HAVE_STMT_EXPR */ - // for faster execution, allow the compiler to inline -// these functions that are called to hash strings +// these functions that are called thousands of times per second + static inline uint32_t simple_hash(const char *name) { register unsigned char *s = (unsigned char *) name; register uint32_t hval = 0x811c9dc5; @@ -53,8 +27,6 @@ static inline uint32_t simple_uhash(const char *name) { return hval; } -#endif /* HAVE_STMT_EXPR */ - static inline int str2i(const char *s) { register int n = 0; register char c, negative = (*s == '-');