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

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 584a5eb28008d7a1c08c3d800c853d5ed594be50
Author: James Peach <jpe...@apache.org>
AuthorDate: Fri Apr 29 20:34:56 2016 -0700

    TS-4388: Refactor ParentResult initialization.
    
    There are a couple of placed where ParentResult objects are
    reinitialized. Refactor this into ParentResult::reset() so avoid
    duplicated code.
    
    (cherry picked from commit 2bf1a31cc95a2ffb1404d0a53e37190243c0aa1d)
    
     Conflicts:
        proxy/ParentSelection.cc
        proxy/ParentSelection.h
---
 proxy/ParentSelection.cc |  7 +------
 proxy/ParentSelection.h  | 24 +++++++++---------------
 proxy/http/HttpSM.cc     |  2 +-
 3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index e3bce11..b7e197c 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -123,12 +123,7 @@ ParentConfigParams::findParent(HttpRequestData *rdata, 
ParentResult *result)
     return;
   }
   // Initialize the result structure
-  result->rec = NULL;
-  result->epoch = tablePtr;
-  result->line_number = 0xffffffff;
-  result->wrap_around = false;
-  result->start_parent = 0;
-  result->last_parent = 0;
+  result->reset();
 
   // Check to see if the parent was set through the
   //   api
diff --git a/proxy/ParentSelection.h b/proxy/ParentSelection.h
index 68f41c7..bbc9182 100644
--- a/proxy/ParentSelection.h
+++ b/proxy/ParentSelection.h
@@ -168,27 +168,21 @@ public:
 ParentRecord *const extApiRecord = (ParentRecord *)0xeeeeffff;
 
 struct ParentResult {
-  ParentResult()
-    : result(PARENT_UNDEFINED),
-      hostname(NULL),
-      port(0),
-      retry(false),
-      line_number(0),
-      epoch(NULL),
-      rec(NULL),
-      last_parent(0),
-      start_parent(0),
-      wrap_around(false),
-      last_lookup(0)
-  {
-  }
-
+  ParentResult() { reset(); }
   // For outside consumption
   ParentResultType result;
   const char *hostname;
   int port;
   bool retry;
 
+  void
+  reset()
+  {
+    ink_zero(*this);
+    line_number = -1;
+    result = PARENT_UNDEFINED;
+  }
+
   // Internal use only
   //   Not to be modified by HTTP
   int line_number;
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 3fb056d..e9eb3cb 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7694,7 +7694,7 @@ HttpSM::redirect_request(const char *redirect_url, const 
int redirect_len)
   // we want to close the server session
   // will do that in handle_api_return under the
   // HttpTransact::SM_ACTION_REDIRECT_READ state
-  t_state.parent_result.result = PARENT_UNDEFINED;
+  t_state.parent_result.reset();
   t_state.request_sent_time = 0;
   t_state.response_received_time = 0;
   t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_INIT;

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

Reply via email to