@cryptotaxi247 / netdata-1 / commits / 777b7ac53

Remove config macros that are always set. (#16994)

vkalintiris committed Feb 12, 2024 at 13:27 UTC 777b7ac531567a54d6666d36838975161f72952f
5 files changed +2 -74
CMakeLists.txt
-4
@@ -2202,10 +2202,6 @@ install(TARGETS netdatacli
2202 # Generate config file
2203 #
2204
2205 -add_definitions(-DHAVE_CONFIG_H)
2206 -
2207 -set(STORAGE_WITH_MATH On)
2208 -
2205 if(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
2206 string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
2207 endif()
config.cmake.h.in
-1
@@ -91,7 +91,6 @@
91 #cmakedefine ENABLE_LZ4
92 #cmakedefine ENABLE_ZSTD
93 #cmakedefine ENABLE_BROTLI
94 -#cmakedefine STORAGE_WITH_MATH
94
95 #cmakedefine ENABLE_LOGSMANAGEMENT
96 #cmakedefine ENABLE_LOGSMANAGEMENT_TESTS
src/libnetdata/libnetdata.h
+1 -5
@@ -7,9 +7,7 @@
7 extern "C" {
8 # endif
9
10 -#ifdef HAVE_CONFIG_H
11 -#include <config.h>
12 -#endif
10 +#include "config.h"
11
12 #ifdef ENABLE_OPENSSL
13 #define ENABLE_HTTPS 1
@@ -176,10 +174,8 @@ extern "C" {
174 #include <sys/sysmacros.h>
175 #endif
176
179 -#ifdef STORAGE_WITH_MATH
177 #include <math.h>
178 #include <float.h>
182 -#endif
179
180 #if defined(HAVE_INTTYPES_H)
181 #include <inttypes.h>
src/libnetdata/storage_number/storage_number.c
-63
@@ -147,13 +147,7 @@ storage_number pack_storage_number(NETDATA_DOUBLE value, SN_FLAGS flags) {
147 r += (m << 27); // the divider m
148 }
149
150 -#ifdef STORAGE_WITH_MATH
151 - // without this there are rounding problems
152 - // example: 0.9 becomes 0.89
150 r += lrint((double) n);
154 -#else
155 - r += (storage_number)n;
156 -#endif
151
152 return r;
153 }
@@ -174,60 +168,3 @@ __attribute__((constructor)) void initialize_lut(void) {
168 unpack_storage_number_lut10x[3 * 8 + i] = pow(100, i); // exp = 1
169 }
170 }
177 -
178 -/*
179 -int print_netdata_double(char *str, NETDATA_DOUBLE value)
180 -{
181 - char *wstr = str;
182 -
183 - int sign = (value < 0) ? 1 : 0;
184 - if(sign) value = -value;
185 -
186 -#ifdef STORAGE_WITH_MATH
187 - // without llrintl() there are rounding problems
188 - // for example 0.9 becomes 0.89
189 - unsigned long long uvalue = (unsigned long long int) llrintl(value * (NETDATA_DOUBLE)100000);
190 -#else
191 - unsigned long long uvalue = value * (NETDATA_DOUBLE)100000;
192 -#endif
193 -
194 - wstr = print_number_llu_r_smart(str, uvalue);
195 -
196 - // make sure we have 6 bytes at least
197 - while((wstr - str) < 6) *wstr++ = '0';
198 -
199 - // put the sign back
200 - if(sign) *wstr++ = '-';
201 -
202 - // reverse it
203 - char *begin = str, *end = --wstr, aux;
204 - while (end > begin) aux = *end, *end-- = *begin, *begin++ = aux;
205 - // wstr--;
206 - // strreverse(str, wstr);
207 -
208 - // remove trailing zeros
209 - int decimal = 5;
210 - while(decimal > 0 && *wstr == '0') {
211 - *wstr-- = '\0';
212 - decimal--;
213 - }
214 -
215 - // terminate it, one position to the right
216 - // to let space for a dot
217 - wstr[2] = '\0';
218 -
219 - // make space for the dot
220 - int i;
221 - for(i = 0; i < decimal ;i++) {
222 - wstr[1] = wstr[0];
223 - wstr--;
224 - }
225 -
226 - // put the dot
227 - if(wstr[2] == '\0') { wstr[1] = '\0'; decimal--; }
228 - else wstr[1] = '.';
229 -
230 - // return the buffer length
231 - return (int) ((wstr - str) + 2 + decimal );
232 -}
233 -*/
tests/profile/benchmark-registry.c
+1 -1
@@ -2,7 +2,7 @@
2
3 /*
4 * compile with
5 - * 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\""
5 + * 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\""
6 */
7
8 char *hostname = "me";