0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-01 04:02:53 +00:00

Remove config macros that are always set. ()

This commit is contained in:
vkalintiris 2024-02-12 13:27:10 +02:00 committed by GitHub
parent 94f533f758
commit 777b7ac531
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2 additions and 74 deletions

View file

@ -2202,10 +2202,6 @@ install(TARGETS netdatacli
# Generate config file
#
add_definitions(-DHAVE_CONFIG_H)
set(STORAGE_WITH_MATH On)
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()

View file

@ -91,7 +91,6 @@
#cmakedefine ENABLE_LZ4
#cmakedefine ENABLE_ZSTD
#cmakedefine ENABLE_BROTLI
#cmakedefine STORAGE_WITH_MATH
#cmakedefine ENABLE_LOGSMANAGEMENT
#cmakedefine ENABLE_LOGSMANAGEMENT_TESTS

View file

@ -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>

View file

@ -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 );
}
*/

View file

@ -2,7 +2,7 @@
/*
* compile with
* gcc -O1 -ggdb -Wall -Wextra -I ../src/ -I ../ -o benchmark-registry benchmark-registry.c ../src/dictionary.o ../src/log.o ../src/avl.o ../src/common.o ../src/appconfig.o ../src/web_buffer.o ../src/storage_number.o ../src/rrd.o ../src/health.o -pthread -luuid -lm -DHAVE_CONFIG_H -DVARLIB_DIR="\"/tmp\""
* gcc -O1 -ggdb -Wall -Wextra -I ../src/ -I ../ -o benchmark-registry benchmark-registry.c ../src/dictionary.o ../src/log.o ../src/avl.o ../src/common.o ../src/appconfig.o ../src/web_buffer.o ../src/storage_number.o ../src/rrd.o ../src/health.o -pthread -luuid -lm -DVARLIB_DIR="\"/tmp\""
*/
char *hostname = "me";