You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/11/15 02:56:21 UTC

[trafficserver] 04/04: Fix some old code use of min(), which was not done on master

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 9b2c668916e9694ab845d77c44be3bc76be8a9aa
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Wed Nov 15 10:55:41 2017 +0800

    Fix some old code use of min(), which was not done on master
---
 iocore/cluster/ClusterHandlerBase.cc |  2 +-
 mgmt/cluster/ClusterCom.cc           |  2 +-
 proxy/http/HttpTransact.cc           | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/iocore/cluster/ClusterHandlerBase.cc b/iocore/cluster/ClusterHandlerBase.cc
index 16d42a8..36011d6 100644
--- a/iocore/cluster/ClusterHandlerBase.cc
+++ b/iocore/cluster/ClusterHandlerBase.cc
@@ -1144,7 +1144,7 @@ ClusterHandler::startClusterEvent(int event, Event *e)
       //  external_incoming_control.
 
       int procs_online    = ink_number_of_processors();
-      int total_callbacks = min(procs_online, MAX_COMPLETION_CALLBACK_EVENTS);
+      int total_callbacks = std::min(procs_online, MAX_COMPLETION_CALLBACK_EVENTS);
       for (int n = 0; n < total_callbacks; ++n) {
         callout_cont[n]   = new ClusterCalloutContinuation(this);
         callout_events[n] = eventProcessor.schedule_every(callout_cont[n], COMPLETION_CALLBACK_PERIOD, ET_NET);
diff --git a/mgmt/cluster/ClusterCom.cc b/mgmt/cluster/ClusterCom.cc
index 496def1..263069d 100644
--- a/mgmt/cluster/ClusterCom.cc
+++ b/mgmt/cluster/ClusterCom.cc
@@ -658,7 +658,7 @@ ClusterCom::generateClusterDelta()
 
     // is the node alive?
     if (tmp->num_virt_addrs != -1) {
-      highest_delta = max(highest_delta, tmp->delta);
+      highest_delta = std::max(highest_delta, tmp->delta);
     }
   }
   ink_mutex_release(&(mutex));
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 6109379..411c631 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7388,12 +7388,12 @@ HttpTransact::calculate_freshness_fuzz(State *s, int fresh_limit)
     if (s->txn_conf->freshness_fuzz_min_time > 0) {
       // Complicated calculations to try to find a reasonable fuzz time between fuzz_min_time and fuzz_time
       int fresh_small = (int)rint((double)s->txn_conf->freshness_fuzz_min_time *
-                                  pow(2, min((double)fresh_limit / (double)s->txn_conf->freshness_fuzz_time,
-                                             sqrt((double)s->txn_conf->freshness_fuzz_time))));
-      int fresh_large = max((int)s->txn_conf->freshness_fuzz_min_time,
-                            (int)rint(s->txn_conf->freshness_fuzz_time *
-                                      log10((double)(fresh_limit - s->txn_conf->freshness_fuzz_min_time) / LOG_YEAR)));
-      result = min(fresh_small, fresh_large);
+                                  pow(2, std::min((double)fresh_limit / (double)s->txn_conf->freshness_fuzz_time,
+                                                  sqrt((double)s->txn_conf->freshness_fuzz_time))));
+      int fresh_large = std::max((int)s->txn_conf->freshness_fuzz_min_time,
+                                 (int)rint(s->txn_conf->freshness_fuzz_time *
+                                           log10((double)(fresh_limit - s->txn_conf->freshness_fuzz_min_time) / LOG_YEAR)));
+      result = std::min(fresh_small, fresh_large);
       DebugTxn("http_match", "calculate_freshness_fuzz using min/max --- freshness fuzz = %d", result);
     } else {
       result = s->txn_conf->freshness_fuzz_time;
@@ -7473,8 +7473,8 @@ HttpTransact::what_is_document_freshness(State *s, HTTPHdr *client_request, HTTP
   //  documents at the same time
   if ((s->txn_conf->freshness_fuzz_time > 0) && (s->txn_conf->freshness_fuzz_prob > 0.0)) {
     fresh_limit = fresh_limit - calculate_freshness_fuzz(s, fresh_limit);
-    fresh_limit = max(0, fresh_limit);
-    fresh_limit = min((int)s->txn_conf->cache_guaranteed_max_lifetime, fresh_limit);
+    fresh_limit = std::max(0, fresh_limit);
+    fresh_limit = std::min((int)s->txn_conf->cache_guaranteed_max_lifetime, fresh_limit);
   }
 
   current_age = HttpTransactHeaders::calculate_document_age(s->request_sent_time, s->response_received_time, cached_obj_response,

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.