diff options
author | vkalintiris <vasilis@netdata.cloud> | 2024-02-12 13:27:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 13:27:10 +0200 |
commit | 777b7ac531567a54d6666d36838975161f72952f (patch) | |
tree | 7ae5310a65dad973d3df7c9e9d8f0da10c3661b6 /src | |
parent | 94f533f758a52a567879fca76dd43f165db184d2 (diff) |
Remove config macros that are always set. (#16994)
Diffstat (limited to 'src')
-rw-r--r-- | src/libnetdata/libnetdata.h | 6 | ||||
-rw-r--r-- | src/libnetdata/storage_number/storage_number.c | 63 |
2 files changed, 1 insertions, 68 deletions
diff --git a/src/libnetdata/libnetdata.h b/src/libnetdata/libnetdata.h index 8d79215224..4bade9b5bb 100644 --- a/src/libnetdata/libnetdata.h +++ b/src/libnetdata/libnetdata.h @@ -7,9 +7,7 @@ extern "C" { # endif -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "config.h" #ifdef ENABLE_OPENSSL #define ENABLE_HTTPS 1 @@ -176,10 +174,8 @@ extern "C" { #include <sys/sysmacros.h> #endif -#ifdef STORAGE_WITH_MATH #include <math.h> #include <float.h> -#endif #if defined(HAVE_INTTYPES_H) #include <inttypes.h> diff --git a/src/libnetdata/storage_number/storage_number.c b/src/libnetdata/storage_number/storage_number.c index 6468951bd0..89a67a532c 100644 --- a/src/libnetdata/storage_number/storage_number.c +++ b/src/libnetdata/storage_number/storage_number.c @@ -147,13 +147,7 @@ storage_number pack_storage_number(NETDATA_DOUBLE value, SN_FLAGS flags) { r += (m << 27); // the divider m } -#ifdef STORAGE_WITH_MATH - // without this there are rounding problems - // example: 0.9 becomes 0.89 r += lrint((double) n); -#else - r += (storage_number)n; -#endif return r; } @@ -174,60 +168,3 @@ __attribute__((constructor)) void initialize_lut(void) { unpack_storage_number_lut10x[3 * 8 + i] = pow(100, i); // exp = 1 } } - -/* -int print_netdata_double(char *str, NETDATA_DOUBLE value) -{ - char *wstr = str; - - int sign = (value < 0) ? 1 : 0; - if(sign) value = -value; - -#ifdef STORAGE_WITH_MATH - // without llrintl() there are rounding problems - // for example 0.9 becomes 0.89 - unsigned long long uvalue = (unsigned long long int) llrintl(value * (NETDATA_DOUBLE)100000); -#else - unsigned long long uvalue = value * (NETDATA_DOUBLE)100000; -#endif - - wstr = print_number_llu_r_smart(str, uvalue); - - // make sure we have 6 bytes at least - while((wstr - str) < 6) *wstr++ = '0'; - - // put the sign back - if(sign) *wstr++ = '-'; - - // reverse it - char *begin = str, *end = --wstr, aux; - while (end > begin) aux = *end, *end-- = *begin, *begin++ = aux; - // wstr--; - // strreverse(str, wstr); - - // remove trailing zeros - int decimal = 5; - while(decimal > 0 && *wstr == '0') { - *wstr-- = '\0'; - decimal--; - } - - // terminate it, one position to the right - // to let space for a dot - wstr[2] = '\0'; - - // make space for the dot - int i; - for(i = 0; i < decimal ;i++) { - wstr[1] = wstr[0]; - wstr--; - } - - // put the dot - if(wstr[2] == '\0') { wstr[1] = '\0'; decimal--; } - else wstr[1] = '.'; - - // return the buffer length - return (int) ((wstr - str) + 2 + decimal ); -} -*/ |