From 73e6e70f13a17d9229fdb285d88c75d634ca0c0e Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 30 Aug 2012 21:16:07 -0700 Subject: [PATCH] Use stl for min and max. --- src/Config.cpp | 11 ++++++----- src/ConnectionPool.cpp | 3 ++- src/utils.h | 8 -------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index 4e36f39a1b..a419ae0aae 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #define SECTION_ACCOUNT_PROBE_MAX "account_probe_max" #define SECTION_DEBUG_LOGFILE "debug_logfile" @@ -232,19 +233,19 @@ void Config::load() if (sectionSingleB(secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp)) // Minimum for min is 60 seconds. - PEER_SCAN_INTERVAL_MIN = MAX(60, boost::lexical_cast(strTemp)); + PEER_SCAN_INTERVAL_MIN = std::max(60, boost::lexical_cast(strTemp)); if (sectionSingleB(secConfig, SECTION_PEER_START_MAX, strTemp)) - PEER_START_MAX = MAX(1, boost::lexical_cast(strTemp)); + PEER_START_MAX = std::max(1, boost::lexical_cast(strTemp)); if (sectionSingleB(secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp)) - PEER_CONNECT_LOW_WATER = MAX(1, boost::lexical_cast(strTemp)); + PEER_CONNECT_LOW_WATER = std::max(1, boost::lexical_cast(strTemp)); if (sectionSingleB(secConfig, SECTION_NETWORK_QUORUM, strTemp)) - NETWORK_QUORUM = MAX(0, boost::lexical_cast(strTemp)); + NETWORK_QUORUM = std::max(0, boost::lexical_cast(strTemp)); if (sectionSingleB(secConfig, SECTION_VALIDATION_QUORUM, strTemp)) - VALIDATION_QUORUM = MAX(0, boost::lexical_cast(strTemp)); + VALIDATION_QUORUM = std::max(0, boost::lexical_cast(strTemp)); if (sectionSingleB(secConfig, SECTION_FEE_ACCOUNT_CREATE, strTemp)) FEE_ACCOUNT_CREATE = boost::lexical_cast(strTemp); diff --git a/src/ConnectionPool.cpp b/src/ConnectionPool.cpp index 14e5604841..acceef4887 100644 --- a/src/ConnectionPool.cpp +++ b/src/ConnectionPool.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "Config.h" #include "Peer.h" @@ -645,7 +646,7 @@ void ConnectionPool::scanRefresh() (void) mScanTimer.cancel(); - iInterval = MAX(iInterval, theConfig.PEER_SCAN_INTERVAL_MIN); + iInterval = std::max(iInterval, theConfig.PEER_SCAN_INTERVAL_MIN); tpNext = tpNow + boost::posix_time::seconds(iInterval); diff --git a/src/utils.h b/src/utils.h index f11b82a1b7..91c5ff9b36 100644 --- a/src/utils.h +++ b/src/utils.h @@ -16,14 +16,6 @@ #define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0))) #define ADDRESS_SHARED(p) strHex(uint64( ((char*) (p).get()) - ((char*) 0))) -#ifndef MAX -#define MAX(x,y) ((x) < (y) ? (y) : (x)) -#endif - -#ifndef MIN -#define MIN(x,y) ((x) > (y) ? (y) : (x)) -#endif - #define isSetBit(x,y) (!!((x) & (y))) #ifdef WIN32