From: Teemu Toivola Date: Wed, 2 Apr 2014 17:25:12 +0000 (+0300) Subject: rename definitions to something more readable X-Git-Tag: v1.12~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afaeb5840f50a80015ea2677bc51cb210801f49b;p=vnstat rename definitions to something more readable --- diff --git a/src/common.c b/src/common.c index 2bc0fd4..0fd097d 100644 --- a/src/common.c +++ b/src/common.c @@ -184,16 +184,16 @@ uint64_t countercalc(const uint64_t *a, const uint64_t *b) /* flip exists */ } else { /* original counter is 64bit */ - if (*a>FP32) { + if (*a>MAX32) { if (debug) - printf("cc64: uint64 - %"PRIu64" + %"PRIu64" = %"PRIu64"\n", *a, *b, (uint64_t)FP64-*a+*b); - return FP64-*a+*b; + printf("cc64: uint64 - %"PRIu64" + %"PRIu64" = %"PRIu64"\n", *a, *b, (uint64_t)MAX64-*a+*b); + return MAX64-*a+*b; /* original counter is 32bit */ } else { if (debug) - printf("cc32: uint32 - %"PRIu64" + %"PRIu64" = %"PRIu64"\n", *a, *b, (uint64_t)FP32-*a+*b); - return FP32-*a+*b; + printf("cc32: uint32 - %"PRIu64" + %"PRIu64" = %"PRIu64"\n", *a, *b, (uint64_t)MAX32-*a+*b); + return MAX32-*a+*b; } } } diff --git a/src/common.h b/src/common.h index e995784..997b235 100644 --- a/src/common.h +++ b/src/common.h @@ -150,8 +150,8 @@ and most can be changed later from the config file. #define ONELINEVERSION 1 /* integer limits */ -#define FP32 4294967295ULL -#define FP64 18446744073709551615ULL +#define MAX32 4294967295ULL +#define MAX64 18446744073709551615ULL /* sampletime in seconds for live traffic */ /* don't use values below 2 */ diff --git a/src/dbaccess.c b/src/dbaccess.c index dbcf65e..aef1663 100644 --- a/src/dbaccess.c +++ b/src/dbaccess.c @@ -202,7 +202,7 @@ void initdb(void) data.month[0].month=current; } - data.btime=FP32; + data.btime=MAX32; } int writedb(const char *iface, const char *dirname, int newdb) diff --git a/src/traffic.c b/src/traffic.c index 5bdaf8c..875dfc3 100644 --- a/src/traffic.c +++ b/src/traffic.c @@ -100,7 +100,7 @@ void livetrafficmeter(char iface[32], int mode) /* set some defaults */ rxtotal=txtotal=rxptotal=txptotal=rxpmax=txpmax=0; - rxpmin=txpmin=rxmin=txmin=FP64; + rxpmin=txpmin=rxmin=txmin=MAX64; rxmax=txmax=0; timespent = (uint64_t)time(NULL); diff --git a/tests/common_tests.c b/tests/common_tests.c index 884c142..375abe6 100644 --- a/tests/common_tests.c +++ b/tests/common_tests.c @@ -95,7 +95,7 @@ START_TEST(countercalc_32bit) a = 1; b = 0; - ck_assert(countercalc(&a, &b)==(FP32-1)); + ck_assert(countercalc(&a, &b)==(MAX32-1)); } END_TEST @@ -103,9 +103,9 @@ START_TEST(countercalc_64bit) { uint64_t a, b; - a = FP32+1; + a = MAX32+1; b = 0; - ck_assert(countercalc(&a, &b)==(FP64-FP32-1)); + ck_assert(countercalc(&a, &b)==(MAX64-MAX32-1)); } END_TEST