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 2015/03/23 21:32:34 UTC

[01/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Repository: trafficserver
Updated Branches:
  refs/heads/master 3535b30d9 -> bc6acc0b8


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/wccp-test-router.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/wccp-test-router.cc b/lib/wccp/wccp-test-router.cc
index 362277b..6fbfe17 100644
--- a/lib/wccp/wccp-test-router.cc
+++ b/lib/wccp/wccp-test-router.cc
@@ -20,33 +20,33 @@
     limitations under the License.
  */
 
-# include <stdio.h>
-# include <unistd.h>
-# include <stdarg.h>
-# include <memory.h>
-# include <strings.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <memory.h>
+#include <strings.h>
 
-# include <getopt.h>
+#include <getopt.h>
 
-# include "Wccp.h"
+#include "Wccp.h"
 
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
-# include <poll.h>
+#include <poll.h>
 
-# include <tsconfig/TsValue.h>
+#include <tsconfig/TsValue.h>
 
-static char const USAGE_TEXT[] =
-  "%s\n"
-  "--address IP address to bind.\n"
-  "--help Print usage and exit.\n"
-  ;
+static char const USAGE_TEXT[] = "%s\n"
+                                 "--address IP address to bind.\n"
+                                 "--help Print usage and exit.\n";
 
 static bool Ready = true;
 
-inline void Error(char const* fmt, ...) {
+inline void
+Error(char const *fmt, ...)
+{
   va_list args;
   va_start(args, fmt);
   vfprintf(stderr, fmt, args);
@@ -54,34 +54,32 @@ inline void Error(char const* fmt, ...) {
 }
 
 int
-main(int argc, char** argv) {
+main(int argc, char **argv)
+{
   wccp::Router wcp;
 
   // Reading stdin support.
   size_t in_size = 200;
-  char* in_buff = 0;
+  char *in_buff = 0;
   ssize_t in_count;
 
   // getopt return values. Selected to avoid collisions with
   // short arguments.
   static int const OPT_ADDRESS = 257; ///< Bind to IP address option.
-  static int const OPT_HELP = 258; ///< Print help message.
-  static int const OPT_MD5 = 259; ///< MD5 key.
+  static int const OPT_HELP = 258;    ///< Print help message.
+  static int const OPT_MD5 = 259;     ///< MD5 key.
 
   static option OPTIONS[] = {
-    { "address", 1, 0, OPT_ADDRESS },
-    { "md5", 1, 0, OPT_MD5 },
-    { "help", 0, 0, OPT_HELP },
-    { 0, 0, 0, 0 } // required terminator.
+    {"address", 1, 0, OPT_ADDRESS}, {"md5", 1, 0, OPT_MD5}, {"help", 0, 0, OPT_HELP}, {0, 0, 0, 0} // required terminator.
   };
 
-  in_addr ip_addr = { INADDR_ANY };
+  in_addr ip_addr = {INADDR_ANY};
 
   int zret; // getopt return.
   int zidx; // option index.
   bool fail = false;
-//  char const* text; // Scratch pointer for config access.
-  char const* FAIL_MSG = "";
+  //  char const* text; // Scratch pointer for config access.
+  char const *FAIL_MSG = "";
 
   while (-1 != (zret = getopt_long_only(argc, argv, "", OPTIONS, &zidx))) {
     switch (zret) {
@@ -110,7 +108,8 @@ main(int argc, char** argv) {
     return 1;
   }
 
-  if (!Ready) return 4;
+  if (!Ready)
+    return 4;
 
   if (0 > wcp.open(ip_addr.s_addr)) {
     fprintf(stderr, "Failed to open or bind socket.\n");
@@ -136,7 +135,7 @@ main(int argc, char** argv) {
       if (pfa[1].revents) {
         if (pfa[1].revents & POLLIN) {
           wcp.handleMessage();
-          //wcp.sendPendingMessages();
+          // wcp.sendPendingMessages();
         } else {
           fprintf(stderr, "Socket failure.\n");
           return 6;
@@ -150,8 +149,7 @@ main(int argc, char** argv) {
         }
       }
     } else { // timeout
-      //wcp.sendPendingMessages();
+      // wcp.sendPendingMessages();
     }
   }
-
 }


[22/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
index 62db54a..6e7974c 100644
--- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
+++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
@@ -34,57 +34,72 @@ using std::string;
 // To view the debug messages ./traffic_server -T "async_http_fetch_example.*"
 #define TAG "async_http_fetch_example"
 
-class AsyncHttpFetch2 : public AsyncHttpFetch {
+class AsyncHttpFetch2 : public AsyncHttpFetch
+{
 public:
-  AsyncHttpFetch2(string request) : AsyncHttpFetch(request) { };
+  AsyncHttpFetch2(string request) : AsyncHttpFetch(request){};
 };
 
-class AsyncHttpFetch3 : public AsyncHttpFetch {
+class AsyncHttpFetch3 : public AsyncHttpFetch
+{
 public:
-  AsyncHttpFetch3(string request, HttpMethod method) : AsyncHttpFetch(request, method) { };
+  AsyncHttpFetch3(string request, HttpMethod method) : AsyncHttpFetch(request, method){};
 };
 
-class DelayedAsyncHttpFetch : public AsyncHttpFetch, public AsyncReceiver<AsyncTimer> {
+class DelayedAsyncHttpFetch : public AsyncHttpFetch, public AsyncReceiver<AsyncTimer>
+{
 public:
   DelayedAsyncHttpFetch(string request, HttpMethod method, shared_ptr<Mutex> mutex)
-    : AsyncHttpFetch(request, method), mutex_(mutex), timer_(NULL) { };
-  void run() {
+    : AsyncHttpFetch(request, method), mutex_(mutex), timer_(NULL){};
+  void
+  run()
+  {
     timer_ = new AsyncTimer(AsyncTimer::TYPE_ONE_OFF, 1000 /* 1s */);
     Async::execute(this, timer_, mutex_);
   }
-  void handleAsyncComplete(AsyncTimer &/*timer ATS_UNUSED */) {
+  void
+  handleAsyncComplete(AsyncTimer & /*timer ATS_UNUSED */)
+  {
     TS_DEBUG(TAG, "Receiver should not be reachable");
     assert(!getDispatchController()->dispatch());
     delete this;
   }
-  bool isAlive() {
+  bool
+  isAlive()
+  {
     return getDispatchController()->isEnabled();
   }
   ~DelayedAsyncHttpFetch() { delete timer_; }
+
 private:
   shared_ptr<Mutex> mutex_;
   AsyncTimer *timer_;
 };
 
-class TransactionHookPlugin : public TransactionPlugin, public AsyncReceiver<AsyncHttpFetch>,
-                              public AsyncReceiver<AsyncHttpFetch2>, public AsyncReceiver<AsyncHttpFetch3>,
-                              public AsyncReceiver<DelayedAsyncHttpFetch> {
+class TransactionHookPlugin : public TransactionPlugin,
+                              public AsyncReceiver<AsyncHttpFetch>,
+                              public AsyncReceiver<AsyncHttpFetch2>,
+                              public AsyncReceiver<AsyncHttpFetch3>,
+                              public AsyncReceiver<DelayedAsyncHttpFetch>
+{
 public:
-  TransactionHookPlugin(Transaction &transaction) :
-    TransactionPlugin(transaction), transaction_(transaction), num_fetches_pending_(0) {
+  TransactionHookPlugin(Transaction &transaction)
+    : TransactionPlugin(transaction), transaction_(transaction), num_fetches_pending_(0)
+  {
     TS_DEBUG(TAG, "Constructed TransactionHookPlugin, saved a reference to this transaction.");
     registerHook(HOOK_SEND_REQUEST_HEADERS);
   }
 
-  void handleSendRequestHeaders(Transaction & /*transaction ATS_UNUSED */) {
+  void
+  handleSendRequestHeaders(Transaction & /*transaction ATS_UNUSED */)
+  {
     Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch("http://127.0.0.1/"), getMutex());
     ++num_fetches_pending_;
     AsyncHttpFetch *post_request = new AsyncHttpFetch("http://127.0.0.1/post", "data");
 
     (void)post_request;
 
-    Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch("http://127.0.0.1/post", "data"),
-                                   getMutex());
+    Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch("http://127.0.0.1/post", "data"), getMutex());
     ++num_fetches_pending_;
 
     // we'll add some custom headers for this request
@@ -105,29 +120,38 @@ public:
     assert(!delayed_provider->isAlive());
   }
 
-  void handleAsyncComplete(AsyncHttpFetch &async_http_fetch) {
+  void
+  handleAsyncComplete(AsyncHttpFetch &async_http_fetch)
+  {
     // This will be called when our async event is complete.
     TS_DEBUG(TAG, "AsyncHttpFetch completed");
     handleAnyAsyncComplete(async_http_fetch);
   }
 
-  void handleAsyncComplete(AsyncHttpFetch2 &async_http_fetch) {
+  void
+  handleAsyncComplete(AsyncHttpFetch2 &async_http_fetch)
+  {
     // This will be called when our async event is complete.
     TS_DEBUG(TAG, "AsyncHttpFetch2 completed");
     handleAnyAsyncComplete(async_http_fetch);
   }
 
-  virtual ~TransactionHookPlugin() {
+  virtual ~TransactionHookPlugin()
+  {
     TS_DEBUG(TAG, "Destroyed TransactionHookPlugin!");
     // since we die right away, we should not receive the callback for this (using POST request this time)
     Async::execute<AsyncHttpFetch3>(this, new AsyncHttpFetch3("http://127.0.0.1/", HTTP_METHOD_POST), getMutex());
   }
 
-  void handleAsyncComplete(AsyncHttpFetch3 & /* async_http_fetch ATS_UNUSED */) {
+  void
+  handleAsyncComplete(AsyncHttpFetch3 & /* async_http_fetch ATS_UNUSED */)
+  {
     assert(!"AsyncHttpFetch3 shouldn't have completed!");
   }
 
-  void handleAsyncComplete(DelayedAsyncHttpFetch &/*async_http_fetch ATS_UNUSED */) {
+  void
+  handleAsyncComplete(DelayedAsyncHttpFetch & /*async_http_fetch ATS_UNUSED */)
+  {
     assert(!"Should've been canceled!");
   }
 
@@ -135,14 +159,15 @@ private:
   Transaction &transaction_;
   int num_fetches_pending_;
 
-  void handleAnyAsyncComplete(AsyncHttpFetch &async_http_fetch) {
+  void
+  handleAnyAsyncComplete(AsyncHttpFetch &async_http_fetch)
+  {
     // This will be called when our async event is complete.
     TS_DEBUG(TAG, "Fetch completed for URL [%s]", async_http_fetch.getRequestUrl().getUrlString().c_str());
     const Response &response = async_http_fetch.getResponse();
     if (async_http_fetch.getResult() == AsyncHttpFetch::RESULT_SUCCESS) {
       TS_DEBUG(TAG, "Response version is [%s], status code %d, reason phrase [%s]",
-               HTTP_VERSION_STRINGS[response.getVersion()].c_str(), response.getStatusCode(),
-               response.getReasonPhrase().c_str());
+               HTTP_VERSION_STRINGS[response.getVersion()].c_str(), response.getStatusCode(), response.getReasonPhrase().c_str());
 
       TS_DEBUG(TAG, "Reponse Headers: \n%s\n", response.getHeaders().str().c_str());
 
@@ -150,44 +175,46 @@ private:
       size_t body_size;
       async_http_fetch.getResponseBody(body, body_size);
       TS_DEBUG(TAG, "Response body is %zu bytes long and is [%.*s]", body_size, static_cast<int>(body_size),
-               static_cast<const char*>(body));
+               static_cast<const char *>(body));
     } else {
-      TS_ERROR(TAG, "Fetch did not complete successfully; Result %d",
-               static_cast<int>(async_http_fetch.getResult()));
+      TS_ERROR(TAG, "Fetch did not complete successfully; Result %d", static_cast<int>(async_http_fetch.getResult()));
     }
     if (--num_fetches_pending_ == 0) {
       TS_DEBUG(TAG, "Reenabling transaction");
       transaction_.resume();
     }
   }
-
 };
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
+  GlobalHookPlugin()
+  {
     TS_DEBUG(TAG, "Registering a global hook HOOK_READ_REQUEST_HEADERS_POST_REMAP");
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
   }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Received a request in handleReadRequestHeadersPostRemap.");
 
     // If we don't make sure to check if it's an internal request we can get ourselves into an infinite loop!
     if (!transaction.isInternalRequest()) {
       transaction.addPlugin(new TransactionHookPlugin(transaction));
-    }
-    else {
+    } else {
       TS_DEBUG(TAG, "Ignoring internal transaction");
     }
     transaction.resume();
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin");
   GlobalPlugin *instance = new GlobalHookPlugin();
 
   (void)instance;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
index f570f6f..33902c3 100644
--- a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
+++ b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
@@ -35,16 +35,19 @@ using std::string;
 // To view the debug messages ./traffic_server -T "async_http_fetch_example.*"
 #define TAG "async_http_fetch_example"
 
-class Intercept : public InterceptPlugin, public AsyncReceiver<AsyncHttpFetch> {
+class Intercept : public InterceptPlugin, public AsyncReceiver<AsyncHttpFetch>
+{
 public:
-  Intercept(Transaction &transaction) : InterceptPlugin(transaction, InterceptPlugin::SERVER_INTERCEPT),
-                                        transaction_(transaction), num_fetches_(0) {
+  Intercept(Transaction &transaction)
+    : InterceptPlugin(transaction, InterceptPlugin::SERVER_INTERCEPT), transaction_(transaction), num_fetches_(0)
+  {
     main_url_ = transaction.getClientRequest().getUrl().getUrlString();
   }
   void consume(const string &data, InterceptPlugin::RequestDataType type);
   void handleInputComplete();
   void handleAsyncComplete(AsyncHttpFetch &async_http_fetch);
   ~Intercept();
+
 private:
   Transaction &transaction_;
   string request_body_;
@@ -53,55 +56,66 @@ private:
   int num_fetches_;
 };
 
-class InterceptInstaller : public GlobalPlugin {
+class InterceptInstaller : public GlobalPlugin
+{
 public:
-  InterceptInstaller() : GlobalPlugin(true /* ignore internal transactions */) {
+  InterceptInstaller() : GlobalPlugin(true /* ignore internal transactions */)
+  {
     GlobalPlugin::registerHook(Plugin::HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
   }
-  void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     transaction.addPlugin(new Intercept(transaction));
     TS_DEBUG(TAG, "Added intercept");
     transaction.resume();
   }
 };
 
-void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) {
+void
+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
+{
   new InterceptInstaller();
 }
 
-void Intercept::consume(const string &data, InterceptPlugin::RequestDataType type) {
+void
+Intercept::consume(const string &data, InterceptPlugin::RequestDataType type)
+{
   if (type == InterceptPlugin::REQUEST_BODY) {
     request_body_ += data;
   }
 }
 
-void Intercept::handleInputComplete() {
+void
+Intercept::handleInputComplete()
+{
   TS_DEBUG(TAG, "Request data complete");
-  AsyncHttpFetch *async_http_fetch = request_body_.empty() ?
-    new AsyncHttpFetch(main_url_, AsyncHttpFetch::STREAMING_ENABLED, transaction_.getClientRequest().getMethod()) :
-    new AsyncHttpFetch(main_url_, AsyncHttpFetch::STREAMING_ENABLED, request_body_);
+  AsyncHttpFetch *async_http_fetch =
+    request_body_.empty() ?
+      new AsyncHttpFetch(main_url_, AsyncHttpFetch::STREAMING_ENABLED, transaction_.getClientRequest().getMethod()) :
+      new AsyncHttpFetch(main_url_, AsyncHttpFetch::STREAMING_ENABLED, request_body_);
   Async::execute<AsyncHttpFetch>(this, async_http_fetch, getMutex());
   ++num_fetches_;
   size_t dependent_url_param_pos = main_url_.find("dependent_url=");
   if (dependent_url_param_pos != string::npos) {
     dependent_url_ = main_url_.substr(dependent_url_param_pos + 14);
-    Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch(dependent_url_,
-                                                            AsyncHttpFetch::STREAMING_ENABLED),
-                                   getMutex());
+    Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch(dependent_url_, AsyncHttpFetch::STREAMING_ENABLED), getMutex());
     ++num_fetches_;
     TS_DEBUG(TAG, "Started fetch for dependent URL [%s]", dependent_url_.c_str());
   }
 }
 
-void Intercept::handleAsyncComplete(AsyncHttpFetch &async_http_fetch) {
+void
+Intercept::handleAsyncComplete(AsyncHttpFetch &async_http_fetch)
+{
   AsyncHttpFetch::Result result = async_http_fetch.getResult();
   string url = async_http_fetch.getRequestUrl().getUrlString();
   if (result == AsyncHttpFetch::RESULT_HEADER_COMPLETE) {
     TS_DEBUG(TAG, "Header completed for URL [%s]", url.c_str());
     const Response &response = async_http_fetch.getResponse();
     std::ostringstream oss;
-    oss << HTTP_VERSION_STRINGS[response.getVersion()] << ' ' << response.getStatusCode() << ' '
-        << response.getReasonPhrase() << "\r\n";
+    oss << HTTP_VERSION_STRINGS[response.getVersion()] << ' ' << response.getStatusCode() << ' ' << response.getReasonPhrase()
+        << "\r\n";
     Headers &response_headers = response.getHeaders();
     for (Headers::iterator iter = response_headers.begin(), end = response_headers.end(); iter != end; ++iter) {
       HeaderFieldName header_name = (*iter).name();
@@ -112,27 +126,23 @@ void Intercept::handleAsyncComplete(AsyncHttpFetch &async_http_fetch) {
     oss << "\r\n";
     if (url == main_url_) {
       Intercept::produce(oss.str());
-    }
-    else {
+    } else {
       TS_DEBUG(TAG, "Response header for dependent URL\n%s", oss.str().c_str());
     }
-  }
-  else if (result == AsyncHttpFetch::RESULT_PARTIAL_BODY || result == AsyncHttpFetch::RESULT_BODY_COMPLETE) {
+  } else if (result == AsyncHttpFetch::RESULT_PARTIAL_BODY || result == AsyncHttpFetch::RESULT_BODY_COMPLETE) {
     const void *body;
     size_t body_size;
     async_http_fetch.getResponseBody(body, body_size);
     if (url == main_url_) {
       Intercept::produce(string(static_cast<const char *>(body), body_size));
-    }
-    else {
+    } else {
       TS_DEBUG(TAG, "Got dependent body bit; has %zu bytes and is [%.*s]", body_size, static_cast<int>(body_size),
                static_cast<const char *>(body));
     }
     if (result == AsyncHttpFetch::RESULT_BODY_COMPLETE) {
       TS_DEBUG(TAG, "response body complete");
     }
-  }
-  else {
+  } else {
     TS_ERROR(TAG, "Fetch did not complete successfully; Result %d", static_cast<int>(result));
     if (url == main_url_) {
       InterceptPlugin::produce("HTTP/1.1 500 Internal Server Error\r\n\r\n");
@@ -147,7 +157,8 @@ void Intercept::handleAsyncComplete(AsyncHttpFetch &async_http_fetch) {
   }
 }
 
-Intercept::~Intercept() {
+Intercept::~Intercept()
+{
   if (num_fetches_) {
     TS_DEBUG(TAG, "Fetch still pending, but transaction closing");
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/async_timer/AsyncTimer.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/async_timer/AsyncTimer.cc b/lib/atscppapi/examples/async_timer/AsyncTimer.cc
index c802462..6faa081 100644
--- a/lib/atscppapi/examples/async_timer/AsyncTimer.cc
+++ b/lib/atscppapi/examples/async_timer/AsyncTimer.cc
@@ -26,16 +26,20 @@ using std::string;
 
 #define TAG "async_timer"
 
-class TimerEventReceiver : public AsyncReceiver<AsyncTimer> {
+class TimerEventReceiver : public AsyncReceiver<AsyncTimer>
+{
 public:
   TimerEventReceiver(AsyncTimer::Type type, int period_in_ms, int initial_period_in_ms = 0, int max_instances = 0,
                      bool cancel = false)
-    : max_instances_(max_instances), instance_count_(0), type_(type), cancel_(cancel) {
+    : max_instances_(max_instances), instance_count_(0), type_(type), cancel_(cancel)
+  {
     timer_ = new AsyncTimer(type, period_in_ms, initial_period_in_ms);
     Async::execute<AsyncTimer>(this, timer_, shared_ptr<Mutex>()); // letting the system create the mutex
   }
 
-  void handleAsyncComplete(AsyncTimer &timer ATSCPPAPI_UNUSED) {
+  void
+  handleAsyncComplete(AsyncTimer &timer ATSCPPAPI_UNUSED)
+  {
     TS_DEBUG(TAG, "Got timer event in object %p!", this);
     if ((type_ == AsyncTimer::TYPE_ONE_OFF) || (max_instances_ && (++instance_count_ == max_instances_))) {
       TS_DEBUG(TAG, "Stopping timer in object %p!", this);
@@ -43,9 +47,7 @@ public:
     }
   }
 
-  ~TimerEventReceiver() {
-    delete timer_;
-  }
+  ~TimerEventReceiver() { delete timer_; }
 
 private:
   int max_instances_;
@@ -55,22 +57,21 @@ private:
   bool cancel_;
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   int period_in_ms = 1000;
   TimerEventReceiver *timer1 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms);
-  TS_DEBUG(TAG, "Created periodic timer %p with initial period 0, regular period %d and max instances 0", timer1,
-           period_in_ms);
+  TS_DEBUG(TAG, "Created periodic timer %p with initial period 0, regular period %d and max instances 0", timer1, period_in_ms);
 
   int initial_period_in_ms = 100;
-  TimerEventReceiver *timer2 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms,
-                                                      initial_period_in_ms);
+  TimerEventReceiver *timer2 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms, initial_period_in_ms);
   TS_DEBUG(TAG, "Created periodic timer %p with initial period %d, regular period %d and max instances 0", timer2,
            initial_period_in_ms, period_in_ms);
 
   initial_period_in_ms = 200;
   int max_instances = 10;
-  TimerEventReceiver *timer3 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms, initial_period_in_ms,
-                                                      max_instances);
+  TimerEventReceiver *timer3 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms, initial_period_in_ms, max_instances);
   TS_DEBUG(TAG, "Created periodic timer %p with initial period %d, regular period %d and max instances %d", timer3,
            initial_period_in_ms, period_in_ms, max_instances);
 
@@ -79,8 +80,8 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED
 
   initial_period_in_ms = 0;
   max_instances = 5;
-  TimerEventReceiver *timer5 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms, initial_period_in_ms,
-                                                      max_instances, true /* cancel */);
+  TimerEventReceiver *timer5 =
+    new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms, initial_period_in_ms, max_instances, true /* cancel */);
   TS_DEBUG(TAG, "Created canceling timer %p with initial period %d, regular period %d and max instances %d", timer5,
            initial_period_in_ms, period_in_ms, max_instances);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/boom/boom.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/boom/boom.cc b/lib/atscppapi/examples/boom/boom.cc
index 1d99bb2..4d8b9d4 100644
--- a/lib/atscppapi/examples/boom/boom.cc
+++ b/lib/atscppapi/examples/boom/boom.cc
@@ -73,8 +73,8 @@
 using namespace atscppapi;
 #define TAG "boom"
 
-namespace {
-
+namespace
+{
 /// Name for the Boom invocation counter
 const std::string BOOM_COUNTER = "BOOM_COUNTER";
 
@@ -82,8 +82,7 @@ const std::string BOOM_COUNTER = "BOOM_COUNTER";
 const std::string DEFAULT_ERROR_FILE = "default"; // default.html will be searched for
 
 // Default error response TBD when the default response will be used
-const std::string DEFAULT_ERROR_RESPONSE =
-    "<html><body><h1>This page will be back soon</h1></body></html>";
+const std::string DEFAULT_ERROR_RESPONSE = "<html><body><h1>This page will be back soon</h1></body></html>";
 
 // Default HTTP status code to use after booming
 const int DEFAULT_BOOM_HTTP_STATUS_CODE = 200;
@@ -97,19 +96,22 @@ Stat boom_counter;
 // Functor that decides whether the HTTP error can be rewritten or not.
 // Rewritable codes are: 2xx, 3xx, 4xx, 5xx and 6xx.
 // 1xx is NOT rewritable!
-class IsRewritableCode: public std::unary_function<std::string, bool> { // could probably be replaced with mem_ptr_fun()..
+class IsRewritableCode : public std::unary_function<std::string, bool>
+{ // could probably be replaced with mem_ptr_fun()..
 private:
   int current_code_;
   std::string current_code_string_;
+
 public:
-  IsRewritableCode(int current_code) :
-      current_code_(current_code) {
+  IsRewritableCode(int current_code) : current_code_(current_code)
+  {
     std::ostringstream oss;
     oss << current_code_;
     current_code_string_ = oss.str();
   }
 
-  bool operator()(const std::string &code) const {
+  bool operator()(const std::string &code) const
+  {
     TS_DEBUG(TAG, "Checking if %s matches code %s", current_code_string_.c_str(), code.c_str());
     if (code == current_code_string_)
       return true;
@@ -128,7 +130,8 @@ public:
   }
 };
 
-class BoomResponseRegistry {
+class BoomResponseRegistry
+{
   // Boom error codes
   std::set<std::string> error_codes_;
 
@@ -148,13 +151,12 @@ class BoomResponseRegistry {
   std::string generic_code_from_status(int http_status);
 
 public:
-
   // Set a "catchall" global default response
-  void set_global_default_response(const std::string& global_default_response);
+  void set_global_default_response(const std::string &global_default_response);
 
   // Populate the registry lookup table with contents of files in
   // the base directory
-  void populate_error_responses(const std::string& base_directory);
+  void populate_error_responses(const std::string &base_directory);
 
   // Return custom response string for the custom code
   // Lookup logic (using 404 as example)
@@ -163,7 +165,7 @@ public:
   //  3. Check for default response (i.e. contents of "default.html")
   //  4. Check for global default response (settable through "set_global_default_response" method)
   //  5. If all else fails, return compiled in response code
-  const std::string& get_response_for_error_code(int http_status_code);
+  const std::string &get_response_for_error_code(int http_status_code);
 
   // Returns true iff either of the three conditions are true:
   // 1. Exact match for the error is registered (e.g. "404.html" for HTTP 404)
@@ -173,11 +175,12 @@ public:
   bool has_code_registered(int http_status_code);
 
   // Register error codes
-  void register_error_codes(const std::vector<std::string>& error_codes);
+  void register_error_codes(const std::vector<std::string> &error_codes);
 };
 
 
-void BoomResponseRegistry::register_error_codes(const std::vector<std::string>& error_codes)
+void
+BoomResponseRegistry::register_error_codes(const std::vector<std::string> &error_codes)
 {
   std::vector<std::string>::const_iterator i = error_codes.begin(), e = error_codes.end();
   for (; i != e; ++i) {
@@ -190,12 +193,13 @@ bool get_file_contents(std::string fileName, std::string &contents);
 
 // Examine the error file directory and populate the error_response
 // map with the file contents.
-void BoomResponseRegistry::populate_error_responses(const std::string& base_directory) {
+void
+BoomResponseRegistry::populate_error_responses(const std::string &base_directory)
+{
   base_error_directory_ = base_directory;
 
   // Make sure we have a trailing / after the base directory
-  if (!base_error_directory_.empty()
-      && base_error_directory_[base_error_directory_.length() - 1] != '/')
+  if (!base_error_directory_.empty() && base_error_directory_[base_error_directory_.length() - 1] != '/')
     base_error_directory_.append("/"); // make sure we have a trailing /
 
   // Iterate over files in the base directory.
@@ -228,11 +232,15 @@ void BoomResponseRegistry::populate_error_responses(const std::string& base_dire
   }
 }
 
-void BoomResponseRegistry::set_global_default_response(const std::string& global_default_response) {
+void
+BoomResponseRegistry::set_global_default_response(const std::string &global_default_response)
+{
   global_response_string_ = global_default_response;
 }
 
-const std::string& BoomResponseRegistry::get_response_for_error_code(int http_status_code) {
+const std::string &
+BoomResponseRegistry::get_response_for_error_code(int http_status_code)
+{
   std::string code_str = code_from_status(http_status_code);
 
   if (error_responses_.count(code_str))
@@ -249,7 +257,9 @@ const std::string& BoomResponseRegistry::get_response_for_error_code(int http_st
   return DEFAULT_ERROR_RESPONSE;
 }
 
-bool BoomResponseRegistry::has_code_registered(int http_status_code) {
+bool
+BoomResponseRegistry::has_code_registered(int http_status_code)
+{
   // Only rewritable codes are allowed.
   std::set<std::string>::iterator ii = std::find_if(error_codes_.begin(), error_codes_.end(), IsRewritableCode(http_status_code));
   if (ii == error_codes_.end())
@@ -258,7 +268,9 @@ bool BoomResponseRegistry::has_code_registered(int http_status_code) {
     return true;
 }
 
-std::string BoomResponseRegistry::generic_code_from_status(int code) {
+std::string
+BoomResponseRegistry::generic_code_from_status(int code)
+{
   if (code >= 200 && code <= 299)
     return "2xx";
   else if (code >= 300 && code <= 399)
@@ -271,7 +283,9 @@ std::string BoomResponseRegistry::generic_code_from_status(int code) {
     return "default";
 }
 
-std::string BoomResponseRegistry::code_from_status(int code) {
+std::string
+BoomResponseRegistry::code_from_status(int code)
+{
   std::ostringstream oss;
   oss << code;
   std::string code_str = oss.str();
@@ -280,18 +294,21 @@ std::string BoomResponseRegistry::code_from_status(int code) {
 
 // Transaction plugin that intercepts error and displays
 // a error page as configured
-class BoomTransactionPlugin: public TransactionPlugin {
+class BoomTransactionPlugin : public TransactionPlugin
+{
 public:
-  BoomTransactionPlugin(Transaction &transaction, HttpStatus status, const std::string &reason,
-      const std::string &body) :
-      TransactionPlugin(transaction), status_(status), reason_(reason), body_(body) {
+  BoomTransactionPlugin(Transaction &transaction, HttpStatus status, const std::string &reason, const std::string &body)
+    : TransactionPlugin(transaction), status_(status), reason_(reason), body_(body)
+  {
     TransactionPlugin::registerHook(HOOK_SEND_RESPONSE_HEADERS);
-    TS_DEBUG(TAG, "Created BoomTransaction plugin for txn=%p, status=%d, reason=%s, body length=%d",
-        transaction.getAtsHandle(), status, reason.c_str(), static_cast<int>(body.length()));
+    TS_DEBUG(TAG, "Created BoomTransaction plugin for txn=%p, status=%d, reason=%s, body length=%d", transaction.getAtsHandle(),
+             status, reason.c_str(), static_cast<int>(body.length()));
     transaction.error(body_); // Set the error body now, and change the status and reason later.
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     transaction.getClientResponse().setStatusCode(status_);
     transaction.getClientResponse().setReasonPhrase(reason_);
     transaction.resume();
@@ -304,7 +321,9 @@ private:
 };
 
 // Utility routine to split string by delimiter.
-void stringSplit(const std::string &in, char delim, std::vector<std::string> &res) {
+void
+stringSplit(const std::string &in, char delim, std::vector<std::string> &res)
+{
   std::istringstream ss(in);
   std::string item;
   while (std::getline(ss, item, delim)) {
@@ -314,7 +333,9 @@ void stringSplit(const std::string &in, char delim, std::vector<std::string> &re
 
 // Utility routine to read file contents into a string
 // @returns true if the file exists and has been successfully read
-bool get_file_contents(std::string fileName, std::string &contents) {
+bool
+get_file_contents(std::string fileName, std::string &contents)
+{
   if (fileName.empty()) {
     return false;
   }
@@ -337,14 +358,14 @@ bool get_file_contents(std::string fileName, std::string &contents) {
   return true;
 }
 
-class BoomGlobalPlugin: public atscppapi::GlobalPlugin {
-
+class BoomGlobalPlugin : public atscppapi::GlobalPlugin
+{
 private:
   BoomResponseRegistry *response_registry_;
 
 public:
-  BoomGlobalPlugin(BoomResponseRegistry* response_registry) :
-      response_registry_(response_registry) {
+  BoomGlobalPlugin(BoomResponseRegistry *response_registry) : response_registry_(response_registry)
+  {
     TS_DEBUG(TAG, "Creating BoomGlobalHook %p", this);
     registerHook(HOOK_READ_RESPONSE_HEADERS);
   }
@@ -356,44 +377,44 @@ private:
   BoomGlobalPlugin();
 };
 
-void BoomGlobalPlugin::handleReadResponseHeaders(Transaction &transaction) {
-    // Get response status code from the transaction
-    HttpStatus http_status_code = transaction.getServerResponse().getStatusCode();
-
-    TS_DEBUG(TAG, "Checking if response with code %d is in the registry.", http_status_code);
-
-    // If the custom response for the error code is registered,
-    // attach the BoomTransactionPlugin to the transaction
-    if (response_registry_->has_code_registered(http_status_code)) {
-      // Get the original reason phrase string from the transaction
-      std::string http_reason_phrase = transaction.getServerResponse().getReasonPhrase();
-
-      TS_DEBUG(TAG, "Response has code %d which matches a registered code, TransactionPlugin will be created.", http_status_code);
-      // Increment the statistics counter
-      boom_counter.increment();
-
-      // Get custom response code from the registry
-      const std::string& custom_response = response_registry_->get_response_for_error_code(
-          http_status_code);
-
-      // Add the transaction plugin to the transaction
-      transaction.addPlugin(
-          new BoomTransactionPlugin(transaction, http_status_code, http_reason_phrase,
-              custom_response));
-      // No need to resume/error the transaction,
-      // as BoomTransactionPlugin will take care of terminating the transaction
-      return;
-    } else {
-      TS_DEBUG(TAG, "Code %d was not in the registry, transaction will be resumed", http_status_code);
-      transaction.resume();
-    }
+void
+BoomGlobalPlugin::handleReadResponseHeaders(Transaction &transaction)
+{
+  // Get response status code from the transaction
+  HttpStatus http_status_code = transaction.getServerResponse().getStatusCode();
+
+  TS_DEBUG(TAG, "Checking if response with code %d is in the registry.", http_status_code);
+
+  // If the custom response for the error code is registered,
+  // attach the BoomTransactionPlugin to the transaction
+  if (response_registry_->has_code_registered(http_status_code)) {
+    // Get the original reason phrase string from the transaction
+    std::string http_reason_phrase = transaction.getServerResponse().getReasonPhrase();
+
+    TS_DEBUG(TAG, "Response has code %d which matches a registered code, TransactionPlugin will be created.", http_status_code);
+    // Increment the statistics counter
+    boom_counter.increment();
+
+    // Get custom response code from the registry
+    const std::string &custom_response = response_registry_->get_response_for_error_code(http_status_code);
+
+    // Add the transaction plugin to the transaction
+    transaction.addPlugin(new BoomTransactionPlugin(transaction, http_status_code, http_reason_phrase, custom_response));
+    // No need to resume/error the transaction,
+    // as BoomTransactionPlugin will take care of terminating the transaction
+    return;
+  } else {
+    TS_DEBUG(TAG, "Code %d was not in the registry, transaction will be resumed", http_status_code);
+    transaction.resume();
   }
+}
 
 /*
  * This is the plugin registration point
  */
-void TSPluginInit(int argc, const char *argv[]) {
-
+void
+TSPluginInit(int argc, const char *argv[])
+{
   boom_counter.init(BOOM_COUNTER);
   BoomResponseRegistry *pregistry = new BoomResponseRegistry();
 
@@ -405,7 +426,7 @@ void TSPluginInit(int argc, const char *argv[]) {
     pregistry->populate_error_responses(base_directory);
 
     std::string error_codes_argument(argv[2], strlen(argv[2]));
-    std::vector < std::string > error_codes;
+    std::vector<std::string> error_codes;
     stringSplit(error_codes_argument, ',', error_codes);
     pregistry->register_error_codes(error_codes);
   } else {
@@ -414,4 +435,3 @@ void TSPluginInit(int argc, const char *argv[]) {
 
   new BoomGlobalPlugin(pregistry);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/clientredirect/ClientRedirect.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc
index 7e6afab..b4fcbd1 100644
--- a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc
+++ b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc
@@ -29,11 +29,12 @@ using std::list;
 using std::string;
 
 
-class ClientRedirectTransactionPlugin : public atscppapi::TransactionPlugin {
+class ClientRedirectTransactionPlugin : public atscppapi::TransactionPlugin
+{
 public:
   ClientRedirectTransactionPlugin(Transaction &transaction, const string &location)
-     : TransactionPlugin(transaction), location_(location) {
-
+    : TransactionPlugin(transaction), location_(location)
+  {
     //
     // We will set this transaction to jump to error state and then we will setup
     // the redirect on SEND_RESPONSE_HEADERS
@@ -42,35 +43,40 @@ public:
     transaction.error();
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     transaction.getClientResponse().setStatusCode(HTTP_STATUS_MOVED_TEMPORARILY);
     transaction.getClientResponse().setReasonPhrase("Moved Temporarily");
     transaction.getClientResponse().getHeaders()["Location"] = location_;
     transaction.resume();
   }
 
-  virtual ~ClientRedirectTransactionPlugin() { }
+  virtual ~ClientRedirectTransactionPlugin() {}
+
 private:
   string location_;
 };
 
 
-class ClientRedirectGlobalPlugin : public GlobalPlugin {
+class ClientRedirectGlobalPlugin : public GlobalPlugin
+{
 public:
-  ClientRedirectGlobalPlugin() {
-    registerHook(HOOK_SEND_REQUEST_HEADERS);
-  }
+  ClientRedirectGlobalPlugin() { registerHook(HOOK_SEND_REQUEST_HEADERS); }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
-    if(transaction.getClientRequest().getUrl().getQuery().find("redirect=1") != string::npos) {
+  void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
+    if (transaction.getClientRequest().getUrl().getQuery().find("redirect=1") != string::npos) {
       transaction.addPlugin(new ClientRedirectTransactionPlugin(transaction, "http://www.linkedin.com/"));
       return;
     }
     transaction.resume();
   }
-
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new ClientRedirectGlobalPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/clientrequest/ClientRequest.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/clientrequest/ClientRequest.cc b/lib/atscppapi/examples/clientrequest/ClientRequest.cc
index 31cd789..323870f 100644
--- a/lib/atscppapi/examples/clientrequest/ClientRequest.cc
+++ b/lib/atscppapi/examples/clientrequest/ClientRequest.cc
@@ -28,16 +28,20 @@ using std::endl;
 using std::list;
 using std::string;
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
+  GlobalHookPlugin()
+  {
     registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
     registerHook(HOOK_SEND_REQUEST_HEADERS);
   }
 
 
-  void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     cout << "Hello from handleReadRequesHeadersPreRemap!" << endl;
 
     ClientRequest &client_request = transaction.getClientRequest();
@@ -61,7 +65,9 @@ public:
   }
 
 
-  void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     cout << "Hello from handleReadRequesHeadersPostRemap!" << endl;
 
     ClientRequest &client_request = transaction.getClientRequest();
@@ -79,7 +85,7 @@ public:
     Headers &client_request_headers = client_request.getHeaders();
 
     Headers::iterator ii = client_request_headers.find("AccepT-EncodinG");
-    if(ii != client_request_headers.end()) {
+    if (ii != client_request_headers.end()) {
       cout << "Deleting accept-encoding header" << endl;
       client_request_headers.erase("AccepT-EnCoDing"); // Case Insensitive
     }
@@ -92,8 +98,8 @@ public:
     cout << "Adding a new accept type accept header" << endl;
     client_request_headers.append("accept", "text/blah");
 
-    for (Headers::iterator header_iter = client_request_headers.begin(),
-           header_end = client_request_headers.end(); header_iter != header_end; ++header_iter) {
+    for (Headers::iterator header_iter = client_request_headers.begin(), header_end = client_request_headers.end();
+         header_iter != header_end; ++header_iter) {
       cout << (*header_iter).str() << endl;
     }
 
@@ -105,13 +111,17 @@ public:
      */
     cout << "Joining on a non-existant header gives: " << client_request_headers.values("i_dont_exist") << endl;
     cout << "Joining the accept encoding header gives: " << client_request_headers.values("accept-encoding") << endl;
-    cout << "Joining the accept encoding header with space gives: " << client_request_headers.values("accept-encoding", ' ') << endl;
-    cout << "Joining the accept encoding header with long join string gives: " << client_request_headers.values("accept-encoding", "--join-string--") << endl;
+    cout << "Joining the accept encoding header with space gives: " << client_request_headers.values("accept-encoding", ' ')
+         << endl;
+    cout << "Joining the accept encoding header with long join string gives: "
+         << client_request_headers.values("accept-encoding", "--join-string--") << endl;
 
     transaction.resume();
   }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
+  void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
     cout << "Hello from handleSendRequestHeaders!" << endl;
     cout << "---------------------IP INFORMATION-----------------" << endl;
     cout << "Server Address: " << utils::getIpPortString(transaction.getServerAddress()) << endl;
@@ -120,9 +130,10 @@ public:
     cout << "Next Hop Address: " << utils::getIpPortString(transaction.getNextHopAddress()) << endl;
     transaction.resume();
   }
-
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new GlobalHookPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/customresponse/CustomResponse.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/customresponse/CustomResponse.cc b/lib/atscppapi/examples/customresponse/CustomResponse.cc
index fef1263..b6d3057 100644
--- a/lib/atscppapi/examples/customresponse/CustomResponse.cc
+++ b/lib/atscppapi/examples/customresponse/CustomResponse.cc
@@ -37,21 +37,26 @@ using std::string;
  *
  */
 
-class CustomResponseTransactionPlugin : public atscppapi::TransactionPlugin {
+class CustomResponseTransactionPlugin : public atscppapi::TransactionPlugin
+{
 public:
   CustomResponseTransactionPlugin(Transaction &transaction, HttpStatus status, const string &reason, const string &body)
-     : TransactionPlugin(transaction), status_(status), reason_(reason), body_(body) {
+    : TransactionPlugin(transaction), status_(status), reason_(reason), body_(body)
+  {
     TransactionPlugin::registerHook(HOOK_SEND_RESPONSE_HEADERS);
     transaction.error(body_); // Set the error body now, and change the status and reason later.
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     transaction.getClientResponse().setStatusCode(status_);
     transaction.getClientResponse().setReasonPhrase(reason_);
     transaction.resume();
   }
 
-  virtual ~CustomResponseTransactionPlugin() { }
+  virtual ~CustomResponseTransactionPlugin() {}
+
 private:
   HttpStatus status_;
   string reason_;
@@ -59,14 +64,15 @@ private:
 };
 
 
-class ClientRedirectGlobalPlugin : public GlobalPlugin {
+class ClientRedirectGlobalPlugin : public GlobalPlugin
+{
 public:
-  ClientRedirectGlobalPlugin() {
-    registerHook(HOOK_SEND_REQUEST_HEADERS);
-  }
+  ClientRedirectGlobalPlugin() { registerHook(HOOK_SEND_REQUEST_HEADERS); }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
-    if(transaction.getClientRequest().getUrl().getQuery().find("custom=1") != string::npos) {
+  void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
+    if (transaction.getClientRequest().getUrl().getQuery().find("custom=1") != string::npos) {
       transaction.addPlugin(new CustomResponseTransactionPlugin(transaction, HTTP_STATUS_OK, "Ok",
                                                                 "Hello! This is a custom response without making "
                                                                 "an origin request and no server intercept."));
@@ -74,9 +80,10 @@ public:
     }
     transaction.resume();
   }
-
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new ClientRedirectGlobalPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc
index 7e47933..1602a05 100644
--- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc
+++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc
@@ -22,20 +22,21 @@
 
 using namespace atscppapi;
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
-    registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
-  }
+  GlobalHookPlugin() { registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); }
 
-  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl;
     transaction.resume();
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new GlobalHookPlugin();
 }
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc
index caae81a..9f3a8d4 100644
--- a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc
+++ b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc
@@ -46,19 +46,30 @@ using std::string;
  * header is correctly set on the way out.
  */
 
-class Helpers {
+class Helpers
+{
 public:
-  static bool clientAcceptsGzip(Transaction &transaction) {
+  static bool
+  clientAcceptsGzip(Transaction &transaction)
+  {
     return transaction.getClientRequest().getHeaders().values("Accept-Encoding").find("gzip") != string::npos;
   }
 
-  static bool serverReturnedGzip(Transaction &transaction) {
+  static bool
+  serverReturnedGzip(Transaction &transaction)
+  {
     return transaction.getServerResponse().getHeaders().values("Content-Encoding").find("gzip") != string::npos;
   }
 
-  enum ContentType { UNKNOWN = 0, TEXT_HTML  = 1, TEXT_PLAIN = 2 };
+  enum ContentType {
+    UNKNOWN = 0,
+    TEXT_HTML = 1,
+    TEXT_PLAIN = 2,
+  };
 
-  static ContentType getContentType(Transaction &transaction) {
+  static ContentType
+  getContentType(Transaction &transaction)
+  {
     if (transaction.getServerResponse().getHeaders().values("Content-Type").find("text/html") != string::npos) {
       return TEXT_HTML;
     } else if (transaction.getServerResponse().getHeaders().values("Content-Type").find("text/plain") != string::npos) {
@@ -69,24 +80,32 @@ public:
   }
 };
 
-class SomeTransformationPlugin : public TransformationPlugin {
+class SomeTransformationPlugin : public TransformationPlugin
+{
 public:
   SomeTransformationPlugin(Transaction &transaction)
-    : TransformationPlugin(transaction, RESPONSE_TRANSFORMATION), transaction_(transaction) {
+    : TransformationPlugin(transaction, RESPONSE_TRANSFORMATION), transaction_(transaction)
+  {
     registerHook(HOOK_SEND_RESPONSE_HEADERS);
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Added X-Content-Transformed header");
     transaction.getClientResponse().getHeaders()["X-Content-Transformed"] = "1";
     transaction.resume();
   }
 
-  void consume(const string &data) {
+  void
+  consume(const string &data)
+  {
     produce(data);
   }
 
-  void handleInputComplete() {
+  void
+  handleInputComplete()
+  {
     Helpers::ContentType content_type = Helpers::getContentType(transaction_);
     if (content_type == Helpers::TEXT_HTML) {
       TS_DEBUG(TAG, "Adding an HTML comment at the end of the page");
@@ -100,20 +119,25 @@ public:
     setOutputComplete();
   }
 
-  virtual ~SomeTransformationPlugin() { }
+  virtual ~SomeTransformationPlugin() {}
+
 private:
   Transaction &transaction_;
 };
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
+  GlobalHookPlugin()
+  {
     registerHook(HOOK_SEND_REQUEST_HEADERS);
     registerHook(HOOK_READ_RESPONSE_HEADERS);
     registerHook(HOOK_SEND_RESPONSE_HEADERS);
   }
 
-  virtual void handleSendRequestHeaders(Transaction &transaction) {
+  virtual void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
     // Since we can only decompress gzip we will change the accept encoding header
     // to gzip, even if the user cannot accept gziped content we will return to them
     // uncompressed content in that case since we have to be able to transform the content.
@@ -126,45 +150,48 @@ public:
     transaction.resume();
   }
 
-  virtual void handleReadResponseHeaders(Transaction &transaction) {
+  virtual void
+  handleReadResponseHeaders(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Determining if we need to add an inflate transformation or a deflate transformation..");
     // We're guaranteed to have been returned either gzipped content or Identity.
 
     if (Helpers::serverReturnedGzip(transaction)) {
       // If the returned content was gziped we will inflate it so we can transform it.
-      TS_DEBUG(TAG,"Creating Inflate Transformation because the server returned gziped content");
-      transaction.addPlugin(new GzipInflateTransformation(transaction,
-                                                          TransformationPlugin::RESPONSE_TRANSFORMATION));
+      TS_DEBUG(TAG, "Creating Inflate Transformation because the server returned gziped content");
+      transaction.addPlugin(new GzipInflateTransformation(transaction, TransformationPlugin::RESPONSE_TRANSFORMATION));
     }
 
     transaction.addPlugin(new SomeTransformationPlugin(transaction));
 
     // Even if the server didn't return gziped content, if the user supports it we will gzip it.
     if (Helpers::clientAcceptsGzip(transaction)) {
-      TS_DEBUG(TAG,"The client supports gzip so we will deflate the content on the way out.");
-      transaction.addPlugin(new GzipDeflateTransformation(transaction,
-                                                          TransformationPlugin::RESPONSE_TRANSFORMATION));
+      TS_DEBUG(TAG, "The client supports gzip so we will deflate the content on the way out.");
+      transaction.addPlugin(new GzipDeflateTransformation(transaction, TransformationPlugin::RESPONSE_TRANSFORMATION));
     }
     transaction.resume();
   }
 
-  virtual void handleSendResponseHeaders(Transaction &transaction) {
+  virtual void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     // If the client supported gzip then we can guarantee they are receiving gzip since regardless of the
     // origins content-encoding we returned gzip, so let's make sure the content-encoding header is correctly
     // set to gzip or identity.
     if (Helpers::clientAcceptsGzip(transaction)) {
-      TS_DEBUG(TAG,"Setting the client response content-encoding to gzip since the user supported it, that's what they got.");
+      TS_DEBUG(TAG, "Setting the client response content-encoding to gzip since the user supported it, that's what they got.");
       transaction.getClientResponse().getHeaders()["Content-Encoding"] = "gzip";
     } else {
-      TS_DEBUG(TAG,"Setting the client response content-encoding to identity since the user didn't support gzip");
+      TS_DEBUG(TAG, "Setting the client response content-encoding to identity since the user didn't support gzip");
       transaction.getClientResponse().getHeaders()["Content-Encoding"] = "identity";
     }
     transaction.resume();
   }
-
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   TS_DEBUG(TAG, "TSPluginInit");
   new GlobalHookPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc
index 8d32502..e7a4399 100644
--- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc
+++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc
@@ -21,16 +21,15 @@
 #include <atscppapi/GlobalPlugin.h>
 #include <atscppapi/PluginInit.h>
 
-class HelloWorldPlugin : public atscppapi::GlobalPlugin {
+class HelloWorldPlugin : public atscppapi::GlobalPlugin
+{
 public:
-  HelloWorldPlugin() {
-    std::cout << "Hello World!" << std::endl;
-  }
+  HelloWorldPlugin() { std::cout << "Hello World!" << std::endl; }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   std::cout << "Hello from " << argv[0] << std::endl;
   new HelloWorldPlugin();
 }
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/intercept/intercept.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/intercept/intercept.cc b/lib/atscppapi/examples/intercept/intercept.cc
index 4cac4ae..9cb0005 100644
--- a/lib/atscppapi/examples/intercept/intercept.cc
+++ b/lib/atscppapi/examples/intercept/intercept.cc
@@ -27,46 +27,56 @@ using std::string;
 using std::cout;
 using std::endl;
 
-class Intercept : public InterceptPlugin {
+class Intercept : public InterceptPlugin
+{
 public:
-  Intercept(Transaction &transaction) : InterceptPlugin(transaction, InterceptPlugin::SERVER_INTERCEPT) { }
+  Intercept(Transaction &transaction) : InterceptPlugin(transaction, InterceptPlugin::SERVER_INTERCEPT) {}
   void consume(const string &data, InterceptPlugin::RequestDataType type);
   void handleInputComplete();
   ~Intercept() { cout << "Shutting down" << endl; }
 };
 
-class InterceptInstaller : public GlobalPlugin {
+class InterceptInstaller : public GlobalPlugin
+{
 public:
-  InterceptInstaller() : GlobalPlugin(true /* ignore internal transactions */) {
+  InterceptInstaller() : GlobalPlugin(true /* ignore internal transactions */)
+  {
     GlobalPlugin::registerHook(Plugin::HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
   }
-  void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     transaction.addPlugin(new Intercept(transaction));
     cout << "Added intercept" << endl;
     transaction.resume();
   }
 };
 
-void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) {
+void
+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
+{
   new InterceptInstaller();
 }
 
-void Intercept::consume(const string &data, InterceptPlugin::RequestDataType type) {
+void
+Intercept::consume(const string &data, InterceptPlugin::RequestDataType type)
+{
   if (type == InterceptPlugin::REQUEST_HEADER) {
     cout << "Read request header data" << endl << data;
-  }
-  else {
+  } else {
     cout << "Read request body data" << endl << data << endl;
   }
 }
 
-void Intercept::handleInputComplete() {
+void
+Intercept::handleInputComplete()
+{
   cout << "Request data complete" << endl;
   string response("HTTP/1.1 200 OK\r\n"
                   "Content-Length: 7\r\n"
                   "\r\n");
   InterceptPlugin::produce(response);
-//  sleep(5); TODO: this is a test for streaming; currently doesn't work
+  //  sleep(5); TODO: this is a test for streaming; currently doesn't work
   response = "hello\r\n";
   InterceptPlugin::produce(response);
   InterceptPlugin::setOutputComplete();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc
index 28c7770..ee1ba07 100644
--- a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc
+++ b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc
@@ -27,38 +27,50 @@ using std::string;
 
 #define TAG "internal_transaction_handling"
 
-class AllTransactionsGlobalPlugin : public GlobalPlugin {
+class AllTransactionsGlobalPlugin : public GlobalPlugin
+{
 public:
-  AllTransactionsGlobalPlugin() : GlobalPlugin() {
+  AllTransactionsGlobalPlugin() : GlobalPlugin()
+  {
     TS_DEBUG(TAG, "Registering a global hook HOOK_READ_REQUEST_HEADERS_POST_REMAP");
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
   }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Received a request in handleReadRequestHeadersPostRemap.");
     transaction.resume();
   }
 };
 
-class NoInternalTransactionsGlobalPlugin : public GlobalPlugin, public AsyncReceiver<AsyncHttpFetch> {
+class NoInternalTransactionsGlobalPlugin : public GlobalPlugin, public AsyncReceiver<AsyncHttpFetch>
+{
 public:
-  NoInternalTransactionsGlobalPlugin() : GlobalPlugin(true) {
+  NoInternalTransactionsGlobalPlugin() : GlobalPlugin(true)
+  {
     TS_DEBUG(TAG, "Registering a global hook HOOK_READ_REQUEST_HEADERS_POST_REMAP");
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
   }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Received a request in handleReadRequestHeadersPostRemap.");
-    shared_ptr<Mutex> mutex(new Mutex()); // required for async operation
+    shared_ptr<Mutex> mutex(new Mutex());                                                 // required for async operation
     Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch("http://127.0.0.1/"), mutex); // internal transaction
     transaction.resume();
   }
 
-  void handleAsyncComplete(AsyncHttpFetch &provider ATSCPPAPI_UNUSED) {
+  void
+  handleAsyncComplete(AsyncHttpFetch &provider ATSCPPAPI_UNUSED)
+  {
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin");
   new AllTransactionsGlobalPlugin();
   new NoInternalTransactionsGlobalPlugin();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/logger_example/LoggerExample.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/logger_example/LoggerExample.cc b/lib/atscppapi/examples/logger_example/LoggerExample.cc
index c6cf32c..02f4732 100644
--- a/lib/atscppapi/examples/logger_example/LoggerExample.cc
+++ b/lib/atscppapi/examples/logger_example/LoggerExample.cc
@@ -32,7 +32,8 @@
 using namespace atscppapi;
 using std::string;
 
-namespace {
+namespace
+{
 Logger log;
 }
 
@@ -43,28 +44,31 @@ Logger log;
  * filename, function name, and line number of the message
  */
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
-    memset(big_buffer_6kb_,'a', sizeof(big_buffer_6kb_));
+  GlobalHookPlugin()
+  {
+    memset(big_buffer_6kb_, 'a', sizeof(big_buffer_6kb_));
     big_buffer_6kb_[sizeof(big_buffer_6kb_) - 1] = '\0';
 
-    memset(big_buffer_14kb_,'a', sizeof(big_buffer_14kb_));
+    memset(big_buffer_14kb_, 'a', sizeof(big_buffer_14kb_));
     big_buffer_14kb_[sizeof(big_buffer_14kb_) - 1] = '\0';
 
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
   }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     LOG_DEBUG(log, "handleReadRequestHeadersPostRemap.\n"
-        "\tRequest URL: %s\n"
-        "\tRequest Path: %s\n"
-        "\tRequest Query: %s\n"
-        "\tRequest Method: %s", transaction.getClientRequest().getUrl().getUrlString().c_str(),
-                                transaction.getClientRequest().getUrl().getPath().c_str(),
-                                transaction.getClientRequest().getUrl().getQuery().c_str(),
-                                HTTP_METHOD_STRINGS[transaction.getClientRequest().getMethod()].c_str()
-                               );
+                   "\tRequest URL: %s\n"
+                   "\tRequest Path: %s\n"
+                   "\tRequest Query: %s\n"
+                   "\tRequest Method: %s",
+              transaction.getClientRequest().getUrl().getUrlString().c_str(),
+              transaction.getClientRequest().getUrl().getPath().c_str(), transaction.getClientRequest().getUrl().getQuery().c_str(),
+              HTTP_METHOD_STRINGS[transaction.getClientRequest().getMethod()].c_str());
 
     // Next, to demonstrate how you can change logging levels:
     if (transaction.getClientRequest().getUrl().getPath() == "change_log_level") {
@@ -89,12 +93,15 @@ public:
 
     transaction.resume();
   }
+
 private:
-  char big_buffer_6kb_[6*1024];
-  char big_buffer_14kb_[14*1024];
+  char big_buffer_6kb_[6 * 1024];
+  char big_buffer_14kb_[14 * 1024];
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   // Create a new logger
   // This will create a log file with the name logger_example.log (since we left off
   //    the extension it will automatically add .log)
@@ -111,7 +118,7 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED
   log.init("logger_example", true, true, Logger::LOG_LEVEL_DEBUG, true, 300);
 
   // Now that we've initialized a logger we can do all kinds of fun things on it:
-  log.setRollingEnabled(true); // already done via log.init, just an example.
+  log.setRollingEnabled(true);        // already done via log.init, just an example.
   log.setRollingIntervalSeconds(300); // already done via log.init
 
   // You have two ways to log to a logger, you can log directly on the object itself:
@@ -129,4 +136,3 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED
 
   new GlobalHookPlugin();
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
index ca1dbe7..d1c2e40 100644
--- a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
+++ b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
@@ -25,63 +25,70 @@
 
 using namespace atscppapi;
 
-class MultipleTransactionHookPluginsOne : public atscppapi::TransactionPlugin {
+class MultipleTransactionHookPluginsOne : public atscppapi::TransactionPlugin
+{
 public:
-  MultipleTransactionHookPluginsOne(Transaction &transaction) : TransactionPlugin(transaction) {
+  MultipleTransactionHookPluginsOne(Transaction &transaction) : TransactionPlugin(transaction)
+  {
     TransactionPlugin::registerHook(HOOK_SEND_RESPONSE_HEADERS);
     std::cout << "Constructed MultipleTransactionHookPluginsOne!" << std::endl;
   }
 
-  virtual ~MultipleTransactionHookPluginsOne() {
-    std::cout << "Destroyed MultipleTransactionHookPluginsOne!" << std::endl;
-  }
+  virtual ~MultipleTransactionHookPluginsOne() { std::cout << "Destroyed MultipleTransactionHookPluginsOne!" << std::endl; }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     std::cerr << "MultipleTransactionHookPluginsOne -- Send response headers!" << std::endl;
     transaction.resume();
   }
 };
 
-class MultipleTransactionHookPluginsTwo : public atscppapi::TransactionPlugin {
+class MultipleTransactionHookPluginsTwo : public atscppapi::TransactionPlugin
+{
 public:
-  MultipleTransactionHookPluginsTwo(Transaction &transaction) : TransactionPlugin(transaction) {
+  MultipleTransactionHookPluginsTwo(Transaction &transaction) : TransactionPlugin(transaction)
+  {
     TransactionPlugin::registerHook(HOOK_SEND_REQUEST_HEADERS);
     TransactionPlugin::registerHook(HOOK_SEND_RESPONSE_HEADERS);
     std::cout << "Constructed MultipleTransactionHookPluginsTwo!" << std::endl;
   }
 
-  virtual ~MultipleTransactionHookPluginsTwo() {
-    std::cout << "Destroyed MultipleTransactionHookPluginsTwo!" << std::endl;
-  }
+  virtual ~MultipleTransactionHookPluginsTwo() { std::cout << "Destroyed MultipleTransactionHookPluginsTwo!" << std::endl; }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
+  void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
     std::cout << "MultipleTransactionHookPluginsTwo -- Send request headers!" << std::endl;
     some_container_.push_back("We have transaction scoped storage in Transaction Hooks!");
     transaction.resume();
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
-     std::cout << "MultipleTransactionHookPluginsTwo -- Send response headers!" << std::endl;
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
+    std::cout << "MultipleTransactionHookPluginsTwo -- Send response headers!" << std::endl;
 
-     // Demonstrate the concept of transaction scoped storage.
-     if(some_container_.size()) {
-       std::cout << some_container_.back() << std::endl;
-     }
+    // Demonstrate the concept of transaction scoped storage.
+    if (some_container_.size()) {
+      std::cout << some_container_.back() << std::endl;
+    }
 
-     transaction.resume();
-   }
+    transaction.resume();
+  }
 
 private:
   std::vector<std::string> some_container_;
 };
 
-class GlobalHookPlugin : public atscppapi::GlobalPlugin {
+class GlobalHookPlugin : public atscppapi::GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
-    GlobalPlugin::registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
-  }
+  GlobalHookPlugin() { GlobalPlugin::registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); }
 
-  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl;
 
     // We need not store the addresses of the transaction plugins
@@ -95,6 +102,8 @@ public:
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new GlobalHookPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
index 445188e..fa6e710 100644
--- a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
+++ b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
@@ -26,62 +26,79 @@
 using namespace atscppapi;
 using std::string;
 
-namespace {
+namespace
+{
 #define TAG "null_transformation"
 }
 
-class NullTransformationPlugin : public TransformationPlugin {
+class NullTransformationPlugin : public TransformationPlugin
+{
 public:
   NullTransformationPlugin(Transaction &transaction, TransformationPlugin::Type xformType)
-    : TransformationPlugin(transaction, xformType) {
-    registerHook((xformType == TransformationPlugin::REQUEST_TRANSFORMATION) ?
-                 HOOK_SEND_REQUEST_HEADERS : HOOK_SEND_RESPONSE_HEADERS);
+    : TransformationPlugin(transaction, xformType)
+  {
+    registerHook((xformType == TransformationPlugin::REQUEST_TRANSFORMATION) ? HOOK_SEND_REQUEST_HEADERS :
+                                                                               HOOK_SEND_RESPONSE_HEADERS);
   }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
+  void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
     transaction.getServerRequest().getHeaders()["X-Content-Transformed"] = "1";
     transaction.resume();
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     transaction.getClientResponse().getHeaders()["X-Content-Transformed"] = "1";
     transaction.resume();
   }
 
-  void consume(const string &data) {
+  void
+  consume(const string &data)
+  {
     produce(data);
   }
 
-  void handleInputComplete() {
+  void
+  handleInputComplete()
+  {
     setOutputComplete();
   }
 
-  virtual ~NullTransformationPlugin() {
-
-  }
+  virtual ~NullTransformationPlugin() {}
 
 private:
 };
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
+  GlobalHookPlugin()
+  {
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
     registerHook(HOOK_READ_RESPONSE_HEADERS);
   }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     transaction.addPlugin(new NullTransformationPlugin(transaction, TransformationPlugin::REQUEST_TRANSFORMATION));
     transaction.resume();
   }
 
-  virtual void handleReadResponseHeaders(Transaction &transaction) {
+  virtual void
+  handleReadResponseHeaders(Transaction &transaction)
+  {
     transaction.addPlugin(new NullTransformationPlugin(transaction, TransformationPlugin::RESPONSE_TRANSFORMATION));
     transaction.resume();
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   TS_DEBUG(TAG, "TSPluginInit");
   new GlobalHookPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/post_buffer/PostBuffer.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/post_buffer/PostBuffer.cc b/lib/atscppapi/examples/post_buffer/PostBuffer.cc
index a360788..85131de 100644
--- a/lib/atscppapi/examples/post_buffer/PostBuffer.cc
+++ b/lib/atscppapi/examples/post_buffer/PostBuffer.cc
@@ -28,37 +28,44 @@ using std::cerr;
 using std::endl;
 using std::string;
 
-class PostBufferTransformationPlugin : public TransformationPlugin {
+class PostBufferTransformationPlugin : public TransformationPlugin
+{
 public:
   PostBufferTransformationPlugin(Transaction &transaction)
-    : TransformationPlugin(transaction, REQUEST_TRANSFORMATION), transaction_(transaction) {
+    : TransformationPlugin(transaction, REQUEST_TRANSFORMATION), transaction_(transaction)
+  {
     buffer_.reserve(1024); // not required, this is an optimization to start the buffer at a slightly higher value.
     (void)transaction_;
   }
 
-  void consume(const string &data) {
+  void
+  consume(const string &data)
+  {
     buffer_.append(data);
   }
 
-  void handleInputComplete() {
+  void
+  handleInputComplete()
+  {
     produce(buffer_);
     setOutputComplete();
   }
 
-  virtual ~PostBufferTransformationPlugin() { }
+  virtual ~PostBufferTransformationPlugin() {}
 
 private:
   Transaction &transaction_;
   string buffer_;
 };
 
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
-    registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
-  }
+  GlobalHookPlugin() { registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP); }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     cerr << "Read Request Headers Post Remap" << endl;
     cerr << "Path: " << transaction.getClientRequest().getUrl().getPath() << endl;
     cerr << "Method: " << HTTP_METHOD_STRINGS[transaction.getClientRequest().getMethod()] << endl;
@@ -70,6 +77,8 @@ public:
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new GlobalHookPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc
index bb0a246..cd83117 100644
--- a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc
+++ b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc
@@ -29,11 +29,14 @@ using namespace atscppapi;
 
 #define LOG_TAG "remapplugin"
 
-class MyRemapPlugin : public RemapPlugin {
+class MyRemapPlugin : public RemapPlugin
+{
 public:
-  MyRemapPlugin(void **instance_handle) : RemapPlugin(instance_handle) { }
+  MyRemapPlugin(void **instance_handle) : RemapPlugin(instance_handle) {}
 
-  Result doRemap(const Url &map_from_url, const Url &map_to_url, Transaction &transaction, bool &redirect) {
+  Result
+  doRemap(const Url &map_from_url, const Url &map_to_url, Transaction &transaction, bool &redirect)
+  {
     Url &request_url = transaction.getClientRequest().getUrl();
     TS_DEBUG(LOG_TAG, "from URL is [%s], to URL is [%s], request URL is [%s]", map_from_url.getUrlString().c_str(),
              map_to_url.getUrlString().c_str(), request_url.getUrlString().c_str());
@@ -81,7 +84,10 @@ public:
   }
 };
 
-TsReturnCode TSRemapNewInstance(int argc ATSCPPAPI_UNUSED, char *argv[] ATSCPPAPI_UNUSED, void **instance_handle, char *errbuf ATSCPPAPI_UNUSED, int errbuf_size ATSCPPAPI_UNUSED) {
+TsReturnCode
+TSRemapNewInstance(int argc ATSCPPAPI_UNUSED, char *argv[] ATSCPPAPI_UNUSED, void **instance_handle, char *errbuf ATSCPPAPI_UNUSED,
+                   int errbuf_size ATSCPPAPI_UNUSED)
+{
   new MyRemapPlugin(instance_handle);
   return TS_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/serverresponse/ServerResponse.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/serverresponse/ServerResponse.cc b/lib/atscppapi/examples/serverresponse/ServerResponse.cc
index 01fb995..b151210 100644
--- a/lib/atscppapi/examples/serverresponse/ServerResponse.cc
+++ b/lib/atscppapi/examples/serverresponse/ServerResponse.cc
@@ -28,18 +28,22 @@ using std::endl;
 using std::list;
 using std::string;
 
-class ServerResponsePlugin : public GlobalPlugin {
+class ServerResponsePlugin : public GlobalPlugin
+{
 public:
-  ServerResponsePlugin() {
+  ServerResponsePlugin()
+  {
     registerHook(HOOK_SEND_REQUEST_HEADERS);
     registerHook(HOOK_READ_RESPONSE_HEADERS);
     registerHook(HOOK_SEND_RESPONSE_HEADERS);
   }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
+  void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
     // Here we can decide to abort the request to the origin (we can do this earlier too)
     // and just send the user an error page.
-    if(transaction.getClientRequest().getUrl().getQuery().find("error=1") != string::npos) {
+    if (transaction.getClientRequest().getUrl().getQuery().find("error=1") != string::npos) {
       // Give this user an error page and don't make a request to an origin.
       cout << "Sending this request an error page" << endl;
       transaction.error("This is the error response, but the response code is 500."
@@ -52,7 +56,9 @@ public:
     cout << transaction.getServerRequest().getHeaders() << endl;
   }
 
-  void handleReadResponseHeaders(Transaction &transaction) {
+  void
+  handleReadResponseHeaders(Transaction &transaction)
+  {
     cout << "Hello from handleReadResponseHeaders!" << endl;
     cout << "Server response headers are" << endl;
     Response &server_response = transaction.getServerResponse();
@@ -61,7 +67,9 @@ public:
     transaction.resume();
   }
 
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     cout << "Hello from handleSendResponseHeaders!" << endl;
     cout << "Client response headers are" << endl;
     transaction.getClientResponse().getHeaders()["X-Foo-Header"] = "1";
@@ -75,7 +83,7 @@ public:
     // request and prevent the origin request in the first place.
     //
 
-    if(transaction.getClientRequest().getUrl().getQuery().find("redirect=1") != string::npos) {
+    if (transaction.getClientRequest().getUrl().getQuery().find("redirect=1") != string::npos) {
       cout << "Sending this guy to google." << endl;
       transaction.getClientResponse().getHeaders().append("Location", "http://www.google.com");
       transaction.getClientResponse().setStatusCode(HTTP_STATUS_MOVED_TEMPORARILY);
@@ -87,24 +95,24 @@ public:
   }
 
 private:
-  void printHeadersManual(Headers &headers) {
-
-    for (Headers::iterator header_iter = headers.begin(), header_end = headers.end();
-         header_iter != header_end; ++header_iter) {
-
-      cout << "Header " << (*header_iter).name() <<  ": " << endl;
-
-      for (HeaderField::iterator value_iter = (*header_iter).begin(), values_end = (*header_iter).end();
-          value_iter != values_end; ++value_iter) {
+  void
+  printHeadersManual(Headers &headers)
+  {
+    for (Headers::iterator header_iter = headers.begin(), header_end = headers.end(); header_iter != header_end; ++header_iter) {
+      cout << "Header " << (*header_iter).name() << ": " << endl;
+
+      for (HeaderField::iterator value_iter = (*header_iter).begin(), values_end = (*header_iter).end(); value_iter != values_end;
+           ++value_iter) {
         cout << "\t" << *value_iter << endl;
       }
-
     }
 
     cout << endl;
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new ServerResponsePlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/stat_example/StatExample.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/stat_example/StatExample.cc b/lib/atscppapi/examples/stat_example/StatExample.cc
index 7208526..12b10cb 100644
--- a/lib/atscppapi/examples/stat_example/StatExample.cc
+++ b/lib/atscppapi/examples/stat_example/StatExample.cc
@@ -26,7 +26,8 @@
 using namespace atscppapi;
 using std::string;
 
-namespace {
+namespace
+{
 // This is for the -T tag debugging
 // To view the debug messages ./traffic_server -T "stat_example.*"
 #define TAG "stat_example"
@@ -44,14 +45,18 @@ Stat stat;
  * This is a simple plugin that will increment a counter
  * everytime a request comes in.
  */
-class GlobalHookPlugin : public GlobalPlugin {
+class GlobalHookPlugin : public GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
+  GlobalHookPlugin()
+  {
     TS_DEBUG(TAG, "Registering a global hook HOOK_READ_REQUEST_HEADERS_POST_REMAP");
     registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
   }
 
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Received a request, incrementing the counter.");
     stat.increment();
     TS_DEBUG(TAG, "Stat '%s' value = %lld", STAT_NAME.c_str(), static_cast<long long>(stat.get()));
@@ -59,7 +64,9 @@ public:
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   TS_DEBUG(TAG, "Loaded stat_example plugin");
 
   // Since this stat is not persistent it will be initialized to 0.
@@ -68,4 +75,3 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED
 
   new GlobalHookPlugin();
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc
index b50bf5a..63c4b78 100644
--- a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc
+++ b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc
@@ -26,19 +26,25 @@ using namespace atscppapi;
 
 #define TAG "timeout_example_plugin"
 
-class TimeoutExamplePlugin : public GlobalPlugin {
+class TimeoutExamplePlugin : public GlobalPlugin
+{
 public:
-  TimeoutExamplePlugin() {
+  TimeoutExamplePlugin()
+  {
     registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
     registerHook(HOOK_SEND_RESPONSE_HEADERS);
   }
 
-  virtual void handleSendResponseHeaders(Transaction &transaction) {
+  virtual void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Sending response headers to the client, status=%d", transaction.getClientResponse().getStatusCode());
     transaction.resume();
   }
 
-  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  virtual void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     TS_DEBUG(TAG, "Setting all timeouts to 1ms, this will likely cause the transaction to receive a 504.");
     transaction.setTimeout(Transaction::TIMEOUT_CONNECT, 1);
     transaction.setTimeout(Transaction::TIMEOUT_ACTIVE, 1);
@@ -48,7 +54,9 @@ public:
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   TS_DEBUG(TAG, "TSPluginInit");
   new TimeoutExamplePlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc
index 41d6eff..22adadf 100644
--- a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc
+++ b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc
@@ -24,37 +24,46 @@
 
 using namespace atscppapi;
 
-class TransactionHookPlugin : public atscppapi::TransactionPlugin {
+class TransactionHookPlugin : public atscppapi::TransactionPlugin
+{
 public:
-  TransactionHookPlugin(Transaction &transaction) : TransactionPlugin(transaction) {
+  TransactionHookPlugin(Transaction &transaction) : TransactionPlugin(transaction)
+  {
     char_ptr_ = new char[100];
     TransactionPlugin::registerHook(HOOK_SEND_RESPONSE_HEADERS);
     std::cout << "Constructed!" << std::endl;
   }
-  virtual ~TransactionHookPlugin() {
+  virtual ~TransactionHookPlugin()
+  {
     delete[] char_ptr_; // cleanup
     std::cout << "Destroyed!" << std::endl;
   }
-  void handleSendResponseHeaders(Transaction &transaction) {
+  void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
     std::cout << "Send response headers!" << std::endl;
     transaction.resume();
   }
+
 private:
   char *char_ptr_;
 };
 
-class GlobalHookPlugin : public atscppapi::GlobalPlugin {
+class GlobalHookPlugin : public atscppapi::GlobalPlugin
+{
 public:
-  GlobalHookPlugin() {
-    GlobalPlugin::registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
-  }
-  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+  GlobalHookPlugin() { GlobalPlugin::registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); }
+  virtual void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
     std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl;
     transaction.addPlugin(new TransactionHookPlugin(transaction));
     transaction.resume();
   }
 };
 
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
+void
+TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
+{
   new GlobalHookPlugin();
 }


[32/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/SplitDNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc
index c0c9f79..bb2bcdb 100644
--- a/iocore/dns/SplitDNS.cc
+++ b/iocore/dns/SplitDNS.cc
@@ -46,7 +46,7 @@
    -------------------------------------------------------------- */
 static const char modulePrefix[] = "[SplitDNS]";
 
-static ConfigUpdateHandler<SplitDNSConfig> * splitDNSUpdate;
+static ConfigUpdateHandler<SplitDNSConfig> *splitDNSUpdate;
 
 static ClassAllocator<DNSRequestData> DNSReqAllocator("DNSRequestDataAllocator");
 
@@ -54,26 +54,19 @@ static ClassAllocator<DNSRequestData> DNSReqAllocator("DNSRequestDataAllocator")
    used by a lot of protocols. We do not have dest ip in most
    cases.
    -------------------------------------------------------------- */
-const matcher_tags sdns_dest_tags = {
-  "dest_host", "dest_domain", NULL, "url_regex", "url", NULL, true
-};
+const matcher_tags sdns_dest_tags = {"dest_host", "dest_domain", NULL, "url_regex", "url", NULL, true};
 
 
 /* --------------------------------------------------------------
    config Callback Prototypes
    -------------------------------------------------------------- */
-enum SplitDNSCB_t
-{
+enum SplitDNSCB_t {
   SDNS_FILE_CB,
-  SDNS_ENABLE_CB
+  SDNS_ENABLE_CB,
 };
 
 
-static const char *SDNSResultStr[] = {
-  "DNSServer_Undefined",
-  "DNSServer_Specified",
-  "DNSServer_Failed"
-};
+static const char *SDNSResultStr[] = {"DNSServer_Undefined", "DNSServer_Specified", "DNSServer_Failed"};
 
 
 int SplitDNSConfig::m_id = 0;
@@ -85,8 +78,7 @@ Ptr<ProxyMutex> SplitDNSConfig::dnsHandler_mutex;
 /* --------------------------------------------------------------
    SplitDNSResult::SplitDNSResult()
    -------------------------------------------------------------- */
-inline SplitDNSResult::SplitDNSResult()
-  : r(DNS_SRVR_UNDEFINED), m_line_number(0), m_rec(0), m_wrap_around(false)
+inline SplitDNSResult::SplitDNSResult() : r(DNS_SRVR_UNDEFINED), m_line_number(0), m_rec(0), m_wrap_around(false)
 {
 }
 
@@ -94,9 +86,7 @@ inline SplitDNSResult::SplitDNSResult()
 /* --------------------------------------------------------------
    SplitDNS::SplitDNS()
    -------------------------------------------------------------- */
-SplitDNS::SplitDNS()
-: m_DNSSrvrTable(NULL), m_SplitDNSlEnable(0),
-  m_bEnableFastPath(false), m_pxLeafArray(NULL), m_numEle(0)
+SplitDNS::SplitDNS() : m_DNSSrvrTable(NULL), m_SplitDNSlEnable(0), m_bEnableFastPath(false), m_pxLeafArray(NULL), m_numEle(0)
 {
 }
 
@@ -115,7 +105,7 @@ SplitDNS::~SplitDNS()
 SplitDNS *
 SplitDNSConfig::acquire()
 {
-  return (SplitDNS *) configProcessor.get(SplitDNSConfig::m_id);
+  return (SplitDNS *)configProcessor.get(SplitDNSConfig::m_id);
 }
 
 
@@ -123,7 +113,7 @@ SplitDNSConfig::acquire()
    SplitDNSConfig::release()
    -------------------------------------------------------------- */
 void
-SplitDNSConfig::release(SplitDNS * params)
+SplitDNSConfig::release(SplitDNS *params)
 {
   configProcessor.release(SplitDNSConfig::m_id, params);
 }
@@ -137,7 +127,7 @@ SplitDNSConfig::startup()
 {
   dnsHandler_mutex = new_ProxyMutex();
 
-  //startup just check gsplit_dns_enabled
+  // startup just check gsplit_dns_enabled
   REC_ReadConfigInt32(gsplit_dns_enabled, "proxy.config.dns.splitDNS.enabled");
   splitDNSUpdate = new ConfigUpdateHandler<SplitDNSConfig>();
   splitDNSUpdate->attach("proxy.config.cache.splitdns.filename");
@@ -166,12 +156,10 @@ SplitDNSConfig::reconfigure()
     return;
   }
 
-  if (0 != params->m_DNSSrvrTable->getHostMatcher() &&
-      0 == params->m_DNSSrvrTable->getReMatcher() &&
+  if (0 != params->m_DNSSrvrTable->getHostMatcher() && 0 == params->m_DNSSrvrTable->getReMatcher() &&
       0 == params->m_DNSSrvrTable->getIPMatcher() && 4 >= params->m_numEle) {
-
     HostLookup *pxHL = params->m_DNSSrvrTable->getHostMatcher()->getHLookup();
-    params->m_pxLeafArray = (void *) pxHL->getLArray();
+    params->m_pxLeafArray = (void *)pxHL->getLArray();
     params->m_bEnableFastPath = true;
   }
 
@@ -216,7 +204,7 @@ SplitDNS::getDNSRecord(const char *hostname)
   DNSReqAllocator.free(pRD);
 
   if (DNS_SRVR_SPECIFIED == res.r) {
-    return (void *) &(res.m_rec->m_servers);
+    return (void *)&(res.m_rec->m_servers);
   }
 
   Debug("splitdns", "Fail to match a valid splitdns rule, fallback to default dns resolver");
@@ -228,7 +216,7 @@ SplitDNS::getDNSRecord(const char *hostname)
    SplitDNS::findServer()
    -------------------------------------------------------------- */
 void
-SplitDNS::findServer(RequestData * rdata, SplitDNSResult * result)
+SplitDNS::findServer(RequestData *rdata, SplitDNSResult *result)
 {
   DNS_table *tablePtr = m_DNSSrvrTable;
   SplitDNSRecord *rec;
@@ -249,14 +237,14 @@ SplitDNS::findServer(RequestData * rdata, SplitDNSResult * result)
      --------------------------- */
   if (m_bEnableFastPath) {
     SplitDNSRecord *data_ptr = 0;
-    char *pHost = (char *) rdata->get_host();
+    char *pHost = (char *)rdata->get_host();
     if (0 == pHost) {
       Warning("SplitDNS: No host to match !");
       return;
     }
 
     int len = strlen(pHost);
-    HostLeaf *pxHL = (HostLeaf *) m_pxLeafArray;
+    HostLeaf *pxHL = (HostLeaf *)m_pxLeafArray;
     for (int i = 0; i < m_numEle; i++) {
       if (0 == pxHL)
         break;
@@ -266,7 +254,7 @@ SplitDNS::findServer(RequestData * rdata, SplitDNSResult * result)
 
       int idx = len - pxHL[i].len;
       char *pH = &pHost[idx];
-      char *pMatch = (char *) pxHL[i].match;
+      char *pMatch = (char *)pxHL[i].match;
       char cNot = *pMatch;
 
       if ('!' == cNot)
@@ -275,7 +263,7 @@ SplitDNS::findServer(RequestData * rdata, SplitDNSResult * result)
       int res = memcmp(pH, pMatch, pxHL[i].len);
 
       if ((0 != res && '!' == cNot) || (0 == res && '!' != cNot)) {
-        data_ptr = (SplitDNSRecord *) pxHL[i].opaque_data;
+        data_ptr = (SplitDNSRecord *)pxHL[i].opaque_data;
         data_ptr->UpdateMatch(result, rdata);
         break;
       }
@@ -339,7 +327,7 @@ SplitDNSRecord::ProcessDNSHosts(char *val)
      ------------------------------------------------ */
   for (int i = 0; i < numTok; i++) {
     current = pTok[i];
-    tmp = (char *) strchr(current, ':');
+    tmp = (char *)strchr(current, ':');
     // coverity[secure_coding]
     if (tmp != NULL && sscanf(tmp + 1, "%d", &port) != 1) {
       return "Malformed DNS port";
@@ -351,8 +339,10 @@ SplitDNSRecord::ProcessDNSHosts(char *val)
        ---------------------------------------- */
     if (tmp) {
       char *scan = tmp + 1;
-      for (; *scan != '\0' && ParseRules::is_digit(*scan); scan++);
-      for (; *scan != '\0' && ParseRules::is_wslfcr(*scan); scan++);
+      for (; *scan != '\0' && ParseRules::is_digit(*scan); scan++)
+        ;
+      for (; *scan != '\0' && ParseRules::is_wslfcr(*scan); scan++)
+        ;
 
       if (*scan != '\0') {
         return "Garbage trailing entry or invalid separator";
@@ -456,7 +446,7 @@ SplitDNSRecord::ProcessDomainSrchList(char *val)
    of the current split.config line
    -------------------------------------------------------------- */
 config_parse_error
-SplitDNSRecord::Init(matcher_line * line_info)
+SplitDNSRecord::Init(matcher_line *line_info)
 {
   const char *errPtr = NULL;
   const char *tmp;
@@ -508,13 +498,10 @@ SplitDNSRecord::Init(matcher_line * line_info)
   ink_res_state res = new ts_imp_res_state;
 
   memset(res, 0, sizeof(ts_imp_res_state));
-  if ((-1 == ink_res_init(res, m_servers.x_server_ip, m_dnsSrvr_cnt,
-                          m_servers.x_def_domain, m_servers.x_domain_srch_list, NULL))) {
+  if ((-1 == ink_res_init(res, m_servers.x_server_ip, m_dnsSrvr_cnt, m_servers.x_def_domain, m_servers.x_domain_srch_list, NULL))) {
     char ab[INET6_ADDRPORTSTRLEN];
-    return config_parse_error(
-      "Failed to build res record for the servers %s ...",
-      ats_ip_ntop(&m_servers.x_server_ip[0].sa, ab, sizeof ab)
-    );
+    return config_parse_error("Failed to build res record for the servers %s ...",
+                              ats_ip_ntop(&m_servers.x_server_ip[0].sa, ab, sizeof ab));
   }
 
   dnsH->m_res = res;
@@ -544,11 +531,11 @@ SplitDNSRecord::Init(matcher_line * line_info)
     SplitDNSRecord::UpdateMatch()
    -------------------------------------------------------------- */
 void
-SplitDNSRecord::UpdateMatch(SplitDNSResult * result, RequestData * /* rdata ATS_UNUSED */)
+SplitDNSRecord::UpdateMatch(SplitDNSResult *result, RequestData * /* rdata ATS_UNUSED */)
 {
   int last_number = result->m_line_number;
 
-  if ((last_number<0) || (last_number> this->line_num)) {
+  if ((last_number < 0) || (last_number > this->line_num)) {
     result->m_rec = this;
     result->m_line_number = this->line_num;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/test_I_DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/test_I_DNS.cc b/iocore/dns/test_I_DNS.cc
index e1434d9..0ddcb8f 100644
--- a/iocore/dns/test_I_DNS.cc
+++ b/iocore/dns/test_I_DNS.cc
@@ -55,7 +55,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -78,19 +77,17 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -113,13 +110,13 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
+                 diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 main()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/test_P_DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/test_P_DNS.cc b/iocore/dns/test_P_DNS.cc
index 93438dd..1db0c41 100644
--- a/iocore/dns/test_P_DNS.cc
+++ b/iocore/dns/test_P_DNS.cc
@@ -24,14 +24,13 @@
 #include "P_DNS.h"
 
 Diags *diags;
-struct NetTesterSM:public Continuation
-{
+struct NetTesterSM : public Continuation {
   VIO *read_vio;
   IOBufferReader *reader;
   NetVConnection *vc;
   MIOBuffer *buf;
 
-    NetTesterSM(ProxyMutex * _mutex, NetVConnection * _vc):Continuation(_mutex)
+  NetTesterSM(ProxyMutex *_mutex, NetVConnection *_vc) : Continuation(_mutex)
   {
     MUTEX_TRY_LOCK(lock, mutex, _vc->thread);
     ink_release_assert(lock);
@@ -43,7 +42,8 @@ struct NetTesterSM:public Continuation
   }
 
 
-  int handle_read(int event, void *data)
+  int
+  handle_read(int event, void *data)
   {
     int r;
     char *str;
@@ -56,7 +56,7 @@ struct NetTesterSM:public Continuation
       fflush(stdout);
       break;
     case VC_EVENT_READ_COMPLETE:
-      /* FALLSTHROUGH */
+    /* FALLSTHROUGH */
     case VC_EVENT_EOS:
       r = reader->read_avail();
       str = new char[r + 10];
@@ -70,12 +70,9 @@ struct NetTesterSM:public Continuation
       break;
     default:
       ink_release_assert(!"unknown event");
-
     }
     return EVENT_CONT;
   }
-
-
 };
 
 main()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/IOBuffer.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/IOBuffer.cc b/iocore/eventsystem/IOBuffer.cc
index a8663ef..0c260a1 100644
--- a/iocore/eventsystem/IOBuffer.cc
+++ b/iocore/eventsystem/IOBuffer.cc
@@ -66,7 +66,7 @@ init_buffer_allocators()
 }
 
 int64_t
-MIOBuffer::remove_append(IOBufferReader * r)
+MIOBuffer::remove_append(IOBufferReader *r)
 {
   int64_t l = 0;
   while (r->block) {
@@ -88,7 +88,7 @@ MIOBuffer::remove_append(IOBufferReader * r)
 int64_t
 MIOBuffer::write(const void *abuf, int64_t alen)
 {
-  const char *buf = (const char*)abuf;
+  const char *buf = (const char *)abuf;
   int64_t len = alen;
   while (len) {
     if (!_writer)
@@ -113,14 +113,14 @@ MIOBuffer::write(const void *abuf, int64_t alen)
 
 
 #ifdef WRITE_AND_TRANSFER
-  /*
-   * Same functionality as write but for the one small difference.
-   * The space available in the last block is taken from the original
-   * and this space becomes available to the copy.
-   *
-   */
+/*
+ * Same functionality as write but for the one small difference.
+ * The space available in the last block is taken from the original
+ * and this space becomes available to the copy.
+ *
+ */
 int64_t
-MIOBuffer::write_and_transfer_left_over_space(IOBufferReader * r, int64_t alen, int64_t offset)
+MIOBuffer::write_and_transfer_left_over_space(IOBufferReader *r, int64_t alen, int64_t offset)
 {
   int64_t rval = write(r, alen, offset);
   // reset the end markers of the original so that it cannot
@@ -139,7 +139,7 @@ MIOBuffer::write_and_transfer_left_over_space(IOBufferReader * r, int64_t alen,
 
 
 int64_t
-MIOBuffer::write(IOBufferReader * r, int64_t alen, int64_t offset)
+MIOBuffer::write(IOBufferReader *r, int64_t alen, int64_t offset)
 {
   int64_t len = alen;
   IOBufferBlock *b = r->block;
@@ -154,7 +154,7 @@ MIOBuffer::write(IOBufferReader * r, int64_t alen, int64_t offset)
       continue;
     }
     int64_t bytes;
-    if (len<0 || len>= max_bytes)
+    if (len < 0 || len >= max_bytes)
       bytes = max_bytes;
     else
       bytes = len;
@@ -178,8 +178,8 @@ MIOBuffer::puts(char *s, int64_t len)
     if (len-- <= 0)
       return -1;
     if (!*pb || *pb == '\n') {
-      int64_t n = (int64_t) (pb - s);
-      memcpy(end(), s, n + 1);  // Upto and including '\n'
+      int64_t n = (int64_t)(pb - s);
+      memcpy(end(), s, n + 1); // Upto and including '\n'
       end()[n + 1] = 0;
       fill(n + 1);
       return n + 1;
@@ -193,7 +193,7 @@ MIOBuffer::puts(char *s, int64_t len)
 int64_t
 IOBufferReader::read(void *ab, int64_t len)
 {
-  char *b = (char*)ab;
+  char *b = (char *)ab;
   int64_t max_bytes = read_avail();
   int64_t bytes = len <= max_bytes ? len : max_bytes;
   int64_t n = bytes;
@@ -227,14 +227,14 @@ IOBufferReader::memchr(char c, int64_t len, int64_t offset)
       continue;
     }
     int64_t bytes;
-    if (len<0 || len>= max_bytes)
+    if (len < 0 || len >= max_bytes)
       bytes = max_bytes;
     else
       bytes = len;
     char *s = b->start() + offset;
-    char *p = (char *) ::memchr(s, c, bytes);
+    char *p = (char *)::memchr(s, c, bytes);
     if (p)
-      return (int64_t) (o - start_offset + p - s);
+      return (int64_t)(o - start_offset + p - s);
     o += bytes;
     len -= bytes;
     b = b->next;
@@ -247,7 +247,7 @@ IOBufferReader::memchr(char c, int64_t len, int64_t offset)
 char *
 IOBufferReader::memcpy(const void *ap, int64_t len, int64_t offset)
 {
-  char *p = (char*)ap;
+  char *p = (char *)ap;
   IOBufferBlock *b = block;
   offset += start_offset;
 
@@ -260,7 +260,7 @@ IOBufferReader::memcpy(const void *ap, int64_t len, int64_t offset)
       continue;
     }
     int64_t bytes;
-    if (len<0 || len>= max_bytes)
+    if (len < 0 || len >= max_bytes)
       bytes = max_bytes;
     else
       bytes = len;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Action.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Action.h b/iocore/eventsystem/I_Action.h
index 8f256a8..f59fe3b 100644
--- a/iocore/eventsystem/I_Action.h
+++ b/iocore/eventsystem/I_Action.h
@@ -87,9 +87,7 @@
 */
 class Action
 {
-
 public:
-
   /**
     Contination that initiated this action.
 
@@ -99,7 +97,7 @@ public:
     directly by the state machine.
 
   */
-  Continuation * continuation;
+  Continuation *continuation;
 
 
   /**
@@ -136,7 +134,9 @@ public:
     @param c Continuation associated with this Action.
 
   */
-  virtual void cancel(Continuation * c = NULL) {
+  virtual void
+  cancel(Continuation *c = NULL)
+  {
     ink_assert(!c || c == continuation);
 #ifdef DEBUG
     ink_assert(!cancelled);
@@ -158,7 +158,9 @@ public:
     @param c Continuation associated with this Action.
 
   */
-  void cancel_action(Continuation * c = NULL) {
+  void
+  cancel_action(Continuation *c = NULL)
+  {
     ink_assert(!c || c == continuation);
 #ifdef DEBUG
     ink_assert(!cancelled);
@@ -169,7 +171,7 @@ public:
 #endif
   }
 
-  Continuation *operator =(Continuation * acont)
+  Continuation *operator=(Continuation *acont)
   {
     continuation = acont;
     if (acont)
@@ -185,29 +187,27 @@ public:
     Continuation.
 
   */
-Action():continuation(NULL), cancelled(false) {
-  }
+  Action() : continuation(NULL), cancelled(false) {}
 
 #if defined(__GNUC__)
-  virtual ~ Action() {
-  }
+  virtual ~Action() {}
 #endif
 };
 
-#define ACTION_RESULT_NONE           MAKE_ACTION_RESULT(0)
-#define ACTION_RESULT_DONE           MAKE_ACTION_RESULT(1)
-#define ACTION_IO_ERROR              MAKE_ACTION_RESULT(2)
-#define ACTION_RESULT_INLINE         MAKE_ACTION_RESULT(3)
+#define ACTION_RESULT_NONE MAKE_ACTION_RESULT(0)
+#define ACTION_RESULT_DONE MAKE_ACTION_RESULT(1)
+#define ACTION_IO_ERROR MAKE_ACTION_RESULT(2)
+#define ACTION_RESULT_INLINE MAKE_ACTION_RESULT(3)
 
 // Use these classes by
 // #define ACTION_RESULT_HOST_DB_OFFLINE
 //   MAKE_ACTION_RESULT(ACTION_RESULT_HOST_DB_BASE + 0)
 
-#define MAKE_ACTION_RESULT(_x) (Action*)(((uintptr_t)((_x<<1)+1)))
+#define MAKE_ACTION_RESULT(_x) (Action *)(((uintptr_t)((_x << 1) + 1)))
 
 #define ACTION_RESULT(_x) \
   (int)((((uintptr_t)_x)&1)!=0?(((uintptr_t)>>1):(uintptr_t)0))
 
-#define IS_ACTION_RESULT(_x) ((((uintptr_t)_x)&1) != 0)
+#define IS_ACTION_RESULT(_x) ((((uintptr_t)_x) & 1) != 0)
 
 #endif /*_Action_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Continuation.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Continuation.h b/iocore/eventsystem/I_Continuation.h
index 1de095b..b2011c4 100644
--- a/iocore/eventsystem/I_Continuation.h
+++ b/iocore/eventsystem/I_Continuation.h
@@ -51,19 +51,17 @@ class EThread;
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#define CONTINUATION_EVENT_NONE      0
+#define CONTINUATION_EVENT_NONE 0
 
-#define CONTINUATION_DONE            0
-#define CONTINUATION_CONT            1
+#define CONTINUATION_DONE 0
+#define CONTINUATION_CONT 1
 
-typedef int (Continuation::*ContinuationHandler) (int event, void *data);
+typedef int (Continuation::*ContinuationHandler)(int event, void *data);
 
 class force_VFPT_to_top
 {
 public:
-  virtual ~force_VFPT_to_top()
-  {
-  }
+  virtual ~force_VFPT_to_top() {}
 };
 
 /**
@@ -91,10 +89,9 @@ public:
 
 */
 
-class Continuation: private force_VFPT_to_top
+class Continuation : private force_VFPT_to_top
 {
 public:
-
   /**
     The current continuation handler function.
 
@@ -142,8 +139,10 @@ public:
     @return State machine and processor specific return code.
 
   */
-  int handleEvent(int event = CONTINUATION_EVENT_NONE, void *data = 0) {
-    return (this->*handler) (event, data);
+  int
+  handleEvent(int event = CONTINUATION_EVENT_NONE, void *data = 0)
+  {
+    return (this->*handler)(event, data);
   }
 
   /**
@@ -153,7 +152,7 @@ public:
     @param amutex Lock to be set for this Continuation.
 
   */
-  Continuation(ProxyMutex * amutex = NULL);
+  Continuation(ProxyMutex *amutex = NULL);
 };
 
 /**
@@ -164,11 +163,9 @@ public:
 
 */
 #ifdef DEBUG
-#define SET_HANDLER(_h) \
-  (handler = ((ContinuationHandler)_h),handler_name = #_h)
+#define SET_HANDLER(_h) (handler = ((ContinuationHandler)_h), handler_name = #_h)
 #else
-#define SET_HANDLER(_h) \
-  (handler = ((ContinuationHandler)_h))
+#define SET_HANDLER(_h) (handler = ((ContinuationHandler)_h))
 #endif
 
 /**
@@ -181,20 +178,18 @@ public:
 
 */
 #ifdef DEBUG
-#define SET_CONTINUATION_HANDLER(_c,_h) \
-  (_c->handler = ((ContinuationHandler) _h),_c->handler_name = #_h)
+#define SET_CONTINUATION_HANDLER(_c, _h) (_c->handler = ((ContinuationHandler)_h), _c->handler_name = #_h)
 #else
-#define SET_CONTINUATION_HANDLER(_c,_h) \
-  (_c->handler = ((ContinuationHandler) _h))
+#define SET_CONTINUATION_HANDLER(_c, _h) (_c->handler = ((ContinuationHandler)_h))
 #endif
 
-inline
-Continuation::Continuation(ProxyMutex * amutex)
+inline Continuation::Continuation(ProxyMutex *amutex)
   : handler(NULL),
 #ifdef DEBUG
     handler_name(NULL),
 #endif
-             mutex(amutex)
-{ }
+    mutex(amutex)
+{
+}
 
 #endif /*_Continuation_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_EThread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h
index 1aca68d..0548ef4 100644
--- a/iocore/eventsystem/I_EThread.h
+++ b/iocore/eventsystem/I_EThread.h
@@ -32,7 +32,7 @@
 
 // TODO: This would be much nicer to have "run-time" configurable (or something),
 // perhaps based on proxy.config.stat_api.max_stats_allowed or other configs. XXX
-#define PER_THREAD_DATA (1024*1024)
+#define PER_THREAD_DATA (1024 * 1024)
 
 // This is not used by the cache anymore, it uses proxy.config.cache.mutex_retry_delay
 // instead.
@@ -51,7 +51,7 @@ class Continuation;
 enum ThreadType {
   REGULAR = 0,
   MONITOR,
-  DEDICATED
+  DEDICATED,
 };
 
 
@@ -84,7 +84,7 @@ enum ThreadType {
   @see Event
 
 */
-class EThread: public Thread
+class EThread : public Thread
 {
 public:
   /*-------------------------------------------------------*\
@@ -130,8 +130,7 @@ public:
       of this callback.
 
   */
-  Event *schedule_at(Continuation *c,
-                     ink_hrtime atimeout_at, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_at(Continuation *c, ink_hrtime atimeout_at, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
 
   /**
     Schedules the continuation on this EThread to receive an event
@@ -151,8 +150,7 @@ public:
       of this callback.
 
   */
-  Event *schedule_in(Continuation *c,
-                     ink_hrtime atimeout_in, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_in(Continuation *c, ink_hrtime atimeout_in, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
 
   /**
     Schedules the continuation on this EThread to receive an event
@@ -212,8 +210,7 @@ public:
       of this callback.
 
   */
-  Event *schedule_at_local(Continuation *c,
-                           ink_hrtime atimeout_at, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_at_local(Continuation *c, ink_hrtime atimeout_at, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
 
   /**
     Schedules the continuation on this EThread to receive an event
@@ -234,8 +231,7 @@ public:
       of this callback.
 
   */
-  Event *schedule_in_local(Continuation *c,
-                           ink_hrtime atimeout_in, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_in_local(Continuation *c, ink_hrtime atimeout_in, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
 
   /**
     Schedules the continuation on this EThread to receive an event
@@ -255,8 +251,7 @@ public:
       of this callback.
 
   */
-  Event *schedule_every_local(Continuation *c,
-                              ink_hrtime aperiod, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_every_local(Continuation *c, ink_hrtime aperiod, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
 
   /* private */
 
@@ -267,7 +262,7 @@ public:
 private:
   // prevent unauthorized copies (Not implemented)
   EThread(const EThread &);
-  EThread & operator =(const EThread &);
+  EThread &operator=(const EThread &);
 
   /*-------------------------------------------------------*\
   |  UNIX Interface                                         |
@@ -320,9 +315,9 @@ public:
   EventIO *ep;
 
   ThreadType tt;
-  Event *oneevent;              // For dedicated event thread
+  Event *oneevent; // For dedicated event thread
 
-  ServerSessionPool* server_session_pool;
+  ServerSessionPool *server_session_pool;
 };
 
 /**
@@ -334,12 +329,11 @@ class ink_dummy_for_new
 {
 };
 
-inline void *operator
-new(size_t, ink_dummy_for_new *p)
+inline void *operator new(size_t, ink_dummy_for_new *p)
 {
-  return (void *) p;
+  return (void *)p;
 }
-#define ETHREAD_GET_PTR(thread, offset) ((void*)((char*)(thread)+(offset)))
+#define ETHREAD_GET_PTR(thread, offset) ((void *)((char *)(thread) + (offset)))
 
 extern EThread *this_ethread();
 #endif /*_EThread_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Event.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Event.h b/iocore/eventsystem/I_Event.h
index 356a691..05d6ee2 100644
--- a/iocore/eventsystem/I_Event.h
+++ b/iocore/eventsystem/I_Event.h
@@ -32,67 +32,67 @@
 //  Defines
 //
 
-#define MAX_EVENTS_PER_THREAD     100000
+#define MAX_EVENTS_PER_THREAD 100000
 
 // Events
 
-#define EVENT_NONE                CONTINUATION_EVENT_NONE       // 0
-#define EVENT_IMMEDIATE           1
-#define EVENT_INTERVAL            2
-#define EVENT_ERROR               3
-#define EVENT_CALL                4     // used internally in state machines
-#define EVENT_POLL                5     // negative event; activated on poll or epoll
+#define EVENT_NONE CONTINUATION_EVENT_NONE // 0
+#define EVENT_IMMEDIATE 1
+#define EVENT_INTERVAL 2
+#define EVENT_ERROR 3
+#define EVENT_CALL 4 // used internally in state machines
+#define EVENT_POLL 5 // negative event; activated on poll or epoll
 
 // Event callback return functions
 
-#define EVENT_DONE                CONTINUATION_DONE     // 0
-#define EVENT_CONT                CONTINUATION_CONT     // 1
-#define EVENT_RETURN              5
-#define EVENT_RESTART             6
-#define EVENT_RESTART_DELAYED     7
+#define EVENT_DONE CONTINUATION_DONE // 0
+#define EVENT_CONT CONTINUATION_CONT // 1
+#define EVENT_RETURN 5
+#define EVENT_RESTART 6
+#define EVENT_RESTART_DELAYED 7
 
 // Event numbers block allocation
 // ** ALL NEW EVENT TYPES SHOULD BE ALLOCATED FROM BLOCKS LISTED HERE! **
 
-#define VC_EVENT_EVENTS_START                     100
-#define NET_EVENT_EVENTS_START                    200
-#define DISK_EVENT_EVENTS_START                   300
-#define CLUSTER_EVENT_EVENTS_START                400
-#define HOSTDB_EVENT_EVENTS_START                 500
-#define DNS_EVENT_EVENTS_START                    600
-#define CONFIG_EVENT_EVENTS_START                 800
-#define LOG_EVENT_EVENTS_START	                  900
-#define MULTI_CACHE_EVENT_EVENTS_START            1000
-#define CACHE_EVENT_EVENTS_START                  1100
-#define CACHE_DIRECTORY_EVENT_EVENTS_START        1200
-#define CACHE_DB_EVENT_EVENTS_START               1300
-#define HTTP_NET_CONNECTION_EVENT_EVENTS_START    1400
-#define HTTP_NET_VCONNECTION_EVENT_EVENTS_START   1500
-#define GC_EVENT_EVENTS_START                     1600
-#define ICP_EVENT_EVENTS_START                    1800
-#define TRANSFORM_EVENTS_START                    2000
-#define STAT_PAGES_EVENTS_START                   2100
-#define HTTP_SESSION_EVENTS_START                 2200
-#define HTTP2_SESSION_EVENTS_START                2250
-#define HTTP_TUNNEL_EVENTS_START                  2300
-#define HTTP_SCH_UPDATE_EVENTS_START              2400
-#define NT_ASYNC_CONNECT_EVENT_EVENTS_START       3000
-#define NT_ASYNC_IO_EVENT_EVENTS_START            3100
-#define RAFT_EVENT_EVENTS_START                   3200
-#define SIMPLE_EVENT_EVENTS_START                 3300
-#define UPDATE_EVENT_EVENTS_START                 3500
-#define LOG_COLLATION_EVENT_EVENTS_START          3800
-#define AIO_EVENT_EVENTS_START                    3900
-#define BLOCK_CACHE_EVENT_EVENTS_START            4000
-#define UTILS_EVENT_EVENTS_START                  5000
-#define CONGESTION_EVENT_EVENTS_START             5100
-#define INK_API_EVENT_EVENTS_START                60000
-#define SRV_EVENT_EVENTS_START	                  62000
-#define REMAP_EVENT_EVENTS_START                  63000
-
-//define misc events here
-#define ONE_WAY_TUNNEL_EVENT_PEER_CLOSE (SIMPLE_EVENT_EVENTS_START+1)
-#define PREFETCH_EVENT_SEND_URL         (SIMPLE_EVENT_EVENTS_START+2)
+#define VC_EVENT_EVENTS_START 100
+#define NET_EVENT_EVENTS_START 200
+#define DISK_EVENT_EVENTS_START 300
+#define CLUSTER_EVENT_EVENTS_START 400
+#define HOSTDB_EVENT_EVENTS_START 500
+#define DNS_EVENT_EVENTS_START 600
+#define CONFIG_EVENT_EVENTS_START 800
+#define LOG_EVENT_EVENTS_START 900
+#define MULTI_CACHE_EVENT_EVENTS_START 1000
+#define CACHE_EVENT_EVENTS_START 1100
+#define CACHE_DIRECTORY_EVENT_EVENTS_START 1200
+#define CACHE_DB_EVENT_EVENTS_START 1300
+#define HTTP_NET_CONNECTION_EVENT_EVENTS_START 1400
+#define HTTP_NET_VCONNECTION_EVENT_EVENTS_START 1500
+#define GC_EVENT_EVENTS_START 1600
+#define ICP_EVENT_EVENTS_START 1800
+#define TRANSFORM_EVENTS_START 2000
+#define STAT_PAGES_EVENTS_START 2100
+#define HTTP_SESSION_EVENTS_START 2200
+#define HTTP2_SESSION_EVENTS_START 2250
+#define HTTP_TUNNEL_EVENTS_START 2300
+#define HTTP_SCH_UPDATE_EVENTS_START 2400
+#define NT_ASYNC_CONNECT_EVENT_EVENTS_START 3000
+#define NT_ASYNC_IO_EVENT_EVENTS_START 3100
+#define RAFT_EVENT_EVENTS_START 3200
+#define SIMPLE_EVENT_EVENTS_START 3300
+#define UPDATE_EVENT_EVENTS_START 3500
+#define LOG_COLLATION_EVENT_EVENTS_START 3800
+#define AIO_EVENT_EVENTS_START 3900
+#define BLOCK_CACHE_EVENT_EVENTS_START 4000
+#define UTILS_EVENT_EVENTS_START 5000
+#define CONGESTION_EVENT_EVENTS_START 5100
+#define INK_API_EVENT_EVENTS_START 60000
+#define SRV_EVENT_EVENTS_START 62000
+#define REMAP_EVENT_EVENTS_START 63000
+
+// define misc events here
+#define ONE_WAY_TUNNEL_EVENT_PEER_CLOSE (SIMPLE_EVENT_EVENTS_START + 1)
+#define PREFETCH_EVENT_SEND_URL (SIMPLE_EVENT_EVENTS_START + 2)
 
 typedef int EventType;
 const int ET_CALL = 0;
@@ -150,10 +150,9 @@ class EThread;
   ink_get_hrtime).
 
 */
-class Event:public Action
+class Event : public Action
 {
 public:
-
   ///////////////////////////////////////////////////////////
   // Common Interface                                      //
   ///////////////////////////////////////////////////////////
@@ -208,11 +207,11 @@ public:
 
   EThread *ethread;
 
-  unsigned int in_the_prot_queue:1;
-  unsigned int in_the_priority_queue:1;
-  unsigned int immediate:1;
-  unsigned int globally_allocated:1;
-  unsigned int in_heap:4;
+  unsigned int in_the_prot_queue : 1;
+  unsigned int in_the_priority_queue : 1;
+  unsigned int immediate : 1;
+  unsigned int globally_allocated : 1;
+  unsigned int in_heap : 4;
   int callback_event;
 
   ink_hrtime timeout_at;
@@ -231,42 +230,43 @@ public:
   Event();
 
 
-  Event *init(Continuation * c, ink_hrtime atimeout_at = 0, ink_hrtime aperiod = 0);
+  Event *init(Continuation *c, ink_hrtime atimeout_at = 0, ink_hrtime aperiod = 0);
 
 #ifdef ENABLE_TIME_TRACE
   ink_hrtime start_time;
 #endif
 
 private:
-  void *operator  new(size_t size);     // use the fast allocators
+  void *operator new(size_t size); // use the fast allocators
 
 private:
   // prevent unauthorized copies (Not implemented)
-    Event(const Event &);
-    Event & operator =(const Event &);
+  Event(const Event &);
+  Event &operator=(const Event &);
 
 public:
   LINK(Event, link);
 
-  /*-------------------------------------------------------*\
-  | UNIX/non-NT Interface                                   |
-  \*-------------------------------------------------------*/
+/*-------------------------------------------------------*\
+| UNIX/non-NT Interface                                   |
+\*-------------------------------------------------------*/
 
 #ifdef ONLY_USED_FOR_FIB_AND_BIN_HEAP
   void *node_pointer;
-  void set_node_pointer(void *x)
+  void
+  set_node_pointer(void *x)
   {
     node_pointer = x;
   }
-  void *get_node_pointer()
+  void *
+  get_node_pointer()
   {
     return node_pointer;
   }
 #endif
 
 #if defined(__GNUC__)
-  virtual ~ Event() {
-  }
+  virtual ~Event() {}
 #endif
 };
 
@@ -276,11 +276,11 @@ public:
 extern ClassAllocator<Event> eventAllocator;
 
 #define EVENT_ALLOC(_a, _t) THREAD_ALLOC(_a, _t)
-#define EVENT_FREE(_p, _a, _t)   \
-  _p->mutex = NULL;              \
-  if (_p->globally_allocated)    \
-    ::_a.free(_p);               \
-  else                           \
-    THREAD_FREE(_p, _a, _t)
+#define EVENT_FREE(_p, _a, _t) \
+  _p->mutex = NULL;            \
+  if (_p->globally_allocated)  \
+    ::_a.free(_p);             \
+  else                         \
+  THREAD_FREE(_p, _a, _t)
 
 #endif /*_Event_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_EventProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_EventProcessor.h b/iocore/eventsystem/I_EventProcessor.h
index 121a846..6cd53c8 100644
--- a/iocore/eventsystem/I_EventProcessor.h
+++ b/iocore/eventsystem/I_EventProcessor.h
@@ -97,10 +97,9 @@ class EThread;
   deallocate it.
 
 */
-class EventProcessor:public Processor
+class EventProcessor : public Processor
 {
 public:
-
   /**
     Spawn an additional thread for calling back the continuation. Spawns
     a dedicated thread (EThread) that calls back the continuation passed
@@ -111,7 +110,7 @@ public:
     @return event object representing the start of the thread.
 
   */
-  Event *spawn_thread(Continuation * cont, const char *thr_name, size_t stacksize = 0);
+  Event *spawn_thread(Continuation *cont, const char *thr_name, size_t stacksize = 0);
 
   /**
     Spawns a group of threads for an event type. Spawns the number of
@@ -122,7 +121,7 @@ public:
     @return EventType or thread id for the new group of threads.
 
   */
-  EventType spawn_event_threads(int n_threads, const char* et_name, size_t stacksize);
+  EventType spawn_event_threads(int n_threads, const char *et_name, size_t stacksize);
 
 
   /**
@@ -143,13 +142,12 @@ public:
       of this callback.
 
   */
-  Event *schedule_imm(Continuation * c,
-                      EventType event_type = ET_CALL, int callback_event = EVENT_IMMEDIATE, void *cookie = NULL);
+  Event *schedule_imm(Continuation *c, EventType event_type = ET_CALL, int callback_event = EVENT_IMMEDIATE, void *cookie = NULL);
   /*
     provides the same functionality as schedule_imm and also signals the thread immediately
   */
-  Event *schedule_imm_signal(Continuation * c,
-                      EventType event_type = ET_CALL, int callback_event = EVENT_IMMEDIATE, void *cookie = NULL);
+  Event *schedule_imm_signal(Continuation *c, EventType event_type = ET_CALL, int callback_event = EVENT_IMMEDIATE,
+                             void *cookie = NULL);
   /**
     Schedules the continuation on a specific thread group to receive an
     event at the given timeout. Requests the EventProcessor to schedule
@@ -170,9 +168,8 @@ public:
       this callback.
 
   */
-  Event *schedule_at(Continuation * c,
-                     ink_hrtime atimeout_at,
-                     EventType event_type = ET_CALL, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_at(Continuation *c, ink_hrtime atimeout_at, EventType event_type = ET_CALL, int callback_event = EVENT_INTERVAL,
+                     void *cookie = NULL);
 
   /**
     Schedules the continuation on a specific thread group to receive an
@@ -193,9 +190,8 @@ public:
       this callback.
 
   */
-  Event *schedule_in(Continuation * c,
-                     ink_hrtime atimeout_in,
-                     EventType event_type = ET_CALL, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_in(Continuation *c, ink_hrtime atimeout_in, EventType event_type = ET_CALL, int callback_event = EVENT_INTERVAL,
+                     void *cookie = NULL);
 
   /**
     Schedules the continuation on a specific thread group to receive
@@ -216,9 +212,8 @@ public:
       this callback.
 
   */
-  Event *schedule_every(Continuation * c,
-                        ink_hrtime aperiod,
-                        EventType event_type = ET_CALL, int callback_event = EVENT_INTERVAL, void *cookie = NULL);
+  Event *schedule_every(Continuation *c, ink_hrtime aperiod, EventType event_type = ET_CALL, int callback_event = EVENT_INTERVAL,
+                        void *cookie = NULL);
 
 
   ////////////////////////////////////////////
@@ -229,10 +224,10 @@ public:
   // from the argument e.                   //
   ////////////////////////////////////////////
 
-  Event *reschedule_imm(Event * e, int callback_event = EVENT_IMMEDIATE);
-  Event *reschedule_at(Event * e, ink_hrtime atimeout_at, int callback_event = EVENT_INTERVAL);
-  Event *reschedule_in(Event * e, ink_hrtime atimeout_in, int callback_event = EVENT_INTERVAL);
-  Event *reschedule_every(Event * e, ink_hrtime aperiod, int callback_event = EVENT_INTERVAL);
+  Event *reschedule_imm(Event *e, int callback_event = EVENT_IMMEDIATE);
+  Event *reschedule_at(Event *e, ink_hrtime atimeout_at, int callback_event = EVENT_INTERVAL);
+  Event *reschedule_in(Event *e, ink_hrtime atimeout_in, int callback_event = EVENT_INTERVAL);
+  Event *reschedule_every(Event *e, ink_hrtime aperiod, int callback_event = EVENT_INTERVAL);
 
   EventProcessor();
 
@@ -245,7 +240,7 @@ public:
     @return 0 if successful, and a negative value otherwise.
 
   */
-  int start(int n_net_threads, size_t stacksize=DEFAULT_STACKSIZE);
+  int start(int n_net_threads, size_t stacksize = DEFAULT_STACKSIZE);
 
   /**
     Stop the EventProcessor. Attempts to stop the EventProcessor and
@@ -301,20 +296,19 @@ public:
 
 private:
   // prevent unauthorized copies (Not implemented)
-    EventProcessor(const EventProcessor &);
-    EventProcessor & operator =(const EventProcessor &);
+  EventProcessor(const EventProcessor &);
+  EventProcessor &operator=(const EventProcessor &);
 
 public:
-
   /*------------------------------------------------------*\
   | Unix & non NT Interface                                |
   \*------------------------------------------------------*/
 
-  Event * schedule(Event * e, EventType etype, bool fast_signal = false);
+  Event *schedule(Event *e, EventType etype, bool fast_signal = false);
   EThread *assign_thread(EventType etype);
 
   EThread *all_dthreads[MAX_EVENT_THREADS];
-  int n_dthreads;               // No. of dedicated threads
+  int n_dthreads; // No. of dedicated threads
   volatile int thread_data_used;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_EventSystem.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_EventSystem.h b/iocore/eventsystem/I_EventSystem.h
index eb6da6e..5bfa2e0 100644
--- a/iocore/eventsystem/I_EventSystem.h
+++ b/iocore/eventsystem/I_EventSystem.h
@@ -46,10 +46,8 @@
 
 #define EVENT_SYSTEM_MODULE_MAJOR_VERSION 1
 #define EVENT_SYSTEM_MODULE_MINOR_VERSION 0
-#define EVENT_SYSTEM_MODULE_VERSION makeModuleVersion(                 \
-                                    EVENT_SYSTEM_MODULE_MAJOR_VERSION, \
-                                    EVENT_SYSTEM_MODULE_MINOR_VERSION, \
-                                    PUBLIC_MODULE_HEADER)
+#define EVENT_SYSTEM_MODULE_VERSION \
+  makeModuleVersion(EVENT_SYSTEM_MODULE_MAJOR_VERSION, EVENT_SYSTEM_MODULE_MINOR_VERSION, PUBLIC_MODULE_HEADER)
 
 void ink_event_system_init(ModuleVersion version);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_IOBuffer.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index 0e5fe0c..c167bb4 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -36,7 +36,7 @@
 
  */
 
-#if !defined (I_IOBuffer_h)
+#if !defined(I_IOBuffer_h)
 #define I_IOBuffer_h
 
 #include "libts.h"
@@ -59,25 +59,24 @@ extern int64_t default_large_iobuffer_size; // matched to size of OS buffers
 #define TRACK_BUFFER_USER 1
 #endif
 
-enum AllocType
-{
+enum AllocType {
   NO_ALLOC,
   FAST_ALLOCATED,
   XMALLOCED,
   MEMALIGNED,
   DEFAULT_ALLOC,
-  CONSTANT
+  CONSTANT,
 };
 
 #if TS_USE_RECLAIMABLE_FREELIST
-#define DEFAULT_BUFFER_NUMBER        64
+#define DEFAULT_BUFFER_NUMBER 64
 #else
-#define DEFAULT_BUFFER_NUMBER        128
+#define DEFAULT_BUFFER_NUMBER 128
 #endif
-#define DEFAULT_HUGE_BUFFER_NUMBER   32
-#define MAX_MIOBUFFER_READERS        5
-#define DEFAULT_BUFFER_ALIGNMENT     8192       // should be disk/page size
-#define DEFAULT_BUFFER_BASE_SIZE     128
+#define DEFAULT_HUGE_BUFFER_NUMBER 32
+#define MAX_MIOBUFFER_READERS 5
+#define DEFAULT_BUFFER_ALIGNMENT 8192 // should be disk/page size
+#define DEFAULT_BUFFER_BASE_SIZE 128
 
 ////////////////////////////////////////////////
 // These are defines so that code that used 2 //
@@ -85,49 +84,45 @@ enum AllocType
 // still work if it uses BUFFER_SIZE_INDEX_2K //
 // instead.                                   //
 ////////////////////////////////////////////////
-#define BUFFER_SIZE_INDEX_128           0
-#define BUFFER_SIZE_INDEX_256           1
-#define BUFFER_SIZE_INDEX_512           2
-#define BUFFER_SIZE_INDEX_1K            3
-#define BUFFER_SIZE_INDEX_2K            4
-#define BUFFER_SIZE_INDEX_4K            5
-#define BUFFER_SIZE_INDEX_8K            6
-#define BUFFER_SIZE_INDEX_16K           7
-#define BUFFER_SIZE_INDEX_32K           8
-#define BUFFER_SIZE_INDEX_64K           9
-#define BUFFER_SIZE_INDEX_128K          10
-#define BUFFER_SIZE_INDEX_256K          11
-#define BUFFER_SIZE_INDEX_512K          12
-#define BUFFER_SIZE_INDEX_1M            13
-#define BUFFER_SIZE_INDEX_2M            14
-#define MAX_BUFFER_SIZE_INDEX           14
-#define DEFAULT_BUFFER_SIZES            (MAX_BUFFER_SIZE_INDEX+1)
-
-#define BUFFER_SIZE_FOR_INDEX(_i)    (DEFAULT_BUFFER_BASE_SIZE * (1 << (_i)))
-#define DEFAULT_SMALL_BUFFER_SIZE    BUFFER_SIZE_INDEX_512
-#define DEFAULT_LARGE_BUFFER_SIZE    BUFFER_SIZE_INDEX_4K
-#define DEFAULT_TS_BUFFER_SIZE       BUFFER_SIZE_INDEX_8K
-#define DEFAULT_MAX_BUFFER_SIZE      BUFFER_SIZE_FOR_INDEX(MAX_BUFFER_SIZE_INDEX)
-#define MIN_IOBUFFER_SIZE            BUFFER_SIZE_INDEX_128
-#define MAX_IOBUFFER_SIZE            (DEFAULT_BUFFER_SIZES-1)
-
-
-#define BUFFER_SIZE_ALLOCATED(_i)     \
-  (BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(_i) || \
-   BUFFER_SIZE_INDEX_IS_XMALLOCED(_i) )
-
-#define BUFFER_SIZE_NOT_ALLOCATED    DEFAULT_BUFFER_SIZES
+#define BUFFER_SIZE_INDEX_128 0
+#define BUFFER_SIZE_INDEX_256 1
+#define BUFFER_SIZE_INDEX_512 2
+#define BUFFER_SIZE_INDEX_1K 3
+#define BUFFER_SIZE_INDEX_2K 4
+#define BUFFER_SIZE_INDEX_4K 5
+#define BUFFER_SIZE_INDEX_8K 6
+#define BUFFER_SIZE_INDEX_16K 7
+#define BUFFER_SIZE_INDEX_32K 8
+#define BUFFER_SIZE_INDEX_64K 9
+#define BUFFER_SIZE_INDEX_128K 10
+#define BUFFER_SIZE_INDEX_256K 11
+#define BUFFER_SIZE_INDEX_512K 12
+#define BUFFER_SIZE_INDEX_1M 13
+#define BUFFER_SIZE_INDEX_2M 14
+#define MAX_BUFFER_SIZE_INDEX 14
+#define DEFAULT_BUFFER_SIZES (MAX_BUFFER_SIZE_INDEX + 1)
+
+#define BUFFER_SIZE_FOR_INDEX(_i) (DEFAULT_BUFFER_BASE_SIZE * (1 << (_i)))
+#define DEFAULT_SMALL_BUFFER_SIZE BUFFER_SIZE_INDEX_512
+#define DEFAULT_LARGE_BUFFER_SIZE BUFFER_SIZE_INDEX_4K
+#define DEFAULT_TS_BUFFER_SIZE BUFFER_SIZE_INDEX_8K
+#define DEFAULT_MAX_BUFFER_SIZE BUFFER_SIZE_FOR_INDEX(MAX_BUFFER_SIZE_INDEX)
+#define MIN_IOBUFFER_SIZE BUFFER_SIZE_INDEX_128
+#define MAX_IOBUFFER_SIZE (DEFAULT_BUFFER_SIZES - 1)
+
+
+#define BUFFER_SIZE_ALLOCATED(_i) (BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(_i) || BUFFER_SIZE_INDEX_IS_XMALLOCED(_i))
+
+#define BUFFER_SIZE_NOT_ALLOCATED DEFAULT_BUFFER_SIZES
 #define BUFFER_SIZE_INDEX_IS_XMALLOCED(_size_index) (_size_index < 0)
-#define BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(_size_index) \
-  (((uint64_t)_size_index) < DEFAULT_BUFFER_SIZES)
-#define BUFFER_SIZE_INDEX_IS_CONSTANT(_size_index) \
-  (_size_index >= DEFAULT_BUFFER_SIZES)
+#define BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(_size_index) (((uint64_t)_size_index) < DEFAULT_BUFFER_SIZES)
+#define BUFFER_SIZE_INDEX_IS_CONSTANT(_size_index) (_size_index >= DEFAULT_BUFFER_SIZES)
 
 #define BUFFER_SIZE_FOR_XMALLOC(_size) (-(_size))
 #define BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(_size) (-(_size))
 
 #define BUFFER_SIZE_FOR_CONSTANT(_size) (_size - DEFAULT_BUFFER_SIZES)
-#define BUFFER_SIZE_INDEX_FOR_CONSTANT_SIZE(_size) (_size+DEFAULT_BUFFER_SIZES)
+#define BUFFER_SIZE_INDEX_FOR_CONSTANT_SIZE(_size) (_size + DEFAULT_BUFFER_SIZES)
 
 inkcoreapi extern Allocator ioBufAllocator[DEFAULT_BUFFER_SIZES];
 
@@ -175,10 +170,9 @@ void init_buffer_allocators();
   </table>
 
  */
-class IOBufferData:public RefCountObj
+class IOBufferData : public RefCountObj
 {
 public:
-
   /**
     The size of the memory allocated by this IOBufferData. Calculates
     the amount of memory allocated by this IOBufferData.
@@ -215,7 +209,8 @@ public:
     @return address of the memory handled by this IOBufferData.
 
   */
-  char *data()
+  char *
+  data()
   {
     return _data;
   }
@@ -227,10 +222,7 @@ public:
     parameter to functions requiring a char*.
 
   */
-  operator  char *()
-  {
-    return _data;
-  }
+  operator char *() { return _data; }
 
   /**
     Frees the IOBufferData object and its underlying memory. Deallocates
@@ -269,9 +261,10 @@ public:
 
   */
   IOBufferData()
-:  _size_index(BUFFER_SIZE_NOT_ALLOCATED), _mem_type(NO_ALLOC), _data(NULL)
+    : _size_index(BUFFER_SIZE_NOT_ALLOCATED), _mem_type(NO_ALLOC), _data(NULL)
 #ifdef TRACK_BUFFER_USER
-    , _location(NULL)
+      ,
+      _location(NULL)
 #endif
   {
   }
@@ -279,7 +272,7 @@ public:
 private:
   // declaration only
   IOBufferData(const IOBufferData &);
-  IOBufferData & operator =(const IOBufferData &);
+  IOBufferData &operator=(const IOBufferData &);
 };
 
 inkcoreapi extern ClassAllocator<IOBufferData> ioDataAllocator;
@@ -292,7 +285,7 @@ inkcoreapi extern ClassAllocator<IOBufferData> ioDataAllocator;
   block is both in use and usable by the MIOBuffer it is attached to.
 
 */
-class IOBufferBlock:public RefCountObj
+class IOBufferBlock : public RefCountObj
 {
 public:
   /**
@@ -302,7 +295,8 @@ public:
     @return pointer to the underlying data.
 
   */
-  char *buf()
+  char *
+  buf()
   {
     return data->_data;
   }
@@ -314,7 +308,8 @@ public:
     @return pointer to the start of the inuse section.
 
   */
-  char *start()
+  char *
+  start()
   {
     return _start;
   }
@@ -326,7 +321,8 @@ public:
     @return pointer to the end of the inuse portion of the block.
 
   */
-  char *end()
+  char *
+  end()
   {
     return _end;
   }
@@ -336,7 +332,8 @@ public:
     represented by this block.
 
   */
-  char *buf_end()
+  char *
+  buf_end()
   {
     return _buf_end;
   }
@@ -347,9 +344,10 @@ public:
     @return bytes occupied by the inuse area.
 
   */
-  int64_t size()
+  int64_t
+  size()
   {
-    return (int64_t) (_end - _start);
+    return (int64_t)(_end - _start);
   }
 
   /**
@@ -359,9 +357,10 @@ public:
     @return bytes available for reading from the inuse area.
 
   */
-  int64_t read_avail()
+  int64_t
+  read_avail()
   {
-    return (int64_t) (_end - _start);
+    return (int64_t)(_end - _start);
   }
 
   /**
@@ -370,9 +369,10 @@ public:
 
     @return space available for writing in this IOBufferBlock.
   */
-  int64_t write_avail()
+  int64_t
+  write_avail()
   {
-    return (int64_t) (_buf_end - _end);
+    return (int64_t)(_buf_end - _end);
   }
 
   /**
@@ -385,7 +385,8 @@ public:
       IOBufferBlock.
 
   */
-  int64_t block_size()
+  int64_t
+  block_size()
   {
     return data->block_size();
   }
@@ -472,7 +473,7 @@ public:
       and to mark its start.
 
   */
-  void set(IOBufferData * d, int64_t len = 0, int64_t offset = 0);
+  void set(IOBufferData *d, int64_t len = 0, int64_t offset = 0);
   void set_internal(void *b, int64_t len, int64_t asize_index);
   void realloc_set_internal(void *b, int64_t buf_size, int64_t asize_index);
   void realloc(void *b, int64_t buf_size);
@@ -521,7 +522,7 @@ public:
 
 private:
   IOBufferBlock(const IOBufferBlock &);
-  IOBufferBlock & operator =(const IOBufferBlock &);
+  IOBufferBlock &operator=(const IOBufferBlock &);
 };
 
 extern inkcoreapi ClassAllocator<IOBufferBlock> ioBlockAllocator;
@@ -540,7 +541,6 @@ extern inkcoreapi ClassAllocator<IOBufferBlock> ioBlockAllocator;
 class IOBufferReader
 {
 public:
-
   /**
     Start of unconsumed data. Returns a pointer to first unconsumed data
     on the buffer for this reader. A null pointer indicates no data is
@@ -760,12 +760,20 @@ public:
     @return reference to the character in that position.
 
   */
-  char &operator[] (int64_t i);
+  char &operator[](int64_t i);
 
-  MIOBuffer *writer() const { return mbuf; }
-  MIOBuffer *allocated() const { return mbuf; }
+  MIOBuffer *
+  writer() const
+  {
+    return mbuf;
+  }
+  MIOBuffer *
+  allocated() const
+  {
+    return mbuf;
+  }
 
-  MIOBufferAccessor *accessor;  // pointer back to the accessor
+  MIOBufferAccessor *accessor; // pointer back to the accessor
 
   /**
     Back pointer to this object's MIOBuffer. A pointer back to the
@@ -784,9 +792,7 @@ public:
   int64_t start_offset;
   int64_t size_limit;
 
-  IOBufferReader()
-    : accessor(NULL), mbuf(NULL), start_offset(0), size_limit(INT64_MAX)
-  { }
+  IOBufferReader() : accessor(NULL), mbuf(NULL), start_offset(0), size_limit(INT64_MAX) {}
 };
 
 /**
@@ -808,7 +814,6 @@ public:
 class MIOBuffer
 {
 public:
-
   /**
     Increase writer's inuse area. Instructs the writer associated with
     this MIOBuffer to increase the inuse area of the block by as much as
@@ -825,7 +830,7 @@ public:
     other buffer.
 
   */
-  void append_block(IOBufferBlock * b);
+  void append_block(IOBufferBlock *b);
 
   /**
     Adds a new block to the end of the block list. The size is determined
@@ -877,7 +882,7 @@ public:
     this space becomes available to the copy.
 
   */
-  inkcoreapi int64_t write_and_transfer_left_over_space(IOBufferReader * r, int64_t len = INT64_MAX, int64_t offset = 0);
+  inkcoreapi int64_t write_and_transfer_left_over_space(IOBufferReader *r, int64_t len = INT64_MAX, int64_t offset = 0);
 #endif
 
   /**
@@ -905,7 +910,7 @@ public:
     rather than sharing blocks to prevent a build of blocks on the buffer.
 
   */
-  inkcoreapi int64_t write(IOBufferReader * r, int64_t len = INT64_MAX, int64_t offset = 0);
+  inkcoreapi int64_t write(IOBufferReader *r, int64_t len = INT64_MAX, int64_t offset = 0);
 
   int64_t remove_append(IOBufferReader *);
 
@@ -915,7 +920,8 @@ public:
     block list.
 
   */
-  IOBufferBlock *first_write_block()
+  IOBufferBlock *
+  first_write_block()
   {
     if (_writer) {
       if (_writer->next && !_writer->write_avail())
@@ -923,24 +929,28 @@ public:
       ink_assert(!_writer->next || !_writer->next->read_avail());
       return _writer;
     } else
-        return NULL;
+      return NULL;
   }
 
 
-  char *buf()
+  char *
+  buf()
   {
     IOBufferBlock *b = first_write_block();
     return b ? b->buf() : 0;
   }
-  char *buf_end()
+  char *
+  buf_end()
   {
     return first_write_block()->buf_end();
   }
-  char *start()
+  char *
+  start()
   {
     return first_write_block()->start();
   }
-  char *end()
+  char *
+  end()
   {
     return first_write_block()->end();
   }
@@ -979,7 +989,8 @@ public:
     Returns the default data block size for this buffer.
 
   */
-  int64_t total_size()
+  int64_t
+  total_size()
   {
     return block_size();
   }
@@ -989,7 +1000,8 @@ public:
     the watermark.
 
   */
-  bool high_water()
+  bool
+  high_water()
   {
     return max_read_avail() > water_mark;
   }
@@ -1000,7 +1012,8 @@ public:
     on write_avail() it may add blocks.
 
   */
-  bool low_water()
+  bool
+  low_water()
   {
     return write_avail() <= water_mark;
   }
@@ -1010,7 +1023,8 @@ public:
     blocks on the buffer is less than the water mark.
 
   */
-  bool current_low_water()
+  bool
+  current_low_water()
   {
     return current_write_avail() <= water_mark;
   }
@@ -1021,7 +1035,7 @@ public:
     to point to 'anAccessor'.
 
   */
-  IOBufferReader *alloc_accessor(MIOBufferAccessor * anAccessor);
+  IOBufferReader *alloc_accessor(MIOBufferAccessor *anAccessor);
 
   /**
     Allocates an IOBufferReader for this buffer. IOBufferReaders hold
@@ -1040,7 +1054,7 @@ public:
     previous allocated from this buffer.
 
   */
-  IOBufferReader *clone_reader(IOBufferReader * r);
+  IOBufferReader *clone_reader(IOBufferReader *r);
 
   /**
     Deallocates reader e from this buffer. e MUST be a pointer to a reader
@@ -1050,7 +1064,7 @@ public:
     being freed as all outstanding readers are automatically deallocated.
 
   */
-  void dealloc_reader(IOBufferReader * e);
+  void dealloc_reader(IOBufferReader *e);
 
   /**
     Deallocates all outstanding readers on the buffer.
@@ -1062,12 +1076,13 @@ public:
   void set_xmalloced(void *b, int64_t len);
   void alloc(int64_t i = default_large_iobuffer_size);
   void alloc_xmalloc(int64_t buf_size);
-  void append_block_internal(IOBufferBlock * b);
+  void append_block_internal(IOBufferBlock *b);
   int64_t puts(char *buf, int64_t len);
 
   // internal interface
 
-  bool empty()
+  bool
+  empty()
   {
     return !_writer;
   }
@@ -1078,7 +1093,8 @@ public:
 
   IOBufferBlock *get_current_block();
 
-  void reset()
+  void
+  reset()
   {
     if (_writer) {
       _writer->reset();
@@ -1089,39 +1105,46 @@ public:
       }
   }
 
-  void init_readers()
+  void
+  init_readers()
   {
     for (int j = 0; j < MAX_MIOBUFFER_READERS; j++)
       if (readers[j].allocated() && !readers[j].block)
         readers[j].block = _writer;
   }
 
-  void dealloc()
+  void
+  dealloc()
   {
     _writer = NULL;
     dealloc_all_readers();
   }
 
-  void clear()
+  void
+  clear()
   {
     dealloc();
     size_index = BUFFER_SIZE_NOT_ALLOCATED;
     water_mark = 0;
   }
 
-  void realloc(int64_t i)
+  void
+  realloc(int64_t i)
   {
     _writer->realloc(i);
   }
-  void realloc(void *b, int64_t buf_size)
+  void
+  realloc(void *b, int64_t buf_size)
   {
     _writer->realloc(b, buf_size);
   }
-  void realloc_xmalloc(void *b, int64_t buf_size)
+  void
+  realloc_xmalloc(void *b, int64_t buf_size)
   {
     _writer->realloc_xmalloc(b, buf_size);
   }
-  void realloc_xmalloc(int64_t buf_size)
+  void
+  realloc_xmalloc(int64_t buf_size)
   {
     _writer->realloc_xmalloc(buf_size);
   }
@@ -1155,61 +1178,70 @@ public:
   A wrapper for either a reader or a writer of an MIOBuffer.
 
 */
-struct MIOBufferAccessor
-{
-  IOBufferReader * reader() {
+struct MIOBufferAccessor {
+  IOBufferReader *
+  reader()
+  {
     return entry;
   }
 
-  MIOBuffer * writer() {
+  MIOBuffer *
+  writer()
+  {
     return mbuf;
   }
 
-  int64_t block_size() const {
+  int64_t
+  block_size() const
+  {
     return mbuf->block_size();
   }
 
-  int64_t total_size() const {
+  int64_t
+  total_size() const
+  {
     return block_size();
   }
 
-  void reader_for(IOBufferReader * abuf);
-  void reader_for(MIOBuffer * abuf);
-  void writer_for(MIOBuffer * abuf);
+  void reader_for(IOBufferReader *abuf);
+  void reader_for(MIOBuffer *abuf);
+  void writer_for(MIOBuffer *abuf);
 
-  void clear() {
+  void
+  clear()
+  {
     mbuf = NULL;
     entry = NULL;
   }
 
-  MIOBufferAccessor():
+  MIOBufferAccessor()
+    :
 #ifdef DEBUG
-    name(NULL),
+      name(NULL),
 #endif
-    mbuf(NULL), entry(NULL)
+      mbuf(NULL), entry(NULL)
   {
   }
 
   ~MIOBufferAccessor();
 
 #ifdef DEBUG
-  const char * name;
+  const char *name;
 #endif
 
 private:
   MIOBufferAccessor(const MIOBufferAccessor &);
-  MIOBufferAccessor & operator =(const MIOBufferAccessor &);
+  MIOBufferAccessor &operator=(const MIOBufferAccessor &);
 
   MIOBuffer *mbuf;
   IOBufferReader *entry;
-
 };
 
-extern MIOBuffer * new_MIOBuffer_internal(
+extern MIOBuffer *new_MIOBuffer_internal(
 #ifdef TRACK_BUFFER_USER
-                                          const char *loc,
+  const char *loc,
 #endif
-                                          int64_t size_index = default_large_iobuffer_size);
+  int64_t size_index = default_large_iobuffer_size);
 
 #ifdef TRACK_BUFFER_USER
 class MIOBuffer_tracker
@@ -1217,17 +1249,12 @@ class MIOBuffer_tracker
   const char *loc;
 
 public:
-    MIOBuffer_tracker(const char *_loc):loc(_loc)
-  {
-  }
-  MIOBuffer *operator() (int64_t size_index = default_large_iobuffer_size) {
-    return new_MIOBuffer_internal(loc, size_index);
-  }
-
+  MIOBuffer_tracker(const char *_loc) : loc(_loc) {}
+  MIOBuffer *operator()(int64_t size_index = default_large_iobuffer_size) { return new_MIOBuffer_internal(loc, size_index); }
 };
 #endif
 
-extern MIOBuffer * new_empty_MIOBuffer_internal(
+extern MIOBuffer *new_empty_MIOBuffer_internal(
 #ifdef TRACK_BUFFER_USER
   const char *loc,
 #endif
@@ -1239,37 +1266,33 @@ class Empty_MIOBuffer_tracker
   const char *loc;
 
 public:
-    Empty_MIOBuffer_tracker(const char *_loc):loc(_loc)
-  {
-  }
-  MIOBuffer *operator() (int64_t size_index = default_large_iobuffer_size) {
-    return new_empty_MIOBuffer_internal(loc, size_index);
-  }
+  Empty_MIOBuffer_tracker(const char *_loc) : loc(_loc) {}
+  MIOBuffer *operator()(int64_t size_index = default_large_iobuffer_size) { return new_empty_MIOBuffer_internal(loc, size_index); }
 };
 #endif
 
 /// MIOBuffer allocator/deallocator
 #ifdef TRACK_BUFFER_USER
-#define new_MIOBuffer               MIOBuffer_tracker(RES_PATH("memory/IOBuffer/"))
-#define new_empty_MIOBuffer         Empty_MIOBuffer_tracker(RES_PATH("memory/IOBuffer/"))
+#define new_MIOBuffer MIOBuffer_tracker(RES_PATH("memory/IOBuffer/"))
+#define new_empty_MIOBuffer Empty_MIOBuffer_tracker(RES_PATH("memory/IOBuffer/"))
 #else
-#define new_MIOBuffer               new_MIOBuffer_internal
-#define new_empty_MIOBuffer         new_empty_MIOBuffer_internal
+#define new_MIOBuffer new_MIOBuffer_internal
+#define new_empty_MIOBuffer new_empty_MIOBuffer_internal
 #endif
-extern void free_MIOBuffer(MIOBuffer * mio);
+extern void free_MIOBuffer(MIOBuffer *mio);
 //////////////////////////////////////////////////////////////////////
 
-extern IOBufferBlock * new_IOBufferBlock_internal(
+extern IOBufferBlock *new_IOBufferBlock_internal(
 #ifdef TRACK_BUFFER_USER
   const char *loc
 #endif
-);
+  );
 
-extern IOBufferBlock * new_IOBufferBlock_internal(
+extern IOBufferBlock *new_IOBufferBlock_internal(
 #ifdef TRACK_BUFFER_USER
   const char *loc,
 #endif
-  IOBufferData * d, int64_t len = 0, int64_t offset = 0);
+  IOBufferData *d, int64_t len = 0, int64_t offset = 0);
 
 #ifdef TRACK_BUFFER_USER
 class IOBufferBlock_tracker
@@ -1277,25 +1300,20 @@ class IOBufferBlock_tracker
   const char *loc;
 
 public:
-    IOBufferBlock_tracker(const char *_loc):loc(_loc)
-  {
-  }
-  IOBufferBlock *operator() ()
+  IOBufferBlock_tracker(const char *_loc) : loc(_loc) {}
+  IOBufferBlock *operator()() { return new_IOBufferBlock_internal(loc); }
+  IOBufferBlock *operator()(IOBufferData *d, int64_t len = 0, int64_t offset = 0)
   {
-    return new_IOBufferBlock_internal(loc);
-  }
-  IOBufferBlock *operator() (IOBufferData * d, int64_t len = 0, int64_t offset = 0) {
     return new_IOBufferBlock_internal(loc, d, len, offset);
   }
-
 };
 #endif
 
 /// IOBufferBlock allocator
 #ifdef TRACK_BUFFER_USER
-#define new_IOBufferBlock  IOBufferBlock_tracker(RES_PATH("memory/IOBuffer/"))
+#define new_IOBufferBlock IOBufferBlock_tracker(RES_PATH("memory/IOBuffer/"))
 #else
-#define new_IOBufferBlock  new_IOBufferBlock_internal
+#define new_IOBufferBlock new_IOBufferBlock_internal
 #endif
 ////////////////////////////////////////////////////////////
 
@@ -1303,8 +1321,7 @@ extern IOBufferData *new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
   const char *location,
 #endif
-  int64_t size_index = default_large_iobuffer_size,
-  AllocType type = DEFAULT_ALLOC);
+  int64_t size_index = default_large_iobuffer_size, AllocType type = DEFAULT_ALLOC);
 
 extern IOBufferData *new_xmalloc_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
@@ -1324,28 +1341,22 @@ class IOBufferData_tracker
   const char *loc;
 
 public:
-  IOBufferData_tracker(const char *_loc):loc(_loc)
+  IOBufferData_tracker(const char *_loc) : loc(_loc) {}
+  IOBufferData *operator()(int64_t size_index = default_large_iobuffer_size, AllocType type = DEFAULT_ALLOC)
   {
-  }
-  IOBufferData *operator() (int64_t size_index = default_large_iobuffer_size, AllocType type = DEFAULT_ALLOC) {
     return new_IOBufferData_internal(loc, size_index, type);
   }
-
 };
 #endif
 
 #ifdef TRACK_BUFFER_USER
 #define new_IOBufferData IOBufferData_tracker(RES_PATH("memory/IOBuffer/"))
-#define  new_xmalloc_IOBufferData(b, size)                      \
-new_xmalloc_IOBufferData_internal(RES_PATH("memory/IOBuffer/"), \
-				  (b), (size))
-#define  new_constant_IOBufferData(b, size)                      \
-new_constant_IOBufferData_internal(RES_PATH("memory/IOBuffer/"), \
-				  (b), (size))
+#define new_xmalloc_IOBufferData(b, size) new_xmalloc_IOBufferData_internal(RES_PATH("memory/IOBuffer/"), (b), (size))
+#define new_constant_IOBufferData(b, size) new_constant_IOBufferData_internal(RES_PATH("memory/IOBuffer/"), (b), (size))
 #else
 #define new_IOBufferData new_IOBufferData_internal
-#define  new_xmalloc_IOBufferData new_xmalloc_IOBufferData_internal
-#define  new_constant_IOBufferData new_constant_IOBufferData_internal
+#define new_xmalloc_IOBufferData new_xmalloc_IOBufferData_internal
+#define new_constant_IOBufferData new_constant_IOBufferData_internal
 #endif
 
 extern int64_t iobuffer_size_to_index(int64_t size, int64_t max = max_iobuffer_size);
@@ -1360,7 +1371,7 @@ extern int64_t index_to_buffer_size(int64_t idx);
   @return ptr to head of new IOBufferBlock chain.
 
 */
-extern IOBufferBlock *iobufferblock_clone(IOBufferBlock * b, int64_t offset, int64_t len);
+extern IOBufferBlock *iobufferblock_clone(IOBufferBlock *b, int64_t offset, int64_t len);
 /**
   Skip over specified bytes in chain. Used for dropping references.
 
@@ -1372,5 +1383,5 @@ extern IOBufferBlock *iobufferblock_clone(IOBufferBlock * b, int64_t offset, int
   @return ptr to head of new IOBufferBlock chain.
 
 */
-extern IOBufferBlock *iobufferblock_skip(IOBufferBlock * b, int64_t *poffset, int64_t *plen, int64_t write);
+extern IOBufferBlock *iobufferblock_skip(IOBufferBlock *b, int64_t *poffset, int64_t *plen, int64_t write);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Lock.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Lock.h b/iocore/eventsystem/I_Lock.h
index bc79f0b..ec3d7c2 100644
--- a/iocore/eventsystem/I_Lock.h
+++ b/iocore/eventsystem/I_Lock.h
@@ -27,8 +27,8 @@
 #include "libts.h"
 #include "I_Thread.h"
 
-#define MAX_LOCK_TIME	HRTIME_MSECONDS(200)
-#define THREAD_MUTEX_THREAD_HOLDING	(-1024*1024)
+#define MAX_LOCK_TIME HRTIME_MSECONDS(200)
+#define THREAD_MUTEX_THREAD_HOLDING (-1024 * 1024)
 
 /*------------------------------------------------------*\
 |  Macros                                                |
@@ -48,13 +48,13 @@
   @param _t The current EThread executing your code.
 
 */
-#  ifdef DEBUG
-#    define MUTEX_LOCK(_l,_m,_t) MutexLock _l(DiagsMakeLocation(),NULL,_m,_t)
-#  else
-#    define MUTEX_LOCK(_l,_m,_t) MutexLock _l(_m,_t)
-#  endif //DEBUG
+#ifdef DEBUG
+#define MUTEX_LOCK(_l, _m, _t) MutexLock _l(DiagsMakeLocation(), NULL, _m, _t)
+#else
+#define MUTEX_LOCK(_l, _m, _t) MutexLock _l(_m, _t)
+#endif // DEBUG
 
-#  ifdef DEBUG
+#ifdef DEBUG
 /**
   Attempts to acquire the lock to the ProxyMutex.
 
@@ -68,8 +68,7 @@
   @param _t The current EThread executing your code.
 
 */
-#    define MUTEX_TRY_LOCK(_l,_m,_t) \
-MutexTryLock _l(DiagsMakeLocation(),(char*)NULL,_m,_t)
+#define MUTEX_TRY_LOCK(_l, _m, _t) MutexTryLock _l(DiagsMakeLocation(), (char *)NULL, _m, _t)
 
 /**
   Attempts to acquire the lock to the ProxyMutex.
@@ -85,8 +84,7 @@ MutexTryLock _l(DiagsMakeLocation(),(char*)NULL,_m,_t)
   @param _sc The number of attempts or spin count. It must be a positive value.
 
 */
-#    define MUTEX_TRY_LOCK_SPIN(_l,_m,_t,_sc) \
-MutexTryLock _l(DiagsMakeLocation(),(char*)NULL,_m,_t,_sc)
+#define MUTEX_TRY_LOCK_SPIN(_l, _m, _t, _sc) MutexTryLock _l(DiagsMakeLocation(), (char *)NULL, _m, _t, _sc)
 
 /**
   Attempts to acquire the lock to the ProxyMutex.
@@ -103,13 +101,12 @@ MutexTryLock _l(DiagsMakeLocation(),(char*)NULL,_m,_t,_sc)
 
 */
 
-#    define MUTEX_TRY_LOCK_FOR(_l,_m,_t,_c) \
-MutexTryLock _l(DiagsMakeLocation(),NULL,_m,_t)
-#  else //DEBUG
-#    define MUTEX_TRY_LOCK(_l,_m,_t) MutexTryLock _l(_m,_t)
-#    define MUTEX_TRY_LOCK_SPIN(_l,_m,_t,_sc) MutexTryLock _l(_m,_t,_sc)
-#    define MUTEX_TRY_LOCK_FOR(_l,_m,_t,_c) MutexTryLock _l(_m,_t)
-#  endif //DEBUG
+#define MUTEX_TRY_LOCK_FOR(_l, _m, _t, _c) MutexTryLock _l(DiagsMakeLocation(), NULL, _m, _t)
+#else // DEBUG
+#define MUTEX_TRY_LOCK(_l, _m, _t) MutexTryLock _l(_m, _t)
+#define MUTEX_TRY_LOCK_SPIN(_l, _m, _t, _sc) MutexTryLock _l(_m, _t, _sc)
+#define MUTEX_TRY_LOCK_FOR(_l, _m, _t, _c) MutexTryLock _l(_m, _t)
+#endif // DEBUG
 
 /**
   Releases the lock on a ProxyMutex.
@@ -123,35 +120,29 @@ MutexTryLock _l(DiagsMakeLocation(),NULL,_m,_t)
     lock.
 
 */
-#  define MUTEX_RELEASE(_l) (_l).release()
+#define MUTEX_RELEASE(_l) (_l).release()
 
 /////////////////////////////////////
 // DEPRECATED DEPRECATED DEPRECATED
 #ifdef DEBUG
-#  define MUTEX_TAKE_TRY_LOCK(_m,_t) \
-Mutex_trylock(DiagsMakeLocation(),(char*)NULL,_m,_t)
-#  define MUTEX_TAKE_TRY_LOCK_FOR(_m,_t,_c) \
-Mutex_trylock(DiagsMakeLocation(),(char*)NULL,_m,_t)
-#  define MUTEX_TAKE_TRY_LOCK_FOR_SPIN(_m,_t,_c,_sc) \
-Mutex_trylock_spin(DiagsMakeLocation(),NULL,_m,_t,_sc)
+#define MUTEX_TAKE_TRY_LOCK(_m, _t) Mutex_trylock(DiagsMakeLocation(), (char *)NULL, _m, _t)
+#define MUTEX_TAKE_TRY_LOCK_FOR(_m, _t, _c) Mutex_trylock(DiagsMakeLocation(), (char *)NULL, _m, _t)
+#define MUTEX_TAKE_TRY_LOCK_FOR_SPIN(_m, _t, _c, _sc) Mutex_trylock_spin(DiagsMakeLocation(), NULL, _m, _t, _sc)
 #else
-#  define MUTEX_TAKE_TRY_LOCK(_m,_t) Mutex_trylock(_m,_t)
-#  define MUTEX_TAKE_TRY_LOCK_FOR(_m,_t,_c) Mutex_trylock(_m,_t)
-#  define MUTEX_TAKE_TRY_LOCK_FOR_SPIN(_m,_t,_c,_sc) \
-Mutex_trylock_spin(_m,_t,_sc)
+#define MUTEX_TAKE_TRY_LOCK(_m, _t) Mutex_trylock(_m, _t)
+#define MUTEX_TAKE_TRY_LOCK_FOR(_m, _t, _c) Mutex_trylock(_m, _t)
+#define MUTEX_TAKE_TRY_LOCK_FOR_SPIN(_m, _t, _c, _sc) Mutex_trylock_spin(_m, _t, _sc)
 #endif
 
 #ifdef DEBUG
-#  define MUTEX_TAKE_LOCK(_m,_t)\
-Mutex_lock(DiagsMakeLocation(),(char*)NULL,_m,_t)
-#  define MUTEX_TAKE_LOCK_FOR(_m,_t,_c) \
-Mutex_lock(DiagsMakeLocation(),NULL,_m,_t)
+#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(DiagsMakeLocation(), (char *)NULL, _m, _t)
+#define MUTEX_TAKE_LOCK_FOR(_m, _t, _c) Mutex_lock(DiagsMakeLocation(), NULL, _m, _t)
 #else
-#  define MUTEX_TAKE_LOCK(_m,_t) Mutex_lock(_m,_t)
-#  define MUTEX_TAKE_LOCK_FOR(_m,_t,_c) Mutex_lock(_m,_t)
-#endif //DEBUG
+#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(_m, _t)
+#define MUTEX_TAKE_LOCK_FOR(_m, _t, _c) Mutex_lock(_m, _t)
+#endif // DEBUG
 
-#define MUTEX_UNTAKE_LOCK(_m,_t) Mutex_unlock(_m,_t)
+#define MUTEX_UNTAKE_LOCK(_m, _t) Mutex_unlock(_m, _t)
 // DEPRECATED DEPRECATED DEPRECATED
 /////////////////////////////////////
 
@@ -160,9 +151,9 @@ typedef EThread *EThreadPtr;
 typedef volatile EThreadPtr VolatileEThreadPtr;
 
 #if DEBUG
-inkcoreapi extern void lock_waiting(const SrcLoc&, const char *handler);
-inkcoreapi extern void lock_holding(const SrcLoc&, const char *handler);
-inkcoreapi extern void lock_taken(const SrcLoc&, const char *handler);
+inkcoreapi extern void lock_waiting(const SrcLoc &, const char *handler);
+inkcoreapi extern void lock_holding(const SrcLoc &, const char *handler);
+inkcoreapi extern void lock_taken(const SrcLoc &, const char *handler);
 #endif
 
 /**
@@ -191,7 +182,7 @@ inkcoreapi extern void lock_taken(const SrcLoc&, const char *handler);
   allow you to lock/unlock the underlying mutex object.
 
 */
-class ProxyMutex: public RefCountObj
+class ProxyMutex : public RefCountObj
 {
 public:
   /**
@@ -220,16 +211,15 @@ public:
   SrcLoc srcloc;
   const char *handler;
 
-#  ifdef MAX_LOCK_TAKEN
+#ifdef MAX_LOCK_TAKEN
   int taken;
-#  endif                        //MAX_LOCK_TAKEN
+#endif // MAX_LOCK_TAKEN
 
-#  ifdef LOCK_CONTENTION_PROFILING
-  int total_acquires, blocking_acquires,
-    nonblocking_acquires, successful_nonblocking_acquires, unsuccessful_nonblocking_acquires;
+#ifdef LOCK_CONTENTION_PROFILING
+  int total_acquires, blocking_acquires, nonblocking_acquires, successful_nonblocking_acquires, unsuccessful_nonblocking_acquires;
   void print_lock_stats(int flag);
-#  endif                        //LOCK_CONTENTION_PROFILING
-#endif                          //DEBUG
+#endif // LOCK_CONTENTION_PROFILING
+#endif // DEBUG
   void free();
 
   /**
@@ -252,17 +242,17 @@ public:
 #ifdef DEBUG
     hold_time = 0;
     handler = NULL;
-#  ifdef MAX_LOCK_TAKEN
+#ifdef MAX_LOCK_TAKEN
     taken = 0;
-#  endif                        //MAX_LOCK_TAKEN
-#  ifdef LOCK_CONTENTION_PROFILING
+#endif // MAX_LOCK_TAKEN
+#ifdef LOCK_CONTENTION_PROFILING
     total_acquires = 0;
     blocking_acquires = 0;
     nonblocking_acquires = 0;
     successful_nonblocking_acquires = 0;
     unsuccessful_nonblocking_acquires = 0;
-#  endif                        //LOCK_CONTENTION_PROFILING
-#endif                          //DEBUG
+#endif // LOCK_CONTENTION_PROFILING
+#endif // DEBUG
     // coverity[uninit_member]
   }
 
@@ -276,7 +266,9 @@ public:
       on the given platform.
 
   */
-  void init(const char *name = "UnnamedMutex") {
+  void
+  init(const char *name = "UnnamedMutex")
+  {
     ink_mutex_init(&the_mutex, name);
   }
 };
@@ -287,13 +279,12 @@ extern inkcoreapi ClassAllocator<ProxyMutex> mutexAllocator;
 inline bool
 Mutex_trylock(
 #ifdef DEBUG
-               const SrcLoc& location, const char *ahandler,
+  const SrcLoc &location, const char *ahandler,
 #endif
-               ProxyMutex * m, EThread * t)
+  ProxyMutex *m, EThread *t)
 {
-
   ink_assert(t != 0);
-  ink_assert(t == (EThread*)this_thread());
+  ink_assert(t == (EThread *)this_thread());
   if (m->thread_holding != t) {
     if (!ink_mutex_try_acquire(&m->the_mutex)) {
 #ifdef DEBUG
@@ -303,8 +294,8 @@ Mutex_trylock(
       m->nonblocking_acquires++;
       m->total_acquires++;
       m->print_lock_stats(0);
-#endif //LOCK_CONTENTION_PROFILING
-#endif //DEBUG
+#endif // LOCK_CONTENTION_PROFILING
+#endif // DEBUG
       return false;
     }
     m->thread_holding = t;
@@ -314,8 +305,8 @@ Mutex_trylock(
     m->hold_time = ink_get_hrtime();
 #ifdef MAX_LOCK_TAKEN
     m->taken++;
-#endif //MAX_LOCK_TAKEN
-#endif //DEBUG
+#endif // MAX_LOCK_TAKEN
+#endif // DEBUG
   }
 #ifdef DEBUG
 #ifdef LOCK_CONTENTION_PROFILING
@@ -323,8 +314,8 @@ Mutex_trylock(
   m->nonblocking_acquires++;
   m->total_acquires++;
   m->print_lock_stats(0);
-#endif //LOCK_CONTENTION_PROFILING
-#endif //DEBUG
+#endif // LOCK_CONTENTION_PROFILING
+#endif // DEBUG
   m->nthread_holding++;
   return true;
 }
@@ -332,11 +323,10 @@ Mutex_trylock(
 inline bool
 Mutex_trylock_spin(
 #ifdef DEBUG
-                    const SrcLoc& location, const char *ahandler,
+  const SrcLoc &location, const char *ahandler,
 #endif
-                    ProxyMutex * m, EThread * t, int spincnt = 1)
+  ProxyMutex *m, EThread *t, int spincnt = 1)
 {
-
   ink_assert(t != 0);
   if (m->thread_holding != t) {
     int locked;
@@ -352,8 +342,8 @@ Mutex_trylock_spin(
       m->nonblocking_acquires++;
       m->total_acquires++;
       m->print_lock_stats(0);
-#endif //LOCK_CONTENTION_PROFILING
-#endif //DEBUG
+#endif // LOCK_CONTENTION_PROFILING
+#endif // DEBUG
       return false;
     }
     m->thread_holding = t;
@@ -364,8 +354,8 @@ Mutex_trylock_spin(
     m->hold_time = ink_get_hrtime();
 #ifdef MAX_LOCK_TAKEN
     m->taken++;
-#endif //MAX_LOCK_TAKEN
-#endif //DEBUG
+#endif // MAX_LOCK_TAKEN
+#endif // DEBUG
   }
 #ifdef DEBUG
 #ifdef LOCK_CONTENTION_PROFILING
@@ -373,8 +363,8 @@ Mutex_trylock_spin(
   m->nonblocking_acquires++;
   m->total_acquires++;
   m->print_lock_stats(0);
-#endif //LOCK_CONTENTION_PROFILING
-#endif //DEBUG
+#endif // LOCK_CONTENTION_PROFILING
+#endif // DEBUG
   m->nthread_holding++;
   return true;
 }
@@ -382,11 +372,10 @@ Mutex_trylock_spin(
 inline int
 Mutex_lock(
 #ifdef DEBUG
-            const SrcLoc& location, const char *ahandler,
+  const SrcLoc &location, const char *ahandler,
 #endif
-            ProxyMutex * m, EThread * t)
+  ProxyMutex *m, EThread *t)
 {
-
   ink_assert(t != 0);
   if (m->thread_holding != t) {
     ink_mutex_acquire(&m->the_mutex);
@@ -398,8 +387,8 @@ Mutex_lock(
     m->hold_time = ink_get_hrtime();
 #ifdef MAX_LOCK_TAKEN
     m->taken++;
-#endif //MAX_LOCK_TAKEN
-#endif //DEBUG
+#endif // MAX_LOCK_TAKEN
+#endif // DEBUG
   }
 #ifdef DEBUG
 #ifdef LOCK_CONTENTION_PROFILING
@@ -407,13 +396,13 @@ Mutex_lock(
   m->total_acquires++;
   m->print_lock_stats(0);
 #endif // LOCK_CONTENTION_PROFILING
-#endif //DEBUG
+#endif // DEBUG
   m->nthread_holding++;
   return true;
 }
 
 inline void
-Mutex_unlock(ProxyMutex * m, EThread * t)
+Mutex_unlock(ProxyMutex *m, EThread *t)
 {
   if (m->nthread_holding) {
     ink_assert(t == m->thread_holding);
@@ -425,10 +414,10 @@ Mutex_unlock(ProxyMutex * m, EThread * t)
 #ifdef MAX_LOCK_TAKEN
       if (m->taken > MAX_LOCK_TAKEN)
         lock_taken(m->srcloc, m->handler);
-#endif //MAX_LOCK_TAKEN
+#endif // MAX_LOCK_TAKEN
       m->srcloc = SrcLoc(NULL, NULL, 0);
       m->handler = NULL;
-#endif //DEBUG
+#endif // DEBUG
       ink_assert(m->thread_holding);
       m->thread_holding = 0;
       ink_mutex_release(&m->the_mutex);
@@ -446,21 +435,19 @@ private:
 public:
   MutexLock(
 #ifdef DEBUG
-             const SrcLoc& location, const char *ahandler,
-#endif                          //DEBUG
-             ProxyMutex * am, EThread * t):m(am)
+    const SrcLoc &location, const char *ahandler,
+#endif // DEBUG
+    ProxyMutex *am, EThread *t)
+    : m(am)
   {
     Mutex_lock(
 #ifdef DEBUG
-                location, ahandler,
-#endif //DEBUG
-                m, t);
+      location, ahandler,
+#endif // DEBUG
+      m, t);
   }
 
-  ~MutexLock()
-  {
-    Mutex_unlock(m, m->thread_holding);
-  }
+  ~MutexLock() { Mutex_unlock(m, m->thread_holding); }
 };
 
 /** Scoped try lock class for ProxyMutex
@@ -474,28 +461,30 @@ private:
 public:
   MutexTryLock(
 #ifdef DEBUG
-                  const SrcLoc& location, const char *ahandler,
-#endif                          //DEBUG
-                  ProxyMutex * am, EThread * t) : m(am)
+    const SrcLoc &location, const char *ahandler,
+#endif // DEBUG
+    ProxyMutex *am, EThread *t)
+    : m(am)
   {
-      lock_acquired = Mutex_trylock(
+    lock_acquired = Mutex_trylock(
 #ifdef DEBUG
-                                     location, ahandler,
-#endif //DEBUG
-                                     m, t);
+      location, ahandler,
+#endif // DEBUG
+      m, t);
   }
 
   MutexTryLock(
 #ifdef DEBUG
-                const SrcLoc& location, const char *ahandler,
-#endif                          //DEBUG
-                ProxyMutex * am, EThread * t, int sp) : m(am)
+    const SrcLoc &location, const char *ahandler,
+#endif // DEBUG
+    ProxyMutex *am, EThread *t, int sp)
+    : m(am)
   {
-      lock_acquired = Mutex_trylock_spin(
+    lock_acquired = Mutex_trylock_spin(
 #ifdef DEBUG
-                                          location, ahandler,
-#endif //DEBUG
-                                          m, t, sp);
+      location, ahandler,
+#endif // DEBUG
+      m, t, sp);
   }
 
   ~MutexTryLock()
@@ -506,13 +495,15 @@ public:
 
   /** Spin till lock is acquired
    */
-  void acquire(EThread * t)
+  void
+  acquire(EThread *t)
   {
     MUTEX_TAKE_LOCK(m.m_ptr, t);
     lock_acquired = true;
   }
 
-  void release()
+  void
+  release()
   {
     ink_assert(lock_acquired); // generate a warning because it shouldn't be done.
     if (lock_acquired) {
@@ -521,8 +512,16 @@ public:
     lock_acquired = false;
   }
 
-  bool is_locked() const { return lock_acquired; }
-  const ProxyMutex* get_mutex() { return m.m_ptr; }
+  bool
+  is_locked() const
+  {
+    return lock_acquired;
+  }
+  const ProxyMutex *
+  get_mutex()
+  {
+    return m.m_ptr;
+  }
 };
 
 inline void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_PriorityEventQueue.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_PriorityEventQueue.h b/iocore/eventsystem/I_PriorityEventQueue.h
index aaa3717..3e649bc 100644
--- a/iocore/eventsystem/I_PriorityEventQueue.h
+++ b/iocore/eventsystem/I_PriorityEventQueue.h
@@ -29,30 +29,27 @@
 
 
 // <5ms, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120
-#define N_PQ_LIST        10
+#define N_PQ_LIST 10
 #define PQ_BUCKET_TIME(_i) (HRTIME_MSECONDS(5) << (_i))
 
 class EThread;
 
-struct PriorityEventQueue
-{
-
+struct PriorityEventQueue {
   Que(Event, link) after[N_PQ_LIST];
   ink_hrtime last_check_time;
   uint32_t last_check_buckets;
 
-  void enqueue(Event * e, ink_hrtime now)
+  void
+  enqueue(Event *e, ink_hrtime now)
   {
     ink_hrtime t = e->timeout_at - now;
     int i = 0;
     // equivalent but faster
-    if (t <= PQ_BUCKET_TIME(3))
-    {
+    if (t <= PQ_BUCKET_TIME(3)) {
       if (t <= PQ_BUCKET_TIME(1)) {
         if (t <= PQ_BUCKET_TIME(0)) {
           i = 0;
-        } else
-        {
+        } else {
           i = 1;
         }
       } else {
@@ -90,16 +87,18 @@ struct PriorityEventQueue
     after[i].enqueue(e);
   }
 
-  void remove(Event * e)
+  void
+  remove(Event *e)
   {
     ink_assert(e->in_the_priority_queue);
     e->in_the_priority_queue = 0;
     after[e->in_heap].remove(e);
   }
 
-  Event *dequeue_ready(ink_hrtime t)
+  Event *
+  dequeue_ready(ink_hrtime t)
   {
-    (void) t;
+    (void)t;
     Event *e = after[0].dequeue();
     if (e) {
       ink_assert(e->in_the_priority_queue);
@@ -108,9 +107,10 @@ struct PriorityEventQueue
     return e;
   }
 
-  void check_ready(ink_hrtime now, EThread * t);
+  void check_ready(ink_hrtime now, EThread *t);
 
-  ink_hrtime earliest_timeout()
+  ink_hrtime
+  earliest_timeout()
   {
     for (int i = 0; i < N_PQ_LIST; i++) {
       if (after[i].head)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Processor.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Processor.h b/iocore/eventsystem/I_Processor.h
index 66fa700..a97fae7 100644
--- a/iocore/eventsystem/I_Processor.h
+++ b/iocore/eventsystem/I_Processor.h
@@ -27,10 +27,10 @@
 
 #include "libts.h"
 
-#define PROCESSOR_RECONFIGURE            0x01
-#define PROCESSOR_CHECK                  0x02
-#define PROCESSOR_FIX                    0x04
-#define PROCESSOR_IGNORE_ERRORS          0x08
+#define PROCESSOR_RECONFIGURE 0x01
+#define PROCESSOR_CHECK 0x02
+#define PROCESSOR_FIX 0x04
+#define PROCESSOR_IGNORE_ERRORS 0x08
 
 class Processor;
 class Thread;
@@ -82,7 +82,8 @@ public:
     supported.
 
   */
-  virtual void shutdown()
+  virtual void
+  shutdown()
   {
   }
 
@@ -98,10 +99,11 @@ public:
     @param stacksize The thread stack size to use for this processor.
 
   */
-  virtual int start(int number_of_threads, size_t stacksize=DEFAULT_STACKSIZE)
+  virtual int
+  start(int number_of_threads, size_t stacksize = DEFAULT_STACKSIZE)
   {
-    (void) number_of_threads;
-    (void) stacksize;
+    (void)number_of_threads;
+    (void)stacksize;
     return 0;
   }
 
@@ -111,7 +113,7 @@ protected:
 private:
   // prevent unauthorized copies (Not implemented)
   Processor(const Processor &);
-  Processor & operator =(const Processor &);
+  Processor &operator=(const Processor &);
 };
 
 #endif //_I_Processor_h_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_ProtectedQueue.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_ProtectedQueue.h b/iocore/eventsystem/I_ProtectedQueue.h
index f291655..4d70e16 100644
--- a/iocore/eventsystem/I_ProtectedQueue.h
+++ b/iocore/eventsystem/I_ProtectedQueue.h
@@ -37,13 +37,12 @@
 
 #include "libts.h"
 #include "I_Event.h"
-struct ProtectedQueue
-{
-  void enqueue(Event * e,bool fast_signal=false);
+struct ProtectedQueue {
+  void enqueue(Event *e, bool fast_signal = false);
   void signal();
   int try_signal();             // Use non blocking lock and if acquired, signal
-  void enqueue_local(Event * e);        // Safe when called from the same thread
-  void remove(Event * e);
+  void enqueue_local(Event *e); // Safe when called from the same thread
+  void remove(Event *e);
   Event *dequeue_local();
   void dequeue_timed(ink_hrtime cur_time, ink_hrtime timeout, bool sleep);
 
@@ -55,6 +54,6 @@ struct ProtectedQueue
   ProtectedQueue();
 };
 
-void flush_signals(EThread * t);
+void flush_signals(EThread *t);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_ProxyAllocator.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_ProxyAllocator.h b/iocore/eventsystem/I_ProxyAllocator.h
index c47a074..32fc72d 100644
--- a/iocore/eventsystem/I_ProxyAllocator.h
+++ b/iocore/eventsystem/I_ProxyAllocator.h
@@ -38,22 +38,23 @@ class EThread;
 extern int thread_freelist_high_watermark;
 extern int thread_freelist_low_watermark;
 
-struct ProxyAllocator
-{
+struct ProxyAllocator {
   int allocated;
   void *freelist;
 
-  ProxyAllocator():allocated(0), freelist(0) { }
+  ProxyAllocator() : allocated(0), freelist(0) {}
 };
 
-template<class C> inline C * thread_alloc(ClassAllocator<C> &a, ProxyAllocator & l)
+template <class C>
+inline C *
+thread_alloc(ClassAllocator<C> &a, ProxyAllocator &l)
 {
 #if TS_USE_FREELIST && !TS_USE_RECLAIMABLE_FREELIST
   if (l.freelist) {
-    C *v = (C *) l.freelist;
-    l.freelist = *(C **) l.freelist;
+    C *v = (C *)l.freelist;
+    l.freelist = *(C **)l.freelist;
     --(l.allocated);
-    *(void **) v = *(void **) &a.proto.typeObject;
+    *(void **)v = *(void **)&a.proto.typeObject;
     return v;
   }
 #else
@@ -62,14 +63,16 @@ template<class C> inline C * thread_alloc(ClassAllocator<C> &a, ProxyAllocator &
   return a.alloc();
 }
 
-template<class C> inline C * thread_alloc_init(ClassAllocator<C> &a, ProxyAllocator & l)
+template <class C>
+inline C *
+thread_alloc_init(ClassAllocator<C> &a, ProxyAllocator &l)
 {
 #if TS_USE_FREELIST && !TS_USE_RECLAIMABLE_FREELIST
   if (l.freelist) {
-    C *v = (C *) l.freelist;
-    l.freelist = *(C **) l.freelist;
+    C *v = (C *)l.freelist;
+    l.freelist = *(C **)l.freelist;
     --(l.allocated);
-    memcpy((void *) v, (void *) &a.proto.typeObject, sizeof(C));
+    memcpy((void *)v, (void *)&a.proto.typeObject, sizeof(C));
     return v;
   }
 #else
@@ -78,7 +81,8 @@ template<class C> inline C * thread_alloc_init(ClassAllocator<C> &a, ProxyAlloca
   return a.alloc();
 }
 
-template<class C> inline void
+template <class C>
+inline void
 thread_free(ClassAllocator<C> &a, C *p)
 {
   a.free(p);
@@ -90,21 +94,22 @@ thread_free(Allocator &a, void *p)
   a.free_void(p);
 }
 
-template<class C> inline void
-thread_freeup(ClassAllocator<C> &a, ProxyAllocator & l)
+template <class C>
+inline void
+thread_freeup(ClassAllocator<C> &a, ProxyAllocator &l)
 {
 #if !TS_USE_RECLAIMABLE_FREELIST
-  C *head = (C *) l.freelist;
+  C *head = (C *)l.freelist;
 #endif
-  C *tail = (C *) l.freelist;
+  C *tail = (C *)l.freelist;
   size_t count = 0;
-  while(l.freelist && l.allocated > thread_freelist_low_watermark) {
-	  tail = (C *) l.freelist;
-	  l.freelist = *(C **) l.freelist;
-	  --(l.allocated);
-	  ++count;
+  while (l.freelist && l.allocated > thread_freelist_low_watermark) {
+    tail = (C *)l.freelist;
+    l.freelist = *(C **)l.freelist;
+    --(l.allocated);
+    ++count;
 #if TS_USE_RECLAIMABLE_FREELIST
-	  a.free(tail);
+    a.free(tail);
 #endif
   }
 #if !TS_USE_RECLAIMABLE_FREELIST
@@ -118,24 +123,26 @@ thread_freeup(ClassAllocator<C> &a, ProxyAllocator & l)
 #endif
 }
 
-void* thread_alloc(Allocator &a, ProxyAllocator &l);
+void *thread_alloc(Allocator &a, ProxyAllocator &l);
 void thread_freeup(Allocator &a, ProxyAllocator &l);
 
 #define THREAD_ALLOC(_a, _t) thread_alloc(::_a, _t->_a)
 #define THREAD_ALLOC_INIT(_a, _t) thread_alloc_init(::_a, _t->_a)
 #if TS_USE_FREELIST && !TS_USE_RECLAIMABLE_FREELIST
-#define THREAD_FREE(_p, _a, _t) do {            \
-  *(char **)_p = (char*)_t->_a.freelist;        \
-  _t->_a.freelist = _p;                         \
-  _t->_a.allocated++;                           \
-  if (_t->_a.allocated > thread_freelist_high_watermark)  \
-    thread_freeup(::_a, _t->_a);                \
-} while (0)
+#define THREAD_FREE(_p, _a, _t)                            \
+  do {                                                     \
+    *(char **)_p = (char *)_t->_a.freelist;                \
+    _t->_a.freelist = _p;                                  \
+    _t->_a.allocated++;                                    \
+    if (_t->_a.allocated > thread_freelist_high_watermark) \
+      thread_freeup(::_a, _t->_a);                         \
+  } while (0)
 #else /* !TS_USE_FREELIST || TS_USE_RECLAIMABLE_FREELIST */
-#define THREAD_FREE(_p, _a, _t) do {  \
-  (void)_t;                           \
-  thread_free(::_a, _p);              \
-} while (0)
+#define THREAD_FREE(_p, _a, _t) \
+  do {                          \
+    (void) _t;                  \
+    thread_free(::_a, _p);      \
+  } while (0)
 #endif
 
 #endif /* _ProxyAllocator_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_SocketManager.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_SocketManager.h b/iocore/eventsystem/I_SocketManager.h
index d294a5c..34b71a6 100644
--- a/iocore/eventsystem/I_SocketManager.h
+++ b/iocore/eventsystem/I_SocketManager.h
@@ -37,7 +37,7 @@
 #include "I_EventSystem.h"
 #include "I_Thread.h"
 
-#define DEFAULT_OPEN_MODE                         0644
+#define DEFAULT_OPEN_MODE 0644
 
 class Thread;
 extern int net_config_poll_timeout;
@@ -46,8 +46,7 @@ extern int net_config_poll_timeout;
 
 /** Utility class for socket operations.
  */
-struct SocketManager
-{
+struct SocketManager {
   SocketManager();
 
   // result is the socket or -errno
@@ -73,7 +72,7 @@ struct SocketManager
   int64_t pwrite(int fd, void *buf, int len, off_t offset, char *tag = NULL);
 
   int send(int fd, void *buf, int len, int flags);
-  int sendto(int fd, void *buf, int len, int flags, struct sockaddr const* to, int tolen);
+  int sendto(int fd, void *buf, int len, int flags, struct sockaddr const *to, int tolen);
   int sendmsg(int fd, struct msghdr *m, int flags, void *pOLP = 0);
   int64_t lseek(int fd, off_t offset, int whence);
   int fstat(int fd, struct stat *);
@@ -90,17 +89,14 @@ struct SocketManager
 #endif
 #if TS_USE_KQUEUE
   int kqueue();
-  int kevent(int kq, const struct kevent *changelist, int nchanges,
-             struct kevent *eventlist, int nevents,
+  int kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents,
              const struct timespec *timeout);
 #endif
 #if TS_USE_PORT
   int port_create();
-  int port_associate(int port, int fd, uintptr_t obj,
-                     int events, void *user);
+  int port_associate(int port, int fd, uintptr_t obj, int events, void *user);
   int port_dissociate(int port, int fd, uintptr_t obj);
-  int port_getn(int port, port_event_t *list, uint_t max,
-                uint_t *nget, timespec_t *timeout);
+  int port_getn(int port, port_event_t *list, uint_t max, uint_t *nget, timespec_t *timeout);
 #endif
   int shutdown(int s, int how);
   int dup(int s);
@@ -120,16 +116,16 @@ struct SocketManager
       @return 0 if successful, -errno on error.
    */
   int close(int sock);
-  int ink_bind(int s, struct sockaddr const* name, int namelen, short protocol = 0);
+  int ink_bind(int s, struct sockaddr const *name, int namelen, short protocol = 0);
 
   const size_t pagesize;
 
-  virtual ~ SocketManager();
+  virtual ~SocketManager();
 
 private:
   // just don't do it
-    SocketManager(SocketManager &);
-    SocketManager & operator=(SocketManager &);
+  SocketManager(SocketManager &);
+  SocketManager &operator=(SocketManager &);
 };
 
 extern SocketManager socketManager;


[08/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_inet.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_inet.cc b/lib/ts/ink_inet.cc
index 6fe7a3d..1812f75 100644
--- a/lib/ts/ink_inet.cc
+++ b/lib/ts/ink_inet.cc
@@ -25,18 +25,17 @@
 #include "ts/TestBox.h"
 
 #if defined(darwin)
-extern "C"
-{
-  struct hostent *gethostbyname_r(const char *name, struct hostent *result, char *buffer, int buflen, int *h_errnop);
-  struct hostent *gethostbyaddr_r(const char *name, size_t size, int type,
-                                  struct hostent *result, char *buffer, int buflen, int *h_errnop);
+extern "C" {
+struct hostent *gethostbyname_r(const char *name, struct hostent *result, char *buffer, int buflen, int *h_errnop);
+struct hostent *gethostbyaddr_r(const char *name, size_t size, int type, struct hostent *result, char *buffer, int buflen,
+                                int *h_errnop);
 }
 #endif
 
 IpAddr const IpAddr::INVALID;
 
 struct hostent *
-ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data * data)
+ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data *data)
 {
 #ifdef RENTRENT_GETHOSTBYNAME
   struct hostent *r = gethostbyname(hostname);
@@ -44,48 +43,39 @@ ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data * data)
     data->ent = *r;
   data->herrno = errno;
 
-#else //RENTRENT_GETHOSTBYNAME
+#else // RENTRENT_GETHOSTBYNAME
 #if GETHOSTBYNAME_R_GLIBC2
 
   struct hostent *addrp = NULL;
-  int res = gethostbyname_r(hostname, &data->ent, data->buf,
-                            INK_GETHOSTBYNAME_R_DATA_SIZE, &addrp,
-                            &data->herrno);
+  int res = gethostbyname_r(hostname, &data->ent, data->buf, INK_GETHOSTBYNAME_R_DATA_SIZE, &addrp, &data->herrno);
   struct hostent *r = NULL;
   if (!res && addrp)
     r = addrp;
 
 #else
-  struct hostent *r = gethostbyname_r(hostname, &data->ent, data->buf,
-                                      INK_GETHOSTBYNAME_R_DATA_SIZE,
-                                      &data->herrno);
+  struct hostent *r = gethostbyname_r(hostname, &data->ent, data->buf, INK_GETHOSTBYNAME_R_DATA_SIZE, &data->herrno);
 #endif
 #endif
   return r;
 }
 
 struct hostent *
-ink_gethostbyaddr_r(char *ip, int len, int type, ink_gethostbyaddr_r_data * data)
+ink_gethostbyaddr_r(char *ip, int len, int type, ink_gethostbyaddr_r_data *data)
 {
 #if GETHOSTBYNAME_R_GLIBC2
   struct hostent *r = NULL;
   struct hostent *addrp = NULL;
-  int res = gethostbyaddr_r((char *) ip, len, type, &data->ent, data->buf,
-                            INK_GETHOSTBYNAME_R_DATA_SIZE, &addrp,
-                            &data->herrno);
+  int res = gethostbyaddr_r((char *)ip, len, type, &data->ent, data->buf, INK_GETHOSTBYNAME_R_DATA_SIZE, &addrp, &data->herrno);
   if (!res && addrp)
     r = addrp;
 #else
 #ifdef RENTRENT_GETHOSTBYADDR
-  struct hostent *r = gethostbyaddr((const void *) ip, len, type);
+  struct hostent *r = gethostbyaddr((const void *)ip, len, type);
 
 #else
-  struct hostent *r = gethostbyaddr_r((char *) ip, len, type, &data->ent,
-                                      data->buf,
-                                      INK_GETHOSTBYNAME_R_DATA_SIZE,
-                                      &data->herrno);
+  struct hostent *r = gethostbyaddr_r((char *)ip, len, type, &data->ent, data->buf, INK_GETHOSTBYNAME_R_DATA_SIZE, &data->herrno);
 #endif
-#endif //LINUX
+#endif // LINUX
   return r;
 }
 
@@ -93,7 +83,7 @@ uint32_t
 ink_inet_addr(const char *s)
 {
   uint32_t u[4];
-  uint8_t *pc = (uint8_t *) s;
+  uint8_t *pc = (uint8_t *)s;
   int n = 0;
   uint32_t base = 10;
 
@@ -102,7 +92,6 @@ ink_inet_addr(const char *s)
   }
 
   while (n < 4) {
-
     u[n] = 0;
     base = 10;
 
@@ -157,9 +146,10 @@ ink_inet_addr(const char *s)
   return htonl((uint32_t)-1);
 }
 
-const char *ats_ip_ntop(const struct sockaddr *addr, char *dst, size_t size)
+const char *
+ats_ip_ntop(const struct sockaddr *addr, char *dst, size_t size)
 {
-  char const* zret = 0;
+  char const *zret = 0;
 
   switch (addr->sa_family) {
   case AF_INET:
@@ -176,40 +166,39 @@ const char *ats_ip_ntop(const struct sockaddr *addr, char *dst, size_t size)
   return zret;
 }
 
-char const*
-ats_ip_family_name(int family) {
-  return AF_INET == family ? "IPv4"
-    : AF_INET6 == family ? "IPv6"
-    : "Unspec"
-    ;
+char const *
+ats_ip_family_name(int family)
+{
+  return AF_INET == family ? "IPv4" : AF_INET6 == family ? "IPv6" : "Unspec";
 }
 
-char const* ats_ip_nptop(
-  sockaddr const* addr,
-  char* dst, size_t size
-) {
+char const *
+ats_ip_nptop(sockaddr const *addr, char *dst, size_t size)
+{
   char buff[INET6_ADDRPORTSTRLEN];
-  snprintf(dst, size, "%s:%u",
-    ats_ip_ntop(addr, buff, sizeof(buff)),
-    ats_ip_port_host_order(addr)
-  );
+  snprintf(dst, size, "%s:%u", ats_ip_ntop(addr, buff, sizeof(buff)), ats_ip_port_host_order(addr));
   return dst;
 }
 
 int
-ats_ip_parse(ts::ConstBuffer src, ts::ConstBuffer* addr, ts::ConstBuffer* port, ts::ConstBuffer* rest) {
+ats_ip_parse(ts::ConstBuffer src, ts::ConstBuffer *addr, ts::ConstBuffer *port, ts::ConstBuffer *rest)
+{
   // In case the incoming arguments are null.
   ts::ConstBuffer localAddr, localPort;
-  if (!addr) addr = &localAddr;
-  if (!port) port = &localPort;
+  if (!addr)
+    addr = &localAddr;
+  if (!port)
+    port = &localPort;
   addr->reset();
   port->reset();
-  if (rest) rest->reset();
+  if (rest)
+    rest->reset();
 
   // Let's see if we can find out what's in the address string.
   if (src) {
     bool colon_p = false;
-    while (src && ParseRules::is_ws(*src)) ++src;
+    while (src && ParseRules::is_ws(*src))
+      ++src;
     // Check for brackets.
     if ('[' == *src) {
       /* Ugly. In a number of places we must use bracket notation
@@ -234,8 +223,8 @@ ats_ip_parse(ts::ConstBuffer src, ts::ConstBuffer* addr, ts::ConstBuffer* port,
       }
     } else {
       ts::ConstBuffer post = src.after(':');
-      if (post.data() && ! post.find(':')) {
-        *addr = src.splitOn(post.data()-1);
+      if (post.data() && !post.find(':')) {
+        *addr = src.splitOn(post.data() - 1);
         colon_p = true;
       } else { // presume no port, use everything.
         *addr = src;
@@ -247,19 +236,20 @@ ats_ip_parse(ts::ConstBuffer src, ts::ConstBuffer* addr, ts::ConstBuffer* port,
       while (src && ParseRules::is_digit(*src))
         ++src;
 
-      if (tmp.data() == src.data()) { // no digits at all
-        src.set(tmp.data()-1, tmp.size()+1); // back up to include colon
+      if (tmp.data() == src.data()) {            // no digits at all
+        src.set(tmp.data() - 1, tmp.size() + 1); // back up to include colon
       } else {
         *port = tmp.clip(src.data());
       }
     }
-    if (rest) *rest = src;
+    if (rest)
+      *rest = src;
   }
   return *addr ? 0 : -1; // true if we found an address.
 }
 
 int
-ats_ip_pton(const ts::ConstBuffer& src, sockaddr* ip)
+ats_ip_pton(const ts::ConstBuffer &src, sockaddr *ip)
 {
   int zret = -1;
   ts::ConstBuffer addr, port;
@@ -267,8 +257,8 @@ ats_ip_pton(const ts::ConstBuffer& src, sockaddr* ip)
   ats_ip_invalidate(ip);
   if (0 == ats_ip_parse(src, &addr, &port)) {
     // Copy if not terminated.
-    if (0 != addr[addr.size()-1]) {
-      char* tmp = static_cast<char*>(alloca(addr.size()+1));
+    if (0 != addr[addr.size() - 1]) {
+      char *tmp = static_cast<char *>(alloca(addr.size() + 1));
       memcpy(tmp, addr.data(), addr.size());
       tmp[addr.size()] = 0;
       addr.set(tmp, addr.size());
@@ -295,7 +285,8 @@ ats_ip_pton(const ts::ConstBuffer& src, sockaddr* ip)
 }
 
 uint32_t
-ats_ip_hash(sockaddr const* addr) {
+ats_ip_hash(sockaddr const *addr)
+{
   union md5sum {
     unsigned char c[16];
     uint32_t i;
@@ -305,46 +296,46 @@ ats_ip_hash(sockaddr const* addr) {
   if (ats_is_ip4(addr)) {
     zret.i = ats_ip4_addr_cast(addr);
   } else if (ats_is_ip6(addr)) {
-    ink_code_md5(const_cast<uint8_t*>(ats_ip_addr8_cast(addr)), TS_IP6_SIZE, zret.c);
+    ink_code_md5(const_cast<uint8_t *>(ats_ip_addr8_cast(addr)), TS_IP6_SIZE, zret.c);
   }
   return zret.i;
 }
 
 int
-ats_ip_to_hex(sockaddr const* src, char* dst, size_t len) {
+ats_ip_to_hex(sockaddr const *src, char *dst, size_t len)
+{
   int zret = 0;
   ink_assert(len);
-  char const* dst_limit = dst + len - 1; // reserve null space.
+  char const *dst_limit = dst + len - 1; // reserve null space.
   if (ats_is_ip(src)) {
-    uint8_t const* data = ats_ip_addr8_cast(src);
-    for ( uint8_t const* src_limit = data + ats_ip_addr_size(src)
-        ; data < src_limit && dst+1 < dst_limit
-        ; ++data, zret += 2
-    ) {
-    uint8_t n1 = (*data >> 4) & 0xF; // high nybble.
-    uint8_t n0 = *data & 0xF; // low nybble.
-
-    *dst++ = n1 > 9 ? n1 + 'A' - 10 : n1 + '0';
-    *dst++ = n0 > 9 ? n0 + 'A' - 10 : n0 + '0';
+    uint8_t const *data = ats_ip_addr8_cast(src);
+    for (uint8_t const *src_limit = data + ats_ip_addr_size(src); data < src_limit && dst + 1 < dst_limit; ++data, zret += 2) {
+      uint8_t n1 = (*data >> 4) & 0xF; // high nybble.
+      uint8_t n0 = *data & 0xF;        // low nybble.
+
+      *dst++ = n1 > 9 ? n1 + 'A' - 10 : n1 + '0';
+      *dst++ = n0 > 9 ? n0 + 'A' - 10 : n0 + '0';
     }
   }
   *dst = 0; // terminate but don't include that in the length.
   return zret;
 }
 
-sockaddr* ats_ip_set(
-  sockaddr* dst,
-  IpAddr const& addr,
-  uint16_t port
-) {
-  if (AF_INET == addr._family) ats_ip4_set(dst, addr._addr._ip4, port);
-  else if (AF_INET6 == addr._family) ats_ip6_set(dst, addr._addr._ip6, port);
-  else ats_ip_invalidate(dst);
+sockaddr *
+ats_ip_set(sockaddr *dst, IpAddr const &addr, uint16_t port)
+{
+  if (AF_INET == addr._family)
+    ats_ip4_set(dst, addr._addr._ip4, port);
+  else if (AF_INET6 == addr._family)
+    ats_ip6_set(dst, addr._addr._ip6, port);
+  else
+    ats_ip_invalidate(dst);
   return dst;
 }
 
 int
-IpAddr::load(char const* text) {
+IpAddr::load(char const *text)
+{
   IpEndpoint ip;
   int zret = ats_ip_pton(text, &ip);
   *this = ip;
@@ -352,7 +343,7 @@ IpAddr::load(char const* text) {
 }
 
 int
-IpAddr::load(ts::ConstBuffer const& text)
+IpAddr::load(ts::ConstBuffer const &text)
 {
   IpEndpoint ip;
   int zret = ats_ip_pton(text, &ip.sa);
@@ -360,8 +351,9 @@ IpAddr::load(ts::ConstBuffer const& text)
   return zret;
 }
 
-char*
-IpAddr::toString(char* dest, size_t len) const {
+char *
+IpAddr::toString(char *dest, size_t len) const
+{
   IpEndpoint ip;
   ip.assign(*this);
   ats_ip_ntop(&ip, dest, len);
@@ -369,14 +361,13 @@ IpAddr::toString(char* dest, size_t len) const {
 }
 
 bool
-IpAddr::isMulticast() const {
-  return (AF_INET == _family && 0xe == (_addr._byte[0] >> 4)) ||
-    (AF_INET6 == _family && IN6_IS_ADDR_MULTICAST(&_addr._ip6))
-    ;
+IpAddr::isMulticast() const
+{
+  return (AF_INET == _family && 0xe == (_addr._byte[0] >> 4)) || (AF_INET6 == _family && IN6_IS_ADDR_MULTICAST(&_addr._ip6));
 }
 
-bool
-operator == (IpAddr const& lhs, sockaddr const* rhs) {
+bool operator==(IpAddr const &lhs, sockaddr const *rhs)
+{
   bool zret = false;
   if (lhs._family == rhs->sa_family) {
     if (AF_INET == lhs._family) {
@@ -406,7 +397,8 @@ operator == (IpAddr const& lhs, sockaddr const* rhs) {
       - 1 if @a lhs is greater than @a rhs.
 */
 int
-IpAddr::cmp(self const& that) const {
+IpAddr::cmp(self const &that) const
+{
   int zret = 0;
   uint16_t rtype = that._family;
   uint16_t ltype = _family;
@@ -417,9 +409,12 @@ IpAddr::cmp(self const& that) const {
     if (AF_INET == rtype) {
       in_addr_t la = ntohl(_addr._ip4);
       in_addr_t ra = ntohl(that._addr._ip4);
-      if (la < ra) zret = -1;
-      else if (la > ra) zret = 1;
-      else zret = 0;
+      if (la < ra)
+        zret = -1;
+      else if (la > ra)
+        zret = 1;
+      else
+        zret = 0;
     } else if (AF_INET6 == rtype) { // IPv4 < IPv6
       zret = -1;
     } else { // IP > not IP
@@ -442,24 +437,24 @@ IpAddr::cmp(self const& that) const {
 }
 
 int
-ats_ip_getbestaddrinfo(char const* host,
-  IpEndpoint* ip4,
-  IpEndpoint* ip6
-) {
+ats_ip_getbestaddrinfo(char const *host, IpEndpoint *ip4, IpEndpoint *ip6)
+{
   int zret = -1;
   int port = 0; // port value to assign if we find an address.
   addrinfo ai_hints;
-  addrinfo* ai_result;
+  addrinfo *ai_result;
   ts::ConstBuffer addr_text, port_text;
-  ts::ConstBuffer src(host, strlen(host)+1);
+  ts::ConstBuffer src(host, strlen(host) + 1);
 
-  if (ip4) ats_ip_invalidate(ip4);
-  if (ip6) ats_ip_invalidate(ip6);
+  if (ip4)
+    ats_ip_invalidate(ip4);
+  if (ip6)
+    ats_ip_invalidate(ip6);
 
   if (0 == ats_ip_parse(src, &addr_text, &port_text)) {
     // Copy if not terminated.
-    if (0 != addr_text[addr_text.size()-1]) {
-      char* tmp = static_cast<char*>(alloca(addr_text.size()+1));
+    if (0 != addr_text[addr_text.size() - 1]) {
+      char *tmp = static_cast<char *>(alloca(addr_text.size() + 1));
       memcpy(tmp, addr_text.data(), addr_text.size());
       tmp[addr_text.size()] = 0;
       addr_text.set(tmp, addr_text.size());
@@ -478,23 +473,28 @@ ats_ip_getbestaddrinfo(char const* host,
         PR, // Private.
         MC, // Multicast.
         GL  // Global.
-      } spot_type = NA, ip4_type = NA, ip6_type = NA;
-      sockaddr const* ip4_src = 0;
-      sockaddr const* ip6_src = 0;
-
-      for ( addrinfo* ai_spot = ai_result
-          ; ai_spot
-          ; ai_spot = ai_spot->ai_next
-      ) {
-        sockaddr const* ai_ip = ai_spot->ai_addr;
-        if (!ats_is_ip(ai_ip)) spot_type = NA;
-        else if (ats_is_ip_loopback(ai_ip)) spot_type = LO;
-        else if (ats_is_ip_linklocal(ai_ip)) spot_type = LL;
-        else if (ats_is_ip_private(ai_ip)) spot_type = PR;
-        else if (ats_is_ip_multicast(ai_ip)) spot_type = MC;
-        else spot_type = GL;
-
-        if (spot_type == NA) continue; // Next!
+      } spot_type = NA,
+        ip4_type = NA, ip6_type = NA;
+      sockaddr const *ip4_src = 0;
+      sockaddr const *ip6_src = 0;
+
+      for (addrinfo *ai_spot = ai_result; ai_spot; ai_spot = ai_spot->ai_next) {
+        sockaddr const *ai_ip = ai_spot->ai_addr;
+        if (!ats_is_ip(ai_ip))
+          spot_type = NA;
+        else if (ats_is_ip_loopback(ai_ip))
+          spot_type = LO;
+        else if (ats_is_ip_linklocal(ai_ip))
+          spot_type = LL;
+        else if (ats_is_ip_private(ai_ip))
+          spot_type = PR;
+        else if (ats_is_ip_multicast(ai_ip))
+          spot_type = MC;
+        else
+          spot_type = GL;
+
+        if (spot_type == NA)
+          continue; // Next!
 
         if (ats_is_ip4(ai_ip)) {
           if (spot_type > ip4_type) {
@@ -508,97 +508,105 @@ ats_ip_getbestaddrinfo(char const* host,
           }
         }
       }
-      if (ip4_type > NA) ats_ip_copy(ip4, ip4_src);
-      if (ip6_type > NA) ats_ip_copy(ip6, ip6_src);
+      if (ip4_type > NA)
+        ats_ip_copy(ip4, ip4_src);
+      if (ip6_type > NA)
+        ats_ip_copy(ip6, ip6_src);
       freeaddrinfo(ai_result); // free *after* the copy.
-
     }
   }
 
   // We don't really care if the port is null terminated - the parser
   // would get all the digits so the next character is a non-digit (null or
   // not) and atoi will do the right thing in either case.
-  if (port_text.size()) port = htons(atoi(port_text.data()));
-  if (ats_is_ip(ip4)) ats_ip_port_cast(ip4) = port;
-  if (ats_is_ip(ip6)) ats_ip_port_cast(ip6) = port;
-
-  if (!ats_is_ip(ip4) && !ats_is_ip(ip6)) zret = -1;
+  if (port_text.size())
+    port = htons(atoi(port_text.data()));
+  if (ats_is_ip(ip4))
+    ats_ip_port_cast(ip4) = port;
+  if (ats_is_ip(ip6))
+    ats_ip_port_cast(ip6) = port;
+
+  if (!ats_is_ip(ip4) && !ats_is_ip(ip6))
+    zret = -1;
 
   return zret;
 }
 
 int
-ats_ip_check_characters(ts::ConstBuffer text) {
+ats_ip_check_characters(ts::ConstBuffer text)
+{
   bool found_colon = false;
   bool found_hex = false;
-  for ( char const *p = text.data(), *limit = p + text.size()
-      ; p < limit
-      ; ++p
-  )
-    if (':' == *p) found_colon = true;
-    else if ('.' == *p || isdigit(*p)) /* empty */;
-    else if (isxdigit(*p)) found_hex = true;
-    else return AF_UNSPEC;
-
-  return found_hex && !found_colon ? AF_UNSPEC
-    : found_colon ? AF_INET6
-    : AF_INET
-    ;
+  for (char const *p = text.data(), *limit = p + text.size(); p < limit; ++p)
+    if (':' == *p)
+      found_colon = true;
+    else if ('.' == *p || isdigit(*p)) /* empty */
+      ;
+    else if (isxdigit(*p))
+      found_hex = true;
+    else
+      return AF_UNSPEC;
+
+  return found_hex && !found_colon ? AF_UNSPEC : found_colon ? AF_INET6 : AF_INET;
 }
 
 // Need to declare this type globally so gcc 4.4 can use it in the countof() template ...
-struct ip_parse_spec { char const* hostspec; char const* host; char const* port; char const* rest;};
-
-REGRESSION_TEST(Ink_Inet) (RegressionTest * t, int /* atype */, int * pstatus) {
+struct ip_parse_spec {
+  char const *hostspec;
+  char const *host;
+  char const *port;
+  char const *rest;
+};
+
+REGRESSION_TEST(Ink_Inet)(RegressionTest *t, int /* atype */, int *pstatus)
+{
   TestBox box(t, pstatus);
-  IpEndpoint  ep;
-  IpAddr      addr;
+  IpEndpoint ep;
+  IpAddr addr;
 
   box = REGRESSION_TEST_PASSED;
 
   // Test ats_ip_parse() ...
   {
-    struct ip_parse_spec names[] = {
-      { "::", "::", NULL, NULL },
-      { "[::1]:99", "::1", "99", NULL },
-      { "127.0.0.1:8080", "127.0.0.1", "8080", NULL },
-      { "127.0.0.1:8080-Bob", "127.0.0.1", "8080", "-Bob" },
-      { "127.0.0.1:", "127.0.0.1", NULL, ":" },
-      { "foo.example.com", "foo.example.com", NULL, NULL },
-      { "foo.example.com:99", "foo.example.com", "99", NULL },
-      { "ffee::24c3:3349:3cee:0143", "ffee::24c3:3349:3cee:0143", NULL },
-      { "fe80:88b5:4a:20c:29ff:feae:1c33:8080", "fe80:88b5:4a:20c:29ff:feae:1c33:8080", NULL, NULL },
-      { "[ffee::24c3:3349:3cee:0143]", "ffee::24c3:3349:3cee:0143", NULL },
-      { "[ffee::24c3:3349:3cee:0143]:80", "ffee::24c3:3349:3cee:0143", "80", NULL },
-      { "[ffee::24c3:3349:3cee:0143]:8080x", "ffee::24c3:3349:3cee:0143", "8080", "x" }
-    };
+    struct ip_parse_spec names[] = {{"::", "::", NULL, NULL},
+                                    {"[::1]:99", "::1", "99", NULL},
+                                    {"127.0.0.1:8080", "127.0.0.1", "8080", NULL},
+                                    {"127.0.0.1:8080-Bob", "127.0.0.1", "8080", "-Bob"},
+                                    {"127.0.0.1:", "127.0.0.1", NULL, ":"},
+                                    {"foo.example.com", "foo.example.com", NULL, NULL},
+                                    {"foo.example.com:99", "foo.example.com", "99", NULL},
+                                    {"ffee::24c3:3349:3cee:0143", "ffee::24c3:3349:3cee:0143", NULL},
+                                    {"fe80:88b5:4a:20c:29ff:feae:1c33:8080", "fe80:88b5:4a:20c:29ff:feae:1c33:8080", NULL, NULL},
+                                    {"[ffee::24c3:3349:3cee:0143]", "ffee::24c3:3349:3cee:0143", NULL},
+                                    {"[ffee::24c3:3349:3cee:0143]:80", "ffee::24c3:3349:3cee:0143", "80", NULL},
+                                    {"[ffee::24c3:3349:3cee:0143]:8080x", "ffee::24c3:3349:3cee:0143", "8080", "x"}};
 
     for (unsigned i = 0; i < countof(names); ++i) {
-      ip_parse_spec const& s = names[i];
+      ip_parse_spec const &s = names[i];
       ts::ConstBuffer host, port, rest;
       size_t len;
 
-      box.check(ats_ip_parse(ts::ConstBuffer(s.hostspec, strlen(s.hostspec)), &host, &port, &rest) == 0,
-                "ats_ip_parse(%s)", s.hostspec);
+      box.check(ats_ip_parse(ts::ConstBuffer(s.hostspec, strlen(s.hostspec)), &host, &port, &rest) == 0, "ats_ip_parse(%s)",
+                s.hostspec);
       len = strlen(s.host);
-      box.check(len == host.size() && strncmp(host.data(), s.host, host.size()) ==  0,
-                "ats_ip_parse(%s) gave addr '%.*s'", s.hostspec, static_cast<int>(host.size()), host.data());
+      box.check(len == host.size() && strncmp(host.data(), s.host, host.size()) == 0, "ats_ip_parse(%s) gave addr '%.*s'",
+                s.hostspec, static_cast<int>(host.size()), host.data());
       if (s.port) {
         len = strlen(s.port);
-        box.check(len == port.size() && strncmp(port.data(), s.port, port.size()) ==  0,
-                  "ats_ip_parse(%s) gave port '%.*s'", s.hostspec, static_cast<int>(port.size()), port.data());
+        box.check(len == port.size() && strncmp(port.data(), s.port, port.size()) == 0, "ats_ip_parse(%s) gave port '%.*s'",
+                  s.hostspec, static_cast<int>(port.size()), port.data());
       } else {
-        box.check(port.size() == 0,
-                  "ats_ip_parse(%s) gave port '%.*s' instead of empty", s.hostspec, static_cast<int>(port.size()), port.data());
+        box.check(port.size() == 0, "ats_ip_parse(%s) gave port '%.*s' instead of empty", s.hostspec, static_cast<int>(port.size()),
+                  port.data());
       }
 
       if (s.rest) {
         len = strlen(s.rest);
-        box.check(len == rest.size() && strncmp(rest.data(), s.rest, len) == 0
-                  , "ats_ip_parse(%s) gave rest '%.*s' instead of '%s'", s.hostspec, static_cast<int>(rest.size()), rest.data(), s.rest);
+        box.check(len == rest.size() && strncmp(rest.data(), s.rest, len) == 0, "ats_ip_parse(%s) gave rest '%.*s' instead of '%s'",
+                  s.hostspec, static_cast<int>(rest.size()), rest.data(), s.rest);
       } else {
-        box.check(rest.size() == 0,
-                  "ats_ip_parse(%s) gave rest '%.*s' instead of empty", s.hostspec, static_cast<int>(rest.size()), rest.data());
+        box.check(rest.size() == 0, "ats_ip_parse(%s) gave rest '%.*s' instead of empty", s.hostspec, static_cast<int>(rest.size()),
+                  rest.data());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_inet.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_inet.h b/lib/ts/ink_inet.h
index 5e4c5d4..553f444 100644
--- a/lib/ts/ink_inet.h
+++ b/lib/ts/ink_inet.h
@@ -22,7 +22,7 @@
 
  */
 
-#if !defined (_ink_inet_h_)
+#if !defined(_ink_inet_h_)
 #define _ink_inet_h_
 
 #include <netinet/in.h>
@@ -35,12 +35,14 @@
 #define INK_GETHOSTBYNAME_R_DATA_SIZE 1024
 #define INK_GETHOSTBYADDR_R_DATA_SIZE 1024
 
-#if ! TS_HAS_IN6_IS_ADDR_UNSPECIFIED
+#if !TS_HAS_IN6_IS_ADDR_UNSPECIFIED
 #if defined(IN6_IS_ADDR_UNSPECIFIED)
 #undef IN6_IS_ADDR_UNSPECIFIED
 #endif
-static inline bool IN6_IS_ADDR_UNSPECIFIED(in6_addr const* addr) {
-  uint64_t const* w = reinterpret_cast<uint64_t const*>(addr);
+static inline bool
+IN6_IS_ADDR_UNSPECIFIED(in6_addr const *addr)
+{
+  uint64_t const *w = reinterpret_cast<uint64_t const *>(addr);
   return 0 == w[0] && 0 == w[1];
 }
 #endif
@@ -65,18 +67,16 @@ struct IpAddr; // forward declare.
 union IpEndpoint {
   typedef IpEndpoint self; ///< Self reference type.
 
-  struct sockaddr         sa; ///< Generic address.
-  struct sockaddr_in      sin; ///< IPv4
-  struct sockaddr_in6     sin6; ///< IPv6
+  struct sockaddr sa;       ///< Generic address.
+  struct sockaddr_in sin;   ///< IPv4
+  struct sockaddr_in6 sin6; ///< IPv6
 
-  self& assign(
-    sockaddr const* ip ///< Source address, family, port.
-  );
+  self &assign(sockaddr const *ip ///< Source address, family, port.
+               );
   /// Construct from an @a addr and @a port.
-  self& assign(
-    IpAddr const& addr, ///< Address and address family.
-    in_port_t port = 0 ///< Port (network order).
-  );
+  self &assign(IpAddr const &addr, ///< Address and address family.
+               in_port_t port = 0  ///< Port (network order).
+               );
 
   /// Test for valid IP address.
   bool isValid() const;
@@ -90,35 +90,31 @@ union IpEndpoint {
   /// Set to be any address for family @a family.
   /// @a family must be @c AF_INET or @c AF_INET6.
   /// @return This object.
-  self& setToAnyAddr(
-    int family ///< Address family.
-  );
+  self &setToAnyAddr(int family ///< Address family.
+                     );
   /// Set to be loopback for family @a family.
   /// @a family must be @c AF_INET or @c AF_INET6.
   /// @return This object.
-  self& setToLoopback(
-    int family ///< Address family.
-  );
+  self &setToLoopback(int family ///< Address family.
+                      );
 
 
   /// Port in network order.
-  in_port_t& port();
+  in_port_t &port();
   /// Port in network order.
   in_port_t port() const;
 
-  operator sockaddr* () { return &sa; }
-  operator sockaddr const* () const { return &sa; }
+  operator sockaddr *() { return &sa; }
+  operator sockaddr const *() const { return &sa; }
 };
 
-struct ink_gethostbyname_r_data
-{
+struct ink_gethostbyname_r_data {
   int herrno;
   struct hostent ent;
   char buf[INK_GETHOSTBYNAME_R_DATA_SIZE];
 };
 
-struct ink_gethostbyaddr_r_data
-{
+struct ink_gethostbyaddr_r_data {
   int herrno;
   struct hostent ent;
   char buf[INK_GETHOSTBYADDR_R_DATA_SIZE];
@@ -133,7 +129,7 @@ struct ink_gethostbyaddr_r_data
   @param data pointer to ink_gethostbyname_r_data allocated by the caller
 
 */
-struct hostent *ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data * data);
+struct hostent *ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data *data);
 
 /**
   Wrapper for gethostbyaddr_r(). If successful, returns a pointer
@@ -146,7 +142,7 @@ struct hostent *ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data * d
   @param data pointer to ink_gethostbyname_r_data allocated by the caller
 
 */
-struct hostent *ink_gethostbyaddr_r(char *ip, int len, int type, ink_gethostbyaddr_r_data * data);
+struct hostent *ink_gethostbyaddr_r(char *ip, int len, int type, ink_gethostbyaddr_r_data *data);
 
 /** Parse a string for pieces of an IP address.
 
@@ -161,13 +157,11 @@ struct hostent *ink_gethostbyaddr_r(char *ip, int len, int type, ink_gethostbyad
 
     @return 0 if an address was found, non-zero otherwise.
 */
-int
-ats_ip_parse(
-             ts::ConstBuffer src, ///< [in] String to search.
-             ts::ConstBuffer* addr, ///< [out] Range containing IP address.
-             ts::ConstBuffer* port, ///< [out] Range containing port.
-	     ts::ConstBuffer* rest = 0 ///< [out] Remnant past the addr/port if any.
-);
+int ats_ip_parse(ts::ConstBuffer src,      ///< [in] String to search.
+                 ts::ConstBuffer *addr,    ///< [out] Range containing IP address.
+                 ts::ConstBuffer *port,    ///< [out] Range containing port.
+                 ts::ConstBuffer *rest = 0 ///< [out] Remnant past the addr/port if any.
+                 );
 
 /**  Check to see if a buffer contains only IP address characters.
      @return
@@ -175,8 +169,7 @@ ats_ip_parse(
     - AF_INET - only digits and dots.
     - AF_INET6 - colons found.
 */
-int
-ats_ip_check_characters(ts::ConstBuffer text);
+int ats_ip_check_characters(ts::ConstBuffer text);
 
 /**
   Wrapper for inet_addr().
@@ -194,87 +187,108 @@ static size_t const TS_IP6_SIZE = sizeof(in6_addr);
 
 /// Reset an address to invalid.
 /// @note Useful for marking a member as not yet set.
-inline void ats_ip_invalidate(sockaddr* addr) {
+inline void
+ats_ip_invalidate(sockaddr *addr)
+{
   addr->sa_family = AF_UNSPEC;
 }
-inline void ats_ip_invalidate(sockaddr_in6* addr) {
+inline void
+ats_ip_invalidate(sockaddr_in6 *addr)
+{
   addr->sin6_family = AF_UNSPEC;
 }
-inline void ats_ip_invalidate(IpEndpoint* ip) {
+inline void
+ats_ip_invalidate(IpEndpoint *ip)
+{
   ip->sa.sa_family = AF_UNSPEC;
 }
 
 /** Get a string name for an IP address family.
     @return The string name (never @c NULL).
 */
-char const*
-ats_ip_family_name(int family);
+char const *ats_ip_family_name(int family);
 
 /// Test for IP protocol.
 /// @return @c true if the address is IP, @c false otherwise.
-inline bool ats_is_ip(sockaddr const* addr) {
-  return addr
-    && (AF_INET == addr->sa_family || AF_INET6 == addr->sa_family);
+inline bool
+ats_is_ip(sockaddr const *addr)
+{
+  return addr && (AF_INET == addr->sa_family || AF_INET6 == addr->sa_family);
 }
 /// @return @c true if the address is IP, @c false otherwise.
-inline bool ats_is_ip(IpEndpoint const* addr) {
-  return addr
-    && (AF_INET == addr->sa.sa_family || AF_INET6 == addr->sa.sa_family);
+inline bool
+ats_is_ip(IpEndpoint const *addr)
+{
+  return addr && (AF_INET == addr->sa.sa_family || AF_INET6 == addr->sa.sa_family);
 }
 /// Test for IP protocol.
 /// @return @c true if the value is an IP address family, @c false otherwise.
-inline bool ats_is_ip(int family) {
+inline bool
+ats_is_ip(int family)
+{
   return AF_INET == family || AF_INET6 == family;
 }
 /// Test for IPv4 protocol.
 /// @return @c true if the address is IPv4, @c false otherwise.
-inline bool ats_is_ip4(sockaddr const* addr) {
+inline bool
+ats_is_ip4(sockaddr const *addr)
+{
   return addr && AF_INET == addr->sa_family;
 }
 /// Test for IPv4 protocol.
 /// @note Convenience overload.
 /// @return @c true if the address is IPv4, @c false otherwise.
-inline bool ats_is_ip4(IpEndpoint const* addr) {
+inline bool
+ats_is_ip4(IpEndpoint const *addr)
+{
   return addr && AF_INET == addr->sa.sa_family;
 }
 /// Test for IPv6 protocol.
 /// @return @c true if the address is IPv6, @c false otherwise.
-inline bool ats_is_ip6(sockaddr const* addr) {
+inline bool
+ats_is_ip6(sockaddr const *addr)
+{
   return addr && AF_INET6 == addr->sa_family;
 }
 /// Test for IPv6 protocol.
 /// @note Convenience overload.
 /// @return @c true if the address is IPv6, @c false otherwise.
-inline bool ats_is_ip6(IpEndpoint const* addr) {
+inline bool
+ats_is_ip6(IpEndpoint const *addr)
+{
   return addr && AF_INET6 == addr->sa.sa_family;
 }
 
 /// @return @c true if the address families are compatible.
-inline bool ats_ip_are_compatible(
-  sockaddr const* lhs, ///< Address to test.
-  sockaddr const* rhs  ///< Address to test.
-) {
+inline bool
+ats_ip_are_compatible(sockaddr const *lhs, ///< Address to test.
+                      sockaddr const *rhs  ///< Address to test.
+                      )
+{
   return lhs->sa_family == rhs->sa_family;
 }
 /// @return @c true if the address families are compatible.
-inline bool ats_ip_are_compatible(
-  IpEndpoint const* lhs, ///< Address to test.
-  IpEndpoint const* rhs  ///< Address to test.
-) {
+inline bool
+ats_ip_are_compatible(IpEndpoint const *lhs, ///< Address to test.
+                      IpEndpoint const *rhs  ///< Address to test.
+                      )
+{
   return ats_ip_are_compatible(&lhs->sa, &rhs->sa);
 }
 /// @return @c true if the address families are compatible.
-inline bool ats_ip_are_compatible(
-  int lhs, ///< Address family to test.
-  sockaddr const* rhs  ///< Address to test.
-) {
+inline bool
+ats_ip_are_compatible(int lhs,            ///< Address family to test.
+                      sockaddr const *rhs ///< Address to test.
+                      )
+{
   return lhs == rhs->sa_family;
 }
 /// @return @c true if the address families are compatible.
-inline bool ats_ip_are_compatible(
-  sockaddr const* lhs, ///< Address to test.
-  int rhs  ///< Family to test.
-) {
+inline bool
+ats_ip_are_compatible(sockaddr const *lhs, ///< Address to test.
+                      int rhs              ///< Family to test.
+                      )
+{
   return lhs->sa_family == rhs;
 }
 
@@ -284,108 +298,140 @@ inline bool ats_ip_are_compatible(
 // ip4_cast converts to sockaddr_in (because that's effectively an IPv4 addr).
 // ip6_cast converts to sockaddr_in6
 
-inline sockaddr* ats_ip_sa_cast(sockaddr_storage* a) {
-  return static_cast<sockaddr*>(static_cast<void*>(a));
+inline sockaddr *
+ats_ip_sa_cast(sockaddr_storage *a)
+{
+  return static_cast<sockaddr *>(static_cast<void *>(a));
 }
-inline sockaddr const* ats_ip_sa_cast(sockaddr_storage const* a) {
-  return static_cast<sockaddr const*>(static_cast<void const*>(a));
+inline sockaddr const *
+ats_ip_sa_cast(sockaddr_storage const *a)
+{
+  return static_cast<sockaddr const *>(static_cast<void const *>(a));
 }
 
-inline sockaddr* ats_ip_sa_cast(sockaddr_in* a) {
-  return static_cast<sockaddr*>(static_cast<void*>(a));
+inline sockaddr *
+ats_ip_sa_cast(sockaddr_in *a)
+{
+  return static_cast<sockaddr *>(static_cast<void *>(a));
 }
-inline sockaddr const* ats_ip_sa_cast(sockaddr_in const* a) {
-  return static_cast<sockaddr const*>(static_cast<void const*>(a));
+inline sockaddr const *
+ats_ip_sa_cast(sockaddr_in const *a)
+{
+  return static_cast<sockaddr const *>(static_cast<void const *>(a));
 }
 
-inline sockaddr* ats_ip_sa_cast(sockaddr_in6* a) {
-  return static_cast<sockaddr*>(static_cast<void*>(a));
+inline sockaddr *
+ats_ip_sa_cast(sockaddr_in6 *a)
+{
+  return static_cast<sockaddr *>(static_cast<void *>(a));
 }
-inline sockaddr const* ats_ip_sa_cast(sockaddr_in6 const* a) {
-  return static_cast<sockaddr const*>(static_cast<void const*>(a));
+inline sockaddr const *
+ats_ip_sa_cast(sockaddr_in6 const *a)
+{
+  return static_cast<sockaddr const *>(static_cast<void const *>(a));
 }
 
-inline sockaddr_storage* ats_ip_ss_cast(sockaddr* a) {
-  return static_cast<sockaddr_storage*>(static_cast<void*>(a));
+inline sockaddr_storage *
+ats_ip_ss_cast(sockaddr *a)
+{
+  return static_cast<sockaddr_storage *>(static_cast<void *>(a));
 }
-inline sockaddr_storage const* ats_ip_ss_cast(sockaddr const* a) {
-  return static_cast<sockaddr_storage const*>(static_cast<void const*>(a));
+inline sockaddr_storage const *
+ats_ip_ss_cast(sockaddr const *a)
+{
+  return static_cast<sockaddr_storage const *>(static_cast<void const *>(a));
 }
 
-inline sockaddr_in* ats_ip4_cast(sockaddr* a) {
-  return static_cast<sockaddr_in*>(static_cast<void*>(a));
+inline sockaddr_in *
+ats_ip4_cast(sockaddr *a)
+{
+  return static_cast<sockaddr_in *>(static_cast<void *>(a));
 }
-inline sockaddr_in const* ats_ip4_cast(sockaddr const* a) {
-  return static_cast<sockaddr_in const*>(static_cast<void const*>(a));
+inline sockaddr_in const *
+ats_ip4_cast(sockaddr const *a)
+{
+  return static_cast<sockaddr_in const *>(static_cast<void const *>(a));
 }
 
-inline sockaddr_in& ats_ip4_cast(sockaddr& a) {
-  return *static_cast<sockaddr_in*>(static_cast<void*>(&a));
+inline sockaddr_in &
+ats_ip4_cast(sockaddr &a)
+{
+  return *static_cast<sockaddr_in *>(static_cast<void *>(&a));
 }
-inline sockaddr_in const& ats_ip4_cast(sockaddr const& a) {
-  return *static_cast<sockaddr_in const*>(static_cast<void const*>(&a));
+inline sockaddr_in const &
+ats_ip4_cast(sockaddr const &a)
+{
+  return *static_cast<sockaddr_in const *>(static_cast<void const *>(&a));
 }
 
-inline sockaddr_in* ats_ip4_cast(sockaddr_in6* a) {
-  return static_cast<sockaddr_in*>(static_cast<void*>(a));
+inline sockaddr_in *
+ats_ip4_cast(sockaddr_in6 *a)
+{
+  return static_cast<sockaddr_in *>(static_cast<void *>(a));
 }
-inline sockaddr_in const* ats_ip4_cast(sockaddr_in6 const* a) {
-  return static_cast<sockaddr_in const*>(static_cast<void const*>(a));
+inline sockaddr_in const *
+ats_ip4_cast(sockaddr_in6 const *a)
+{
+  return static_cast<sockaddr_in const *>(static_cast<void const *>(a));
 }
 
-inline sockaddr_in& ats_ip4_cast(sockaddr_in6& a) {
-  return *static_cast<sockaddr_in*>(static_cast<void*>(&a));
+inline sockaddr_in &
+ats_ip4_cast(sockaddr_in6 &a)
+{
+  return *static_cast<sockaddr_in *>(static_cast<void *>(&a));
 }
-inline sockaddr_in const& ats_ip4_cast(sockaddr_in6 const& a) {
-  return *static_cast<sockaddr_in const*>(static_cast<void const*>(&a));
+inline sockaddr_in const &
+ats_ip4_cast(sockaddr_in6 const &a)
+{
+  return *static_cast<sockaddr_in const *>(static_cast<void const *>(&a));
 }
 
-inline sockaddr_in6* ats_ip6_cast(sockaddr* a) {
-  return static_cast<sockaddr_in6*>(static_cast<void*>(a));
+inline sockaddr_in6 *
+ats_ip6_cast(sockaddr *a)
+{
+  return static_cast<sockaddr_in6 *>(static_cast<void *>(a));
 }
-inline sockaddr_in6 const* ats_ip6_cast(sockaddr const* a) {
-  return static_cast<sockaddr_in6 const*>(static_cast<void const*>(a));
+inline sockaddr_in6 const *
+ats_ip6_cast(sockaddr const *a)
+{
+  return static_cast<sockaddr_in6 const *>(static_cast<void const *>(a));
 }
-inline sockaddr_in6& ats_ip6_cast(sockaddr& a) {
-  return *static_cast<sockaddr_in6*>(static_cast<void*>(&a));
+inline sockaddr_in6 &
+ats_ip6_cast(sockaddr &a)
+{
+  return *static_cast<sockaddr_in6 *>(static_cast<void *>(&a));
 }
-inline sockaddr_in6 const& ats_ip6_cast(sockaddr const& a) {
-  return *static_cast<sockaddr_in6 const*>(static_cast<void const*>(&a));
+inline sockaddr_in6 const &
+ats_ip6_cast(sockaddr const &a)
+{
+  return *static_cast<sockaddr_in6 const *>(static_cast<void const *>(&a));
 }
 
 /// @return The @c sockaddr size for the family of @a addr.
-inline size_t ats_ip_size(
-  sockaddr const* addr ///< Address object.
-) {
-  return AF_INET == addr->sa_family ? sizeof(sockaddr_in)
-    : AF_INET6 == addr->sa_family ? sizeof(sockaddr_in6)
-    : 0
-    ;
-}
-inline size_t ats_ip_size(
-  IpEndpoint const* addr ///< Address object.
-) {
-  return AF_INET == addr->sa.sa_family ? sizeof(sockaddr_in)
-    : AF_INET6 == addr->sa.sa_family ? sizeof(sockaddr_in6)
-    : 0
-    ;
+inline size_t
+ats_ip_size(sockaddr const *addr ///< Address object.
+            )
+{
+  return AF_INET == addr->sa_family ? sizeof(sockaddr_in) : AF_INET6 == addr->sa_family ? sizeof(sockaddr_in6) : 0;
+}
+inline size_t
+ats_ip_size(IpEndpoint const *addr ///< Address object.
+            )
+{
+  return AF_INET == addr->sa.sa_family ? sizeof(sockaddr_in) : AF_INET6 == addr->sa.sa_family ? sizeof(sockaddr_in6) : 0;
 }
 /// @return The size of the IP address only.
-inline size_t ats_ip_addr_size(
-  sockaddr const* addr ///< Address object.
-) {
-  return AF_INET == addr->sa_family ? sizeof(in_addr_t)
-    : AF_INET6 == addr->sa_family ? sizeof(in6_addr)
-    : 0
-    ;
-}
-inline size_t ats_ip_addr_size(
-  IpEndpoint const* addr ///< Address object.
-) {
-  return AF_INET == addr->sa.sa_family ? sizeof(in_addr_t)
-    : AF_INET6 == addr->sa.sa_family ? sizeof(in6_addr)
-    : 0
-    ;
+inline size_t
+ats_ip_addr_size(sockaddr const *addr ///< Address object.
+                 )
+{
+  return AF_INET == addr->sa_family ? sizeof(in_addr_t) : AF_INET6 == addr->sa_family ? sizeof(in6_addr) : 0;
+}
+inline size_t
+ats_ip_addr_size(IpEndpoint const *addr ///< Address object.
+                 )
+{
+  return AF_INET == addr->sa.sa_family ? sizeof(in_addr_t) : AF_INET6 == addr->sa.sa_family ? sizeof(in6_addr) : 0;
 }
 
 /** Get a reference to the port in an address.
@@ -395,22 +441,25 @@ inline size_t ats_ip_addr_size(
     @internal This is primarily for internal use but it might be handy for
     clients so it is exposed.
 */
-inline in_port_t& ats_ip_port_cast(sockaddr* sa) {
+inline in_port_t &
+ats_ip_port_cast(sockaddr *sa)
+{
   static in_port_t dummy = 0;
-  return ats_is_ip4(sa)
-    ? ats_ip4_cast(sa)->sin_port
-    : ats_is_ip6(sa)
-      ? ats_ip6_cast(sa)->sin6_port
-      : (dummy = 0)
-    ;
+  return ats_is_ip4(sa) ? ats_ip4_cast(sa)->sin_port : ats_is_ip6(sa) ? ats_ip6_cast(sa)->sin6_port : (dummy = 0);
 }
-inline in_port_t const& ats_ip_port_cast(sockaddr const* sa) {
-  return ats_ip_port_cast(const_cast<sockaddr*>(sa));
+inline in_port_t const &
+ats_ip_port_cast(sockaddr const *sa)
+{
+  return ats_ip_port_cast(const_cast<sockaddr *>(sa));
 }
-inline in_port_t const& ats_ip_port_cast(IpEndpoint const* ip) {
-  return ats_ip_port_cast(const_cast<sockaddr*>(&ip->sa));
+inline in_port_t const &
+ats_ip_port_cast(IpEndpoint const *ip)
+{
+  return ats_ip_port_cast(const_cast<sockaddr *>(&ip->sa));
 }
-inline in_port_t& ats_ip_port_cast(IpEndpoint* ip) {
+inline in_port_t &
+ats_ip_port_cast(IpEndpoint *ip)
+{
   return ats_ip_port_cast(&ip->sa);
 }
 
@@ -422,12 +471,11 @@ inline in_port_t& ats_ip_port_cast(IpEndpoint* ip) {
 
     @return A reference to the IPv4 address in @a addr.
 */
-inline in_addr_t& ats_ip4_addr_cast(sockaddr* addr) {
+inline in_addr_t &
+ats_ip4_addr_cast(sockaddr *addr)
+{
   static in_addr_t dummy = 0;
-  return ats_is_ip4(addr)
-    ? ats_ip4_cast(addr)->sin_addr.s_addr
-    : (dummy = 0)
-    ;
+  return ats_is_ip4(addr) ? ats_ip4_cast(addr)->sin_addr.s_addr : (dummy = 0);
 }
 
 /** Access the IPv4 address.
@@ -438,12 +486,11 @@ inline in_addr_t& ats_ip4_addr_cast(sockaddr* addr) {
 
     @return A reference to the IPv4 address in @a addr.
 */
-inline in_addr_t const& ats_ip4_addr_cast(sockaddr const* addr) {
+inline in_addr_t const &
+ats_ip4_addr_cast(sockaddr const *addr)
+{
   static in_addr_t dummy = 0;
-  return ats_is_ip4(addr)
-    ? ats_ip4_cast(addr)->sin_addr.s_addr
-    : static_cast<in_addr_t const&>(dummy = 0)
-    ;
+  return ats_is_ip4(addr) ? ats_ip4_cast(addr)->sin_addr.s_addr : static_cast<in_addr_t const &>(dummy = 0);
 }
 
 /** Access the IPv4 address.
@@ -455,7 +502,9 @@ inline in_addr_t const& ats_ip4_addr_cast(sockaddr const* addr) {
 
     @return A reference to the IPv4 address in @a addr.
 */
-inline in_addr_t& ats_ip4_addr_cast(IpEndpoint* ip) {
+inline in_addr_t &
+ats_ip4_addr_cast(IpEndpoint *ip)
+{
   return ats_ip4_addr_cast(&ip->sa);
 }
 
@@ -468,7 +517,9 @@ inline in_addr_t& ats_ip4_addr_cast(IpEndpoint* ip) {
 
     @return A reference to the IPv4 address in @a addr.
 */
-inline in_addr_t const& ats_ip4_addr_cast(IpEndpoint const* ip) {
+inline in_addr_t const &
+ats_ip4_addr_cast(IpEndpoint const *ip)
+{
   return ats_ip4_addr_cast(&ip->sa);
 }
 
@@ -480,16 +531,24 @@ inline in_addr_t const& ats_ip4_addr_cast(IpEndpoint const* ip) {
 
     @return A reference to the IPv6 address in @a addr.
 */
-inline in6_addr& ats_ip6_addr_cast(sockaddr* addr) {
+inline in6_addr &
+ats_ip6_addr_cast(sockaddr *addr)
+{
   return ats_ip6_cast(addr)->sin6_addr;
 }
-inline in6_addr const& ats_ip6_addr_cast(sockaddr const* addr) {
+inline in6_addr const &
+ats_ip6_addr_cast(sockaddr const *addr)
+{
   return ats_ip6_cast(addr)->sin6_addr;
 }
-inline in6_addr& ats_ip6_addr_cast(IpEndpoint* ip) {
+inline in6_addr &
+ats_ip6_addr_cast(IpEndpoint *ip)
+{
   return ip->sin6.sin6_addr;
 }
-inline in6_addr const& ats_ip6_addr_cast(IpEndpoint const* ip) {
+inline in6_addr const &
+ats_ip6_addr_cast(IpEndpoint const *ip)
+{
   return ip->sin6.sin6_addr;
 }
 
@@ -499,16 +558,24 @@ inline in6_addr const& ats_ip6_addr_cast(IpEndpoint const* ip) {
     @return A pointer to the address information in @a addr or @c NULL
     if @a addr is not an IP address.
 */
-inline uint32_t* ats_ip_addr32_cast(sockaddr* addr) {
-  uint32_t* zret = 0;
-  switch(addr->sa_family) {
-  case AF_INET: zret = reinterpret_cast<uint32_t*>(&ats_ip4_addr_cast(addr)); break;
-  case AF_INET6: zret = reinterpret_cast<uint32_t*>(&ats_ip6_addr_cast(addr)); break;
+inline uint32_t *
+ats_ip_addr32_cast(sockaddr *addr)
+{
+  uint32_t *zret = 0;
+  switch (addr->sa_family) {
+  case AF_INET:
+    zret = reinterpret_cast<uint32_t *>(&ats_ip4_addr_cast(addr));
+    break;
+  case AF_INET6:
+    zret = reinterpret_cast<uint32_t *>(&ats_ip6_addr_cast(addr));
+    break;
   }
   return zret;
 }
-inline uint32_t const* ats_ip_addr32_cast(sockaddr const* addr) {
-  return ats_ip_addr32_cast(const_cast<sockaddr*>(addr));
+inline uint32_t const *
+ats_ip_addr32_cast(sockaddr const *addr)
+{
+  return ats_ip_addr32_cast(const_cast<sockaddr *>(addr));
 }
 
 /** Cast an IP address to an array of @c uint8_t.
@@ -518,68 +585,81 @@ inline uint32_t const* ats_ip_addr32_cast(sockaddr const* addr) {
     if @a addr is not an IP address.
     @see ats_ip_addr_size
 */
-inline uint8_t* ats_ip_addr8_cast(sockaddr* addr) {
-  uint8_t* zret = 0;
-  switch(addr->sa_family) {
-  case AF_INET: zret = reinterpret_cast<uint8_t*>(&ats_ip4_addr_cast(addr)); break;
-  case AF_INET6: zret = reinterpret_cast<uint8_t*>(&ats_ip6_addr_cast(addr)); break;
+inline uint8_t *
+ats_ip_addr8_cast(sockaddr *addr)
+{
+  uint8_t *zret = 0;
+  switch (addr->sa_family) {
+  case AF_INET:
+    zret = reinterpret_cast<uint8_t *>(&ats_ip4_addr_cast(addr));
+    break;
+  case AF_INET6:
+    zret = reinterpret_cast<uint8_t *>(&ats_ip6_addr_cast(addr));
+    break;
   }
   return zret;
 }
-inline uint8_t const* ats_ip_addr8_cast(sockaddr const* addr) {
-  return ats_ip_addr8_cast(const_cast<sockaddr*>(addr));
+inline uint8_t const *
+ats_ip_addr8_cast(sockaddr const *addr)
+{
+  return ats_ip_addr8_cast(const_cast<sockaddr *>(addr));
 }
-inline uint8_t* ats_ip_addr8_cast(IpEndpoint* ip) {
+inline uint8_t *
+ats_ip_addr8_cast(IpEndpoint *ip)
+{
   return ats_ip_addr8_cast(&ip->sa);
 }
-inline uint8_t const* ats_ip_addr8_cast(IpEndpoint const* ip) {
+inline uint8_t const *
+ats_ip_addr8_cast(IpEndpoint const *ip)
+{
   return ats_ip_addr8_cast(&ip->sa);
 }
 
 /// Check for loopback.
 /// @return @c true if this is an IP loopback address, @c false otherwise.
-inline bool ats_is_ip_loopback(sockaddr const* ip) {
-  return ip
-    && (
-      (AF_INET == ip->sa_family && 0x7F == ats_ip_addr8_cast(ip)[0])
-      ||
-      (AF_INET6 == ip->sa_family && IN6_IS_ADDR_LOOPBACK(&ats_ip6_addr_cast(ip)))
-    );
+inline bool
+ats_is_ip_loopback(sockaddr const *ip)
+{
+  return ip && ((AF_INET == ip->sa_family && 0x7F == ats_ip_addr8_cast(ip)[0]) ||
+                (AF_INET6 == ip->sa_family && IN6_IS_ADDR_LOOPBACK(&ats_ip6_addr_cast(ip))));
 }
 
 /// Check for loopback.
 /// @return @c true if this is an IP loopback address, @c false otherwise.
-inline bool ats_is_ip_loopback(IpEndpoint const* ip) {
+inline bool
+ats_is_ip_loopback(IpEndpoint const *ip)
+{
   return ats_is_ip_loopback(&ip->sa);
 }
 
 /// Check for multicast.
 /// @return @true if @a ip is multicast.
-inline bool ats_is_ip_multicast(sockaddr const* ip) {
-  return ip
-    && (
-      (AF_INET == ip->sa_family && 0xe == *ats_ip_addr8_cast(ip))
-      ||
-      (AF_INET6 == ip->sa_family && IN6_IS_ADDR_MULTICAST(&ats_ip6_addr_cast(ip)))
-    );
+inline bool
+ats_is_ip_multicast(sockaddr const *ip)
+{
+  return ip && ((AF_INET == ip->sa_family && 0xe == *ats_ip_addr8_cast(ip)) ||
+                (AF_INET6 == ip->sa_family && IN6_IS_ADDR_MULTICAST(&ats_ip6_addr_cast(ip))));
 }
 /// Check for multicast.
 /// @return @true if @a ip is multicast.
-inline bool ats_is_ip_multicast(IpEndpoint const* ip) {
+inline bool
+ats_is_ip_multicast(IpEndpoint const *ip)
+{
   return ats_is_ip_multicast(&ip->sa);
 }
 
 /// Check for Private.
 /// @return @true if @a ip is private.
 inline bool
-ats_is_ip_private(sockaddr const* ip) {
+ats_is_ip_private(sockaddr const *ip)
+{
   bool zret = false;
   if (ats_is_ip4(ip)) {
     in_addr_t a = ats_ip4_addr_cast(ip);
     zret = ((a & htonl(0xFF000000)) == htonl(0x0A000000)) || // 10.0.0.0/8
-      ((a & htonl(0xFFC00000)) == htonl(0x64400000)) ||      // 100.64.0.0/10
-      ((a & htonl(0xFFF00000)) == htonl(0xAC100000)) ||      // 172.16.0.0/12
-      ((a & htonl(0xFFFF0000)) == htonl(0xC0A80000))         // 192.168.0.0/16
+           ((a & htonl(0xFFC00000)) == htonl(0x64400000)) || // 100.64.0.0/10
+           ((a & htonl(0xFFF00000)) == htonl(0xAC100000)) || // 172.16.0.0/12
+           ((a & htonl(0xFFFF0000)) == htonl(0xC0A80000))    // 192.168.0.0/16
       ;
   } else if (ats_is_ip6(ip)) {
     in6_addr a = ats_ip6_addr_cast(ip);
@@ -592,14 +672,16 @@ ats_is_ip_private(sockaddr const* ip) {
 /// Check for Private.
 /// @return @true if @a ip is private.
 inline bool
-ats_is_ip_private(IpEndpoint const* ip) {
+ats_is_ip_private(IpEndpoint const *ip)
+{
   return ats_is_ip_private(&ip->sa);
 }
 
 /// Check for Link Local.
 /// @return @true if @a ip is link local.
 inline bool
-ats_is_ip_linklocal(sockaddr const* ip) {
+ats_is_ip_linklocal(sockaddr const *ip)
+{
   bool zret = false;
   if (ats_is_ip4(ip)) {
     in_addr_t a = ats_ip4_addr_cast(ip);
@@ -616,16 +698,18 @@ ats_is_ip_linklocal(sockaddr const* ip) {
 /// Check for Link Local.
 /// @return @true if @a ip is link local.
 inline bool
-ats_is_ip_linklocal(IpEndpoint const* ip) {
+ats_is_ip_linklocal(IpEndpoint const *ip)
+{
   return ats_is_ip_linklocal(&ip->sa);
 }
 
 /// Check for being "any" address.
 /// @return @c true if @a ip is the any / unspecified address.
-inline bool ats_is_ip_any(sockaddr const* ip) {
+inline bool
+ats_is_ip_any(sockaddr const *ip)
+{
   return (ats_is_ip4(ip) && INADDR_ANY == ats_ip4_addr_cast(ip)) ||
-    (ats_is_ip6(ip) && IN6_IS_ADDR_UNSPECIFIED(&ats_ip6_addr_cast(ip)))
-    ;
+         (ats_is_ip6(ip) && IN6_IS_ADDR_UNSPECIFIED(&ats_ip6_addr_cast(ip)));
 }
 
 /// @name Address operators
@@ -637,15 +721,20 @@ inline bool ats_is_ip_any(sockaddr const* ip) {
     @a dst is marked as invalid.
     @return @c true if @a src was an IP address, @c false otherwise.
 */
-inline bool ats_ip_copy(
-  sockaddr* dst, ///< Destination object.
-  sockaddr const* src ///< Source object.
-) {
+inline bool
+ats_ip_copy(sockaddr *dst,      ///< Destination object.
+            sockaddr const *src ///< Source object.
+            )
+{
   size_t n = 0;
   if (src) {
     switch (src->sa_family) {
-    case AF_INET: n = sizeof(sockaddr_in); break;
-    case AF_INET6: n = sizeof(sockaddr_in6); break;
+    case AF_INET:
+      n = sizeof(sockaddr_in);
+      break;
+    case AF_INET6:
+      n = sizeof(sockaddr_in6);
+      break;
     }
   }
   if (n) {
@@ -659,22 +748,23 @@ inline bool ats_ip_copy(
   return n != 0;
 }
 
-inline bool ats_ip_copy(
-  IpEndpoint* dst, ///< Destination object.
-  sockaddr const* src ///< Source object.
-) {
+inline bool
+ats_ip_copy(IpEndpoint *dst,    ///< Destination object.
+            sockaddr const *src ///< Source object.
+            )
+{
   return ats_ip_copy(&dst->sa, src);
 }
-inline bool ats_ip_copy(
-  IpEndpoint* dst, ///< Destination object.
-  IpEndpoint const* src ///< Source object.
-) {
+inline bool
+ats_ip_copy(IpEndpoint *dst,      ///< Destination object.
+            IpEndpoint const *src ///< Source object.
+            )
+{
   return ats_ip_copy(&dst->sa, &src->sa);
 }
-inline bool ats_ip_copy(
-  sockaddr* dst,
-  IpEndpoint const* src
-) {
+inline bool
+ats_ip_copy(sockaddr *dst, IpEndpoint const *src)
+{
   return ats_ip_copy(dst, &src->sa);
 }
 
@@ -696,10 +786,11 @@ inline bool ats_ip_copy(
     @internal This looks like a lot of code for an inline but I think it
     should compile down to something reasonable.
 */
-inline int ats_ip_addr_cmp(
-  sockaddr const* lhs, ///< Left hand operand.
-  sockaddr const* rhs ///< Right hand operand.
-) {
+inline int
+ats_ip_addr_cmp(sockaddr const *lhs, ///< Left hand operand.
+                sockaddr const *rhs  ///< Right hand operand.
+                )
+{
   int zret = 0;
   uint16_t rtype = rhs->sa_family;
   uint16_t ltype = lhs->sa_family;
@@ -710,9 +801,12 @@ inline int ats_ip_addr_cmp(
     if (AF_INET == rtype) {
       in_addr_t la = ntohl(ats_ip4_cast(lhs)->sin_addr.s_addr);
       in_addr_t ra = ntohl(ats_ip4_cast(rhs)->sin_addr.s_addr);
-      if (la < ra) zret = -1;
-      else if (la > ra) zret = 1;
-      else zret = 0;
+      if (la < ra)
+        zret = -1;
+      else if (la > ra)
+        zret = 1;
+      else
+        zret = 0;
     } else if (AF_INET6 == rtype) { // IPv4 < IPv6
       zret = -1;
     } else { // IP > not IP
@@ -720,12 +814,8 @@ inline int ats_ip_addr_cmp(
     }
   } else if (AF_INET6 == ltype) {
     if (AF_INET6 == rtype) {
-      sockaddr_in6 const* lhs_in6 = ats_ip6_cast(lhs);
-      zret = memcmp(
-        &lhs_in6->sin6_addr,
-        &ats_ip6_cast(rhs)->sin6_addr,
-        sizeof(lhs_in6->sin6_addr)
-      );
+      sockaddr_in6 const *lhs_in6 = ats_ip6_cast(lhs);
+      zret = memcmp(&lhs_in6->sin6_addr, &ats_ip6_cast(rhs)->sin6_addr, sizeof(lhs_in6->sin6_addr));
     } else {
       zret = 1; // IPv6 greater than any other type.
     }
@@ -744,7 +834,9 @@ inline int ats_ip_addr_cmp(
     @note Convenience overload.
     @see ats_ip_addr_cmp(sockaddr const* lhs, sockaddr const* rhs)
 */
-inline int ats_ip_addr_cmp(IpEndpoint const* lhs, IpEndpoint const* rhs) {
+inline int
+ats_ip_addr_cmp(IpEndpoint const *lhs, IpEndpoint const *rhs)
+{
   return ats_ip_addr_cmp(&lhs->sa, &rhs->sa);
 }
 
@@ -752,22 +844,30 @@ inline int ats_ip_addr_cmp(IpEndpoint const* lhs, IpEndpoint const* rhs) {
     @return @c true if @a lhs and @a rhs point to equal addresses,
     @c false otherwise.
 */
-inline bool ats_ip_addr_eq(sockaddr const* lhs, sockaddr const* rhs) {
+inline bool
+ats_ip_addr_eq(sockaddr const *lhs, sockaddr const *rhs)
+{
   return 0 == ats_ip_addr_cmp(lhs, rhs);
 }
-inline bool ats_ip_addr_eq(IpEndpoint const* lhs, IpEndpoint const* rhs) {
+inline bool
+ats_ip_addr_eq(IpEndpoint const *lhs, IpEndpoint const *rhs)
+{
   return 0 == ats_ip_addr_cmp(&lhs->sa, &rhs->sa);
 }
 
-inline bool operator == (IpEndpoint const& lhs, IpEndpoint const& rhs) {
+inline bool operator==(IpEndpoint const &lhs, IpEndpoint const &rhs)
+{
   return 0 == ats_ip_addr_cmp(&lhs.sa, &rhs.sa);
 }
-inline bool operator != (IpEndpoint const& lhs, IpEndpoint const& rhs) {
+inline bool operator!=(IpEndpoint const &lhs, IpEndpoint const &rhs)
+{
   return 0 != ats_ip_addr_cmp(&lhs.sa, &rhs.sa);
 }
 
 /// Compare address and port for equality.
-inline bool ats_ip_addr_port_eq(sockaddr const* lhs, sockaddr const* rhs) {
+inline bool
+ats_ip_addr_port_eq(sockaddr const *lhs, sockaddr const *rhs)
+{
   bool zret = false;
   if (lhs->sa_family == rhs->sa_family && ats_ip_port_cast(lhs) == ats_ip_port_cast(rhs)) {
     if (AF_INET == lhs->sa_family)
@@ -783,41 +883,45 @@ inline bool ats_ip_addr_port_eq(sockaddr const* lhs, sockaddr const* rhs) {
 /// Get IP TCP/UDP port.
 /// @return The port in host order for an IPv4 or IPv6 address,
 /// or zero if neither.
-inline in_port_t ats_ip_port_host_order(
-  sockaddr const* addr ///< Address with port.
-) {
+inline in_port_t
+ats_ip_port_host_order(sockaddr const *addr ///< Address with port.
+                       )
+{
   // We can discard the const because this function returns
   // by value.
-  return ntohs(ats_ip_port_cast(const_cast<sockaddr*>(addr)));
+  return ntohs(ats_ip_port_cast(const_cast<sockaddr *>(addr)));
 }
 
 /// Get IP TCP/UDP port.
 /// @return The port in host order for an IPv4 or IPv6 address,
 /// or zero if neither.
-inline in_port_t ats_ip_port_host_order(
-  IpEndpoint const* ip ///< Address with port.
-) {
+inline in_port_t
+ats_ip_port_host_order(IpEndpoint const *ip ///< Address with port.
+                       )
+{
   // We can discard the const because this function returns
   // by value.
-  return ntohs(ats_ip_port_cast(const_cast<sockaddr*>(&ip->sa)));
+  return ntohs(ats_ip_port_cast(const_cast<sockaddr *>(&ip->sa)));
 }
 
 
 /** Extract the IPv4 address.
     @return Host order IPv4 address.
 */
-inline in_addr_t ats_ip4_addr_host_order(
-  sockaddr const* addr ///< Address object.
-) {
-  return ntohl(ats_ip4_addr_cast(const_cast<sockaddr*>(addr)));
+inline in_addr_t
+ats_ip4_addr_host_order(sockaddr const *addr ///< Address object.
+                        )
+{
+  return ntohl(ats_ip4_addr_cast(const_cast<sockaddr *>(addr)));
 }
 
 /// Write IPv4 data to storage @a dst.
-inline sockaddr* ats_ip4_set(
-  sockaddr_in* dst, ///< Destination storage.
-  in_addr_t addr, ///< address, IPv4 network order.
-  in_port_t port = 0 ///< port, network order.
-) {
+inline sockaddr *
+ats_ip4_set(sockaddr_in *dst,  ///< Destination storage.
+            in_addr_t addr,    ///< address, IPv4 network order.
+            in_port_t port = 0 ///< port, network order.
+            )
+{
   ink_zero(*dst);
 #if HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   dst->sin_len = sizeof(sockaddr_in);
@@ -831,11 +935,12 @@ inline sockaddr* ats_ip4_set(
 /** Write IPv4 data to @a dst.
     @note Convenience overload.
 */
-inline sockaddr* ats_ip4_set(
-  IpEndpoint* dst, ///< Destination storage.
-  in_addr_t ip4, ///< address, IPv4 network order.
-  in_port_t port = 0 ///< port, network order.
-) {
+inline sockaddr *
+ats_ip4_set(IpEndpoint *dst,   ///< Destination storage.
+            in_addr_t ip4,     ///< address, IPv4 network order.
+            in_port_t port = 0 ///< port, network order.
+            )
+{
   return ats_ip4_set(&dst->sin, ip4, port);
 }
 
@@ -844,21 +949,23 @@ inline sockaddr* ats_ip4_set(
     This is the generic overload. Caller must verify that @a dst is at
     least @c sizeof(sockaddr_in) bytes.
 */
-inline sockaddr* ats_ip4_set(
-  sockaddr* dst, ///< Destination storage.
-  in_addr_t ip4, ///< address, IPv4 network order.
-  in_port_t port = 0 ///< port, network order.
-) {
+inline sockaddr *
+ats_ip4_set(sockaddr *dst,     ///< Destination storage.
+            in_addr_t ip4,     ///< address, IPv4 network order.
+            in_port_t port = 0 ///< port, network order.
+            )
+{
   return ats_ip4_set(ats_ip4_cast(dst), ip4, port);
 }
 /** Write IPv6 data to storage @a dst.
     @return @a dst cast to @c sockaddr*.
  */
-inline sockaddr* ats_ip6_set(
-  sockaddr_in6* dst, ///< Destination storage.
-  in6_addr const& addr, ///< address in network order.
-  in_port_t port = 0 ///< Port, network order.
-) {
+inline sockaddr *
+ats_ip6_set(sockaddr_in6 *dst,    ///< Destination storage.
+            in6_addr const &addr, ///< address in network order.
+            in_port_t port = 0    ///< Port, network order.
+            )
+{
   ink_zero(*dst);
 #if HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   dst->sin6_len = sizeof(sockaddr_in6);
@@ -871,41 +978,43 @@ inline sockaddr* ats_ip6_set(
 /** Write IPv6 data to storage @a dst.
     @return @a dst cast to @c sockaddr*.
  */
-inline sockaddr* ats_ip6_set(
-  sockaddr* dst, ///< Destination storage.
-  in6_addr const& addr, ///< address in network order.
-  in_port_t port = 0 ///< Port, network order.
-) {
+inline sockaddr *
+ats_ip6_set(sockaddr *dst,        ///< Destination storage.
+            in6_addr const &addr, ///< address in network order.
+            in_port_t port = 0    ///< Port, network order.
+            )
+{
   return ats_ip6_set(ats_ip6_cast(dst), addr, port);
 }
 /** Write IPv6 data to storage @a dst.
     @return @a dst cast to @c sockaddr*.
  */
-inline sockaddr* ats_ip6_set(
-  IpEndpoint* dst, ///< Destination storage.
-  in6_addr const& addr, ///< address in network order.
-  in_port_t port = 0 ///< Port, network order.
-) {
+inline sockaddr *
+ats_ip6_set(IpEndpoint *dst,      ///< Destination storage.
+            in6_addr const &addr, ///< address in network order.
+            in_port_t port = 0    ///< Port, network order.
+            )
+{
   return ats_ip6_set(&dst->sin6, addr, port);
 }
 
 /** Write a null terminated string for @a addr to @a dst.
     A buffer of size INET6_ADDRSTRLEN suffices, including a terminating nul.
  */
-char const* ats_ip_ntop(
-  const sockaddr *addr, ///< Address.
-  char *dst, ///< Output buffer.
-  size_t size ///< Length of buffer.
-);
+char const *ats_ip_ntop(const sockaddr *addr, ///< Address.
+                        char *dst,            ///< Output buffer.
+                        size_t size           ///< Length of buffer.
+                        );
 
 /** Write a null terminated string for @a addr to @a dst.
     A buffer of size INET6_ADDRSTRLEN suffices, including a terminating nul.
  */
-inline char const* ats_ip_ntop(
-  IpEndpoint const* addr, ///< Address.
-  char *dst, ///< Output buffer.
-  size_t size ///< Length of buffer.
-) {
+inline char const *
+ats_ip_ntop(IpEndpoint const *addr, ///< Address.
+            char *dst,              ///< Output buffer.
+            size_t size             ///< Length of buffer.
+            )
+{
   return ats_ip_ntop(&addr->sa, dst, size);
 }
 
@@ -919,20 +1028,20 @@ typedef char ip_port_text_buffer[INET6_ADDRPORTSTRLEN];
 /** Write a null terminated string for @a addr to @a dst with port.
     A buffer of size INET6_ADDRPORTSTRLEN suffices, including a terminating nul.
  */
-char const* ats_ip_nptop(
-  const sockaddr *addr, ///< Address.
-  char *dst, ///< Output buffer.
-  size_t size ///< Length of buffer.
-);
+char const *ats_ip_nptop(const sockaddr *addr, ///< Address.
+                         char *dst,            ///< Output buffer.
+                         size_t size           ///< Length of buffer.
+                         );
 
 /** Write a null terminated string for @a addr to @a dst with port.
     A buffer of size INET6_ADDRPORTSTRLEN suffices, including a terminating nul.
  */
-inline char const* ats_ip_nptop(
-  IpEndpoint const*addr, ///< Address.
-  char *dst, ///< Output buffer.
-  size_t size ///< Length of buffer.
-) {
+inline char const *
+ats_ip_nptop(IpEndpoint const *addr, ///< Address.
+             char *dst,              ///< Output buffer.
+             size_t size             ///< Length of buffer.
+             )
+{
   return ats_ip_nptop(&addr->sa, dst, size);
 }
 
@@ -953,10 +1062,9 @@ inline char const* ats_ip_nptop(
 
     @return 0 on success, non-zero on failure.
 */
-int ats_ip_pton(
-  const ts::ConstBuffer& text, ///< [in] text.
-  sockaddr* addr ///< [out] address
-);
+int ats_ip_pton(const ts::ConstBuffer &text, ///< [in] text.
+                sockaddr *addr               ///< [out] address
+                );
 
 /** Convert @a text to an IP address and write it to @a addr.
 
@@ -969,31 +1077,35 @@ int ats_ip_pton(
 
     @return 0 on success, non-zero on failure.
 */
-inline int ats_ip_pton(
-  char const* text, ///< [in] text.
-  sockaddr_in6* addr ///< [out] address
-) {
+inline int
+ats_ip_pton(char const *text,  ///< [in] text.
+            sockaddr_in6 *addr ///< [out] address
+            )
+{
   return ats_ip_pton(ts::ConstBuffer(text, strlen(text)), ats_ip_sa_cast(addr));
 }
 
-inline int ats_ip_pton(
-  const ts::ConstBuffer& text, ///< [in] text.
-  IpEndpoint* addr ///< [out] address
-) {
+inline int
+ats_ip_pton(const ts::ConstBuffer &text, ///< [in] text.
+            IpEndpoint *addr             ///< [out] address
+            )
+{
   return ats_ip_pton(text, &addr->sa);
 }
 
-inline int ats_ip_pton(
-  const char * text, ///< [in] text.
-  IpEndpoint* addr ///< [out] address
-) {
+inline int
+ats_ip_pton(const char *text, ///< [in] text.
+            IpEndpoint *addr  ///< [out] address
+            )
+{
   return ats_ip_pton(ts::ConstBuffer(text, strlen(text)), &addr->sa);
 }
 
-inline int ats_ip_pton(
-  const char * text, ///< [in] text.
-  sockaddr * addr ///< [out] address
-) {
+inline int
+ats_ip_pton(const char *text, ///< [in] text.
+            sockaddr *addr    ///< [out] address
+            )
+{
   return ats_ip_pton(ts::ConstBuffer(text, strlen(text)), addr);
 }
 
@@ -1022,28 +1134,24 @@ inline int ats_ip_pton(
     @see getaddrinfo
  */
 
-int
-ats_ip_getbestaddrinfo(
-  char const* name, ///< [in] Address name (IPv4, IPv6, or host name)
-  IpEndpoint* ip4, ///< [out] Storage for IPv4 address.
-  IpEndpoint* ip6 ///< [out] Storage for IPv6 address
-);
+int ats_ip_getbestaddrinfo(char const *name, ///< [in] Address name (IPv4, IPv6, or host name)
+                           IpEndpoint *ip4,  ///< [out] Storage for IPv4 address.
+                           IpEndpoint *ip6   ///< [out] Storage for IPv6 address
+                           );
 
 /** Generic IP address hash function.
 */
-uint32_t ats_ip_hash(sockaddr const* addr);
+uint32_t ats_ip_hash(sockaddr const *addr);
 
 /** Convert address to string as a hexidecimal value.
     The string is always nul terminated, the output string is clipped
     if @a dst is insufficient.
     @return The length of the resulting string (not including nul).
 */
-int
-ats_ip_to_hex(
-  sockaddr const* addr, ///< Address to convert. Must be IP.
-  char* dst, ///< Destination buffer.
-  size_t len ///< Length of @a dst.
-);
+int ats_ip_to_hex(sockaddr const *addr, ///< Address to convert. Must be IP.
+                  char *dst,            ///< Destination buffer.
+                  size_t len            ///< Length of @a dst.
+                  );
 
 /** Storage for an IP address.
     In some cases we want to store just the address and not the
@@ -1056,91 +1164,78 @@ struct IpAddr {
   /// Default construct (invalid address).
   IpAddr() : _family(AF_UNSPEC) {}
   /// Construct as IPv4 @a addr.
-  explicit IpAddr(
-    in_addr_t addr ///< Address to assign.
-  ) : _family(AF_INET) {
+  explicit IpAddr(in_addr_t addr ///< Address to assign.
+                  )
+    : _family(AF_INET)
+  {
     _addr._ip4 = addr;
   }
   /// Construct as IPv6 @a addr.
-  explicit IpAddr(
-    in6_addr const& addr ///< Address to assign.
-  ) : _family(AF_INET6) {
+  explicit IpAddr(in6_addr const &addr ///< Address to assign.
+                  )
+    : _family(AF_INET6)
+  {
     _addr._ip6 = addr;
   }
   /// Construct from @c sockaddr.
-  explicit IpAddr(sockaddr const* addr) { this->assign(addr); }
+  explicit IpAddr(sockaddr const *addr) { this->assign(addr); }
   /// Construct from @c sockaddr_in6.
-  explicit IpAddr(sockaddr_in6 const& addr) { this->assign(ats_ip_sa_cast(&addr)); }
+  explicit IpAddr(sockaddr_in6 const &addr) { this->assign(ats_ip_sa_cast(&addr)); }
   /// Construct from @c sockaddr_in6.
-  explicit IpAddr(sockaddr_in6 const* addr) { this->assign(ats_ip_sa_cast(addr)); }
+  explicit IpAddr(sockaddr_in6 const *addr) { this->assign(ats_ip_sa_cast(addr)); }
   /// Construct from @c IpEndpoint.
-  explicit IpAddr(IpEndpoint const& addr) { this->assign(&addr.sa); }
+  explicit IpAddr(IpEndpoint const &addr) { this->assign(&addr.sa); }
   /// Construct from @c IpEndpoint.
-  explicit IpAddr(IpEndpoint const* addr) { this->assign(&addr->sa); }
+  explicit IpAddr(IpEndpoint const *addr) { this->assign(&addr->sa); }
 
   /// Assign sockaddr storage.
-  self& assign(
-	       sockaddr const* addr ///< May be @c NULL
-	       );
+  self &assign(sockaddr const *addr ///< May be @c NULL
+               );
 
   /// Assign from end point.
-  self& operator = (IpEndpoint const& ip) {
-    return this->assign(&ip.sa);
-  }
+  self &operator=(IpEndpoint const &ip) { return this->assign(&ip.sa); }
   /// Assign from IPv4 raw address.
-  self& operator = (
-    in_addr_t ip ///< Network order IPv4 address.
-  );
+  self &operator=(in_addr_t ip ///< Network order IPv4 address.
+                  );
   /// Assign from IPv6 raw address.
-  self& operator = (
-    in6_addr const& ip
-  );
+  self &operator=(in6_addr const &ip);
 
   /** Load from string.
       The address is copied to this object if the conversion is successful,
       otherwise this object is invalidated.
       @return 0 on success, non-zero on failure.
   */
-  int load(
-    char const* str ///< Nul terminated input string.
-  );
+  int load(char const *str ///< Nul terminated input string.
+           );
 
   /** Load from string.
       The address is copied to this object if the conversion is successful,
       otherwise this object is invalidated.
       @return 0 on success, non-zero on failure.
   */
-  int load(
-    ts::ConstBuffer const& str ///< Text of IP address.
-  );
+  int load(ts::ConstBuffer const &str ///< Text of IP address.
+           );
 
   /** Output to a string.
       @return The string @a dest.
   */
-  char* toString(
-    char* dest, ///< [out] Destination string buffer.
-    size_t len ///< [in] Size of buffer.
-  ) const;
+  char *toString(char *dest, ///< [out] Destination string buffer.
+                 size_t len  ///< [in] Size of buffer.
+                 ) const;
 
   /// Equality.
-  bool operator==(self const& that) const {
-    return _family == AF_INET
-      ? (that._family == AF_INET && _addr._ip4 == that._addr._ip4)
-      : _family == AF_INET6
-        ? (that._family == AF_INET6
-          && 0 == memcmp(&_addr._ip6, &that._addr._ip6, TS_IP6_SIZE)
-          )
-        : (_family == AF_UNSPEC && that._family == AF_UNSPEC)
-    ;
+  bool operator==(self const &that) const
+  {
+    return _family == AF_INET ? (that._family == AF_INET && _addr._ip4 == that._addr._ip4) : _family == AF_INET6 ?
+                                (that._family == AF_INET6 && 0 == memcmp(&_addr._ip6, &that._addr._ip6, TS_IP6_SIZE)) :
+                                (_family == AF_UNSPEC && that._family == AF_UNSPEC);
   }
 
   /// Inequality.
-  bool operator!=(self const& that) {
-    return ! (*this == that);
-  }
+  bool operator!=(self const &that) { return !(*this == that); }
 
   /// Generic compare.
-  int cmp(self const& that) const;
+  int cmp(self const &that) const;
 
   /** Return a normalized hash value.
       - Ipv4: the address in host order.
@@ -1153,14 +1248,12 @@ struct IpAddr {
       @see hash
   */
   struct Hasher {
-    uint32_t operator() (self const& ip) const {
-      return ip.hash();
-    }
+    uint32_t operator()(self const &ip) const { return ip.hash(); }
   };
 
   /// Test for same address family.
   /// @c return @c true if @a that is the same address family as @a this.
-  bool isCompatibleWith(self const& that);
+  bool isCompatibleWith(self const &that);
 
   /// Get the address family.
   /// @return The address family.
@@ -1171,9 +1264,18 @@ struct IpAddr {
   bool isIp6() const;
 
   /// Test for validity.
-  bool isValid() const { return _family == AF_INET || _family == AF_INET6; }
+  bool
+  isValid() const
+  {
+    return _family == AF_INET || _family == AF_INET6;
+  }
   /// Make invalid.
-  self& invalidate() { _family = AF_UNSPEC; return *this; }
+  self &
+  invalidate()
+  {
+    _family = AF_UNSPEC;
+    return *this;
+  }
   /// Test for multicast
   bool isMulticast() const;
   /// Test for loopback
@@ -1182,50 +1284,64 @@ struct IpAddr {
   uint16_t _family; ///< Protocol family.
   /// Address data.
   union {
-    in_addr_t _ip4; ///< IPv4 address storage.
-    in6_addr  _ip6; ///< IPv6 address storage.
-    uint8_t   _byte[TS_IP6_SIZE]; ///< As raw bytes.
-    uint32_t  _u32[TS_IP6_SIZE/(sizeof(uint32_t)/sizeof(uint8_t))]; ///< As 32 bit chunks.
-    uint64_t  _u64[TS_IP6_SIZE/(sizeof(uint64_t)/sizeof(uint8_t))]; ///< As 64 bit chunks.
+    in_addr_t _ip4;                                                    ///< IPv4 address storage.
+    in6_addr _ip6;                                                     ///< IPv6 address storage.
+    uint8_t _byte[TS_IP6_SIZE];                                        ///< As raw bytes.
+    uint32_t _u32[TS_IP6_SIZE / (sizeof(uint32_t) / sizeof(uint8_t))]; ///< As 32 bit chunks.
+    uint64_t _u64[TS_IP6_SIZE / (sizeof(uint64_t) / sizeof(uint8_t))]; ///< As 64 bit chunks.
   } _addr;
 
   ///< Pre-constructed invalid instance.
   static self const INVALID;
 };
 
-inline IpAddr&
-IpAddr::operator = (in_addr_t ip) {
+inline IpAddr &IpAddr::operator=(in_addr_t ip)
+{
   _family = AF_INET;
   _addr._ip4 = ip;
   return *this;
 }
 
-inline IpAddr&
-IpAddr::operator = (in6_addr const& ip) {
+inline IpAddr &IpAddr::operator=(in6_addr const &ip)
+{
   _family = AF_INET6;
   _addr._ip6 = ip;
   return *this;
 }
 
-inline uint16_t IpAddr::family() const { return _family; }
+inline uint16_t
+IpAddr::family() const
+{
+  return _family;
+}
 
 inline bool
-IpAddr::isCompatibleWith(self const& that) {
+IpAddr::isCompatibleWith(self const &that)
+{
   return this->isValid() && _family == that._family;
 }
 
-inline bool IpAddr::isIp4() const { return AF_INET == _family; }
-inline bool IpAddr::isIp6() const { return AF_INET6 == _family; }
+inline bool
+IpAddr::isIp4() const
+{
+  return AF_INET == _family;
+}
+inline bool
+IpAddr::isIp6() const
+{
+  return AF_INET6 == _family;
+}
 
-inline bool IpAddr::isLoopback() const {
-  return (AF_INET == _family && 0x7F == _addr._byte[0]) ||
-    (AF_INET6 == _family && IN6_IS_ADDR_LOOPBACK(&_addr._ip6))
-    ;
+inline bool
+IpAddr::isLoopback() const
+{
+  return (AF_INET == _family && 0x7F == _addr._byte[0]) || (AF_INET6 == _family && IN6_IS_ADDR_LOOPBACK(&_addr._ip6));
 }
 
 /// Assign sockaddr storage.
-inline IpAddr&
-IpAddr::assign(sockaddr const* addr) {
+inline IpAddr &
+IpAddr::assign(sockaddr const *addr)
+{
   if (addr) {
     _family = addr->sa_family;
     if (ats_is_ip4(addr)) {
@@ -1242,47 +1358,59 @@ IpAddr::assign(sockaddr const* addr) {
 }
 
 // Associated operators.
-bool operator == (IpAddr const& lhs, sockaddr const* rhs);
-inline bool operator == (sockaddr const* lhs, IpAddr const& rhs) {
+bool operator==(IpAddr const &lhs, sockaddr const *rhs);
+inline bool operator==(sockaddr const *lhs, IpAddr const &rhs)
+{
   return rhs == lhs;
 }
-inline bool operator != (IpAddr const& lhs, sockaddr const* rhs) {
-  return ! (lhs == rhs);
+inline bool operator!=(IpAddr const &lhs, sockaddr const *rhs)
+{
+  return !(lhs == rhs);
 }
-inline bool operator != (sockaddr const* lhs, IpAddr const& rhs) {
-  return ! (rhs == lhs);
+inline bool operator!=(sockaddr const *lhs, IpAddr const &rhs)
+{
+  return !(rhs == lhs);
 }
-inline bool operator == (IpAddr const& lhs, IpEndpoint const& rhs) {
+inline bool operator==(IpAddr const &lhs, IpEndpoint const &rhs)
+{
   return lhs == &rhs.sa;
 }
-inline bool operator == (IpEndpoint const& lhs, IpAddr const& rhs) {
+inline bool operator==(IpEndpoint const &lhs, IpAddr const &rhs)
+{
   return &lhs.sa == rhs;
 }
-inline bool operator != (IpAddr const& lhs, IpEndpoint const& rhs) {
-  return ! (lhs == &rhs.sa);
+inline bool operator!=(IpAddr const &lhs, IpEndpoint const &rhs)
+{
+  return !(lhs == &rhs.sa);
 }
-inline bool operator != (IpEndpoint const& lhs, IpAddr const& rhs) {
-  return ! (rhs == &lhs.sa);
+inline bool operator!=(IpEndpoint const &lhs, IpAddr const &rhs)
+{
+  return !(rhs == &lhs.sa);
 }
 
-inline bool operator < (IpAddr const& lhs, IpAddr const& rhs) {
+inline bool operator<(IpAddr const &lhs, IpAddr const &rhs)
+{
   return -1 == lhs.cmp(rhs);
 }
 
-inline bool operator >= (IpAddr const& lhs, IpAddr const& rhs) {
+inline bool operator>=(IpAddr const &lhs, IpAddr const &rhs)
+{
   return lhs.cmp(rhs) >= 0;
 }
 
-inline bool operator > (IpAddr const& lhs, IpAddr const& rhs) {
+inline bool operator>(IpAddr const &lhs, IpAddr const &rhs)
+{
   return 1 == lhs.cmp(rhs);
 }
 
-inline bool operator <= (IpAddr const& lhs, IpAddr const& rhs) {
-  return  lhs.cmp(rhs) <= 0;
+inline bool operator<=(IpAddr const &lhs, IpAddr const &rhs)
+{
+  return lhs.cmp(rhs) <= 0;
 }
 
 inline uint32_t
-IpAddr::hash() const {
+IpAddr::hash() const
+{
   uint32_t zret = 0;
   if (this->isIp4()) {
     zret = ntohl(_addr._ip4);
@@ -1294,56 +1422,74 @@ IpAddr::hash() const {
 
 /// Write IP @a addr to storage @a dst.
 /// @return @s dst.
-sockaddr* ats_ip_set(
-  sockaddr* dst, ///< Destination storage.
-  IpAddr const& addr, ///< source address.
-  in_port_t port = 0 ///< port, network order.
-);
+sockaddr *ats_ip_set(sockaddr *dst,      ///< Destination storage.
+                     IpAddr const &addr, ///< source address.
+                     in_port_t port = 0  ///< port, network order.
+                     );
 
 /** Convert @a text to an IP address and write it to @a addr.
     Convenience overload.
     @return 0 on success, non-zero on failure.
 */
-inline int ats_ip_pton(
-  char const* text, ///< [in] text.
-  IpAddr& addr ///< [out] address
-) {
+inline int
+ats_ip_pton(char const *text, ///< [in] text.
+            IpAddr &addr      ///< [out] address
+            )
+{
   return addr.load(text) ? 0 : -1;
 }
 
-inline IpEndpoint&
-IpEndpoint::assign(IpAddr const& addr, in_port_t port) {
+inline IpEndpoint &
+IpEndpoint::assign(IpAddr const &addr, in_port_t port)
+{
   ats_ip_set(&sa, addr, port);
   return *this;
 }
 
-inline IpEndpoint&
-IpEndpoint::assign(sockaddr const* ip) {
+inline IpEndpoint &
+IpEndpoint::assign(sockaddr const *ip)
+{
   ats_ip_copy(&sa, ip);
   return *this;
 }
 
-inline in_port_t&
-IpEndpoint::port() {
+inline in_port_t &
+IpEndpoint::port()
+{
   return ats_ip_port_cast(&sa);
 }
 
 inline in_port_t
-IpEndpoint::port() const {
+IpEndpoint::port() const
+{
   return ats_ip_port_cast(&sa);
 }
 
 inline bool
-IpEndpoint::isValid() const {
+IpEndpoint::isValid() const
+{
   return ats_is_ip(this);
 }
 
-inline bool IpEndpoint::isIp4() const { return AF_INET == sa.sa_family; }
-inline bool IpEndpoint::isIp6() const { return AF_INET6 == sa.sa_family; }
-inline uint16_t IpEndpoint::family() const { return sa.sa_family; }
+inline bool
+IpEndpoint::isIp4() const
+{
+  return AF_INET == sa.sa_family;
+}
+inline bool
+IpEndpoint::isIp6() const
+{
+  return AF_INET6 == sa.sa_family;
+}
+inline uint16_t
+IpEndpoint::family() const
+{
+  return sa.sa_family;
+}
 
-inline IpEndpoint&
-IpEndpoint::setToAnyAddr(int family) {
+inline IpEndpoint &
+IpEndpoint::setToAnyAddr(int family)
+{
   ink_zero(*this);
   sa.sa_family = family;
   if (AF_INET == family) {
@@ -1360,8 +1506,9 @@ IpEndpoint::setToAnyAddr(int family) {
   return *this;
 }
 
-inline IpEndpoint&
-IpEndpoint::setToLoopback(int family) {
+inline IpEndpoint &
+IpEndpoint::setToLoopback(int family)
+{
   ink_zero(*this);
   sa.sa_family = family;
   if (AF_INET == family) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_inout.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_inout.h b/lib/ts/ink_inout.h
index fd6e701..56b04b3 100644
--- a/lib/ts/ink_inout.h
+++ b/lib/ts/ink_inout.h
@@ -32,45 +32,55 @@
 // source of good macros..
 #ifdef __cplusplus
 extern "C" {
-#endif                          /* __cplusplus */
+#endif /* __cplusplus */
 #include <arpa/nameser.h>
 #ifdef __cplusplus
 }
-#endif                          /* __cplusplus */
+#endif /* __cplusplus */
 
-#define GETCHAR(s, cp) { \
-        (s) = *(cp)++; \
-}
+#define GETCHAR(s, cp) \
+  {                    \
+    (s) = *(cp)++;     \
+  }
 
-#define PUTCHAR(s, cp) { \
-        *(cp)++ = (s); \
-}
+#define PUTCHAR(s, cp) \
+  {                    \
+    *(cp)++ = (s);     \
+  }
 
-#define	GETLONGLONG(l, cp) { \
-	(l) = *(cp)++ << 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; \
-}
+#define GETLONGLONG(l, cp) \
+  {                        \
+    (l) = *(cp)++ << 8;    \
+    (l) |= *(cp)++;        \
+    (l) <<= 8;             \
+    (l) |= *(cp)++;        \
+    (l) <<= 8;             \
+    (l) |= *(cp)++;        \
+    (l) <<= 8;             \
+    (l) |= *(cp)++;        \
+    (l) <<= 8;             \
+    (l) |= *(cp)++;        \
+    (l) <<= 8;             \
+    (l) |= *(cp)++;        \
+    (l) <<= 8;             \
+    (l) |= *(cp)++;        \
+  }
 
 /*
  * Warning: PUTLONGLONG destroys its first argument.
  */
-#define	PUTLONGLONG(l, cp) { \
-	(cp)[7] = l; \
-	(cp)[6] = (l >>= 8); \
-	(cp)[5] = (l >>= 8); \
-	(cp)[4] = (l >>= 8); \
-	(cp)[3] = (l >>= 8); \
-	(cp)[2] = (l >>= 8); \
-	(cp)[1] = (l >>= 8); \
-	(cp)[0] = l >> 8; \
-	(cp) += 8; \
-}
+#define PUTLONGLONG(l, cp) \
+  {                        \
+    (cp)[7] = l;           \
+    (cp)[6] = (l >>= 8);   \
+    (cp)[5] = (l >>= 8);   \
+    (cp)[4] = (l >>= 8);   \
+    (cp)[3] = (l >>= 8);   \
+    (cp)[2] = (l >>= 8);   \
+    (cp)[1] = (l >>= 8);   \
+    (cp)[0] = l >> 8;      \
+    (cp) += 8;             \
+  }
 
 
-#endif                          /* #ifndef _INOUT_H */
+#endif /* #ifndef _INOUT_H */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_llqueue.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_llqueue.h b/lib/ts/ink_llqueue.h
index 67df59d..fa25ea0 100644
--- a/lib/ts/ink_llqueue.h
+++ b/lib/ts/ink_llqueue.h
@@ -32,28 +32,26 @@ A simple linked list queue.
 #include "ink_mutex.h"
 #include "ink_thread.h"
 
-typedef struct llqrec_s
-{
+typedef struct llqrec_s {
   struct llqrec_s *next;
   void *data;
 } LLQrec;
 
-typedef struct llq_s
-{
-  LLQrec * head, *tail, *free;
+typedef struct llq_s {
+  LLQrec *head, *tail, *free;
   uint64_t len, highwater;
   ink_mutex mux;
   ink_semaphore sema;
 } LLQ;
 
 LLQ *create_queue(void);
-int enqueue(LLQ * q, void *data);
-void *dequeue(LLQ * q);
-bool queue_is_empty(LLQ * q);
-uint64_t queue_len(LLQ * Q);
-uint64_t queue_highwater(LLQ * Q);
-void delete_queue(LLQ * Q);     /* only deletes an empty queue but
-                                   provides symmetry. */
+int enqueue(LLQ *q, void *data);
+void *dequeue(LLQ *q);
+bool queue_is_empty(LLQ *q);
+uint64_t queue_len(LLQ *Q);
+uint64_t queue_highwater(LLQ *Q);
+void delete_queue(LLQ *Q); /* only deletes an empty queue but
+                              provides symmetry. */
 
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_lockfile.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_lockfile.h b/lib/ts/ink_lockfile.h
index 900c932..6dc6bab 100644
--- a/lib/ts/ink_lockfile.h
+++ b/lib/ts/ink_lockfile.h
@@ -27,34 +27,28 @@
 #include "ink_defs.h"
 #include "ink_string.h"
 
-#define COP_LOCK       "cop.lock"
-#define MANAGER_LOCK   "manager.lock"
-#define SERVER_LOCK    "server.lock"
+#define COP_LOCK "cop.lock"
+#define MANAGER_LOCK "manager.lock"
+#define SERVER_LOCK "server.lock"
 
 class Lockfile
 {
 public:
-  Lockfile(void):fd(0)
-  {
-    fname[0] = '\0';
-  }
+  Lockfile(void) : fd(0) { fname[0] = '\0'; }
 
   // coverity[uninit_member]
-  Lockfile(const char *filename):fd(0)
-  {
-    ink_strlcpy(fname, filename, sizeof(fname));
-  }
+  Lockfile(const char *filename) : fd(0) { ink_strlcpy(fname, filename, sizeof(fname)); }
 
-  ~Lockfile(void)
-  {
-  }
+  ~Lockfile(void) {}
 
-  void SetLockfileName(const char *filename)
+  void
+  SetLockfileName(const char *filename)
   {
     ink_strlcpy(fname, filename, sizeof(fname));
   }
 
-  const char *GetLockfileName(void)
+  const char *
+  GetLockfileName(void)
   {
     return fname;
   }
@@ -65,7 +59,7 @@ public:
   //   -errno on error
   //   0 if someone is holding the lock (with holding_pid set)
   //   1 if we now have a writable lock file
-  int Open(pid_t * holding_pid);
+  int Open(pid_t *holding_pid);
 
   // Get()
   //
@@ -74,7 +68,7 @@ public:
   //   -errno on error
   //   0 if someone is holding the lock (with holding_pid set)
   //   1 if we now have a writable lock file
-  int Get(pid_t * holding_pid);
+  int Get(pid_t *holding_pid);
 
   // Close()
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_memory.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_memory.cc b/lib/ts/ink_memory.cc
index d2e94d6..4c18c43 100644
--- a/lib/ts/ink_memory.cc
+++ b/lib/ts/ink_memory.cc
@@ -53,7 +53,7 @@ ats_malloc(size_t size)
     }
   }
   return ptr;
-}                               /* End ats_malloc */
+} /* End ats_malloc */
 
 void *
 ats_calloc(size_t nelem, size_t elsize)
@@ -64,7 +64,7 @@ ats_calloc(size_t nelem, size_t elsize)
     ink_fatal("ats_calloc: couldn't allocate %zu %zu byte elements", nelem, elsize);
   }
   return ptr;
-}                               /* End ats_calloc */
+} /* End ats_calloc */
 
 void *
 ats_realloc(void *ptr, size_t size)
@@ -75,7 +75,7 @@ ats_realloc(void *ptr, size_t size)
     ink_fatal("ats_realloc: couldn't reallocate %zu bytes", size);
   }
   return newptr;
-}                               /* End ats_realloc */
+} /* End ats_realloc */
 
 // TODO: For Win32 platforms, we need to figure out what to do with memalign.
 // The older code had ifdef's around such calls, turning them into ats_malloc().
@@ -90,46 +90,43 @@ ats_memalign(size_t alignment, size_t size)
 
 #if defined(openbsd)
   if (alignment > PAGE_SIZE)
-      alignment = PAGE_SIZE;
+    alignment = PAGE_SIZE;
 #endif
 
   int retcode = posix_memalign(&ptr, alignment, size);
 
   if (unlikely(retcode)) {
     if (retcode == EINVAL) {
-      ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu - invalid alignment parameter",
-                size, alignment);
+      ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu - invalid alignment parameter", size, alignment);
     } else if (retcode == ENOMEM) {
-      ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu - insufficient memory",
-                size, alignment);
+      ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu - insufficient memory", size, alignment);
     } else {
-      ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu - unknown error %d",
-                size, alignment, retcode);
+      ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu - unknown error %d", size, alignment, retcode);
     }
   }
 #else
   ptr = memalign(alignment, size);
   if (unlikely(ptr == NULL)) {
-    ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu",  size,  alignment);
+    ink_fatal("ats_memalign: couldn't allocate %zu bytes at alignment %zu", size, alignment);
   }
 #endif
   return ptr;
-}                               /* End ats_memalign */
+} /* End ats_memalign */
 
 void
 ats_free(void *ptr)
 {
   if (likely(ptr != NULL))
     free(ptr);
-}                               /* End ats_free */
+} /* End ats_free */
 
-void*
+void *
 ats_free_null(void *ptr)
 {
   if (likely(ptr != NULL))
     free(ptr);
   return NULL;
-}                               /* End ats_free_null */
+} /* End ats_free_null */
 
 void
 ats_memalign_free(void *ptr)
@@ -166,11 +163,11 @@ ats_msync(caddr_t addr, size_t len, caddr_t end, int flags)
   size_t pagesize = ats_pagesize();
 
   // align start back to page boundary
-  caddr_t a = (caddr_t) (((uintptr_t) addr) & ~(pagesize - 1));
+  caddr_t a = (caddr_t)(((uintptr_t)addr) & ~(pagesize - 1));
   // align length to page boundry covering region
   size_t l = (len + (addr - a) + (pagesize - 1)) & ~(pagesize - 1);
   if ((a + l) > end)
-    l = end - a;                // strict limit
+    l = end - a; // strict limit
 #if defined(linux)
 /* Fix INKqa06500
    Under Linux, msync(..., MS_SYNC) calls are painfully slow, even on
@@ -191,13 +188,13 @@ int
 ats_madvise(caddr_t addr, size_t len, int flags)
 {
 #if defined(linux)
-  (void) addr;
-  (void) len;
-  (void) flags;
+  (void)addr;
+  (void)len;
+  (void)flags;
   return 0;
 #else
   size_t pagesize = ats_pagesize();
-  caddr_t a = (caddr_t) (((uintptr_t) addr) & ~(pagesize - 1));
+  caddr_t a = (caddr_t)(((uintptr_t)addr) & ~(pagesize - 1));
   size_t l = (len + (addr - a) + pagesize - 1) & ~(pagesize - 1);
   int res = 0;
 #if HAVE_POSIX_MADVISE
@@ -214,7 +211,7 @@ ats_mlock(caddr_t addr, size_t len)
 {
   size_t pagesize = ats_pagesize();
 
-  caddr_t a = (caddr_t) (((uintptr_t) addr) & ~(pagesize - 1));
+  caddr_t a = (caddr_t)(((uintptr_t)addr) & ~(pagesize - 1));
   size_t l = (len + (addr - a) + pagesize - 1) & ~(pagesize - 1);
   int res = mlock(a, l);
   return res;
@@ -225,7 +222,7 @@ ats_mlock(caddr_t addr, size_t len)
   Moved from old ink_resource.h
   -------------------------------------------------------------------------*/
 char *
-_xstrdup(const char *str, int length, const char* /* path ATS_UNUSED */)
+_xstrdup(const char *str, int length, const char * /* path ATS_UNUSED */)
 {
   char *newstr;
 
@@ -239,7 +236,7 @@ _xstrdup(const char *str, int length, const char* /* path ATS_UNUSED */)
       *newstr = '\0';
     } else {
       strncpy(newstr, str, length); // we cannot do length + 1 because the string isn't
-      newstr[length] = '\0'; // guaranteeed to be null terminated!
+      newstr[length] = '\0';        // guaranteeed to be null terminated!
     }
     return newstr;
   }


[52/52] trafficserver git commit: Update CHANGES with TS-3419

Posted by zw...@apache.org.
Update CHANGES with TS-3419


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bc6acc0b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bc6acc0b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bc6acc0b

Branch: refs/heads/master
Commit: bc6acc0b84a8c53d2022298dfa9d3dc6541e4b83
Parents: 6547794
Author: Leif Hedstrom <le...@ogre.com>
Authored: Sat Mar 21 19:14:35 2015 -0600
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Sun Mar 22 19:16:52 2015 -0600

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bc6acc0b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 696c6ff..5235892 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3419] Run the source through clang-format. Keep it clean!
+
   *) [TS-3459] Create a new config to disallow Post w/ Expect: 100-continue
 
   *) [TS-3312] KA timeout to origin does not honor configs


[29/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/I_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index ab1f3ed..bcdc3a0 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -28,15 +28,15 @@
 #include "SRV.h"
 
 // Event returned on a lookup
-#define EVENT_HOST_DB_LOOKUP                 (HOSTDB_EVENT_EVENTS_START+0)
-#define EVENT_HOST_DB_IP_REMOVED             (HOSTDB_EVENT_EVENTS_START+1)
-#define EVENT_HOST_DB_GET_RESPONSE           (HOSTDB_EVENT_EVENTS_START+2)
+#define EVENT_HOST_DB_LOOKUP (HOSTDB_EVENT_EVENTS_START + 0)
+#define EVENT_HOST_DB_IP_REMOVED (HOSTDB_EVENT_EVENTS_START + 1)
+#define EVENT_HOST_DB_GET_RESPONSE (HOSTDB_EVENT_EVENTS_START + 2)
 
-#define EVENT_SRV_LOOKUP                 (SRV_EVENT_EVENTS_START+0)
-#define EVENT_SRV_IP_REMOVED             (SRV_EVENT_EVENTS_START+1)
-#define EVENT_SRV_GET_RESPONSE           (SRV_EVENT_EVENTS_START+2)
+#define EVENT_SRV_LOOKUP (SRV_EVENT_EVENTS_START + 0)
+#define EVENT_SRV_IP_REMOVED (SRV_EVENT_EVENTS_START + 1)
+#define EVENT_SRV_GET_RESPONSE (SRV_EVENT_EVENTS_START + 2)
 
-#define HOST_DB_MAX_ROUND_ROBIN_INFO         16
+#define HOST_DB_MAX_ROUND_ROBIN_INFO 16
 
 #define HOST_DB_SRV_PREFIX "_http._tcp."
 //
@@ -85,10 +85,8 @@ makeHostHash(const char *string)
 // is treated as opacque by the database.
 //
 
-union HostDBApplicationInfo
-{
-  struct application_data_allotment
-  {
+union HostDBApplicationInfo {
+  struct application_data_allotment {
     unsigned int application1;
     unsigned int application2;
   } allotment;
@@ -106,55 +104,62 @@ union HostDBApplicationInfo
   // fail_count         - Number of times we tried and    //
   //                       and failed to contact the host //
   //////////////////////////////////////////////////////////
-  struct http_server_attr
-  {
-    unsigned int http_version:3;
-    unsigned int pipeline_max:7;
-    unsigned int keepalive_timeout:6;
-    unsigned int fail_count:8;
-    unsigned int unused1:8;
-    unsigned int last_failure:32;
+  struct http_server_attr {
+    unsigned int http_version : 3;
+    unsigned int pipeline_max : 7;
+    unsigned int keepalive_timeout : 6;
+    unsigned int fail_count : 8;
+    unsigned int unused1 : 8;
+    unsigned int last_failure : 32;
   } http_data;
 
-  enum HttpVersion_t
-  {
+  enum HttpVersion_t {
     HTTP_VERSION_UNDEFINED = 0,
     HTTP_VERSION_09 = 1,
     HTTP_VERSION_10 = 2,
-    HTTP_VERSION_11 = 3
+    HTTP_VERSION_11 = 3,
   };
 
-  struct application_data_rr
-  {
+  struct application_data_rr {
     int offset;
   } rr;
 };
 
 struct HostDBRoundRobin;
 
-struct SRVInfo
-{
-  unsigned int srv_offset:16;
-  unsigned int srv_weight:16;
-  unsigned int srv_priority:16;
-  unsigned int srv_port:16;
+struct SRVInfo {
+  unsigned int srv_offset : 16;
+  unsigned int srv_weight : 16;
+  unsigned int srv_priority : 16;
+  unsigned int srv_port : 16;
   unsigned int key;
 };
 
-struct HostDBInfo
-{
+struct HostDBInfo {
   /** Internal IP address data.
       This is at least large enough to hold an IPv6 address.
   */
-  sockaddr* ip()  { return &data.ip.sa; }
-  sockaddr const* ip() const { return &data.ip.sa; }
+  sockaddr *
+  ip()
+  {
+    return &data.ip.sa;
+  }
+  sockaddr const *
+  ip() const
+  {
+    return &data.ip.sa;
+  }
 
   char *hostname();
   char *srvname(HostDBRoundRobin *rr);
   HostDBRoundRobin *rr();
 
   /** Indicate that the HostDBInfo is BAD and should be deleted. */
-  void bad() { full = 0; }
+  void
+  bad()
+  {
+    full = 0;
+  }
 
   /**
     Application specific data. NOTE: We need an integral number of these
@@ -164,36 +169,45 @@ struct HostDBInfo
   */
   HostDBApplicationInfo app;
 
-  unsigned int ip_interval()
+  unsigned int
+  ip_interval()
   {
     return (hostdb_current_interval - ip_timestamp) & 0x7FFFFFFF;
   }
 
-  int ip_time_remaining()
+  int
+  ip_time_remaining()
   {
     return static_cast<int>(ip_timeout_interval) - static_cast<int>(this->ip_interval());
   }
 
-  bool is_ip_stale() {
-    return ip_timeout_interval >= 2 * hostdb_ip_stale_interval &&
-      ip_interval() >= hostdb_ip_stale_interval
-      ;
+  bool
+  is_ip_stale()
+  {
+    return ip_timeout_interval >= 2 * hostdb_ip_stale_interval && ip_interval() >= hostdb_ip_stale_interval;
   }
 
-  bool is_ip_timeout() {
+  bool
+  is_ip_timeout()
+  {
     return ip_timeout_interval && ip_interval() >= ip_timeout_interval;
   }
 
-  bool is_ip_fail_timeout() {
+  bool
+  is_ip_fail_timeout()
+  {
     return ip_interval() >= hostdb_ip_fail_timeout_interval;
   }
 
-  void refresh_ip()
+  void
+  refresh_ip()
   {
     ip_timestamp = hostdb_current_interval;
   }
 
-  bool serve_stale_but_revalidate() {
+  bool
+  serve_stale_but_revalidate()
+  {
     // the option is disabled
     if (hostdb_serve_stale_but_revalidate <= 0)
       return false;
@@ -202,8 +216,8 @@ struct HostDBInfo
     // hostdb_serve_stale_but_revalidate == number of seconds
     // ip_interval() is the number of seconds between now() and when the entry was inserted
     if ((ip_timeout_interval + hostdb_serve_stale_but_revalidate) > ip_interval()) {
-      Debug("hostdb", "serving stale entry %d | %d | %d as requested by config",
-            ip_timeout_interval, hostdb_serve_stale_but_revalidate, ip_interval());
+      Debug("hostdb", "serving stale entry %d | %d | %d as requested by config", ip_timeout_interval,
+            hostdb_serve_stale_but_revalidate, ip_interval());
       return true;
     }
     // otherwise, the entry is too old
@@ -216,7 +230,7 @@ struct HostDBInfo
   //
 
   union {
-    IpEndpoint ip; ///< IP address / port data.
+    IpEndpoint ip;       ///< IP address / port data.
     int hostname_offset; ///< Some hostname thing.
     SRVInfo srv;
   } data;
@@ -226,24 +240,28 @@ struct HostDBInfo
   // if this is 0 then no timeout.
   unsigned int ip_timeout_interval;
 
-  unsigned int full:1;
-  unsigned int backed:1;        // duplicated in lower level
-  unsigned int deleted:1;
-  unsigned int hits:3;
+  unsigned int full : 1;
+  unsigned int backed : 1; // duplicated in lower level
+  unsigned int deleted : 1;
+  unsigned int hits : 3;
 
-  unsigned int is_srv:1; // steal a bit from ip_timeout_interval
-  unsigned int round_robin:1;
-  unsigned int reverse_dns:1;
+  unsigned int is_srv : 1; // steal a bit from ip_timeout_interval
+  unsigned int round_robin : 1;
+  unsigned int reverse_dns : 1;
 
-  unsigned int md5_low_low:24;
+  unsigned int md5_low_low : 24;
   unsigned int md5_low;
 
   uint64_t md5_high;
 
-  bool failed() {
+  bool
+  failed()
+  {
     return !((is_srv && data.srv.srv_offset) || (reverse_dns && data.hostname_offset) || ats_is_ip(ip()));
   }
-  void set_failed() {
+  void
+  set_failed()
+  {
     if (is_srv)
       data.srv.srv_offset = 0;
     else if (reverse_dns)
@@ -252,12 +270,25 @@ struct HostDBInfo
       ats_ip_invalidate(ip());
   }
 
-  void set_deleted() { deleted = 1; }
-  bool is_deleted() const { return deleted; }
+  void
+  set_deleted()
+  {
+    deleted = 1;
+  }
+  bool
+  is_deleted() const
+  {
+    return deleted;
+  }
 
-  bool is_empty() const { return !full; }
+  bool
+  is_empty() const
+  {
+    return !full;
+  }
 
-  void set_empty()
+  void
+  set_empty()
   {
     full = 0;
     md5_high = 0;
@@ -265,18 +296,20 @@ struct HostDBInfo
     md5_low_low = 0;
   }
 
-  void set_full(uint64_t folded_md5, int buckets)
+  void
+  set_full(uint64_t folded_md5, int buckets)
   {
     uint64_t ttag = folded_md5 / buckets;
 
     if (!ttag)
       ttag = 1;
-    md5_low_low = (unsigned int) ttag;
-    md5_low = (unsigned int) (ttag >> 24);
+    md5_low_low = (unsigned int)ttag;
+    md5_low = (unsigned int)(ttag >> 24);
     full = 1;
   }
 
-  void reset()
+  void
+  reset()
   {
     ats_ip_invalidate(ip());
     app.allotment.application1 = 0;
@@ -289,7 +322,9 @@ struct HostDBInfo
     is_srv = 0;
   }
 
-  uint64_t tag() {
+  uint64_t
+  tag()
+  {
     uint64_t f = md5_low;
     return (f << 24) + md5_low_low;
   }
@@ -300,8 +335,7 @@ struct HostDBInfo
 };
 
 
-struct HostDBRoundRobin
-{
+struct HostDBRoundRobin {
   /** Total number (to compute space used). */
   short rrcount;
 
@@ -316,7 +350,8 @@ struct HostDBRoundRobin
 
   // Return the allocation size of a HostDBRoundRobin struct suitable for storing
   // "count" HostDBInfo records.
-  static unsigned size(unsigned count, unsigned srv_len = 0)
+  static unsigned
+  size(unsigned count, unsigned srv_len = 0)
   {
     ink_assert(count > 0);
     return INK_ALIGN((sizeof(HostDBRoundRobin) + (count * sizeof(HostDBInfo)) + srv_len), 8);
@@ -325,34 +360,30 @@ struct HostDBRoundRobin
   /** Find the index of @a addr in member @a info.
       @return The index if found, -1 if not found.
   */
-  int index_of(sockaddr const* addr);
-  HostDBInfo *find_ip(sockaddr const* addr);
+  int index_of(sockaddr const *addr);
+  HostDBInfo *find_ip(sockaddr const *addr);
   // Find the srv target
   HostDBInfo *find_target(const char *target);
   /** Select the next entry after @a addr.
       @note If @a addr isn't an address in the round robin nothing is updated.
       @return The selected entry or @c NULL if @a addr wasn't present.
    */
-  HostDBInfo* select_next(sockaddr const* addr);
-  HostDBInfo *select_best_http(sockaddr const* client_ip, ink_time_t now, int32_t fail_window);
+  HostDBInfo *select_next(sockaddr const *addr);
+  HostDBInfo *select_best_http(sockaddr const *client_ip, ink_time_t now, int32_t fail_window);
   HostDBInfo *select_best_srv(char *target, InkRand *rand, ink_time_t now, int32_t fail_window);
-  HostDBRoundRobin()
-    : rrcount(0), good(0), current(0), length(0), timed_rr_ctime(0)
-  { }
-
+  HostDBRoundRobin() : rrcount(0), good(0), current(0), length(0), timed_rr_ctime(0) {}
 };
 
 struct HostDBCache;
 
 // Prototype for inline completion functionf or
 //  getbyname_imm()
-typedef void (Continuation::*process_hostdb_info_pfn) (HostDBInfo * r);
-typedef void (Continuation::*process_srv_info_pfn) (HostDBInfo * r);
+typedef void (Continuation::*process_hostdb_info_pfn)(HostDBInfo *r);
+typedef void (Continuation::*process_srv_info_pfn)(HostDBInfo *r);
 
 
 /** The Host Databse access interface. */
-struct HostDBProcessor: public Processor
-{
+struct HostDBProcessor : public Processor {
   friend struct HostDBSyncer;
   // Public Interface
 
@@ -364,8 +395,8 @@ struct HostDBProcessor: public Processor
   //       cache.  The HostDBInfo * becomes invalid when the callback returns.
   //       The HostDBInfo may be changed during the callback.
 
-  enum
-  { HOSTDB_DO_NOT_FORCE_DNS = 0,
+  enum {
+    HOSTDB_DO_NOT_FORCE_DNS = 0,
     HOSTDB_ROUND_ROBIN = 0,
     HOSTDB_FORCE_DNS_RELOAD = 1,
     HOSTDB_FORCE_DNS_ALWAYS = 2,
@@ -374,40 +405,40 @@ struct HostDBProcessor: public Processor
 
   /// Optional parameters for getby...
   struct Options {
-    typedef Options self; ///< Self reference type.
-    int port; ///< Target service port (default 0 -> don't care)
-    int flags; ///< Processing flags (default HOSTDB_DO_NOT_FORCE_DNS)
-    int timeout; ///< Timeout value (default 0 -> default timeout)
+    typedef Options self;        ///< Self reference type.
+    int port;                    ///< Target service port (default 0 -> don't care)
+    int flags;                   ///< Processing flags (default HOSTDB_DO_NOT_FORCE_DNS)
+    int timeout;                 ///< Timeout value (default 0 -> default timeout)
     HostResStyle host_res_style; ///< How to query host (default HOST_RES_IPV4)
 
-    Options() : port(0), flags(HOSTDB_DO_NOT_FORCE_DNS), timeout(0), host_res_style(HOST_RES_IPV4)
-    { }
+    Options() : port(0), flags(HOSTDB_DO_NOT_FORCE_DNS), timeout(0), host_res_style(HOST_RES_IPV4) {}
 
     /// Set the flags.
-    self& setFlags(int f) { flags = f; return *this; }
+    self &
+    setFlags(int f)
+    {
+      flags = f;
+      return *this;
+    }
   };
 
   /// Default options.
   static Options const DEFAULT_OPTIONS;
 
-  HostDBProcessor()
-  { }
+  HostDBProcessor() {}
 
-  inkcoreapi Action *getbyname_re(Continuation * cont, const char *hostname, int len, Options const& opt = DEFAULT_OPTIONS);
+  inkcoreapi Action *getbyname_re(Continuation *cont, const char *hostname, int len, Options const &opt = DEFAULT_OPTIONS);
 
-  Action *getSRVbyname_imm(Continuation * cont, process_srv_info_pfn process_srv_info, const char *hostname, int len, Options const& opt = DEFAULT_OPTIONS);
+  Action *getSRVbyname_imm(Continuation *cont, process_srv_info_pfn process_srv_info, const char *hostname, int len,
+                           Options const &opt = DEFAULT_OPTIONS);
 
-  Action *getbyname_imm(
-    Continuation * cont,
-    process_hostdb_info_pfn process_hostdb_info,
-    const char *hostname,
-    int len,
-    Options const& opt = DEFAULT_OPTIONS
-  );
+  Action *getbyname_imm(Continuation *cont, process_hostdb_info_pfn process_hostdb_info, const char *hostname, int len,
+                        Options const &opt = DEFAULT_OPTIONS);
 
 
   /** Lookup Hostinfo by addr */
-  Action *getbyaddr_re(Continuation * cont, sockaddr const* aip)
+  Action *
+  getbyaddr_re(Continuation *cont, sockaddr const *aip)
   {
     return getby(cont, NULL, 0, aip, false, HOST_RES_NONE, 0);
   }
@@ -428,18 +459,22 @@ struct HostDBProcessor: public Processor
 #endif
 
   /** Set the application information (fire-and-forget). */
-  void setbyname_appinfo(char *hostname, int len, int port, HostDBApplicationInfo * app)
+  void
+  setbyname_appinfo(char *hostname, int len, int port, HostDBApplicationInfo *app)
   {
     sockaddr_in addr;
     ats_ip4_set(&addr, INADDR_ANY, port);
     setby(hostname, len, ats_ip_sa_cast(&addr), app);
   }
 
-  void setbyaddr_appinfo(sockaddr const* addr, HostDBApplicationInfo * app) {
+  void
+  setbyaddr_appinfo(sockaddr const *addr, HostDBApplicationInfo *app)
+  {
     this->setby(0, 0, addr, app);
   }
 
-  void setbyaddr_appinfo(in_addr_t ip, HostDBApplicationInfo * app)
+  void
+  setbyaddr_appinfo(in_addr_t ip, HostDBApplicationInfo *app)
   {
     sockaddr_in addr;
     ats_ip4_set(&addr, ip);
@@ -458,29 +493,24 @@ struct HostDBProcessor: public Processor
 
   // Private
   HostDBCache *cache();
+
 private:
-  Action *getby(
-    Continuation * cont,
-    const char *hostname, int len,
-    sockaddr const* ip,
-    bool aforce_dns, HostResStyle host_res_style, int timeout
-  );
+  Action *getby(Continuation *cont, const char *hostname, int len, sockaddr const *ip, bool aforce_dns, HostResStyle host_res_style,
+                int timeout);
+
 public:
   /** Set something.
       @a aip can carry address and / or port information. If setting just
       by a port value, the address should be set to INADDR_ANY which is of
       type IPv4.
    */
-  void setby(
-    const char *hostname, ///< Hostname.
-    int len, ///< Length of hostname.
-    sockaddr const* aip, ///< Address and/or port.
-    HostDBApplicationInfo * app ///< I don't know.
-  );
-
-  void setby_srv(const char *hostname, int len, const char *target,
-      HostDBApplicationInfo * app);
+  void setby(const char *hostname,      ///< Hostname.
+             int len,                   ///< Length of hostname.
+             sockaddr const *aip,       ///< Address and/or port.
+             HostDBApplicationInfo *app ///< I don't know.
+             );
 
+  void setby_srv(const char *hostname, int len, const char *target, HostDBApplicationInfo *app);
 };
 
 void run_HostDBTest();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/Inline.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/Inline.cc b/iocore/hostdb/Inline.cc
index e93e860..dd8fb46 100644
--- a/iocore/hostdb/Inline.cc
+++ b/iocore/hostdb/Inline.cc
@@ -28,5 +28,3 @@
 
 #define TS_INLINE
 #include "P_HostDB.h"
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/MultiCache.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc
index bac792d..b219631 100644
--- a/iocore/hostdb/MultiCache.cc
+++ b/iocore/hostdb/MultiCache.cc
@@ -32,7 +32,7 @@
 #include "I_Layout.h"
 #include "P_HostDB.h"
 #include "P_MultiCache.h"
-#include "P_EventSystem.h"      // FIXME: need to have this in I_* header files.
+#include "P_EventSystem.h" // FIXME: need to have this in I_* header files.
 #include "ink_file.h"
 
 static const int MC_SYNC_MIN_PAUSE_TIME = HRTIME_MSECONDS(200); // Pause for at least 200ms
@@ -53,7 +53,7 @@ store_verify(Store *store)
   if (!store)
     return 0;
   for (unsigned i = 0; i < store->n_disks; i++) {
-    for (Span * sd = store->disk[i]; sd; sd = sd->link.next) {
+    for (Span *sd = store->disk[i]; sd; sd = sd->link.next) {
       if (!sd->file_pathname && sd->offset)
         return 0;
     }
@@ -62,9 +62,8 @@ store_verify(Store *store)
 }
 
 MultiCacheHeader::MultiCacheHeader()
-  : magic(MULTI_CACHE_MAGIC_NUMBER), levels(0),
-    tag_bits(0), max_hits(0), elementsize(0),
-    buckets(0), totalelements(0), totalsize(0), nominal_elements(0), heap_size(0), heap_halfspace(0)
+  : magic(MULTI_CACHE_MAGIC_NUMBER), levels(0), tag_bits(0), max_hits(0), elementsize(0), buckets(0), totalelements(0),
+    totalsize(0), nominal_elements(0), heap_size(0), heap_halfspace(0)
 {
   memset(level_offset, 0, sizeof(level_offset));
   memset(bucketsize, 0, sizeof(bucketsize));
@@ -78,7 +77,7 @@ MultiCacheHeader::MultiCacheHeader()
 static inline int
 bytes_to_blocks(int64_t b)
 {
-  return (int) ((b + (STORE_BLOCK_SIZE - 1)) / STORE_BLOCK_SIZE);
+  return (int)((b + (STORE_BLOCK_SIZE - 1)) / STORE_BLOCK_SIZE);
 }
 
 inline int
@@ -88,7 +87,7 @@ MultiCacheBase::blocks_in_level(unsigned int level)
   int prevblocks = 0;
   int b = 0;
   for (unsigned int i = 0; i <= level; i++) {
-    sumbytes += buckets * ((int64_t) bucketsize[i]);
+    sumbytes += buckets * ((int64_t)bucketsize[i]);
     int sumblocks = bytes_to_blocks(sumbytes);
     b = sumblocks - prevblocks;
     prevblocks = sumblocks;
@@ -102,10 +101,8 @@ MultiCacheBase::blocks_in_level(unsigned int level)
 // The higher levels (lower in number) contain fewer.
 //
 int
-MultiCacheBase::initialize(Store *astore, char *afilename,
-                           int aelements, int abuckets, unsigned int alevels,
-                           int level0_elements_per_bucket,
-                           int level1_elements_per_bucket, int level2_elements_per_bucket)
+MultiCacheBase::initialize(Store *astore, char *afilename, int aelements, int abuckets, unsigned int alevels,
+                           int level0_elements_per_bucket, int level1_elements_per_bucket, int level2_elements_per_bucket)
 {
   int64_t size = 0;
 
@@ -136,7 +133,7 @@ MultiCacheBase::initialize(Store *astore, char *afilename,
     elements[2] = level2_elements_per_bucket;
     totalelements += buckets * level2_elements_per_bucket;
     bucketsize[2] = elementsize * level2_elements_per_bucket;
-    size += (int64_t) bucketsize[2] * (int64_t) buckets;
+    size += (int64_t)bucketsize[2] * (int64_t)buckets;
 
     if (!(level2_elements_per_bucket / level1_elements_per_bucket)) {
       Warning("Size change too large, unable to reconfigure");
@@ -159,7 +156,7 @@ MultiCacheBase::initialize(Store *astore, char *afilename,
     elements[1] = level1_elements_per_bucket;
     totalelements += buckets * level1_elements_per_bucket;
     bucketsize[1] = elementsize * level1_elements_per_bucket;
-    size += (int64_t) bucketsize[1] * (int64_t) buckets;
+    size += (int64_t)bucketsize[1] * (int64_t)buckets;
     if (!(level1_elements_per_bucket / level0_elements_per_bucket)) {
       Warning("Size change too large, unable to reconfigure");
       return -2;
@@ -179,18 +176,18 @@ MultiCacheBase::initialize(Store *astore, char *afilename,
   elements[0] = level0_elements_per_bucket;
   totalelements += buckets * level0_elements_per_bucket;
   bucketsize[0] = elementsize * level0_elements_per_bucket;
-  size += (int64_t) bucketsize[0] * (int64_t) buckets;
+  size += (int64_t)bucketsize[0] * (int64_t)buckets;
 
   buckets_per_partitionF8 = (buckets << 8) / MULTI_CACHE_PARTITIONS;
   ink_release_assert(buckets_per_partitionF8);
 
   unsigned int blocks = (size + (STORE_BLOCK_SIZE - 1)) / STORE_BLOCK_SIZE;
 
-  heap_size = int ((float)totalelements * estimated_heap_bytes_per_entry());
+  heap_size = int((float)totalelements * estimated_heap_bytes_per_entry());
   blocks += bytes_to_blocks(heap_size);
 
-  blocks += 1;                  // header
-  totalsize = (int64_t) blocks *(int64_t) STORE_BLOCK_SIZE;
+  blocks += 1; // header
+  totalsize = (int64_t)blocks * (int64_t)STORE_BLOCK_SIZE;
 
   Debug("multicache", "heap_size = %d, totalelements = %d, totalsize = %d", heap_size, totalelements, totalsize);
 
@@ -209,13 +206,13 @@ MultiCacheBase::initialize(Store *astore, char *afilename,
     Warning("Configured store too small, unable to reconfigure");
     return -3;
   }
-  totalsize = (STORE_BLOCK_SIZE) * blocks;
+  totalsize = (STORE_BLOCK_SIZE)*blocks;
 
   level_offset[1] = buckets * bucketsize[0];
   level_offset[2] = buckets * bucketsize[1] + level_offset[1];
 
   if (lowest_level_data)
-    delete[]lowest_level_data;
+    delete[] lowest_level_data;
   lowest_level_data = new char[lowest_level_data_size()];
   ink_assert(lowest_level_data);
   memset(lowest_level_data, 0xFF, lowest_level_data_size());
@@ -224,7 +221,7 @@ MultiCacheBase::initialize(Store *astore, char *afilename,
 }
 
 char *
-MultiCacheBase::mmap_region(int blocks, int *fds, char *cur, size_t& total_length, bool private_flag, int zero_fill)
+MultiCacheBase::mmap_region(int blocks, int *fds, char *cur, size_t &total_length, bool private_flag, int zero_fill)
 {
   if (!blocks)
     return cur;
@@ -252,13 +249,13 @@ MultiCacheBase::mmap_region(int blocks, int *fds, char *cur, size_t& total_lengt
         int flags = private_flag ? MAP_PRIVATE : MAP_SHARED_MAP_NORESERVE;
 
         if (cur)
-          res = (char *) mmap(cur, nbytes, PROT_READ | PROT_WRITE, MAP_FIXED | flags, fd, d->offset * STORE_BLOCK_SIZE);
+          res = (char *)mmap(cur, nbytes, PROT_READ | PROT_WRITE, MAP_FIXED | flags, fd, d->offset * STORE_BLOCK_SIZE);
         else
-          res = (char *) mmap(cur, nbytes, PROT_READ | PROT_WRITE, flags, fd, d->offset * STORE_BLOCK_SIZE);
+          res = (char *)mmap(cur, nbytes, PROT_READ | PROT_WRITE, flags, fd, d->offset * STORE_BLOCK_SIZE);
 
         d->offset += b;
 
-        if (res == NULL || res == (caddr_t) MAP_FAILED)
+        if (res == NULL || res == (caddr_t)MAP_FAILED)
           return NULL;
         ink_assert(!cur || res == cur);
         cur = res + nbytes;
@@ -278,7 +275,7 @@ MultiCacheBase::reset()
     delete store;
   store = 0;
   if (lowest_level_data)
-    delete[]lowest_level_data;
+    delete[] lowest_level_data;
   lowest_level_data = 0;
   if (data)
     unmap_data();
@@ -301,7 +298,7 @@ int
 MultiCacheBase::mmap_data(bool private_flag, bool zero_fill)
 {
   ats_scoped_fd fd;
-  int fds[MULTI_CACHE_MAX_FILES] = { 0 };
+  int fds[MULTI_CACHE_MAX_FILES] = {0};
   int n_fds = 0;
   size_t total_mapped = 0; // total mapped memory from storage.
 
@@ -374,13 +371,13 @@ MultiCacheBase::mmap_data(bool private_flag, bool zero_fill)
     }
 #endif
 
-    // lots of useless stuff
+// lots of useless stuff
 #if defined(darwin)
-    cur = (char *) mmap(0, totalsize, PROT_READ, MAP_SHARED_MAP_NORESERVE | MAP_ANON, -1, 0);
+    cur = (char *)mmap(0, totalsize, PROT_READ, MAP_SHARED_MAP_NORESERVE | MAP_ANON, -1, 0);
 #else
-    cur = (char *) mmap(0, totalsize, PROT_READ, MAP_SHARED_MAP_NORESERVE, fd, 0);
+    cur = (char *)mmap(0, totalsize, PROT_READ, MAP_SHARED_MAP_NORESERVE, fd, 0);
 #endif
-    if (cur == NULL || cur == (caddr_t) MAP_FAILED) {
+    if (cur == NULL || cur == (caddr_t)MAP_FAILED) {
       store = saved;
 #if defined(darwin)
       Warning("unable to mmap anonymous region for %u bytes: %d, %s", totalsize, errno, strerror(errno));
@@ -432,7 +429,7 @@ MultiCacheBase::mmap_data(bool private_flag, bool zero_fill)
         goto Labort;
       }
     }
-    mapped_header = (MultiCacheHeader *) cur;
+    mapped_header = (MultiCacheHeader *)cur;
     if (!mmap_region(1, fds, cur, total_mapped, private_flag, fd)) {
       store = saved;
       goto Labort;
@@ -450,30 +447,29 @@ MultiCacheBase::mmap_data(bool private_flag, bool zero_fill)
   }
 
   return 0;
-Lalloc:
-  {
-    free(data);
-    char *cur = 0;
-
-    data = (char *)ats_memalign(ats_pagesize(), totalsize);
-    cur = data + STORE_BLOCK_SIZE * blocks_in_level(0);
-    if (levels > 1)
-      cur = data + STORE_BLOCK_SIZE * blocks_in_level(1);
-    if (levels > 2)
-      cur = data + STORE_BLOCK_SIZE * blocks_in_level(2);
-    if (heap_size) {
-      heap = cur;
-      cur += bytes_to_blocks(heap_size) * STORE_BLOCK_SIZE;
-    }
-    mapped_header = (MultiCacheHeader *) cur;
-    for (int i = 0; i < n_fds; i++) {
-      if (fds[i] >= 0)
-        socketManager.close(fds[i]);
-    }
-
-    return 0;
+Lalloc : {
+  free(data);
+  char *cur = 0;
+
+  data = (char *)ats_memalign(ats_pagesize(), totalsize);
+  cur = data + STORE_BLOCK_SIZE * blocks_in_level(0);
+  if (levels > 1)
+    cur = data + STORE_BLOCK_SIZE * blocks_in_level(1);
+  if (levels > 2)
+    cur = data + STORE_BLOCK_SIZE * blocks_in_level(2);
+  if (heap_size) {
+    heap = cur;
+    cur += bytes_to_blocks(heap_size) * STORE_BLOCK_SIZE;
+  }
+  mapped_header = (MultiCacheHeader *)cur;
+  for (int i = 0; i < n_fds; i++) {
+    if (fds[i] >= 0)
+      socketManager.close(fds[i]);
   }
 
+  return 0;
+}
+
 Labort:
   for (int i = 0; i < n_fds; i++) {
     if (fds[i] >= 0)
@@ -492,18 +488,18 @@ MultiCacheBase::clear()
   heap_used[0] = 8;
   heap_used[1] = 8;
   heap_halfspace = 0;
-  *mapped_header = *(MultiCacheHeader *) this;
+  *mapped_header = *(MultiCacheHeader *)this;
 }
 
 void
 MultiCacheBase::clear_but_heap()
 {
   memset(data, 0, totalelements * elementsize);
-  *mapped_header = *(MultiCacheHeader *) this;
+  *mapped_header = *(MultiCacheHeader *)this;
 }
 
 int
-MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, int *pi, int *pbuck)
+MultiCacheBase::read_config(const char *config_filename, Store &s, char *fn, int *pi, int *pbuck)
 {
   int scratch;
   ats_scoped_str rundir(RecConfigReadRuntimeDir());
@@ -548,7 +544,7 @@ MultiCacheBase::write_config(const char *config_filename, int nominal_size, int
 
   Layout::relative_to(p, sizeof(p), rundir, config_filename);
 
-  if ((fd =::open(p, O_CREAT | O_WRONLY | O_TRUNC, 0644)) >= 0) {
+  if ((fd = ::open(p, O_CREAT | O_WRONLY | O_TRUNC, 0644)) >= 0) {
     snprintf(buf, sizeof(buf) - 1, "%d\n%d\n%d\n", nominal_size, abuckets, heap_size);
     buf[sizeof(buf) - 1] = 0;
     if (ink_file_fd_writestring(fd, buf) != -1 && store->write(fd, filename) >= 0)
@@ -561,8 +557,7 @@ MultiCacheBase::write_config(const char *config_filename, int nominal_size, int
 }
 
 int
-MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, int db_size,
-                     bool reconfigure, bool fix, bool silent)
+MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, int db_size, bool reconfigure, bool fix, bool silent)
 {
   int ret = 0;
   const char *err = NULL;
@@ -628,7 +623,7 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
             stealStore(freeStore, delta);
             Store more;
             freeStore.spread_alloc(more, delta);
-            if (delta > (int) more.total_blocks())
+            if (delta > (int)more.total_blocks())
               goto LfailReconfig;
             Store more_diff;
             s->try_realloc(more, more_diff);
@@ -676,7 +671,7 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
           goto LfailMap;
         if (!verify_header())
           goto LheaderCorrupt;
-        *(MultiCacheHeader *) this = *mapped_header;
+        *(MultiCacheHeader *)this = *mapped_header;
         ink_assert(store_verify(store));
 
         if (fix)
@@ -730,20 +725,19 @@ LfailMap:
   serr = strerror(errno);
   goto Lfail;
 
-Lfail:
-  {
-    unmap_data();
-    if (!silent) {
-      if (reconfigure) {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: [%s] %s: disabling database\n"
-                     "You may need to 'reconfigure' your cache manually.  Please refer to\n"
-                     "the 'Configuration' chapter in the manual.", err, config_filename, serr ? serr : "");
-      } else {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: [%s] %s: reinitializing database", err, config_filename,
-                     serr ? serr : "");
-      }
+Lfail : {
+  unmap_data();
+  if (!silent) {
+    if (reconfigure) {
+      RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: [%s] %s: disabling database\n"
+                                                "You may need to 'reconfigure' your cache manually.  Please refer to\n"
+                                                "the 'Configuration' chapter in the manual.",
+                       err, config_filename, serr ? serr : "");
+    } else {
+      RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: [%s] %s: reinitializing database", err, config_filename, serr ? serr : "");
     }
   }
+}
   ret = -1;
   goto Lcontinue;
 }
@@ -751,31 +745,21 @@ Lfail:
 bool
 MultiCacheBase::verify_header()
 {
-  return
-    mapped_header->magic == magic &&
-    mapped_header->version.ink_major == version.ink_major &&
-    mapped_header->version.ink_minor == version.ink_minor &&
-    mapped_header->levels == levels &&
-    mapped_header->tag_bits == tag_bits &&
-    mapped_header->max_hits == max_hits &&
-    mapped_header->elementsize == elementsize &&
-    mapped_header->buckets == buckets &&
-    mapped_header->level_offset[0] == level_offset[0] &&
-    mapped_header->level_offset[1] == level_offset[1] &&
-    mapped_header->level_offset[2] == level_offset[2] &&
-    mapped_header->elements[0] == elements[0] &&
-    mapped_header->elements[1] == elements[1] &&
-    mapped_header->elements[2] == elements[2] &&
-    mapped_header->bucketsize[0] == bucketsize[0] &&
-    mapped_header->bucketsize[1] == bucketsize[1] &&
-    mapped_header->bucketsize[2] == bucketsize[2] &&
-    mapped_header->totalelements == totalelements &&
-    mapped_header->totalsize == totalsize && mapped_header->nominal_elements == nominal_elements;
+  return mapped_header->magic == magic && mapped_header->version.ink_major == version.ink_major &&
+         mapped_header->version.ink_minor == version.ink_minor && mapped_header->levels == levels &&
+         mapped_header->tag_bits == tag_bits && mapped_header->max_hits == max_hits && mapped_header->elementsize == elementsize &&
+         mapped_header->buckets == buckets && mapped_header->level_offset[0] == level_offset[0] &&
+         mapped_header->level_offset[1] == level_offset[1] && mapped_header->level_offset[2] == level_offset[2] &&
+         mapped_header->elements[0] == elements[0] && mapped_header->elements[1] == elements[1] &&
+         mapped_header->elements[2] == elements[2] && mapped_header->bucketsize[0] == bucketsize[0] &&
+         mapped_header->bucketsize[1] == bucketsize[1] && mapped_header->bucketsize[2] == bucketsize[2] &&
+         mapped_header->totalelements == totalelements && mapped_header->totalsize == totalsize &&
+         mapped_header->nominal_elements == nominal_elements;
 }
 
 void
 MultiCacheBase::print_info(FILE *fp)
-{                               // STDIO OK
+{ // STDIO OK
   fprintf(fp, "    Elements:       %-10d\n", totalelements);
   fprintf(fp, "    Size (bytes):   %-10u\n", totalsize);
 }
@@ -788,7 +772,7 @@ MultiCacheBase::print_info(FILE *fp)
 // if data == NULL we are rebuilding (as opposed to check or fix)
 //
 int
-MultiCacheBase::rebuild(MultiCacheBase & old, int kind)
+MultiCacheBase::rebuild(MultiCacheBase &old, int kind)
 {
   char *new_data = 0;
 
@@ -803,11 +787,11 @@ MultiCacheBase::rebuild(MultiCacheBase & old, int kind)
     return -1;
   }
 
-  new_data = (char *) mmap(0, old.totalsize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+  new_data = (char *)mmap(0, old.totalsize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
 
   ink_assert(data != new_data);
-  if (new_data == NULL || new_data == (caddr_t) MAP_FAILED) {
-    Warning("unable to mmap /dev/zero for %u bytes: %d, %s", totalsize,errno, strerror(errno));
+  if (new_data == NULL || new_data == (caddr_t)MAP_FAILED) {
+    Warning("unable to mmap /dev/zero for %u bytes: %d, %s", totalsize, errno, strerror(errno));
     return -1;
   }
   // if we are rebuilding get the original data
@@ -890,18 +874,15 @@ MultiCacheBase::rebuild(MultiCacheBase & old, int kind)
   if (r.good)
     fprintf(diag_output_fp, "\tGood:       %.2f%% (%d)\n", r.total ? ((r.good * 100.0) / r.total) : 0, r.good);
   if (r.deleted)
-    fprintf(diag_output_fp, "\tDeleted:    %5.2f%% (%d)\n",
-            r.deleted ? ((r.deleted * 100.0) / r.total) : 0.0, r.deleted);
+    fprintf(diag_output_fp, "\tDeleted:    %5.2f%% (%d)\n", r.deleted ? ((r.deleted * 100.0) / r.total) : 0.0, r.deleted);
   if (r.backed)
     fprintf(diag_output_fp, "\tBacked:     %5.2f%% (%d)\n", r.backed ? ((r.backed * 100.0) / r.total) : 0.0, r.backed);
   if (r.duplicates)
-    fprintf(diag_output_fp, "\tDuplicates: %5.2f%% (%d)\n",
-            r.duplicates ? ((r.duplicates * 100.0) / r.total) : 0.0, r.duplicates);
+    fprintf(diag_output_fp, "\tDuplicates: %5.2f%% (%d)\n", r.duplicates ? ((r.duplicates * 100.0) / r.total) : 0.0, r.duplicates);
   if (r.stale)
     fprintf(diag_output_fp, "\tStale:      %5.2f%% (%d)\n", r.stale ? ((r.stale * 100.0) / r.total) : 0.0, r.stale);
   if (r.corrupt)
-    fprintf(diag_output_fp, "\tCorrupt:    %5.2f%% (%d)\n",
-            r.corrupt ? ((r.corrupt * 100.0) / r.total) : 0.0, r.corrupt);
+    fprintf(diag_output_fp, "\tCorrupt:    %5.2f%% (%d)\n", r.corrupt ? ((r.corrupt * 100.0) / r.total) : 0.0, r.corrupt);
 
   old.reset();
 
@@ -936,8 +917,7 @@ MultiCacheBase::sync_heap(int part)
 {
   if (heap_size) {
     int b_per_part = heap_size / MULTI_CACHE_PARTITIONS;
-    if (ats_msync(data + level_offset[2] + buckets * bucketsize[2] +
-                   b_per_part * part, b_per_part, data + totalsize, MS_SYNC) < 0)
+    if (ats_msync(data + level_offset[2] + buckets * bucketsize[2] + b_per_part * part, b_per_part, data + totalsize, MS_SYNC) < 0)
       return -1;
   }
   return 0;
@@ -975,8 +955,8 @@ MultiCacheBase::sync_partition(int partition)
 int
 MultiCacheBase::sync_header()
 {
-  *mapped_header = *(MultiCacheHeader *) this;
-  return ats_msync((char *) mapped_header, STORE_BLOCK_SIZE, (char *) mapped_header + STORE_BLOCK_SIZE, MS_SYNC);
+  *mapped_header = *(MultiCacheHeader *)this;
+  return ats_msync((char *)mapped_header, STORE_BLOCK_SIZE, (char *)mapped_header + STORE_BLOCK_SIZE, MS_SYNC);
 }
 
 int
@@ -998,38 +978,37 @@ MultiCacheBase::sync_all()
 // Syncs MulitCache
 //
 struct MultiCacheSync;
-typedef int (MultiCacheSync::*MCacheSyncHandler) (int, void *);
+typedef int (MultiCacheSync::*MCacheSyncHandler)(int, void *);
 
-struct MultiCacheSync: public Continuation
-{
+struct MultiCacheSync : public Continuation {
   int partition;
   MultiCacheBase *mc;
   Continuation *cont;
   int before_used;
 
-  int heapEvent(int event, Event *e)
+  int
+  heapEvent(int event, Event *e)
   {
     if (!partition) {
       before_used = mc->heap_used[mc->heap_halfspace];
-      mc->header_snap = *(MultiCacheHeader *) mc;
+      mc->header_snap = *(MultiCacheHeader *)mc;
     }
-    if (partition < MULTI_CACHE_PARTITIONS)
-    {
+    if (partition < MULTI_CACHE_PARTITIONS) {
       mc->sync_heap(partition++);
       e->schedule_imm();
       return EVENT_CONT;
     }
     *mc->mapped_header = mc->header_snap;
-    ink_assert(!ats_msync((char *) mc->mapped_header, STORE_BLOCK_SIZE,
-                           (char *) mc->mapped_header + STORE_BLOCK_SIZE, MS_SYNC));
+    ink_assert(!ats_msync((char *)mc->mapped_header, STORE_BLOCK_SIZE, (char *)mc->mapped_header + STORE_BLOCK_SIZE, MS_SYNC));
     partition = 0;
-    SET_HANDLER((MCacheSyncHandler) & MultiCacheSync::mcEvent);
+    SET_HANDLER((MCacheSyncHandler)&MultiCacheSync::mcEvent);
     return mcEvent(event, e);
   }
 
-  int mcEvent(int event, Event *e)
+  int
+  mcEvent(int event, Event *e)
   {
-    (void) event;
+    (void)event;
     if (partition >= MULTI_CACHE_PARTITIONS) {
       cont->handleEvent(MULTI_CACHE_EVENT_SYNC, 0);
       Debug("multicache", "MultiCacheSync done (%d, %d)", mc->heap_used[0], mc->heap_used[1]);
@@ -1040,28 +1019,30 @@ struct MultiCacheSync: public Continuation
     mc->sync_partition(partition);
     partition++;
     mutex = e->ethread->mutex;
-    SET_HANDLER((MCacheSyncHandler) & MultiCacheSync::pauseEvent);
+    SET_HANDLER((MCacheSyncHandler)&MultiCacheSync::pauseEvent);
     e->schedule_in(MAX(MC_SYNC_MIN_PAUSE_TIME, HRTIME_SECONDS(hostdb_sync_frequency - 5) / MULTI_CACHE_PARTITIONS));
     return EVENT_CONT;
   }
 
-  int pauseEvent(int event, Event *e)
+  int
+  pauseEvent(int event, Event *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     if (partition < MULTI_CACHE_PARTITIONS)
       mutex = mc->locks[partition];
     else
       mutex = cont->mutex;
-    SET_HANDLER((MCacheSyncHandler) & MultiCacheSync::mcEvent);
+    SET_HANDLER((MCacheSyncHandler)&MultiCacheSync::mcEvent);
     e->schedule_imm();
     return EVENT_CONT;
   }
 
-MultiCacheSync(Continuation *acont, MultiCacheBase *amc):
-  Continuation(amc->locks[0]), partition(0), mc(amc), cont(acont), before_used(0) {
+  MultiCacheSync(Continuation *acont, MultiCacheBase *amc)
+    : Continuation(amc->locks[0]), partition(0), mc(amc), cont(acont), before_used(0)
+  {
     mutex = mc->locks[partition];
-    SET_HANDLER((MCacheSyncHandler) & MultiCacheSync::heapEvent);
+    SET_HANDLER((MCacheSyncHandler)&MultiCacheSync::heapEvent);
   }
 };
 
@@ -1076,10 +1057,10 @@ MultiCacheBase::fixup_heap_offsets(int partition, int before_used, UnsunkPtrRegi
     r = &unsunk[partition];
   bool found = 0;
   for (int i = 0; i < r->n; i++) {
-    UnsunkPtr & p = r->ptrs[i];
+    UnsunkPtr &p = r->ptrs[i];
     if (p.offset) {
-      Debug("multicache", "fixup p.offset %d offset %d %" PRId64 " part %d",
-            p.offset, *p.poffset, (int64_t)((char *) p.poffset - data), partition);
+      Debug("multicache", "fixup p.offset %d offset %d %" PRId64 " part %d", p.offset, *p.poffset,
+            (int64_t)((char *)p.poffset - data), partition);
       if (*p.poffset == -(i + base) - 1) {
         if (halfspace_of(p.offset) != heap_halfspace) {
           ink_assert(0);
@@ -1092,12 +1073,11 @@ MultiCacheBase::fixup_heap_offsets(int partition, int before_used, UnsunkPtrRegi
             continue;
         }
       } else {
-        Debug("multicache",
-              "not found %" PRId64 " i %d base %d *p.poffset = %d",
-              (int64_t)((char *) p.poffset - data), i, base, *p.poffset);
+        Debug("multicache", "not found %" PRId64 " i %d base %d *p.poffset = %d", (int64_t)((char *)p.poffset - data), i, base,
+              *p.poffset);
       }
       p.offset = 0;
-      p.poffset = (int *) r->next_free;
+      p.poffset = (int *)r->next_free;
       r->next_free = &p;
       found = true;
     }
@@ -1113,41 +1093,36 @@ MultiCacheBase::fixup_heap_offsets(int partition, int before_used, UnsunkPtrRegi
   return r;
 }
 
-struct OffsetTable
-{
+struct OffsetTable {
   int new_offset;
   int *poffset;
 };
 
 struct MultiCacheHeapGC;
-typedef int (MultiCacheHeapGC::*MCacheHeapGCHandler) (int, void *);
-struct MultiCacheHeapGC: public Continuation
-{
+typedef int (MultiCacheHeapGC::*MCacheHeapGCHandler)(int, void *);
+struct MultiCacheHeapGC : public Continuation {
   Continuation *cont;
   MultiCacheBase *mc;
   int partition;
   int n_offsets;
   OffsetTable *offset_table;
 
-  int startEvent(int event, Event *e)
+  int
+  startEvent(int event, Event *e)
   {
-    (void) event;
-    if (partition < MULTI_CACHE_PARTITIONS)
-    {
-
+    (void)event;
+    if (partition < MULTI_CACHE_PARTITIONS) {
       // copy heap data
 
       char *before = mc->heap + mc->heap_used[mc->heap_halfspace];
-        mc->copy_heap(partition, this);
+      mc->copy_heap(partition, this);
       char *after = mc->heap + mc->heap_used[mc->heap_halfspace];
 
       // sync new heap data and header (used)
 
-      if (after - before > 0)
-      {
+      if (after - before > 0) {
         ink_assert(!ats_msync(before, after - before, mc->heap + mc->totalsize, MS_SYNC));
-        ink_assert(!ats_msync((char *) mc->mapped_header, STORE_BLOCK_SIZE,
-                               (char *) mc->mapped_header + STORE_BLOCK_SIZE, MS_SYNC));
+        ink_assert(!ats_msync((char *)mc->mapped_header, STORE_BLOCK_SIZE, (char *)mc->mapped_header + STORE_BLOCK_SIZE, MS_SYNC));
       }
       // update table to point to new entries
 
@@ -1169,26 +1144,24 @@ struct MultiCacheHeapGC: public Continuation
       e->schedule_in(MAX(MC_SYNC_MIN_PAUSE_TIME, HRTIME_SECONDS(hostdb_sync_frequency - 5) / MULTI_CACHE_PARTITIONS));
       return EVENT_CONT;
     }
-    mc->heap_used[mc->heap_halfspace ? 0 : 1] = 8;      // skip 0
+    mc->heap_used[mc->heap_halfspace ? 0 : 1] = 8; // skip 0
     cont->handleEvent(MULTI_CACHE_EVENT_SYNC, 0);
     Debug("multicache", "MultiCacheHeapGC done");
     delete this;
     return EVENT_DONE;
   }
 
-MultiCacheHeapGC(Continuation *acont, MultiCacheBase *amc):
-  Continuation(amc->locks[0]), cont(acont), mc(amc), partition(0), n_offsets(0) {
-
-    SET_HANDLER((MCacheHeapGCHandler) & MultiCacheHeapGC::startEvent);
+  MultiCacheHeapGC(Continuation *acont, MultiCacheBase *amc)
+    : Continuation(amc->locks[0]), cont(acont), mc(amc), partition(0), n_offsets(0)
+  {
+    SET_HANDLER((MCacheHeapGCHandler)&MultiCacheHeapGC::startEvent);
     offset_table = (OffsetTable *)ats_malloc(sizeof(OffsetTable) *
-        ((mc->totalelements / MULTI_CACHE_PARTITIONS) + mc->elements[mc->levels - 1] * 3 + 1));
+                                             ((mc->totalelements / MULTI_CACHE_PARTITIONS) + mc->elements[mc->levels - 1] * 3 + 1));
     // flip halfspaces
     mutex = mc->locks[partition];
     mc->heap_halfspace = mc->heap_halfspace ? 0 : 1;
   }
-  ~MultiCacheHeapGC() {
-    ats_free(offset_table);
-  }
+  ~MultiCacheHeapGC() { ats_free(offset_table); }
 };
 
 void
@@ -1206,11 +1179,11 @@ MultiCacheBase::sync_partitions(Continuation *cont)
 void
 MultiCacheBase::copy_heap_data(char *src, int s, int *pi, int partition, MultiCacheHeapGC *gc)
 {
-  char *dest = (char *) alloc(NULL, s);
+  char *dest = (char *)alloc(NULL, s);
   Debug("multicache", "copy %p to %p", src, dest);
   if (dest) {
     memcpy(dest, src, s);
-    if (*pi < 0) {              // already in the unsunk ptr registry, ok to change there
+    if (*pi < 0) { // already in the unsunk ptr registry, ok to change there
       UnsunkPtr *ptr = unsunk[partition].ptr(-*pi - 1);
       if (ptr->poffset == pi)
         ptr->offset = dest - heap;
@@ -1229,8 +1202,7 @@ MultiCacheBase::copy_heap_data(char *src, int s, int *pi, int partition, MultiCa
   }
 }
 
-UnsunkPtrRegistry::UnsunkPtrRegistry()
-:mc(NULL), n(0), ptrs(NULL), next_free(NULL), next(NULL)
+UnsunkPtrRegistry::UnsunkPtrRegistry() : mc(NULL), n(0), ptrs(NULL), next_free(NULL), next(NULL)
 {
 }
 
@@ -1247,7 +1219,7 @@ UnsunkPtrRegistry::alloc_data()
   ptrs = (UnsunkPtr *)ats_malloc(s);
   for (int i = 0; i < bs; i++) {
     ptrs[i].offset = 0;
-    ptrs[i].poffset = (int *) &ptrs[i + 1];
+    ptrs[i].poffset = (int *)&ptrs[i + 1];
   }
   ptrs[bs - 1].poffset = NULL;
   next_free = ptrs;
@@ -1259,7 +1231,7 @@ UnsunkPtrRegistry::alloc(int *poffset, int base)
 {
   if (next_free) {
     UnsunkPtr *res = next_free;
-    next_free = (UnsunkPtr *) next_free->poffset;
+    next_free = (UnsunkPtr *)next_free->poffset;
     *poffset = -(base + (res - ptrs)) - 1;
     ink_assert(*poffset);
     return res;
@@ -1282,10 +1254,10 @@ MultiCacheBase::alloc(int *poffset, int asize)
 {
   int h = heap_halfspace;
   int size = (asize + MULTI_CACHE_HEAP_ALIGNMENT - 1) & ~(MULTI_CACHE_HEAP_ALIGNMENT - 1);
-  int o = ink_atomic_increment((int *) &heap_used[h], size);
+  int o = ink_atomic_increment((int *)&heap_used[h], size);
 
   if (o + size > halfspace_size()) {
-    ink_atomic_increment((int *) &heap_used[h], -size);
+    ink_atomic_increment((int *)&heap_used[h], -size);
     ink_assert(!"out of space");
     if (poffset)
       *poffset = 0;
@@ -1294,16 +1266,16 @@ MultiCacheBase::alloc(int *poffset, int asize)
   int offset = (h ? halfspace_size() : 0) + o;
   char *p = heap + offset;
   if (poffset) {
-    int part = ptr_to_partition((char *) poffset);
+    int part = ptr_to_partition((char *)poffset);
     if (part < 0)
       return NULL;
     UnsunkPtr *up = unsunk[part].alloc(poffset);
     up->offset = offset;
     up->poffset = poffset;
-    Debug("multicache", "alloc unsunk %d at %" PRId64 " part %d offset %d",
-          *poffset, (int64_t)((char *) poffset - data), part, offset);
+    Debug("multicache", "alloc unsunk %d at %" PRId64 " part %d offset %d", *poffset, (int64_t)((char *)poffset - data), part,
+          offset);
   }
-  return (void *) p;
+  return (void *)p;
 }
 
 UnsunkPtr *
@@ -1325,14 +1297,14 @@ void *
 MultiCacheBase::ptr(int *poffset, int partition)
 {
   int o = *poffset;
-  Debug("multicache", "ptr %" PRId64 " part %d %d", (int64_t)((char *) poffset - data), partition, o);
+  Debug("multicache", "ptr %" PRId64 " part %d %d", (int64_t)((char *)poffset - data), partition, o);
   if (o > 0) {
     if (!valid_offset(o)) {
       ink_assert(!"bad offset");
       *poffset = 0;
       return NULL;
     }
-    return (void *) (heap + o - 1);
+    return (void *)(heap + o - 1);
   }
   if (!o)
     return NULL;
@@ -1341,14 +1313,14 @@ MultiCacheBase::ptr(int *poffset, int partition)
     return NULL;
   if (p->poffset != poffset)
     return NULL;
-  return (void *) (heap + p->offset);
+  return (void *)(heap + p->offset);
 }
 
 void
 MultiCacheBase::update(int *poffset, int *old_poffset)
 {
   int o = *poffset;
-  Debug("multicache", "updating %" PRId64 " %d", (int64_t)((char *) poffset - data), o);
+  Debug("multicache", "updating %" PRId64 " %d", (int64_t)((char *)poffset - data), o);
   if (o > 0) {
     if (!valid_offset(o)) {
       ink_assert(!"bad poffset");
@@ -1359,7 +1331,7 @@ MultiCacheBase::update(int *poffset, int *old_poffset)
   if (!o)
     return;
 
-  int part = ptr_to_partition((char *) poffset);
+  int part = ptr_to_partition((char *)poffset);
 
   if (part < 0)
     return;
@@ -1392,7 +1364,7 @@ MultiCacheBase::ptr_to_partition(char *ptr)
 
 
 void
-stealStore(Store & s, int blocks)
+stealStore(Store &s, int blocks)
 {
   if (s.read_config())
     return;
@@ -1414,14 +1386,14 @@ stealStore(Store & s, int blocks)
   }
   // grab some end portion of some block... so as not to damage the
   // pool header
-  for (unsigned d = 0; d < s.n_disks; ) {
+  for (unsigned d = 0; d < s.n_disks;) {
     Span *ds = s.disk[d];
     while (ds) {
       if (!blocks)
         ds->blocks = 0;
       else {
         int b = blocks;
-        if ((int) ds->blocks < blocks)
+        if ((int)ds->blocks < blocks)
           b = ds->blocks;
         if (ds->file_pathname)
           ds->offset += (ds->blocks - b);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/P_HostDB.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/P_HostDB.h b/iocore/hostdb/P_HostDB.h
index 1973597..c78e051 100644
--- a/iocore/hostdb/P_HostDB.h
+++ b/iocore/hostdb/P_HostDB.h
@@ -48,12 +48,9 @@
 #include "P_HostDBProcessor.h"
 
 
-#undef  HOSTDB_MODULE_VERSION
-#define HOSTDB_MODULE_VERSION makeModuleVersion(                 \
-                                    HOSTDB_MODULE_MAJOR_VERSION, \
-                                    HOSTDB_MODULE_MINOR_VERSION, \
-                                    PRIVATE_MODULE_HEADER)
-HostDBInfo *probe(ProxyMutex * mutex, HostDBMD5 const& md5, bool ignore_timeout);
-
-void make_md5(INK_MD5 & md5, const char *hostname, int len, int port, char const*pDNSServers, HostDBMark mark);
+#undef HOSTDB_MODULE_VERSION
+#define HOSTDB_MODULE_VERSION makeModuleVersion(HOSTDB_MODULE_MAJOR_VERSION, HOSTDB_MODULE_MINOR_VERSION, PRIVATE_MODULE_HEADER)
+HostDBInfo *probe(ProxyMutex *mutex, HostDBMD5 const &md5, bool ignore_timeout);
+
+void make_md5(INK_MD5 &md5, const char *hostname, int len, int port, char const *pDNSServers, HostDBMark mark);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/P_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h
index e67b0f8..5f2b908 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -43,8 +43,12 @@ extern int hostdb_insert_timeout;
 extern int hostdb_re_dns_on_reload;
 
 // 0 = obey, 1 = ignore, 2 = min(X,ttl), 3 = max(X,ttl)
-enum
-  { TTL_OBEY, TTL_IGNORE, TTL_MIN, TTL_MAX };
+enum {
+  TTL_OBEY,
+  TTL_IGNORE,
+  TTL_MIN,
+  TTL_MAX,
+};
 extern int hostdb_ttl_mode;
 
 extern unsigned int hostdb_current_interval;
@@ -55,7 +59,7 @@ extern int hostdb_size;
 extern int hostdb_srv_enabled;
 extern char hostdb_filename[PATH_NAME_MAX + 1];
 
-//extern int hostdb_timestamp;
+// extern int hostdb_timestamp;
 extern int hostdb_sync_frequency;
 extern int hostdb_disable_reverse_lookup;
 
@@ -70,29 +74,28 @@ extern HostDBCache hostDB;
  */
 enum HostDBMark {
   HOSTDB_MARK_GENERIC, ///< Anything that's not one of the other types.
-  HOSTDB_MARK_IPV4, ///< IPv4 / T_A
-  HOSTDB_MARK_IPV6, ///< IPv6 / T_AAAA
-  HOSTDB_MARK_SRV, ///< Service / T_SRV
+  HOSTDB_MARK_IPV4,    ///< IPv4 / T_A
+  HOSTDB_MARK_IPV6,    ///< IPv6 / T_AAAA
+  HOSTDB_MARK_SRV,     ///< Service / T_SRV
 };
 /** Convert a HostDB @a mark to a string.
     @return A static string.
  */
-extern char const* string_for(HostDBMark mark);
+extern char const *string_for(HostDBMark mark);
 
-inline unsigned int HOSTDB_CLIENT_IP_HASH(
-  sockaddr const* lhs,
-  sockaddr const* rhs
-) {
+inline unsigned int
+HOSTDB_CLIENT_IP_HASH(sockaddr const *lhs, sockaddr const *rhs)
+{
   unsigned int zret = ~static_cast<unsigned int>(0);
-  if (ats_ip_are_compatible(lhs,rhs)) {
+  if (ats_ip_are_compatible(lhs, rhs)) {
     if (ats_is_ip4(lhs)) {
       in_addr_t ip1 = ats_ip4_addr_cast(lhs);
       in_addr_t ip2 = ats_ip4_addr_cast(rhs);
       zret = (ip1 >> 16) ^ ip1 ^ ip2 ^ (ip2 >> 16);
     } else if (ats_is_ip6(lhs)) {
-      uint32_t const* ip1 = ats_ip_addr32_cast(lhs);
-      uint32_t const* ip2 = ats_ip_addr32_cast(rhs);
-      for ( int i = 0 ; i < 4 ; ++i, ++ip1, ++ip2 ) {
+      uint32_t const *ip1 = ats_ip_addr32_cast(lhs);
+      uint32_t const *ip2 = ats_ip_addr32_cast(rhs);
+      for (int i = 0; i < 4; ++i, ++ip1, ++ip2) {
         zret ^= (*ip1 >> 16) ^ *ip1 ^ *ip2 ^ (*ip2 >> 16);
       }
     }
@@ -104,44 +107,44 @@ inline unsigned int HOSTDB_CLIENT_IP_HASH(
 // Constants
 //
 
-#define HOST_DB_HITS_BITS           3
-#define HOST_DB_TAG_BITS            56
+#define HOST_DB_HITS_BITS 3
+#define HOST_DB_TAG_BITS 56
 
-#define CONFIGURATION_HISTORY_PROBE_DEPTH   1
+#define CONFIGURATION_HISTORY_PROBE_DEPTH 1
 
 // Bump this any time hostdb format is changed
-#define HOST_DB_CACHE_MAJOR_VERSION         3
-#define HOST_DB_CACHE_MINOR_VERSION         0
+#define HOST_DB_CACHE_MAJOR_VERSION 3
+#define HOST_DB_CACHE_MINOR_VERSION 0
 // 2.2: IP family split 2.1 : IPv6
 
-#define DEFAULT_HOST_DB_FILENAME             "host.db"
-#define DEFAULT_HOST_DB_SIZE                 (1<<14)
+#define DEFAULT_HOST_DB_FILENAME "host.db"
+#define DEFAULT_HOST_DB_SIZE (1 << 14)
 // Resolution of timeouts
-#define HOST_DB_TIMEOUT_INTERVAL             HRTIME_SECOND
+#define HOST_DB_TIMEOUT_INTERVAL HRTIME_SECOND
 // Timeout DNS every 24 hours by default if ttl_mode is enabled
-#define HOST_DB_IP_TIMEOUT                   (24*60*60)
+#define HOST_DB_IP_TIMEOUT (24 * 60 * 60)
 // DNS entries should be revalidated every 12 hours
-#define HOST_DB_IP_STALE                     (12*60*60)
+#define HOST_DB_IP_STALE (12 * 60 * 60)
 // DNS entries which failed lookup, should be revalidated every hour
-#define HOST_DB_IP_FAIL_TIMEOUT              (60*60)
+#define HOST_DB_IP_FAIL_TIMEOUT (60 * 60)
 
 //#define HOST_DB_MAX_INTERVAL                 (0x7FFFFFFF)
-#define HOST_DB_MAX_TTL                      (0x1FFFFF) //24 days
+#define HOST_DB_MAX_TTL (0x1FFFFF) // 24 days
 
 //
 // Constants
 //
 
 // period to wait for a remote probe...
-#define HOST_DB_CLUSTER_TIMEOUT  HRTIME_MSECONDS(5000)
-#define HOST_DB_RETRY_PERIOD     HRTIME_MSECONDS(20)
+#define HOST_DB_CLUSTER_TIMEOUT HRTIME_MSECONDS(5000)
+#define HOST_DB_RETRY_PERIOD HRTIME_MSECONDS(20)
 
 //#define TEST(_x) _x
 #define TEST(_x)
 
 
 #ifdef _HOSTDB_CC_
-template struct MultiCache <HostDBInfo >;
+template struct MultiCache<HostDBInfo>;
 #endif /* _HOSTDB_CC_ */
 
 struct ClusterMachine;
@@ -149,13 +152,12 @@ struct HostEnt;
 struct ClusterConfiguration;
 
 // Stats
-enum HostDB_Stats
-{
+enum HostDB_Stats {
   hostdb_total_entries_stat,
   hostdb_total_lookups_stat,
-  hostdb_total_hits_stat,       // D == total hits
-  hostdb_ttl_stat,              // D average TTL
-  hostdb_ttl_expires_stat,      // D == TTL Expires
+  hostdb_total_hits_stat,  // D == total hits
+  hostdb_ttl_stat,         // D average TTL
+  hostdb_ttl_expires_stat, // D == TTL Expires
   hostdb_re_dns_on_reload_stat,
   hostdb_bytes_stat,
   HostDB_Stat_Count
@@ -167,56 +169,55 @@ extern RecRawStatBlock *hostdb_rsb;
 
 // Stat Macros
 
-#define HOSTDB_DEBUG_COUNT_DYN_STAT(_x, _y) \
-RecIncrRawStatCount(hostdb_rsb, mutex->thread_holding, (int)_x, _y)
+#define HOSTDB_DEBUG_COUNT_DYN_STAT(_x, _y) RecIncrRawStatCount(hostdb_rsb, mutex->thread_holding, (int)_x, _y)
 
-#define HOSTDB_INCREMENT_DYN_STAT(_x)  \
-RecIncrRawStatSum(hostdb_rsb, mutex->thread_holding, (int)_x, 1)
+#define HOSTDB_INCREMENT_DYN_STAT(_x) RecIncrRawStatSum(hostdb_rsb, mutex->thread_holding, (int)_x, 1)
 
-#define HOSTDB_DECREMENT_DYN_STAT(_x) \
-RecIncrRawStatSum(hostdb_rsb, mutex->thread_holding, (int)_x, -1)
+#define HOSTDB_DECREMENT_DYN_STAT(_x) RecIncrRawStatSum(hostdb_rsb, mutex->thread_holding, (int)_x, -1)
 
-#define HOSTDB_SUM_DYN_STAT(_x, _r) \
-RecIncrRawStatSum(hostdb_rsb, mutex->thread_holding, (int)_x, _r)
+#define HOSTDB_SUM_DYN_STAT(_x, _r) RecIncrRawStatSum(hostdb_rsb, mutex->thread_holding, (int)_x, _r)
 
-#define HOSTDB_READ_DYN_STAT(_x, _count, _sum) do {\
-RecGetRawStatSum(hostdb_rsb, (int)_x, &_sum);          \
-RecGetRawStatCount(hostdb_rsb, (int)_x, &_count);         \
-} while (0)
+#define HOSTDB_READ_DYN_STAT(_x, _count, _sum)        \
+  do {                                                \
+    RecGetRawStatSum(hostdb_rsb, (int)_x, &_sum);     \
+    RecGetRawStatCount(hostdb_rsb, (int)_x, &_count); \
+  } while (0)
 
-#define HOSTDB_SET_DYN_COUNT(_x, _count) \
-RecSetRawStatCount(hostdb_rsb, _x, _count);
+#define HOSTDB_SET_DYN_COUNT(_x, _count) RecSetRawStatCount(hostdb_rsb, _x, _count);
 
-#define HOSTDB_INCREMENT_THREAD_DYN_STAT(_s, _t) \
-  RecIncrRawStatSum(hostdb_rsb, _t, (int) _s, 1);
+#define HOSTDB_INCREMENT_THREAD_DYN_STAT(_s, _t) RecIncrRawStatSum(hostdb_rsb, _t, (int)_s, 1);
 
-#define HOSTDB_DECREMENT_THREAD_DYN_STAT(_s, _t) \
-  RecIncrRawStatSum(hostdb_rsb, _t, (int) _s, -1);
+#define HOSTDB_DECREMENT_THREAD_DYN_STAT(_s, _t) RecIncrRawStatSum(hostdb_rsb, _t, (int)_s, -1);
 
 
 //
 // HostDBCache (Private)
 //
-struct HostDBCache: public MultiCache<HostDBInfo>
-{
-  int rebuild_callout(HostDBInfo * e, RebuildMC & r);
+struct HostDBCache : public MultiCache<HostDBInfo> {
+  int rebuild_callout(HostDBInfo *e, RebuildMC &r);
   int start(int flags = 0);
-  MultiCacheBase *dup()
+  MultiCacheBase *
+  dup()
   {
     return new HostDBCache;
   }
 
   // This accounts for an average of 2 HostDBInfo per DNS cache (for round-robin etc.)
   // In addition, we can do a padding for additional SRV records storage.
-  virtual size_t estimated_heap_bytes_per_entry() const { return sizeof(HostDBInfo) * 2 + 512 * hostdb_srv_enabled; }
+  virtual size_t
+  estimated_heap_bytes_per_entry() const
+  {
+    return sizeof(HostDBInfo) * 2 + 512 * hostdb_srv_enabled;
+  }
 
   Queue<HostDBContinuation, Continuation::Link_link> pending_dns[MULTI_CACHE_PARTITIONS];
-  Queue<HostDBContinuation, Continuation::Link_link> &pending_dns_for_hash(INK_MD5 & md5);
+  Queue<HostDBContinuation, Continuation::Link_link> &pending_dns_for_hash(INK_MD5 &md5);
   HostDBCache();
 };
 
 inline int
-HostDBRoundRobin::index_of(sockaddr const* ip) {
+HostDBRoundRobin::index_of(sockaddr const *ip)
+{
   bool bad = (rrcount <= 0 || rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || good <= 0 || good > HOST_DB_MAX_ROUND_ROBIN_INFO);
   if (bad) {
     ink_assert(!"bad round robin size");
@@ -232,19 +233,21 @@ HostDBRoundRobin::index_of(sockaddr const* ip) {
   return -1;
 }
 
-inline HostDBInfo*
-HostDBRoundRobin::find_ip(sockaddr const* ip) {
+inline HostDBInfo *
+HostDBRoundRobin::find_ip(sockaddr const *ip)
+{
   int idx = this->index_of(ip);
   return idx < 0 ? NULL : &info[idx];
 }
 
-inline HostDBInfo*
-HostDBRoundRobin::select_next(sockaddr const* ip) {
-  HostDBInfo* zret = 0;
+inline HostDBInfo *
+HostDBRoundRobin::select_next(sockaddr const *ip)
+{
+  HostDBInfo *zret = 0;
   if (good > 1) {
     int idx = this->index_of(ip);
     if (idx >= 0) {
-      idx = (idx+1)%good;
+      idx = (idx + 1) % good;
       zret = &info[idx];
     }
   }
@@ -252,7 +255,8 @@ HostDBRoundRobin::select_next(sockaddr const* ip) {
 }
 
 inline HostDBInfo *
-HostDBRoundRobin::find_target(const char *target) {
+HostDBRoundRobin::find_target(const char *target)
+{
   bool bad = (rrcount <= 0 || rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || good <= 0 || good > HOST_DB_MAX_ROUND_ROBIN_INFO);
   if (bad) {
     ink_assert(!"bad round robin size");
@@ -268,7 +272,7 @@ HostDBRoundRobin::find_target(const char *target) {
 }
 
 inline HostDBInfo *
-HostDBRoundRobin::select_best_http(sockaddr const* client_ip, ink_time_t now, int32_t fail_window)
+HostDBRoundRobin::select_best_http(sockaddr const *client_ip, ink_time_t now, int32_t fail_window)
 {
   bool bad = (rrcount <= 0 || rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || good <= 0 || good > HOST_DB_MAX_ROUND_ROBIN_INFO);
 
@@ -296,7 +300,7 @@ HostDBRoundRobin::select_best_http(sockaddr const* client_ip, ink_time_t now, in
     Debug("hostdb", "Using default round robin");
     unsigned int best_hash_any = 0;
     unsigned int best_hash_up = 0;
-    sockaddr const* ip;
+    sockaddr const *ip;
     for (int i = 0; i < good; i++) {
       ip = info[i].ip();
       unsigned int h = HOSTDB_CLIENT_IP_HASH(client_ip, ip);
@@ -304,8 +308,7 @@ HostDBRoundRobin::select_best_http(sockaddr const* client_ip, ink_time_t now, in
         best_any = i;
         best_hash_any = h;
       }
-      if (info[i].app.http_data.last_failure == 0 ||
-          (unsigned int) (now - fail_window) > info[i].app.http_data.last_failure) {
+      if (info[i].app.http_data.last_failure == 0 || (unsigned int)(now - fail_window) > info[i].app.http_data.last_failure) {
         // Entry is marked up
         if (best_hash_up <= h) {
           best_up = i;
@@ -317,7 +320,7 @@ HostDBRoundRobin::select_best_http(sockaddr const* client_ip, ink_time_t now, in
         //  as to how far in the future we should tolerate bogus last
         //  failure times.  This sets the upper bound that we would ever
         //  consider a server down to 2*down_server_timeout
-        if (now + fail_window < (int32_t) (info[i].app.http_data.last_failure)) {
+        if (now + fail_window < (int32_t)(info[i].app.http_data.last_failure)) {
 #ifdef DEBUG
           // because this region is mmaped, I cann't get anything
           //   useful from the structure in core files,  therefore
@@ -356,7 +359,7 @@ HostDBRoundRobin::select_best_srv(char *target, InkRand *rand, ink_time_t now, i
 
 #ifdef DEBUG
   for (int i = 1; i < good; ++i) {
-    ink_assert(info[i].data.srv.srv_priority >= info[i-1].data.srv.srv_priority);
+    ink_assert(info[i].data.srv.srv_priority >= info[i - 1].data.srv.srv_priority);
   }
 #endif
 
@@ -366,8 +369,7 @@ HostDBRoundRobin::select_best_srv(char *target, InkRand *rand, ink_time_t now, i
   HostDBInfo *infos[HOST_DB_MAX_ROUND_ROBIN_INFO];
 
   do {
-    if (info[i].app.http_data.last_failure != 0 &&
-        (uint32_t) (now - fail_window) < info[i].app.http_data.last_failure) {
+    if (info[i].app.http_data.last_failure != 0 && (uint32_t)(now - fail_window) < info[i].app.http_data.last_failure) {
       continue;
     }
 
@@ -413,15 +415,15 @@ struct HostDBMD5 {
 
   INK_MD5 hash; ///< The hash value.
 
-  char const* host_name; ///< Host name.
-  int host_len; ///< Length of @a _host_name
-  IpAddr ip; ///< IP address.
-  in_port_t port; ///< IP port (host order).
+  char const *host_name; ///< Host name.
+  int host_len;          ///< Length of @a _host_name
+  IpAddr ip;             ///< IP address.
+  in_port_t port;        ///< IP port (host order).
   /// DNS server. Not strictly part of the MD5 data but
   /// it's both used by @c HostDBContinuation and provides access to
   /// MD5 data. It's just handier to store it here for both uses.
-  DNSServer* dns_server;
-  SplitDNS* pSD; ///< Hold the container for @a dns_server.
+  DNSServer *dns_server;
+  SplitDNS *pSD;      ///< Hold the container for @a dns_server.
   HostDBMark db_mark; ///< Mark / type of record.
 
   /// Default constructor.
@@ -433,17 +435,16 @@ struct HostDBMD5 {
   /** Assign a hostname.
       This updates the split DNS data as well.
   */
-  self& set_host(char const* name, int len);
+  self &set_host(char const *name, int len);
 };
 
 //
 // Handles a HostDB lookup request
 //
 struct HostDBContinuation;
-typedef int (HostDBContinuation::*HostDBContHandler) (int, void *);
+typedef int (HostDBContinuation::*HostDBContHandler)(int, void *);
 
-struct HostDBContinuation: public Continuation
-{
+struct HostDBContinuation : public Continuation {
   Action action;
   HostDBMD5 md5;
   //  IpEndpoint ip;
@@ -463,45 +464,47 @@ struct HostDBContinuation: public Continuation
   ClusterMachine *past_probes[CONFIGURATION_HISTORY_PROBE_DEPTH];
   //  char name[MAXDNAME];
   //  int namelen;
-  char md5_host_name_store[MAXDNAME+1]; // used as backing store for @a md5
+  char md5_host_name_store[MAXDNAME + 1]; // used as backing store for @a md5
   char srv_target_name[MAXDNAME];
   //  void *m_pDS;
   Action *pending_action;
 
-  unsigned int missing:1;
-  unsigned int force_dns:1;
-  unsigned int round_robin:1;
+  unsigned int missing : 1;
+  unsigned int force_dns : 1;
+  unsigned int round_robin : 1;
 
-  int probeEvent(int event, Event * e);
-  int clusterEvent(int event, Event * e);
-  int clusterResponseEvent(int event, Event * e);
-  int dnsEvent(int event, HostEnt * e);
-  int dnsPendingEvent(int event, Event * e);
-  int backgroundEvent(int event, Event * e);
-  int retryEvent(int event, Event * e);
-  int removeEvent(int event, Event * e);
-  int setbyEvent(int event, Event * e);
+  int probeEvent(int event, Event *e);
+  int clusterEvent(int event, Event *e);
+  int clusterResponseEvent(int event, Event *e);
+  int dnsEvent(int event, HostEnt *e);
+  int dnsPendingEvent(int event, Event *e);
+  int backgroundEvent(int event, Event *e);
+  int retryEvent(int event, Event *e);
+  int removeEvent(int event, Event *e);
+  int setbyEvent(int event, Event *e);
 
   /// Recompute the MD5 and update ancillary values.
   void refresh_MD5();
   void do_dns();
-  bool is_byname()
+  bool
+  is_byname()
   {
     return md5.db_mark == HOSTDB_MARK_IPV4 || md5.db_mark == HOSTDB_MARK_IPV6;
   }
-  bool is_srv()
+  bool
+  is_srv()
   {
     return md5.db_mark == HOSTDB_MARK_SRV;
   }
-  HostDBInfo *lookup_done(IpAddr const& ip, char const* aname, bool round_robin, unsigned int attl, SRVHosts * s = NULL);
-  bool do_get_response(Event * e);
-  void do_put_response(ClusterMachine * m, HostDBInfo * r, Continuation * cont);
-  int failed_cluster_request(Event * e);
+  HostDBInfo *lookup_done(IpAddr const &ip, char const *aname, bool round_robin, unsigned int attl, SRVHosts *s = NULL);
+  bool do_get_response(Event *e);
+  void do_put_response(ClusterMachine *m, HostDBInfo *r, Continuation *cont);
+  int failed_cluster_request(Event *e);
   int key_partition();
   void remove_trigger_pending_dns();
   int set_check_pending_dns();
 
-  ClusterMachine *master_machine(ClusterConfiguration * cc);
+  ClusterMachine *master_machine(ClusterConfiguration *cc);
 
   HostDBInfo *insert(unsigned int attl);
 
@@ -510,38 +513,32 @@ struct HostDBContinuation: public Continuation
   struct Options {
     typedef Options self; ///< Self reference type.
 
-    int timeout; ///< Timeout value. Default 0
+    int timeout;                 ///< Timeout value. Default 0
     HostResStyle host_res_style; ///< IP address family fallback. Default @c HOST_RES_NONE
-    bool force_dns; ///< Force DNS lookup. Default @c false
-    Continuation* cont; ///< Continuation / action. Default @c NULL (none)
+    bool force_dns;              ///< Force DNS lookup. Default @c false
+    Continuation *cont;          ///< Continuation / action. Default @c NULL (none)
 
-    Options()
-      : timeout(0), host_res_style(HOST_RES_NONE), force_dns(false), cont(0)
-    { }
+    Options() : timeout(0), host_res_style(HOST_RES_NONE), force_dns(false), cont(0) {}
   };
   static const Options DEFAULT_OPTIONS; ///< Default defaults.
-  void init(HostDBMD5 const& md5,
-            Options const& opt = DEFAULT_OPTIONS);
+  void init(HostDBMD5 const &md5, Options const &opt = DEFAULT_OPTIONS);
   int make_get_message(char *buf, int len);
-  int make_put_message(HostDBInfo * r, Continuation * c, char *buf, int len);
-
-HostDBContinuation():
-  Continuation(NULL), ttl(0),
-    host_res_style(DEFAULT_OPTIONS.host_res_style),
-    dns_lookup_timeout(DEFAULT_OPTIONS.timeout),
-    timeout(0), from(0),
-    from_cont(0), probe_depth(0), missing(false),
-    force_dns(DEFAULT_OPTIONS.force_dns), round_robin(false) {
+  int make_put_message(HostDBInfo *r, Continuation *c, char *buf, int len);
+
+  HostDBContinuation()
+    : Continuation(NULL), ttl(0), host_res_style(DEFAULT_OPTIONS.host_res_style), dns_lookup_timeout(DEFAULT_OPTIONS.timeout),
+      timeout(0), from(0), from_cont(0), probe_depth(0), missing(false), force_dns(DEFAULT_OPTIONS.force_dns), round_robin(false)
+  {
     ink_zero(md5_host_name_store);
     ink_zero(md5.hash);
-    SET_HANDLER((HostDBContHandler) & HostDBContinuation::probeEvent);
+    SET_HANDLER((HostDBContHandler)&HostDBContinuation::probeEvent);
   }
 };
 
-//extern Queue<HostDBContinuation>  remoteHostDBQueue[MULTI_CACHE_PARTITIONS];
+// extern Queue<HostDBContinuation>  remoteHostDBQueue[MULTI_CACHE_PARTITIONS];
 
 inline unsigned int
-master_hash(INK_MD5 const& md5)
+master_hash(INK_MD5 const &md5)
 {
   return static_cast<int>(md5[1] >> 32);
 }
@@ -549,13 +546,13 @@ master_hash(INK_MD5 const& md5)
 inline bool
 is_dotted_form_hostname(const char *c)
 {
-  return -1 != (int) ink_inet_addr(c);
+  return -1 != (int)ink_inet_addr(c);
 }
 
 inline Queue<HostDBContinuation> &
-HostDBCache::pending_dns_for_hash(INK_MD5 & md5)
+HostDBCache::pending_dns_for_hash(INK_MD5 &md5)
 {
-  return pending_dns[partition_of_bucket((int) (fold_md5(md5) % hostDB.buckets))];
+  return pending_dns[partition_of_bucket((int)(fold_md5(md5) % hostDB.buckets))];
 }
 
 inline int

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/P_MultiCache.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/P_MultiCache.h b/iocore/hostdb/P_MultiCache.h
index b5f81ac..8f9478c 100644
--- a/iocore/hostdb/P_MultiCache.h
+++ b/iocore/hostdb/P_MultiCache.h
@@ -39,34 +39,34 @@
 // Constants
 //
 
-#define MULTI_CACHE_MAX_LEVELS       3
-#define MULTI_CACHE_MAX_BUCKET_SIZE  256
-#define MULTI_CACHE_MAX_FILES        256
-#define MULTI_CACHE_PARTITIONS       64
+#define MULTI_CACHE_MAX_LEVELS 3
+#define MULTI_CACHE_MAX_BUCKET_SIZE 256
+#define MULTI_CACHE_MAX_FILES 256
+#define MULTI_CACHE_PARTITIONS 64
 
-#define MULTI_CACHE_EVENT_SYNC       MULTI_CACHE_EVENT_EVENTS_START
+#define MULTI_CACHE_EVENT_SYNC MULTI_CACHE_EVENT_EVENTS_START
 
 
 // for heap_offset() and heap_size(), indicates no data
-#define MULTI_CACHE_HEAP_NONE       -1
+#define MULTI_CACHE_HEAP_NONE -1
 
-#define MULTI_CACHE_MAGIC_NUMBER     0x0BAD2D8
+#define MULTI_CACHE_MAGIC_NUMBER 0x0BAD2D8
 
 // Update these if there is a change to MultiCacheBase
 // There is a separate HOST_DB_CACHE_[MAJOR|MINOR]_VERSION
-#define MULTI_CACHE_MAJOR_VERSION    2
-#define MULTI_CACHE_MINOR_VERSION    1
+#define MULTI_CACHE_MAJOR_VERSION 2
+#define MULTI_CACHE_MINOR_VERSION 1
 // 2.1 - IPv6 compatible
 
-#define MULTI_CACHE_HEAP_HIGH_WATER  0.8
+#define MULTI_CACHE_HEAP_HIGH_WATER 0.8
 
-#define MULTI_CACHE_HEAP_INITIAL     sizeof(uint32_t)
-#define MULTI_CACHE_HEAP_ALIGNMENT   8
+#define MULTI_CACHE_HEAP_INITIAL sizeof(uint32_t)
+#define MULTI_CACHE_HEAP_ALIGNMENT 8
 
 // unused.. possible optimization
-#define MULTI_CACHE_OFFSET_PARITION(_x)  ((_x)%MULTI_CACHE_PARTITIONS)
-#define MULTI_CACHE_OFFSET_INDEX(_x)     ((_x)/MULTI_CACHE_PARTITIONS)
-#define MULTI_CACHE_OFFSET(_p,_o)        ((_p) + (_o) * MULTI_CACHE_PARTITIONS)
+#define MULTI_CACHE_OFFSET_PARITION(_x) ((_x) % MULTI_CACHE_PARTITIONS)
+#define MULTI_CACHE_OFFSET_INDEX(_x) ((_x) / MULTI_CACHE_PARTITIONS)
+#define MULTI_CACHE_OFFSET(_p, _o) ((_p) + (_o)*MULTI_CACHE_PARTITIONS)
 
 class ProxyMutex;
 class Continuation;
@@ -80,8 +80,7 @@ class Continuation;
 // required by the templated cache operations.
 
 
-struct MultiCacheBlock
-{
+struct MultiCacheBlock {
   uint64_t tag();
   bool is_deleted();
   void set_deleted();
@@ -89,18 +88,19 @@ struct MultiCacheBlock
   void set_empty();
   void reset();
   void set_full(uint64_t folded_md5, int buckets);
-  int heap_size()
+  int
+  heap_size()
   {
     return 0;
   }
-  int *heap_offset_ptr()
+  int *
+  heap_offset_ptr()
   {
     return NULL;
   }
 };
 
-struct RebuildMC
-{
+struct RebuildMC {
   bool rebuild;
   bool check;
   bool fix;
@@ -116,8 +116,7 @@ struct RebuildMC
   int total;
 };
 
-struct MultiCacheHeader
-{
+struct MultiCacheHeader {
   unsigned int magic;
   VersionNumber version;
 
@@ -142,24 +141,21 @@ struct MultiCacheHeader
   volatile int heap_halfspace;
   volatile int heap_used[2];
 
-    MultiCacheHeader();
+  MultiCacheHeader();
 };
 
 // size of block of unsunk pointers with respect to the number of
 // elements
-#define MULTI_CACHE_UNSUNK_PTR_BLOCK_SIZE(_e)   \
-  ((_e / 8) / MULTI_CACHE_PARTITIONS)
+#define MULTI_CACHE_UNSUNK_PTR_BLOCK_SIZE(_e) ((_e / 8) / MULTI_CACHE_PARTITIONS)
 
-struct UnsunkPtr
-{
+struct UnsunkPtr {
   int offset;
-  int *poffset;                 // doubles as freelist pointer
+  int *poffset; // doubles as freelist pointer
 };
 
 struct MultiCacheBase;
 
-struct UnsunkPtrRegistry
-{
+struct UnsunkPtrRegistry {
   MultiCacheBase *mc;
   int n;
   UnsunkPtr *ptrs;
@@ -170,8 +166,8 @@ struct UnsunkPtrRegistry
   UnsunkPtr *alloc(int *p, int base = 0);
   void alloc_data();
 
-    UnsunkPtrRegistry();
-   ~UnsunkPtrRegistry();
+  UnsunkPtrRegistry();
+  ~UnsunkPtrRegistry();
 };
 
 //
@@ -183,8 +179,7 @@ struct UnsunkPtrRegistry
 // used by windows only - to keep track
 // of mapping handles
 //
-struct Unmaper
-{
+struct Unmaper {
   void *hMap;
   char *pAddr;
 };
@@ -194,8 +189,7 @@ typedef int two_ints[2];
 
 struct MultiCacheHeapGC;
 
-struct MultiCacheBase: public MultiCacheHeader
-{
+struct MultiCacheBase : public MultiCacheHeader {
   Store *store;
   char filename[PATH_NAME_MAX + 1];
   MultiCacheHeader *mapped_header;
@@ -212,7 +206,8 @@ struct MultiCacheBase: public MultiCacheHeader
 
   // interface functions
   //
-  int halfspace_size()
+  int
+  halfspace_size()
   {
     return heap_size / 2;
   }
@@ -222,89 +217,100 @@ struct MultiCacheBase: public MultiCacheHeader
   int hit_stat[MULTI_CACHE_MAX_LEVELS];
   int miss_stat;
 
-  unsigned int lowest_level_data_size()
+  unsigned int
+  lowest_level_data_size()
   {
     return (buckets + 3) / 4;
   }
-  unsigned int lowest_level(unsigned int bucket)
+  unsigned int
+  lowest_level(unsigned int bucket)
   {
-    unsigned int i = (unsigned char) lowest_level_data[bucket / 4];
+    unsigned int i = (unsigned char)lowest_level_data[bucket / 4];
     return 3 & (i >> (buckets % 4));
   }
-  void set_lowest_level(unsigned int bucket, unsigned int lowest)
+  void
+  set_lowest_level(unsigned int bucket, unsigned int lowest)
   {
-    unsigned char p = (unsigned char) lowest_level_data[bucket / 4];
+    unsigned char p = (unsigned char)lowest_level_data[bucket / 4];
     p &= ~(3 << (buckets % 4));
     p |= (lowest & 3) << (buckets % 4);
-    lowest_level_data[bucket / 4] = (char) p;
+    lowest_level_data[bucket / 4] = (char)p;
   }
 
   // Fixed point, 8 bits shifted left
   int buckets_per_partitionF8;
 
-  int partition_of_bucket(int b)
+  int
+  partition_of_bucket(int b)
   {
     return ((b << 8) + 0xFF) / buckets_per_partitionF8;
   }
-  int first_bucket_of_partition(int p)
+  int
+  first_bucket_of_partition(int p)
   {
     return ((buckets_per_partitionF8 * p) >> 8);
   }
-  int last_bucket_of_partition(int p)
+  int
+  last_bucket_of_partition(int p)
   {
     return first_bucket_of_partition(p + 1) - 1;
   }
-  int buckets_of_partition(int p)
+  int
+  buckets_of_partition(int p)
   {
     return last_bucket_of_partition(p) - first_bucket_of_partition(p) + 1;
   }
 
-  int open(Store * store, const char *config_filename,
-           char *db_filename = NULL, int db_size = -1, bool reconfigure = false, bool fix = false, bool silent = false);
+  int open(Store *store, const char *config_filename, char *db_filename = NULL, int db_size = -1, bool reconfigure = false,
+           bool fix = false, bool silent = false);
 
   // 1 for success, 0 for no config file, -1 for failure
-  int read_config(const char *config_filename, Store & store, char *fn = NULL, int *pi = NULL, int *pbuckets = NULL);
+  int read_config(const char *config_filename, Store &store, char *fn = NULL, int *pi = NULL, int *pbuckets = NULL);
   int write_config(const char *config_filename, int nominal_size, int buckets);
-  int initialize(Store * store, char *filename, int elements,
-                 int buckets = 0, unsigned int levels = 2,
-                 int level0_elements_per_bucket = 4,
-                 int level1_elements_per_bucket = 32, int level2_elements_per_bucket = 1);
+  int initialize(Store *store, char *filename, int elements, int buckets = 0, unsigned int levels = 2,
+                 int level0_elements_per_bucket = 4, int level1_elements_per_bucket = 32, int level2_elements_per_bucket = 1);
   int mmap_data(bool private_flag = false, bool zero_fill = false);
-  char *mmap_region(int blocks, int *fds, char *cur, size_t& total_length, bool private_flag, int zero_fill = 0);
+  char *mmap_region(int blocks, int *fds, char *cur, size_t &total_length, bool private_flag, int zero_fill = 0);
   int blocks_in_level(unsigned int level);
 
   bool verify_header();
 
   int unmap_data();
   void reset();
-  void clear();                 // this zeros the data
+  void clear(); // this zeros the data
   void clear_but_heap();
 
-  virtual MultiCacheBase *dup()
+  virtual MultiCacheBase *
+  dup()
   {
     ink_assert(0);
     return NULL;
   }
 
-  virtual size_t estimated_heap_bytes_per_entry() const { return 0; }
+  virtual size_t
+  estimated_heap_bytes_per_entry() const
+  {
+    return 0;
+  }
 
-  void print_info(FILE * fp);
+  void print_info(FILE *fp);
 
-  //
-  // Rebuild the database, also perform checks, and fixups
-  // ** cannot be called on a running system **
-  // "this" must be initialized.
-  //
-#define MC_REBUILD         0
-#define MC_REBUILD_CHECK   1
-#define MC_REBUILD_FIX     2
-  int rebuild(MultiCacheBase & old, int kind = MC_REBUILD);     // 0 on success
+//
+// Rebuild the database, also perform checks, and fixups
+// ** cannot be called on a running system **
+// "this" must be initialized.
+//
+#define MC_REBUILD 0
+#define MC_REBUILD_CHECK 1
+#define MC_REBUILD_FIX 2
+  int rebuild(MultiCacheBase &old, int kind = MC_REBUILD); // 0 on success
 
-  virtual void rebuild_element(int buck, char *elem, RebuildMC & r)
+  virtual void
+  rebuild_element(int buck, char *elem, RebuildMC &r)
   {
-    (void) buck;
-    (void) elem;
-    (void) r;
+    (void)buck;
+    (void)elem;
+    (void)r;
     ink_assert(0);
   }
 
@@ -315,13 +321,15 @@ struct MultiCacheBase: public MultiCacheHeader
   //
   int check(const char *config_filename, bool fix = false);
 
-  ProxyMutex *lock_for_bucket(int bucket)
+  ProxyMutex *
+  lock_for_bucket(int bucket)
   {
     return locks[partition_of_bucket(bucket)];
   }
-  uint64_t make_tag(uint64_t folded_md5)
+  uint64_t
+  make_tag(uint64_t folded_md5)
   {
-    uint64_t ttag = folded_md5 / (uint64_t) buckets;
+    uint64_t ttag = folded_md5 / (uint64_t)buckets;
     if (!ttag)
       return 1LL;
     // beeping gcc 2.7.2 is broken
@@ -338,17 +346,16 @@ struct MultiCacheBase: public MultiCacheHeader
   }
 
   int sync_all();
-  int sync_heap(int part);      // part varies between 0 and MULTI_CACHE_PARTITIONS
+  int sync_heap(int part); // part varies between 0 and MULTI_CACHE_PARTITIONS
   int sync_header();
   int sync_partition(int partition);
-  void sync_partitions(Continuation * cont);
+  void sync_partitions(Continuation *cont);
 
   MultiCacheBase();
-  virtual ~ MultiCacheBase() {
-    reset();
-  }
+  virtual ~MultiCacheBase() { reset(); }
 
-  virtual int get_elementsize()
+  virtual int
+  get_elementsize()
   {
     ink_assert(0);
     return 0;
@@ -366,7 +373,8 @@ struct MultiCacheBase: public MultiCacheHeader
   void *alloc(int *poffset, int size);
   void update(int *poffset, int *old_poffset);
   void *ptr(int *poffset, int partition);
-  int valid_offset(int offset)
+  int
+  valid_offset(int offset)
   {
     int max;
     if (offset < halfspace_size())
@@ -375,108 +383,121 @@ struct MultiCacheBase: public MultiCacheHeader
       max = halfspace_size() + heap_used[1];
     return offset < max;
   }
-  int valid_heap_pointer(char *p)
+  int
+  valid_heap_pointer(char *p)
   {
     if (p < heap + halfspace_size())
       return p < heap + heap_used[0];
     else
       return p < heap + halfspace_size() + heap_used[1];
   }
-  void copy_heap_data(char *src, int s, int *pi, int partition, MultiCacheHeapGC * gc);
-  int halfspace_of(int o)
+  void copy_heap_data(char *src, int s, int *pi, int partition, MultiCacheHeapGC *gc);
+  int
+  halfspace_of(int o)
   {
-    return o < halfspace_size()? 0 : 1;
+    return o < halfspace_size() ? 0 : 1;
   }
-  UnsunkPtrRegistry *fixup_heap_offsets(int partition, int before_used, UnsunkPtrRegistry * r = NULL, int base = 0);
+  UnsunkPtrRegistry *fixup_heap_offsets(int partition, int before_used, UnsunkPtrRegistry *r = NULL, int base = 0);
 
-  virtual void copy_heap(int partition, MultiCacheHeapGC * gc)
+  virtual void
+  copy_heap(int partition, MultiCacheHeapGC *gc)
   {
-    (void) partition;
-    (void) gc;
+    (void)partition;
+    (void)gc;
   }
 
   //
   // Private
   //
-  void alloc_mutexes()
+  void
+  alloc_mutexes()
   {
     for (int i = 0; i < MULTI_CACHE_PARTITIONS; i++)
       locks[i] = new_ProxyMutex();
   }
-  PtrMutex locks[MULTI_CACHE_PARTITIONS];       // 1 lock per (buckets/partitions)
+  PtrMutex locks[MULTI_CACHE_PARTITIONS]; // 1 lock per (buckets/partitions)
 };
 
-template<class C> struct MultiCache: public MultiCacheBase
-{
-  int get_elementsize()
+template <class C> struct MultiCache : public MultiCacheBase {
+  int
+  get_elementsize()
   {
     return sizeof(C);
   }
 
-  MultiCacheBase *dup()
+  MultiCacheBase *
+  dup()
   {
     return new MultiCache<C>;
   }
 
-  void rebuild_element(int buck, char *elem, RebuildMC & r);
+  void rebuild_element(int buck, char *elem, RebuildMC &r);
   // -1 is corrupt, 0 == void (do not insert), 1 is OK
-  virtual int rebuild_callout(C * c, RebuildMC & r)
+  virtual int
+  rebuild_callout(C *c, RebuildMC &r)
   {
-    (void) c;
-    (void) r;
+    (void)c;
+    (void)r;
     return 1;
   }
 
-  virtual void rebuild_insert_callout(C * c, RebuildMC & r)
+  virtual void
+  rebuild_insert_callout(C *c, RebuildMC &r)
   {
-    (void) c;
-    (void) r;
+    (void)c;
+    (void)r;
   }
 
   //
   // template operations
   //
-  int level_of_block(C * b);
-  bool match(uint64_t folded_md5, C * block);
+  int level_of_block(C *b);
+  bool match(uint64_t folded_md5, C *block);
   C *cache_bucket(uint64_t folded_md5, unsigned int level);
-  C *insert_block(uint64_t folded_md5, C * new_block, unsigned int level);
-  void flush(C * b, int bucket, unsigned int level);
-  void delete_block(C * block);
+  C *insert_block(uint64_t folded_md5, C *new_block, unsigned int level);
+  void flush(C *b, int bucket, unsigned int level);
+  void delete_block(C *block);
   C *lookup_block(uint64_t folded_md5, unsigned int level);
   void copy_heap(int paritition, MultiCacheHeapGC *);
 };
 
 inline uint64_t
-fold_md5(INK_MD5 const& md5)
+fold_md5(INK_MD5 const &md5)
 {
   return md5.fold();
 }
 
-template<class C> inline int MultiCache<C>::level_of_block(C * b)
+template <class C>
+inline int
+MultiCache<C>::level_of_block(C *b)
 {
-  if ((char *) b - data >= level_offset[1]) {
-    if ((char *) b - data >= level_offset[2])
+  if ((char *)b - data >= level_offset[1]) {
+    if ((char *)b - data >= level_offset[2])
       return 2;
     return 1;
   }
   return 0;
 }
 
-template<class C> inline C * MultiCache<C>::cache_bucket(uint64_t folded_md5, unsigned int level)
+template <class C>
+inline C *
+MultiCache<C>::cache_bucket(uint64_t folded_md5, unsigned int level)
 {
-  int bucket = (int) (folded_md5 % buckets);
+  int bucket = (int)(folded_md5 % buckets);
   char *offset = data + level_offset[level] + bucketsize[level] * bucket;
-  return (C *) offset;
+  return (C *)offset;
 }
 
 //
 // Insert an entry
 //
-template<class C> inline C * MultiCache<C>::insert_block(uint64_t folded_md5, C * new_block, unsigned int level)
+template <class C>
+inline C *
+MultiCache<C>::insert_block(uint64_t folded_md5, C *new_block, unsigned int level)
 {
   C *b = cache_bucket(folded_md5, level);
   C *block = NULL, *empty = NULL;
-  int bucket = (int) (folded_md5 % buckets);
+  int bucket = (int)(folded_md5 % buckets);
   int hits = 0;
 
   // Find the entry
@@ -537,13 +558,14 @@ Lfound:
   return block;
 }
 
-#define REBUILD_FOLDED_MD5(_cl) \
-((_cl->tag() * (uint64_t)buckets + (uint64_t)bucket))
+#define REBUILD_FOLDED_MD5(_cl) ((_cl->tag() * (uint64_t)buckets + (uint64_t)bucket))
 
 //
 // This function ejects some number of entries.
 //
-template<class C> inline void MultiCache<C>::flush(C * b, int bucket, unsigned int level)
+template <class C>
+inline void
+MultiCache<C>::flush(C *b, int bucket, unsigned int level)
 {
   C *block = NULL;
   // The comparison against the constant is redundant, but it
@@ -566,7 +588,9 @@ template<class C> inline void MultiCache<C>::flush(C * b, int bucket, unsigned i
 //
 // Match a cache line and a folded md5 key
 //
-template<class C> inline bool MultiCache<C>::match(uint64_t folded_md5, C * block)
+template <class C>
+inline bool
+MultiCache<C>::match(uint64_t folded_md5, C *block)
 {
   return block->tag() == make_tag(folded_md5);
 }
@@ -574,14 +598,16 @@ template<class C> inline bool MultiCache<C>::match(uint64_t folded_md5, C * bloc
 //
 // This code is a bit of a mess and should probably be rewritten
 //
-template<class C> inline void MultiCache<C>::delete_block(C * b)
+template <class C>
+inline void
+MultiCache<C>::delete_block(C *b)
 {
   if (b->backed) {
     unsigned int l = level_of_block(b);
     if (l < levels - 1) {
-      int bucket = (((char *) b - data) - level_offset[l]) / bucketsize[l];
-      C *x = (C *) (data + level_offset[l + 1] + bucket * bucketsize[l + 1]);
-      for (C * y = x; y < x + elements[l + 1]; y++)
+      int bucket = (((char *)b - data) - level_offset[l]) / bucketsize[l];
+      C *x = (C *)(data + level_offset[l + 1] + bucket * bucketsize[l + 1]);
+      for (C *y = x; y < x + elements[l + 1]; y++)
         if (b->tag() == y->tag())
           delete_block(y);
     }
@@ -592,7 +618,9 @@ template<class C> inline void MultiCache<C>::delete_block(C * b)
 //
 // Lookup an entry up to some level in the cache
 //
-template<class C> inline C * MultiCache<C>::lookup_block(uint64_t folded_md5, unsigned int level)
+template <class C>
+inline C *
+MultiCache<C>::lookup_block(uint64_t folded_md5, unsigned int level)
 {
   C *b = cache_bucket(folded_md5, 0);
   uint64_t tag = make_tag(folded_md5);
@@ -618,9 +646,11 @@ template<class C> inline C * MultiCache<C>::lookup_block(uint64_t folded_md5, un
   return NULL;
 }
 
-template<class C> inline void MultiCache<C>::rebuild_element(int bucket, char *elem, RebuildMC & r)
+template <class C>
+inline void
+MultiCache<C>::rebuild_element(int bucket, char *elem, RebuildMC &r)
 {
-  C *e = (C *) elem;
+  C *e = (C *)elem;
   if (!e->is_empty()) {
     r.total++;
     if (e->is_deleted())
@@ -643,20 +673,22 @@ template<class C> inline void MultiCache<C>::rebuild_element(int bucket, char *e
   }
 }
 
-template<class C> inline void MultiCache<C>::copy_heap(int partition, MultiCacheHeapGC * gc)
+template <class C>
+inline void
+MultiCache<C>::copy_heap(int partition, MultiCacheHeapGC *gc)
 {
   int b = first_bucket_of_partition(partition);
   int n = buckets_of_partition(partition);
   for (unsigned int level = 0; level < levels; level++) {
     int e = n * elements[level];
     char *d = data + level_offset[level] + b * bucketsize[level];
-    C *x = (C *) d;
+    C *x = (C *)d;
     for (int i = 0; i < e; i++) {
       int s = x[i].heap_size();
       if (s) {
         int *pi = x[i].heap_offset_ptr();
         if (pi) {
-          char *src = (char *) ptr(pi, partition);
+          char *src = (char *)ptr(pi, partition);
           if (src) {
             if (heap_halfspace) {
               if (src >= heap + halfspace_size())
@@ -672,5 +704,5 @@ template<class C> inline void MultiCache<C>::copy_heap(int partition, MultiCache
 }
 
 // store either free or in the cache, can be stolen for reconfiguration
-void stealStore(Store & s, int blocks);
+void stealStore(Store &s, int blocks);
 #endif /* _MultiCache_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/include/Machine.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/include/Machine.h b/iocore/hostdb/include/Machine.h
index a933b39..50b24fa 100644
--- a/iocore/hostdb/include/Machine.h
+++ b/iocore/hostdb/include/Machine.h
@@ -41,7 +41,7 @@
 // Timeout the Machine * this amount of time after they
 // fall out of the current configuration that are deleted.
 //
-#define MACHINE_TIMEOUT            (HRTIME_DAY*2)
+#define MACHINE_TIMEOUT (HRTIME_DAY * 2)
 
 
 //
@@ -53,14 +53,13 @@
 //
 //  Long running operations should use more sophisticated synchronization.
 //
-#define NO_RACE_DELAY                  HRTIME_HOUR      // a long long time
+#define NO_RACE_DELAY HRTIME_HOUR // a long long time
 
 //#include "Connection.h"
 
-class ClusterHandler;           // Leave this a class - VC++ gets very anal  ~SR
+class ClusterHandler; // Leave this a class - VC++ gets very anal  ~SR
 
-struct Machine: Server
-{
+struct Machine : Server {
   bool dead;
   char *hostname;
   int hostname_len;
@@ -71,11 +70,11 @@ struct Machine: Server
   unsigned int ip;
   int cluster_port;
 
-    Link<Machine> link;
+  Link<Machine> link;
 
   // default for localhost
-    Machine(char *hostname = NULL, unsigned int ip = 0, int acluster_port = 0);
-   ~Machine();
+  Machine(char *hostname = NULL, unsigned int ip = 0, int acluster_port = 0);
+  ~Machine();
 
   // Cluster message protocol version
   uint16_t msg_proto_major;
@@ -86,17 +85,17 @@ struct Machine: Server
   ClusterHandler *clusterHandler;
 };
 
-struct MachineListElement
-{
+struct MachineListElement {
   unsigned int ip;
   int port;
 };
 
-struct MachineList
-{
+struct MachineList {
   int n;
   MachineListElement machine[1];
-  MachineListElement *find(unsigned int ip, int port = 0) {
+  MachineListElement *
+  find(unsigned int ip, int port = 0)
+  {
     for (int i = 0; i < n; i++)
       if (machine[i].ip == ip && (!port || machine[i].port == port))
         return &machine[i];
@@ -104,7 +103,7 @@ struct MachineList
   }
 };
 
-void free_Machine(Machine * m);
+void free_Machine(Machine *m);
 
 MachineList *the_cluster_config();
 extern ProxyMutex *the_cluster_config_mutex;


[46/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index d26810b..d8e7bed 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -39,7 +39,7 @@
 #endif
 
 // Compilation Options
-#define USELESS_REENABLES       // allow them for now
+#define USELESS_REENABLES // allow them for now
 // #define VERIFY_JTEST_DATA
 
 static size_t DEFAULT_RAM_CACHE_MULTIPLIER = 10; // I.e. 10x 1MB per 1GB of disk.
@@ -47,11 +47,11 @@ static size_t DEFAULT_RAM_CACHE_MULTIPLIER = 10; // I.e. 10x 1MB per 1GB of disk
 // This is the oldest version number that is still usable.
 static short int const CACHE_DB_MAJOR_VERSION_COMPATIBLE = 21;
 
-#define DOCACHE_CLEAR_DYN_STAT(x) \
-do { \
-	RecSetRawStatSum(rsb, x, 0); \
-	RecSetRawStatCount(rsb, x, 0); \
-} while (0);
+#define DOCACHE_CLEAR_DYN_STAT(x)  \
+  do {                             \
+    RecSetRawStatSum(rsb, x, 0);   \
+    RecSetRawStatCount(rsb, x, 0); \
+  } while (0);
 
 
 // Configuration
@@ -97,7 +97,7 @@ Cache *theCache = 0;
 CacheDisk **gdisks = NULL;
 int gndisks = 0;
 static volatile int initialize_disk = 0;
-Cache *caches[NUM_CACHE_FRAG_TYPES] = { 0 };
+Cache *caches[NUM_CACHE_FRAG_TYPES] = {0};
 CacheSync *cacheDirSync = 0;
 Store theCacheStore;
 volatile int CacheProcessor::initialized = CACHE_INITIALIZING;
@@ -126,8 +126,7 @@ CacheKey zero_key;
 ClassAllocator<MigrateToInterimCache> migrateToInterimCacheAllocator("migrateToInterimCache");
 #endif
 
-struct VolInitInfo
-{
+struct VolInitInfo {
   off_t recover_pos;
   AIOCallbackInternal vol_aio[4];
   char *vol_h_f;
@@ -150,29 +149,29 @@ struct VolInitInfo
 };
 
 #if AIO_MODE == AIO_MODE_NATIVE
-struct VolInit : public Continuation
-{
+struct VolInit : public Continuation {
   Vol *vol;
   char *path;
   off_t blocks;
   int64_t offset;
   bool vol_clear;
 
-  int mainEvent(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */) {
+  int
+  mainEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
+  {
     vol->init(path, blocks, offset, vol_clear);
     mutex.clear();
     delete this;
     return EVENT_DONE;
   }
 
-  VolInit(Vol *v, char *p, off_t b, int64_t o, bool c) : Continuation(v->mutex),
-    vol(v), path(p), blocks(b), offset(o), vol_clear(c) {
+  VolInit(Vol *v, char *p, off_t b, int64_t o, bool c) : Continuation(v->mutex), vol(v), path(p), blocks(b), offset(o), vol_clear(c)
+  {
     SET_HANDLER(&VolInit::mainEvent);
   }
 };
 
-struct DiskInit : public Continuation
-{
+struct DiskInit : public Continuation {
   CacheDisk *disk;
   char *s;
   off_t blocks;
@@ -181,7 +180,9 @@ struct DiskInit : public Continuation
   int fildes;
   bool clear;
 
-  int mainEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) {
+  int
+  mainEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
+  {
     disk->open(s, blocks, askip, ahw_sector_size, fildes, clear);
     ats_free(s);
     mutex.clear();
@@ -189,8 +190,9 @@ struct DiskInit : public Continuation
     return EVENT_DONE;
   }
 
-  DiskInit(CacheDisk *d, char *str, off_t b, off_t skip, int sector, int f, bool c) : Continuation(d->mutex),
-      disk(d), s(ats_strdup(str)), blocks(b), askip(skip), ahw_sector_size(sector), fildes(f), clear(c) {
+  DiskInit(CacheDisk *d, char *str, off_t b, off_t skip, int sector, int f, bool c)
+    : Continuation(d->mutex), disk(d), s(ats_strdup(str)), blocks(b), askip(skip), ahw_sector_size(sector), fildes(f), clear(c)
+  {
     SET_HANDLER(&DiskInit::mainEvent);
   }
 };
@@ -207,7 +209,9 @@ int cp_list_len = 0;
 ConfigVolumes config_volumes;
 
 #if TS_HAS_TESTS
-void force_link_CacheTestCaller() {
+void
+force_link_CacheTestCaller()
+{
   force_link_CacheTest();
 }
 #endif
@@ -220,9 +224,9 @@ cache_bytes_used(int volume)
   for (int i = 0; i < gnvol; i++) {
     if (!DISK_BAD(gvol[i]->disk) && (volume == -1 || gvol[i]->cache_vol->vol_number == volume)) {
       if (!gvol[i]->header->cycle)
-          used += gvol[i]->header->write_pos - gvol[i]->start;
+        used += gvol[i]->header->write_pos - gvol[i]->start;
       else
-          used += gvol[i]->len - vol_dirlen(gvol[i]) - EVACUATION_SIZE;
+        used += gvol[i]->len - vol_dirlen(gvol[i]) - EVACUATION_SIZE;
     }
   }
 
@@ -236,23 +240,23 @@ cache_stats_bytes_used_cb(const char *name, RecDataT data_type, RecData *data, R
   char *p;
 
   // Well, there's no way to pass along the volume ID, so extracting it from the stat name.
-  p = strstr((char *) name, "volume_");
+  p = strstr((char *)name, "volume_");
   if (p != NULL) {
     // I'm counting on the compiler to optimize out strlen("volume_").
     volume = strtol(p + strlen("volume_"), NULL, 10);
   }
 
   if (cacheProcessor.initialized == CACHE_INITIALIZED) {
-    int64_t used, total =0;
+    int64_t used, total = 0;
     float percent_full;
 
-    used =  cache_bytes_used(volume);
+    used = cache_bytes_used(volume);
     RecSetGlobalRawStatSum(rsb, id, used);
     RecRawStatSyncSum(name, data_type, data, rsb, id);
-    RecGetGlobalRawStatSum(rsb, (int) cache_bytes_total_stat, &total);
+    RecGetGlobalRawStatSum(rsb, (int)cache_bytes_total_stat, &total);
     percent_full = (float)used / (float)total * 100;
     // The perent_full float below gets rounded down
-    RecSetGlobalRawStatSum(rsb, (int) cache_percent_full_stat, (int64_t) percent_full);
+    RecSetGlobalRawStatSum(rsb, (int)cache_percent_full_stat, (int64_t)percent_full);
   }
 
   return 1;
@@ -290,14 +294,14 @@ update_cache_config(const char * /* name ATS_UNUSED */, RecDataT /* data_type AT
   return 0;
 }
 
-CacheVC::CacheVC():alternate_index(CACHE_ALT_INDEX_DEFAULT)
+CacheVC::CacheVC() : alternate_index(CACHE_ALT_INDEX_DEFAULT)
 {
-  size_to_init = sizeof(CacheVC) - (size_t) & ((CacheVC *) 0)->vio;
-  memset((void *) &vio, 0, size_to_init);
+  size_to_init = sizeof(CacheVC) - (size_t) & ((CacheVC *)0)->vio;
+  memset((void *)&vio, 0, size_to_init);
 }
 
 #ifdef HTTP_CACHE
-HTTPInfo::FragOffset*
+HTTPInfo::FragOffset *
 CacheVC::get_frag_table()
 {
   ink_assert(alternate.valid());
@@ -363,7 +367,7 @@ CacheVC::do_io_close(int alerrno)
 {
   ink_assert(mutex->thread_holding == this_ethread());
   int previous_closed = closed;
-  closed = (alerrno == -1) ? 1 : -1;    // Stupid default arguments
+  closed = (alerrno == -1) ? 1 : -1; // Stupid default arguments
   DDebug("cache_close", "do_io_close %p %d %d", this, alerrno, closed);
   if (!previous_closed && !recursive)
     die();
@@ -373,7 +377,7 @@ void
 CacheVC::reenable(VIO *avio)
 {
   DDebug("cache_reenable", "reenable %p", this);
-  (void) avio;
+  (void)avio;
 #ifdef DEBUG
   ink_assert(avio->mutex->thread_holding);
 #endif
@@ -393,13 +397,13 @@ void
 CacheVC::reenable_re(VIO *avio)
 {
   DDebug("cache_reenable", "reenable_re %p", this);
-  (void) avio;
+  (void)avio;
 #ifdef DEBUG
   ink_assert(avio->mutex->thread_holding);
 #endif
   if (!trigger) {
     if (!is_io_in_progress() && !recursive) {
-      handleEvent(EVENT_NONE, (void *) 0);
+      handleEvent(EVENT_NONE, (void *)0);
     } else
       trigger = avio->mutex->thread_holding->schedule_imm_local(this);
   }
@@ -411,11 +415,11 @@ CacheVC::get_data(int i, void *data)
   switch (i) {
 #ifdef HTTP_CACHE
   case CACHE_DATA_HTTP_INFO:
-    *((CacheHTTPInfo **) data) = &alternate;
+    *((CacheHTTPInfo **)data) = &alternate;
     return true;
 #endif
   case CACHE_DATA_RAM_CACHE_HIT_FLAG:
-    *((int *) data) = !f.not_from_ram_cache;
+    *((int *)data) = !f.not_from_ram_cache;
     return true;
   default:
     break;
@@ -426,10 +430,11 @@ CacheVC::get_data(int i, void *data)
 int64_t
 CacheVC::get_object_size()
 {
-  return ((CacheVC *) this)->doc_len;
+  return ((CacheVC *)this)->doc_len;
 }
 
-bool CacheVC::set_data(int /* i ATS_UNUSED */ , void * /* data */ )
+bool
+CacheVC::set_data(int /* i ATS_UNUSED */, void * /* data */)
 {
   ink_assert(!"CacheVC::set_data should not be called!");
   return true;
@@ -437,9 +442,9 @@ bool CacheVC::set_data(int /* i ATS_UNUSED */ , void * /* data */ )
 
 #ifdef HTTP_CACHE
 void
-CacheVC::get_http_info(CacheHTTPInfo ** ainfo)
+CacheVC::get_http_info(CacheHTTPInfo **ainfo)
 {
-  *ainfo = &((CacheVC *) this)->alternate;
+  *ainfo = &((CacheVC *)this)->alternate;
 }
 
 // set_http_info must be called before do_io_write
@@ -470,7 +475,8 @@ CacheVC::set_http_info(CacheHTTPInfo *ainfo)
 }
 #endif
 
-bool CacheVC::set_pin_in_cache(time_t time_pin)
+bool
+CacheVC::set_pin_in_cache(time_t time_pin)
 {
   if (total_len) {
     ink_assert(!"should Pin the document before writing");
@@ -484,15 +490,16 @@ bool CacheVC::set_pin_in_cache(time_t time_pin)
   return true;
 }
 
-bool CacheVC::set_disk_io_priority(int priority)
+bool
+CacheVC::set_disk_io_priority(int priority)
 {
-
   ink_assert(priority >= AIO_LOWEST_PRIORITY);
   io.aiocb.aio_reqprio = priority;
   return true;
 }
 
-time_t CacheVC::get_pin_in_cache()
+time_t
+CacheVC::get_pin_in_cache()
 {
   return pin_in_cache;
 }
@@ -582,7 +589,6 @@ static const int DEFAULT_CACHE_OPTIONS = (O_RDWR);
 int
 CacheProcessor::start_internal(int flags)
 {
-
   ink_assert((int)TS_EVENT_CACHE_OPEN_READ == (int)CACHE_EVENT_OPEN_READ);
   ink_assert((int)TS_EVENT_CACHE_OPEN_READ_FAILED == (int)CACHE_EVENT_OPEN_READ_FAILED);
   ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE == (int)CACHE_EVENT_OPEN_WRITE);
@@ -614,7 +620,7 @@ CacheProcessor::start_internal(int flags)
   Span *sd;
 #if TS_USE_INTERIM_CACHE == 1
   gn_interim_disks = theCacheStore.n_interim_disks;
-  g_interim_disks = (CacheDisk **) ats_malloc(gn_interim_disks * sizeof(CacheDisk *));
+  g_interim_disks = (CacheDisk **)ats_malloc(gn_interim_disks * sizeof(CacheDisk *));
 
   gn_interim_disks = 0;
 
@@ -626,8 +632,7 @@ CacheProcessor::start_internal(int flags)
     if (!sd->file_pathname) {
 #if !defined(_WIN32)
       if (config_volumes.num_http_volumes && config_volumes.num_stream_volumes) {
-        Warning(
-            "It is suggested that you use raw disks if streaming and http are in the same cache");
+        Warning("It is suggested that you use raw disks if streaming and http are in the same cache");
       }
 #endif
       ink_strlcat(path, "/cache.db", sizeof(path));
@@ -646,7 +651,7 @@ CacheProcessor::start_internal(int flags)
     int blocks = sd->blocks;
     if (fd > 0) {
       if (!sd->file_pathname) {
-        if (ftruncate(fd, ((uint64_t) blocks) * STORE_BLOCK_SIZE) < 0) {
+        if (ftruncate(fd, ((uint64_t)blocks) * STORE_BLOCK_SIZE) < 0) {
           Warning("unable to truncate cache file '%s' to %d blocks", path, blocks);
           diskok = 0;
         }
@@ -661,8 +666,8 @@ CacheProcessor::start_internal(int flags)
           Note("resetting hardware sector size from %d to %d", sector_size, STORE_BLOCK_SIZE);
           sector_size = STORE_BLOCK_SIZE;
         }
-        off_t skip = ROUND_TO_STORE_BLOCK((sd->offset * STORE_BLOCK_SIZE < START_POS ? START_POS + sd->alignment :
-                                           sd->offset * STORE_BLOCK_SIZE));
+        off_t skip = ROUND_TO_STORE_BLOCK(
+          (sd->offset * STORE_BLOCK_SIZE < START_POS ? START_POS + sd->alignment : sd->offset * STORE_BLOCK_SIZE));
         blocks = blocks - (skip >> STORE_BLOCK_SHIFT);
         disk->path = ats_strdup(path);
         disk->hw_sector_size = sector_size;
@@ -725,12 +730,12 @@ CacheProcessor::start_internal(int flags)
     int fd = open(path, opts, 0644);
     int blocks = sd->blocks;
 
-    if (fd < 0 && (opts & O_CREAT))  // Try without O_DIRECT if this is a file on filesystem, e.g. tmpfs.
+    if (fd < 0 && (opts & O_CREAT)) // Try without O_DIRECT if this is a file on filesystem, e.g. tmpfs.
       fd = open(path, DEFAULT_CACHE_OPTIONS | O_CREAT, 0644);
 
     if (fd >= 0) {
       if (!sd->file_pathname) {
-        if (ftruncate(fd, ((uint64_t) blocks) * STORE_BLOCK_SIZE) < 0) {
+        if (ftruncate(fd, ((uint64_t)blocks) * STORE_BLOCK_SIZE) < 0) {
           Warning("unable to truncate cache file '%s' to %d blocks", path, blocks);
           diskok = 0;
         }
@@ -794,7 +799,6 @@ CacheProcessor::diskInitialized()
   int bad_disks = 0;
   int res = 0;
   if (n_init == gndisks - 1) {
-
     int i;
     for (i = 0; i < gndisks; i++) {
       if (DISK_BAD(gdisks[i]))
@@ -845,7 +849,7 @@ CacheProcessor::diskInitialized()
     } else {
       CacheVol *cp = cp_list.head;
       for (; cp; cp = cp->link.next) {
-        cp->vol_rsb = RecAllocateRawStatBlock((int) cache_stat_count);
+        cp->vol_rsb = RecAllocateRawStatBlock((int)cache_stat_count);
         char vol_stat_str_prefix[256];
         snprintf(vol_stat_str_prefix, sizeof(vol_stat_str_prefix), "proxy.process.cache.volume_%d", cp->vol_number);
         register_cache_stats(cp->vol_rsb, vol_stat_str_prefix);
@@ -859,14 +863,13 @@ CacheProcessor::diskInitialized()
       CacheDisk *d = gdisks[i];
       if (is_debug_tag_set("cache_hosting")) {
         int j;
-        Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64,
-              i, d->header->num_diskvol_blks, d->free_space);
-        for (j = 0; j < (int) d->header->num_volumes; j++) {
+        Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64, i, d->header->num_diskvol_blks, d->free_space);
+        for (j = 0; j < (int)d->header->num_volumes; j++) {
           Debug("cache_hosting", "\tVol: %d Size: %" PRIu64, d->disk_vols[j]->vol_number, d->disk_vols[j]->size);
         }
-        for (j = 0; j < (int) d->header->num_diskvol_blks; j++) {
-          Debug("cache_hosting", "\tBlock No: %d Size: %" PRIu64" Free: %u",
-                d->header->vol_info[j].number, d->header->vol_info[j].len, d->header->vol_info[j].free);
+        for (j = 0; j < (int)d->header->num_diskvol_blks; j++) {
+          Debug("cache_hosting", "\tBlock No: %d Size: %" PRIu64 " Free: %u", d->header->vol_info[j].number,
+                d->header->vol_info[j].len, d->header->vol_info[j].free);
         }
       }
       d->sync();
@@ -888,7 +891,6 @@ CacheProcessor::diskInitialized()
       theStreamCache->scheme = CACHE_RTSP_TYPE;
       theStreamCache->open(clear, fix);
     }
-
   }
 }
 
@@ -897,17 +899,16 @@ CacheProcessor::cacheInitialized()
 {
   int i;
 
-  if ((theCache && (theCache->ready == CACHE_INITIALIZING)) ||
-      (theStreamCache && (theStreamCache->ready == CACHE_INITIALIZING)))
+  if ((theCache && (theCache->ready == CACHE_INITIALIZING)) || (theStreamCache && (theStreamCache->ready == CACHE_INITIALIZING)))
     return;
   int caches_ready = 0;
   int cache_init_ok = 0;
   /* allocate ram size in proportion to the disk space the
      volume accupies */
-  int64_t total_size = 0;               // count in HTTP & MIXT
-  uint64_t total_cache_bytes = 0;       // bytes that can used in total_size
-  uint64_t total_direntries = 0;        // all the direntries in the cache
-  uint64_t used_direntries = 0;         //   and used
+  int64_t total_size = 0;         // count in HTTP & MIXT
+  uint64_t total_cache_bytes = 0; // bytes that can used in total_size
+  uint64_t total_direntries = 0;  // all the direntries in the cache
+  uint64_t used_direntries = 0;   //   and used
   uint64_t vol_total_cache_bytes = 0;
   uint64_t vol_total_direntries = 0;
   uint64_t vol_used_direntries = 0;
@@ -917,13 +918,13 @@ CacheProcessor::cacheInitialized()
 
   if (theCache) {
     total_size += theCache->cache_size;
-    Debug("cache_init", "CacheProcessor::cacheInitialized - theCache, total_size = %" PRId64 " = %" PRId64 " MB",
-          total_size, total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
+    Debug("cache_init", "CacheProcessor::cacheInitialized - theCache, total_size = %" PRId64 " = %" PRId64 " MB", total_size,
+          total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
   }
   if (theStreamCache) {
     total_size += theStreamCache->cache_size;
-    Debug("cache_init", "CacheProcessor::cacheInitialized - theStreamCache, total_size = %" PRId64 " = %" PRId64 " MB",
-          total_size, total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
+    Debug("cache_init", "CacheProcessor::cacheInitialized - theStreamCache, total_size = %" PRId64 " = %" PRId64 " MB", total_size,
+          total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
   }
 
   if (theCache) {
@@ -939,8 +940,7 @@ CacheProcessor::cacheInitialized()
   }
   if (theStreamCache) {
     if (theStreamCache->ready == CACHE_INIT_FAILED) {
-      Debug("cache_init",
-            "CacheProcessor::cacheInitialized - failed to initialize the cache for streaming: cache disabled");
+      Debug("cache_init", "CacheProcessor::cacheInitialized - failed to initialize the cache for streaming: cache disabled");
       Warning("failed to initialize the cache for streaming: cache disabled\n");
     } else {
       caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_RTSP);
@@ -953,7 +953,7 @@ CacheProcessor::cacheInitialized()
     cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = gvol[0]->header->version;
   // scan the rest of the stripes.
   for (i = 1; i < gnvol; i++) {
-    Vol* v = gvol[i];
+    Vol *v = gvol[i];
     if (v->header->version < cacheProcessor.min_stripe_version)
       cacheProcessor.min_stripe_version = v->header->version;
     if (cacheProcessor.max_stripe_version < v->header->version)
@@ -962,8 +962,7 @@ CacheProcessor::cacheInitialized()
 
 
   if (caches_ready) {
-    Debug("cache_init", "CacheProcessor::cacheInitialized - caches_ready=0x%0X, gnvol=%d", (unsigned int) caches_ready,
-          gnvol);
+    Debug("cache_init", "CacheProcessor::cacheInitialized - caches_ready=0x%0X, gnvol=%d", (unsigned int)caches_ready, gnvol);
 
     int64_t ram_cache_bytes = 0;
 
@@ -971,13 +970,13 @@ CacheProcessor::cacheInitialized()
       // new ram_caches, with algorithm from the config
       for (i = 0; i < gnvol; i++) {
         switch (cache_config_ram_cache_algorithm) {
-          default:
-          case RAM_CACHE_ALGORITHM_CLFUS:
-            gvol[i]->ram_cache = new_RamCacheCLFUS();
-            break;
-          case RAM_CACHE_ALGORITHM_LRU:
-            gvol[i]->ram_cache = new_RamCacheLRU();
-            break;
+        default:
+        case RAM_CACHE_ALGORITHM_CLFUS:
+          gvol[i]->ram_cache = new_RamCacheCLFUS();
+          break;
+        case RAM_CACHE_ALGORITHM_LRU:
+          gvol[i]->ram_cache = new_RamCacheLRU();
+          break;
         }
       }
       // let us calculate the Size
@@ -987,12 +986,12 @@ CacheProcessor::cacheInitialized()
           vol = gvol[i];
           gvol[i]->ram_cache->init(vol_dirlen(vol) * DEFAULT_RAM_CACHE_MULTIPLIER, vol);
 #if TS_USE_INTERIM_CACHE == 1
-          gvol[i]->history.init(1<<20, 2097143);
+          gvol[i]->history.init(1 << 20, 2097143);
 #endif
           ram_cache_bytes += vol_dirlen(gvol[i]);
-          Debug("cache_init", "CacheProcessor::cacheInitialized - ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb",
-                ram_cache_bytes, ram_cache_bytes / (1024 * 1024));
-          CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, (int64_t) vol_dirlen(gvol[i]));
+          Debug("cache_init", "CacheProcessor::cacheInitialized - ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb", ram_cache_bytes,
+                ram_cache_bytes / (1024 * 1024));
+          CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, (int64_t)vol_dirlen(gvol[i]));
 
           vol_total_cache_bytes = gvol[i]->len - vol_dirlen(gvol[i]);
           total_cache_bytes += vol_total_cache_bytes;
@@ -1016,10 +1015,9 @@ CacheProcessor::cacheInitialized()
         // we got configured memory size
         // TODO, should we check the available system memories, or you will
         //   OOM or swapout, that is not a good situation for the server
-        Debug("cache_init", "CacheProcessor::cacheInitialized - %" PRId64 " != AUTO_SIZE_RAM_CACHE",
-              cache_config_ram_cache_size);
+        Debug("cache_init", "CacheProcessor::cacheInitialized - %" PRId64 " != AUTO_SIZE_RAM_CACHE", cache_config_ram_cache_size);
         int64_t http_ram_cache_size =
-          (theCache) ? (int64_t) (((double) theCache->cache_size / total_size) * cache_config_ram_cache_size) : 0;
+          (theCache) ? (int64_t)(((double)theCache->cache_size / total_size) * cache_config_ram_cache_size) : 0;
         Debug("cache_init", "CacheProcessor::cacheInitialized - http_ram_cache_size = %" PRId64 " = %" PRId64 "Mb",
               http_ram_cache_size, http_ram_cache_size / (1024 * 1024));
         int64_t stream_ram_cache_size = cache_config_ram_cache_size - http_ram_cache_size;
@@ -1027,29 +1025,29 @@ CacheProcessor::cacheInitialized()
               stream_ram_cache_size, stream_ram_cache_size / (1024 * 1024));
 
         // Dump some ram_cache size information in debug mode.
-        Debug("ram_cache", "config: size = %" PRId64 ", cutoff = %" PRId64 "",
-              cache_config_ram_cache_size, cache_config_ram_cache_cutoff);
+        Debug("ram_cache", "config: size = %" PRId64 ", cutoff = %" PRId64 "", cache_config_ram_cache_size,
+              cache_config_ram_cache_cutoff);
 
         for (i = 0; i < gnvol; i++) {
           vol = gvol[i];
           double factor;
           if (gvol[i]->cache == theCache) {
-            factor = (double) (int64_t) (gvol[i]->len >> STORE_BLOCK_SHIFT) / (int64_t) theCache->cache_size;
+            factor = (double)(int64_t)(gvol[i]->len >> STORE_BLOCK_SHIFT) / (int64_t)theCache->cache_size;
             Debug("cache_init", "CacheProcessor::cacheInitialized - factor = %f", factor);
-            gvol[i]->ram_cache->init((int64_t) (http_ram_cache_size * factor), vol);
-            ram_cache_bytes += (int64_t) (http_ram_cache_size * factor);
-            CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, (int64_t) (http_ram_cache_size * factor));
+            gvol[i]->ram_cache->init((int64_t)(http_ram_cache_size * factor), vol);
+            ram_cache_bytes += (int64_t)(http_ram_cache_size * factor);
+            CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, (int64_t)(http_ram_cache_size * factor));
           } else {
-            factor = (double) (int64_t) (gvol[i]->len >> STORE_BLOCK_SHIFT) / (int64_t) theStreamCache->cache_size;
+            factor = (double)(int64_t)(gvol[i]->len >> STORE_BLOCK_SHIFT) / (int64_t)theStreamCache->cache_size;
             Debug("cache_init", "CacheProcessor::cacheInitialized - factor = %f", factor);
-            gvol[i]->ram_cache->init((int64_t) (stream_ram_cache_size * factor), vol);
-            ram_cache_bytes += (int64_t) (stream_ram_cache_size * factor);
-            CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, (int64_t) (stream_ram_cache_size * factor));
+            gvol[i]->ram_cache->init((int64_t)(stream_ram_cache_size * factor), vol);
+            ram_cache_bytes += (int64_t)(stream_ram_cache_size * factor);
+            CACHE_VOL_SUM_DYN_STAT(cache_ram_cache_bytes_total_stat, (int64_t)(stream_ram_cache_size * factor));
           }
-          Debug("cache_init", "CacheProcessor::cacheInitialized[%d] - ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb",
-                i, ram_cache_bytes, ram_cache_bytes / (1024 * 1024));
+          Debug("cache_init", "CacheProcessor::cacheInitialized[%d] - ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb", i,
+                ram_cache_bytes, ram_cache_bytes / (1024 * 1024));
 #if TS_USE_INTERIM_CACHE == 1
-          gvol[i]->history.init(1<<20, 2097143);
+          gvol[i]->history.init(1 << 20, 2097143);
 #endif
           vol_total_cache_bytes = gvol[i]->len - vol_dirlen(gvol[i]);
           total_cache_bytes += vol_total_cache_bytes;
@@ -1065,25 +1063,24 @@ CacheProcessor::cacheInitialized()
           vol_used_direntries = dir_entries_used(gvol[i]);
           CACHE_VOL_SUM_DYN_STAT(cache_direntries_used_stat, vol_used_direntries);
           used_direntries += vol_used_direntries;
-
         }
       }
       switch (cache_config_ram_cache_compress) {
-        default:
-          Fatal("unknown RAM cache compression type: %d", cache_config_ram_cache_compress);
-        case CACHE_COMPRESSION_NONE:
-        case CACHE_COMPRESSION_FASTLZ:
-          break;
-        case CACHE_COMPRESSION_LIBZ:
-#if ! TS_HAS_LIBZ
-          Fatal("libz not available for RAM cache compression");
+      default:
+        Fatal("unknown RAM cache compression type: %d", cache_config_ram_cache_compress);
+      case CACHE_COMPRESSION_NONE:
+      case CACHE_COMPRESSION_FASTLZ:
+        break;
+      case CACHE_COMPRESSION_LIBZ:
+#if !TS_HAS_LIBZ
+        Fatal("libz not available for RAM cache compression");
 #endif
-          break;
-        case CACHE_COMPRESSION_LIBLZMA:
-#if ! TS_HAS_LZMA
-          Fatal("lzma not available for RAM cache compression");
+        break;
+      case CACHE_COMPRESSION_LIBLZMA:
+#if !TS_HAS_LZMA
+        Fatal("lzma not available for RAM cache compression");
 #endif
-          break;
+        break;
       }
 
       GLOBAL_CACHE_SET_DYN_STAT(cache_ram_cache_bytes_total_stat, ram_cache_bytes);
@@ -1137,12 +1134,12 @@ CacheProcessor::db_check(bool afix)
 }
 
 int
-Vol::db_check(bool /* fix ATS_UNUSED */ )
+Vol::db_check(bool /* fix ATS_UNUSED */)
 {
   char tt[256];
   printf("    Data for [%s]\n", hash_text.get());
   printf("        Length:          %" PRIu64 "\n", (uint64_t)len);
-  printf("        Write Position:  %" PRIu64 "\n", (uint64_t) (header->write_pos - skip));
+  printf("        Write Position:  %" PRIu64 "\n", (uint64_t)(header->write_pos - skip));
   printf("        Phase:           %d\n", (int)!!header->phase);
   ink_ctime_r(&header->create_time, tt);
   tt[strlen(tt) - 1] = 0;
@@ -1158,13 +1155,14 @@ static void
 vol_init_data_internal(Vol *d)
 {
   d->buckets = ((d->len - (d->start - d->skip)) / cache_config_min_average_object_size) / DIR_DEPTH;
-  d->segments = (d->buckets + (((1<<16)-1)/DIR_DEPTH)) / ((1<<16)/DIR_DEPTH);
+  d->segments = (d->buckets + (((1 << 16) - 1) / DIR_DEPTH)) / ((1 << 16) / DIR_DEPTH);
   d->buckets = (d->buckets + d->segments - 1) / d->segments;
-  d->start = d->skip + 2 *vol_dirlen(d);
+  d->start = d->skip + 2 * vol_dirlen(d);
 }
 
 static void
-vol_init_data(Vol *d) {
+vol_init_data(Vol *d)
+{
   // iteratively calculate start + buckets
   vol_init_data_internal(d);
   vol_init_data_internal(d);
@@ -1266,14 +1264,14 @@ Vol::clear_dir()
 int
 Vol::init(char *s, off_t blocks, off_t dir_skip, bool clear)
 {
-  char* seed_str = disk->hash_base_string ? disk->hash_base_string : s;
+  char *seed_str = disk->hash_base_string ? disk->hash_base_string : s;
   const size_t hash_seed_size = strlen(seed_str);
   const size_t hash_text_size = hash_seed_size + 32;
 
   hash_text = static_cast<char *>(ats_malloc(hash_text_size));
   ink_strlcpy(hash_text, seed_str, hash_text_size);
-  snprintf(hash_text + hash_seed_size, (hash_text_size - hash_seed_size), " %" PRIu64 ":%" PRIu64 "",
-           (uint64_t)dir_skip, (uint64_t)blocks);
+  snprintf(hash_text + hash_seed_size, (hash_text_size - hash_seed_size), " %" PRIu64 ":%" PRIu64 "", (uint64_t)dir_skip,
+           (uint64_t)blocks);
   MD5Context().hash_immediate(hash_id, hash_text, strlen(hash_text));
 
   dir_skip = ROUND_TO_STORE_BLOCK((dir_skip < START_POS ? START_POS : dir_skip));
@@ -1289,24 +1287,24 @@ Vol::init(char *s, off_t blocks, off_t dir_skip, bool clear)
   data_blocks = (len - (start - skip)) / STORE_BLOCK_SIZE;
   hit_evacuate_window = (data_blocks * cache_config_hit_evacuate_percent) / 100;
 
-  evacuate_size = (int) (len / EVACUATION_BUCKET_SIZE) + 2;
-  int evac_len = (int) evacuate_size * sizeof(DLL<EvacuationBlock>);
+  evacuate_size = (int)(len / EVACUATION_BUCKET_SIZE) + 2;
+  int evac_len = (int)evacuate_size * sizeof(DLL<EvacuationBlock>);
   evacuate = (DLL<EvacuationBlock> *)ats_malloc(evac_len);
   memset(evacuate, 0, evac_len);
 
-  Debug("cache_init", "allocating %zu directory bytes for a %lld byte volume (%lf%%)",
-    vol_dirlen(this), (long long)this->len, (double)vol_dirlen(this) / (double)this->len * 100.0);
+  Debug("cache_init", "allocating %zu directory bytes for a %lld byte volume (%lf%%)", vol_dirlen(this), (long long)this->len,
+        (double)vol_dirlen(this) / (double)this->len * 100.0);
   raw_dir = (char *)ats_memalign(ats_pagesize(), vol_dirlen(this));
-  dir = (Dir *) (raw_dir + vol_headerlen(this));
-  header = (VolHeaderFooter *) raw_dir;
-  footer = (VolHeaderFooter *) (raw_dir + vol_dirlen(this) - ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter)));
+  dir = (Dir *)(raw_dir + vol_headerlen(this));
+  header = (VolHeaderFooter *)raw_dir;
+  footer = (VolHeaderFooter *)(raw_dir + vol_dirlen(this) - ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter)));
 
 #if TS_USE_INTERIM_CACHE == 1
   num_interim_vols = good_interim_disks;
   ink_assert(num_interim_vols >= 0 && num_interim_vols <= 8);
   for (int i = 0; i < num_interim_vols; i++) {
-    double r = (double) blocks / total_cache_size;
-    off_t vlen = off_t (r * g_interim_disks[i]->len * STORE_BLOCK_SIZE);
+    double r = (double)blocks / total_cache_size;
+    off_t vlen = off_t(r * g_interim_disks[i]->len * STORE_BLOCK_SIZE);
     vlen = (vlen / STORE_BLOCK_SIZE) * STORE_BLOCK_SIZE;
     off_t start = ink_atomic_increment(&g_interim_disks[i]->skip, vlen);
     interim_vols[i].init(start, vlen, g_interim_disks[i], this, &(this->header->interim_header[i]));
@@ -1357,8 +1355,8 @@ Vol::handle_dir_clear(int event, void *data)
   AIOCallback *op;
 
   if (event == AIO_EVENT_DONE) {
-    op = (AIOCallback *) data;
-    if ((size_t) op->aio_result != (size_t) op->aiocb.aio_nbytes) {
+    op = (AIOCallback *)data;
+    if ((size_t)op->aio_result != (size_t)op->aiocb.aio_nbytes) {
       Warning("unable to clear cache directory '%s'", hash_text.get());
       fd = -1;
     }
@@ -1383,18 +1381,17 @@ Vol::handle_dir_clear(int event, void *data)
 int
 Vol::handle_dir_read(int event, void *data)
 {
-  AIOCallback *op = (AIOCallback *) data;
+  AIOCallback *op = (AIOCallback *)data;
 
   if (event == AIO_EVENT_DONE) {
-    if ((size_t) op->aio_result != (size_t) op->aiocb.aio_nbytes) {
+    if ((size_t)op->aio_result != (size_t)op->aiocb.aio_nbytes) {
       clear_dir();
       return EVENT_DONE;
     }
   }
 
-  if (!(header->magic == VOL_MAGIC &&  footer->magic == VOL_MAGIC &&
-        CACHE_DB_MAJOR_VERSION_COMPATIBLE <= header->version.ink_major &&  header->version.ink_major <= CACHE_DB_MAJOR_VERSION
-    )) {
+  if (!(header->magic == VOL_MAGIC && footer->magic == VOL_MAGIC &&
+        CACHE_DB_MAJOR_VERSION_COMPATIBLE <= header->version.ink_major && header->version.ink_major <= CACHE_DB_MAJOR_VERSION)) {
     Warning("bad footer in cache directory for '%s', clearing", hash_text.get());
     Note("clearing cache directory '%s'", hash_text.get());
     clear_dir();
@@ -1413,7 +1410,7 @@ Vol::handle_dir_read(int event, void *data)
   } else {
 #endif
 
-  return this->recover_data();
+    return this->recover_data();
 
 #if TS_USE_INTERIM_CACHE == 1
   }
@@ -1466,7 +1463,7 @@ Vol::recover_data()
       */
 
 int
-Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */ )
+Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */)
 {
   uint32_t got_len = 0;
   uint32_t max_sync_serial = header->sync_serial;
@@ -1491,12 +1488,11 @@ Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */ )
     if ((off_t)(recover_pos + io.aiocb.aio_nbytes) > (off_t)(skip + len))
       io.aiocb.aio_nbytes = (skip + len) - recover_pos;
   } else if (event == AIO_EVENT_DONE) {
-    if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+    if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
       Warning("disk read error on recover '%s', clearing", hash_text.get());
       goto Lclear;
     }
     if (io.aiocb.aio_offset == header->last_write_pos) {
-
       /* check that we haven't wrapped around without syncing
          the directory. Start from last_write_serial (write pos the documents
          were written to just before syncing the directory) and make sure
@@ -1505,9 +1501,9 @@ Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */ )
       uint32_t to_check = header->write_pos - header->last_write_pos;
       ink_assert(to_check && to_check < (uint32_t)io.aiocb.aio_nbytes);
       uint32_t done = 0;
-      s = (char *) io.aiocb.aio_buf;
+      s = (char *)io.aiocb.aio_buf;
       while (done < to_check) {
-        Doc *doc = (Doc *) (s + done);
+        Doc *doc = (Doc *)(s + done);
         if (doc->magic != DOC_MAGIC || doc->write_serial > header->write_serial) {
           Warning("no valid directory found while recovering '%s', clearing", hash_text.get());
           goto Lclear;
@@ -1520,22 +1516,21 @@ Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */ )
 
       got_len = io.aiocb.aio_nbytes - done;
       recover_pos += io.aiocb.aio_nbytes;
-      s = (char *) io.aiocb.aio_buf + done;
+      s = (char *)io.aiocb.aio_buf + done;
       e = s + got_len;
     } else {
       got_len = io.aiocb.aio_nbytes;
       recover_pos += io.aiocb.aio_nbytes;
-      s = (char *) io.aiocb.aio_buf;
+      s = (char *)io.aiocb.aio_buf;
       e = s + got_len;
     }
   }
   // examine what we got
   if (got_len) {
-
     Doc *doc = NULL;
 
     if (recover_wrapped && start == io.aiocb.aio_offset) {
-      doc = (Doc *) s;
+      doc = (Doc *)s;
       if (doc->magic != DOC_MAGIC || doc->write_serial < last_write_serial) {
         recover_pos = skip + len - EVACUATION_SIZE;
         goto Ldone;
@@ -1543,10 +1538,9 @@ Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */ )
     }
 
     while (s < e) {
-      doc = (Doc *) s;
+      doc = (Doc *)s;
 
       if (doc->magic != DOC_MAGIC || doc->sync_serial != last_sync_serial) {
-
         if (doc->magic == DOC_MAGIC) {
           if (doc->sync_serial > header->sync_serial)
             max_sync_serial = doc->sync_serial;
@@ -1640,76 +1634,76 @@ Vol::handle_recover_from_data(int event, void * /* data ATS_UNUSED */ )
   ink_assert(ink_aio_read(&io));
   return EVENT_CONT;
 
-Ldone:{
-    /* if we come back to the starting position, then we don't have to recover anything */
-    if (recover_pos == header->write_pos && recover_wrapped) {
-      SET_HANDLER(&Vol::handle_recover_write_dir);
-      if (is_debug_tag_set("cache_init"))
-        Note("recovery wrapped around. nothing to clear\n");
-      return handle_recover_write_dir(EVENT_IMMEDIATE, 0);
-    }
+Ldone : {
+  /* if we come back to the starting position, then we don't have to recover anything */
+  if (recover_pos == header->write_pos && recover_wrapped) {
+    SET_HANDLER(&Vol::handle_recover_write_dir);
+    if (is_debug_tag_set("cache_init"))
+      Note("recovery wrapped around. nothing to clear\n");
+    return handle_recover_write_dir(EVENT_IMMEDIATE, 0);
+  }
 
-    recover_pos += EVACUATION_SIZE;   // safely cover the max write size
-    if (recover_pos < header->write_pos && (recover_pos + EVACUATION_SIZE >= header->write_pos)) {
-      Debug("cache_init", "Head Pos: %" PRIu64 ", Rec Pos: %" PRIu64 ", Wrapped:%d", header->write_pos, recover_pos, recover_wrapped);
-      Warning("no valid directory found while recovering '%s', clearing", hash_text.get());
-      goto Lclear;
-    }
+  recover_pos += EVACUATION_SIZE; // safely cover the max write size
+  if (recover_pos < header->write_pos && (recover_pos + EVACUATION_SIZE >= header->write_pos)) {
+    Debug("cache_init", "Head Pos: %" PRIu64 ", Rec Pos: %" PRIu64 ", Wrapped:%d", header->write_pos, recover_pos, recover_wrapped);
+    Warning("no valid directory found while recovering '%s', clearing", hash_text.get());
+    goto Lclear;
+  }
 
-    if (recover_pos > skip + len)
-      recover_pos -= skip + len;
-    // bump sync number so it is different from that in the Doc structs
-    uint32_t next_sync_serial = max_sync_serial + 1;
-    // make that the next sync does not overwrite our good copy!
-    if (!(header->sync_serial & 1) == !(next_sync_serial & 1))
-      next_sync_serial++;
-    // clear effected portion of the cache
-    off_t clear_start = offset_to_vol_offset(this, header->write_pos);
-    off_t clear_end = offset_to_vol_offset(this, recover_pos);
-    if (clear_start <= clear_end)
-      dir_clear_range(clear_start, clear_end, this);
-    else {
-      dir_clear_range(clear_end, DIR_OFFSET_MAX, this);
-      dir_clear_range(1, clear_start, this);
-    }
-    if (is_debug_tag_set("cache_init"))
-      Note("recovery clearing offsets [%" PRIu64 ", %" PRIu64 "] sync_serial %d next %d\n",
-           header->write_pos, recover_pos, header->sync_serial, next_sync_serial);
-    footer->sync_serial = header->sync_serial = next_sync_serial;
-
-    for (int i = 0; i < 3; i++) {
-      AIOCallback *aio = &(init_info->vol_aio[i]);
-      aio->aiocb.aio_fildes = fd;
-      aio->action = this;
-      aio->thread = AIO_CALLBACK_THREAD_ANY;
-      aio->then = (i < 2) ? &(init_info->vol_aio[i + 1]) : 0;
-    }
-    int footerlen = ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter));
-    size_t dirlen = vol_dirlen(this);
-    int B = header->sync_serial & 1;
-    off_t ss = skip + (B ? dirlen : 0);
-
-    init_info->vol_aio[0].aiocb.aio_buf = raw_dir;
-    init_info->vol_aio[0].aiocb.aio_nbytes = footerlen;
-    init_info->vol_aio[0].aiocb.aio_offset = ss;
-    init_info->vol_aio[1].aiocb.aio_buf = raw_dir + footerlen;
-    init_info->vol_aio[1].aiocb.aio_nbytes = dirlen - 2 * footerlen;
-    init_info->vol_aio[1].aiocb.aio_offset = ss + footerlen;
-    init_info->vol_aio[2].aiocb.aio_buf = raw_dir + dirlen - footerlen;
-    init_info->vol_aio[2].aiocb.aio_nbytes = footerlen;
-    init_info->vol_aio[2].aiocb.aio_offset = ss + dirlen - footerlen;
+  if (recover_pos > skip + len)
+    recover_pos -= skip + len;
+  // bump sync number so it is different from that in the Doc structs
+  uint32_t next_sync_serial = max_sync_serial + 1;
+  // make that the next sync does not overwrite our good copy!
+  if (!(header->sync_serial & 1) == !(next_sync_serial & 1))
+    next_sync_serial++;
+  // clear effected portion of the cache
+  off_t clear_start = offset_to_vol_offset(this, header->write_pos);
+  off_t clear_end = offset_to_vol_offset(this, recover_pos);
+  if (clear_start <= clear_end)
+    dir_clear_range(clear_start, clear_end, this);
+  else {
+    dir_clear_range(clear_end, DIR_OFFSET_MAX, this);
+    dir_clear_range(1, clear_start, this);
+  }
+  if (is_debug_tag_set("cache_init"))
+    Note("recovery clearing offsets [%" PRIu64 ", %" PRIu64 "] sync_serial %d next %d\n", header->write_pos, recover_pos,
+         header->sync_serial, next_sync_serial);
+  footer->sync_serial = header->sync_serial = next_sync_serial;
 
-    SET_HANDLER(&Vol::handle_recover_write_dir);
+  for (int i = 0; i < 3; i++) {
+    AIOCallback *aio = &(init_info->vol_aio[i]);
+    aio->aiocb.aio_fildes = fd;
+    aio->action = this;
+    aio->thread = AIO_CALLBACK_THREAD_ANY;
+    aio->then = (i < 2) ? &(init_info->vol_aio[i + 1]) : 0;
+  }
+  int footerlen = ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter));
+  size_t dirlen = vol_dirlen(this);
+  int B = header->sync_serial & 1;
+  off_t ss = skip + (B ? dirlen : 0);
+
+  init_info->vol_aio[0].aiocb.aio_buf = raw_dir;
+  init_info->vol_aio[0].aiocb.aio_nbytes = footerlen;
+  init_info->vol_aio[0].aiocb.aio_offset = ss;
+  init_info->vol_aio[1].aiocb.aio_buf = raw_dir + footerlen;
+  init_info->vol_aio[1].aiocb.aio_nbytes = dirlen - 2 * footerlen;
+  init_info->vol_aio[1].aiocb.aio_offset = ss + footerlen;
+  init_info->vol_aio[2].aiocb.aio_buf = raw_dir + dirlen - footerlen;
+  init_info->vol_aio[2].aiocb.aio_nbytes = footerlen;
+  init_info->vol_aio[2].aiocb.aio_offset = ss + dirlen - footerlen;
+
+  SET_HANDLER(&Vol::handle_recover_write_dir);
 #if AIO_MODE == AIO_MODE_NATIVE
-    ink_assert(ink_aio_writev(init_info->vol_aio));
+  ink_assert(ink_aio_writev(init_info->vol_aio));
 #else
-    ink_assert(ink_aio_write(init_info->vol_aio));
+  ink_assert(ink_aio_write(init_info->vol_aio));
 #endif
-    return EVENT_CONT;
-  }
+  return EVENT_CONT;
+}
 
 Lclear:
-  free((char *) io.aiocb.aio_buf);
+  free((char *)io.aiocb.aio_buf);
   delete init_info;
   init_info = 0;
   clear_dir();
@@ -1717,10 +1711,10 @@ Lclear:
 }
 
 int
-Vol::handle_recover_write_dir(int /* event ATS_UNUSED */ , void * /* data ATS_UNUSED */ )
+Vol::handle_recover_write_dir(int /* event ATS_UNUSED */, void * /* data ATS_UNUSED */)
 {
   if (io.aiocb.aio_buf)
-    free((char *) io.aiocb.aio_buf);
+    free((char *)io.aiocb.aio_buf);
   delete init_info;
   init_info = 0;
   set_io_not_in_progress();
@@ -1737,11 +1731,11 @@ Vol::handle_header_read(int event, void *data)
   VolHeaderFooter *hf[4];
   switch (event) {
   case AIO_EVENT_DONE:
-    op = (AIOCallback *) data;
+    op = (AIOCallback *)data;
     for (int i = 0; i < 4; i++) {
       ink_assert(op != 0);
-      hf[i] = (VolHeaderFooter *) (op->aiocb.aio_buf);
-      if ((size_t) op->aio_result != (size_t) op->aiocb.aio_nbytes) {
+      hf[i] = (VolHeaderFooter *)(op->aiocb.aio_buf);
+      if ((size_t)op->aio_result != (size_t)op->aiocb.aio_nbytes) {
         clear_dir();
         return EVENT_DONE;
       }
@@ -1765,7 +1759,6 @@ Vol::handle_header_read(int event, void *data)
     }
     // try B
     else if (hf[2]->sync_serial == hf[3]->sync_serial) {
-
       SET_HANDLER(&Vol::handle_dir_read);
       if (is_debug_tag_set("cache_init"))
         Note("using directory B for '%s'", hash_text.get());
@@ -1785,7 +1778,7 @@ Vol::handle_header_read(int event, void *data)
 }
 
 int
-Vol::dir_init_done(int /* event ATS_UNUSED */, void * /* data ATS_UNUSED */ )
+Vol::dir_init_done(int /* event ATS_UNUSED */, void * /* data ATS_UNUSED */)
 {
   if (!cache->cache_read_done) {
     eventProcessor.schedule_in(this, HRTIME_MSECONDS(5), ET_CALL);
@@ -1850,7 +1843,7 @@ InterimCacheVol::handle_recover_from_data(int event, void *data)
       io.aiocb.aio_nbytes = (skip + len) - recover_pos;
 
   } else if (event == AIO_EVENT_DONE) {
-    if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+    if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
       Warning("disk read error on recover '%s', clearing", hash_text.get());
       goto Lclear;
     }
@@ -1859,9 +1852,9 @@ InterimCacheVol::handle_recover_from_data(int event, void *data)
       uint32_t to_check = header->write_pos - header->last_write_pos;
       ink_assert(to_check && to_check < (uint32_t)io.aiocb.aio_nbytes);
       uint32_t done = 0;
-      s = (char *) io.aiocb.aio_buf;
+      s = (char *)io.aiocb.aio_buf;
       while (done < to_check) {
-        Doc *doc = (Doc *) (s + done);
+        Doc *doc = (Doc *)(s + done);
         if (doc->magic != DOC_MAGIC || doc->write_serial > header->write_serial) {
           Warning("no valid directory found while recovering '%s', clearing", hash_text.get());
           goto Lclear;
@@ -1874,23 +1867,22 @@ InterimCacheVol::handle_recover_from_data(int event, void *data)
 
       got_len = io.aiocb.aio_nbytes - done;
       recover_pos += io.aiocb.aio_nbytes;
-      s = (char *) io.aiocb.aio_buf + done;
+      s = (char *)io.aiocb.aio_buf + done;
       e = s + got_len;
     } else {
       got_len = io.aiocb.aio_nbytes;
       recover_pos += io.aiocb.aio_nbytes;
-      s = (char *) io.aiocb.aio_buf;
+      s = (char *)io.aiocb.aio_buf;
       e = s + got_len;
     }
   }
 
   // examine what we got
   if (got_len) {
-
     Doc *doc = NULL;
 
     if (recover_wrapped && start == io.aiocb.aio_offset) {
-      doc = (Doc *) s;
+      doc = (Doc *)s;
       if (doc->magic != DOC_MAGIC || doc->write_serial < last_write_serial) {
         recover_pos = skip + len - EVACUATION_SIZE;
         goto Ldone;
@@ -1898,10 +1890,9 @@ InterimCacheVol::handle_recover_from_data(int event, void *data)
     }
 
     while (s < e) {
-      doc = (Doc *) s;
+      doc = (Doc *)s;
 
       if (doc->magic != DOC_MAGIC || doc->sync_serial != last_sync_serial) {
-
         if (doc->magic == DOC_MAGIC) {
           if (doc->sync_serial > header->sync_serial)
             max_sync_serial = doc->sync_serial;
@@ -1939,7 +1930,6 @@ InterimCacheVol::handle_recover_from_data(int event, void *data)
     }
 
     if (s >= e) {
-
       if (s > e)
         s -= round_to_approx_size(doc->len);
 
@@ -1961,56 +1951,55 @@ InterimCacheVol::handle_recover_from_data(int event, void *data)
   ink_assert(ink_aio_read(&io));
   return EVENT_CONT;
 
-Ldone: {
-
-    if (recover_pos == header->write_pos && recover_wrapped) {
-      goto Lfinish;
-    }
+Ldone : {
+  if (recover_pos == header->write_pos && recover_wrapped) {
+    goto Lfinish;
+  }
 
-    recover_pos += EVACUATION_SIZE;
-    if (recover_pos < header->write_pos && (recover_pos + EVACUATION_SIZE >= header->write_pos)) {
-      Debug("cache_init", "Head Pos: %" PRIu64 ", Rec Pos: %" PRIu64 ", Wrapped:%d", header->write_pos, recover_pos, recover_wrapped);
-      Warning("no valid directory found while recovering '%s', clearing", hash_text.get());
-      goto Lclear;
-    }
+  recover_pos += EVACUATION_SIZE;
+  if (recover_pos < header->write_pos && (recover_pos + EVACUATION_SIZE >= header->write_pos)) {
+    Debug("cache_init", "Head Pos: %" PRIu64 ", Rec Pos: %" PRIu64 ", Wrapped:%d", header->write_pos, recover_pos, recover_wrapped);
+    Warning("no valid directory found while recovering '%s', clearing", hash_text.get());
+    goto Lclear;
+  }
 
-    if (recover_pos > skip + len)
-      recover_pos -= skip + len;
+  if (recover_pos > skip + len)
+    recover_pos -= skip + len;
 
-    uint32_t next_sync_serial = max_sync_serial + 1;
-    if (!(header->sync_serial & 1) == !(next_sync_serial & 1))
-      next_sync_serial++;
+  uint32_t next_sync_serial = max_sync_serial + 1;
+  if (!(header->sync_serial & 1) == !(next_sync_serial & 1))
+    next_sync_serial++;
 
-    off_t clear_start = offset_to_vol_offset(this, header->write_pos);
-    off_t clear_end = offset_to_vol_offset(this, recover_pos);
+  off_t clear_start = offset_to_vol_offset(this, header->write_pos);
+  off_t clear_end = offset_to_vol_offset(this, recover_pos);
 
-    if (clear_start <= clear_end)
-      dir_clean_range_interimvol(clear_start, clear_end, this);
-    else {
-      dir_clean_range_interimvol(clear_end, DIR_OFFSET_MAX, this);
-      dir_clean_range_interimvol(1, clear_start, this);
-    }
+  if (clear_start <= clear_end)
+    dir_clean_range_interimvol(clear_start, clear_end, this);
+  else {
+    dir_clean_range_interimvol(clear_end, DIR_OFFSET_MAX, this);
+    dir_clean_range_interimvol(1, clear_start, this);
+  }
 
-    header->sync_serial = next_sync_serial;
+  header->sync_serial = next_sync_serial;
 
-    goto Lfinish;
-  }
+  goto Lfinish;
+}
 
 Lclear:
 
   interimvol_clear_init(this);
   offset = this - vol->interim_vols;
-  clear_interimvol_dir(vol, offset);          // remove this interimvol dir
+  clear_interimvol_dir(vol, offset); // remove this interimvol dir
 
 Lfinish:
 
-  free((char*)io.aiocb.aio_buf);
+  free((char *)io.aiocb.aio_buf);
   io.aiocb.aio_buf = NULL;
 
   set_io_not_in_progress();
 
   ndone = ink_atomic_increment(&vol->interim_done, 1);
-  if (ndone == vol->num_interim_vols - 1) {         // all interim finished
+  if (ndone == vol->num_interim_vols - 1) { // all interim finished
     return vol->recover_data();
   }
 
@@ -2021,17 +2010,20 @@ Lfinish:
 // explicit pair for random table in build_vol_hash_table
 struct rtable_pair {
   unsigned int rval; ///< relative value, used to sort.
-  unsigned int idx; ///< volume mapping table index.
+  unsigned int idx;  ///< volume mapping table index.
 };
 
 // comparison operator for random table in build_vol_hash_table
 // sorts based on the randomly assigned rval
 static int
-cmprtable(const void *aa, const void *bb) {
-  rtable_pair *a = (rtable_pair*)aa;
-  rtable_pair *b = (rtable_pair*)bb;
-  if (a->rval < b->rval) return -1;
-  if (a->rval > b->rval) return 1;
+cmprtable(const void *aa, const void *bb)
+{
+  rtable_pair *a = (rtable_pair *)aa;
+  rtable_pair *b = (rtable_pair *)bb;
+  if (a->rval < b->rval)
+    return -1;
+  if (a->rval > b->rval)
+    return 1;
   return 0;
 }
 
@@ -2072,12 +2064,12 @@ build_vol_hash_table(CacheHostRecord *cp)
     return;
   }
 
-  unsigned int *forvol = (unsigned int *) ats_malloc(sizeof(unsigned int) * num_vols);
-  unsigned int *gotvol = (unsigned int *) ats_malloc(sizeof(unsigned int) * num_vols);
-  unsigned int *rnd = (unsigned int *) ats_malloc(sizeof(unsigned int) * num_vols);
+  unsigned int *forvol = (unsigned int *)ats_malloc(sizeof(unsigned int) * num_vols);
+  unsigned int *gotvol = (unsigned int *)ats_malloc(sizeof(unsigned int) * num_vols);
+  unsigned int *rnd = (unsigned int *)ats_malloc(sizeof(unsigned int) * num_vols);
   unsigned short *ttable = (unsigned short *)ats_malloc(sizeof(unsigned short) * VOL_HASH_TABLE_SIZE);
   unsigned short *old_table;
-  unsigned int *rtable_entries = (unsigned int *) ats_malloc(sizeof(unsigned int) * num_vols);
+  unsigned int *rtable_entries = (unsigned int *)ats_malloc(sizeof(unsigned int) * num_vols);
   unsigned int rtable_size = 0;
 
   // estimate allocation
@@ -2095,7 +2087,7 @@ build_vol_hash_table(CacheHostRecord *cp)
   // seed random number generator
   for (int i = 0; i < num_vols; i++) {
     uint64_t x = p[i]->hash_id.fold();
-    rnd[i] = (unsigned int) x;
+    rnd[i] = (unsigned int)x;
   }
   // initialize table to "empty"
   for (int i = 0; i < VOL_HASH_TABLE_SIZE; i++)
@@ -2113,12 +2105,13 @@ build_vol_hash_table(CacheHostRecord *cp)
   // sort (rand #, vol $ pairs)
   qsort(rtable, rtable_size, sizeof(rtable_pair), cmprtable);
   unsigned int width = (1LL << 32) / VOL_HASH_TABLE_SIZE;
-  unsigned int pos;  // target position to allocate
+  unsigned int pos; // target position to allocate
   // select vol with closest random number for each bucket
-  int i = 0;  // index moving through the random numbers
+  int i = 0; // index moving through the random numbers
   for (int j = 0; j < VOL_HASH_TABLE_SIZE; j++) {
-    pos = width / 2 + j * width;  // position to select closest to
-    while (pos > rtable[i].rval && i < (int)rtable_size - 1) i++;
+    pos = width / 2 + j * width; // position to select closest to
+    while (pos > rtable[i].rval && i < (int)rtable_size - 1)
+      i++;
     ttable[j] = mapping[rtable[i].idx];
     gotvol[rtable[i].idx]++;
   }
@@ -2138,7 +2131,8 @@ build_vol_hash_table(CacheHostRecord *cp)
 }
 
 void
-Cache::vol_initialized(bool result) {
+Cache::vol_initialized(bool result)
+{
   if (result)
     ink_atomic_increment(&total_good_nvol, 1);
   if (total_nvol == ink_atomic_increment(&total_initialized_vol, 1) + 1)
@@ -2148,15 +2142,17 @@ Cache::vol_initialized(bool result) {
 /** Set the state of a disk programmatically.
 */
 bool
-CacheProcessor::mark_storage_offline( CacheDisk* d ///< Target disk
-  ) {
+CacheProcessor::mark_storage_offline(CacheDisk *d ///< Target disk
+                                     )
+{
   bool zret; // indicates whether there's any online storage left.
   int p;
   uint64_t total_bytes_delete = 0;
   uint64_t total_dir_delete = 0;
   uint64_t used_dir_delete = 0;
 
-  if (!DISK_BAD(d)) SET_DISK_BAD(d);
+  if (!DISK_BAD(d))
+    SET_DISK_BAD(d);
 
   for (p = 0; p < gnvol; p++) {
     if (d->fd == gvol[p]->fd) {
@@ -2203,21 +2199,24 @@ CacheProcessor::mark_storage_offline( CacheDisk* d ///< Target disk
 }
 
 bool
-CacheProcessor::has_online_storage() const {
-  CacheDisk** dptr = gdisks;
-  for (int disk_no = 0 ; disk_no < gndisks ; ++disk_no, ++dptr) {
-    if (!DISK_BAD(*dptr)) return true;
+CacheProcessor::has_online_storage() const
+{
+  CacheDisk **dptr = gdisks;
+  for (int disk_no = 0; disk_no < gndisks; ++disk_no, ++dptr) {
+    if (!DISK_BAD(*dptr))
+      return true;
   }
   return false;
 }
 
 int
-AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data) {
+AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data)
+{
   /* search for the matching file descriptor */
   if (!CacheProcessor::cache_ready)
     return EVENT_DONE;
   int disk_no = 0;
-  AIOCallback *cb = (AIOCallback *) data;
+  AIOCallback *cb = (AIOCallback *)data;
 #if TS_USE_INTERIM_CACHE == 1
   for (; disk_no < gn_interim_disks; disk_no++) {
     CacheDisk *d = g_interim_disks[disk_no];
@@ -2231,8 +2230,7 @@ AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data
         Warning("%s", message);
         RecSignalManager(REC_SIGNAL_CACHE_WARNING, message);
       } else if (!DISK_BAD_SIGNALLED(d)) {
-        snprintf(message, sizeof(message),
-                 "too many errors [%d] accessing disk %s: declaring disk bad", d->num_errors, d->path);
+        snprintf(message, sizeof(message), "too many errors [%d] accessing disk %s: declaring disk bad", d->num_errors, d->path);
         Warning("%s", message);
         RecSignalManager(REC_SIGNAL_CACHE_ERROR, message);
         good_interim_disks--;
@@ -2253,7 +2251,8 @@ AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data
         Warning("%s", message);
         RecSignalManager(REC_SIGNAL_CACHE_WARNING, message);
       } else if (!DISK_BAD_SIGNALLED(d)) {
-        snprintf(message, sizeof(message), "too many errors accessing disk %s [%d/%d]: declaring disk bad", d->path, d->num_errors, cache_config_max_disk_errors);
+        snprintf(message, sizeof(message), "too many errors accessing disk %s [%d/%d]: declaring disk bad", d->path, d->num_errors,
+                 cache_config_max_disk_errors);
         Warning("%s", message);
         RecSignalManager(REC_SIGNAL_CACHE_ERROR, message);
         cacheProcessor.mark_storage_offline(d); // take it out of service
@@ -2267,9 +2266,10 @@ AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data
 }
 
 int
-Cache::open_done() {
+Cache::open_done()
+{
   Action *register_ShowCache(Continuation * c, HTTPHdr * h);
-  Action *register_ShowCacheInternal(Continuation *c, HTTPHdr *h);
+  Action *register_ShowCacheInternal(Continuation * c, HTTPHdr * h);
   statPagesManager.register_http("cache", register_ShowCache);
   statPagesManager.register_http("cache-internal", register_ShowCacheInternal);
   if (total_good_nvol == 0) {
@@ -2291,7 +2291,8 @@ Cache::open_done() {
 }
 
 int
-Cache::open(bool clear, bool /* fix ATS_UNUSED */) {
+Cache::open(bool clear, bool /* fix ATS_UNUSED */)
+{
   int i;
   off_t blocks = 0;
   cache_read_done = 0;
@@ -2300,8 +2301,7 @@ Cache::open(bool clear, bool /* fix ATS_UNUSED */) {
   total_good_nvol = 0;
 
   REC_EstablishStaticConfigInt32(cache_config_min_average_object_size, "proxy.config.cache.min_average_object_size");
-  Debug("cache_init", "Cache::open - proxy.config.cache.min_average_object_size = %d",
-        (int)cache_config_min_average_object_size);
+  Debug("cache_init", "Cache::open - proxy.config.cache.min_average_object_size = %d", (int)cache_config_min_average_object_size);
 
   CacheVol *cp = cp_list.head;
   for (; cp; cp = cp->link.next) {
@@ -2341,12 +2341,14 @@ Cache::open(bool clear, bool /* fix ATS_UNUSED */) {
 }
 
 int
-Cache::close() {
+Cache::close()
+{
   return -1;
 }
 
 int
-CacheVC::dead(int /* event ATS_UNUSED */, Event * /*e ATS_UNUSED */) {
+CacheVC::dead(int /* event ATS_UNUSED */, Event * /*e ATS_UNUSED */)
+{
   ink_assert(0);
   return EVENT_DONE;
 }
@@ -2360,7 +2362,9 @@ CacheVC::is_pread_capable()
 #define STORE_COLLISION 1
 
 #ifdef HTTP_CACHE
-static void unmarshal_helper(Doc *doc, Ptr<IOBufferData> &buf, int &okay) {
+static void
+unmarshal_helper(Doc *doc, Ptr<IOBufferData> &buf, int &okay)
+{
   char *tmp = doc->hdr();
   int len = doc->hlen;
   while (len > 0) {
@@ -2388,23 +2392,26 @@ static void unmarshal_helper(Doc *doc, Ptr<IOBufferData> &buf, int &okay) {
     this fails and we have a cache miss. The assumption that this is sufficiently rare that
     code simplicity takes precedence should be checked at some point.
  */
-static bool upgrade_doc_version(Ptr<IOBufferData>& buf) {
+static bool
+upgrade_doc_version(Ptr<IOBufferData> &buf)
+{
   // Type definition is close enough to use for initial checking.
-  cache_bc::Doc_v23* doc = reinterpret_cast<cache_bc::Doc_v23*>(buf->data());
+  cache_bc::Doc_v23 *doc = reinterpret_cast<cache_bc::Doc_v23 *>(buf->data());
   bool zret = true;
 
   if (DOC_MAGIC == doc->magic) {
     if (0 == doc->hlen) {
       Debug("cache_bc", "Doc %p without header, no upgrade needed.", doc);
     } else if (CACHE_FRAG_TYPE_HTTP_V23 == doc->doc_type) {
-      cache_bc::HTTPCacheAlt_v21* alt = reinterpret_cast<cache_bc::HTTPCacheAlt_v21*>(doc->hdr());
+      cache_bc::HTTPCacheAlt_v21 *alt = reinterpret_cast<cache_bc::HTTPCacheAlt_v21 *>(doc->hdr());
       if (alt && alt->is_unmarshalled_format()) {
         Ptr<IOBufferData> d_buf(ioDataAllocator.alloc());
-        Doc* d_doc;
-        char* src;
-        char* dst;
-        char* hdr_limit = doc->data();
-        HTTPInfo::FragOffset* frags = reinterpret_cast<HTTPInfo::FragOffset*>(static_cast<char*>(buf->data()) + cache_bc::sizeofDoc_v23);
+        Doc *d_doc;
+        char *src;
+        char *dst;
+        char *hdr_limit = doc->data();
+        HTTPInfo::FragOffset *frags =
+          reinterpret_cast<HTTPInfo::FragOffset *>(static_cast<char *>(buf->data()) + cache_bc::sizeofDoc_v23);
         int frag_count = doc->_flen / sizeof(HTTPInfo::FragOffset);
         size_t n = 0;
         size_t content_size = doc->data_len();
@@ -2413,13 +2420,15 @@ static bool upgrade_doc_version(Ptr<IOBufferData>& buf) {
 
         // Use the same buffer size, fail if no fit.
         d_buf->alloc(buf->_size_index, buf->_mem_type); // Duplicate.
-        d_doc = reinterpret_cast<Doc*>(d_buf->data());
+        d_doc = reinterpret_cast<Doc *>(d_buf->data());
         n = d_buf->block_size();
 
         src = buf->data();
         dst = d_buf->data();
         memcpy(dst, src, sizeofDoc);
-        src += sizeofDoc + doc->_flen; dst += sizeofDoc; n -= sizeofDoc;
+        src += sizeofDoc + doc->_flen;
+        dst += sizeofDoc;
+        n -= sizeofDoc;
 
         // We copy the fragment table iff there is a fragment table and there is only one alternate.
         if (frag_count > 0 && cache_bc::HTTPInfo_v21::marshalled_length(src) > doc->hlen)
@@ -2432,14 +2441,14 @@ static bool upgrade_doc_version(Ptr<IOBufferData>& buf) {
           memcpy(dst, src, content_size); // content
           // Must update new Doc::len and Doc::hlen
           // dst points at the first byte of the content, or one past the last byte of the alt header.
-          d_doc->len = (dst - reinterpret_cast<char*>(d_doc)) + content_size;
-          d_doc->hlen = (dst - reinterpret_cast<char*>(d_doc)) - sizeofDoc;
+          d_doc->len = (dst - reinterpret_cast<char *>(d_doc)) + content_size;
+          d_doc->hlen = (dst - reinterpret_cast<char *>(d_doc)) - sizeofDoc;
           buf = d_buf; // replace original buffer with new buffer.
         } else {
           zret = false;
         }
       }
-      Doc* n_doc = reinterpret_cast<Doc*>(buf->data()); // access as current version.
+      Doc *n_doc = reinterpret_cast<Doc *>(buf->data()); // access as current version.
       // For now the base header size is the same. If that changes we'll need to handle the v22/23 case here
       // as with the v21 and shift the content down to accomodate the bigger header.
       ink_assert(sizeof(*n_doc) == sizeof(*doc));
@@ -2466,9 +2475,8 @@ CacheVC::handleReadDone(int event, Event *e)
   Doc *doc = NULL;
   if (event == AIO_EVENT_DONE)
     set_io_not_in_progress();
-  else
-    if (is_io_in_progress())
-      return EVENT_CONT;
+  else if (is_io_in_progress())
+    return EVENT_CONT;
   {
     MUTEX_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
     if (!lock.is_locked())
@@ -2483,7 +2491,7 @@ CacheVC::handleReadDone(int event, Event *e)
       goto Ldone;
     }
 
-    doc = reinterpret_cast<Doc*>(buf->data());
+    doc = reinterpret_cast<Doc *>(buf->data());
     ink_assert(vol->mutex->nthread_holding < 1000);
     ink_assert(doc->magic == DOC_MAGIC);
 
@@ -2501,10 +2509,10 @@ CacheVC::handleReadDone(int event, Event *e)
 
     if (doc->doc_type == CACHE_FRAG_TYPE_HTTP_V23) {
       if (upgrade_doc_version(buf)) {
-        doc = reinterpret_cast<Doc*>(buf->data()); // buf may be a new copy
+        doc = reinterpret_cast<Doc *>(buf->data()); // buf may be a new copy
       } else {
-        Debug("cache_bc", "Upgrade of fragment failed - disk %s - doc id = %" PRIx64 ":%" PRIx64 "\n"
-              , vol->hash_text.get(), read_key->slice64(0), read_key->slice64(1));
+        Debug("cache_bc", "Upgrade of fragment failed - disk %s - doc id = %" PRIx64 ":%" PRIx64 "\n", vol->hash_text.get(),
+              read_key->slice64(0), read_key->slice64(1));
         doc->magic = DOC_CORRUPT;
         // Should really trash the directory entry for this, as it's never going to work in the future.
         // Or does that happen later anyway?
@@ -2526,77 +2534,75 @@ CacheVC::handleReadDone(int event, Event *e)
 
     if (is_debug_tag_set("cache_read")) {
       char xt[33];
-      Debug("cache_read",
-            "Read complete on fragment %s. Length: data payload=%d this fragment=%d total doc=%" PRId64" prefix=%d",
+      Debug("cache_read", "Read complete on fragment %s. Length: data payload=%d this fragment=%d total doc=%" PRId64 " prefix=%d",
             doc->key.toHexStr(xt), doc->data_len(), doc->len, doc->total_len, doc->prefix_len());
     }
 
     // put into ram cache?
-    if (io.ok() && ((doc->first_key == *read_key) || (doc->key == *read_key) || STORE_COLLISION) &&
-        doc->magic == DOC_MAGIC) {
+    if (io.ok() && ((doc->first_key == *read_key) || (doc->key == *read_key) || STORE_COLLISION) && doc->magic == DOC_MAGIC) {
       int okay = 1;
       if (!f.doc_from_ram_cache)
         f.not_from_ram_cache = 1;
       if (cache_config_enable_checksum && doc->checksum != DOC_NO_CHECKSUM) {
         // verify that the checksum matches
         uint32_t checksum = 0;
-        for (char *b = doc->hdr(); b < (char *) doc + doc->len; b++)
+        for (char *b = doc->hdr(); b < (char *)doc + doc->len; b++)
           checksum += *b;
         ink_assert(checksum == doc->checksum);
         if (checksum != doc->checksum) {
           Note("cache: checksum error for [%" PRIu64 " %" PRIu64 "] len %d, hlen %d, disk %s, offset %" PRIu64 " size %zu",
-               doc->first_key.b[0], doc->first_key.b[1],
-               doc->len, doc->hlen, vol->path, (uint64_t)io.aiocb.aio_offset, (size_t)io.aiocb.aio_nbytes);
+               doc->first_key.b[0], doc->first_key.b[1], doc->len, doc->hlen, vol->path, (uint64_t)io.aiocb.aio_offset,
+               (size_t)io.aiocb.aio_nbytes);
           doc->magic = DOC_CORRUPT;
           okay = 0;
         }
       }
 #if TS_USE_INTERIM_CACHE == 1
-    ink_assert(vol->num_interim_vols >= good_interim_disks);
-    if (mts && !f.doc_from_ram_cache) {
-      int indx;
-      do {
-        indx = vol->interim_index++ % vol->num_interim_vols;
-      } while (good_interim_disks > 0 && DISK_BAD(vol->interim_vols[indx].disk));
-
-      if (good_interim_disks) {
-        if (f.write_into_interim) {
-          mts->interim_vol = interim_vol = &vol->interim_vols[indx];
-          mts->agg_len = interim_vol->round_to_approx_size(doc->len);
-          if (vol->sector_size != interim_vol->sector_size) {
-            dir_set_approx_size(&mts->dir, mts->agg_len);
+      ink_assert(vol->num_interim_vols >= good_interim_disks);
+      if (mts && !f.doc_from_ram_cache) {
+        int indx;
+        do {
+          indx = vol->interim_index++ % vol->num_interim_vols;
+        } while (good_interim_disks > 0 && DISK_BAD(vol->interim_vols[indx].disk));
+
+        if (good_interim_disks) {
+          if (f.write_into_interim) {
+            mts->interim_vol = interim_vol = &vol->interim_vols[indx];
+            mts->agg_len = interim_vol->round_to_approx_size(doc->len);
+            if (vol->sector_size != interim_vol->sector_size) {
+              dir_set_approx_size(&mts->dir, mts->agg_len);
+            }
+          }
+          if (f.transistor) {
+            mts->interim_vol = interim_vol;
+            mts->agg_len = interim_vol->round_to_approx_size(doc->len);
+            ink_assert(mts->agg_len == dir_approx_size(&mts->dir));
           }
-        }
-        if (f.transistor) {
-          mts->interim_vol = interim_vol;
-          mts->agg_len = interim_vol->round_to_approx_size(doc->len);
-          ink_assert(mts->agg_len == dir_approx_size(&mts->dir));
-        }
 
-        if (!interim_vol->is_io_in_progress()) {
-          mts->buf = buf;
-          mts->copy = false;
-          interim_vol->agg.enqueue(mts);
-          interim_vol->aggWrite(event, e);
+          if (!interim_vol->is_io_in_progress()) {
+            mts->buf = buf;
+            mts->copy = false;
+            interim_vol->agg.enqueue(mts);
+            interim_vol->aggWrite(event, e);
+          } else {
+            mts->buf = new_IOBufferData(iobuffer_size_to_index(mts->agg_len, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
+            mts->copy = true;
+            memcpy(mts->buf->data(), buf->data(), doc->len);
+            interim_vol->agg.enqueue(mts);
+          }
         } else {
-          mts->buf = new_IOBufferData(iobuffer_size_to_index(mts->agg_len, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
-          mts->copy = true;
-          memcpy(mts->buf->data(), buf->data(), doc->len);
-          interim_vol->agg.enqueue(mts);
+          vol->set_migrate_failed(mts);
+          migrateToInterimCacheAllocator.free(mts);
         }
-      } else {
-        vol->set_migrate_failed(mts);
-        migrateToInterimCacheAllocator.free(mts);
+        mts = NULL;
       }
-      mts = NULL;
-    }
 #else
-    (void)e; // Avoid compiler warnings
+      (void)e; // Avoid compiler warnings
 #endif
       bool http_copy_hdr = false;
 #ifdef HTTP_CACHE
-      http_copy_hdr = cache_config_ram_cache_compress && !f.doc_from_ram_cache &&
-        doc->doc_type == CACHE_FRAG_TYPE_HTTP && doc->hlen;
+      http_copy_hdr =
+        cache_config_ram_cache_compress && !f.doc_from_ram_cache && doc->doc_type == CACHE_FRAG_TYPE_HTTP && doc->hlen;
       // If http doc we need to unmarshal the headers before putting in the ram cache
       // unless it could be compressed
       if (!http_copy_hdr && doc->doc_type == CACHE_FRAG_TYPE_HTTP && doc->hlen && okay)
@@ -2611,16 +2617,15 @@ CacheVC::handleReadDone(int event, Event *e)
         //                doc->total_len
         // After that, the decision is based of doc_len (doc_len != 0)
         // (cache_config_ram_cache_cutoff == 0) : no cutoffs
-        cutoff_check = ((!doc_len && (int64_t)doc->total_len < cache_config_ram_cache_cutoff)
-                        || (doc_len && (int64_t)doc_len < cache_config_ram_cache_cutoff)
-                        || !cache_config_ram_cache_cutoff);
+        cutoff_check = ((!doc_len && (int64_t)doc->total_len < cache_config_ram_cache_cutoff) ||
+                        (doc_len && (int64_t)doc_len < cache_config_ram_cache_cutoff) || !cache_config_ram_cache_cutoff);
         if (cutoff_check && !f.doc_from_ram_cache) {
 #if TS_USE_INTERIM_CACHE == 1
           if (!f.ram_fixup) {
             uint64_t o = dir_get_offset(&dir);
             vol->ram_cache->put(read_key, buf, doc->len, http_copy_hdr, (uint32_t)(o >> 32), (uint32_t)o);
           } else {
-            vol->ram_cache->put(read_key, buf, doc->len, http_copy_hdr, (uint32_t)(dir_off>>32), (uint32_t)dir_off);
+            vol->ram_cache->put(read_key, buf, doc->len, http_copy_hdr, (uint32_t)(dir_off >> 32), (uint32_t)dir_off);
           }
 #else
           uint64_t o = dir_offset(&dir);
@@ -2642,15 +2647,15 @@ CacheVC::handleReadDone(int event, Event *e)
 #endif
           vol->first_fragment_data = buf;
         }
-      }                           // end VIO::READ check
+      } // end VIO::READ check
 #ifdef HTTP_CACHE
       // If it could be compressed, unmarshal after
       if (http_copy_hdr && doc->doc_type == CACHE_FRAG_TYPE_HTTP && doc->hlen && okay)
         unmarshal_helper(doc, buf, okay);
 #endif
-    }                             // end io.ok() check
+    } // end io.ok() check
 #if TS_USE_INTERIM_CACHE == 1
-Ldone:
+  Ldone:
     if (mts) {
       vol->set_migrate_failed(mts);
       migrateToInterimCacheAllocator.free(mts);
@@ -2687,7 +2692,7 @@ CacheVC::handleRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     goto LramHit;
   }
 
-  // check if it was read in the last open_read call
+// check if it was read in the last open_read call
 #if TS_USE_INTERIM_CACHE == 1
   if (*read_key == vol->first_fragment_key && dir_get_offset(&dir) == vol->first_fragment_offset) {
 #else
@@ -2702,7 +2707,7 @@ LinterimRead:
     if (dir_agg_buf_valid(interim_vol, &dir)) {
       int interim_agg_offset = vol_offset(interim_vol, &dir) - interim_vol->header->write_pos;
       buf = new_IOBufferData(iobuffer_size_to_index(io.aiocb.aio_nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
-      ink_assert((interim_agg_offset + io.aiocb.aio_nbytes) <= (unsigned) interim_vol->agg_buf_pos);
+      ink_assert((interim_agg_offset + io.aiocb.aio_nbytes) <= (unsigned)interim_vol->agg_buf_pos);
       char *doc = buf->data();
       char *agg = interim_vol->agg_buffer + interim_agg_offset;
       memcpy(doc, agg, io.aiocb.aio_nbytes);
@@ -2730,7 +2735,7 @@ LinterimRead:
   if (dir_agg_buf_valid(vol, &dir)) {
     int agg_offset = vol_offset(vol, &dir) - vol->header->write_pos;
     buf = new_IOBufferData(iobuffer_size_to_index(io.aiocb.aio_nbytes, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
-    ink_assert((agg_offset + io.aiocb.aio_nbytes) <= (unsigned) vol->agg_buf_pos);
+    ink_assert((agg_offset + io.aiocb.aio_nbytes) <= (unsigned)vol->agg_buf_pos);
     char *doc = buf->data();
     char *agg = vol->agg_buffer + agg_offset;
     memcpy(doc, agg, io.aiocb.aio_nbytes);
@@ -2752,15 +2757,15 @@ LinterimRead:
   CACHE_DEBUG_INCREMENT_DYN_STAT(cache_pread_count_stat);
   return EVENT_CONT;
 
-LramHit: {
-    f.doc_from_ram_cache = true;
-    io.aio_result = io.aiocb.aio_nbytes;
-    Doc *doc = (Doc*)buf->data();
-    if (cache_config_ram_cache_compress && doc->doc_type == CACHE_FRAG_TYPE_HTTP && doc->hlen) {
-      SET_HANDLER(&CacheVC::handleReadDone);
-      return EVENT_RETURN;
-    }
+LramHit : {
+  f.doc_from_ram_cache = true;
+  io.aio_result = io.aiocb.aio_nbytes;
+  Doc *doc = (Doc *)buf->data();
+  if (cache_config_ram_cache_compress && doc->doc_type == CACHE_FRAG_TYPE_HTTP && doc->hlen) {
+    SET_HANDLER(&CacheVC::handleReadDone);
+    return EVENT_RETURN;
   }
+}
 LmemHit:
   f.doc_from_ram_cache = true;
   io.aio_result = io.aiocb.aio_nbytes;
@@ -2776,7 +2781,7 @@ LmemHit:
 }
 
 Action *
-Cache::lookup(Continuation *cont, CacheKey *key, CacheFragType type, char const* hostname, int host_len)
+Cache::lookup(Continuation *cont, CacheKey *key, CacheFragType type, char const *hostname, int host_len)
 {
   if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_LOOKUP_FAILED, 0);
@@ -2809,7 +2814,7 @@ Cache::lookup(Continuation *cont, CacheURL *url, CacheFragType type)
 
   url->hash_get(&id);
   int len = 0;
-  char const* hostname = url->host_get(&len);
+  char const *hostname = url->host_get(&len);
   return lookup(cont, &id, type, hostname, len);
 }
 
@@ -2849,11 +2854,11 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       goto Lcollision;
     }
     // check read completed correct FIXME: remove bad vols
-    if ((size_t) io.aio_result != (size_t) io.aiocb.aio_nbytes)
+    if ((size_t)io.aio_result != (size_t)io.aiocb.aio_nbytes)
       goto Ldone;
     {
       // verify that this is our document
-      Doc *doc = (Doc *) buf->data();
+      Doc *doc = (Doc *)buf->data();
       /* should be first_key not key..right?? */
       if (doc->first_key == key) {
         ink_assert(doc->magic == DOC_MAGIC);
@@ -2887,7 +2892,7 @@ CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       vol->close_write(this);
   }
   ink_assert(!vol || this_ethread() != vol->mutex->thread_holding);
-  _action.continuation->handleEvent(CACHE_EVENT_REMOVE_FAILED, (void *) -ECACHE_NO_DOC);
+  _action.continuation->handleEvent(CACHE_EVENT_REMOVE_FAILED, (void *)-ECACHE_NO_DOC);
   goto Lfree;
 Lremoved:
   _action.continuation->handleEvent(CACHE_EVENT_REMOVE, 0);
@@ -2896,8 +2901,8 @@ Lfree:
 }
 
 Action *
-Cache::remove(Continuation *cont, CacheKey *key, CacheFragType type, bool /* user_agents ATS_UNUSED */,
-              bool /* link ATS_UNUSED */, char *hostname, int host_len)
+Cache::remove(Continuation *cont, CacheKey *key, CacheFragType type, bool /* user_agents ATS_UNUSED */, bool /* link ATS_UNUSED */,
+              char *hostname, int host_len)
 {
   if (!CacheProcessor::IsCacheReady(type)) {
     if (cont)
@@ -2914,7 +2919,7 @@ Cache::remove(Continuation *cont, CacheKey *key, CacheFragType type, bool /* use
   Vol *vol = key_to_vol(key, hostname, host_len);
   // coverity[var_decl]
   Dir result;
-  dir_clear(&result);           // initialized here, set result empty so we can recognize missed lock
+  dir_clear(&result); // initialized here, set result empty so we can recognize missed lock
   mutex = cont->mutex;
 
   CacheVC *c = new_CacheVC(cont);
@@ -2936,9 +2941,9 @@ Cache::remove(Continuation *cont, CacheKey *key, CacheFragType type, bool /* use
 }
 // CacheVConnection
 
-CacheVConnection::CacheVConnection()
-  : VConnection(NULL)
-{ }
+CacheVConnection::CacheVConnection() : VConnection(NULL)
+{
+}
 
 
 void
@@ -2953,7 +2958,7 @@ cplist_init()
       CacheVol *p = cp_list.head;
       while (p) {
         if (p->vol_number == dp[j]->vol_number) {
-          ink_assert(p->scheme == (int) dp[j]->dpb_queue.head->b->type);
+          ink_assert(p->scheme == (int)dp[j]->dpb_queue.head->b->type);
           p->size += dp[j]->size;
           p->num_vols += dp[j]->num_volblocks;
           p->disk_vols[i] = dp[j];
@@ -3018,7 +3023,7 @@ cplist_update()
 
     if (!config_vol) {
       // did not find a matching volume in the config file.
-      //Delete hte volume from the cache vol list
+      // Delete hte volume from the cache vol list
       int d_no;
       for (d_no = 0; d_no < gndisks; d_no++) {
         if (cp->disk_vols[d_no])
@@ -3048,7 +3053,7 @@ fillExclusiveDisks(CacheVol *cp)
     }
     /* The user had created several volumes before - clear the disk
        and create one volume for http */
-    for(int j = 0; j < (int)gdisks[i]->header->num_volumes; j++) {
+    for (int j = 0; j < (int)gdisks[i]->header->num_volumes; j++) {
       if (volume_number != gdisks[i]->disk_vols[j]->vol_number) {
         Note("Clearing Disk: %s", gdisks[i]->path);
         gdisks[i]->delete_all_volumes();
@@ -3060,22 +3065,22 @@ fillExclusiveDisks(CacheVol *cp)
     int64_t size_diff = gdisks[i]->num_usable_blocks;
     DiskVolBlock *dpb;
 
-     do {
-       dpb = gdisks[i]->create_volume(volume_number, size_diff, cp->scheme);
-       if (dpb) {
-         if (!cp->disk_vols[i]) {
-           cp->disk_vols[i] = gdisks[i]->get_diskvol(volume_number);
-         }
-         size_diff -= dpb->len;
-         cp->size += dpb->len;
-         cp->num_vols++;
-       } else {
-         Debug("cache_init", "create_volume failed");
-         break;
-       }
-     } while ((size_diff > 0));
-   }
-   return diskCount;
+    do {
+      dpb = gdisks[i]->create_volume(volume_number, size_diff, cp->scheme);
+      if (dpb) {
+        if (!cp->disk_vols[i]) {
+          cp->disk_vols[i] = gdisks[i]->get_diskvol(volume_number);
+        }
+        size_diff -= dpb->len;
+        cp->size += dpb->len;
+        cp->num_vols++;
+      } else {
+        Debug("cache_init", "create_volume failed");
+        break;
+      }
+    } while ((size_diff > 0));
+  }
+  return diskCount;
 }
 
 
@@ -3150,7 +3155,7 @@ cplist_reconfigure()
           Warning("no volumes created");
           return -1;
         }
-        int64_t space_in_blks = (int64_t) (((double) (config_vol->percent / percent_remaining)) * tot_space_in_blks);
+        int64_t space_in_blks = (int64_t)(((double)(config_vol->percent / percent_remaining)) * tot_space_in_blks);
 
         space_in_blks = space_in_blks >> (20 - STORE_BLOCK_SHIFT);
         /* round down to 128 megabyte multiple */
@@ -3160,8 +3165,8 @@ cplist_reconfigure()
         percent_remaining -= (config_vol->size < 128) ? 0 : config_vol->percent;
       }
       if (config_vol->size < 128) {
-        Warning("the size of volume %d (%" PRId64") is less than the minimum required volume size %d",
-                config_vol->number, (int64_t)config_vol->size, 128);
+        Warning("the size of volume %d (%" PRId64 ") is less than the minimum required volume size %d", config_vol->number,
+                (int64_t)config_vol->size, 128);
         Warning("volume %d is not created", config_vol->number);
       }
       Debug("cache_hosting", "Volume: %d Size: %" PRId64, config_vol->number, (int64_t)config_vol->size);
@@ -3178,14 +3183,13 @@ cplist_reconfigure()
     }
 
     for (config_vol = config_volumes.cp_queue.head; config_vol; config_vol = config_vol->link.next) {
-
       size = config_vol->size;
       if (size < 128)
         continue;
 
       volume_number = config_vol->number;
 
-      size_in_blocks = ((off_t) size * 1024 * 1024) / STORE_BLOCK_SIZE;
+      size_in_blocks = ((off_t)size * 1024 * 1024) / STORE_BLOCK_SIZE;
 
       if (config_vol->cachep && config_vol->cachep->num_vols > 0) {
         gnvol += config_vol->cachep->num_vols;
@@ -3208,7 +3212,7 @@ cplist_reconfigure()
         gnvol += new_cp->num_vols;
         continue;
       }
-//    else
+      //    else
       CacheVol *cp = config_vol->cachep;
       ink_assert(cp->size <= size_in_blocks);
       if (cp->size == size_in_blocks) {
@@ -3233,7 +3237,6 @@ cplist_reconfigure()
             smallest = curr;
             smallest_ndx = j;
           } else if (!dvol && cp->disk_vols[smallest]) {
-
             smallest = curr;
             smallest_ndx = j;
           } else if (dvol && cp->disk_vols[smallest] && (dvol->size < cp->disk_vols[smallest]->size)) {
@@ -3248,7 +3251,6 @@ cplist_reconfigure()
       int64_t size_to_alloc = size_in_blocks - cp->size;
       int disk_full = 0;
       for (int i = 0; (i < gndisks) && size_to_alloc; i++) {
-
         int disk_no = sorted_vols[i];
         ink_assert(cp->disk_vols[sorted_vols[gndisks - 1]]);
         int largest_vol = cp->disk_vols[sorted_vols[gndisks - 1]]->size;
@@ -3284,7 +3286,7 @@ cplist_reconfigure()
         size_to_alloc = size_in_blocks - cp->size;
       }
 
-      delete[]sorted_vols;
+      delete[] sorted_vols;
 
       if (size_to_alloc) {
         if (create_volume(volume_number, size_to_alloc, cp->scheme, cp))
@@ -3300,7 +3302,7 @@ cplist_reconfigure()
 int
 create_volume(int volume_number, off_t size_in_blocks, int scheme, CacheVol *cp)
 {
-  static int curr_vol = 0;  // FIXME: this will not reinitialize correctly
+  static int curr_vol = 0; // FIXME: this will not reinitialize correctly
   off_t to_create = size_in_blocks;
   off_t blocks_per_vol = VOL_BLOCK_SIZE >> STORE_BLOCK_SHIFT;
   int full_disks = 0;
@@ -3327,14 +3329,14 @@ create_volume(int volume_number, off_t size_in_blocks, int scheme, CacheVol *cp)
         char config_file[PATH_NAME_MAX];
         REC_ReadConfigString(config_file, "proxy.config.cache.volume_filename", PATH_NAME_MAX);
         if (cp->size)
-          Warning("not enough space to increase volume: [%d] to size: [%" PRId64 "]",
-                  volume_number, (int64_t)((to_create + cp->size) >> (20 - STORE_BLOCK_SHIFT)));
+          Warning("not enough space to increase volume: [%d] to size: [%" PRId64 "]", volume_number,
+                  (int64_t)((to_create + cp->size) >> (20 - STORE_BLOCK_SHIFT)));
         else
-          Warning("not enough space to create volume: [%d], size: [%" PRId64 "]",
-                  volume_number, (int64_t)(to_create >> (20 - STORE_BLOCK_SHIFT)));
+          Warning("not enough space to create volume: [%d], size: [%" PRId64 "]", volume_number,
+                  (int64_t)(to_create >> (20 - STORE_BLOCK_SHIFT)));
 
         Note("edit the %s file and restart traffic_server", config_file);
-        delete[]sp;
+        delete[] sp;
         return -1;
       }
     }
@@ -3347,7 +3349,7 @@ create_volume(int volume_number, off_t size_in_blocks, int scheme, CacheVol *cp)
     if (sp[i] > 0) {
       while (sp[i] > 0) {
         DiskVolBlock *p = gdisks[i]->create_volume(volume_number, sp[i], scheme);
-        ink_assert(p && (p->len >= (unsigned int) blocks_per_vol));
+        ink_assert(p && (p->len >= (unsigned int)blocks_per_vol));
         sp[i] -= p->len;
         cp->num_vols++;
         cp->size += p->len;
@@ -3356,7 +3358,7 @@ create_volume(int volume_number, off_t size_in_blocks, int scheme, CacheVol *cp)
         cp->disk_vols[i] = gdisks[i]->get_diskvol(volume_number);
     }
   }
-  delete[]sp;
+  delete[] sp;
   return 0;
 }
 
@@ -3377,7 +3379,7 @@ rebuild_host_table(Cache *cache)
 
 // if generic_host_rec.vols == NULL, what do we do???
 Vol *
-Cache::key_to_vol(CacheKey *key, char const* hostname, int host_len)
+Cache::key_to_vol(CacheKey *key, char const *hostname, int host_len)
 {
   uint32_t h = (key->slice32(2) >> DIR_TAG_WIDTH) % VOL_HASH_TABLE_SIZE;
   unsigned short *hash_table = hosttable->gen_host_rec.vol_hash_table;
@@ -3409,7 +3411,9 @@ Cache::key_to_vol(CacheKey *key, char const* hostname, int host_len)
     return host_rec->vols[0];
 }
 
-static void reg_int(const char *str, int stat, RecRawStatBlock *rsb, const char *prefix, RecRawStatSyncCb sync_cb=RecRawStatSyncSum) {
+static void
+reg_int(const char *str, int stat, RecRawStatBlock *rsb, const char *prefix, RecRawStatSyncCb sync_cb = RecRawStatSyncSum)
+{
   char stat_str[256];
   snprintf(stat_str, sizeof(stat_str), "%s.%s", prefix, str);
   RecRegisterRawStat(rsb, RECT_PROCESS, stat_str, RECD_INT, RECP_NON_PERSISTENT, stat, sync_cb);
@@ -3484,11 +3488,11 @@ ink_cache_init(ModuleVersion v)
 {
   ink_release_assert(!checkModuleVersion(v, CACHE_MODULE_VERSION));
 
-  cache_rsb = RecAllocateRawStatBlock((int) cache_stat_count);
+  cache_rsb = RecAllocateRawStatBlock((int)cache_stat_count);
 
   REC_EstablishStaticConfigInteger(cache_config_ram_cache_size, "proxy.config.cache.ram_cache.size");
-  Debug("cache_init", "proxy.config.cache.ram_cache.size = %" PRId64 " = %" PRId64 "Mb",
-        cache_config_ram_cache_size, cache_config_ram_cache_size / (1024 * 1024));
+  Debug("cache_init", "proxy.config.cache.ram_cache.size = %" PRId64 " = %" PRId64 "Mb", cache_config_ram_cache_size,
+        cache_config_ram_cache_size / (1024 * 1024));
 
   REC_EstablishStaticConfigInt32(cache_config_ram_cache_algorithm, "proxy.config.cache.ram_cache.algorithm");
   REC_EstablishStaticConfigInt32(cache_config_ram_cache_compress, "proxy.config.cache.ram_cache.compress");
@@ -3499,8 +3503,8 @@ ink_cache_init(ModuleVersion v)
   Debug("cache_init", "proxy.config.cache.limits.http.max_alts = %d", cache_config_http_max_alts);
 
   REC_EstablishStaticConfigInteger(cache_config_ram_cache_cutoff, "proxy.config.cache.ram_cache_cutoff");
-  Debug("cache_init", "cache_config_ram_cache_cutoff = %" PRId64 " = %" PRId64 "Mb",
-        cache_config_ram_cache_cutoff, cache_config_ram_cache_cutoff / (1024 * 1024));
+  Debug("cache_init", "cache_config_ram_cache_cutoff = %" PRId64 " = %" PRId64 "Mb", cache_config_ram_cache_cutoff,
+        cache_config_ram_cache_cutoff / (1024 * 1024));
 
   REC_EstablishStaticConfigInt32(cache_config_permit_pinning, "proxy.config.cache.permit.pinning");
   Debug("cache_init", "proxy.config.cache.permit.pinning = %d", cache_config_permit_pinning);
@@ -3512,8 +3516,8 @@ ink_cache_init(ModuleVersion v)
   Debug("cache_init", "proxy.config.cache.select_alternate = %d", cache_config_select_alternate);
 
   REC_EstablishStaticConfigInt32(cache_config_max_doc_size, "proxy.config.cache.max_doc_size");
-  Debug("cache_init", "proxy.config.cache.max_doc_size = %d = %dMb",
-        cache_config_max_doc_size, cache_config_max_doc_size / (1024 * 1024));
+  Debug("cache_init", "proxy.config.cache.max_doc_size = %d = %dMb", cache_config_max_doc_size,
+        cache_config_max_doc_size / (1024 * 1024));
 
   REC_EstablishStaticConfigInt32(cache_config_mutex_retry_delay, "proxy.config.cache.mutex_retry_delay");
   Debug("cache_init", "proxy.config.cache.mutex_retry_delay = %dms", cache_config_mutex_retry_delay);
@@ -3569,7 +3573,7 @@ ink_cache_init(ModuleVersion v)
   if (theCacheStore.n_disks == 0) {
     ats_scoped_str path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config"));
     Warning("no cache disks specified in %s: cache disabled\n", (const char *)path);
-    //exit(1);
+    // exit(1);
   }
 #if TS_USE_INTERIM_CACHE == 1
   else {
@@ -3587,8 +3591,8 @@ CacheProcessor::open_read(Continuation *cont, URL *url, bool cluster_cache_local
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
-    return open_read_internal(CACHE_OPEN_READ_LONG, cont, (MIOBuffer *) 0,
-                              url, request, params, (CacheKey *) 0, pin_in_cache, type, (char *) 0, 0);
+    return open_read_internal(CACHE_OPEN_READ_LONG, cont, (MIOBuffer *)0, url, request, params, (CacheKey *)0, pin_in_cache, type,
+                              (char *)0, 0);
   }
 #endif
   return caches[type]->open_read(cont, url, request, params, type);
@@ -3597,8 +3601,8 @@ CacheProcessor::open_read(Continuation *cont, URL *url, bool cluster_cache_local
 
 //----------------------------------------------------------------------------
 Action *
-CacheProcessor::open_write(Continuation *cont, int expected_size, URL *url, bool cluster_cache_local,
-                           CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache, CacheFragType type)
+CacheProcessor::open_write(Continuation *cont, int expected_size, URL *url, bool cluster_cache_local, CacheHTTPHdr *request,
+                           CacheHTTPInfo *old_info, time_t pin_in_cache, CacheFragType type)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
@@ -3610,10 +3614,8 @@ CacheProcessor::open_write(Continuation *cont, int expected_size, URL *url, bool
       // Do remote open_write()
       INK_MD5 url_only_md5;
       Cache::generate_key(&url_only_md5, url);
-      return Cluster_write(cont, expected_size, (MIOBuffer *) 0, m,
-                           &url_only_md5, type,
-                           false, pin_in_cache, CACHE_OPEN_WRITE_LONG,
-                           (CacheKey *) 0, url, request, old_info, (char *) 0, 0);
+      return Cluster_write(cont, expected_size, (MIOBuffer *)0, m, &url_only_md5, type, false, pin_in_cache, CACHE_OPEN_WRITE_LONG,
+                           (CacheKey *)0, url, request, old_info, (char *)0, 0);
     }
   }
 #endif
@@ -3642,17 +3644,18 @@ CacheProcessor::remove(Continuation *cont, URL *url, bool cluster_cache_local, C
 #endif
 
   // Remove from local cache only.
-  return caches[frag_type]->remove(cont, &id, frag_type, true, false, const_cast<char*>(hostname), len);
+  return caches[frag_type]->remove(cont, &id, frag_type, true, false, const_cast<char *>(hostname), len);
 }
 
-CacheDisk*
-CacheProcessor::find_by_path(char const* path, int len)
+CacheDisk *
+CacheProcessor::find_by_path(char const *path, int len)
 {
   if (CACHE_INITIALIZED == initialized) {
     // If no length is passed in, assume it's null terminated.
-    if (0 >= len && 0 != *path) len = strlen(path);
+    if (0 >= len && 0 != *path)
+      len = strlen(path);
 
-    for ( int i = 0 ; i < gndisks ; ++i ) {
+    for (int i = 0; i < gndisks; ++i) {
       if (0 == strncmp(path, gdisks[i]->path, len))
         return gdisks[i];
     }
@@ -3663,101 +3666,102 @@ CacheProcessor::find_by_path(char const* path, int len)
 
 // ----------------------------
 
-namespace cache_bc {
-  static size_t const HTTP_ALT_MARSHAL_SIZE = ROUND(sizeof(HTTPCacheAlt), HDR_PTR_SIZE); // current size.
-  size_t
-  HTTPInfo_v21::marshalled_length(void* data)
-  {
-    size_t zret = ROUND(sizeof(HTTPCacheAlt_v21), HDR_PTR_SIZE);
-    HTTPCacheAlt_v21* alt = static_cast<HTTPCacheAlt_v21*>(data);
-    HdrHeap* hdr;
-
-    hdr = reinterpret_cast<HdrHeap*>(reinterpret_cast<char*>(alt) + reinterpret_cast<uintptr_t>(alt->m_request_hdr.m_heap));
-    zret += ROUND(hdr->unmarshal_size(), HDR_PTR_SIZE);
-    hdr = reinterpret_cast<HdrHeap*>(reinterpret_cast<char*>(alt) + reinterpret_cast<uintptr_t>(alt->m_response_hdr.m_heap));
-    zret += ROUND(hdr->unmarshal_size(), HDR_PTR_SIZE);
-    return zret;
-  }
-
-  // Copy an unmarshalled instance from @a src to @a dst.
-  // @a src is presumed to be Cache version 21 and the result
-  // is Cache version 23. @a length is the buffer available in @a dst.
-  // @return @c false if something went wrong (e.g., data overrun).
-  bool
-  HTTPInfo_v21::copy_and_upgrade_unmarshalled_to_v23(
-    char*& dst, char*& src, size_t& length, int n_frags, FragOffset* frag_offsets
-    )
-  {
-    // Offsets of the data after the new st

<TRUNCATED>

[43/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheTest.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
index 734f7a7..219eb97 100644
--- a/iocore/cache/CacheTest.cc
+++ b/iocore/cache/CacheTest.cc
@@ -29,26 +29,15 @@
 
 using namespace std;
 
-CacheTestSM::CacheTestSM(RegressionTest *t) :
-  RegressionSM(t),
-  timeout(0),
-  cache_action(0),
-  start_time(0),
-  cache_vc(0),
-  cvio(0),
-  buffer(0),
-  buffer_reader(0),
-  nbytes(-1),
-  repeat_count(0),
-  expect_event(EVENT_NONE),
-  expect_initial_event(EVENT_NONE),
-  initial_event(EVENT_NONE),
-  content_salt(0)
+CacheTestSM::CacheTestSM(RegressionTest *t)
+  : RegressionSM(t), timeout(0), cache_action(0), start_time(0), cache_vc(0), cvio(0), buffer(0), buffer_reader(0), nbytes(-1),
+    repeat_count(0), expect_event(EVENT_NONE), expect_initial_event(EVENT_NONE), initial_event(EVENT_NONE), content_salt(0)
 {
   SET_HANDLER(&CacheTestSM::event_handler);
 }
 
-CacheTestSM::~CacheTestSM() {
+CacheTestSM::~CacheTestSM()
+{
   ink_assert(!cache_action);
   ink_assert(!cache_vc);
   if (buffer_reader)
@@ -57,125 +46,129 @@ CacheTestSM::~CacheTestSM() {
     free_MIOBuffer(buffer);
 }
 
-int CacheTestSM::open_read_callout() {
+int
+CacheTestSM::open_read_callout()
+{
   cvio = cache_vc->do_io_read(this, nbytes, buffer);
   return 1;
 }
 
-int CacheTestSM::open_write_callout() {
+int
+CacheTestSM::open_write_callout()
+{
   cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
   return 1;
 }
 
-int CacheTestSM::event_handler(int event, void *data) {
-
+int
+CacheTestSM::event_handler(int event, void *data)
+{
   switch (event) {
-
-    case EVENT_INTERVAL:
-    case EVENT_IMMEDIATE:
-      cancel_timeout();
-      if (cache_action) {
-        cache_action->cancel();
-        cache_action = 0;
-      }
-      if (cache_vc) {
-        cache_vc->do_io_close();
-        cache_vc = 0;
-      }
-      cvio = 0;
-      make_request();
-      return EVENT_DONE;
-
-    case CACHE_EVENT_LOOKUP_FAILED:
-    case CACHE_EVENT_LOOKUP:
-      goto Lcancel_next;
-
-    case CACHE_EVENT_OPEN_READ:
-      initial_event = event;
-      cancel_timeout();
+  case EVENT_INTERVAL:
+  case EVENT_IMMEDIATE:
+    cancel_timeout();
+    if (cache_action) {
+      cache_action->cancel();
       cache_action = 0;
-      cache_vc = (CacheVConnection*)data;
-      buffer = new_empty_MIOBuffer();
-      buffer_reader = buffer->alloc_reader();
-      if (open_read_callout() < 0)
-        goto Lclose_error_next;
-      else
-        return EVENT_DONE;
-
-    case CACHE_EVENT_OPEN_READ_FAILED:
-      goto Lcancel_next;
+    }
+    if (cache_vc) {
+      cache_vc->do_io_close();
+      cache_vc = 0;
+    }
+    cvio = 0;
+    make_request();
+    return EVENT_DONE;
 
-    case VC_EVENT_READ_READY:
-      if (!check_buffer())
-        goto Lclose_error_next;
-      buffer_reader->consume(buffer_reader->read_avail());
-      ((VIO*)data)->reenable();
-      return EVENT_CONT;
+  case CACHE_EVENT_LOOKUP_FAILED:
+  case CACHE_EVENT_LOOKUP:
+    goto Lcancel_next;
+
+  case CACHE_EVENT_OPEN_READ:
+    initial_event = event;
+    cancel_timeout();
+    cache_action = 0;
+    cache_vc = (CacheVConnection *)data;
+    buffer = new_empty_MIOBuffer();
+    buffer_reader = buffer->alloc_reader();
+    if (open_read_callout() < 0)
+      goto Lclose_error_next;
+    else
+      return EVENT_DONE;
 
-    case VC_EVENT_READ_COMPLETE:
-      if (!check_buffer())
-        goto Lclose_error_next;
-      goto Lclose_next;
+  case CACHE_EVENT_OPEN_READ_FAILED:
+    goto Lcancel_next;
 
-    case VC_EVENT_ERROR:
-    case VC_EVENT_EOS:
+  case VC_EVENT_READ_READY:
+    if (!check_buffer())
       goto Lclose_error_next;
+    buffer_reader->consume(buffer_reader->read_avail());
+    ((VIO *)data)->reenable();
+    return EVENT_CONT;
 
-    case CACHE_EVENT_OPEN_WRITE:
-      initial_event = event;
-      cancel_timeout();
-      cache_action = 0;
-      cache_vc = (CacheVConnection*)data;
-      buffer = new_empty_MIOBuffer();
-      buffer_reader = buffer->alloc_reader();
-      if (open_write_callout() < 0)
-        goto Lclose_error_next;
-      else
-        return EVENT_DONE;
+  case VC_EVENT_READ_COMPLETE:
+    if (!check_buffer())
+      goto Lclose_error_next;
+    goto Lclose_next;
+
+  case VC_EVENT_ERROR:
+  case VC_EVENT_EOS:
+    goto Lclose_error_next;
+
+  case CACHE_EVENT_OPEN_WRITE:
+    initial_event = event;
+    cancel_timeout();
+    cache_action = 0;
+    cache_vc = (CacheVConnection *)data;
+    buffer = new_empty_MIOBuffer();
+    buffer_reader = buffer->alloc_reader();
+    if (open_write_callout() < 0)
+      goto Lclose_error_next;
+    else
+      return EVENT_DONE;
 
-    case CACHE_EVENT_OPEN_WRITE_FAILED:
-      goto Lcancel_next;
+  case CACHE_EVENT_OPEN_WRITE_FAILED:
+    goto Lcancel_next;
 
-    case VC_EVENT_WRITE_READY:
-      fill_buffer();
-      cvio->reenable();
-      return EVENT_CONT;
+  case VC_EVENT_WRITE_READY:
+    fill_buffer();
+    cvio->reenable();
+    return EVENT_CONT;
 
-    case VC_EVENT_WRITE_COMPLETE:
-      if (nbytes != cvio->ndone)
-        goto Lclose_error_next;
-      goto Lclose_next;
+  case VC_EVENT_WRITE_COMPLETE:
+    if (nbytes != cvio->ndone)
+      goto Lclose_error_next;
+    goto Lclose_next;
 
-    case CACHE_EVENT_REMOVE:
-    case CACHE_EVENT_REMOVE_FAILED:
-      goto Lcancel_next;
+  case CACHE_EVENT_REMOVE:
+  case CACHE_EVENT_REMOVE_FAILED:
+    goto Lcancel_next;
 
-    case CACHE_EVENT_SCAN:
-      initial_event = event;
-      cache_vc = (CacheVConnection*)data;
-      return EVENT_CONT;
+  case CACHE_EVENT_SCAN:
+    initial_event = event;
+    cache_vc = (CacheVConnection *)data;
+    return EVENT_CONT;
 
-    case CACHE_EVENT_SCAN_OBJECT:
-      return CACHE_SCAN_RESULT_CONTINUE;
+  case CACHE_EVENT_SCAN_OBJECT:
+    return CACHE_SCAN_RESULT_CONTINUE;
 
-    case CACHE_EVENT_SCAN_OPERATION_FAILED:
-      return CACHE_SCAN_RESULT_CONTINUE;
+  case CACHE_EVENT_SCAN_OPERATION_FAILED:
+    return CACHE_SCAN_RESULT_CONTINUE;
 
-    case CACHE_EVENT_SCAN_OPERATION_BLOCKED:
-      return CACHE_SCAN_RESULT_CONTINUE;
+  case CACHE_EVENT_SCAN_OPERATION_BLOCKED:
+    return CACHE_SCAN_RESULT_CONTINUE;
 
-    case CACHE_EVENT_SCAN_DONE:
-      return EVENT_CONT;
+  case CACHE_EVENT_SCAN_DONE:
+    return EVENT_CONT;
 
-    case CACHE_EVENT_SCAN_FAILED:
-      return EVENT_CONT;
+  case CACHE_EVENT_SCAN_FAILED:
+    return EVENT_CONT;
 
-    case AIO_EVENT_DONE:
-      goto Lnext;
+  case AIO_EVENT_DONE:
+    goto Lnext;
 
-    default:
-      ink_assert(!"case");
-      break;
+  default:
+    ink_assert(!"case");
+    break;
   }
   return EVENT_DONE;
 
@@ -207,7 +200,9 @@ Lnext:
     return complete(event);
 }
 
-void CacheTestSM::fill_buffer() {
+void
+CacheTestSM::fill_buffer()
+{
   int64_t avail = buffer->write_avail();
   CacheKey k = key;
   k.b[1] += content_salt;
@@ -217,26 +212,28 @@ void CacheTestSM::fill_buffer() {
     if (l > sk)
       l = sk;
 
-    int64_t pos = cvio->ndone +  buffer_reader->read_avail();
+    int64_t pos = cvio->ndone + buffer_reader->read_avail();
     int64_t o = pos % sk;
 
     if (l > sk - o)
       l = sk - o;
     k.b[0] = pos / sk;
-    char *x = ((char*)&k) + o;
+    char *x = ((char *)&k) + o;
     buffer->write(x, l);
     buffer->fill(l);
     avail -= l;
   }
 }
 
-int CacheTestSM::check_buffer() {
+int
+CacheTestSM::check_buffer()
+{
   int64_t avail = buffer_reader->read_avail();
   CacheKey k = key;
   k.b[1] += content_salt;
   char b[sizeof(key)];
   int64_t sk = (int64_t)sizeof(key);
-  int64_t pos = cvio->ndone -  buffer_reader->read_avail();
+  int64_t pos = cvio->ndone - buffer_reader->read_avail();
   while (avail > 0) {
     int64_t l = avail;
     if (l > sk)
@@ -245,7 +242,7 @@ int CacheTestSM::check_buffer() {
     if (l > sk - o)
       l = sk - o;
     k.b[0] = pos / sk;
-    char *x = ((char*)&k) + o;
+    char *x = ((char *)&k) + o;
     buffer_reader->read(&b[0], l);
     if (::memcmp(b, x, l))
       return 0;
@@ -256,13 +253,15 @@ int CacheTestSM::check_buffer() {
   return 1;
 }
 
-int CacheTestSM::check_result(int event) {
-  return
-    initial_event == expect_initial_event &&
-    event == expect_event;
+int
+CacheTestSM::check_result(int event)
+{
+  return initial_event == expect_initial_event && event == expect_event;
 }
 
-int CacheTestSM::complete(int event) {
+int
+CacheTestSM::complete(int event)
+{
   if (!check_result(event))
     done(REGRESSION_TEST_FAILED);
   else
@@ -271,14 +270,16 @@ int CacheTestSM::complete(int event) {
   return EVENT_DONE;
 }
 
-CacheTestSM::CacheTestSM(const CacheTestSM &ao) : RegressionSM(ao) {
-  int o = (int)(((char*)&start_memcpy_on_clone) - ((char*)this));
-  int s = (int)(((char*)&end_memcpy_on_clone) - ((char*)&start_memcpy_on_clone));
-  memcpy(((char*)this)+o, ((char*)&ao)+o, s);
+CacheTestSM::CacheTestSM(const CacheTestSM &ao) : RegressionSM(ao)
+{
+  int o = (int)(((char *)&start_memcpy_on_clone) - ((char *)this));
+  int s = (int)(((char *)&end_memcpy_on_clone) - ((char *)&start_memcpy_on_clone));
+  memcpy(((char *)this) + o, ((char *)&ao) + o, s);
   SET_HANDLER(&CacheTestSM::event_handler);
 }
 
-EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus) {
+EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
+{
   if (cacheProcessor.IsCacheEnabled() != CACHE_INITIALIZED) {
     rprintf(t, "cache not initialized");
     *pstatus = REGRESSION_TEST_FAILED;
@@ -287,45 +288,41 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
 
   EThread *thread = this_ethread();
 
-  CACHE_SM(t, write_test, { cacheProcessor.open_write(
-        this, &key, false, CACHE_FRAG_TYPE_NONE, 100,
-        CACHE_WRITE_OPT_SYNC); } );
+  CACHE_SM(t, write_test, { cacheProcessor.open_write(this, &key, false, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); });
   write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   write_test.nbytes = 100;
   rand_CacheKey(&write_test.key, thread->mutex);
 
-  CACHE_SM(t, lookup_test, { cacheProcessor.lookup(this, &key, false); } );
+  CACHE_SM(t, lookup_test, { cacheProcessor.lookup(this, &key, false); });
   lookup_test.expect_event = CACHE_EVENT_LOOKUP;
   lookup_test.key = write_test.key;
 
-  CACHE_SM(t, read_test, { cacheProcessor.open_read(this, &key, false); } );
+  CACHE_SM(t, read_test, { cacheProcessor.open_read(this, &key, false); });
   read_test.expect_initial_event = CACHE_EVENT_OPEN_READ;
   read_test.expect_event = VC_EVENT_READ_COMPLETE;
   read_test.nbytes = 100;
   read_test.key = write_test.key;
 
-  CACHE_SM(t, remove_test, { cacheProcessor.remove(this, &key, false); } );
+  CACHE_SM(t, remove_test, { cacheProcessor.remove(this, &key, false); });
   remove_test.expect_event = CACHE_EVENT_REMOVE;
   remove_test.key = write_test.key;
 
-  CACHE_SM(t, lookup_fail_test, { cacheProcessor.lookup(this, &key, false); } );
+  CACHE_SM(t, lookup_fail_test, { cacheProcessor.lookup(this, &key, false); });
   lookup_fail_test.expect_event = CACHE_EVENT_LOOKUP_FAILED;
   lookup_fail_test.key = write_test.key;
 
-  CACHE_SM(t, read_fail_test, { cacheProcessor.open_read(this, &key, false); } );
+  CACHE_SM(t, read_fail_test, { cacheProcessor.open_read(this, &key, false); });
   read_fail_test.expect_event = CACHE_EVENT_OPEN_READ_FAILED;
   read_fail_test.key = write_test.key;
 
-  CACHE_SM(t, remove_fail_test, { cacheProcessor.remove(this, &key, false); } );
+  CACHE_SM(t, remove_fail_test, { cacheProcessor.remove(this, &key, false); });
   remove_fail_test.expect_event = CACHE_EVENT_REMOVE_FAILED;
   rand_CacheKey(&remove_fail_test.key, thread->mutex);
 
-  CACHE_SM(t, replace_write_test, {
-      cacheProcessor.open_write(this, &key, false, CACHE_FRAG_TYPE_NONE, 100,
-                                CACHE_WRITE_OPT_SYNC);
-    }
-    int open_write_callout() {
+  CACHE_SM(
+    t, replace_write_test,
+    { cacheProcessor.open_write(this, &key, false, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); } int open_write_callout() {
       header.serial = 10;
       cache_vc->set_header(&header, sizeof(header));
       cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
@@ -336,101 +333,83 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
   replace_write_test.nbytes = 100;
   rand_CacheKey(&replace_write_test.key, thread->mutex);
 
-  CACHE_SM(t, replace_test, {
-      cacheProcessor.open_write(this, &key, false, CACHE_FRAG_TYPE_NONE, 100,
-                                CACHE_WRITE_OPT_OVERWRITE_SYNC);
-    }
-    int open_write_callout() {
-      CacheTestHeader *h = 0;
-      int hlen = 0;
-      if (cache_vc->get_header((void**)&h, &hlen) < 0)
-        return -1;
-      if (h->serial != 10)
-        return -1;
-      header.serial = 11;
-      cache_vc->set_header(&header, sizeof(header));
-      cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
-      return 1;
-    });
+  CACHE_SM(t, replace_test,
+           {
+             cacheProcessor.open_write(this, &key, false, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_OVERWRITE_SYNC);
+           } int open_write_callout() {
+             CacheTestHeader *h = 0;
+             int hlen = 0;
+             if (cache_vc->get_header((void **)&h, &hlen) < 0)
+               return -1;
+             if (h->serial != 10)
+               return -1;
+             header.serial = 11;
+             cache_vc->set_header(&header, sizeof(header));
+             cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
+             return 1;
+           });
   replace_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   replace_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   replace_test.nbytes = 100;
   replace_test.key = replace_write_test.key;
   replace_test.content_salt = 1;
 
-  CACHE_SM(t, replace_read_test, {
-      cacheProcessor.open_read(this, &key, false);
-    }
-    int open_read_callout() {
-      CacheTestHeader *h = 0;
-      int hlen = 0;
-      if (cache_vc->get_header((void**)&h, &hlen) < 0)
-        return -1;
-      if (h->serial != 11)
-        return -1;
-      cvio = cache_vc->do_io_read(this, nbytes, buffer);
-      return 1;
-    });
+  CACHE_SM(t, replace_read_test, { cacheProcessor.open_read(this, &key, false); } int open_read_callout() {
+    CacheTestHeader *h = 0;
+    int hlen = 0;
+    if (cache_vc->get_header((void **)&h, &hlen) < 0)
+      return -1;
+    if (h->serial != 11)
+      return -1;
+    cvio = cache_vc->do_io_read(this, nbytes, buffer);
+    return 1;
+  });
   replace_read_test.expect_initial_event = CACHE_EVENT_OPEN_READ;
   replace_read_test.expect_event = VC_EVENT_READ_COMPLETE;
   replace_read_test.nbytes = 100;
   replace_read_test.key = replace_test.key;
   replace_read_test.content_salt = 1;
 
-  CACHE_SM(t, large_write_test, { cacheProcessor.open_write(
-        this, &key, false, CACHE_FRAG_TYPE_NONE, 100,
-        CACHE_WRITE_OPT_SYNC); } );
+  CACHE_SM(t, large_write_test, { cacheProcessor.open_write(this, &key, false, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); });
   large_write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   large_write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   large_write_test.nbytes = 10000000;
   rand_CacheKey(&large_write_test.key, thread->mutex);
 
-  CACHE_SM(t, pread_test, {
-      cacheProcessor.open_read(this, &key, false);
-    }
-    int open_read_callout() {
-      cvio = cache_vc->do_io_pread(this, nbytes, buffer, 7000000);
-      return 1;
-    });
+  CACHE_SM(t, pread_test, { cacheProcessor.open_read(this, &key, false); } int open_read_callout() {
+    cvio = cache_vc->do_io_pread(this, nbytes, buffer, 7000000);
+    return 1;
+  });
   pread_test.expect_initial_event = CACHE_EVENT_OPEN_READ;
   pread_test.expect_event = VC_EVENT_READ_COMPLETE;
   pread_test.nbytes = 100;
   pread_test.key = large_write_test.key;
 
-  r_sequential(
-    t,
-    write_test.clone(),
-    lookup_test.clone(),
-    r_sequential(t, 10, read_test.clone()),
-    remove_test.clone(),
-    lookup_fail_test.clone(),
-    read_fail_test.clone(),
-    remove_fail_test.clone(),
-    replace_write_test.clone(),
-    replace_test.clone(),
-    replace_read_test.clone(),
-    large_write_test.clone(),
-    pread_test.clone(),
-    NULL_PTR
-    )->run(pstatus);
+  r_sequential(t, write_test.clone(), lookup_test.clone(), r_sequential(t, 10, read_test.clone()), remove_test.clone(),
+               lookup_fail_test.clone(), read_fail_test.clone(), remove_fail_test.clone(), replace_write_test.clone(),
+               replace_test.clone(), replace_read_test.clone(), large_write_test.clone(), pread_test.clone(),
+               NULL_PTR)->run(pstatus);
   return;
 }
 
-void force_link_CacheTest() {
+void
+force_link_CacheTest()
+{
 }
 
 // run -R 3 -r cache_disk_replacement_stability
 
-REGRESSION_TEST(cache_disk_replacement_stability)(RegressionTest *t, int level, int *pstatus) {
+REGRESSION_TEST(cache_disk_replacement_stability)(RegressionTest *t, int level, int *pstatus)
+{
   static int const MAX_VOLS = 26; // maximum values used in any test.
   static uint64_t DEFAULT_SKIP = 8192;
   static uint64_t DEFAULT_STRIPE_SIZE = 1024ULL * 1024 * 1024 * 911; // 911G
-  CacheDisk disk; // Only need one because it's just checked for failure.
+  CacheDisk disk;                                                    // Only need one because it's just checked for failure.
   CacheHostRecord hr1, hr2;
-  Vol* sample;
+  Vol *sample;
   static int const sample_idx = 16;
   Vol vols[MAX_VOLS];
-  Vol* vol_ptrs[MAX_VOLS]; // array of pointers.
+  Vol *vol_ptrs[MAX_VOLS]; // array of pointers.
   char buff[2048];
 
   // Only run at the highest levels.
@@ -443,12 +422,11 @@ REGRESSION_TEST(cache_disk_replacement_stability)(RegressionTest *t, int level,
 
   disk.num_errors = 0;
 
-  for ( int i = 0 ; i < MAX_VOLS ; ++i ) {
+  for (int i = 0; i < MAX_VOLS; ++i) {
     vol_ptrs[i] = vols + i;
     vols[i].disk = &disk;
     vols[i].len = DEFAULT_STRIPE_SIZE;
-    snprintf(buff, sizeof(buff), "/dev/sd%c %" PRIu64 ":%" PRIu64,
-             'a' + i, DEFAULT_SKIP, vols[i].len);
+    snprintf(buff, sizeof(buff), "/dev/sd%c %" PRIu64 ":%" PRIu64, 'a' + i, DEFAULT_SKIP, vols[i].len);
     MD5Context().hash_immediate(vols[i].hash_id, buff, strlen(buff));
   }
 
@@ -462,18 +440,19 @@ REGRESSION_TEST(cache_disk_replacement_stability)(RegressionTest *t, int level,
   hr2.num_vols = MAX_VOLS;
 
   sample = vols + sample_idx;
-  sample->len = 1024ULL * 1024 * 1024 * (1024+128); // 1.1 TB
-  snprintf(buff, sizeof(buff), "/dev/sd%c %" PRIu64 ":%" PRIu64,
-           'a' + sample_idx, DEFAULT_SKIP, sample->len);
+  sample->len = 1024ULL * 1024 * 1024 * (1024 + 128); // 1.1 TB
+  snprintf(buff, sizeof(buff), "/dev/sd%c %" PRIu64 ":%" PRIu64, 'a' + sample_idx, DEFAULT_SKIP, sample->len);
   MD5Context().hash_immediate(sample->hash_id, buff, strlen(buff));
   build_vol_hash_table(&hr2);
 
   // See what the difference is
   int to = 0, from = 0;
   int then = 0, now = 0;
-  for ( int i = 0 ; i < VOL_HASH_TABLE_SIZE ; ++i ) {
-    if (hr1.vol_hash_table[i] == sample_idx) ++then;
-    if (hr2.vol_hash_table[i] == sample_idx) ++now;
+  for (int i = 0; i < VOL_HASH_TABLE_SIZE; ++i) {
+    if (hr1.vol_hash_table[i] == sample_idx)
+      ++then;
+    if (hr2.vol_hash_table[i] == sample_idx)
+      ++now;
     if (hr1.vol_hash_table[i] != hr2.vol_hash_table[i]) {
       if (hr1.vol_hash_table[i] == sample_idx)
         ++from;
@@ -482,9 +461,8 @@ REGRESSION_TEST(cache_disk_replacement_stability)(RegressionTest *t, int level,
     }
   }
   rprintf(t, "Cache stability difference - "
-          "delta = %d of %d : %d to, %d from, originally %d slots, now %d slots (net gain = %d/%d)\n"
-          , to+from, VOL_HASH_TABLE_SIZE, to, from, then, now, now-then, to-from
-    );
+             "delta = %d of %d : %d to, %d from, originally %d slots, now %d slots (net gain = %d/%d)\n",
+          to + from, VOL_HASH_TABLE_SIZE, to, from, then, now, now - then, to - from);
   *pstatus = REGRESSION_TEST_PASSED;
 
   hr1.vols = 0;
@@ -496,8 +474,8 @@ test_RamCache(RegressionTest *t, RamCache *cache)
 {
   bool pass = true;
   CacheKey key;
-  Vol *vol = theCache->key_to_vol(&key, "example.com", sizeof("example.com")-1);
-  vector< Ptr<IOBufferData> > data;
+  Vol *vol = theCache->key_to_vol(&key, "example.com", sizeof("example.com") - 1);
+  vector<Ptr<IOBufferData> > data;
 
   cache->init(1 << 20, vol);
 
@@ -544,8 +522,7 @@ REGRESSION_TEST(ram_cache)(RegressionTest *t, int /* level ATS_UNUSED */, int *p
     *pstatus = REGRESSION_TEST_FAILED;
     return;
   }
-  if (!test_RamCache(t, new_RamCacheLRU()) ||
-      !test_RamCache(t, new_RamCacheCLFUS()))
+  if (!test_RamCache(t, new_RamCacheLRU()) || !test_RamCache(t, new_RamCacheCLFUS()))
     *pstatus = REGRESSION_TEST_FAILED;
   else
     *pstatus = REGRESSION_TEST_PASSED;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheVol.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheVol.cc b/iocore/cache/CacheVol.cc
index 9428774..47f5775 100644
--- a/iocore/cache/CacheVol.cc
+++ b/iocore/cache/CacheVol.cc
@@ -22,14 +22,13 @@
  */
 
 
-
 #include "P_Cache.h"
 
-#define SCAN_BUF_SIZE      RECOVERY_SIZE
+#define SCAN_BUF_SIZE RECOVERY_SIZE
 #define SCAN_WRITER_LOCK_MAX_RETRY 5
 
 Action *
-Cache::scan(Continuation * cont, char *hostname, int host_len, int KB_per_second)
+Cache::scan(Continuation *cont, char *hostname, int host_len, int KB_per_second)
 {
   Debug("cache_scan_truss", "inside scan");
   if (!CacheProcessor::IsCacheReady(CACHE_FRAG_TYPE_HTTP)) {
@@ -93,20 +92,22 @@ Ldone:
  * d - Vol
  * vol_map - precalculated map
  * offset - offset to start looking at (and data at this location has not been read yet). */
-static off_t next_in_map(Vol *d, char *vol_map, off_t offset)
+static off_t
+next_in_map(Vol *d, char *vol_map, off_t offset)
 {
   off_t start_offset = vol_offset_to_offset(d, 0);
   off_t new_off = (offset - start_offset);
   off_t vol_len = vol_relative_length(d, start_offset);
 
-  while (new_off < vol_len && !vol_map[new_off / SCAN_BUF_SIZE]) new_off += SCAN_BUF_SIZE;
-  if (new_off >= vol_len) return vol_len + start_offset;
+  while (new_off < vol_len && !vol_map[new_off / SCAN_BUF_SIZE])
+    new_off += SCAN_BUF_SIZE;
+  if (new_off >= vol_len)
+    return vol_len + start_offset;
   return new_off + start_offset;
 }
 
 // Function in CacheDir.cc that we need for make_vol_map().
-int
-dir_bucket_loop_fix(Dir *start_dir, int s, Vol *d);
+int dir_bucket_loop_fix(Dir *start_dir, int s, Vol *d);
 
 // TODO: If we used a bit vector, we could make a smaller map structure.
 // TODO: If we saved a high water mark we could have a smaller buf, and avoid searching it
@@ -114,7 +115,8 @@ dir_bucket_loop_fix(Dir *start_dir, int s, Vol *d);
 /* Make map of what blocks in partition are used.
  *
  * d - Vol to make a map of. */
-static char *make_vol_map(Vol *d)
+static char *
+make_vol_map(Vol *d)
 {
   // Map will be one byte for each SCAN_BUF_SIZE bytes.
   off_t start_offset = vol_offset_to_offset(d, 0);
@@ -135,8 +137,9 @@ static char *make_vol_map(Vol *d)
       }
       while (e) {
         if (dir_offset(e) && dir_valid(d, e) && dir_agg_valid(d, e) && dir_head(e)) {
-            off_t offset = vol_offset(d, e) - start_offset;
-            if (offset <= vol_len) vol_map[offset / SCAN_BUF_SIZE] = 1;
+          off_t offset = vol_offset(d, e) - start_offset;
+          if (offset <= vol_len)
+            vol_map[offset / SCAN_BUF_SIZE] = 1;
         }
         e = next_dir(e, seg);
         if (!e)
@@ -174,7 +177,7 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     return EVENT_CONT;
   }
 
-  if (!fragment) {               // initialize for first read
+  if (!fragment) { // initialize for first read
     fragment = 1;
     scan_vol_map = make_vol_map(vol);
     io.aiocb.aio_offset = next_in_map(vol, scan_vol_map, vol_offset_to_offset(vol, 0));
@@ -188,12 +191,12 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     goto Lread;
   }
 
-  if ((size_t)io.aio_result != (size_t) io.aiocb.aio_nbytes) {
-    result = (void *) -ECACHE_READ_FAIL;
+  if ((size_t)io.aio_result != (size_t)io.aiocb.aio_nbytes) {
+    result = (void *)-ECACHE_READ_FAIL;
     goto Ldone;
   }
 
-  doc = (Doc *) (buf->data() + offset);
+  doc = (Doc *)(buf->data() + offset);
   // If there is data in the buffer before the start that is from a partial object read previously
   // Fix things as if we read it this time.
   if (scan_fix_buffer_offset) {
@@ -203,9 +206,9 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     io.aiocb.aio_buf = (char *)io.aiocb.aio_buf - scan_fix_buffer_offset;
     scan_fix_buffer_offset = 0;
   }
-  while ((off_t)((char *) doc - buf->data()) + next_object_len < (off_t)io.aiocb.aio_nbytes) {
+  while ((off_t)((char *)doc - buf->data()) + next_object_len < (off_t)io.aiocb.aio_nbytes) {
     might_need_overlap_read = false;
-    doc = (Doc *) ((char *) doc + next_object_len);
+    doc = (Doc *)((char *)doc + next_object_len);
     next_object_len = vol->round_to_approx_size(doc->len);
 #ifdef HTTP_CACHE
     int i;
@@ -225,11 +228,11 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       if (!dir_probe(&doc->first_key, vol, &dir, &last_collision))
         goto Lskip;
       if (!dir_agg_valid(vol, &dir) || !dir_head(&dir) ||
-          (vol_offset(vol, &dir) != io.aiocb.aio_offset + ((char *) doc - buf->data())))
+          (vol_offset(vol, &dir) != io.aiocb.aio_offset + ((char *)doc - buf->data())))
         continue;
       break;
     }
-    if (doc->data() - buf->data() > (int) io.aiocb.aio_nbytes) {
+    if (doc->data() - buf->data() > (int)io.aiocb.aio_nbytes) {
       might_need_overlap_read = true;
       goto Lskip;
     }
@@ -301,10 +304,10 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
         ink_assert(hostinfo_copied);
         SET_HANDLER(&CacheVC::scanRemoveDone);
         // force remove even if there is a writer
-        cacheProcessor.remove(this, &doc->first_key, true, CACHE_FRAG_TYPE_HTTP, true, false, (char *) hname, hlen);
+        cacheProcessor.remove(this, &doc->first_key, true, CACHE_FRAG_TYPE_HTTP, true, false, (char *)hname, hlen);
         return EVENT_CONT;
       } else {
-        offset = (char *) doc - buf->data();
+        offset = (char *)doc - buf->data();
         write_len = 0;
         frag_type = CACHE_FRAG_TYPE_HTTP;
         f.use_first_key = 1;
@@ -318,16 +321,16 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       }
     }
     continue;
-  Lskip:;
+  Lskip:
+    ;
 #endif
   }
 #ifdef HTTP_CACHE
   vector.clear();
 #endif
-    // If we had an object that went past the end of the buffer, and it is small enough to fix,
-    // fix it.
-  if (might_need_overlap_read &&
-      ((off_t)((char *) doc - buf->data()) + next_object_len > (off_t)io.aiocb.aio_nbytes) &&
+  // If we had an object that went past the end of the buffer, and it is small enough to fix,
+  // fix it.
+  if (might_need_overlap_read && ((off_t)((char *)doc - buf->data()) + next_object_len > (off_t)io.aiocb.aio_nbytes) &&
       next_object_len > 0) {
     off_t partial_object_len = io.aiocb.aio_nbytes - ((char *)doc - buf->data());
     // Copy partial object to beginning of the buffer.
@@ -347,7 +350,7 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   }
 
   if (io.aiocb.aio_offset >= vol->skip + vol->len) {
-Lnext_vol:
+  Lnext_vol:
     SET_HANDLER(&CacheVC::scanVol);
     eventProcessor.schedule_in(this, HRTIME_MSECONDS(scan_msec_delay));
     return EVENT_CONT;
@@ -359,12 +362,11 @@ Lread:
     io.aiocb.aio_nbytes = vol->skip + vol->len - io.aiocb.aio_offset;
   offset = 0;
   ink_assert(ink_aio_read(&io) >= 0);
-  Debug("cache_scan_truss", "read %p:scanObject %" PRId64 " %zu", this,
-        (int64_t)io.aiocb.aio_offset, (size_t)io.aiocb.aio_nbytes);
+  Debug("cache_scan_truss", "read %p:scanObject %" PRId64 " %zu", this, (int64_t)io.aiocb.aio_offset, (size_t)io.aiocb.aio_nbytes);
   return EVENT_CONT;
 
 Ldone:
-   Debug("cache_scan_truss", "done %p:scanObject", this);
+  Debug("cache_scan_truss", "done %p:scanObject", this);
   _action.continuation->handleEvent(CACHE_EVENT_SCAN_DONE, result);
 #ifdef HTTP_CACHE
 Lcancel:
@@ -431,8 +433,8 @@ CacheVC::scanOpenWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     Debug("cache_scan", "got writer lock");
     Dir *l = NULL;
     Dir d;
-    Doc *doc = (Doc *) (buf->data() + offset);
-    offset = (char *) doc - buf->data() + vol->round_to_approx_size(doc->len);
+    Doc *doc = (Doc *)(buf->data() + offset);
+    offset = (char *)doc - buf->data() + vol->round_to_approx_size(doc->len);
     // if the doc contains some data, then we need to create
     // a new directory entry for this fragment. Remember the
     // offset and the key in earliest_key
@@ -494,4 +496,3 @@ CacheVC::scanUpdateDone(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     return EVENT_CONT;
   }
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheWrite.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 3861776..4e6319e 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -24,10 +24,10 @@
 
 #include "P_Cache.h"
 
-#define IS_POWER_2(_x) (!((_x)&((_x)-1)))
-#define UINT_WRAP_LTE(_x, _y) (((_y)-(_x)) < INT_MAX) // exploit overflow
-#define UINT_WRAP_GTE(_x, _y) (((_x)-(_y)) < INT_MAX) // exploit overflow
-#define UINT_WRAP_LT(_x, _y) (((_x)-(_y)) >= INT_MAX) // exploit overflow
+#define IS_POWER_2(_x) (!((_x) & ((_x)-1)))
+#define UINT_WRAP_LTE(_x, _y) (((_y) - (_x)) < INT_MAX) // exploit overflow
+#define UINT_WRAP_GTE(_x, _y) (((_x) - (_y)) < INT_MAX) // exploit overflow
+#define UINT_WRAP_LT(_x, _y) (((_x) - (_y)) >= INT_MAX) // exploit overflow
 
 // Given a key, finds the index of the alternate which matches
 // used to get the alternate which is actually present in the document
@@ -56,7 +56,7 @@ get_alternate_index(CacheHTTPInfoVector *cache_vector, CacheKey key)
 // of writing the vector even if the http state machine aborts.  This
 // makes it easier to handle situations where writers abort.
 int
-CacheVC::updateVector(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
+CacheVC::updateVector(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
   cancel_trigger();
   if (od->reading_vec || od->writing_vec)
@@ -71,7 +71,8 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
     if (f.update) {
       // all Update cases. Need to get the alternate index.
       alternate_index = get_alternate_index(write_vector, update_key);
-      Debug("cache_update", "updating alternate index %d frags %d", alternate_index, alternate_index >=0 ? write_vector->get(alternate_index)->get_frag_offset_count() : -1);
+      Debug("cache_update", "updating alternate index %d frags %d", alternate_index,
+            alternate_index >= 0 ? write_vector->get(alternate_index)->get_frag_offset_count() : -1);
       // if its an alternate delete
       if (!vec) {
         ink_assert(!total_len);
@@ -107,7 +108,7 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
     }
 
     if (od->move_resident_alt && first_buf._ptr() && !od->has_multiple_writers()) {
-      Doc *doc = (Doc *) first_buf->data();
+      Doc *doc = (Doc *)first_buf->data();
       int small_doc = (int64_t)doc->data_len() < (int64_t)cache_config_alt_rewrite_max_size;
       int have_res_alt = doc->key == od->single_doc_key;
       // if the new alternate is not written with the vector
@@ -125,8 +126,8 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
         od->move_resident_alt = 0;
         f.rewrite_resident_alt = 1;
         write_len = doc->data_len();
-        Debug("cache_update_alt",
-              "rewriting resident alt size: %d key: %X, first_key: %X", write_len, doc->key.slice32(0), first_key.slice32(0));
+        Debug("cache_update_alt", "rewriting resident alt size: %d key: %X, first_key: %X", write_len, doc->key.slice32(0),
+              first_key.slice32(0));
       }
     }
     header_len = write_vector->marshal_length();
@@ -176,7 +177,7 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
    */
 
 int
-CacheVC::handleWrite(int event, Event */* e ATS_UNUSED */)
+CacheVC::handleWrite(int event, Event * /* e ATS_UNUSED */)
 {
   // plain write case
   ink_assert(!trigger);
@@ -186,16 +187,13 @@ CacheVC::handleWrite(int event, Event */* e ATS_UNUSED */)
   POP_HANDLER;
   agg_len = vol->round_to_approx_size(write_len + header_len + frag_len + sizeofDoc);
   vol->agg_todo_size += agg_len;
-  bool agg_error =
-    (agg_len > AGG_SIZE || header_len + sizeofDoc > MAX_FRAG_SIZE ||
-     (!f.readers && (vol->agg_todo_size > cache_config_agg_write_backlog + AGG_SIZE) && write_len));
+  bool agg_error = (agg_len > AGG_SIZE || header_len + sizeofDoc > MAX_FRAG_SIZE ||
+                    (!f.readers && (vol->agg_todo_size > cache_config_agg_write_backlog + AGG_SIZE) && write_len));
 #ifdef CACHE_AGG_FAIL_RATE
-  agg_error = agg_error || ((uint32_t) mutex->thread_holding->generator.random() <
-                            (uint32_t) (UINT_MAX * CACHE_AGG_FAIL_RATE));
+  agg_error = agg_error || ((uint32_t)mutex->thread_holding->generator.random() < (uint32_t)(UINT_MAX * CACHE_AGG_FAIL_RATE));
 #endif
-  bool max_doc_error = (cache_config_max_doc_size &&
-                        (cache_config_max_doc_size < vio.ndone ||
-                         (vio.nbytes != INT64_MAX && (cache_config_max_doc_size < vio.nbytes))));
+  bool max_doc_error = (cache_config_max_doc_size && (cache_config_max_doc_size < vio.ndone ||
+                                                      (vio.nbytes != INT64_MAX && (cache_config_max_doc_size < vio.nbytes))));
 
   if (agg_error || max_doc_error) {
     CACHE_INCREMENT_DYN_STAT(cache_write_backlog_failure_stat);
@@ -255,14 +253,14 @@ Vol::force_evacuate_head(Dir *evac_dir, int pinned)
   if (!b) {
     b = new_EvacuationBlock(mutex->thread_holding);
     b->dir = *evac_dir;
-    DDebug("cache_evac", "force: %d, %d", (int) dir_offset(evac_dir), (int) dir_phase(evac_dir));
+    DDebug("cache_evac", "force: %d, %d", (int)dir_offset(evac_dir), (int)dir_phase(evac_dir));
     evacuate[dir_evac_bucket(evac_dir)].push(b);
   }
   b->f.pinned = pinned;
   b->f.evacuate_head = 1;
-  b->evac_frags.key = zero_key;  // ensure that the block gets
+  b->evac_frags.key = zero_key; // ensure that the block gets
   // evacuated no matter what
-  b->readers = 0;             // ensure that the block does not disappear
+  b->readers = 0; // ensure that the block does not disappear
   return b;
 }
 
@@ -286,7 +284,7 @@ Vol::scan_for_pinned_documents()
           if (before_end_of_vol || o >= (pe - vol_end_offset))
             continue;
         } else {
-          if (o<ps || o>= pe)
+          if (o < ps || o >= pe)
             continue;
         }
         force_evacuate_head(&dir[i], 1);
@@ -318,8 +316,8 @@ Vol::aggWriteDone(int event, Event *e)
     header->last_write_pos = header->write_pos;
     header->write_pos += io.aiocb.aio_nbytes;
     ink_assert(header->write_pos >= start);
-    DDebug("cache_agg", "Dir %s, Write: %" PRIu64 ", last Write: %" PRIu64 "\n",
-          hash_text.get(), header->write_pos, header->last_write_pos);
+    DDebug("cache_agg", "Dir %s, Write: %" PRIu64 ", last Write: %" PRIu64 "\n", hash_text.get(), header->write_pos,
+           header->last_write_pos);
     ink_assert(header->write_pos == header->agg_pos);
     if (header->write_pos + EVACUATION_SIZE > scan_pos)
       periodic_scan();
@@ -330,14 +328,13 @@ Vol::aggWriteDone(int event, Event *e)
     // for fragments is this aggregation buffer
     Debug("cache_disk_error", "Write error on disk %s\n \
               write range : [%" PRIu64 " - %" PRIu64 " bytes]  [%" PRIu64 " - %" PRIu64 " blocks] \n",
-          hash_text.get(), (uint64_t)io.aiocb.aio_offset,
-          (uint64_t)io.aiocb.aio_offset + io.aiocb.aio_nbytes,
+          hash_text.get(), (uint64_t)io.aiocb.aio_offset, (uint64_t)io.aiocb.aio_offset + io.aiocb.aio_nbytes,
           (uint64_t)io.aiocb.aio_offset / CACHE_BLOCK_SIZE,
           (uint64_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes) / CACHE_BLOCK_SIZE);
     Dir del_dir;
     dir_clear(&del_dir);
     for (int done = 0; done < agg_buf_pos;) {
-      Doc *doc = (Doc *) (agg_buffer + done);
+      Doc *doc = (Doc *)(agg_buffer + done);
       dir_set_offset(&del_dir, header->write_pos + done);
       dir_delete(&doc->key, this, &del_dir);
       done += round_to_approx_size(doc->len);
@@ -385,7 +382,7 @@ CacheVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */
   // The evacuator vc shares the lock with the volition mutex
   ink_assert(vol->mutex->thread_holding == this_ethread());
   cancel_trigger();
-  Doc *doc = (Doc *) buf->data();
+  Doc *doc = (Doc *)buf->data();
 #ifdef HTTP_CACHE
   CacheHTTPInfo *alternate_tmp = 0;
 #endif
@@ -411,8 +408,8 @@ CacheVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */
       goto Ldone;
     alternate_tmp = vector.get(alternate_index);
     doc_len = alternate_tmp->object_size_get();
-    Debug("cache_evac", "evacuateReadHead http earliest %X first: %X len: %" PRId64,
-          first_key.slice32(0), earliest_key.slice32(0), doc_len);
+    Debug("cache_evac", "evacuateReadHead http earliest %X first: %X len: %" PRId64, first_key.slice32(0), earliest_key.slice32(0),
+          doc_len);
   } else
 #endif
   {
@@ -422,8 +419,8 @@ CacheVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */
     if (!(next_key == earliest_key))
       goto Ldone;
     doc_len = doc->total_len;
-    DDebug("cache_evac",
-          "evacuateReadHead non-http earliest %X first: %X len: %" PRId64, first_key.slice32(0), earliest_key.slice32(0), doc_len);
+    DDebug("cache_evac", "evacuateReadHead non-http earliest %X first: %X len: %" PRId64, first_key.slice32(0),
+           earliest_key.slice32(0), doc_len);
   }
   if (doc_len == total_len) {
     // the whole document has been evacuated. Insert the directory
@@ -445,19 +442,17 @@ Ldone:
 }
 
 int
-CacheVC::evacuateDocDone(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
+CacheVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
   ink_assert(vol->mutex->thread_holding == this_ethread());
-  Doc *doc = (Doc *) buf->data();
-  DDebug("cache_evac", "evacuateDocDone %X o %d p %d new_o %d new_p %d",
-        (int) key.slice32(0), (int) dir_offset(&overwrite_dir),
-        (int) dir_phase(&overwrite_dir), (int) dir_offset(&dir), (int) dir_phase(&dir));
+  Doc *doc = (Doc *)buf->data();
+  DDebug("cache_evac", "evacuateDocDone %X o %d p %d new_o %d new_p %d", (int)key.slice32(0), (int)dir_offset(&overwrite_dir),
+         (int)dir_phase(&overwrite_dir), (int)dir_offset(&dir), (int)dir_phase(&dir));
   int i = dir_evac_bucket(&overwrite_dir);
   // nasty beeping race condition, need to have the EvacuationBlock here
   EvacuationBlock *b = vol->evacuate[i].head;
   for (; b; b = b->link.next) {
     if (dir_offset(&b->dir) == dir_offset(&overwrite_dir)) {
-
       // If the document is single fragment (although not tied to the vector),
       // then we don't have to put the directory entry in the lookaside
       // buffer. But, we have no way of finding out if the document is
@@ -468,13 +463,13 @@ CacheVC::evacuateDocDone(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
       if (!dir_head(&overwrite_dir)) {
         // find the earliest key
         EvacuationKey *evac = &b->evac_frags;
-        for (; evac && !(evac->key == doc->key); evac = evac->link.next);
+        for (; evac && !(evac->key == doc->key); evac = evac->link.next)
+          ;
         ink_assert(evac);
         if (!evac)
           break;
         if (evac->earliest_key.fold()) {
-          DDebug("cache_evac", "evacdocdone: evacuating key %X earliest %X",
-                evac->key.slice32(0), evac->earliest_key.slice32(0));
+          DDebug("cache_evac", "evacdocdone: evacuating key %X earliest %X", evac->key.slice32(0), evac->earliest_key.slice32(0));
           EvacuationBlock *eblock = 0;
           Dir dir_tmp;
           dir_lookaside_probe(&evac->earliest_key, vol, &dir_tmp, &eblock);
@@ -495,27 +490,24 @@ CacheVC::evacuateDocDone(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
       // Cache::open_write). Once we know its the vector, we can
       // safely overwrite the first_key in the directory.
       if (dir_head(&overwrite_dir) && b->f.evacuate_head) {
-        DDebug("cache_evac",
-              "evacuateDocDone evacuate_head %X %X hlen %d offset %d",
-              (int) key.slice32(0), (int) doc->key.slice32(0), doc->hlen, (int) dir_offset(&overwrite_dir));
+        DDebug("cache_evac", "evacuateDocDone evacuate_head %X %X hlen %d offset %d", (int)key.slice32(0), (int)doc->key.slice32(0),
+               doc->hlen, (int)dir_offset(&overwrite_dir));
 
         if (dir_compare_tag(&overwrite_dir, &doc->first_key)) {
           OpenDirEntry *cod;
-          DDebug("cache_evac", "evacuating vector: %X %d",
-                (int) doc->first_key.slice32(0), (int) dir_offset(&overwrite_dir));
+          DDebug("cache_evac", "evacuating vector: %X %d", (int)doc->first_key.slice32(0), (int)dir_offset(&overwrite_dir));
           if ((cod = vol->open_read(&doc->first_key))) {
             // writer  exists
-            DDebug("cache_evac", "overwriting the open directory %X %d %d",
-                  (int) doc->first_key.slice32(0), (int) dir_offset(&cod->first_dir), (int) dir_offset(&dir));
+            DDebug("cache_evac", "overwriting the open directory %X %d %d", (int)doc->first_key.slice32(0),
+                   (int)dir_offset(&cod->first_dir), (int)dir_offset(&dir));
             cod->first_dir = dir;
-
           }
           if (dir_overwrite(&doc->first_key, vol, &dir, &overwrite_dir)) {
             int64_t o = dir_offset(&overwrite_dir), n = dir_offset(&dir);
             vol->ram_cache->fixup(&doc->first_key, (uint32_t)(o >> 32), (uint32_t)o, (uint32_t)(n >> 32), (uint32_t)n);
           }
         } else {
-          DDebug("cache_evac", "evacuating earliest: %X %d", (int) doc->key.slice32(0), (int) dir_offset(&overwrite_dir));
+          DDebug("cache_evac", "evacuating earliest: %X %d", (int)doc->key.slice32(0), (int)dir_offset(&overwrite_dir));
           ink_assert(dir_compare_tag(&overwrite_dir, &doc->key));
           ink_assert(b->earliest_evacuator == this);
           total_len += doc->data_len();
@@ -550,7 +542,7 @@ evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Vol *vol)
 #if TS_USE_INTERIM_CACHE == 1
         || dir_ininterim(&dir)
 #endif
-        )
+          )
       continue;
     EvacuationBlock *b = evacuation_block_exists(&dir, vol);
     if (!b) {
@@ -571,9 +563,8 @@ evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Vol *vol)
     }
     if (force)
       b->readers = 0;
-    DDebug("cache_evac",
-          "next fragment %X Earliest: %X offset %d phase %d force %d",
-          (int) key->slice32(0), (int) earliest_key->slice32(0), (int) dir_offset(&dir), (int) dir_phase(&dir), force);
+    DDebug("cache_evac", "next fragment %X Earliest: %X offset %d phase %d force %d", (int)key->slice32(0),
+           (int)earliest_key->slice32(0), (int)dir_offset(&dir), (int)dir_phase(&dir), force);
   }
   return i;
 }
@@ -586,9 +577,9 @@ Vol::evacuateWrite(CacheVC *evacuator, int event, Event *e)
   evacuator->agg_len = round_to_approx_size(((Doc *)evacuator->buf->data())->len);
   agg_todo_size += evacuator->agg_len;
   /* insert the evacuator after all the other evacuators */
-  CacheVC *cur = (CacheVC *) agg.head;
+  CacheVC *cur = (CacheVC *)agg.head;
   CacheVC *after = NULL;
-  for (; cur && cur->f.evacuator; cur = (CacheVC *) cur->link.next)
+  for (; cur && cur->f.evacuator; cur = (CacheVC *)cur->link.next)
     after = cur;
   ink_assert(evacuator->agg_len <= AGG_SIZE);
   agg.insert(evacuator, after);
@@ -604,17 +595,17 @@ Vol::evacuateDocReadDone(int event, Event *e)
   ink_assert(is_io_in_progress());
   set_io_not_in_progress();
   ink_assert(mutex->thread_holding == this_ethread());
-  Doc *doc = (Doc *) doc_evacuator->buf->data();
+  Doc *doc = (Doc *)doc_evacuator->buf->data();
   CacheKey next_key;
   EvacuationBlock *b = NULL;
   if (doc->magic != DOC_MAGIC) {
-    Debug("cache_evac", "DOC magic: %X %d",
-          (int) dir_tag(&doc_evacuator->overwrite_dir), (int) dir_offset(&doc_evacuator->overwrite_dir));
+    Debug("cache_evac", "DOC magic: %X %d", (int)dir_tag(&doc_evacuator->overwrite_dir),
+          (int)dir_offset(&doc_evacuator->overwrite_dir));
     ink_assert(doc->magic == DOC_MAGIC);
     goto Ldone;
   }
-  DDebug("cache_evac", "evacuateDocReadDone %X offset %d",
-        (int) doc->key.slice32(0), (int) dir_offset(&doc_evacuator->overwrite_dir));
+  DDebug("cache_evac", "evacuateDocReadDone %X offset %d", (int)doc->key.slice32(0),
+         (int)dir_offset(&doc_evacuator->overwrite_dir));
 
   b = evacuate[dir_evac_bucket(&doc_evacuator->overwrite_dir)].head;
   while (b) {
@@ -624,7 +615,7 @@ Vol::evacuateDocReadDone(int event, Event *e)
   }
   if (!b)
     goto Ldone;
-  if ((b->f.pinned && !b->readers) && doc->pinned < (uint32_t) (ink_get_based_hrtime() / HRTIME_SECOND))
+  if ((b->f.pinned && !b->readers) && doc->pinned < (uint32_t)(ink_get_based_hrtime() / HRTIME_SECOND))
     goto Ldone;
 
   if (dir_head(&b->dir) && b->f.evacuate_head) {
@@ -634,8 +625,8 @@ Vol::evacuateDocReadDone(int event, Event *e)
     if (dir_compare_tag(&b->dir, &doc->first_key)) {
       doc_evacuator->key = doc->first_key;
       b->evac_frags.key = doc->first_key;
-      DDebug("cache_evac", "evacuating vector %X offset %d",
-            (int) doc->first_key.slice32(0), (int) dir_offset(&doc_evacuator->overwrite_dir));
+      DDebug("cache_evac", "evacuating vector %X offset %d", (int)doc->first_key.slice32(0),
+             (int)dir_offset(&doc_evacuator->overwrite_dir));
       b->f.unused = 57;
     } else {
       // if its an earliest fragment (alternate) evacuation, things get
@@ -647,23 +638,22 @@ Vol::evacuateDocReadDone(int event, Event *e)
       b->evac_frags.key = doc->key;
       b->evac_frags.earliest_key = doc->key;
       b->earliest_evacuator = doc_evacuator;
-      DDebug("cache_evac", "evacuating earliest %X %X evac: %p offset: %d",
-            (int) b->evac_frags.key.slice32(0), (int) doc->key.slice32(0),
-            doc_evacuator, (int) dir_offset(&doc_evacuator->overwrite_dir));
+      DDebug("cache_evac", "evacuating earliest %X %X evac: %p offset: %d", (int)b->evac_frags.key.slice32(0),
+             (int)doc->key.slice32(0), doc_evacuator, (int)dir_offset(&doc_evacuator->overwrite_dir));
       b->f.unused = 67;
     }
   } else {
     // find which key matches the document
     EvacuationKey *ek = &b->evac_frags;
-    for (; ek && !(ek->key == doc->key); ek = ek->link.next);
+    for (; ek && !(ek->key == doc->key); ek = ek->link.next)
+      ;
     if (!ek) {
       b->f.unused = 77;
       goto Ldone;
     }
     doc_evacuator->key = ek->key;
     doc_evacuator->earliest_key = ek->earliest_key;
-    DDebug("cache_evac", "evacuateDocReadDone key: %X earliest: %X",
-          (int) ek->key.slice32(0), (int) ek->earliest_key.slice32(0));
+    DDebug("cache_evac", "evacuateDocReadDone key: %X earliest: %X", (int)ek->key.slice32(0), (int)ek->earliest_key.slice32(0));
     b->f.unused = 87;
   }
   // if the tag in the c->dir does match the first_key in the
@@ -732,7 +722,7 @@ agg_copy(char *p, CacheVC *vc)
   off_t o = vol->header->write_pos + vol->agg_buf_pos;
 
   if (!vc->f.evacuator) {
-    Doc *doc = (Doc *) p;
+    Doc *doc = (Doc *)p;
     IOBufferBlock *res_alt_blk = 0;
 
     uint32_t len = vc->write_len + vc->header_len + vc->frag_len + sizeofDoc;
@@ -762,7 +752,7 @@ agg_copy(char *p, CacheVC *vc)
     doc->checksum = DOC_NO_CHECKSUM;
     if (vc->pin_in_cache) {
       dir_set_pinned(&vc->dir, 1);
-      doc->pinned = (uint32_t) (ink_get_based_hrtime() / HRTIME_SECOND) + vc->pin_in_cache;
+      doc->pinned = (uint32_t)(ink_get_based_hrtime() / HRTIME_SECOND) + vc->pin_in_cache;
     } else {
       dir_set_pinned(&vc->dir, 0);
       doc->pinned = 0;
@@ -771,9 +761,9 @@ agg_copy(char *p, CacheVC *vc)
     if (vc->f.use_first_key) {
       if (doc->data_len()
 #ifdef HTTP_CACHE
-                  || vc->f.allow_empty_doc
+          || vc->f.allow_empty_doc
 #endif
-                  )
+          )
         doc->key = vc->earliest_key;
       else // the vector is being written by itself
         prev_CacheKey(&doc->key, &vc->earliest_key);
@@ -786,7 +776,7 @@ agg_copy(char *p, CacheVC *vc)
 #ifdef HTTP_CACHE
     if (vc->f.rewrite_resident_alt) {
       ink_assert(vc->f.use_first_key);
-      Doc *res_doc = (Doc *) vc->first_buf->data();
+      Doc *res_doc = (Doc *)vc->first_buf->data();
       res_alt_blk = new_IOBufferBlock(vc->first_buf, res_doc->data_len(), sizeofDoc + res_doc->hlen);
       doc->key = res_doc->key;
       doc->total_len = res_doc->data_len();
@@ -809,7 +799,7 @@ agg_copy(char *p, CacheVC *vc)
           CacheHTTPInfo *http_info = vc->write_vector->get(vc->alternate_index);
           http_info->object_size_set(vc->total_len);
         }
-        ink_assert(!(((uintptr_t) &doc->hdr()[0]) & HDR_PTR_ALIGNMENT_MASK));
+        ink_assert(!(((uintptr_t)&doc->hdr()[0]) & HDR_PTR_ALIGNMENT_MASK));
         ink_assert(vc->header_len == vc->write_vector->marshal(doc->hdr(), vc->header_len));
       } else
 #endif
@@ -842,11 +832,10 @@ agg_copy(char *p, CacheVC *vc)
         ink_assert(!memcmp(doc->hdr(), x, ib - (x - xx)));
       }
 #endif
-
     }
     if (cache_config_enable_checksum) {
       doc->checksum = 0;
-      for (char *b = doc->hdr(); b < (char *) doc + doc->len; b++)
+      for (char *b = doc->hdr(); b < (char *)doc + doc->len; b++)
         doc->checksum += *b;
     }
     if (vc->frag_type == CACHE_FRAG_TYPE_HTTP && vc->f.single_fragment)
@@ -858,7 +847,7 @@ agg_copy(char *p, CacheVC *vc)
     return vc->agg_len;
   } else {
     // for evacuated documents, copy the data, and update directory
-    Doc *doc = (Doc *) vc->buf->data();
+    Doc *doc = (Doc *)vc->buf->data();
     int l = vc->vol->round_to_approx_size(doc->len);
     {
       ProxyMutex *mutex ATS_UNUSED = vc->vol->mutex;
@@ -887,13 +876,10 @@ Vol::evacuate_cleanup_blocks(int i)
 {
   EvacuationBlock *b = evacuate[i].head;
   while (b) {
-    if (b->f.done &&
-        ((header->phase != dir_phase(&b->dir) &&
-          header->write_pos > vol_offset(this, &b->dir)) ||
-         (header->phase == dir_phase(&b->dir) && header->write_pos <= vol_offset(this, &b->dir)))) {
+    if (b->f.done && ((header->phase != dir_phase(&b->dir) && header->write_pos > vol_offset(this, &b->dir)) ||
+                      (header->phase == dir_phase(&b->dir) && header->write_pos <= vol_offset(this, &b->dir)))) {
       EvacuationBlock *x = b;
-      DDebug("cache_evac", "evacuate cleanup free %X offset %d",
-            (int) b->evac_frags.key.slice32(0), (int) dir_offset(&b->dir));
+      DDebug("cache_evac", "evacuate cleanup free %X offset %d", (int)b->evac_frags.key.slice32(0), (int)dir_offset(&b->dir));
       b = b->link.next;
       evacuate[i].remove(x);
       free_EvacuationBlock(x, mutex->thread_holding);
@@ -950,7 +936,7 @@ Vol::agg_wrap()
   dir_lookaside_cleanup(this);
   dir_clean_vol(this);
   {
-    Vol* vol = this;
+    Vol *vol = this;
     CACHE_INCREMENT_DYN_STAT(cache_directory_wrap_stat);
   }
   periodic_scan();
@@ -964,7 +950,7 @@ Vol::agg_wrap()
    the eventProcessor to schedule events
 */
 int
-Vol::aggWrite(int event, void */* e ATS_UNUSED */)
+Vol::aggWrite(int event, void * /* e ATS_UNUSED */)
 {
   ink_assert(!is_io_in_progress());
 
@@ -975,15 +961,13 @@ Vol::aggWrite(int event, void */* e ATS_UNUSED */)
 
 Lagain:
   // calculate length of aggregated write
-  for (c = (CacheVC *) agg.head; c;) {
+  for (c = (CacheVC *)agg.head; c;) {
     int writelen = c->agg_len;
     // [amc] this is checked multiple places, on here was it strictly less.
     ink_assert(writelen <= AGG_SIZE);
-    if (agg_buf_pos + writelen > AGG_SIZE ||
-        header->write_pos + agg_buf_pos + writelen > (skip + len))
+    if (agg_buf_pos + writelen > AGG_SIZE || header->write_pos + agg_buf_pos + writelen > (skip + len))
       break;
-    DDebug("agg_read", "copying: %d, %" PRIu64 ", key: %d",
-          agg_buf_pos, header->write_pos + agg_buf_pos, c->first_key.slice32(0));
+    DDebug("agg_read", "copying: %d, %" PRIu64 ", key: %d", agg_buf_pos, header->write_pos + agg_buf_pos, c->first_key.slice32(0));
     int wrotelen = agg_copy(agg_buffer + agg_buf_pos, c);
     ink_assert(writelen == wrotelen);
     agg_todo_size -= writelen;
@@ -993,7 +977,7 @@ Lagain:
     if (c->f.sync && c->f.use_first_key) {
       CacheVC *last = sync.tail;
       while (last && UINT_WRAP_LT(c->write_serial, last->write_serial))
-        last = (CacheVC*)last->link.prev;
+        last = (CacheVC *)last->link.prev;
       sync.insert(c, last);
     } else if (c->f.evacuator)
       c->handleEvent(AIO_EVENT_DONE, 0);
@@ -1045,7 +1029,7 @@ Lagain:
     ink_assert(sync.head);
     int l = round_to_approx_size(sizeof(Doc));
     agg_buf_pos = l;
-    Doc *d = (Doc*)agg_buffer;
+    Doc *d = (Doc *)agg_buffer;
     memset(d, 0, sizeof(Doc));
     d->magic = DOC_MAGIC;
     d->len = l;
@@ -1084,7 +1068,7 @@ Lwait:
 }
 
 int
-CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
+CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
   cancel_trigger();
   {
@@ -1101,15 +1085,15 @@ CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */
   if (is_debug_tag_set("cache_update")) {
     if (f.update && closed > 0) {
       if (!total_len && alternate_index != CACHE_ALT_REMOVED) {
-        Debug("cache_update", "header only %d (%" PRIu64 ", %" PRIu64 ")\n",
-              DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0], update_key.b[1]);
+        Debug("cache_update", "header only %d (%" PRIu64 ", %" PRIu64 ")\n", DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0],
+              update_key.b[1]);
 
       } else if (total_len && alternate_index != CACHE_ALT_REMOVED) {
         Debug("cache_update", "header body, %d, (%" PRIu64 ", %" PRIu64 "), (%" PRIu64 ", %" PRIu64 ")\n",
               DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0], update_key.b[1], earliest_key.b[0], earliest_key.b[1]);
       } else if (!total_len && alternate_index == CACHE_ALT_REMOVED) {
-        Debug("cache_update", "alt delete, %d, (%" PRIu64 ", %" PRIu64 ")\n",
-              DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0], update_key.b[1]);
+        Debug("cache_update", "alt delete, %d, (%" PRIu64 ", %" PRIu64 ")\n", DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0],
+              update_key.b[1]);
       }
     }
   }
@@ -1120,20 +1104,26 @@ CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */
   // size of the document
   if ((closed == 1) && (total_len > 0
 #ifdef HTTP_CACHE
-                  || f.allow_empty_doc
+                        || f.allow_empty_doc
 #endif
-                  )) {
+                        )) {
     DDebug("cache_stats", "Fragment = %d", fragment);
     switch (fragment) {
-      case 0: CACHE_INCREMENT_DYN_STAT(cache_single_fragment_document_count_stat); break;
-      case 1: CACHE_INCREMENT_DYN_STAT(cache_two_fragment_document_count_stat); break;
-      default: CACHE_INCREMENT_DYN_STAT(cache_three_plus_plus_fragment_document_count_stat); break;
+    case 0:
+      CACHE_INCREMENT_DYN_STAT(cache_single_fragment_document_count_stat);
+      break;
+    case 1:
+      CACHE_INCREMENT_DYN_STAT(cache_two_fragment_document_count_stat);
+      break;
+    default:
+      CACHE_INCREMENT_DYN_STAT(cache_three_plus_plus_fragment_document_count_stat);
+      break;
     }
   }
   if (f.close_complete) {
     recursive++;
     ink_assert(!vol || this_ethread() != vol->mutex->thread_holding);
-    vio._cont->handleEvent(VC_EVENT_WRITE_COMPLETE, (void *) &vio);
+    vio._cont->handleEvent(VC_EVENT_WRITE_COMPLETE, (void *)&vio);
     recursive--;
   }
   return free_CacheVC(this);
@@ -1270,9 +1260,9 @@ CacheVC::openWriteClose(int event, Event *e)
   }
   if (closed > 0
 #ifdef HTTP_CACHE
-                  || f.allow_empty_doc
+      || f.allow_empty_doc
 #endif
-                  ) {
+      ) {
     if (total_len == 0) {
 #ifdef HTTP_CACHE
       if (f.update || f.allow_empty_doc) {
@@ -1305,9 +1295,8 @@ CacheVC::openWriteWriteDone(int event, Event *e)
   cancel_trigger();
   if (event == AIO_EVENT_DONE)
     set_io_not_in_progress();
-  else
-    if (is_io_in_progress())
-      return EVENT_CONT;
+  else if (is_io_in_progress())
+    return EVENT_CONT;
   // In the event of VC_EVENT_ERROR, the cont must do an io_close
   if (!io.ok()) {
     if (closed) {
@@ -1347,12 +1336,14 @@ CacheVC::openWriteWriteDone(int event, Event *e)
   return openWriteMain(event, e);
 }
 
-static inline int target_fragment_size() {
+static inline int
+target_fragment_size()
+{
   return cache_config_target_fragment_size - sizeofDoc;
 }
 
 int
-CacheVC::openWriteMain(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
+CacheVC::openWriteMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
   cancel_trigger();
   int called_user = 0;
@@ -1394,8 +1385,7 @@ Lagain:
     total_len += avail;
   }
   length = (uint64_t)towrite;
-  if (length > target_fragment_size() &&
-      (length < target_fragment_size() + target_fragment_size() / 4))
+  if (length > target_fragment_size() && (length < target_fragment_size() + target_fragment_size() / 4))
     write_len = target_fragment_size();
   else
     write_len = length;
@@ -1435,25 +1425,24 @@ CacheVC::openWriteOverwrite(int event, Event *e)
       return openWriteCloseDir(event, e);
     if (!io.ok())
       goto Ldone;
-    doc = (Doc *) buf->data();
+    doc = (Doc *)buf->data();
     if (!(doc->first_key == first_key))
       goto Lcollision;
     od->first_dir = dir;
     first_buf = buf;
     goto Ldone;
   }
-Lcollision:
-  {
-    CACHE_TRY_LOCK(lock, vol->mutex, this_ethread());
-    if (!lock.is_locked())
-      VC_LOCK_RETRY_EVENT();
-    int res = dir_probe(&first_key, vol, &dir, &last_collision);
-    if (res > 0) {
-      if ((res = do_read_call(&first_key)) == EVENT_RETURN)
-        goto Lcallreturn;
-      return res;
-    }
+Lcollision : {
+  CACHE_TRY_LOCK(lock, vol->mutex, this_ethread());
+  if (!lock.is_locked())
+    VC_LOCK_RETRY_EVENT();
+  int res = dir_probe(&first_key, vol, &dir, &last_collision);
+  if (res > 0) {
+    if ((res = do_read_call(&first_key)) == EVENT_RETURN)
+      goto Lcallreturn;
+    return res;
   }
+}
 Ldone:
   SET_HANDLER(&CacheVC::openWriteMain);
   return callcont(CACHE_EVENT_OPEN_WRITE);
@@ -1482,8 +1471,8 @@ CacheVC::openWriteStartDone(int event, Event *e)
     if (_action.cancelled && (!od || !od->has_multiple_writers()))
       goto Lcancel;
 
-    if (event == AIO_EVENT_DONE) {        // vector read done
-      Doc *doc = (Doc *) buf->data();
+    if (event == AIO_EVENT_DONE) { // vector read done
+      Doc *doc = (Doc *)buf->data();
       if (!io.ok()) {
         err = ECACHE_READ_FAIL;
         goto Lfailure;
@@ -1495,8 +1484,7 @@ CacheVC::openWriteStartDone(int event, Event *e)
          to NULL.
        */
       if (!dir_valid(vol, &dir)) {
-        DDebug("cache_write",
-               "OpenReadStartDone: Dir not valid: Write Head: %" PRId64 ", Dir: %" PRId64,
+        DDebug("cache_write", "OpenReadStartDone: Dir not valid: Write Head: %" PRId64 ", Dir: %" PRId64,
                (int64_t)offset_to_vol_offset(vol, vol->header->write_pos), dir_offset(&dir));
         last_collision = NULL;
         goto Lcollision;
@@ -1504,8 +1492,7 @@ CacheVC::openWriteStartDone(int event, Event *e)
       if (!(doc->first_key == first_key))
         goto Lcollision;
 
-      if (doc->magic != DOC_MAGIC || !doc->hlen ||
-          this->load_http_info(write_vector, doc, buf) != doc->hlen) {
+      if (doc->magic != DOC_MAGIC || !doc->hlen || this->load_http_info(write_vector, doc, buf) != doc->hlen) {
         err = ECACHE_BAD_META_DATA;
 #if TS_USE_INTERIM_CACHE == 1
         if (dir_ininterim(&dir)) {
@@ -1518,7 +1505,7 @@ CacheVC::openWriteStartDone(int event, Event *e)
       }
       ink_assert(write_vector->count() > 0);
 #if TS_USE_INTERIM_CACHE == 1
-Lagain:
+    Lagain:
       if (dir_ininterim(&dir)) {
         dir_delete(&first_key, vol, &dir);
         last_collision = NULL;
@@ -1545,11 +1532,10 @@ Lagain:
       goto Lsuccess;
     }
 
-Lcollision:
-    int if_writers = ((uintptr_t) info == CACHE_ALLOW_MULTIPLE_WRITES);
+  Lcollision:
+    int if_writers = ((uintptr_t)info == CACHE_ALLOW_MULTIPLE_WRITES);
     if (!od) {
-      if ((err = vol->open_write(
-                this, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0)
+      if ((err = vol->open_write(this, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0)
         goto Lfailure;
       if (od->has_multiple_writers()) {
         MUTEX_RELEASE(lock);
@@ -1579,7 +1565,7 @@ Lsuccess:
 
 Lfailure:
   CACHE_INCREMENT_DYN_STAT(base_stat + CACHE_STAT_FAILURE);
-  _action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -err);
+  _action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-err);
 Lcancel:
   if (od) {
     od->reading_vec = 0;
@@ -1593,7 +1579,7 @@ Lcallreturn:
 
 // handle lock failures from main Cache::open_write entry points below
 int
-CacheVC::openWriteStartBegin(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
+CacheVC::openWriteStartBegin(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
   intptr_t err;
   cancel_trigger();
@@ -1602,7 +1588,7 @@ CacheVC::openWriteStartBegin(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED
   if (((err = vol->open_write_lock(this, false, 1)) > 0)) {
     CACHE_INCREMENT_DYN_STAT(base_stat + CACHE_STAT_FAILURE);
     free_CacheVC(this);
-    _action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -err);
+    _action.continuation->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-err);
     return EVENT_DONE;
   }
   if (err < 0)
@@ -1619,12 +1605,11 @@ CacheVC::openWriteStartBegin(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED
 
 // main entry point for writing of of non-http documents
 Action *
-Cache::open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type,
-                  int options, time_t apin_in_cache, char *hostname, int host_len)
+Cache::open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type, int options, time_t apin_in_cache, char *hostname,
+                  int host_len)
 {
-
   if (!CacheProcessor::IsCacheReady(frag_type)) {
-    cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
+    cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
 
@@ -1658,12 +1643,12 @@ Cache::open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type,
   c->f.overwrite = (options & CACHE_WRITE_OPT_OVERWRITE) != 0;
   c->f.close_complete = (options & CACHE_WRITE_OPT_CLOSE_COMPLETE) != 0;
   c->f.sync = (options & CACHE_WRITE_OPT_SYNC) == CACHE_WRITE_OPT_SYNC;
-  c->pin_in_cache = (uint32_t) apin_in_cache;
+  c->pin_in_cache = (uint32_t)apin_in_cache;
 
   if ((res = c->vol->open_write_lock(c, false, 1)) > 0) {
     // document currently being written, abort
     CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_FAILURE);
-    cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -res);
+    cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-res);
     free_CacheVC(c);
     return ACTION_RESULT_DONE;
   }
@@ -1688,17 +1673,17 @@ Cache::open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type,
 #ifdef HTTP_CACHE
 // main entry point for writing of http documents
 Action *
-Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache,
-                  CacheKey */* key1 ATS_UNUSED */, CacheFragType type, char *hostname, int host_len)
+Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache, CacheKey * /* key1 ATS_UNUSED */,
+                  CacheFragType type, char *hostname, int host_len)
 {
   if (!CacheProcessor::IsCacheReady(type)) {
-    cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
+    cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
 
   ink_assert(caches[type] == this);
   intptr_t err = 0;
-  int if_writers = (uintptr_t) info == CACHE_ALLOW_MULTIPLE_WRITES;
+  int if_writers = (uintptr_t)info == CACHE_ALLOW_MULTIPLE_WRITES;
   CacheVC *c = new_CacheVC(cont);
   ProxyMutex *mutex = cont->mutex;
   c->vio.op = VIO::WRITE;
@@ -1712,14 +1697,13 @@ Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t
    */
   do {
     rand_CacheKey(&c->key, cont->mutex);
-  }
-  while (DIR_MASK_TAG(c->key.slice32(2)) == DIR_MASK_TAG(c->first_key.slice32(2)));
+  } while (DIR_MASK_TAG(c->key.slice32(2)) == DIR_MASK_TAG(c->first_key.slice32(2)));
   c->earliest_key = c->key;
   c->frag_type = CACHE_FRAG_TYPE_HTTP;
   c->vol = key_to_vol(key, hostname, host_len);
   Vol *vol = c->vol;
   c->info = info;
-  if (c->info && (uintptr_t) info != CACHE_ALLOW_MULTIPLE_WRITES) {
+  if (c->info && (uintptr_t)info != CACHE_ALLOW_MULTIPLE_WRITES) {
     /*
        Update has the following code paths :
        a) Update alternate header only :
@@ -1758,13 +1742,12 @@ Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t
   } else
     c->base_stat = cache_write_active_stat;
   CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
-  c->pin_in_cache = (uint32_t) apin_in_cache;
+  c->pin_in_cache = (uint32_t)apin_in_cache;
 
   {
     CACHE_TRY_LOCK(lock, c->vol->mutex, cont->mutex->thread_holding);
     if (lock.is_locked()) {
-      if ((err = c->vol->open_write(c, if_writers,
-                                     cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0)
+      if ((err = c->vol->open_write(c, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0)
         goto Lfailure;
       // If there are multiple writers, then this one cannot be an update.
       // Only the first writer can do an update. If that's the case, we can
@@ -1785,9 +1768,12 @@ Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t
         // document exists, read vector
         SET_CONTINUATION_HANDLER(c, &CacheVC::openWriteStartDone);
         switch (c->do_read_call(&c->first_key)) {
-          case EVENT_DONE: return ACTION_RESULT_DONE;
-          case EVENT_RETURN: goto Lcallreturn;
-          default: return &c->_action;
+        case EVENT_DONE:
+          return ACTION_RESULT_DONE;
+        case EVENT_RETURN:
+          goto Lcallreturn;
+        default:
+          return &c->_action;
         }
       }
     }
@@ -1804,7 +1790,7 @@ Lmiss:
 
 Lfailure:
   CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_FAILURE);
-  cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -err);
+  cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *)-err);
   if (c->od) {
     c->openWriteCloseDir(EVENT_IMMEDIATE, 0);
     return ACTION_RESULT_DONE;
@@ -1826,18 +1812,16 @@ InterimCacheVol::aggWrite(int /* event ATS_UNUSED */, void * /* ATS_UNUSED e */)
   MigrateToInterimCache *mts;
   Doc *doc;
   uint64_t old_off, new_off;
-  ink_assert(this_ethread() == mutex.m_ptr->thread_holding
-      && vol->mutex.m_ptr == mutex.m_ptr);
+  ink_assert(this_ethread() == mutex.m_ptr->thread_holding && vol->mutex.m_ptr == mutex.m_ptr);
 Lagain:
 
   while ((mts = agg.head) != NULL) {
-    doc = (Doc *) mts->buf->data();
+    doc = (Doc *)mts->buf->data();
     uint32_t agg_len = dir_approx_size(&mts->dir);
     ink_assert(agg_len == mts->agg_len);
     ink_assert(agg_len <= AGG_SIZE && agg_buf_pos <= AGG_SIZE);
 
-    if (agg_buf_pos + agg_len > AGG_SIZE
-        || header->agg_pos + agg_len > (skip + len))
+    if (agg_buf_pos + agg_len > AGG_SIZE || header->agg_pos + agg_len > (skip + len))
       break;
     mts = agg.dequeue();
 
@@ -1864,12 +1848,13 @@ Lagain:
         dir_overwrite(&mts->key, vol, &mts->dir, &old_dir);
       else
         dir_insert(&mts->key, vol, &mts->dir);
-      DDebug("cache_insert", "InterimCache: WriteDone: key: %X, first_key: %X, write_len: %d, write_offset: %" PRId64 ", dir_last_word: %X",
-          doc->key.slice32(0), doc->first_key.slice32(0), mts->agg_len, o, mts->dir.w[4]);
+      DDebug("cache_insert",
+             "InterimCache: WriteDone: key: %X, first_key: %X, write_len: %d, write_offset: %" PRId64 ", dir_last_word: %X",
+             doc->key.slice32(0), doc->first_key.slice32(0), mts->agg_len, o, mts->dir.w[4]);
 
       if (mts->copy) {
-        mts->interim_vol->vol->ram_cache->fixup(&mts->key, (uint32_t)(old_off >> 32), (uint32_t)old_off,
-            (uint32_t)(new_off >> 32), (uint32_t)new_off);
+        mts->interim_vol->vol->ram_cache->fixup(&mts->key, (uint32_t)(old_off >> 32), (uint32_t)old_off, (uint32_t)(new_off >> 32),
+                                                (uint32_t)new_off);
       } else {
         mts->vc->f.ram_fixup = 1;
         mts->vc->dir_off = new_off;
@@ -1895,14 +1880,13 @@ Lagain:
     return EVENT_CONT;
   }
 
-  if (agg.head == NULL && agg_buf_pos < (AGG_SIZE / 2) && !sync
-      && header->write_pos + AGG_SIZE <= (skip + len))
+  if (agg.head == NULL && agg_buf_pos < (AGG_SIZE / 2) && !sync && header->write_pos + AGG_SIZE <= (skip + len))
     return EVENT_CONT;
 
   for (mts = agg.head; mts != NULL; mts = mts->link.next) {
     if (!mts->copy) {
       Ptr<IOBufferData> buf = mts->buf;
-      doc = (Doc *) buf->data();
+      doc = (Doc *)buf->data();
       mts->buf = new_IOBufferData(iobuffer_size_to_index(mts->agg_len, MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
       mts->copy = true;
       memcpy(mts->buf->data(), buf->data(), doc->len);
@@ -1930,42 +1914,40 @@ Lagain:
 int
 InterimCacheVol::aggWriteDone(int event, void *e)
 {
-  ink_release_assert(this_ethread() == mutex.m_ptr->thread_holding
-        && vol->mutex.m_ptr == mutex.m_ptr);
+  ink_release_assert(this_ethread() == mutex.m_ptr->thread_holding && vol->mutex.m_ptr == mutex.m_ptr);
   if (io.ok()) {
-     header->last_write_pos = header->write_pos;
-     header->write_pos += io.aiocb.aio_nbytes;
-     ink_assert(header->write_pos >= start);
-     DDebug("cache_agg", "Write: %" PRIu64 ", last Write: %" PRIu64 "\n",
-           header->write_pos, header->last_write_pos);
-     ink_assert(header->write_pos == header->agg_pos);
-     agg_buf_pos = 0;
-     header->write_serial++;
-   } else {
-     // delete all the directory entries that we inserted
-     // for fragments is this aggregation buffer
-     Debug("cache_disk_error", "Write error on disk %s\n \
+    header->last_write_pos = header->write_pos;
+    header->write_pos += io.aiocb.aio_nbytes;
+    ink_assert(header->write_pos >= start);
+    DDebug("cache_agg", "Write: %" PRIu64 ", last Write: %" PRIu64 "\n", header->write_pos, header->last_write_pos);
+    ink_assert(header->write_pos == header->agg_pos);
+    agg_buf_pos = 0;
+    header->write_serial++;
+  } else {
+    // delete all the directory entries that we inserted
+    // for fragments is this aggregation buffer
+    Debug("cache_disk_error", "Write error on disk %s\n \
                write range : [%" PRIu64 " - %" PRIu64 " bytes]  [%" PRIu64 " - %" PRIu64 " blocks] \n",
-           "InterimCache ID", (uint64_t)io.aiocb.aio_offset, (uint64_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes),
-           (uint64_t)io.aiocb.aio_offset / CACHE_BLOCK_SIZE,
-           (uint64_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes) / CACHE_BLOCK_SIZE);
-     Dir del_dir;
-     dir_clear(&del_dir);
-     dir_set_ininterim(&del_dir);
-     dir_set_index(&del_dir, (this - vol->interim_vols));
-     for (int done = 0; done < agg_buf_pos;) {
-       Doc *doc = (Doc *) (agg_buffer + done);
-       dir_set_offset(&del_dir, header->write_pos + done);
-       dir_delete(&doc->key, vol, &del_dir);
-       done += this->round_to_approx_size(doc->len);
-     }
-     agg_buf_pos = 0;
-   }
-   set_io_not_in_progress();
-   sync = false;
-   if (agg.head)
-     aggWrite(event, e);
-   return EVENT_CONT;
+          "InterimCache ID", (uint64_t)io.aiocb.aio_offset, (uint64_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes),
+          (uint64_t)io.aiocb.aio_offset / CACHE_BLOCK_SIZE,
+          (uint64_t)(io.aiocb.aio_offset + io.aiocb.aio_nbytes) / CACHE_BLOCK_SIZE);
+    Dir del_dir;
+    dir_clear(&del_dir);
+    dir_set_ininterim(&del_dir);
+    dir_set_index(&del_dir, (this - vol->interim_vols));
+    for (int done = 0; done < agg_buf_pos;) {
+      Doc *doc = (Doc *)(agg_buffer + done);
+      dir_set_offset(&del_dir, header->write_pos + done);
+      dir_delete(&doc->key, vol, &del_dir);
+      done += this->round_to_approx_size(doc->len);
+    }
+    agg_buf_pos = 0;
+  }
+  set_io_not_in_progress();
+  sync = false;
+  if (agg.head)
+    aggWrite(event, e);
+  return EVENT_CONT;
 }
 #endif
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 69fa156..af99d30 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -32,24 +32,22 @@
 
 #define CACHE_MODULE_MAJOR_VERSION 1
 #define CACHE_MODULE_MINOR_VERSION 0
-#define CACHE_MODULE_VERSION       makeModuleVersion(CACHE_MODULE_MAJOR_VERSION,\
-						   CACHE_MODULE_MINOR_VERSION,\
-						   PUBLIC_MODULE_HEADER)
+#define CACHE_MODULE_VERSION makeModuleVersion(CACHE_MODULE_MAJOR_VERSION, CACHE_MODULE_MINOR_VERSION, PUBLIC_MODULE_HEADER)
 
-#define CACHE_WRITE_OPT_OVERWRITE       0x0001
-#define CACHE_WRITE_OPT_CLOSE_COMPLETE  0x0002
-#define CACHE_WRITE_OPT_SYNC            (CACHE_WRITE_OPT_CLOSE_COMPLETE | 0x0004)
-#define CACHE_WRITE_OPT_OVERWRITE_SYNC  (CACHE_WRITE_OPT_SYNC | CACHE_WRITE_OPT_OVERWRITE)
+#define CACHE_WRITE_OPT_OVERWRITE 0x0001
+#define CACHE_WRITE_OPT_CLOSE_COMPLETE 0x0002
+#define CACHE_WRITE_OPT_SYNC (CACHE_WRITE_OPT_CLOSE_COMPLETE | 0x0004)
+#define CACHE_WRITE_OPT_OVERWRITE_SYNC (CACHE_WRITE_OPT_SYNC | CACHE_WRITE_OPT_OVERWRITE)
 
-#define SCAN_KB_PER_SECOND      8192 // 1TB/8MB = 131072 = 36 HOURS to scan a TB
+#define SCAN_KB_PER_SECOND 8192 // 1TB/8MB = 131072 = 36 HOURS to scan a TB
 
-#define RAM_CACHE_ALGORITHM_CLFUS        0
-#define RAM_CACHE_ALGORITHM_LRU          1
+#define RAM_CACHE_ALGORITHM_CLFUS 0
+#define RAM_CACHE_ALGORITHM_LRU 1
 
-#define CACHE_COMPRESSION_NONE           0
-#define CACHE_COMPRESSION_FASTLZ         1
-#define CACHE_COMPRESSION_LIBZ           2
-#define CACHE_COMPRESSION_LIBLZMA        3
+#define CACHE_COMPRESSION_NONE 0
+#define CACHE_COMPRESSION_FASTLZ 1
+#define CACHE_COMPRESSION_LIBZ 2
+#define CACHE_COMPRESSION_LIBLZMA 3
 
 struct CacheVC;
 struct CacheDisk;
@@ -64,13 +62,12 @@ typedef URL CacheURL;
 typedef HTTPInfo CacheHTTPInfo;
 #endif
 
-struct CacheProcessor:public Processor
-{
+struct CacheProcessor : public Processor {
   CacheProcessor()
-    : min_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION)
-    , max_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION)
-    , cb_after_init(0)
-  {}
+    : min_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION),
+      max_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION), cb_after_init(0)
+  {
+  }
 
   virtual int start(int n_cache_threads = 0, size_t stacksize = DEFAULT_STACKSIZE);
   virtual int start_internal(int flags = 0);
@@ -79,47 +76,35 @@ struct CacheProcessor:public Processor
   int dir_check(bool fix);
   int db_check(bool fix);
 
-  inkcoreapi Action *lookup(Continuation *cont, CacheKey *key, bool cluster_cache_local,
-                            bool local_only = false,
+  inkcoreapi Action *lookup(Continuation *cont, CacheKey *key, bool cluster_cache_local, bool local_only = false,
                             CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, char *hostname = 0, int host_len = 0);
   inkcoreapi Action *open_read(Continuation *cont, CacheKey *key, bool cluster_cache_local,
                                CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, char *hostname = 0, int host_len = 0);
-  inkcoreapi Action *open_write(Continuation *cont,
-                                CacheKey *key,
-                                bool cluster_cache_local,
-                                CacheFragType frag_type = CACHE_FRAG_TYPE_NONE,
-                                int expected_size = CACHE_EXPECTED_SIZE,
-                                int options = 0,
-                                time_t pin_in_cache = (time_t) 0,
-                                char *hostname = 0, int host_len = 0);
-  inkcoreapi Action *remove(Continuation *cont, CacheKey *key,
-                            bool cluster_cache_local,
-                            CacheFragType frag_type = CACHE_FRAG_TYPE_NONE,
-                            bool rm_user_agents = true, bool rm_link = false,
+  inkcoreapi Action *open_write(Continuation *cont, CacheKey *key, bool cluster_cache_local,
+                                CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, int expected_size = CACHE_EXPECTED_SIZE,
+                                int options = 0, time_t pin_in_cache = (time_t)0, char *hostname = 0, int host_len = 0);
+  inkcoreapi Action *remove(Continuation *cont, CacheKey *key, bool cluster_cache_local,
+                            CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, bool rm_user_agents = true, bool rm_link = false,
                             char *hostname = 0, int host_len = 0);
   Action *scan(Continuation *cont, char *hostname = 0, int host_len = 0, int KB_per_second = SCAN_KB_PER_SECOND);
 #ifdef HTTP_CACHE
   Action *lookup(Continuation *cont, URL *url, bool cluster_cache_local, bool local_only = false,
                  CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
-  inkcoreapi Action *open_read(Continuation *cont, URL *url,
-                               bool cluster_cache_local,
-                               CacheHTTPHdr *request,
-                               CacheLookupHttpConfig *params,
-                               time_t pin_in_cache = (time_t) 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
-  Action *open_write(Continuation *cont, int expected_size, URL *url, bool cluster_cache_local,
-                     CacheHTTPHdr *request, CacheHTTPInfo *old_info,
-                     time_t pin_in_cache = (time_t) 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
+  inkcoreapi Action *open_read(Continuation *cont, URL *url, bool cluster_cache_local, CacheHTTPHdr *request,
+                               CacheLookupHttpConfig *params, time_t pin_in_cache = (time_t)0,
+                               CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
+  Action *open_write(Continuation *cont, int expected_size, URL *url, bool cluster_cache_local, CacheHTTPHdr *request,
+                     CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *remove(Continuation *cont, URL *url, bool cluster_cache_local, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
 
-  Action *open_read_internal(int, Continuation *, MIOBuffer *, CacheURL *,
-                             CacheHTTPHdr *, CacheLookupHttpConfig *,
-                             CacheKey *, time_t, CacheFragType type, char *hostname, int host_len);
+  Action *open_read_internal(int, Continuation *, MIOBuffer *, CacheURL *, CacheHTTPHdr *, CacheLookupHttpConfig *, CacheKey *,
+                             time_t, CacheFragType type, char *hostname, int host_len);
 #endif
   Action *link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local,
                CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP, char *hostname = 0, int host_len = 0);
 
-  Action *deref(Continuation *cont, CacheKey *key, bool cluster_cache_local,
-                CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP, char *hostname = 0, int host_len = 0);
+  Action *deref(Continuation *cont, CacheKey *key, bool cluster_cache_local, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP,
+                char *hostname = 0, int host_len = 0);
 
   /** Mark physical disk/device/file as offline.
       All stripes for this device are disabled.
@@ -128,13 +113,13 @@ struct CacheProcessor:public Processor
 
       @note This is what is called if a disk is disabled due to I/O errors.
   */
-  bool mark_storage_offline(CacheDisk* d);
+  bool mark_storage_offline(CacheDisk *d);
 
   /** Find the storage for a @a path.
       If @a len is 0 then @a path is presumed null terminated.
       @return @c NULL if the path does not match any defined storage.
    */
-  CacheDisk* find_by_path(char const* path, int len = 0);
+  CacheDisk *find_by_path(char const *path, int len = 0);
 
   /** Check if there are any online storage devices.
       If this returns @c false then the cache should be disabled as there is no storage available.
@@ -184,17 +169,17 @@ CacheProcessor::set_after_init_callback(CALLBACK_FUNC cb)
   cb_after_init = cb;
 }
 
-struct CacheVConnection:public VConnection
-{
+struct CacheVConnection : public VConnection {
   VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf) = 0;
   virtual VIO *do_io_pread(Continuation *c, int64_t nbytes, MIOBuffer *buf, int64_t offset) = 0;
   VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner = false) = 0;
   void do_io_close(int lerrno = -1) = 0;
   void reenable(VIO *avio) = 0;
   void reenable_re(VIO *avio) = 0;
-  void do_io_shutdown(ShutdownHowTo_t howto)
+  void
+  do_io_shutdown(ShutdownHowTo_t howto)
   {
-    (void) howto;
+    (void)howto;
     ink_assert(!"CacheVConnection::do_io_shutdown unsupported");
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/I_CacheDefs.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_CacheDefs.h b/iocore/cache/I_CacheDefs.h
index bd5bf46..93b0cac 100644
--- a/iocore/cache/I_CacheDefs.h
+++ b/iocore/cache/I_CacheDefs.h
@@ -22,50 +22,48 @@
  */
 
 
-
 #ifndef _I_CACHE_DEFS_H__
 #define _I_CACHE_DEFS_H__
 
-#define CACHE_INIT_FAILED           -1
-#define CACHE_INITIALIZING          0
-#define CACHE_INITIALIZED           1
+#define CACHE_INIT_FAILED -1
+#define CACHE_INITIALIZING 0
+#define CACHE_INITIALIZED 1
 
-#define CACHE_ALT_INDEX_DEFAULT     -1
-#define CACHE_ALT_REMOVED           -2
+#define CACHE_ALT_INDEX_DEFAULT -1
+#define CACHE_ALT_REMOVED -2
 
-#define CACHE_DB_MAJOR_VERSION      24
-#define CACHE_DB_MINOR_VERSION      0
+#define CACHE_DB_MAJOR_VERSION 24
+#define CACHE_DB_MINOR_VERSION 0
 
-#define CACHE_DIR_MAJOR_VERSION     18
-#define CACHE_DIR_MINOR_VERSION     0
+#define CACHE_DIR_MAJOR_VERSION 18
+#define CACHE_DIR_MINOR_VERSION 0
 
-#define CACHE_DB_FDS                128
+#define CACHE_DB_FDS 128
 
 // opcodes
-#define CACHE_OPEN_READ			1
-#define CACHE_OPEN_READ_BUFFER		2
-#define CACHE_OPEN_READ_LONG		3
-#define CACHE_OPEN_READ_BUFFER_LONG	4
-#define CACHE_OPEN_WRITE		5
-#define CACHE_OPEN_WRITE_BUFFER		6
-#define CACHE_OPEN_WRITE_LONG		7
-#define CACHE_OPEN_WRITE_BUFFER_LONG	8
-#define CACHE_UPDATE			9
-#define CACHE_REMOVE			10
-#define CACHE_LINK			11
-#define CACHE_DEREF			12
-#define CACHE_LOOKUP_OP			13
+#define CACHE_OPEN_READ 1
+#define CACHE_OPEN_READ_BUFFER 2
+#define CACHE_OPEN_READ_LONG 3
+#define CACHE_OPEN_READ_BUFFER_LONG 4
+#define CACHE_OPEN_WRITE 5
+#define CACHE_OPEN_WRITE_BUFFER 6
+#define CACHE_OPEN_WRITE_LONG 7
+#define CACHE_OPEN_WRITE_BUFFER_LONG 8
+#define CACHE_UPDATE 9
+#define CACHE_REMOVE 10
+#define CACHE_LINK 11
+#define CACHE_DEREF 12
+#define CACHE_LOOKUP_OP 13
 
 enum CacheType {
-  CACHE_NONE_TYPE = 0,  // for empty disk fragments
+  CACHE_NONE_TYPE = 0, // for empty disk fragments
   CACHE_HTTP_TYPE = 1,
   CACHE_RTSP_TYPE = 2
 };
 
 // NOTE: All the failures are ODD, and one greater than the success
 //       Some of these must match those in <ts/ts.h>
-enum CacheEventType
-{
+enum CacheEventType {
   CACHE_EVENT_LOOKUP = CACHE_EVENT_EVENTS_START + 0,
   CACHE_EVENT_LOOKUP_FAILED = CACHE_EVENT_EVENTS_START + 1,
   CACHE_EVENT_OPEN_READ = CACHE_EVENT_EVENTS_START + 2,
@@ -95,8 +93,7 @@ enum CacheEventType
   CACHE_EVENT_RESPONSE_RETRY
 };
 
-enum CacheScanResult
-{
+enum CacheScanResult {
   CACHE_SCAN_RESULT_CONTINUE = EVENT_CONT,
   CACHE_SCAN_RESULT_DONE = EVENT_DONE,
   CACHE_SCAN_RESULT_DELETE = 10,
@@ -105,18 +102,16 @@ enum CacheScanResult
   CACHE_SCAN_RESULT_RETRY
 };
 
-enum CacheDataType
-{
+enum CacheDataType {
   CACHE_DATA_HTTP_INFO = VCONNECTION_CACHE_DATA_BASE,
   CACHE_DATA_KEY,
-  CACHE_DATA_RAM_CACHE_HIT_FLAG
+  CACHE_DATA_RAM_CACHE_HIT_FLAG,
 };
 
-enum CacheFragType
-{
+enum CacheFragType {
   CACHE_FRAG_TYPE_NONE,
   CACHE_FRAG_TYPE_HTTP_V23, ///< DB version 23 or prior.
-  CACHE_FRAG_TYPE_RTSP, ///< Should be removed once Cache Toolkit is implemented.
+  CACHE_FRAG_TYPE_RTSP,     ///< Should be removed once Cache Toolkit is implemented.
   CACHE_FRAG_TYPE_HTTP,
   NUM_CACHE_FRAG_TYPES
 };


[14/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IpMapConf.cc
----------------------------------------------------------------------
diff --git a/lib/ts/IpMapConf.cc b/lib/ts/IpMapConf.cc
index bb54ae5..1c60044 100644
--- a/lib/ts/IpMapConf.cc
+++ b/lib/ts/IpMapConf.cc
@@ -23,9 +23,9 @@
 
 // Copied from IPRange.cc for backwards compatibility.
 
-# include <ts/IpMap.h>
-# include <ts/IpMapConf.h>
-# include <ts/ink_memory.h>
+#include <ts/IpMap.h>
+#include <ts/IpMapConf.h>
+#include <ts/ink_memory.h>
 
 static size_t const ERR_STRING_LEN = 256;
 static size_t const MAX_LINE_SIZE = 2048;
@@ -37,11 +37,11 @@ static size_t const MAX_LINE_SIZE = 2048;
 // addr  [out] Destination for address.
 // err   Buffer for error string (must be ERR_STRING_LEN big).
 int
-read_addr(char *line, int n, int *i, sockaddr* addr, char* err)
+read_addr(char *line, int n, int *i, sockaddr *addr, char *err)
 {
   int k;
   char dst[INET6_ADDRSTRLEN];
-  char* src = line + *i;
+  char *src = line + *i;
   bool bracketed_p = false;
 
   // Allow enclosing brackets to be more consistent but
@@ -50,11 +50,11 @@ read_addr(char *line, int n, int *i, sockaddr* addr, char* err)
     ++*i, ++src, bracketed_p = true;
   }
 
-  for (k = 0; k < INET6_ADDRSTRLEN && *i < n && (isxdigit(*src) || '.' == *src || ':' == *src) ; ++k, ++*i, ++src) {
+  for (k = 0; k < INET6_ADDRSTRLEN && *i < n && (isxdigit(*src) || '.' == *src || ':' == *src); ++k, ++*i, ++src) {
     dst[k] = *src;
   }
 
-  if (bracketed_p && (! (*i < n) || (']' != *src))) {
+  if (bracketed_p && (!(*i < n) || (']' != *src))) {
     snprintf(err, ERR_STRING_LEN, "Unclosed brackets");
     return EINVAL;
   }
@@ -73,13 +73,14 @@ read_addr(char *line, int n, int *i, sockaddr* addr, char* err)
 }
 
 char *
-Load_IpMap_From_File(IpMap* map, int fd, const char *key_str)
+Load_IpMap_From_File(IpMap *map, int fd, const char *key_str)
 {
-  char* zret = 0;
+  char *zret = 0;
   int fd2 = dup(fd); // dup to avoid closing the original file.
-  FILE* f = NULL;
+  FILE *f = NULL;
 
-  if (fd2 >= 0) f = fdopen(fd2, "r");
+  if (fd2 >= 0)
+    f = fdopen(fd2, "r");
 
   if (f != NULL) {
     zret = Load_IpMap_From_File(map, f, key_str);
@@ -97,7 +98,8 @@ Load_IpMap_From_File(IpMap* map, int fd, const char *key_str)
 // line    Source line.
 // n       Line length.
 // offset  Current offset
-static inline bool skip_space(char* line, int n, int& offset )
+static inline bool
+skip_space(char *line, int n, int &offset)
 {
   while (offset < n && isspace(line[offset]))
     ++offset;
@@ -106,7 +108,7 @@ static inline bool skip_space(char* line, int n, int& offset )
 
 // Returns 0 if successful, error string otherwise
 char *
-Load_IpMap_From_File(IpMap* map, FILE* f, const char *key_str)
+Load_IpMap_From_File(IpMap *map, FILE *f, const char *key_str)
 {
   int i, n, line_no;
   int key_len = strlen(key_str);
@@ -122,7 +124,7 @@ Load_IpMap_From_File(IpMap* map, FILE* f, const char *key_str)
     ++line_no;
     n = strlen(line);
     // Find first white space which terminates the line key.
-    for ( i = 0 ; i < n && ! isspace(line[i]); ++i)
+    for (i = 0; i < n && !isspace(line[i]); ++i)
       ;
     if (i != key_len || 0 != strncmp(line, key_str, key_len))
       continue;
@@ -131,10 +133,10 @@ Load_IpMap_From_File(IpMap* map, FILE* f, const char *key_str)
       if (!skip_space(line, n, i))
         break;
 
-      if (0 != read_addr(line, n,  &i, &laddr.sa, err_buff)) {
+      if (0 != read_addr(line, n, &i, &laddr.sa, err_buff)) {
         char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
-        snprintf(error_str, ERR_STRING_LEN, "Invalid input configuration (%s) at line %d offset %d - '%s'", err_buff,
-                 line_no, i, line);
+        snprintf(error_str, ERR_STRING_LEN, "Invalid input configuration (%s) at line %d offset %d - '%s'", err_buff, line_no, i,
+                 line);
         return error_str;
       }
 
@@ -151,13 +153,11 @@ Load_IpMap_From_File(IpMap* map, FILE* f, const char *key_str)
         ++i;
         if (!skip_space(line, n, i)) {
           char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
-          snprintf(error_str, ERR_STRING_LEN, "Invalid input (unterminated range) at line %d offset %d - '%s'", line_no,
-                   i, line);
+          snprintf(error_str, ERR_STRING_LEN, "Invalid input (unterminated range) at line %d offset %d - '%s'", line_no, i, line);
           return error_str;
         } else if (0 != read_addr(line, n, &i, &raddr.sa, err_buff)) {
           char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
-          snprintf(error_str, ERR_STRING_LEN, "Invalid input (%s) at line %d offset %d - '%s'", err_buff, line_no, i,
-                   line);
+          snprintf(error_str, ERR_STRING_LEN, "Invalid input (%s) at line %d offset %d - '%s'", err_buff, line_no, i, line);
           return error_str;
         }
         map->mark(&laddr.sa, &raddr.sa);
@@ -165,8 +165,7 @@ Load_IpMap_From_File(IpMap* map, FILE* f, const char *key_str)
           break;
         if (line[i] != ',') {
           char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
-          snprintf(error_str, ERR_STRING_LEN, "Invalid input (expecting comma) at line %d offset %d - '%s'", line_no,
-                   i, line);
+          snprintf(error_str, ERR_STRING_LEN, "Invalid input (expecting comma) at line %d offset %d - '%s'", line_no, i, line);
           return error_str;
         }
         ++i;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IpMapConf.h
----------------------------------------------------------------------
diff --git a/lib/ts/IpMapConf.h b/lib/ts/IpMapConf.h
index 8ec0c7c..1895b49 100644
--- a/lib/ts/IpMapConf.h
+++ b/lib/ts/IpMapConf.h
@@ -26,6 +26,6 @@
 class IpMap; // declare in name only.
 
 // Returns 0 if successful, error string otherwise
-char* Load_IpMap_From_File(IpMap* map, int fd, char const* key_str);
+char *Load_IpMap_From_File(IpMap *map, int fd, char const *key_str);
 // Returns 0 if successful, error string otherwise
-char* Load_IpMap_From_File(IpMap* map, FILE* f, char const* key_str);
+char *Load_IpMap_From_File(IpMap *map, FILE *f, char const *key_str);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IpMapTest.cc
----------------------------------------------------------------------
diff --git a/lib/ts/IpMapTest.cc b/lib/ts/IpMapTest.cc
index 14a8107..af9a6b2 100644
--- a/lib/ts/IpMapTest.cc
+++ b/lib/ts/IpMapTest.cc
@@ -25,27 +25,27 @@
 #include <ts/TestBox.h>
 
 void
-IpMapTestPrint(IpMap& map) {
+IpMapTestPrint(IpMap &map)
+{
   printf("IpMap Dump\n");
-  for ( IpMap::iterator spot(map.begin()), limit(map.end())
-      ; spot != limit
-      ; ++spot
-  ) {
+  for (IpMap::iterator spot(map.begin()), limit(map.end()); spot != limit; ++spot) {
     ip_text_buffer ipb1, ipb2;
 
-    printf("%s - %s : %p\n", ats_ip_ntop(spot->min(), ipb1, sizeof ipb1), ats_ip_ntop(spot->max(), ipb2, sizeof(ipb2)), spot->data());
+    printf("%s - %s : %p\n", ats_ip_ntop(spot->min(), ipb1, sizeof ipb1), ats_ip_ntop(spot->max(), ipb2, sizeof(ipb2)),
+           spot->data());
   }
   printf("\n");
 }
 
-REGRESSION_TEST(IpMap_Basic)(RegressionTest* t, int /* atype ATS_UNUSED */, int*  pstatus) {
+REGRESSION_TEST(IpMap_Basic)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
+{
   TestBox tb(t, pstatus);
 
   IpMap map;
-  void* const markA = reinterpret_cast<void*>(1);
-  void* const markB = reinterpret_cast<void*>(2);
-  void* const markC = reinterpret_cast<void*>(3);
-  void* mark; // for retrieval
+  void *const markA = reinterpret_cast<void *>(1);
+  void *const markB = reinterpret_cast<void *>(2);
+  void *const markC = reinterpret_cast<void *>(3);
+  void *mark; // for retrieval
 
   in_addr_t ip5 = htonl(5), ip9 = htonl(9);
   in_addr_t ip10 = htonl(10), ip15 = htonl(15), ip20 = htonl(20);
@@ -58,7 +58,7 @@ REGRESSION_TEST(IpMap_Basic)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
 
   *pstatus = REGRESSION_TEST_PASSED;
 
-  map.mark(ip10,ip20,markA);
+  map.mark(ip10, ip20, markA);
   map.mark(ip5, ip9, markA);
   tb.check(map.getCount() == 1, "Coalesce failed");
   tb.check(map.contains(ip9), "Range max not found.");
@@ -93,10 +93,10 @@ REGRESSION_TEST(IpMap_Basic)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
   tb.check(!map.contains(ip160), "Test 3 - unmark right edge still there.");
 
   map.clear();
-  map.mark(ip20,ip20, markA);
+  map.mark(ip20, ip20, markA);
   tb.check(map.contains(ip20), "Map failed on singleton insert");
   map.mark(ip10, ip200, markB);
-  mark=0;
+  mark = 0;
   map.contains(ip20, &mark);
   tb.check(mark == markB, "Map held singleton against range.");
   map.mark(ip100, ip120, markA);
@@ -105,14 +105,15 @@ REGRESSION_TEST(IpMap_Basic)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
   tb.check(map.getCount() == 1, "IpMap: Full range fill left extra ranges.");
 }
 
-REGRESSION_TEST(IpMap_Unmark)(RegressionTest* t, int /* atype ATS_UNUSED */, int* pstatus) {
+REGRESSION_TEST(IpMap_Unmark)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
+{
   TestBox tb(t, pstatus);
   IpMap map;
-//  ip_text_buffer ipb1, ipb2;
-  void* const markA = reinterpret_cast<void*>(1);
+  //  ip_text_buffer ipb1, ipb2;
+  void *const markA = reinterpret_cast<void *>(1);
 
   IpEndpoint a_0, a_0_0_0_16, a_0_0_0_17, a_max;
-  IpEndpoint a_10_28_56_0,a_10_28_56_4, a_10_28_56_255;
+  IpEndpoint a_10_28_56_0, a_10_28_56_4, a_10_28_56_255;
   IpEndpoint a_10_28_55_255, a_10_28_57_0;
   IpEndpoint a_63_128_1_12;
   IpEndpoint a_loopback, a_loopback2;
@@ -153,18 +154,19 @@ REGRESSION_TEST(IpMap_Unmark)(RegressionTest* t, int /* atype ATS_UNUSED */, int
   tb.check(map.contains(&a_0_0_0_17), "IpMap Unmark: Range unmark zero bounded range max+1 removed.");
 }
 
-REGRESSION_TEST(IpMap_Fill)(RegressionTest* t, int /* atype ATS_UNUSED */, int* pstatus) {
+REGRESSION_TEST(IpMap_Fill)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
+{
   TestBox tb(t, pstatus);
   IpMap map;
   ip_text_buffer ipb1, ipb2;
-  void* const allow = reinterpret_cast<void*>(0);
-  void* const deny = reinterpret_cast<void*>(~0);
-  void* const markA = reinterpret_cast<void*>(1);
-  void* const markB = reinterpret_cast<void*>(2);
-  void* const markC = reinterpret_cast<void*>(3);
-  void* mark; // for retrieval
-
-  IpEndpoint a0,a_10_28_56_0,a_10_28_56_255,a3,a4;
+  void *const allow = reinterpret_cast<void *>(0);
+  void *const deny = reinterpret_cast<void *>(~0);
+  void *const markA = reinterpret_cast<void *>(1);
+  void *const markB = reinterpret_cast<void *>(2);
+  void *const markC = reinterpret_cast<void *>(3);
+  void *mark; // for retrieval
+
+  IpEndpoint a0, a_10_28_56_0, a_10_28_56_255, a3, a4;
   IpEndpoint a_9_255_255_255, a_10_0_0_0, a_10_0_0_19, a_10_0_0_255, a_10_0_1_0;
   IpEndpoint a_10_28_56_4, a_max, a_loopback, a_loopback2;
   IpEndpoint a_10_28_55_255, a_10_28_57_0;
@@ -205,10 +207,10 @@ REGRESSION_TEST(IpMap_Fill)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
   ats_ip_pton("127.0.0.255", &a_loopback2);
   ats_ip_pton("63.128.1.12", &a_63_128_1_12);
 
-  map.fill(&a_10_28_56_0,&a_10_28_56_255,deny);
-  map.fill(&a0,&a_max,allow);
+  map.fill(&a_10_28_56_0, &a_10_28_56_255, deny);
+  map.fill(&a0, &a_max, allow);
 
-  tb.check(map.contains(&a_10_28_56_4,&mark), "IpMap Fill: Target not found.");
+  tb.check(map.contains(&a_10_28_56_4, &mark), "IpMap Fill: Target not found.");
   tb.check(mark == deny, "IpMap Fill: Expected deny, got allow at %s.", ats_ip_ntop(&a_10_28_56_4, ipb1, sizeof(ipb1)));
 
   map.clear();
@@ -216,12 +218,13 @@ REGRESSION_TEST(IpMap_Fill)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
   tb.check(map.contains(&a_loopback), "IpMap fill: singleton not marked.");
   map.fill(&a0, &a_max, deny);
 
-  mark=0;
+  mark = 0;
   tb.check(map.contains(&a_loopback, &mark), "IpMap fill: singleton marking lost.");
   tb.check(mark == allow, "IpMap fill: overwrote existing singleton mark.");
   if (tb.check(map.begin() != map.end(), "IpMap fill: map is empty.")) {
     if (tb.check(++(map.begin()) != map.end(), "IpMap fill: only one range.")) {
-      tb.check(-1 == ats_ip_addr_cmp(map.begin()->max(), (++map.begin())->min()), "IpMap fill: ranges not disjoint [%s < %s].", ats_ip_ntop(map.begin()->max(), ipb1, sizeof(ipb1)), ats_ip_ntop((++map.begin())->min(), ipb2, sizeof(ipb2)));
+      tb.check(-1 == ats_ip_addr_cmp(map.begin()->max(), (++map.begin())->min()), "IpMap fill: ranges not disjoint [%s < %s].",
+               ats_ip_ntop(map.begin()->max(), ipb1, sizeof(ipb1)), ats_ip_ntop((++map.begin())->min(), ipb2, sizeof(ipb2)));
     }
   }
 
@@ -251,20 +254,13 @@ REGRESSION_TEST(IpMap_Fill)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
   map.fill(&a_0000_0001, &a_0000_0001, markA);
   map.fill(&a_0000_0000, &a_ffff_ffff, markB);
 
-  tb.check(map.contains(&a_0000_0000, &mark) && mark == markB,
-           "IpMap Fill[v6]: Zero address has bad mark.");
-  tb.check(map.contains(&a_ffff_ffff, &mark) && mark == markB,
-           "IpMap Fill[v6]: Max address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d90, &mark) && mark == markA,
-           "IpMap Fill[v6]: 9d90 address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d8f, &mark) && mark == markB,
-           "IpMap Fill[v6]: 9d8f address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d9d, &mark) && mark == markA,
-           "IpMap Fill[v6]: 9d9d address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d9e, &mark) && mark == markB,
-           "IpMap Fill[v6]: 9d9b address has bad mark.");
-  tb.check(map.contains(&a_0000_0001, &mark) && mark == markA,
-           "IpMap Fill[v6]: ::1 has bad mark.");
+  tb.check(map.contains(&a_0000_0000, &mark) && mark == markB, "IpMap Fill[v6]: Zero address has bad mark.");
+  tb.check(map.contains(&a_ffff_ffff, &mark) && mark == markB, "IpMap Fill[v6]: Max address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d90, &mark) && mark == markA, "IpMap Fill[v6]: 9d90 address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d8f, &mark) && mark == markB, "IpMap Fill[v6]: 9d8f address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d9d, &mark) && mark == markA, "IpMap Fill[v6]: 9d9d address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d9e, &mark) && mark == markB, "IpMap Fill[v6]: 9d9b address has bad mark.");
+  tb.check(map.contains(&a_0000_0001, &mark) && mark == markA, "IpMap Fill[v6]: ::1 has bad mark.");
 
   tb.check(map.getCount() == 10, "IpMap Fill[pre-refill]: Bad range count.");
   // These should be ignored by the map as it is completely covered for IPv6.
@@ -277,19 +273,11 @@ REGRESSION_TEST(IpMap_Fill)(RegressionTest* t, int /* atype ATS_UNUSED */, int*
   map.fill(&a_fe80_9d90, &a_fe80_9d9d, markA);
   map.fill(&a_0000_0001, &a_0000_0001, markC);
   map.fill(&a_0000_0000, &a_ffff_ffff, markB);
-  tb.check(map.contains(&a_0000_0000, &mark) && mark == markB,
-           "IpMap Fill[v6-2]: Zero address has bad mark.");
-  tb.check(map.contains(&a_ffff_ffff, &mark) && mark == markB,
-           "IpMap Fill[v6-2]: Max address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d90, &mark) && mark == markA,
-           "IpMap Fill[v6-2]: 9d90 address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d8f, &mark) && mark == markB,
-           "IpMap Fill[v6-2]: 9d8f address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d9d, &mark) && mark == markA,
-           "IpMap Fill[v6-2]: 9d9d address has bad mark.");
-  tb.check(map.contains(&a_fe80_9d9e, &mark) && mark == markB,
-           "IpMap Fill[v6-2]: 9d9b address has bad mark.");
-  tb.check(map.contains(&a_0000_0001, &mark) && mark == markC,
-           "IpMap Fill[v6-2]: ::1 has bad mark.");
-
+  tb.check(map.contains(&a_0000_0000, &mark) && mark == markB, "IpMap Fill[v6-2]: Zero address has bad mark.");
+  tb.check(map.contains(&a_ffff_ffff, &mark) && mark == markB, "IpMap Fill[v6-2]: Max address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d90, &mark) && mark == markA, "IpMap Fill[v6-2]: 9d90 address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d8f, &mark) && mark == markB, "IpMap Fill[v6-2]: 9d8f address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d9d, &mark) && mark == markA, "IpMap Fill[v6-2]: 9d9d address has bad mark.");
+  tb.check(map.contains(&a_fe80_9d9e, &mark) && mark == markB, "IpMap Fill[v6-2]: 9d9b address has bad mark.");
+  tb.check(map.contains(&a_0000_0001, &mark) && mark == markC, "IpMap Fill[v6-2]: ::1 has bad mark.");
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Layout.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Layout.cc b/lib/ts/Layout.cc
index 6e1dfdb..8669953 100644
--- a/lib/ts/Layout.cc
+++ b/lib/ts/Layout.cc
@@ -30,7 +30,8 @@ Layout *
 Layout::get()
 {
   if (layout == NULL) {
-    ink_assert("need to call create_default_layout before accessing" "default_layout()");
+    ink_assert("need to call create_default_layout before accessing"
+               "default_layout()");
   }
   return layout;
 }
@@ -55,8 +56,7 @@ layout_relative(const char *root, const char *file)
       ink_error("Cannot merge path '%s' above the root '%s'\n", file, root);
     } else if (err == E2BIG) {
       ink_error("Exceeding file name length limit of %d characters\n", PATH_NAME_MAX);
-    }
-    else {
+    } else {
       // TODO: Make some pretty errors.
       ink_error("Cannot merge '%s' with '%s' error=%d\n", file, root, err);
     }
@@ -76,16 +76,14 @@ Layout::relative(char *buf, size_t bufsz, const char *file)
 {
   char path[PATH_NAME_MAX];
 
-  if (ink_filepath_merge(path, PATH_NAME_MAX, prefix, file,
-      INK_FILEPATH_TRUENAME)) {
+  if (ink_filepath_merge(path, PATH_NAME_MAX, prefix, file, INK_FILEPATH_TRUENAME)) {
     int err = errno;
     // Log error
     if (err == EACCES) {
       ink_error("Cannot merge path '%s' above the root '%s'\n", file, prefix);
     } else if (err == E2BIG) {
       ink_error("Exceeding file name length limit of %d characters\n", PATH_NAME_MAX);
-    }
-    else {
+    } else {
       // TODO: Make some pretty errors.
       ink_error("Cannot merge '%s' with '%s' error=%d\n", file, prefix, err);
     }
@@ -94,8 +92,7 @@ Layout::relative(char *buf, size_t bufsz, const char *file)
   size_t path_len = strlen(path) + 1;
   if (path_len > bufsz) {
     ink_error("Provided buffer is too small: %zu, required %zu\n", bufsz, path_len);
-  }
-  else {
+  } else {
     ink_strlcpy(buf, path, bufsz);
   }
 }
@@ -128,8 +125,7 @@ Layout::relative_to(char *buf, size_t bufsz, const char *dir, const char *file)
       ink_error("Cannot merge path '%s' above the root '%s'\n", file, dir);
     } else if (err == E2BIG) {
       ink_error("Exceeding file name length limit of %d characters\n", PATH_NAME_MAX);
-    }
-    else {
+    } else {
       // TODO: Make some pretty errors.
       ink_error("Cannot merge '%s' with '%s' error=%d\n", file, dir, err);
     }
@@ -138,8 +134,7 @@ Layout::relative_to(char *buf, size_t bufsz, const char *dir, const char *file)
   size_t path_len = strlen(path) + 1;
   if (path_len > bufsz) {
     ink_error("Provided buffer is too small: %zu, required %zu\n", bufsz, path_len);
-  }
-  else {
+  } else {
     ink_strlcpy(buf, path, bufsz);
   }
 }
@@ -151,12 +146,12 @@ Layout::Layout(const char *_prefix)
   } else {
     char *env_path;
     char path[PATH_NAME_MAX];
-    int  len;
+    int len;
 
     if ((env_path = getenv("TS_ROOT"))) {
       len = strlen(env_path);
       if ((len + 1) > PATH_NAME_MAX) {
-        ink_error("TS_ROOT environment variable is too big: %d, max %d\n", len, PATH_NAME_MAX -1);
+        ink_error("TS_ROOT environment variable is too big: %d, max %d\n", len, PATH_NAME_MAX - 1);
         return;
       }
       ink_strlcpy(path, env_path, sizeof(path));
@@ -165,7 +160,7 @@ Layout::Layout(const char *_prefix)
         --len;
       }
     } else {
-        // Use compile time --prefix
+      // Use compile time --prefix
       ink_strlcpy(path, TS_BUILD_PREFIX, sizeof(path));
     }
 
@@ -185,7 +180,6 @@ Layout::Layout(const char *_prefix)
   mandir = layout_relative(prefix, TS_BUILD_MANDIR);
   infodir = layout_relative(prefix, TS_BUILD_INFODIR);
   cachedir = layout_relative(prefix, TS_BUILD_CACHEDIR);
-
 }
 
 Layout::~Layout()
@@ -206,4 +200,3 @@ Layout::~Layout()
   ats_free(infodir);
   ats_free(cachedir);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/List.h
----------------------------------------------------------------------
diff --git a/lib/ts/List.h b/lib/ts/List.h
index f447b15..e96212c 100644
--- a/lib/ts/List.h
+++ b/lib/ts/List.h
@@ -52,7 +52,7 @@
  ****************************************************************************/
 
 #ifndef _List_h_
-#define	_List_h_
+#define _List_h_
 
 #include <stdint.h>
 
@@ -63,17 +63,37 @@
 //
 //      Link cell for singly-linked list of objects of type C.
 //
-template <class C> class SLink {
- public:
+template <class C> class SLink
+{
+public:
   C *next;
-  SLink() : next(NULL) {};
+  SLink() : next(NULL){};
 };
-#define SLINK(_c,_f) class Link##_##_f : public SLink<_c> { public:    \
-    static _c *& next_link(_c *c) { return c->_f.next; }                \
-    static const _c * next_link(const _c *c) { return c->_f.next; } \
-  }; SLink<_c> _f
-#define SLINKM(_c,_m,_f) class Link##_##_m##_##_f : public SLink<_c> { public: \
-    static _c *& next_link(_c *c) { return c->_m._f.next; }             \
+#define SLINK(_c, _f)                  \
+  class Link##_##_f : public SLink<_c> \
+  {                                    \
+  public:                              \
+    static _c *&                       \
+    next_link(_c *c)                   \
+    {                                  \
+      return c->_f.next;               \
+    }                                  \
+    static const _c *                  \
+    next_link(const _c *c)             \
+    {                                  \
+      return c->_f.next;               \
+    }                                  \
+  };                                   \
+  SLink<_c> _f
+#define SLINKM(_c, _m, _f)                    \
+  class Link##_##_m##_##_f : public SLink<_c> \
+  {                                           \
+  public:                                     \
+    static _c *&                              \
+    next_link(_c *c)                          \
+    {                                         \
+      return c->_m._f.next;                   \
+    }                                         \
   };
 
 //
@@ -83,52 +103,107 @@ template <class C> struct Link : public SLink<C> {
   C *prev;
   Link() : prev(NULL) {}
 };
-#define LINK(_c,_f) class Link##_##_f : public Link<_c> { public:       \
-    static _c *& next_link(_c *c) { return c->_f.next; }                \
-    static _c *& prev_link(_c *c) { return c->_f.prev; }                \
-    static const _c * next_link(const _c *c) { return c->_f.next; }     \
-    static const _c * prev_link(const _c *c) { return c->_f.prev; }     \
-  }; Link<_c> _f
-#define LINKM(_c,_m,_f) class Link##_##_m##_##_f : public Link<_c> { public:  \
-    static _c *& next_link(_c *c) { return c->_m._f.next; }             \
-    static _c *& prev_link(_c *c) { return c->_m._f.prev; }             \
+#define LINK(_c, _f)                  \
+  class Link##_##_f : public Link<_c> \
+  {                                   \
+  public:                             \
+    static _c *&                      \
+    next_link(_c *c)                  \
+    {                                 \
+      return c->_f.next;              \
+    }                                 \
+    static _c *&                      \
+    prev_link(_c *c)                  \
+    {                                 \
+      return c->_f.prev;              \
+    }                                 \
+    static const _c *                 \
+    next_link(const _c *c)            \
+    {                                 \
+      return c->_f.next;              \
+    }                                 \
+    static const _c *                 \
+    prev_link(const _c *c)            \
+    {                                 \
+      return c->_f.prev;              \
+    }                                 \
+  };                                  \
+  Link<_c> _f
+#define LINKM(_c, _m, _f)                    \
+  class Link##_##_m##_##_f : public Link<_c> \
+  {                                          \
+  public:                                    \
+    static _c *&                             \
+    next_link(_c *c)                         \
+    {                                        \
+      return c->_m._f.next;                  \
+    }                                        \
+    static _c *&                             \
+    prev_link(_c *c)                         \
+    {                                        \
+      return c->_m._f.prev;                  \
+    }                                        \
   };
-#define LINK_FORWARD_DECLARATION(_c,_f) class Link##_##_c##_##_f : public Link<_c> { public:     \
-    static _c *& next_link(_c *c);                                      \
-    static _c *& prev_link(_c *c);                                      \
+#define LINK_FORWARD_DECLARATION(_c, _f)     \
+  class Link##_##_c##_##_f : public Link<_c> \
+  {                                          \
+  public:                                    \
+    static _c *&next_link(_c *c);            \
+    static _c *&prev_link(_c *c);            \
   };
-#define LINK_DEFINITION(_c,_f)  \
-  inline _c *& Link##_##_c##_##_f::next_link(_c *c) { return c->_f.next; } \
-  inline _c *& Link##_##_c##_##_f::prev_link(_c *c) { return c->_f.prev; } \
+#define LINK_DEFINITION(_c, _f)                                           \
+  inline _c *&Link##_##_c##_##_f::next_link(_c *c) { return c->_f.next; } \
+  inline _c *&Link##_##_c##_##_f::prev_link(_c *c) { return c->_f.prev; }
 
 //
 //      List descriptor for singly-linked list of objects of type C.
 //
-template <class C, class L = typename C::Link_link> class SLL {
- public:
+template <class C, class L = typename C::Link_link> class SLL
+{
+public:
   C *head;
-  bool empty() const { return head == NULL; }
+  bool
+  empty() const
+  {
+    return head == NULL;
+  }
   void push(C *e);
   C *pop();
-  void clear() { head = NULL; }
-  C *& next(C *e) { return L::next_link(e); }
-  const C * next(const C *e) const { return L::next_link(e); }
+  void
+  clear()
+  {
+    head = NULL;
+  }
+  C *&
+  next(C *e)
+  {
+    return L::next_link(e);
+  }
+  const C *
+  next(const C *e) const
+  {
+    return L::next_link(e);
+  }
 
   SLL() : head(NULL) {}
   SLL(C *c) : head(c) {}
 };
-#define SList(_c, _f)  SLL<_c, _c::Link##_##_f>
+#define SList(_c, _f) SLL<_c, _c::Link##_##_f>
 #define SListM(_c, _m, _ml, _l) SLL<_c, _c::Link##_##_ml##_##_l>
 #define forl_LL(_c, _p, _l) for (_c *_p = (_l).head; _p; _p = (_l).next(_p))
 
-template <class C, class L> inline void
-SLL<C,L>::push(C *e) {
+template <class C, class L>
+inline void
+SLL<C, L>::push(C *e)
+{
   next(e) = head;
   head = e;
 }
 
-template <class C, class L> inline C *
-SLL<C,L>::pop() {
+template <class C, class L>
+inline C *
+SLL<C, L>::pop()
+{
   C *ret = head;
   if (ret) {
     head = next(ret);
@@ -142,43 +217,81 @@ SLL<C,L>::pop() {
 //
 template <class C, class L = typename C::Link_link> struct DLL {
   C *head;
-  bool empty() const { return head == NULL; }
+  bool
+  empty() const
+  {
+    return head == NULL;
+  }
   void push(C *e);
   C *pop();
   void remove(C *e);
   void insert(C *e, C *after);
-  bool in(C *e) { return head == e || next(e) || prev(e); }
-  void clear() { head = NULL; }
-  static C *&next(C *e) { return reinterpret_cast<C*&>(L::next_link(e)); }
-  static C *&prev(C *e) { return reinterpret_cast<C*&>(L::prev_link(e)); }
-  static C const* next(const C *e) { return L::next_link(e); }
-  static C const* prev(const C *e) { return L::prev_link(e); }
+  bool
+  in(C *e)
+  {
+    return head == e || next(e) || prev(e);
+  }
+  void
+  clear()
+  {
+    head = NULL;
+  }
+  static C *&
+  next(C *e)
+  {
+    return reinterpret_cast<C *&>(L::next_link(e));
+  }
+  static C *&
+  prev(C *e)
+  {
+    return reinterpret_cast<C *&>(L::prev_link(e));
+  }
+  static C const *
+  next(const C *e)
+  {
+    return L::next_link(e);
+  }
+  static C const *
+  prev(const C *e)
+  {
+    return L::prev_link(e);
+  }
 
   DLL() : head(NULL) {}
 };
-#define DList(_c, _f)  DLL<_c, _c::Link##_##_f>
+#define DList(_c, _f) DLL<_c, _c::Link##_##_f>
 #define DListM(_c, _m, _ml, _l) DLL<_c, _c::Link##_##_ml##_##_l>
 
-template <class C, class L> inline void
-DLL<C,L>::push(C *e) {
+template <class C, class L>
+inline void
+DLL<C, L>::push(C *e)
+{
   if (head)
     prev(head) = e;
   next(e) = head;
   head = e;
 }
 
-template <class C, class L> inline void
-DLL<C,L>::remove(C *e) {
-  if (!head) return;
-  if (e == head) head = next(e);
-  if (prev(e)) next(prev(e)) = next(e);
-  if (next(e)) prev(next(e)) = prev(e);
+template <class C, class L>
+inline void
+DLL<C, L>::remove(C *e)
+{
+  if (!head)
+    return;
+  if (e == head)
+    head = next(e);
+  if (prev(e))
+    next(prev(e)) = next(e);
+  if (next(e))
+    prev(next(e)) = prev(e);
   prev(e) = NULL;
   next(e) = NULL;
 }
 
-template <class C, class L> inline C *
-DLL<C,L>::pop() {
+template <class C, class L>
+inline C *
+DLL<C, L>::pop()
+{
   C *ret = head;
   if (ret) {
     head = next(ret);
@@ -190,21 +303,28 @@ DLL<C,L>::pop() {
     return NULL;
 }
 
-template <class C, class L> inline void
-DLL<C,L>::insert(C *e, C *after) {
-  if (!after) { push(e); return; }
+template <class C, class L>
+inline void
+DLL<C, L>::insert(C *e, C *after)
+{
+  if (!after) {
+    push(e);
+    return;
+  }
   prev(e) = after;
   next(e) = next(after);
   next(after) = e;
-  if (next(e)) prev(next(e)) = e;
+  if (next(e))
+    prev(next(e)) = e;
 }
 
 //
 //      List descriptor for queue of objects of type C.
 //
-template <class C, class L = typename C::Link_link> class Queue : public DLL<C,L> {
- public:
-  using DLL<C,L>::head;
+template <class C, class L = typename C::Link_link> class Queue : public DLL<C, L>
+{
+public:
+  using DLL<C, L>::head;
   C *tail;
   void push(C *e);
   C *pop();
@@ -213,47 +333,68 @@ template <class C, class L = typename C::Link_link> class Queue : public DLL<C,L
   C *dequeue();
   void remove(C *e);
   void insert(C *e, C *after);
-  void append(Queue<C,L> q);
-  void append(DLL<C,L> q);
-  void clear() { head = NULL; tail = NULL; }
-  bool empty() const { return head == NULL; }
+  void append(Queue<C, L> q);
+  void append(DLL<C, L> q);
+  void
+  clear()
+  {
+    head = NULL;
+    tail = NULL;
+  }
+  bool
+  empty() const
+  {
+    return head == NULL;
+  }
 
   Queue() : tail(NULL) {}
 };
 #define Que(_c, _f) Queue<_c, _c::Link##_##_f>
 #define QueM(_c, _m, _mf, _f) Queue<_c, _c::Link##_##_mf##_##_f>
 
-template <class C, class L> inline void
-Queue<C,L>::push(C *e) {
-  DLL<C,L>::push(e);
-  if (!tail) tail = head;
+template <class C, class L>
+inline void
+Queue<C, L>::push(C *e)
+{
+  DLL<C, L>::push(e);
+  if (!tail)
+    tail = head;
 }
 
-template <class C, class L> inline C *
-Queue<C,L>::pop() {
-  C *ret = DLL<C,L>::pop();
-  if (!head) tail = NULL;
+template <class C, class L>
+inline C *
+Queue<C, L>::pop()
+{
+  C *ret = DLL<C, L>::pop();
+  if (!head)
+    tail = NULL;
   return ret;
 }
 
-template <class C, class L> inline void
-Queue<C,L>::insert(C *e, C *after) {
-  DLL<C,L>::insert(e, after);
+template <class C, class L>
+inline void
+Queue<C, L>::insert(C *e, C *after)
+{
+  DLL<C, L>::insert(e, after);
   if (!tail)
     tail = head;
   else if (tail == after)
     tail = e;
 }
 
-template <class C, class L> inline void
-Queue<C,L>::remove(C *e) {
+template <class C, class L>
+inline void
+Queue<C, L>::remove(C *e)
+{
   if (tail == e)
-    tail = (C*)this->prev(e);
-  DLL<C,L>::remove(e);
+    tail = (C *)this->prev(e);
+  DLL<C, L>::remove(e);
 }
 
-template <class C, class L> inline void
-Queue<C,L>::append(DLL<C,L> q) {
+template <class C, class L>
+inline void
+Queue<C, L>::append(DLL<C, L> q)
+{
   C *qtail = q.head;
   if (qtail)
     while (this->next(qtail))
@@ -270,8 +411,10 @@ Queue<C,L>::append(DLL<C,L> q) {
   }
 }
 
-template <class C, class L> inline void
-Queue<C,L>::append(Queue<C,L> q) {
+template <class C, class L>
+inline void
+Queue<C, L>::append(Queue<C, L> q)
+{
   if (!head) {
     head = q.head;
     tail = q.tail;
@@ -284,21 +427,28 @@ Queue<C,L>::append(Queue<C,L> q) {
   }
 }
 
-template <class C, class L> inline void
-Queue<C,L>::enqueue(C *e) {
+template <class C, class L>
+inline void
+Queue<C, L>::enqueue(C *e)
+{
   if (tail)
     insert(e, tail);
   else
     push(e);
 }
 
-template <class C, class L> inline void
-Queue<C,L>::in_or_enqueue(C *e) {
-  if (!this->in(e)) enqueue(e);
+template <class C, class L>
+inline void
+Queue<C, L>::in_or_enqueue(C *e)
+{
+  if (!this->in(e))
+    enqueue(e);
 }
 
-template <class C, class L> inline C *
-Queue<C,L>::dequeue() {
+template <class C, class L>
+inline C *
+Queue<C, L>::dequeue()
+{
   return pop();
 }
 
@@ -306,12 +456,14 @@ Queue<C,L>::dequeue() {
 // Adds sorting, but requires that elements implement <
 //
 
-template<class C, class L = typename C::Link_link> struct SortableQueue: public Queue<C,L>
-{
-  using DLL<C,L>::head;
-  using Queue<C,L>::tail;
-  void sort() {
-    if (!head) return;
+template <class C, class L = typename C::Link_link> struct SortableQueue : public Queue<C, L> {
+  using DLL<C, L>::head;
+  using Queue<C, L>::tail;
+  void
+  sort()
+  {
+    if (!head)
+      return;
     bool clean = false;
     while (!clean) {
       clean = true;
@@ -355,7 +507,7 @@ template<class C, class L = typename C::Link_link> struct SortableQueue: public
 // Adds counting to the Queue
 //
 
-template <class C, class L = typename C::Link_link> struct CountQueue : public Queue<C,L> {
+template <class C, class L = typename C::Link_link> struct CountQueue : public Queue<C, L> {
   int size;
   inline CountQueue(void) : size(0) {}
   inline void push(C *e);
@@ -364,57 +516,73 @@ template <class C, class L = typename C::Link_link> struct CountQueue : public Q
   inline C *dequeue();
   inline void remove(C *e);
   inline void insert(C *e, C *after);
-  inline void append(CountQueue<C,L> &q);
-  inline void append_clear(CountQueue<C,L> &q);
+  inline void append(CountQueue<C, L> &q);
+  inline void append_clear(CountQueue<C, L> &q);
 };
 #define CountQue(_c, _f) CountQueue<_c, _c::Link##_##_f>
 #define CountQueM(_c, _m, _mf, _f) CountQueue<_c, _c::Link##_##_mf##_##_f>
 
-template <class C, class L> inline void
-CountQueue<C,L>::push(C *e) {
-  Queue<C,L>::push(e);
+template <class C, class L>
+inline void
+CountQueue<C, L>::push(C *e)
+{
+  Queue<C, L>::push(e);
   size++;
 }
 
-template <class C, class L> inline C *
-CountQueue<C,L>::pop() {
-  C *ret = Queue<C,L>::pop();
+template <class C, class L>
+inline C *
+CountQueue<C, L>::pop()
+{
+  C *ret = Queue<C, L>::pop();
   if (ret)
     size--;
   return ret;
 }
 
-template <class C, class L> inline void
-CountQueue<C,L>::remove(C *e) {
-  Queue<C,L>::remove(e);
+template <class C, class L>
+inline void
+CountQueue<C, L>::remove(C *e)
+{
+  Queue<C, L>::remove(e);
   size--;
 }
 
-template <class C, class L> inline void
-CountQueue<C,L>::enqueue(C *e) {
-  Queue<C,L>::enqueue(e);
+template <class C, class L>
+inline void
+CountQueue<C, L>::enqueue(C *e)
+{
+  Queue<C, L>::enqueue(e);
   size++;
 }
 
-template <class C, class L> inline C *
-CountQueue<C,L>::dequeue() {
+template <class C, class L>
+inline C *
+CountQueue<C, L>::dequeue()
+{
   return pop();
 }
 
-template <class C, class L> inline void
-CountQueue<C,L>::insert(C *e, C *after) {
-  Queue<C,L>::insert(e, after);
+template <class C, class L>
+inline void
+CountQueue<C, L>::insert(C *e, C *after)
+{
+  Queue<C, L>::insert(e, after);
   size++;
 }
 
-template <class C, class L> inline void
-CountQueue<C,L>::append(CountQueue<C,L> &q) {
-  Queue<C,L>::append(q);
+template <class C, class L>
+inline void
+CountQueue<C, L>::append(CountQueue<C, L> &q)
+{
+  Queue<C, L>::append(q);
   size += q.size;
 }
 
-template <class C, class L> inline void
-CountQueue<C,L>::append_clear(CountQueue<C,L> &q) {
+template <class C, class L>
+inline void
+CountQueue<C, L>::append_clear(CountQueue<C, L> &q)
+{
   append(q);
   q.head = q.tail = 0;
   q.size = 0;
@@ -424,10 +592,9 @@ CountQueue<C,L>::append_clear(CountQueue<C,L> &q) {
 // List using cons cells
 //
 
-template <class C, class A = DefaultAlloc>
-struct ConsCell {
-  C             car;
-  ConsCell      *cdr;
+template <class C, class A = DefaultAlloc> struct ConsCell {
+  C car;
+  ConsCell *cdr;
   ConsCell(C acar, ConsCell *acdr) : car(acar), cdr(acdr) {}
   ConsCell(C acar) : car(acar), cdr(NULL) {}
   ConsCell(ConsCell *acdr) : cdr(acdr) {}
@@ -435,29 +602,72 @@ struct ConsCell {
   static void operator delete(void *p, size_t /* size ATS_UNUSED */) { A::free(p); }
 };
 
-template <class C, class A = DefaultAlloc>
-struct List {
-  ConsCell<C,A> *head;
-  C first() { if (head) return head->car; else return 0; }
-  C car() { return first(); }
-  ConsCell<C,A> *rest() { if (head) return head->cdr; else return 0; }
-  ConsCell<C,A> *cdr() { return rest(); }
-  void push(C a) { head = new ConsCell<C,A>(a, head); }
-  void push() { head = new ConsCell<C,A>(head); }
-  C pop() { C a = car(); head = cdr(); return a; }
-  void clear() { head = NULL; }
+template <class C, class A = DefaultAlloc> struct List {
+  ConsCell<C, A> *head;
+  C
+  first()
+  {
+    if (head)
+      return head->car;
+    else
+      return 0;
+  }
+  C
+  car()
+  {
+    return first();
+  }
+  ConsCell<C, A> *
+  rest()
+  {
+    if (head)
+      return head->cdr;
+    else
+      return 0;
+  }
+  ConsCell<C, A> *
+  cdr()
+  {
+    return rest();
+  }
+  void
+  push(C a)
+  {
+    head = new ConsCell<C, A>(a, head);
+  }
+  void
+  push()
+  {
+    head = new ConsCell<C, A>(head);
+  }
+  C
+  pop()
+  {
+    C a = car();
+    head = cdr();
+    return a;
+  }
+  void
+  clear()
+  {
+    head = NULL;
+  }
   void reverse();
-  List(C acar) : head(new ConsCell<C,A>(acar)) {}
-  List(C a, C b) : head(new ConsCell<C,A>(a, new ConsCell<C,A>(b))) {}
-  List(C a, C b, C c) : head(new ConsCell<C,A>(a, new ConsCell<C,A>(b, new ConsCell<C,A>(c)))) {}
+  List(C acar) : head(new ConsCell<C, A>(acar)) {}
+  List(C a, C b) : head(new ConsCell<C, A>(a, new ConsCell<C, A>(b))) {}
+  List(C a, C b, C c) : head(new ConsCell<C, A>(a, new ConsCell<C, A>(b, new ConsCell<C, A>(c)))) {}
   List() : head(0) {}
 };
-#define forc_List(_c, _p, _l) if ((_l).head) for (_c *_p  = (_l).head; _p; _p = _p->cdr)
+#define forc_List(_c, _p, _l) \
+  if ((_l).head)              \
+    for (_c *_p = (_l).head; _p; _p = _p->cdr)
 
-template <class C,class A> void
-List<C,A>::reverse() {
-  ConsCell<C,A> *n, *t;
-  for (ConsCell<C,A> *p = head; p; p = n) {
+template <class C, class A>
+void
+List<C, A>::reverse()
+{
+  ConsCell<C, A> *n, *t;
+  for (ConsCell<C, A> *p = head; p; p = n) {
     n = p->cdr;
     p->cdr = t;
     t = p;
@@ -469,12 +679,27 @@ List<C,A>::reverse() {
 // Atomic lists
 //
 
-template<class C, class L = typename C::Link_link> struct AtomicSLL
-{
-  void push(C * c) { ink_atomiclist_push(&al, c); }
-  C *pop() { return (C *) ink_atomiclist_pop(&al); }
-  C *popall() { return (C *) ink_atomiclist_popall(&al); }
-  bool empty() { return INK_ATOMICLIST_EMPTY(al); }
+template <class C, class L = typename C::Link_link> struct AtomicSLL {
+  void
+  push(C *c)
+  {
+    ink_atomiclist_push(&al, c);
+  }
+  C *
+  pop()
+  {
+    return (C *)ink_atomiclist_pop(&al);
+  }
+  C *
+  popall()
+  {
+    return (C *)ink_atomiclist_popall(&al);
+  }
+  bool
+  empty()
+  {
+    return INK_ATOMICLIST_EMPTY(al);
+  }
 
   /*
    * WARNING WARNING WARNING WARNING WARNING WARNING WARNING
@@ -482,9 +707,21 @@ template<class C, class L = typename C::Link_link> struct AtomicSLL
    * which only that thread can use as well.
    * WARNING WARNING WARNING WARNING WARNING WARNING WARNING
    */
-  C *remove(C * c) { return (C *) ink_atomiclist_remove(&al, c); }
-  C *head() { return (C *) TO_PTR(FREELIST_POINTER(al.head)); }
-  C *next(C * c) { return (C *) TO_PTR(c); }
+  C *
+  remove(C *c)
+  {
+    return (C *)ink_atomiclist_remove(&al, c);
+  }
+  C *
+  head()
+  {
+    return (C *)TO_PTR(FREELIST_POINTER(al.head));
+  }
+  C *
+  next(C *c)
+  {
+    return (C *)TO_PTR(c);
+  }
 
   InkAtomicList al;
 
@@ -494,8 +731,9 @@ template<class C, class L = typename C::Link_link> struct AtomicSLL
 #define ASLL(_c, _l) AtomicSLL<_c, _c::Link##_##_l>
 #define ASLLM(_c, _m, _ml, _l) AtomicSLL<_c, _c::Link##_##_ml##_##_l>
 
-template<class C, class L> inline AtomicSLL<C,L>::AtomicSLL() {
-  ink_atomiclist_init(&al, "AtomicSLL", (uint32_t)(uintptr_t)&L::next_link((C*)0));
+template <class C, class L> inline AtomicSLL<C, L>::AtomicSLL()
+{
+  ink_atomiclist_init(&al, "AtomicSLL", (uint32_t)(uintptr_t)&L::next_link((C *)0));
 }
 
-#endif  /*_List_h_*/
+#endif /*_List_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/MMH.cc
----------------------------------------------------------------------
diff --git a/lib/ts/MMH.cc b/lib/ts/MMH.cc
index 66d5c48..4154aee 100644
--- a/lib/ts/MMH.cc
+++ b/lib/ts/MMH.cc
@@ -27,141 +27,62 @@
 #include "ink_platform.h"
 #include "MMH.h"
 
-#define MMH_X_SIZE	512
+#define MMH_X_SIZE 512
 
 /* BUG: INKqa11504: need it be to 64 bits...otherwise it overflows */
 static uint64_t MMH_x[MMH_X_SIZE + 8] = {
-  0x3ee18b32, 0x746d0d6b, 0x591be6a3, 0x760bd17f,
-  0x363c765d, 0x4bf3d5c5, 0x10f0510a, 0x39a84605,
-  0x2282b48f, 0x6903652e, 0x1b491170, 0x1ab8407a,
-  0x776b8aa8, 0x5b126ffe, 0x5095db1a, 0x565fe90c,
-  0x3ae1f068, 0x73fdf0cb, 0x72f39a81, 0x6a40a4a3,
-  0x4ef557fe, 0x360c1a2c, 0x4579b0ea, 0x61dfd174,
-  0x269b242f, 0x752d6298, 0x15f10fa3, 0x618b7ab3,
-  0x6699171f, 0x488f2c6c, 0x790f8cdb, 0x5ed15565,
-  0x04eba3c0, 0x5009ac0b, 0x3a5d6c1f, 0x1a4f7853,
-  0x1affabd4, 0x74aace1f, 0x2310b46d, 0x466b611a,
-  0x18c5d4a0, 0x7eb9fffe, 0x76098df6, 0x4172f860,
-  0x689e3c2f, 0x722cdc29, 0x64548175, 0x28f46721,
-  0x58fdf93f, 0x12c2dcee, 0x58cb1327, 0x02d4af27,
-  0x4d1c6fcd, 0x72fe572d, 0x7038d366, 0x0bfa1898,
-  0x788d2438, 0x1f131f37, 0x25729ee6, 0x635ea6a9,
-  0x3b0b5714, 0x6ac759d2, 0x5faf688a, 0x0c2fe571,
-  0x7487538e, 0x65491b59, 0x60cd86e4, 0x5d6482d8,
-  0x4a59fa77, 0x78439700, 0x56a51f48, 0x360544ae,
-  0x6c01b3ef, 0x2228c036, 0x15b7e88b, 0x326e0dd8,
-  0x509491af, 0x72d06023, 0x26181f5d, 0x7924c4a4,
-  0x70c60bf2, 0x7b5bc151, 0x28e42640, 0x48af0c3e,
-  0x009b6301, 0x06dd3366, 0x2ad1eb24, 0x102ce33c,
-  0x1e504f5a, 0x5ab4c90f, 0x669ccca1, 0x118d5954,
-  0x1a1e4a7c, 0x1807d1f9, 0x525a58d0, 0x2f13ae2d,
-  0x17335a52, 0x714eb2f9, 0x1865dfc7, 0x61b64b52,
-  0x0dc9e939, 0x4fccde4c, 0x6d5873af, 0x47c62b43,
-  0x0fa1d4b0, 0x2f00cdf8, 0x68029083, 0x52645fa6,
-  0x4bb37c9b, 0x53d60251, 0x48364566, 0x35b4889b,
-  0x46783d34, 0x30c12697, 0x210459a1, 0x36962f2d,
-  0x36305d8f, 0x170e9dbd, 0x687c8739, 0x261c14e4,
-  0x3cc51cc7, 0x02add945, 0x01a88529, 0x6617aa77,
-  0x6be627ca, 0x14c7fc46, 0x46fb3b41, 0x1bffff9e,
-  0x1e6c61be, 0x10966c8f, 0x3f69199b, 0x1b5e9e06,
-  0x4880890f, 0x055613e6, 0x6c742db5, 0x7be1e15e,
-  0x2522e317, 0x41fe3369, 0x2b462f30, 0x605b7e8e,
-  0x1c19b868, 0x3fadcb16, 0x781c5e24, 0x1c6b0c08,
-  0x499f0bb9, 0x04b0b766, 0x7d6cad1e, 0x097f7d36,
-  0x2e02956a, 0x03adc713, 0x4ce950b7, 0x6e57a313,
-  0x557badb5, 0x73212afb, 0x3f7f6ed2, 0x0558e3d6,
-  0x28376f73, 0x54dac21d, 0x6c3f4771, 0x67147bc8,
-  0x5ae9fd88, 0x51ede3c0, 0x1067d134, 0x5246b937,
-  0x056e74ed, 0x5d7869b2, 0x62356370, 0x76a0c583,
-  0x3defb558, 0x5200dcae, 0x1432a7e8, 0x3ae4ad55,
-  0x0c4cca8a, 0x0607c4d7, 0x1944ae2b, 0x726479f0,
-  0x558e6035, 0x5ae64061, 0x4e1e9a8a, 0x0cf04d9f,
-  0x46ef4a87, 0x0554224f, 0x70d70ab3, 0x03cc954e,
-  0x39d0cd57, 0x1b11fb56, 0x62a0e9ee, 0x55888135,
-  0x3e93ebeb, 0x29578ee1, 0x0bcb0ef4, 0x529e16af,
-  0x165bab64, 0x39ed562e, 0x52c59d67, 0x48c84d29,
-  0x0fd0d1c7, 0x795fd395, 0x79a1c4f3, 0x5010c835,
-  0x4fbe4ba8, 0x49a597e9, 0x29f017ff, 0x59dde0be,
-  0x2c660275, 0x15fcfbf7, 0x1eab540f, 0x38e2cf56,
-  0x74608d5c, 0x7cd4b02c, 0x52a115b9, 0x2bdee9ac,
-  0x5456c6da, 0x63626453, 0x15279241, 0x19b60519,
-  0x508af0e1, 0x2e3ce97b, 0x568710d4, 0x6abb3059,
-  0x7897b1a5, 0x17034ff6, 0x2aef7d5e, 0x5a281657,
-  0x0fa5d304, 0x76f0a37e, 0x31be0f08, 0x46ce7c20,
-  0x563e4e90, 0x31540773, 0x1cdc9c51, 0x10366bfa,
-  0x1b6cd03a, 0x615f1540, 0x18c3d6c8, 0x3cb2bf8e,
-  0x29bf799c, 0x40b87edb, 0x42c34863, 0x1e9edb40,
-  0x64734fe2, 0x3ddf176a, 0x1c458c7f, 0x06138c9f,
-  0x5e695e56, 0x02c98403, 0x0474de75, 0x660e1df8,
-  0x6df73788, 0x3770f68c, 0x758bb7d5, 0x0763d105,
-  0x16e61f16, 0x153974c1, 0x29ded842, 0x1a0d12c3,
-  0x599ec61d, 0x05904d54, 0x79e9b0ea, 0x4976da61,
-  0x5834243c, 0x67c17d2f, 0x65fbcda0, 0x17bdc554,
-  0x465e9741, 0x7a0ee6d5, 0x3b357597, 0x0d1da287,
-  0x01211373, 0x04a05de6, 0x5deb5dbd, 0x6d993eb0,
-  0x2064ce7c, 0x3011a8c1, 0x36ece6b1, 0x4a0963be,
-  0x0cf46ef0, 0x0d53ba44, 0x63260063, 0x187f1d6e,
-  0x7e866a7e, 0x4b6885af, 0x254d6d47, 0x715474fd,
-  0x6896dcb2, 0x7554eea6, 0x2161bf36, 0x5387f5f8,
-  0x5c4bc064, 0x059a7755, 0x7d4307e1, 0x17326e2f,
-  0x5e2315c1, 0x14c26eae, 0x1e5cd6f2, 0x352b7ac8,
-  0x66591ef3, 0x381e80cd, 0x19b3bfc1, 0x3668946f,
-  0x4b6d7d70, 0x20feab7d, 0x1b6340af, 0x356b6cab,
-  0x299099dc, 0x295ab8d4, 0x184c8623, 0x134f8e4c,
-  0x7caf609c, 0x716d81f9, 0x2e04231f, 0x1dd45301,
-  0x43e9fcf9, 0x1c225c06, 0x0994797e, 0x5b3f6006,
-  0x1d22dcec, 0x32993108, 0x3f0c2bcc, 0x4d44fbfa,
-  0x389de78c, 0x7f8be723, 0x5dab92c1, 0x7866afce,
-  0x3bfc7011, 0x4a27d7d3, 0x0c79d05c, 0x268dc4da,
-  0x3fe10f84, 0x1f18394d, 0x20b9ba99, 0x312e520a,
-  0x64cf2f05, 0x322a7c04, 0x4cc077ce, 0x7218aa35,
-  0x550cacb8, 0x5943be47, 0x15b346a8, 0x0d6a1d8e,
-  0x3f08a54d, 0x7a6e9807, 0x274f8bbc, 0x6feb2033,
-  0x64b10c2b, 0x2cbaa0b7, 0x0db7decc, 0x22b807e3,
-  0x10d15c39, 0x6a9b314c, 0x5ff27199, 0x5072b2cd,
-  0x4eaf4b49, 0x5a890464, 0x7df0ca60, 0x548e8983,
-  0x5e3f0a21, 0x70027683, 0x503e6bf2, 0x47ad6e0d,
-  0x77173b26, 0x6dc04878, 0x4d73a573, 0x439b4a1a,
-  0x2e6569a7, 0x1630e5de, 0x1be363af, 0x6f5f0e52,
-  0x5b266bc3, 0x2f2a51be, 0x204e7e14, 0x1b3314c6,
-  0x4472b8f9, 0x4162fb52, 0x72549950, 0x3223f889,
-  0x0e655f4a, 0x65c3dce4, 0x04825988, 0x22b41458,
-  0x53a4e10d, 0x3e2a66d5, 0x29de3e31, 0x0252fa74,
-  0x267fe54f, 0x42d6d8ba, 0x5951218f, 0x73db5791,
-  0x618444e4, 0x79abcaa1, 0x0ddcf5c8, 0x2cbed2e6,
-  0x73159e0e, 0x7aadc871, 0x10e3f9a4, 0x762e9d65,
-  0x2a7138c9, 0x59fe016f, 0x5b6c3ee4, 0x28888205,
-  0x695fa5b1, 0x50f92ddd, 0x07eefc3b, 0x42bb693a,
-  0x71312191, 0x3653ecbd, 0x1d80c4ed, 0x5a536187,
-  0x6a286789, 0x4a1ffbb3, 0x1e976003, 0x5a8c5f29,
-  0x2ac83bdb, 0x5ab9cb08, 0x63039928, 0x5a4c04f4,
-  0x7b329952, 0x40d40fcb, 0x01810524, 0x2555e83c,
-  0x748d0b4f, 0x534f1612, 0x272353f2, 0x6992e1ea,
-  0x33cc5e71, 0x5163b55e, 0x29886a7f, 0x7cfb1eae,
-  0x330271e0, 0x6f05e91c, 0x35b01e02, 0x64bbc053,
-  0x76eb9337, 0x62612f48, 0x044e0af2, 0x1dac022e,
-  0x1ca56f0c, 0x0210ef2c, 0x5af7a1a9, 0x2632f2b0,
-  0x23d0401c, 0x0c594a46, 0x77582293, 0x297df41b,
-  0x4c7b8718, 0x6c48d948, 0x4835e412, 0x74795651,
-  0x28ca3506, 0x4071f739, 0x032fdbf2, 0x097f7bc8,
-  0x44ced256, 0x47f25cb9, 0x43500684, 0x45481b9a,
-  0x5a5ecc82, 0x4fe9ed61, 0x337ee559, 0x556852b9,
-  0x0b24b460, 0x696db949, 0x7a2def9d, 0x4fcd5640,
-  0x1babd707, 0x5c9254a3, 0x44d26e0d, 0x0e26b8e4,
-  0x3b1c3b5c, 0x0078c784, 0x27a7dc96, 0x1d525589,
-  0x4384ae38, 0x447b77c3, 0x78488b8c, 0x5eab10f1,
-  0x16812737, 0x37cc8efa, 0x219cda83, 0x00bcc48f,
-  0x3c667020, 0x492d7eaa, 0x710d06ce, 0x4172c47a,
-  0x358098ec, 0x1fff647b, 0x65672792, 0x1a7b927d,
-  0x24006275, 0x04e630a0, 0x2f2a9185, 0x5873704b,
-  0x0a8c69bc, 0x06b49059, 0x49837c48, 0x4f90a2d0,
-  0x29ad7dd7, 0x3674be92, 0x46d5635f, 0x782758a2,
-  0x721a2a75, 0x13427ca9, 0x20e03cc9, 0x5f884596,
-  0x19dc210f, 0x066c954d, 0x52f43f40, 0x5d9c256f,
-  0x7f0acaae, 0x1e186b81, 0x55e9920f, 0x0e4f77b2,
-  0x6700ec53, 0x268837c0, 0x554ce08b, 0x4284e695,
-  0x2127e806, 0x384cb53b, 0x51076b2f, 0x23f9eb15
-};
+  0x3ee18b32, 0x746d0d6b, 0x591be6a3, 0x760bd17f, 0x363c765d, 0x4bf3d5c5, 0x10f0510a, 0x39a84605, 0x2282b48f, 0x6903652e,
+  0x1b491170, 0x1ab8407a, 0x776b8aa8, 0x5b126ffe, 0x5095db1a, 0x565fe90c, 0x3ae1f068, 0x73fdf0cb, 0x72f39a81, 0x6a40a4a3,
+  0x4ef557fe, 0x360c1a2c, 0x4579b0ea, 0x61dfd174, 0x269b242f, 0x752d6298, 0x15f10fa3, 0x618b7ab3, 0x6699171f, 0x488f2c6c,
+  0x790f8cdb, 0x5ed15565, 0x04eba3c0, 0x5009ac0b, 0x3a5d6c1f, 0x1a4f7853, 0x1affabd4, 0x74aace1f, 0x2310b46d, 0x466b611a,
+  0x18c5d4a0, 0x7eb9fffe, 0x76098df6, 0x4172f860, 0x689e3c2f, 0x722cdc29, 0x64548175, 0x28f46721, 0x58fdf93f, 0x12c2dcee,
+  0x58cb1327, 0x02d4af27, 0x4d1c6fcd, 0x72fe572d, 0x7038d366, 0x0bfa1898, 0x788d2438, 0x1f131f37, 0x25729ee6, 0x635ea6a9,
+  0x3b0b5714, 0x6ac759d2, 0x5faf688a, 0x0c2fe571, 0x7487538e, 0x65491b59, 0x60cd86e4, 0x5d6482d8, 0x4a59fa77, 0x78439700,
+  0x56a51f48, 0x360544ae, 0x6c01b3ef, 0x2228c036, 0x15b7e88b, 0x326e0dd8, 0x509491af, 0x72d06023, 0x26181f5d, 0x7924c4a4,
+  0x70c60bf2, 0x7b5bc151, 0x28e42640, 0x48af0c3e, 0x009b6301, 0x06dd3366, 0x2ad1eb24, 0x102ce33c, 0x1e504f5a, 0x5ab4c90f,
+  0x669ccca1, 0x118d5954, 0x1a1e4a7c, 0x1807d1f9, 0x525a58d0, 0x2f13ae2d, 0x17335a52, 0x714eb2f9, 0x1865dfc7, 0x61b64b52,
+  0x0dc9e939, 0x4fccde4c, 0x6d5873af, 0x47c62b43, 0x0fa1d4b0, 0x2f00cdf8, 0x68029083, 0x52645fa6, 0x4bb37c9b, 0x53d60251,
+  0x48364566, 0x35b4889b, 0x46783d34, 0x30c12697, 0x210459a1, 0x36962f2d, 0x36305d8f, 0x170e9dbd, 0x687c8739, 0x261c14e4,
+  0x3cc51cc7, 0x02add945, 0x01a88529, 0x6617aa77, 0x6be627ca, 0x14c7fc46, 0x46fb3b41, 0x1bffff9e, 0x1e6c61be, 0x10966c8f,
+  0x3f69199b, 0x1b5e9e06, 0x4880890f, 0x055613e6, 0x6c742db5, 0x7be1e15e, 0x2522e317, 0x41fe3369, 0x2b462f30, 0x605b7e8e,
+  0x1c19b868, 0x3fadcb16, 0x781c5e24, 0x1c6b0c08, 0x499f0bb9, 0x04b0b766, 0x7d6cad1e, 0x097f7d36, 0x2e02956a, 0x03adc713,
+  0x4ce950b7, 0x6e57a313, 0x557badb5, 0x73212afb, 0x3f7f6ed2, 0x0558e3d6, 0x28376f73, 0x54dac21d, 0x6c3f4771, 0x67147bc8,
+  0x5ae9fd88, 0x51ede3c0, 0x1067d134, 0x5246b937, 0x056e74ed, 0x5d7869b2, 0x62356370, 0x76a0c583, 0x3defb558, 0x5200dcae,
+  0x1432a7e8, 0x3ae4ad55, 0x0c4cca8a, 0x0607c4d7, 0x1944ae2b, 0x726479f0, 0x558e6035, 0x5ae64061, 0x4e1e9a8a, 0x0cf04d9f,
+  0x46ef4a87, 0x0554224f, 0x70d70ab3, 0x03cc954e, 0x39d0cd57, 0x1b11fb56, 0x62a0e9ee, 0x55888135, 0x3e93ebeb, 0x29578ee1,
+  0x0bcb0ef4, 0x529e16af, 0x165bab64, 0x39ed562e, 0x52c59d67, 0x48c84d29, 0x0fd0d1c7, 0x795fd395, 0x79a1c4f3, 0x5010c835,
+  0x4fbe4ba8, 0x49a597e9, 0x29f017ff, 0x59dde0be, 0x2c660275, 0x15fcfbf7, 0x1eab540f, 0x38e2cf56, 0x74608d5c, 0x7cd4b02c,
+  0x52a115b9, 0x2bdee9ac, 0x5456c6da, 0x63626453, 0x15279241, 0x19b60519, 0x508af0e1, 0x2e3ce97b, 0x568710d4, 0x6abb3059,
+  0x7897b1a5, 0x17034ff6, 0x2aef7d5e, 0x5a281657, 0x0fa5d304, 0x76f0a37e, 0x31be0f08, 0x46ce7c20, 0x563e4e90, 0x31540773,
+  0x1cdc9c51, 0x10366bfa, 0x1b6cd03a, 0x615f1540, 0x18c3d6c8, 0x3cb2bf8e, 0x29bf799c, 0x40b87edb, 0x42c34863, 0x1e9edb40,
+  0x64734fe2, 0x3ddf176a, 0x1c458c7f, 0x06138c9f, 0x5e695e56, 0x02c98403, 0x0474de75, 0x660e1df8, 0x6df73788, 0x3770f68c,
+  0x758bb7d5, 0x0763d105, 0x16e61f16, 0x153974c1, 0x29ded842, 0x1a0d12c3, 0x599ec61d, 0x05904d54, 0x79e9b0ea, 0x4976da61,
+  0x5834243c, 0x67c17d2f, 0x65fbcda0, 0x17bdc554, 0x465e9741, 0x7a0ee6d5, 0x3b357597, 0x0d1da287, 0x01211373, 0x04a05de6,
+  0x5deb5dbd, 0x6d993eb0, 0x2064ce7c, 0x3011a8c1, 0x36ece6b1, 0x4a0963be, 0x0cf46ef0, 0x0d53ba44, 0x63260063, 0x187f1d6e,
+  0x7e866a7e, 0x4b6885af, 0x254d6d47, 0x715474fd, 0x6896dcb2, 0x7554eea6, 0x2161bf36, 0x5387f5f8, 0x5c4bc064, 0x059a7755,
+  0x7d4307e1, 0x17326e2f, 0x5e2315c1, 0x14c26eae, 0x1e5cd6f2, 0x352b7ac8, 0x66591ef3, 0x381e80cd, 0x19b3bfc1, 0x3668946f,
+  0x4b6d7d70, 0x20feab7d, 0x1b6340af, 0x356b6cab, 0x299099dc, 0x295ab8d4, 0x184c8623, 0x134f8e4c, 0x7caf609c, 0x716d81f9,
+  0x2e04231f, 0x1dd45301, 0x43e9fcf9, 0x1c225c06, 0x0994797e, 0x5b3f6006, 0x1d22dcec, 0x32993108, 0x3f0c2bcc, 0x4d44fbfa,
+  0x389de78c, 0x7f8be723, 0x5dab92c1, 0x7866afce, 0x3bfc7011, 0x4a27d7d3, 0x0c79d05c, 0x268dc4da, 0x3fe10f84, 0x1f18394d,
+  0x20b9ba99, 0x312e520a, 0x64cf2f05, 0x322a7c04, 0x4cc077ce, 0x7218aa35, 0x550cacb8, 0x5943be47, 0x15b346a8, 0x0d6a1d8e,
+  0x3f08a54d, 0x7a6e9807, 0x274f8bbc, 0x6feb2033, 0x64b10c2b, 0x2cbaa0b7, 0x0db7decc, 0x22b807e3, 0x10d15c39, 0x6a9b314c,
+  0x5ff27199, 0x5072b2cd, 0x4eaf4b49, 0x5a890464, 0x7df0ca60, 0x548e8983, 0x5e3f0a21, 0x70027683, 0x503e6bf2, 0x47ad6e0d,
+  0x77173b26, 0x6dc04878, 0x4d73a573, 0x439b4a1a, 0x2e6569a7, 0x1630e5de, 0x1be363af, 0x6f5f0e52, 0x5b266bc3, 0x2f2a51be,
+  0x204e7e14, 0x1b3314c6, 0x4472b8f9, 0x4162fb52, 0x72549950, 0x3223f889, 0x0e655f4a, 0x65c3dce4, 0x04825988, 0x22b41458,
+  0x53a4e10d, 0x3e2a66d5, 0x29de3e31, 0x0252fa74, 0x267fe54f, 0x42d6d8ba, 0x5951218f, 0x73db5791, 0x618444e4, 0x79abcaa1,
+  0x0ddcf5c8, 0x2cbed2e6, 0x73159e0e, 0x7aadc871, 0x10e3f9a4, 0x762e9d65, 0x2a7138c9, 0x59fe016f, 0x5b6c3ee4, 0x28888205,
+  0x695fa5b1, 0x50f92ddd, 0x07eefc3b, 0x42bb693a, 0x71312191, 0x3653ecbd, 0x1d80c4ed, 0x5a536187, 0x6a286789, 0x4a1ffbb3,
+  0x1e976003, 0x5a8c5f29, 0x2ac83bdb, 0x5ab9cb08, 0x63039928, 0x5a4c04f4, 0x7b329952, 0x40d40fcb, 0x01810524, 0x2555e83c,
+  0x748d0b4f, 0x534f1612, 0x272353f2, 0x6992e1ea, 0x33cc5e71, 0x5163b55e, 0x29886a7f, 0x7cfb1eae, 0x330271e0, 0x6f05e91c,
+  0x35b01e02, 0x64bbc053, 0x76eb9337, 0x62612f48, 0x044e0af2, 0x1dac022e, 0x1ca56f0c, 0x0210ef2c, 0x5af7a1a9, 0x2632f2b0,
+  0x23d0401c, 0x0c594a46, 0x77582293, 0x297df41b, 0x4c7b8718, 0x6c48d948, 0x4835e412, 0x74795651, 0x28ca3506, 0x4071f739,
+  0x032fdbf2, 0x097f7bc8, 0x44ced256, 0x47f25cb9, 0x43500684, 0x45481b9a, 0x5a5ecc82, 0x4fe9ed61, 0x337ee559, 0x556852b9,
+  0x0b24b460, 0x696db949, 0x7a2def9d, 0x4fcd5640, 0x1babd707, 0x5c9254a3, 0x44d26e0d, 0x0e26b8e4, 0x3b1c3b5c, 0x0078c784,
+  0x27a7dc96, 0x1d525589, 0x4384ae38, 0x447b77c3, 0x78488b8c, 0x5eab10f1, 0x16812737, 0x37cc8efa, 0x219cda83, 0x00bcc48f,
+  0x3c667020, 0x492d7eaa, 0x710d06ce, 0x4172c47a, 0x358098ec, 0x1fff647b, 0x65672792, 0x1a7b927d, 0x24006275, 0x04e630a0,
+  0x2f2a9185, 0x5873704b, 0x0a8c69bc, 0x06b49059, 0x49837c48, 0x4f90a2d0, 0x29ad7dd7, 0x3674be92, 0x46d5635f, 0x782758a2,
+  0x721a2a75, 0x13427ca9, 0x20e03cc9, 0x5f884596, 0x19dc210f, 0x066c954d, 0x52f43f40, 0x5d9c256f, 0x7f0acaae, 0x1e186b81,
+  0x55e9920f, 0x0e4f77b2, 0x6700ec53, 0x268837c0, 0x554ce08b, 0x4284e695, 0x2127e806, 0x384cb53b, 0x51076b2f, 0x23f9eb15};
 
 // We don't need this generator in release.
 #ifdef TEST
@@ -169,7 +90,7 @@ static uint64_t MMH_x[MMH_X_SIZE + 8] = {
 static void
 ink_init_MMH()
 {
-  srand48(13);                  // must remain the same!
+  srand48(13); // must remain the same!
   for (int i = 0; i < MMH_X_SIZE; i++)
     MMH_x[i] = lrand48();
 }
@@ -182,21 +103,21 @@ static inline void
 _memcpy(void *dest, const void *src, int nbytes)
 {
   for (int i = 0; i < nbytes; i++)
-    ((char *) dest)[i] = ((char *) src)[i];
+    ((char *)dest)[i] = ((char *)src)[i];
 }
 
 #define memcpy _memcpy
 #endif
 
 int
-ink_code_incr_MMH_init(MMH_CTX * ctx)
+ink_code_incr_MMH_init(MMH_CTX *ctx)
 {
   ctx->buffer_size = 0;
   ctx->blocks = 0;
-  ctx->state[0] = ((uint64_t) MMH_x[MMH_X_SIZE + 0] << 32) + MMH_x[MMH_X_SIZE + 1];
-  ctx->state[1] = ((uint64_t) MMH_x[MMH_X_SIZE + 2] << 32) + MMH_x[MMH_X_SIZE + 3];
-  ctx->state[2] = ((uint64_t) MMH_x[MMH_X_SIZE + 4] << 32) + MMH_x[MMH_X_SIZE + 5];
-  ctx->state[3] = ((uint64_t) MMH_x[MMH_X_SIZE + 6] << 32) + MMH_x[MMH_X_SIZE + 7];
+  ctx->state[0] = ((uint64_t)MMH_x[MMH_X_SIZE + 0] << 32) + MMH_x[MMH_X_SIZE + 1];
+  ctx->state[1] = ((uint64_t)MMH_x[MMH_X_SIZE + 2] << 32) + MMH_x[MMH_X_SIZE + 3];
+  ctx->state[2] = ((uint64_t)MMH_x[MMH_X_SIZE + 4] << 32) + MMH_x[MMH_X_SIZE + 5];
+  ctx->state[3] = ((uint64_t)MMH_x[MMH_X_SIZE + 6] << 32) + MMH_x[MMH_X_SIZE + 7];
   return 0;
 }
 
@@ -205,15 +126,15 @@ ink_code_MMH(unsigned char *input, int len, unsigned char *sixteen_byte_hash)
 {
   MMH_CTX ctx;
   ink_code_incr_MMH_init(&ctx);
-  ink_code_incr_MMH_update(&ctx, (const char *) input, len);
+  ink_code_incr_MMH_update(&ctx, (const char *)input, len);
   ink_code_incr_MMH_final(sixteen_byte_hash, &ctx);
   return 0;
 }
 
 static inline void
-MMH_update(MMH_CTX * ctx, unsigned char *ab)
+MMH_update(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) ab;
+  uint32_t *b = (uint32_t *)ab;
   ctx->state[0] += b[0] * MMH_x[(ctx->blocks + 0) % MMH_X_SIZE];
   ctx->state[1] += b[1] * MMH_x[(ctx->blocks + 1) % MMH_X_SIZE];
   ctx->state[2] += b[2] * MMH_x[(ctx->blocks + 2) % MMH_X_SIZE];
@@ -222,9 +143,9 @@ MMH_update(MMH_CTX * ctx, unsigned char *ab)
 }
 
 static inline void
-MMH_updateb1(MMH_CTX * ctx, unsigned char *ab)
+MMH_updateb1(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) (ab - 1);
+  uint32_t *b = (uint32_t *)(ab - 1);
   uint32_t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4];
   b0 = (b0 << 8) + (b1 >> 24);
   b1 = (b1 << 8) + (b2 >> 24);
@@ -238,9 +159,9 @@ MMH_updateb1(MMH_CTX * ctx, unsigned char *ab)
 }
 
 static inline void
-MMH_updateb2(MMH_CTX * ctx, unsigned char *ab)
+MMH_updateb2(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) (ab - 2);
+  uint32_t *b = (uint32_t *)(ab - 2);
   uint32_t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4];
   b0 = (b0 << 16) + (b1 >> 16);
   b1 = (b1 << 16) + (b2 >> 16);
@@ -254,9 +175,9 @@ MMH_updateb2(MMH_CTX * ctx, unsigned char *ab)
 }
 
 static inline void
-MMH_updateb3(MMH_CTX * ctx, unsigned char *ab)
+MMH_updateb3(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) (ab - 3);
+  uint32_t *b = (uint32_t *)(ab - 3);
   uint32_t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4];
   b0 = (b0 << 24) + (b1 >> 8);
   b1 = (b1 << 24) + (b2 >> 8);
@@ -270,9 +191,9 @@ MMH_updateb3(MMH_CTX * ctx, unsigned char *ab)
 }
 
 static inline void
-MMH_updatel1(MMH_CTX * ctx, unsigned char *ab)
+MMH_updatel1(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) (ab - 1);
+  uint32_t *b = (uint32_t *)(ab - 1);
   uint32_t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4];
   b0 = (b0 >> 8) + (b1 << 24);
   b1 = (b1 >> 8) + (b2 << 24);
@@ -286,9 +207,9 @@ MMH_updatel1(MMH_CTX * ctx, unsigned char *ab)
 }
 
 static inline void
-MMH_updatel2(MMH_CTX * ctx, unsigned char *ab)
+MMH_updatel2(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) (ab - 2);
+  uint32_t *b = (uint32_t *)(ab - 2);
   uint32_t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4];
   b0 = (b0 >> 16) + (b1 << 16);
   b1 = (b1 >> 16) + (b2 << 16);
@@ -302,9 +223,9 @@ MMH_updatel2(MMH_CTX * ctx, unsigned char *ab)
 }
 
 static inline void
-MMH_updatel3(MMH_CTX * ctx, unsigned char *ab)
+MMH_updatel3(MMH_CTX *ctx, unsigned char *ab)
 {
-  uint32_t *b = (uint32_t *) (ab - 3);
+  uint32_t *b = (uint32_t *)(ab - 3);
   uint32_t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4];
   b0 = (b0 >> 24) + (b1 << 8);
   b1 = (b1 >> 24) + (b2 << 8);
@@ -318,9 +239,9 @@ MMH_updatel3(MMH_CTX * ctx, unsigned char *ab)
 }
 
 int
-ink_code_incr_MMH_update(MMH_CTX * ctx, const char *ainput, int input_length)
+ink_code_incr_MMH_update(MMH_CTX *ctx, const char *ainput, int input_length)
 {
-  unsigned char *in = (unsigned char *) ainput;
+  unsigned char *in = (unsigned char *)ainput;
   unsigned char *end = in + input_length;
   if (ctx->buffer_size) {
     int l = 16 - ctx->buffer_size;
@@ -336,7 +257,7 @@ ink_code_incr_MMH_update(MMH_CTX * ctx, const char *ainput, int input_length)
   }
   {
     // check alignment
-    int alignment = (int)((intptr_t) in & 0x3);
+    int alignment = (int)((intptr_t)in & 0x3);
     if (alignment) {
 #if defined(_BIG_ENDIAN)
 #define big_endian 1
@@ -344,7 +265,7 @@ ink_code_incr_MMH_update(MMH_CTX * ctx, const char *ainput, int input_length)
 #define big_endian 0
 #else
       unsigned int endian = 1;
-      int big_endian = !*(char *) &endian;
+      int big_endian = !*(char *)&endian;
 #endif
       if (big_endian) {
         if (alignment == 1) {
@@ -389,11 +310,11 @@ ink_code_incr_MMH_update(MMH_CTX * ctx, const char *ainput, int input_length)
 Lstore:
   if (end - in) {
     int oldbs = ctx->buffer_size;
-    ctx->buffer_size += (int) (end - in);
+    ctx->buffer_size += (int)(end - in);
 #ifndef TEST
     ink_assert(ctx->buffer_size < 16);
 #endif
-    memcpy(ctx->buffer + oldbs, in, (int) (end - in));
+    memcpy(ctx->buffer + oldbs, in, (int)(end - in));
   }
   return 0;
 }
@@ -405,18 +326,18 @@ Lstore:
 inline void
 _memset(unsigned char *b, int c, int len)
 {
-  (void) c;
+  (void)c;
   int o = len & 0x3, i;
   for (i = 0; i < o; i++)
     b[i] = 0;
   for (i = 0; i < (len - o) / 4; i++)
-    ((uint32_t *) (b + o))[i] = 0;
+    ((uint32_t *)(b + o))[i] = 0;
 }
 #endif
 
 
 int
-ink_code_incr_MMH_final(uint8_t *presult, MMH_CTX * ctx)
+ink_code_incr_MMH_final(uint8_t *presult, MMH_CTX *ctx)
 {
   unsigned int len = ctx->blocks * 4 + ctx->buffer_size;
   // pad out to 16 bytes
@@ -426,12 +347,12 @@ ink_code_incr_MMH_final(uint8_t *presult, MMH_CTX * ctx)
     MMH_update(ctx, ctx->buffer);
   }
   // append length (before padding)
-  unsigned int *pbuffer = (unsigned int *) ctx->buffer;
+  unsigned int *pbuffer = (unsigned int *)ctx->buffer;
   pbuffer[1] = pbuffer[2] = pbuffer[3] = pbuffer[0] = len;
   MMH_update(ctx, ctx->buffer);
   // final phase
-  uint32_t *b = (uint32_t *) presult;
-  uint64_t d = (((uint64_t) 1) << 32) + 15;
+  uint32_t *b = (uint32_t *)presult;
+  uint64_t d = (((uint64_t)1) << 32) + 15;
   uint32_t b0 = uint32_t(ctx->state[0] % d);
   uint32_t b1 = uint32_t(ctx->state[1] % d);
   uint32_t b2 = uint32_t(ctx->state[2] % d);
@@ -439,11 +360,8 @@ ink_code_incr_MMH_final(uint8_t *presult, MMH_CTX * ctx)
   // scramble the bits, losslessly (reversibly)
   b[0] = b0;
   b[1] = b1 ^ (b0 >> 24) ^ (b0 << 8);
-  b[2] = b2 ^ (b1 >> 16) ^ (b1 << 16)
-    ^ (b0 >> 24) ^ (b0 << 8);
-  b[3] = b3 ^ (b1 >> 8) ^ (b1 << 24)
-    ^ (b2 >> 16) ^ (b2 << 16)
-    ^ (b0 >> 24) ^ (b0 << 8);
+  b[2] = b2 ^ (b1 >> 16) ^ (b1 << 16) ^ (b0 >> 24) ^ (b0 << 8);
+  b[3] = b3 ^ (b1 >> 8) ^ (b1 << 24) ^ (b2 >> 16) ^ (b2 << 16) ^ (b0 >> 24) ^ (b0 << 8);
 
   b0 = b[0];
   b1 = b[1];
@@ -451,25 +369,25 @@ ink_code_incr_MMH_final(uint8_t *presult, MMH_CTX * ctx)
   b3 = b[3];
 
   b[2] = b2 ^ (b3 >> 24) ^ (b3 << 8);
-  b[1] = b1 ^ (b2 >> 16) ^ (b2 << 16)
-    ^ (b3 >> 24) ^ (b3 << 8);
-  b[0] = b0 ^ (b3 >> 8) ^ (b3 << 24)
-    ^ (b2 >> 16) ^ (b2 << 16)
-    ^ (b1 >> 24) ^ (b1 << 8);
+  b[1] = b1 ^ (b2 >> 16) ^ (b2 << 16) ^ (b3 >> 24) ^ (b3 << 8);
+  b[0] = b0 ^ (b3 >> 8) ^ (b3 << 24) ^ (b2 >> 16) ^ (b2 << 16) ^ (b1 >> 24) ^ (b1 << 8);
   return 0;
 }
 
-MMHContext::MMHContext() {
+MMHContext::MMHContext()
+{
   ink_code_incr_MMH_init(&_ctx);
 }
 
 bool
-MMHContext::update(void const* data, int length) {
-  return 0 == ink_code_incr_MMH_update(&_ctx, static_cast<char const*>(data), length);
+MMHContext::update(void const *data, int length)
+{
+  return 0 == ink_code_incr_MMH_update(&_ctx, static_cast<char const *>(data), length);
 }
 
 bool
-MMHContext::finalize(CryptoHash& hash) {
+MMHContext::finalize(CryptoHash &hash)
+{
   return 0 == ink_code_incr_MMH_final(hash.u8, &_ctx);
 }
 
@@ -478,7 +396,7 @@ MMHContext::finalize(CryptoHash& hash) {
 #define TEST_COLLISIONS 10000000
 
 static int
-xxcompar(uint32_t ** x, uint32_t ** y)
+xxcompar(uint32_t **x, uint32_t **y)
 {
   for (int i = 0; i < 4; i++) {
     if (x[i] > y[i])
@@ -495,8 +413,7 @@ double *xf;
 
 main()
 {
-  union
-  {
+  union {
     unsigned char hash[16];
     uint32_t h[4];
   } h;
@@ -509,13 +426,13 @@ main()
   char *sc2 = "http://npdev:19080/1.8666000000/4000";
   char *sc3 = "http://:@npdev/1.6664000000/4000;?";
   char *sc4 = "http://:@npdev/1.8666000000/4000;?";
-  ink_code_MMH((unsigned char *) sc1, strlen(sc1), h.hash);
+  ink_code_MMH((unsigned char *)sc1, strlen(sc1), h.hash);
   printf("%X %X %X %X\n", h.h[0], h.h[1], h.h[2], h.h[3]);
-  ink_code_MMH((unsigned char *) sc2, strlen(sc2), h.hash);
+  ink_code_MMH((unsigned char *)sc2, strlen(sc2), h.hash);
   printf("%X %X %X %X\n", h.h[0], h.h[1], h.h[2], h.h[3]);
-  ink_code_MMH((unsigned char *) sc3, strlen(sc3), h.hash);
+  ink_code_MMH((unsigned char *)sc3, strlen(sc3), h.hash);
   printf("%X %X %X %X\n", h.h[0], h.h[1], h.h[2], h.h[3]);
-  ink_code_MMH((unsigned char *) sc4, strlen(sc4), h.hash);
+  ink_code_MMH((unsigned char *)sc4, strlen(sc4), h.hash);
   printf("%X %X %X %X\n", h.h[0], h.h[1], h.h[2], h.h[3]);
 
   srand48(time(NULL));
@@ -523,16 +440,16 @@ main()
     char xs[256];
     xf[xx] = drand48();
     sprintf(xs, "http://@npdev/%16.14f/4000;?", xf[xx]);
-    ink_code_MMH((unsigned char *) xs, strlen(xs), (unsigned char *) &xxh[xx]);
+    ink_code_MMH((unsigned char *)xs, strlen(xs), (unsigned char *)&xxh[xx]);
   }
   qsort(xxh, TEST_COLLISIONS, 16, xxcompar);
   for (int xy = 0; xy < TEST_COLLISIONS - 1; xy++) {
-    if (xxh[xy][0] == xxh[xy + 1][0] &&
-        xxh[xy][1] == xxh[xy + 1][1] && xxh[xy][2] == xxh[xy + 1][2] && xxh[xy][3] == xxh[xy + 1][3])
+    if (xxh[xy][0] == xxh[xy + 1][0] && xxh[xy][1] == xxh[xy + 1][1] && xxh[xy][2] == xxh[xy + 1][2] &&
+        xxh[xy][3] == xxh[xy + 1][3])
       printf("********** collision %d\n", xy);
   }
 
-  unsigned char *s = (unsigned char *) MMH_x;
+  unsigned char *s = (unsigned char *)MMH_x;
   int l = sizeof(MMH_x);
   unsigned char *s1 = (unsigned char *)ats_malloc(l + 3);
   s1 += 1;
@@ -560,10 +477,10 @@ main()
   printf("test chunking\n");
   ink_code_incr_MMH_init(&c);
   for (i = 0; i < 24; i++) {
-    ink_code_incr_MMH_update(&c, (char *) t, i);
+    ink_code_incr_MMH_update(&c, (char *)t, i);
     t += i;
   }
-  ink_code_incr_MMH_final((char *) h.hash, &c);
+  ink_code_incr_MMH_final((char *)h.hash, &c);
   printf("%X %X %X %X\n", h.h[0], h.h[1], h.h[2], h.h[3]);
   int q = t - s;
   ink_code_MMH(s, q, h.hash);
@@ -575,7 +492,7 @@ main()
   memset(hist, 0, sizeof(hist));
   size_t xx;
   while (((xx = fread(x, 1, 128, fp)) == 128)) {
-    ink_code_MMH((unsigned char *) x, 128, h.hash);
+    ink_code_MMH((unsigned char *)x, 128, h.hash);
     hist[h.h[0] & 255]++;
   }
   for (int z = 0; z < 256; z++) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/MMH.h
----------------------------------------------------------------------
diff --git a/lib/ts/MMH.h b/lib/ts/MMH.h
index 74f2c3c..a886bdf 100644
--- a/lib/ts/MMH.h
+++ b/lib/ts/MMH.h
@@ -22,14 +22,13 @@
  */
 
 #ifndef _MMH_h_
-#define	_MMH_h_
+#define _MMH_h_
 
 #include "ink_code.h"
 #include "ink_defs.h"
 #include "CryptoHash.h"
 
-struct MMH_CTX
-{
+struct MMH_CTX {
   uint64_t state[4];
   unsigned char buffer[32];
   int buffer_size;
@@ -39,9 +38,9 @@ struct MMH_CTX
 // signed-unsigned-const gratuitous differences brought
 // to you by history and the ANSI committee
 
-int inkcoreapi ink_code_incr_MMH_init(MMH_CTX * context);
-int inkcoreapi ink_code_incr_MMH_update(MMH_CTX * context, const char *input, int input_length);
-int inkcoreapi ink_code_incr_MMH_final(uint8_t *sixteen_byte_hash_pointer, MMH_CTX * context);
+int inkcoreapi ink_code_incr_MMH_init(MMH_CTX *context);
+int inkcoreapi ink_code_incr_MMH_update(MMH_CTX *context, const char *input, int input_length);
+int inkcoreapi ink_code_incr_MMH_final(uint8_t *sixteen_byte_hash_pointer, MMH_CTX *context);
 int inkcoreapi ink_code_MMH(unsigned char *input, int len, unsigned char *sixteen_byte_hash);
 
 /**
@@ -54,13 +53,14 @@ class MMHContext : public CryptoContext
 {
 protected:
   MMH_CTX _ctx;
+
 public:
   MMHContext();
   /// Update the hash with @a data of @a length bytes.
-  virtual bool update(void const* data, int length);
+  virtual bool update(void const *data, int length);
   /// Finalize and extract the @a hash.
-  virtual bool finalize(CryptoHash& hash);
-# if 0
+  virtual bool finalize(CryptoHash &hash);
+#if 0
   MMH & loadFromBuffer(char *MMH_buf)
   {
     int i;
@@ -113,7 +113,7 @@ public:
   {
     return ink_code_md5_stringify_fast(hex_MMH, str());
   }
-# endif
+#endif
 };
 
 #endif


[04/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpConfig.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpConfig.cc b/lib/wccp/WccpConfig.cc
index fca9966..b2a5327 100644
--- a/lib/wccp/WccpConfig.cc
+++ b/lib/wccp/WccpConfig.cc
@@ -19,30 +19,34 @@
     limitations under the License.
  */
 
-# include "WccpLocal.h"
-# include <sstream>
-# include <tsconfig/TsValue.h>
-# include <arpa/inet.h>
-# include <iostream>
-# include <errno.h>
-# include <stdlib.h>
+#include "WccpLocal.h"
+#include <sstream>
+#include <tsconfig/TsValue.h>
+#include <arpa/inet.h>
+#include <iostream>
+#include <errno.h>
+#include <stdlib.h>
 
 using ts::config::Configuration;
 using ts::config::Value;
 
 // Support that must go in the standard namespace.
-namespace std {
-
-inline ostream& operator << ( ostream& s, ts::ConstBuffer const& b ) {
-  if (b._ptr) s.write(b._ptr, b._size);
-  else s << b._size;
+namespace std
+{
+inline ostream &operator<<(ostream &s, ts::ConstBuffer const &b)
+{
+  if (b._ptr)
+    s.write(b._ptr, b._size);
+  else
+    s << b._size;
   return s;
 }
 
 } // namespace std
 
 // WCCP related things that are file local.
-namespace {
+namespace
+{
 using namespace wccp;
 
 // Scratch global list of seed router addresses.
@@ -51,64 +55,69 @@ using namespace wccp;
 std::vector<uint32_t> Seed_Router;
 
 // Names used for various elements and properties.
-static char const * const SVC_NAME = "service";
-
-static char const * const SVC_PROP_ID = "id";
-static char const * const SVC_PROP_TYPE = "type";
-static char const * const SVC_PROP_PRIORITY = "priority";
-static char const * const SVC_PROP_PROTOCOL = "protocol";
-static char const * const SVC_PROP_FLAGS = "flags";
-static char const * const SVC_PROP_PRIMARY_HASH = "primary-hash";
-static char const * const SVC_PROP_ALT_HASH = "alt-hash";
-static char const * const SVC_PROP_PORTS = "ports";
-static char const * const SVC_PROP_PORT_TYPE = "port-type";
-static char const * const SVC_PROP_SECURITY = "security";
-static char const * const SVC_PROP_ROUTERS = "routers";
-static char const * const SVC_PROP_FORWARD = "forward";
-static char const * const SVC_PROP_RETURN = "return";
-static char const * const SVC_PROP_ASSIGN = "assignment";
-static char const * const SVC_PROP_PROC = "proc-name";
-
-static char const * const SECURITY_PROP_OPTION = "option";
-static char const * const SECURITY_PROP_KEY = "key";
+static char const *const SVC_NAME = "service";
+
+static char const *const SVC_PROP_ID = "id";
+static char const *const SVC_PROP_TYPE = "type";
+static char const *const SVC_PROP_PRIORITY = "priority";
+static char const *const SVC_PROP_PROTOCOL = "protocol";
+static char const *const SVC_PROP_FLAGS = "flags";
+static char const *const SVC_PROP_PRIMARY_HASH = "primary-hash";
+static char const *const SVC_PROP_ALT_HASH = "alt-hash";
+static char const *const SVC_PROP_PORTS = "ports";
+static char const *const SVC_PROP_PORT_TYPE = "port-type";
+static char const *const SVC_PROP_SECURITY = "security";
+static char const *const SVC_PROP_ROUTERS = "routers";
+static char const *const SVC_PROP_FORWARD = "forward";
+static char const *const SVC_PROP_RETURN = "return";
+static char const *const SVC_PROP_ASSIGN = "assignment";
+static char const *const SVC_PROP_PROC = "proc-name";
+
+static char const *const SECURITY_PROP_OPTION = "option";
+static char const *const SECURITY_PROP_KEY = "key";
 
 /// Helper structure for processing configuration strings.
 struct CfgString {
-  char const* m_text; ///< Text value of the option.
-  bool m_found; ///< String was found.
+  char const *m_text; ///< Text value of the option.
+  bool m_found;       ///< String was found.
 };
 typedef std::vector<CfgString> CfgOpts;
 
-# define N_OPTS(x) (sizeof(x) / sizeof(*x))
+#define N_OPTS(x) (sizeof(x) / sizeof(*x))
 
-CfgString FORWARD_OPTS[] = { { "gre" } , { "l2" } };
-size_t const N_FORWARD_OPTS = sizeof(FORWARD_OPTS)/sizeof(*FORWARD_OPTS);
+CfgString FORWARD_OPTS[] = {{"gre"}, {"l2"}};
+size_t const N_FORWARD_OPTS = sizeof(FORWARD_OPTS) / sizeof(*FORWARD_OPTS);
 
-CfgString RETURN_OPTS[] = { { "gre" } , { "l2" } };
-size_t const N_RETURN_OPTS = sizeof(RETURN_OPTS)/sizeof(*RETURN_OPTS);
+CfgString RETURN_OPTS[] = {{"gre"}, {"l2"}};
+size_t const N_RETURN_OPTS = sizeof(RETURN_OPTS) / sizeof(*RETURN_OPTS);
 
-CfgString ASSIGN_OPTS[] = { { "hash" } , { "mask" } };
+CfgString ASSIGN_OPTS[] = {{"hash"}, {"mask"}};
 
-CfgString HASH_OPTS[] = { { "src_ip" } , { "dst_ip" } , { "src_port" } , { "dst_port" } };
+CfgString HASH_OPTS[] = {{"src_ip"}, {"dst_ip"}, {"src_port"}, {"dst_port"}};
 
-ts::Errata::Code code_max(ts::Errata const& err) {
+ts::Errata::Code
+code_max(ts::Errata const &err)
+{
   ts::Errata::Code zret = std::numeric_limits<ts::Errata::Code::raw_type>::min();
   ts::Errata::const_iterator spot = err.begin();
   ts::Errata::const_iterator limit = err.end();
-  for ( ; spot != limit ; ++spot )
+  for (; spot != limit; ++spot)
     zret = std::max(zret, spot->getCode());
   return zret;
 }
 
 struct ValueNamePrinter {
-  Value const& _v;
-  ValueNamePrinter(Value const& v) : _v(v) {}
+  Value const &_v;
+  ValueNamePrinter(Value const &v) : _v(v) {}
 };
 
-std::ostream& operator << ( std::ostream& out, ValueNamePrinter const& v ) {
-  ts::ConstBuffer const& name = v._v.getName();
-  if (name._ptr) out << "'" << name << "'";
-  else out << v._v.getIndex();
+std::ostream &operator<<(std::ostream &out, ValueNamePrinter const &v)
+{
+  ts::ConstBuffer const &name = v._v.getName();
+  if (name._ptr)
+    out << "'" << name << "'";
+  else
+    out << v._v.getIndex();
   return out;
 }
 
@@ -131,102 +140,93 @@ ts::Errata::Message File_Read_Error(char const* text) {
 }
 #endif
 
-ts::Errata::Message Unable_To_Create_Service_Group(int line) {
+ts::Errata::Message
+Unable_To_Create_Service_Group(int line)
+{
   std::ostringstream out;
-  out << "Unable to create service group at line " << line
-      << " because of configuration errors."
-    ;
+  out << "Unable to create service group at line " << line << " because of configuration errors.";
   return ts::Errata::Message(23, LVL_FATAL, out.str());
 }
 
-ts::Errata::Message Services_Not_Found() {
+ts::Errata::Message
+Services_Not_Found()
+{
   return ts::Errata::Message(3, LVL_INFO, "No services found in configuration.");
 }
 
-ts::Errata::Message Services_Not_A_Sequence() {
+ts::Errata::Message
+Services_Not_A_Sequence()
+{
   return ts::Errata::Message(4, LVL_INFO, "The 'services' setting was not a list nor array.");
 }
 
-ts::Errata::Message Service_Not_A_Group(int line) {
+ts::Errata::Message
+Service_Not_A_Group(int line)
+{
   std::ostringstream out;
-  out << "'" << SVC_NAME << "' must be a group at line "
-      << line << "."
-    ;
+  out << "'" << SVC_NAME << "' must be a group at line " << line << ".";
   return ts::Errata::Message(5, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Service_Type_Defaulted(wccp::ServiceGroup::Type type, int line) {
+ts::Errata::Message
+Service_Type_Defaulted(wccp::ServiceGroup::Type type, int line)
+{
   std::ostringstream out;
-  out << "'type' not found in " << SVC_NAME << " at line "
-      << line << "' -- defaulting to "
-      << ( type == wccp::ServiceGroup::STANDARD ? "STANDARD" : "DYNAMIC" )
-    ;
+  out << "'type' not found in " << SVC_NAME << " at line " << line << "' -- defaulting to "
+      << (type == wccp::ServiceGroup::STANDARD ? "STANDARD" : "DYNAMIC");
   return ts::Errata::Message(6, LVL_INFO, out.str());
 }
 
-ts::Errata::Message Service_Type_Invalid(ts::ConstBuffer const& text, int line) {
+ts::Errata::Message
+Service_Type_Invalid(ts::ConstBuffer const &text, int line)
+{
   std::ostringstream out;
-  out << "Service type '" << text
-      << "' at line " << line
-      << " invalid. Must be \"STANDARD\" or \"DYNAMIC\""
-    ;
+  out << "Service type '" << text << "' at line " << line << " invalid. Must be \"STANDARD\" or \"DYNAMIC\"";
   return ts::Errata::Message(7, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Prop_Not_Found(char const* prop_name, char const* group_name, int line) {
+ts::Errata::Message
+Prop_Not_Found(char const *prop_name, char const *group_name, int line)
+{
   std::ostringstream out;
-  out << "Required '" << prop_name << "' property not found in '"
-      << group_name << "' at line " << line << "."
-    ;
+  out << "Required '" << prop_name << "' property not found in '" << group_name << "' at line " << line << ".";
   return ts::Errata::Message(8, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Prop_Invalid_Type(
-  Value const& prop_cfg,
-  ts::config::ValueType expected
-) {
+ts::Errata::Message
+Prop_Invalid_Type(Value const &prop_cfg, ts::config::ValueType expected)
+{
   std::ostringstream out;
-  out << "'" << prop_cfg.getName() << "' at line " << prop_cfg.getSourceLine()
-      << " is of type '" << prop_cfg.getType()
-      << "' instead of required type '" << expected << "'."
-    ;
+  out << "'" << prop_cfg.getName() << "' at line " << prop_cfg.getSourceLine() << " is of type '" << prop_cfg.getType()
+      << "' instead of required type '" << expected << "'.";
   return ts::Errata::Message(9, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Prop_List_Invalid_Type(
-  Value const& elt_cfg, ///< List element.
-  ts::config::ValueType expected
-) {
+ts::Errata::Message
+Prop_List_Invalid_Type(Value const &elt_cfg, ///< List element.
+                       ts::config::ValueType expected)
+{
   std::ostringstream out;
-  out << "Element " << ValueNamePrinter(elt_cfg)
-      << " at line " << elt_cfg.getSourceLine()
-      << " in the aggregate property '" << elt_cfg.getParent().getName()
-      << "' is of type '" << elt_cfg.getType()
-      << "' instead of required type '" << expected << "'."
-    ;
+  out << "Element " << ValueNamePrinter(elt_cfg) << " at line " << elt_cfg.getSourceLine() << " in the aggregate property '"
+      << elt_cfg.getParent().getName() << "' is of type '" << elt_cfg.getType() << "' instead of required type '" << expected
+      << "'.";
   return ts::Errata::Message(9, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Svc_Prop_Out_Of_Range(
-  char const* name,
-  Value const& elt_cfg,
-  int v, int min, int max
-) {
+ts::Errata::Message
+Svc_Prop_Out_Of_Range(char const *name, Value const &elt_cfg, int v, int min, int max)
+{
   std::ostringstream out;
-  out << "Service property '" << name
-      << "' at line " << elt_cfg.getSourceLine()
-      << " has a value " << v
-      << " that is not in the allowed range of "
-      << min << ".." << max << "."
-    ;
+  out << "Service property '" << name << "' at line " << elt_cfg.getSourceLine() << " has a value " << v
+      << " that is not in the allowed range of " << min << ".." << max << ".";
   return ts::Errata::Message(10, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Svc_Prop_Ignored(char const* name, int line) {
+ts::Errata::Message
+Svc_Prop_Ignored(char const *name, int line)
+{
   std::ostringstream out;
-  out << "Service property '" << name << "' at line " << line
-      << " ignored because the service is of type standard."
-    ;
+  out << "Service property '" << name << "' at line " << line << " ignored because the service is of type standard.";
   return ts::Errata::Message(11, LVL_INFO, out.str());
 }
 
@@ -247,154 +247,144 @@ ts::Errata::Message Svc_Flags_Ignored(int line) {
 }
 #endif
 
-ts::Errata::Message Svc_Ports_Too_Many(int line, int n) {
+ts::Errata::Message
+Svc_Ports_Too_Many(int line, int n)
+{
   std::ostringstream out;
-  out << "Excess ports ignored at line " << line
-      << ". " << n << " ports specified, only"
-      << wccp::ServiceGroup::N_PORTS << " supported."
-    ;
+  out << "Excess ports ignored at line " << line << ". " << n << " ports specified, only" << wccp::ServiceGroup::N_PORTS
+      << " supported.";
   return ts::Errata::Message(14, LVL_INFO, out.str());
 }
 
-ts::Errata::Message Svc_Ports_Malformed(int line) {
+ts::Errata::Message
+Svc_Ports_Malformed(int line)
+{
   std::ostringstream out;
-  out << "Port value ignored (not a number) at line " << line
-      << "."
-    ;
+  out << "Port value ignored (not a number) at line " << line << ".";
   return ts::Errata::Message(15, LVL_INFO, out.str());
 }
 
-ts::Errata::Message Svc_Ports_None_Valid(int line) {
+ts::Errata::Message
+Svc_Ports_None_Valid(int line)
+{
   std::ostringstream out;
-  out << "A '" << SVC_PROP_PORTS << "' property was found at line "
-      << line << " but none of the ports were valid."
-    ;
-  return  ts::Errata::Message(17, LVL_WARN, out.str());
+  out << "A '" << SVC_PROP_PORTS << "' property was found at line " << line << " but none of the ports were valid.";
+  return ts::Errata::Message(17, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Svc_Ports_Not_Found(int line) {
+ts::Errata::Message
+Svc_Ports_Not_Found(int line)
+{
   std::ostringstream out;
-  out << "Ports not found in service at line " << line
-      << ". Ports must be defined for a dynamic service.";
-  return  ts::Errata::Message(18, LVL_WARN, out.str());
+  out << "Ports not found in service at line " << line << ". Ports must be defined for a dynamic service.";
+  return ts::Errata::Message(18, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Svc_Prop_Ignored_In_Standard(const char* name, int line) {
+ts::Errata::Message
+Svc_Prop_Ignored_In_Standard(const char *name, int line)
+{
   std::ostringstream out;
-  out << "Service property '" << name << "' at line " << line
-      << " ignored because the service is of type STANDARD."
-    ;
+  out << "Service property '" << name << "' at line " << line << " ignored because the service is of type STANDARD.";
   return ts::Errata::Message(19, LVL_INFO, out.str());
 }
 
-ts::Errata::Message Security_Opt_Invalid(ts::ConstBuffer const& text, int line) {
+ts::Errata::Message
+Security_Opt_Invalid(ts::ConstBuffer const &text, int line)
+{
   std::ostringstream out;
-  out << "Security option '" << text
-      << "' at line " << line
-      << " is invalid. It must be 'none' or 'md5'."
-    ;
+  out << "Security option '" << text << "' at line " << line << " is invalid. It must be 'none' or 'md5'.";
   return ts::Errata::Message(20, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Value_Malformed(char const* name, char const* text, int line) {
+ts::Errata::Message
+Value_Malformed(char const *name, char const *text, int line)
+{
   std::ostringstream out;
-  out << "'" << name << "' value '" << text
-      << "' malformed at line " << line << "."
-    ;
+  out << "'" << name << "' value '" << text << "' malformed at line " << line << ".";
   return ts::Errata::Message(21, LVL_WARN, out.str());
 }
 
-ts::Errata::Message No_Valid_Routers(int line) {
+ts::Errata::Message
+No_Valid_Routers(int line)
+{
   std::ostringstream out;
-  out << "No valid IP address for routers found for Service Group at line "
-      << line << "."
-    ;
+  out << "No valid IP address for routers found for Service Group at line " << line << ".";
   return ts::Errata::Message(22, LVL_WARN, out.str());
 }
 
-ts::Errata::Message Ignored_Option_Value(
-  ts::ConstBuffer const& text,
-  ts::ConstBuffer const& name,
-  int line
-) {
+ts::Errata::Message
+Ignored_Option_Value(ts::ConstBuffer const &text, ts::ConstBuffer const &name, int line)
+{
   std::ostringstream out;
-  out << "Value '" << text << "' at line " << line
-      << " was ignored because it is not a valid option for '"
-      << name << "'."
-    ;
+  out << "Value '" << text << "' at line " << line << " was ignored because it is not a valid option for '" << name << "'.";
   return ts::Errata::Message(24, LVL_INFO, out.str());
 }
 
-ts::Errata::Message Ignored_Opt_Errors(
-  char const* name,
-  int line
-) {
+ts::Errata::Message
+Ignored_Opt_Errors(char const *name, int line)
+{
   std::ostringstream out;
-  out << "Errors in  '" << name << "' at line " << line
-      << " were ignored."
-    ;
+  out << "Errors in  '" << name << "' at line " << line << " were ignored.";
   return ts::Errata::Message(28, LVL_INFO, out.str());
 }
 
-ts::Errata::Message List_Valid_Opts(
-  ts::ConstBuffer const& name,
-  int line,
-  CfgString* values,
-  size_t n
-) {
+ts::Errata::Message
+List_Valid_Opts(ts::ConstBuffer const &name, int line, CfgString *values, size_t n)
+{
   std::ostringstream out;
-  out << "Valid values for the '" << name << "' property at line " << line
-      << " are: "
-    ;
+  out << "Valid values for the '" << name << "' property at line " << line << " are: ";
   out << '"' << values[0].m_text << '"';
-  for ( size_t i = 1 ; i < n ; ++i )
+  for (size_t i = 1; i < n; ++i)
     out << ", \"" << values[i].m_text << '"';
   out << '.';
   return ts::Errata::Message(29, LVL_INFO, out.str());
 }
 
-ts::Errata::Message Port_Type_Invalid(ts::ConstBuffer const& text, int line) {
+ts::Errata::Message
+Port_Type_Invalid(ts::ConstBuffer const &text, int line)
+{
   std::ostringstream out;
-  out << "Value '" << text
-      << "' at line " << line
-      << "for property '" << SVC_PROP_PORT_TYPE
-      << "' is invalid. It must be 'src' or 'dst'."
-    ;
+  out << "Value '" << text << "' at line " << line << "for property '" << SVC_PROP_PORT_TYPE
+      << "' is invalid. It must be 'src' or 'dst'.";
   return ts::Errata::Message(30, LVL_WARN, out.str());
 }
 
 } // anon namespace
 
-namespace wccp {
-
-inline bool operator == ( ts::ConstBuffer const& b, char const* text ) {
+namespace wccp
+{
+inline bool operator==(ts::ConstBuffer const &b, char const *text)
+{
   return 0 == strncasecmp(text, b._ptr, b._size);
 }
 
-inline bool operator == ( char const* text, ts::ConstBuffer const& b ) {
+inline bool operator==(char const *text, ts::ConstBuffer const &b)
+{
   return 0 == strncasecmp(text, b._ptr, b._size);
 }
 
 ts::Errata
-load_option_set(Value const& setting, CfgString* opts, size_t count) {
+load_option_set(Value const &setting, CfgString *opts, size_t count)
+{
   ts::Errata zret;
-  CfgString* spot;
-  CfgString* limit = opts + count;
-  ts::ConstBuffer const& name  = setting.getName();
+  CfgString *spot;
+  CfgString *limit = opts + count;
+  ts::ConstBuffer const &name = setting.getName();
   int src_line = setting.getSourceLine();
 
   // Clear all found flags.
-  for ( spot = opts ; spot < limit ; ++spot ) spot->m_found = false;
+  for (spot = opts; spot < limit; ++spot)
+    spot->m_found = false;
 
   // Walk through the strings in the setting.
   if (setting.isContainer()) {
     int nr = setting.childCount();
     bool list_opts = false;
-    for ( int i = 0 ; i < nr ; ++i ) {
+    for (int i = 0; i < nr; ++i) {
       Value item = setting[i];
       if (ts::config::StringValue == item.getType()) {
         ts::ConstBuffer text = item.getText();
-        for ( spot = opts ; spot < limit ; ++spot ) {
+        for (spot = opts; spot < limit; ++spot) {
           if (spot->m_text == text) {
             spot->m_found = true;
             break;
@@ -421,9 +411,9 @@ load_option_set(Value const& setting, CfgString* opts, size_t count) {
     the option was none and the pointer is @c NULL
  */
 ts::Rv<ts::ConstBuffer>
-load_security (
-  Value const& setting ///< Security setting.
-) {
+load_security(Value const &setting ///< Security setting.
+              )
+{
   ts::Rv<ts::ConstBuffer> zret;
   int src_line;
   ts::ConstBuffer text;
@@ -465,24 +455,26 @@ load_security (
 
 /// Process a router address list.
 ts::Errata
-load_routers (
-  Value const& setting, ///< Source of addresses.
-  std::vector<uint32_t>& addrs ///< Output list
-) {
+load_routers(Value const &setting,        ///< Source of addresses.
+             std::vector<uint32_t> &addrs ///< Output list
+             )
+{
   ts::Errata zret;
-  char const* text;
-  static char const * const NAME = "IPv4 Address";
+  char const *text;
+  static char const *const NAME = "IPv4 Address";
 
   if (setting.isContainer()) {
     int nr = setting.childCount();
-    for ( int i = 0 ; i < nr ; ++i ) {
-      Value const& addr_cfg = setting[i];
+    for (int i = 0; i < nr; ++i) {
+      Value const &addr_cfg = setting[i];
       int addr_line = addr_cfg.getSourceLine();
       in_addr addr;
       if (ts::config::StringValue == addr_cfg.getType()) {
         text = addr_cfg.getText()._ptr;
-        if (inet_aton(text, &addr)) addrs.push_back(addr.s_addr);
-        else zret.push(Value_Malformed(NAME, text, addr_line));
+        if (inet_aton(text, &addr))
+          addrs.push_back(addr.s_addr);
+        else
+          zret.push(Value_Malformed(NAME, text, addr_line));
       } else {
         zret.push(Prop_List_Invalid_Type(addr_cfg, ts::config::StringValue));
       }
@@ -494,27 +486,33 @@ load_routers (
 }
 
 ts::Errata
-CacheImpl::loadServicesFromFile(char const* path) {
+CacheImpl::loadServicesFromFile(char const *path)
+{
   ts::Errata zret;
-  int src_line = 0; // scratch for local source line caching.
+  int src_line = 0;              // scratch for local source line caching.
   std::vector<uint32_t> routers; // scratch per service loop.
-  Value prop; // scratch var.
+  Value prop;                    // scratch var.
 
   ts::Rv<Configuration> cv = Configuration::loadFromPath(path);
-  if (!cv.isOK()) return cv.errata();
+  if (!cv.isOK())
+    return cv.errata();
 
   ts::config::Configuration cfg = cv.result();
   Value svc_list = cfg.find("services");
   // No point in going on from here.
-  if (!svc_list) return Services_Not_Found();
+  if (!svc_list)
+    return Services_Not_Found();
 
-  if (!svc_list.isContainer()) return Services_Not_A_Sequence();
+  if (!svc_list.isContainer())
+    return Services_Not_A_Sequence();
 
   // Check for global (default) security setting.
   if ((prop = cfg[SVC_PROP_SECURITY]).hasValue()) {
     ts::Rv<ts::ConstBuffer> rv = load_security(prop);
-    if (rv.isOK()) this->useMD5Security(rv);
-    else zret.pull(rv.errata());
+    if (rv.isOK())
+      this->useMD5Security(rv);
+    else
+      zret.pull(rv.errata());
   }
 
   if ((prop = cfg[SVC_PROP_ROUTERS]).hasValue()) {
@@ -522,13 +520,13 @@ CacheImpl::loadServicesFromFile(char const* path) {
   }
 
   int idx, nsvc;
-  for ( idx = 0, nsvc = svc_list.childCount() ; idx < nsvc ; ++idx ) {
+  for (idx = 0, nsvc = svc_list.childCount(); idx < nsvc; ++idx) {
     int x; // scratch int.
-    char const* md5_key = 0;
+    char const *md5_key = 0;
     ts::ConstBuffer text;
     SecurityOption security_style = SECURITY_NONE;
     bool use_group_local_security = false;
-    Value const& svc_cfg = svc_list[idx];
+    Value const &svc_cfg = svc_list[idx];
     int svc_line = svc_cfg.getSourceLine();
     ServiceGroup svc_info;
 
@@ -566,11 +564,7 @@ CacheImpl::loadServicesFromFile(char const* path) {
         zret.push(Prop_Invalid_Type(prop, ts::config::StringValue));
       }
     } else { // default type based on ID.
-      ServiceGroup::Type svc_type =
-        svc_info.getSvcId() <= ServiceGroup::RESERVED
-          ? ServiceGroup::STANDARD
-          : ServiceGroup::DYNAMIC
-        ;
+      ServiceGroup::Type svc_type = svc_info.getSvcId() <= ServiceGroup::RESERVED ? ServiceGroup::STANDARD : ServiceGroup::DYNAMIC;
       svc_info.setSvcType(svc_type);
       zret.push(Service_Type_Defaulted(svc_type, svc_line));
     }
@@ -615,11 +609,13 @@ CacheImpl::loadServicesFromFile(char const* path) {
       ts::Errata status = load_option_set(prop, HASH_OPTS, N_OPTS(HASH_OPTS));
       uint32_t f = 0;
       src_line = prop.getSourceLine();
-      for ( size_t i = 0 ; i < N_OPTS(HASH_OPTS) ; ++i )
-        if (HASH_OPTS[i].m_found) f |= ServiceGroup::SRC_IP_HASH << i;
+      for (size_t i = 0; i < N_OPTS(HASH_OPTS); ++i)
+        if (HASH_OPTS[i].m_found)
+          f |= ServiceGroup::SRC_IP_HASH << i;
       if (f) {
         svc_info.enableFlags(f);
-        if (!status) zret.push(Ignored_Opt_Errors(SVC_PROP_PRIMARY_HASH, src_line).set(status));
+        if (!status)
+          zret.push(Ignored_Opt_Errors(SVC_PROP_PRIMARY_HASH, src_line).set(status));
       } else {
         zret.push(List_Valid_Opts(prop.getName(), src_line, HASH_OPTS, N_OPTS(HASH_OPTS)).set(status));
       }
@@ -631,17 +627,20 @@ CacheImpl::loadServicesFromFile(char const* path) {
       ts::Errata status = load_option_set(prop, HASH_OPTS, N_OPTS(HASH_OPTS));
       uint32_t f = 0;
       src_line = prop.getSourceLine();
-      for ( size_t i = 0 ; i < N_OPTS(HASH_OPTS) ; ++i )
-        if (HASH_OPTS[i].m_found) f |= ServiceGroup::SRC_IP_ALT_HASH << i;
-      if (f) svc_info.enableFlags(f);
-      if (!status) zret.push(Ignored_Opt_Errors(SVC_PROP_ALT_HASH, src_line).set(status));
+      for (size_t i = 0; i < N_OPTS(HASH_OPTS); ++i)
+        if (HASH_OPTS[i].m_found)
+          f |= ServiceGroup::SRC_IP_ALT_HASH << i;
+      if (f)
+        svc_info.enableFlags(f);
+      if (!status)
+        zret.push(Ignored_Opt_Errors(SVC_PROP_ALT_HASH, src_line).set(status));
     }
 
     if ((prop = svc_cfg[SVC_PROP_PORT_TYPE]).hasValue()) {
       src_line = prop.getSourceLine();
       if (ts::config::StringValue == prop.getType()) {
         text = prop.getText();
-        if ("src" ==  text)
+        if ("src" == text)
           svc_info.enableFlags(ServiceGroup::PORTS_SOURCE);
         else if ("dst" == text)
           svc_info.disableFlags(ServiceGroup::PORTS_SOURCE);
@@ -659,7 +658,7 @@ CacheImpl::loadServicesFromFile(char const* path) {
       if (ServiceGroup::STANDARD == svc_info.getSvcType()) {
         zret.push(Svc_Prop_Ignored_In_Standard(SVC_PROP_PORTS, src_line));
       } else {
-        if ( prop.isContainer() ) {
+        if (prop.isContainer()) {
           size_t nport = prop.childCount();
           size_t pidx, sidx;
           bool malformed_error = false;
@@ -669,8 +668,8 @@ CacheImpl::loadServicesFromFile(char const* path) {
             nport = ServiceGroup::N_PORTS;
           }
           // Step through the ports.
-          for ( pidx = sidx = 0 ; pidx < nport ; ++pidx ) {
-            Value const& port_cfg = prop[pidx];
+          for (pidx = sidx = 0; pidx < nport; ++pidx) {
+            Value const &port_cfg = prop[pidx];
             if (ts::config::IntegerValue == port_cfg.getType()) {
               x = atoi(port_cfg.getText()._ptr);
               if (0 <= x && x <= 65535)
@@ -682,8 +681,10 @@ CacheImpl::loadServicesFromFile(char const* path) {
               malformed_error = true;
             }
           }
-          if (sidx) svc_info.enableFlags(ServiceGroup::PORTS_DEFINED);
-          else zret.push(Svc_Ports_None_Valid(src_line));
+          if (sidx)
+            svc_info.enableFlags(ServiceGroup::PORTS_DEFINED);
+          else
+            zret.push(Svc_Ports_None_Valid(src_line));
         } else {
           zret.push(Prop_Invalid_Type(prop, ts::config::ListValue));
         }
@@ -725,22 +726,22 @@ CacheImpl::loadServicesFromFile(char const* path) {
     }
 
     // Properties after this are optional so we can proceed if they fail.
-    GroupData& svc = this->defineServiceGroup(svc_info);
+    GroupData &svc = this->defineServiceGroup(svc_info);
 
     // Is there a process we should track?
     if ((prop = svc_cfg[SVC_PROP_PROC]).hasValue()) {
       if (ts::config::StringValue == prop.getType()) {
-         svc.setProcName(prop.getText());
+        svc.setProcName(prop.getText());
       } else {
         zret.push(Prop_Invalid_Type(prop, ts::config::StringValue));
       }
-    } 
+    }
 
     // Add seed routers.
     std::vector<uint32_t>::iterator rspot, rlimit;
-    for ( rspot = routers.begin(), rlimit = routers.end() ; rspot != rlimit ; ++rspot )
+    for (rspot = routers.begin(), rlimit = routers.end(); rspot != rlimit; ++rspot)
       svc.seedRouter(*rspot);
-    for ( rspot = Seed_Router.begin(), rlimit = Seed_Router.end() ; rspot != rlimit ; ++rspot )
+    for (rspot = Seed_Router.begin(), rlimit = Seed_Router.end(); rspot != rlimit; ++rspot)
       svc.seedRouter(*rspot);
 
     if (use_group_local_security)
@@ -754,11 +755,7 @@ CacheImpl::loadServicesFromFile(char const* path) {
       bool gre = FORWARD_OPTS[0].m_found;
       bool l2 = FORWARD_OPTS[1].m_found;
       if (gre || l2) {
-        svc.m_packet_forward =
-          gre
-            ? l2 ? ServiceGroup::GRE_OR_L2 : ServiceGroup::GRE
-            : ServiceGroup::L2
-          ;
+        svc.m_packet_forward = gre ? l2 ? ServiceGroup::GRE_OR_L2 : ServiceGroup::GRE : ServiceGroup::L2;
         if (!status.isOK())
           zret.push(Ignored_Opt_Errors(SVC_PROP_FORWARD, prop.getSourceLine()).set(status));
       } else {
@@ -772,12 +769,9 @@ CacheImpl::loadServicesFromFile(char const* path) {
       bool gre = RETURN_OPTS[0].m_found;
       bool l2 = RETURN_OPTS[1].m_found;
       if (gre || l2) {
-        svc.m_packet_return =
-          gre
-            ? l2 ? ServiceGroup::GRE_OR_L2 : ServiceGroup::GRE
-            : ServiceGroup::L2
-          ;
-        if (!status.isOK()) zret.push(Ignored_Opt_Errors(SVC_PROP_RETURN, prop.getSourceLine()).set(status));
+        svc.m_packet_return = gre ? l2 ? ServiceGroup::GRE_OR_L2 : ServiceGroup::GRE : ServiceGroup::L2;
+        if (!status.isOK())
+          zret.push(Ignored_Opt_Errors(SVC_PROP_RETURN, prop.getSourceLine()).set(status));
       } else {
         zret.push(ts::Errata::Message(26, LVL_INFO, "Defaulting to GRE return.").set(status));
       }
@@ -789,12 +783,9 @@ CacheImpl::loadServicesFromFile(char const* path) {
       bool hash = ASSIGN_OPTS[0].m_found;
       bool mask = ASSIGN_OPTS[1].m_found;
       if (hash || mask) {
-        svc.m_cache_assign =
-          hash
-            ? mask ? ServiceGroup::HASH_OR_MASK : ServiceGroup::HASH_ONLY
-            : ServiceGroup::MASK_ONLY
-          ;
-        if (!status.isOK()) zret.push(Ignored_Opt_Errors(SVC_PROP_ASSIGN, prop.getSourceLine()).set(status));
+        svc.m_cache_assign = hash ? mask ? ServiceGroup::HASH_OR_MASK : ServiceGroup::HASH_ONLY : ServiceGroup::MASK_ONLY;
+        if (!status.isOK())
+          zret.push(Ignored_Opt_Errors(SVC_PROP_ASSIGN, prop.getSourceLine()).set(status));
       } else {
         status.push(ts::Errata::Message(26, LVL_INFO, "Defaulting to hash assignment only."));
         zret.push(List_Valid_Opts(prop.getName(), src_line, ASSIGN_OPTS, N_OPTS(ASSIGN_OPTS)).set(status));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpEndPoint.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpEndPoint.cc b/lib/wccp/WccpEndPoint.cc
index 2426bc1..41bfe16 100644
--- a/lib/wccp/WccpEndPoint.cc
+++ b/lib/wccp/WccpEndPoint.cc
@@ -19,61 +19,62 @@
     limitations under the License.
  */
 
-# include "WccpLocal.h"
-# include "WccpUtil.h"
-# include "WccpMeta.h"
-# include <errno.h>
-# include "ink_string.h"
-# include "ink_defs.h"
+#include "WccpLocal.h"
+#include "WccpUtil.h"
+#include "WccpMeta.h"
+#include <errno.h>
+#include "ink_string.h"
+#include "ink_defs.h"
 // ------------------------------------------------------
-namespace wccp {
-
+namespace wccp
+{
 #if defined IP_RECVDSTADDR
-# define DSTADDR_SOCKOPT IP_RECVDSTADDR
-# define DSTADDR_DATASIZE (CMSG_SPACE(sizeof(struct in_addr)))
-# define dstaddr(x) (CMSG_DATA(x))
+#define DSTADDR_SOCKOPT IP_RECVDSTADDR
+#define DSTADDR_DATASIZE (CMSG_SPACE(sizeof(struct in_addr)))
+#define dstaddr(x) (CMSG_DATA(x))
 #elif defined IP_PKTINFO
-# define DSTADDR_SOCKOPT IP_PKTINFO
-# define DSTADDR_DATASIZE (CMSG_SPACE(sizeof(struct in_pktinfo)))
-# define dstaddr(x) (&(((struct in_pktinfo *)(CMSG_DATA(x)))->ipi_addr))
+#define DSTADDR_SOCKOPT IP_PKTINFO
+#define DSTADDR_DATASIZE (CMSG_SPACE(sizeof(struct in_pktinfo)))
+#define dstaddr(x) (&(((struct in_pktinfo *)(CMSG_DATA(x)))->ipi_addr))
 #else
-# error "can't determine socket option"
+#error "can't determine socket option"
 #endif
 
 // ------------------------------------------------------
-Impl::GroupData::GroupData()
-  : m_generation(0)
-  , m_use_security_opt(false)
-  , m_use_security_key(false) {
+Impl::GroupData::GroupData() : m_generation(0), m_use_security_opt(false), m_use_security_key(false)
+{
 }
 
-Impl::GroupData&
-Impl::GroupData::setKey(char const* key) {
+Impl::GroupData &
+Impl::GroupData::setKey(char const *key)
+{
   m_use_security_key = true;
   strncpy(m_security_key, key, SecurityComp::KEY_SIZE);
   return *this;
 }
 
-Impl::GroupData&
-Impl::GroupData::setSecurity(SecurityOption style) {
+Impl::GroupData &
+Impl::GroupData::setSecurity(SecurityOption style)
+{
   m_use_security_opt = true;
   m_security_opt = style;
   return *this;
 }
 
-Impl::Impl()
-  : m_addr(INADDR_ANY)
-  , m_fd(ts::NO_FD) {
+Impl::Impl() : m_addr(INADDR_ANY), m_fd(ts::NO_FD)
+{
 }
 
-Impl::~Impl() {
+Impl::~Impl()
+{
   this->close();
 }
 
 int
-Impl::open(uint addr) {
+Impl::open(uint addr)
+{
   struct sockaddr saddr;
-  sockaddr_in& in_addr = reinterpret_cast<sockaddr_in&>(saddr);
+  sockaddr_in &in_addr = reinterpret_cast<sockaddr_in &>(saddr);
   int fd;
 
   if (ts::NO_FD != m_fd) {
@@ -86,7 +87,8 @@ Impl::open(uint addr) {
     return -errno;
   }
 
-  if (INADDR_ANY != addr) m_addr = addr; // overridden.
+  if (INADDR_ANY != addr)
+    m_addr = addr; // overridden.
   memset(&saddr, 0, sizeof(saddr));
   in_addr.sin_family = AF_INET;
   in_addr.sin_port = htons(DEFAULT_PORT);
@@ -115,7 +117,7 @@ Impl::open(uint addr) {
     return -errno;
   }
 
-# if defined IP_MTU_DISCOVER
+#if defined IP_MTU_DISCOVER
   /// Disable PMTU on Linux because of a bug in IOS routers.
   /// WCCP packets are rejected as duplicates if the IP fragment
   /// identifier is 0, which is the value used when PMTU is enabled.
@@ -125,14 +127,15 @@ Impl::open(uint addr) {
     this->close();
     return -errno;
   }
-# endif
+#endif
 
   m_fd = fd;
   return 0;
 }
 
 void
-Impl::close() {
+Impl::close()
+{
   if (ts::NO_FD != m_fd) {
     ::close(m_fd);
     m_fd = ts::NO_FD;
@@ -140,7 +143,8 @@ Impl::close() {
 }
 
 void
-Impl::useMD5Security(ts::ConstBuffer const& key) {
+Impl::useMD5Security(ts::ConstBuffer const &key)
+{
   m_use_security_opt = true;
   m_security_opt = SECURITY_MD5;
   m_use_security_key = true;
@@ -150,35 +154,46 @@ Impl::useMD5Security(ts::ConstBuffer const& key) {
 }
 
 SecurityOption
-Impl::setSecurity(BaseMsg& msg, GroupData const& group) const {
+Impl::setSecurity(BaseMsg &msg, GroupData const &group) const
+{
   SecurityOption zret = SECURITY_NONE;
-  if (group.m_use_security_opt) zret = group.m_security_opt;
-  else if (m_use_security_opt) zret =  m_security_opt;
-  if (group.m_use_security_key) msg.m_security.setKey(group.m_security_key);
-  else if (m_use_security_key) msg.m_security.setKey(m_security_key);
+  if (group.m_use_security_opt)
+    zret = group.m_security_opt;
+  else if (m_use_security_opt)
+    zret = m_security_opt;
+  if (group.m_use_security_key)
+    msg.m_security.setKey(group.m_security_key);
+  else if (m_use_security_key)
+    msg.m_security.setKey(m_security_key);
   return zret;
 }
 
 bool
-Impl::validateSecurity(BaseMsg& msg, GroupData const& group) {
+Impl::validateSecurity(BaseMsg &msg, GroupData const &group)
+{
   SecurityOption opt = msg.m_security.getOption();
   if (group.m_use_security_opt) {
-    if (opt != group.m_security_opt) return false;
+    if (opt != group.m_security_opt)
+      return false;
   } else if (m_use_security_opt) {
-    if (opt != m_security_opt) return false;
+    if (opt != m_security_opt)
+      return false;
   }
   if (opt == SECURITY_MD5) {
-    if (group.m_use_security_key) msg.m_security.setKey(group.m_security_key);
-    else if (m_use_security_key) msg.m_security.setKey(m_security_key);
+    if (group.m_use_security_key)
+      msg.m_security.setKey(group.m_security_key);
+    else if (m_use_security_key)
+      msg.m_security.setKey(m_security_key);
     return msg.validateSecurity();
   }
   return true;
 }
 
 ts::Rv<int>
-Impl::handleMessage() {
+Impl::handleMessage()
+{
   ts::Rv<int> zret;
-  ssize_t n; // recv byte count.
+  ssize_t n;                // recv byte count.
   struct sockaddr src_addr; // sender's address.
   msghdr recv_hdr;
   iovec recv_buffer;
@@ -188,7 +203,8 @@ Impl::handleMessage() {
   static size_t const ANC_BUFFER_SIZE = DSTADDR_DATASIZE;
   char anc_buffer[ANC_BUFFER_SIZE];
 
-  if (ts::NO_FD == m_fd) return -ENOTCONN;
+  if (ts::NO_FD == m_fd)
+    return -ENOTCONN;
 
   recv_buffer.iov_base = buffer;
   recv_buffer.iov_len = BUFFER_SIZE;
@@ -201,34 +217,42 @@ Impl::handleMessage() {
   recv_hdr.msg_controllen = ANC_BUFFER_SIZE;
 
   n = recvmsg(m_fd, &recv_hdr, MSG_TRUNC);
-  if (n > BUFFER_SIZE) return -EMSGSIZE;
-  else if (n < 0) return -errno;
+  if (n > BUFFER_SIZE)
+    return -EMSGSIZE;
+  else if (n < 0)
+    return -errno;
 
   // Extract the original destination address.
   ip_header.m_src = access_field(&sockaddr_in::sin_addr, &src_addr).s_addr;
-  for ( cmsghdr* anc = CMSG_FIRSTHDR(&recv_hdr);
-        anc;
-        anc = CMSG_NXTHDR(&recv_hdr, anc)
-  ) {
+  for (cmsghdr *anc = CMSG_FIRSTHDR(&recv_hdr); anc; anc = CMSG_NXTHDR(&recv_hdr, anc)) {
     if (anc->cmsg_level == IPPROTO_IP && anc->cmsg_type == DSTADDR_SOCKOPT) {
-      ip_header.m_dst = ((struct in_addr*)dstaddr(anc))->s_addr;
+      ip_header.m_dst = ((struct in_addr *)dstaddr(anc))->s_addr;
       break;
     }
   }
 
   // Check to see if there is a valid header.
   MsgHeaderComp header;
-  MsgBuffer msg_buffer(buffer,n);
+  MsgBuffer msg_buffer(buffer, n);
   if (PARSE_SUCCESS == header.parse(msg_buffer)) {
     message_type_t msg_type = header.getType();
-    ts::Buffer chunk(buffer,n);
+    ts::Buffer chunk(buffer, n);
 
     switch (msg_type) {
-    case HERE_I_AM: this->handleHereIAm(ip_header, chunk); break;
-    case I_SEE_YOU: this->handleISeeYou(ip_header, chunk); break;
-    case REDIRECT_ASSIGN: this->handleRedirectAssign(ip_header, chunk); break;
-    case REMOVAL_QUERY: this->handleRemovalQuery(ip_header, chunk); break;
-    default: fprintf(stderr, "Unknown message type %d ignored.\n", msg_type);
+    case HERE_I_AM:
+      this->handleHereIAm(ip_header, chunk);
+      break;
+    case I_SEE_YOU:
+      this->handleISeeYou(ip_header, chunk);
+      break;
+    case REDIRECT_ASSIGN:
+      this->handleRedirectAssign(ip_header, chunk);
+      break;
+    case REMOVAL_QUERY:
+      this->handleRemovalQuery(ip_header, chunk);
+      break;
+    default:
+      fprintf(stderr, "Unknown message type %d ignored.\n", msg_type);
       break;
     };
   } else {
@@ -238,28 +262,33 @@ Impl::handleMessage() {
 }
 
 ts::Errata
-Impl::handleHereIAm(IpHeader const&, ts::Buffer const&) {
+Impl::handleHereIAm(IpHeader const &, ts::Buffer const &)
+{
   return log(LVL_INFO, "Unanticipated WCCP2_HERE_I_AM message ignored");
 }
 ts::Errata
-Impl::handleISeeYou(IpHeader const&, ts::Buffer const& /* data ATS_UNUSED */) {
+Impl::handleISeeYou(IpHeader const &, ts::Buffer const & /* data ATS_UNUSED */)
+{
   return log(LVL_INFO, "Unanticipated WCCP2_I_SEE_YOU message ignored.");
 }
 ts::Errata
-Impl::handleRedirectAssign(IpHeader const&, ts::Buffer const& /* data ATS_UNUSED */) {
+Impl::handleRedirectAssign(IpHeader const &, ts::Buffer const & /* data ATS_UNUSED */)
+{
   return log(LVL_INFO, "Unanticipated WCCP2_REDIRECT_ASSIGN message ignored.");
 }
 ts::Errata
-Impl::handleRemovalQuery(IpHeader const&, ts::Buffer const& /* data ATS_UNUSED */) {
+Impl::handleRemovalQuery(IpHeader const &, ts::Buffer const & /* data ATS_UNUSED */)
+{
   return log(LVL_INFO, "Unanticipated WCCP2_REMOVAL_QUERY message ignored.");
 }
 // ------------------------------------------------------
-CacheImpl::GroupData::GroupData()
-  : m_proc_name(NULL), m_assignment_pending(false) {
+CacheImpl::GroupData::GroupData() : m_proc_name(NULL), m_assignment_pending(false)
+{
 }
 
-CacheImpl::GroupData&
-CacheImpl::GroupData::seedRouter(uint32_t addr) {
+CacheImpl::GroupData &
+CacheImpl::GroupData::seedRouter(uint32_t addr)
+{
   // Be nice and don't add it if it's already there.
   if (m_seed_routers.end() == find_by_member(m_seed_routers, &SeedRouter::m_addr, addr))
     m_seed_routers.push_back(SeedRouter(addr));
@@ -267,12 +296,12 @@ CacheImpl::GroupData::seedRouter(uint32_t addr) {
 }
 
 time_t
-CacheImpl::GroupData::removeSeedRouter(uint32_t addr) {
+CacheImpl::GroupData::removeSeedRouter(uint32_t addr)
+{
   time_t zret = 0;
   std::vector<SeedRouter>::iterator begin = m_seed_routers.begin();
   std::vector<SeedRouter>::iterator end = m_seed_routers.end();
-  std::vector<SeedRouter>::iterator spot =
-    std::find_if(begin, end, ts::predicate(&SeedRouter::m_addr, addr));
+  std::vector<SeedRouter>::iterator spot = std::find_if(begin, end, ts::predicate(&SeedRouter::m_addr, addr));
 
   if (end != spot) {
     zret = spot->m_xmit;
@@ -282,80 +311,73 @@ CacheImpl::GroupData::removeSeedRouter(uint32_t addr) {
   return zret;
 }
 
-CacheImpl::GroupData& CacheImpl::GroupData::setKey(char const* key) { return static_cast<self&>(this->super::setKey(key)); }
+CacheImpl::GroupData &
+CacheImpl::GroupData::setKey(char const *key)
+{
+  return static_cast<self &>(this->super::setKey(key));
+}
 
-CacheImpl::GroupData& CacheImpl::GroupData::setSecurity(SecurityOption style) { return static_cast<self&>(this->super::setSecurity(style)); }
+CacheImpl::GroupData &
+CacheImpl::GroupData::setSecurity(SecurityOption style)
+{
+  return static_cast<self &>(this->super::setSecurity(style));
+}
 
 CacheImpl::CacheBag::iterator
-CacheImpl::GroupData::findCache(uint32_t addr) {
-  return std::find_if(
-    m_caches.begin(),
-    m_caches.end(),
-    ts::predicate(&CacheData::idAddr, addr)
-  );
+CacheImpl::GroupData::findCache(uint32_t addr)
+{
+  return std::find_if(m_caches.begin(), m_caches.end(), ts::predicate(&CacheData::idAddr, addr));
 }
 
 CacheImpl::RouterBag::iterator
-CacheImpl::GroupData::findRouter(uint32_t addr) {
-  return std::find_if(
-    m_routers.begin(),
-    m_routers.end(),
-    ts::predicate(&RouterData::m_addr, addr)
-  );
+CacheImpl::GroupData::findRouter(uint32_t addr)
+{
+  return std::find_if(m_routers.begin(), m_routers.end(), ts::predicate(&RouterData::m_addr, addr));
 }
 
 void
-CacheImpl::GroupData::resizeCacheSources() {
+CacheImpl::GroupData::resizeCacheSources()
+{
   int count = m_routers.size();
-  for ( CacheBag::iterator spot = m_caches.begin(),
-          limit = m_caches.end();
-        spot != limit;
-        ++spot
-  ) {
+  for (CacheBag::iterator spot = m_caches.begin(), limit = m_caches.end(); spot != limit; ++spot) {
     spot->m_src.resize(count);
   }
 }
 
-inline CacheImpl::RouterData::RouterData()
-  : m_addr(0)
-  , m_generation(0)
-  , m_rapid(0)
-  , m_assign(false)
-  , m_send_caps(false) {
+inline CacheImpl::RouterData::RouterData() : m_addr(0), m_generation(0), m_rapid(0), m_assign(false), m_send_caps(false)
+{
 }
 
 inline CacheImpl::RouterData::RouterData(uint32_t addr)
-  : m_addr(addr)
-  , m_generation(0)
-  , m_rapid(0)
-  , m_assign(false)
-  , m_send_caps(false) {
+  : m_addr(addr), m_generation(0), m_rapid(0), m_assign(false), m_send_caps(false)
+{
 }
 
 time_t
-CacheImpl::RouterData::pingTime(time_t now) const {
-  time_t tx = m_xmit.m_time + (m_rapid ? TIME_UNIT/10 : TIME_UNIT);
+CacheImpl::RouterData::pingTime(time_t now) const
+{
+  time_t tx = m_xmit.m_time + (m_rapid ? TIME_UNIT / 10 : TIME_UNIT);
   return tx < now ? 0 : tx - now;
 }
 
 time_t
-CacheImpl::RouterData::waitTime(time_t now) const {
+CacheImpl::RouterData::waitTime(time_t now) const
+{
   return m_assign ? 0 : this->pingTime(now);
 }
 
 inline uint32_t
-CacheImpl::CacheData::idAddr() const {
+CacheImpl::CacheData::idAddr() const
+{
   return m_id.getAddr();
 }
 
-CacheImpl::GroupData&
-CacheImpl::defineServiceGroup(
-  ServiceGroup const& svc,
-  ServiceGroup::Result* result
-) {
+CacheImpl::GroupData &
+CacheImpl::defineServiceGroup(ServiceGroup const &svc, ServiceGroup::Result *result)
+{
   uint8_t svc_id = svc.getSvcId();
   GroupMap::iterator spot = m_groups.find(svc_id);
-  GroupData* group; // service with target ID.
+  GroupData *group; // service with target ID.
   ServiceGroup::Result zret;
   if (spot == m_groups.end()) { // not defined
     group = &(m_groups[svc_id]);
@@ -367,44 +389,44 @@ CacheImpl::defineServiceGroup(
     group = &spot->second;
     zret = group->m_svc == svc ? ServiceGroup::EXISTS : ServiceGroup::CONFLICT;
   }
-  if (result) *result = zret;
+  if (result)
+    *result = zret;
   return *group;
 }
 
 time_t
-CacheImpl::GroupData::waitTime(time_t now) const {
+CacheImpl::GroupData::waitTime(time_t now) const
+{
   time_t zret = std::numeric_limits<time_t>::max();
   // Active routers.
-  for ( RouterBag::const_iterator router = m_routers.begin(),
-          router_limit = m_routers.end() ;
-        router != router_limit && zret;
-        ++router
-  ) {
+  for (RouterBag::const_iterator router = m_routers.begin(), router_limit = m_routers.end(); router != router_limit && zret;
+       ++router) {
     zret = std::min(zret, router->waitTime(now));
-    }
+  }
   // Seed routers.
-  for ( std::vector<SeedRouter>::const_iterator
-          router = m_seed_routers.begin(),
-          router_limit = m_seed_routers.end() ;
-        router != router_limit && zret;
-        ++router
-  ) {
+  for (std::vector<SeedRouter>::const_iterator router = m_seed_routers.begin(), router_limit = m_seed_routers.end();
+       router != router_limit && zret; ++router) {
     time_t tx = router->m_xmit + TIME_UNIT;
-    if (tx < now) zret = 0;
-    else zret = std::min(tx - now, zret);
+    if (tx < now)
+      zret = 0;
+    else
+      zret = std::min(tx - now, zret);
   }
   // Assignment
   if (m_assignment_pending) {
-    time_t tx = m_generation_time + ( 3 * TIME_UNIT / 2 );
-    if (tx < now) zret = 0;
-    else zret = std::min(tx - now, zret);
+    time_t tx = m_generation_time + (3 * TIME_UNIT / 2);
+    if (tx < now)
+      zret = 0;
+    else
+      zret = std::min(tx - now, zret);
   }
 
   return zret;
 }
 
 bool
-CacheImpl::GroupData::processUp() {
+CacheImpl::GroupData::processUp()
+{
   bool zret = false;
   const char *proc_pid_path = this->getProcName();
   if (proc_pid_path == NULL || proc_pid_path[0] == '\0') {
@@ -414,7 +436,7 @@ CacheImpl::GroupData::processUp() {
     int fd = open(proc_pid_path, O_RDONLY);
     if (fd > 0) {
       char buffer[256];
-      ssize_t read_count = read(fd, buffer, sizeof(buffer)-1);
+      ssize_t read_count = read(fd, buffer, sizeof(buffer) - 1);
       close(fd);
       if (read_count > 0) {
         buffer[read_count] = '\0';
@@ -425,7 +447,7 @@ CacheImpl::GroupData::processUp() {
           fd = open(buffer, O_RDONLY);
           if (fd > 0) {
             zret = true;
-            close(fd); 
+            close(fd);
           }
         }
       }
@@ -435,25 +457,23 @@ CacheImpl::GroupData::processUp() {
 }
 
 bool
-CacheImpl::GroupData::cullRouters(time_t now) {
+CacheImpl::GroupData::cullRouters(time_t now)
+{
   bool zret = false;
   size_t idx = 0, n = m_routers.size();
-  while ( idx < n ) {
-    RouterData& router = m_routers[idx];
+  while (idx < n) {
+    RouterData &router = m_routers[idx];
     if (router.m_recv.m_time + TIME_UNIT * 3 < now) {
       uint32_t addr = router.m_addr;
       // Clip the router by copying down and resizing.
       // Must do all caches as well.
       --n; // Decrement router counter first.
-      if (idx < n) router = m_routers[n];
+      if (idx < n)
+        router = m_routers[n];
       m_routers.resize(n);
-      for ( CacheBag::iterator
-              cache = m_caches.begin(),
-              cache_limit = m_caches.end();
-            cache != cache_limit;
-            ++cache
-      ) {
-        if (idx < n) cache->m_src[idx] = cache->m_src[n];
+      for (CacheBag::iterator cache = m_caches.begin(), cache_limit = m_caches.end(); cache != cache_limit; ++cache) {
+        if (idx < n)
+          cache->m_src[idx] = cache->m_src[n];
         cache->m_src.resize(n);
       }
       // Put it back in the seeds.
@@ -464,12 +484,14 @@ CacheImpl::GroupData::cullRouters(time_t now) {
       ++idx; // move to next router.
     }
   }
-  if (zret) this->viewChanged(now);
+  if (zret)
+    this->viewChanged(now);
   return zret;
 }
 
-CacheImpl::GroupData&
-CacheImpl::GroupData::viewChanged(time_t now) {
+CacheImpl::GroupData &
+CacheImpl::GroupData::viewChanged(time_t now)
+{
   m_generation += 1;
   m_generation_time = now;
   m_assign_info.setActive(false); // invalidate current assignment.
@@ -481,40 +503,43 @@ CacheImpl::GroupData::viewChanged(time_t now) {
   return *this;
 }
 
-Cache::Service&
-Cache::Service::setKey(char const* key) {
+Cache::Service &
+Cache::Service::setKey(char const *key)
+{
   m_group->setKey(key);
   return *this;
 }
 
-Cache::Service&
-Cache::Service::setSecurity(SecurityOption opt) {
+Cache::Service &
+Cache::Service::setSecurity(SecurityOption opt)
+{
   m_group->setSecurity(opt);
   return *this;
 }
 
-CacheImpl&
-CacheImpl::seedRouter(uint8_t id, uint32_t addr) {
+CacheImpl &
+CacheImpl::seedRouter(uint8_t id, uint32_t addr)
+{
   GroupMap::iterator spot = m_groups.find(id);
-  if (spot != m_groups.end()) spot->second.seedRouter(addr);
+  if (spot != m_groups.end())
+    spot->second.seedRouter(addr);
   return *this;
 }
 
 bool
-CacheImpl::isConfigured() const {
+CacheImpl::isConfigured() const
+{
   return INADDR_ANY != m_addr && m_groups.size() > 0;
 }
 
 int
-CacheImpl::open(uint32_t addr) {
+CacheImpl::open(uint32_t addr)
+{
   int zret = this->super::open(addr);
   // If the socket was successfully opened, go through the
   // services and update the local service descriptor.
   if (0 <= zret) {
-    for ( GroupMap::iterator spot = m_groups.begin(), limit = m_groups.end();
-          spot != limit;
-          ++spot
-    ) {
+    for (GroupMap::iterator spot = m_groups.begin(), limit = m_groups.end(); spot != limit; ++spot) {
       spot->second.m_id.setAddr(m_addr);
     }
   }
@@ -522,26 +547,22 @@ CacheImpl::open(uint32_t addr) {
 }
 
 time_t
-CacheImpl::waitTime() const {
+CacheImpl::waitTime() const
+{
   time_t now = time(0);
   return ts::minima(m_groups, &GroupData::waitTime, now);
 }
 
 void
-CacheImpl::generateHereIAm(
-  HereIAmMsg& msg,
-  GroupData& group
-) {
+CacheImpl::generateHereIAm(HereIAmMsg &msg, GroupData &group)
+{
   msg.fill(group, group.m_id, this->setSecurity(msg, group));
   msg.finalize();
 }
 
 void
-CacheImpl::generateHereIAm(
-  HereIAmMsg& msg,
-  GroupData& group,
-  RouterData& router
-) {
+CacheImpl::generateHereIAm(HereIAmMsg &msg, GroupData &group, RouterData &router)
+{
   SecurityOption sec_opt = this->setSecurity(msg, group);
 
   msg.fill(group, group.m_id, sec_opt);
@@ -553,32 +574,26 @@ CacheImpl::generateHereIAm(
 }
 
 void
-CacheImpl::generateRedirectAssign(
-  RedirectAssignMsg& msg,
-  GroupData& group
-) {
+CacheImpl::generateRedirectAssign(RedirectAssignMsg &msg, GroupData &group)
+{
   msg.fill(group, this->setSecurity(msg, group));
   msg.finalize();
 }
 
 ts::Errata
-CacheImpl::checkRouterAssignment(
-  GroupData const& group,
-  RouterViewComp const& comp
-) const {
-  detail::Assignment const& ainfo = group.m_assign_info;
+CacheImpl::checkRouterAssignment(GroupData const &group, RouterViewComp const &comp) const
+{
+  detail::Assignment const &ainfo = group.m_assign_info;
   // If group doesn't have an active assignment, always match w/o checking.
   ts::Errata zret; // default is success.
 
   // if active assignment and data we can check, then check.
-  if (ainfo.isActive() && ! comp.isEmpty()) {
+  if (ainfo.isActive() && !comp.isEmpty()) {
     // Validate the assignment key.
-    if (ainfo.getKey().getAddr() != comp.getKeyAddr()
-      || ainfo.getKey().getChangeNumber() != comp.getKeyChangeNumber()
-    ) {
-      log(zret, LVL_INFO, "Router assignment key did not match.");;
-    } else if (ServiceGroup::HASH_ONLY == group.m_cache_assign
-    ) {
+    if (ainfo.getKey().getAddr() != comp.getKeyAddr() || ainfo.getKey().getChangeNumber() != comp.getKeyChangeNumber()) {
+      log(zret, LVL_INFO, "Router assignment key did not match.");
+      ;
+    } else if (ServiceGroup::HASH_ONLY == group.m_cache_assign) {
       // Still not sure how much checking we really want or should
       // do here. For now, we'll just leave the checks validating
       // the assignment key.
@@ -592,10 +607,11 @@ CacheImpl::checkRouterAssignment(
 }
 
 int
-CacheImpl::housekeeping() {
+CacheImpl::housekeeping()
+{
   int zret = 0;
   sockaddr_in dst_addr;
-  sockaddr* addr_ptr = reinterpret_cast<sockaddr*>(&dst_addr);
+  sockaddr *addr_ptr = reinterpret_cast<sockaddr *>(&dst_addr);
   time_t now = time(0);
   static size_t const BUFFER_SIZE = 4096;
   MsgBuffer msg_buffer;
@@ -608,24 +624,15 @@ CacheImpl::housekeeping() {
   dst_addr.sin_port = htons(DEFAULT_PORT);
 
   // Walk the service groups and do their housekeeping.
-  for ( GroupMap::iterator
-          svc_spot = m_groups.begin(),
-          svc_limit = m_groups.end();
-        svc_spot != svc_limit;
-        ++svc_spot
-  ) {
-    GroupData& group = svc_spot->second;
+  for (GroupMap::iterator svc_spot = m_groups.begin(), svc_limit = m_groups.end(); svc_spot != svc_limit; ++svc_spot) {
+    GroupData &group = svc_spot->second;
 
     // Check to see if it's time for an assignment.
-    if (group.m_assignment_pending
-      && group.m_generation_time + ASSIGN_WAIT <= now
-    ) {
+    if (group.m_assignment_pending && group.m_generation_time + ASSIGN_WAIT <= now) {
       // Is a valid assignment possible?
       if (group.m_assign_info.fill(group, m_addr)) {
         group.m_assign_info.setActive(true);
-        ts::for_each(group.m_routers,
-          ts::assign_member(&RouterData::m_assign, true)
-        );
+        ts::for_each(group.m_routers, ts::assign_member(&RouterData::m_assign, true));
       }
 
       // Always clear because no point in sending an assign we can't generate.
@@ -637,11 +644,7 @@ CacheImpl::housekeeping() {
     // Check to see if the related service is up
     if (group.processUp()) {
       // Check the active routers for scheduled packets.
-      for ( RouterBag::iterator rspot = group.m_routers.begin(),
-               rend = group.m_routers.end() ;
-             rspot != rend ;
-             ++rspot
-      ) {
+      for (RouterBag::iterator rspot = group.m_routers.begin(), rend = group.m_routers.end(); rspot != rend; ++rspot) {
         dst_addr.sin_addr.s_addr = rspot->m_addr;
         if (0 == rspot->pingTime(now)) {
           HereIAmMsg here_i_am;
@@ -651,13 +654,10 @@ CacheImpl::housekeeping() {
           if (0 <= zret) {
             rspot->m_xmit.set(now, group.m_generation);
             rspot->m_send_caps = false;
-            logf(LVL_DEBUG, "Sent HERE_I_AM for service group %d to router %s%s[#%d,%lu].",
-              group.m_svc.getSvcId(),
-              ip_addr_to_str(rspot->m_addr),
-              rspot->m_rapid ? " [rapid] " : " ",
-              group.m_generation, now
-            );
-            if (rspot->m_rapid) --(rspot->m_rapid);
+            logf(LVL_DEBUG, "Sent HERE_I_AM for service group %d to router %s%s[#%d,%lu].", group.m_svc.getSvcId(),
+                 ip_addr_to_str(rspot->m_addr), rspot->m_rapid ? " [rapid] " : " ", group.m_generation, now);
+            if (rspot->m_rapid)
+              --(rspot->m_rapid);
           } else {
             logf_errno(LVL_WARN, "Failed to send to router " ATS_IP_PRINTF_CODE " - ", ATS_IP_OCTETS(rspot->m_addr));
           }
@@ -666,46 +666,35 @@ CacheImpl::housekeeping() {
           redirect_assign.setBuffer(msg_buffer);
           this->generateRedirectAssign(redirect_assign, group);
           zret = sendto(m_fd, msg_data, redirect_assign.getCount(), 0, addr_ptr, sizeof(dst_addr));
-          if (0 <= zret) rspot->m_assign = false;
+          if (0 <= zret)
+            rspot->m_assign = false;
         }
       }
     }
 
     // Seed routers.
-    for ( std::vector<SeedRouter>::iterator
-            sspot = group.m_seed_routers.begin(),
-            slimit = group.m_seed_routers.end() ;
-           sspot != slimit ;
-           ++sspot
-    ) {
+    for (std::vector<SeedRouter>::iterator sspot = group.m_seed_routers.begin(), slimit = group.m_seed_routers.end();
+         sspot != slimit; ++sspot) {
       // Check to see if the related service is up
       if (group.processUp()) {
         HereIAmMsg here_i_am;
         here_i_am.setBuffer(msg_buffer);
         // Is the router due for a ping?
-        if (sspot->m_xmit + TIME_UNIT > now) continue; // no
+        if (sspot->m_xmit + TIME_UNIT > now)
+          continue; // no
 
         this->generateHereIAm(here_i_am, group);
 
         dst_addr.sin_addr.s_addr = sspot->m_addr;
-        zret = sendto(m_fd, msg_data, here_i_am.getCount(), 0,
-          addr_ptr, sizeof(dst_addr));
+        zret = sendto(m_fd, msg_data, here_i_am.getCount(), 0, addr_ptr, sizeof(dst_addr));
         if (0 <= zret) {
-          logf(LVL_DEBUG, "Sent HERE_I_AM for SG %d to seed router %s [gen=#%d,t=%lu,n=%lu].",
-            group.m_svc.getSvcId(),
-            ip_addr_to_str(sspot->m_addr),
-            group.m_generation, now, here_i_am.getCount()
-          );
+          logf(LVL_DEBUG, "Sent HERE_I_AM for SG %d to seed router %s [gen=#%d,t=%lu,n=%lu].", group.m_svc.getSvcId(),
+               ip_addr_to_str(sspot->m_addr), group.m_generation, now, here_i_am.getCount());
           sspot->m_xmit = now;
           sspot->m_count += 1;
-        }
-        else logf(LVL_DEBUG,
-          "Error [%d:%s] sending HERE_I_AM for SG %d to seed router %s [#%d,%lu].",
-          zret, strerror(errno),
-          group.m_svc.getSvcId(),
-          ip_addr_to_str(sspot->m_addr),
-          group.m_generation, now
-        );
+        } else
+          logf(LVL_DEBUG, "Error [%d:%s] sending HERE_I_AM for SG %d to seed router %s [#%d,%lu].", zret, strerror(errno),
+               group.m_svc.getSvcId(), ip_addr_to_str(sspot->m_addr), group.m_generation, now);
       }
     }
   }
@@ -713,7 +702,8 @@ CacheImpl::housekeeping() {
 }
 
 ts::Errata
-CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer const& chunk) {
+CacheImpl::handleISeeYou(IpHeader const & /* ip_hdr ATS_UNUSED */, ts::Buffer const &chunk)
+{
   ts::Errata zret;
   ISeeYouMsg msg;
   // Set if our view of the group changes enough to bump the
@@ -730,7 +720,7 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
   if (spot == m_groups.end())
     return logf(LVL_INFO, "WCCP2_I_SEE_YOU ignored - service group %d not found.", svc.getSvcId());
 
-  GroupData& group = spot->second;
+  GroupData &group = spot->second;
 
   if (!this->validateSecurity(msg, group))
     return log(LVL_INFO, "Ignored WCCP2_I_SEE_YOU with invalid security.\n");
@@ -749,10 +739,10 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
   uint32_t to_addr = msg.m_router_id.getToAddr();
   uint32_t recv_id = msg.m_router_id.idElt().getRecvId();
   RouterBag::iterator ar_spot; // active router
-  int router_idx; // index in active routers.
-  std::vector< SeedRouter >::iterator seed_spot;
+  int router_idx;              // index in active routers.
+  std::vector<SeedRouter>::iterator seed_spot;
 
-  CapComp& caps = msg.m_capabilities;
+  CapComp &caps = msg.m_capabilities;
   // Handle the router that sent us this.
   ar_spot = find_by_member(group.m_routers, &RouterData::m_addr, router_addr);
   if (ar_spot == group.m_routers.end()) {
@@ -768,7 +758,7 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
     // Validate capabilities.
     ServiceGroup::PacketStyle ps;
     ServiceGroup::CacheAssignmentStyle as;
-    char const* caps_tag = caps.isEmpty() ? "default" : "router";
+    char const *caps_tag = caps.isEmpty() ? "default" : "router";
 
     // No caps -> use GRE forwarding.
     ps = caps.isEmpty() ? ServiceGroup::GRE : caps.getPacketForwardStyle();
@@ -814,11 +804,9 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
     ts::Errata status = this->checkRouterAssignment(group, msg.m_router_view);
     if (status.size()) {
       ar_spot->m_assign = true; // schedule an assignment message.
-      logf(status, LVL_INFO, "Router assignment reported from "
-        ATS_IP_PRINTF_CODE
-        " did not match local assignment. Resending assignment.\n ",
-        ATS_IP_OCTETS(router_addr)
-      );
+      logf(status, LVL_INFO,
+           "Router assignment reported from " ATS_IP_PRINTF_CODE " did not match local assignment. Resending assignment.\n ",
+           ATS_IP_OCTETS(router_addr));
     }
   }
   time_t then = ar_spot->m_recv.m_time; // used for comparisons later.
@@ -828,12 +816,12 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
   // Reply with our own capability options iff the router sent one to us.
   // This is a violation of the spec but it's what we have to do in practice
   // for mask assignment.
-  ar_spot->m_send_caps = ! caps.isEmpty();
+  ar_spot->m_send_caps = !caps.isEmpty();
 
   // For all the other listed routers, seed them if they're not
   // already active.
   uint32_t nr = msg.m_router_view.getRouterCount();
-  for ( uint32_t idx = 0; idx < nr ; ++idx ) {
+  for (uint32_t idx = 0; idx < nr; ++idx) {
     uint32_t addr = msg.m_router_view.getRouterAddr(idx);
     if (group.m_routers.end() == find_by_member(group.m_routers, &RouterData::m_addr, addr))
       group.seedRouter(addr);
@@ -844,8 +832,8 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
   // in its last packet.
   group.resizeCacheSources();
   uint32_t nc = msg.m_router_view.getCacheCount();
-  for ( uint32_t idx = 0 ; idx < nc ; ++idx ) {
-    CacheIdBox& cache = msg.m_router_view.cacheId(idx);
+  for (uint32_t idx = 0; idx < nc; ++idx) {
+    CacheIdBox &cache = msg.m_router_view.cacheId(idx);
     CacheBag::iterator ac_spot = group.findCache(cache.getAddr());
     if (group.m_caches.end() == ac_spot) {
       group.m_caches.push_back(CacheData());
@@ -857,21 +845,25 @@ CacheImpl::handleISeeYou(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer con
       // Check if the cache wasn't reported last time but was reported
       // this time. In that case we need to bump the view to trigger
       // assignment generation.
-      if (ac_spot->m_src[router_idx].m_time != then) view_changed = true;
+      if (ac_spot->m_src[router_idx].m_time != then)
+        view_changed = true;
     }
     ac_spot->m_id.fill(cache);
     // If cache is this cache, update data in router record.
-    if (cache.getAddr() == m_addr) ar_spot->m_local_cache_id.fill(cache);
+    if (cache.getAddr() == m_addr)
+      ar_spot->m_local_cache_id.fill(cache);
     ac_spot->m_src[router_idx].set(now, recv_id);
   }
 
-  if (view_changed) group.viewChanged(now);
+  if (view_changed)
+    group.viewChanged(now);
 
   return zret;
 }
 
 ts::Errata
-CacheImpl::handleRemovalQuery(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffer const& chunk) {
+CacheImpl::handleRemovalQuery(IpHeader const & /* ip_hdr ATS_UNUSED */, ts::Buffer const &chunk)
+{
   ts::Errata zret;
   RemovalQueryMsg msg;
   time_t now = time(0);
@@ -885,7 +877,7 @@ CacheImpl::handleRemovalQuery(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffe
   if (spot == m_groups.end())
     return logf(LVL_INFO, "WCCP2_REMOVAL_QUERY ignored - service group %d not found.", svc.getSvcId());
 
-  GroupData& group = spot->second;
+  GroupData &group = spot->second;
 
   if (!this->validateSecurity(msg, group))
     return log(LVL_INFO, "Ignored WCCP2_REMOVAL_QUERY with invalid security.\n");
@@ -900,25 +892,15 @@ CacheImpl::handleRemovalQuery(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffe
     if (group.m_routers.end() != router) {
       router->m_rapid = true; // do rapid responses.
       router->m_recv.set(now, msg.m_query.getRecvId());
-      logf(LVL_INFO, "WCCP2_REMOVAL_QUERY from router "
-        ATS_IP_PRINTF_CODE ".\n",
-        ATS_IP_OCTETS(raddr)
-      );
+      logf(LVL_INFO, "WCCP2_REMOVAL_QUERY from router " ATS_IP_PRINTF_CODE ".\n", ATS_IP_OCTETS(raddr));
     } else {
-      logf(LVL_INFO, "WCCP2_REMOVAL_QUERY from unknown router "
-        ATS_IP_PRINTF_CODE ".\n",
-        ATS_IP_OCTETS(raddr)
-      );
+      logf(LVL_INFO, "WCCP2_REMOVAL_QUERY from unknown router " ATS_IP_PRINTF_CODE ".\n", ATS_IP_OCTETS(raddr));
     }
   } else {
     // Not an error in the multi-cast case, so just log under debug.
-    logf(LVL_DEBUG, "WCCP2_REMOVAL_QUERY ignored -- target cache address "
-      ATS_IP_PRINTF_CODE
-      " did not match local address "
-      ATS_IP_PRINTF_CODE
-      "\n.",
-      ATS_IP_OCTETS(target_addr), ATS_IP_OCTETS(m_addr)
-    );
+    logf(LVL_DEBUG, "WCCP2_REMOVAL_QUERY ignored -- target cache address " ATS_IP_PRINTF_CODE
+                    " did not match local address " ATS_IP_PRINTF_CODE "\n.",
+         ATS_IP_OCTETS(target_addr), ATS_IP_OCTETS(m_addr));
   }
 
   logf(LVL_DEBUG, "Received WCCP2_REMOVAL_QUERY for group %d.", group.m_svc.getSvcId());
@@ -927,29 +909,27 @@ CacheImpl::handleRemovalQuery(IpHeader const& /* ip_hdr ATS_UNUSED */, ts::Buffe
 }
 // ------------------------------------------------------
 inline uint32_t
-RouterImpl::CacheData::idAddr() const {
+RouterImpl::CacheData::idAddr() const
+{
   return m_id.getAddr();
 }
 
-RouterImpl::GroupData::GroupData() { }
+RouterImpl::GroupData::GroupData()
+{
+}
 
 RouterImpl::CacheBag::iterator
-RouterImpl::GroupData::findCache(uint32_t addr) {
-  return std::find_if(
-    m_caches.begin(),
-    m_caches.end(),
-    ts::predicate(&CacheData::idAddr, addr)
-  );
-}
-
-RouterImpl::GroupData&
-RouterImpl::defineServiceGroup(
-  ServiceGroup const& svc,
-  ServiceGroup::Result* result
-) {
+RouterImpl::GroupData::findCache(uint32_t addr)
+{
+  return std::find_if(m_caches.begin(), m_caches.end(), ts::predicate(&CacheData::idAddr, addr));
+}
+
+RouterImpl::GroupData &
+RouterImpl::defineServiceGroup(ServiceGroup const &svc, ServiceGroup::Result *result)
+{
   uint8_t svc_id = svc.getSvcId();
   GroupMap::iterator spot = m_groups.find(svc_id);
-  GroupData* group; // service with target ID.
+  GroupData *group; // service with target ID.
   ServiceGroup::Result zret;
   if (spot == m_groups.end()) { // not defined
     group = &(m_groups[svc_id]);
@@ -959,24 +939,27 @@ RouterImpl::defineServiceGroup(
     group = &spot->second;
     zret = group->m_svc == svc ? ServiceGroup::EXISTS : ServiceGroup::CONFLICT;
   }
-  if (result) *result = zret;
+  if (result)
+    *result = zret;
   return *group;
 }
 
 void
-RouterImpl::GroupData::resizeRouterSources() {
+RouterImpl::GroupData::resizeRouterSources()
+{
   ts::for_each(m_routers, &RouterData::resize, m_caches.size());
 }
 
 ts::Errata
-RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
+RouterImpl::handleHereIAm(IpHeader const &ip_hdr, ts::Buffer const &chunk)
+{
   ts::Errata zret;
   HereIAmMsg msg;
   static GroupData nil_group; // scratch until I clean up the security.
   // Set if our view of the group changes enough to bump the
   // generation number.
   bool view_changed = false;
-  int i; // scratch index var.
+  int i;                // scratch index var.
   time_t now = time(0); // don't call this over and over.
   int parse = msg.parse(chunk);
 
@@ -988,7 +971,7 @@ RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
 
   ServiceGroup svc(msg.m_service);
   ServiceGroup::Result r;
-  GroupData& group = this->defineServiceGroup(svc, &r);
+  GroupData &group = this->defineServiceGroup(svc, &r);
   if (ServiceGroup::CONFLICT == r)
     return logf(LVL_INFO, "WCCP2_HERE_I_AM ignored - service group %d definition does not match.\n", svc.getSvcId());
   else if (ServiceGroup::DEFINED == r)
@@ -1009,7 +992,7 @@ RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
   } else {
     // Did the cache mention us specifically?
     // If so, make sure the sequence # is correct.
-    RouterIdElt* me = msg.m_cache_view.findf_router_elt(m_addr);
+    RouterIdElt *me = msg.m_cache_view.findf_router_elt(m_addr);
     if (me && me->getRecvId() != cache->m_recv_count)
       return logf(LVL_INFO, "Discarded out of date (recv=%d, local=%ld) WCCP2_HERE_I_AM.\n", me->getRecvId(), cache->m_recv_count);
   }
@@ -1024,7 +1007,7 @@ RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
 
   // Add any new routers
   i = msg.m_cache_view.getRouterCount();
-  while(i-- > 0) {
+  while (i-- > 0) {
     uint32_t addr = msg.m_cache_view.routerElt(i).getAddr();
     RouterBag::iterator spot = find_by_member(group.m_routers, &RouterData::m_addr, addr);
     if (spot == group.m_routers.end()) {
@@ -1038,16 +1021,14 @@ RouterImpl::handleHereIAm(IpHeader const& ip_hdr, ts::Buffer const& chunk) {
     spot->m_src[cache_idx].set(now, cache_gen);
   }
 
-  if (view_changed) ++(group.m_generation);
+  if (view_changed)
+    ++(group.m_generation);
   return zret;
 }
 
 void
-RouterImpl::generateISeeYou(
-  ISeeYouMsg& msg,
-  GroupData& group,
-  CacheData& cache
-) {
+RouterImpl::generateISeeYou(ISeeYouMsg &msg, GroupData &group, CacheData &cache)
+{
   int i;
   size_t n_routers = group.m_routers.size();
   size_t n_caches = group.m_caches.size();
@@ -1056,46 +1037,37 @@ RouterImpl::generateISeeYou(
   msg.fill(group, this->setSecurity(msg, group), group.m_assign_info, 1, n_routers, n_caches);
 
   // Fill in ID data not done by fill.
-  msg.m_router_id
-    .setIdElt(m_addr, cache.m_recv_count + 1)
-    .setToAddr(cache.m_to_addr)
-    .setFromAddr(0, cache.idAddr());
-    ;
+  msg.m_router_id.setIdElt(m_addr, cache.m_recv_count + 1).setToAddr(cache.m_to_addr).setFromAddr(0, cache.idAddr());
+  ;
 
   // Fill view routers.
   i = 0;
-  for ( RouterBag::iterator router = group.m_routers.begin(),
-          router_limit = group.m_routers.end();
-        router != router_limit;
-        ++router, ++i
-  ) {
+  for (RouterBag::iterator router = group.m_routers.begin(), router_limit = group.m_routers.end(); router != router_limit;
+       ++router, ++i) {
     msg.m_router_view.setRouterAddr(i, router->m_addr);
   }
 
   // Fill view caches.
   i = 0;
-  for ( CacheBag::iterator spot = group.m_caches.begin(),
-          limit = group.m_caches.end();
-        spot != limit;
-        ++spot, ++i
-  ) {
+  for (CacheBag::iterator spot = group.m_caches.begin(), limit = group.m_caches.end(); spot != limit; ++spot, ++i) {
     // TBD: This needs to track memory because cache ID elements
     // turn out to be variable sized.
-//    msg.m_router_view.cacheId(i) = spot->m_id;
+    //    msg.m_router_view.cacheId(i) = spot->m_id;
   }
 
   msg.finalize();
 }
 
 int
-RouterImpl::xmitISeeYou() {
+RouterImpl::xmitISeeYou()
+{
   int zret = 0;
   ISeeYouMsg msg;
   MsgBuffer buffer;
   sockaddr_in dst_addr;
   time_t now = time(0);
   static size_t const BUFFER_SIZE = 4096;
-  char* data = static_cast<char*>(alloca(BUFFER_SIZE));
+  char *data = static_cast<char *>(alloca(BUFFER_SIZE));
 
   memset(&dst_addr, 0, sizeof(dst_addr));
   dst_addr.sin_family = AF_INET;
@@ -1103,33 +1075,24 @@ RouterImpl::xmitISeeYou() {
   buffer.set(data, BUFFER_SIZE);
 
   // Send out messages for each service group.
-  for ( GroupMap::iterator svc_spot = m_groups.begin(),
-          svc_limit = m_groups.end() ;
-        svc_spot != svc_limit ;
-        ++svc_spot
-  ) {
-    GroupData& group = svc_spot->second;
+  for (GroupMap::iterator svc_spot = m_groups.begin(), svc_limit = m_groups.end(); svc_spot != svc_limit; ++svc_spot) {
+    GroupData &group = svc_spot->second;
 
     // Check each active cache in the group.
-    for ( CacheBag::iterator cache = group.m_caches.begin(),
-             cache_limit = group.m_caches.end() ;
-           cache != cache_limit ;
-           ++cache
-    ) {
-      if (!cache->m_pending) continue;
+    for (CacheBag::iterator cache = group.m_caches.begin(), cache_limit = group.m_caches.end(); cache != cache_limit; ++cache) {
+      if (!cache->m_pending)
+        continue;
 
       msg.setBuffer(buffer);
       this->generateISeeYou(msg, group, *cache);
       dst_addr.sin_addr.s_addr = cache->m_id.getAddr();
-      zret = sendto(m_fd, data, msg.getCount(), 0,
-        reinterpret_cast<sockaddr*>(&dst_addr), sizeof(dst_addr));
+      zret = sendto(m_fd, data, msg.getCount(), 0, reinterpret_cast<sockaddr *>(&dst_addr), sizeof(dst_addr));
       if (0 <= zret) {
         cache->m_xmit.set(now, group.m_generation);
         cache->m_pending = false;
         cache->m_recv_count = msg.m_router_id.getRecvId();
         logf(LVL_DEBUG, "I_SEE_YOU -> %s\n", ip_addr_to_str(cache->m_id.getAddr()));
-      }
-      else {
+      } else {
         log_errno(LVL_WARN, "Router transmit failed -");
         return zret;
       }
@@ -1139,137 +1102,165 @@ RouterImpl::xmitISeeYou() {
 }
 
 int
-RouterImpl::housekeeping() {
+RouterImpl::housekeeping()
+{
   return this->xmitISeeYou();
 }
 
 bool
-RouterImpl::isConfigured() const {
+RouterImpl::isConfigured() const
+{
   return false;
 }
 // ------------------------------------------------------
-EndPoint::EndPoint() {
+EndPoint::EndPoint()
+{
 }
 
-EndPoint::~EndPoint() {
+EndPoint::~EndPoint()
+{
 }
 
-EndPoint::EndPoint(self const& that)
-  : m_ptr(that.m_ptr) {
+EndPoint::EndPoint(self const &that) : m_ptr(that.m_ptr)
+{
 }
 
-inline EndPoint::ImplType*
-EndPoint::instance() {
+inline EndPoint::ImplType *
+EndPoint::instance()
+{
   return m_ptr ? m_ptr.get() : this->make();
 }
 
-EndPoint& EndPoint::setAddr(uint32_t addr) {
+EndPoint &
+EndPoint::setAddr(uint32_t addr)
+{
   this->instance()->m_addr = addr;
   logf(LVL_DEBUG, "Endpoint address set to %s\n", ip_addr_to_str(addr));
   return *this;
 }
 
 bool
-EndPoint::isConfigured() const {
+EndPoint::isConfigured() const
+{
   return m_ptr && m_ptr->isConfigured();
 }
 
 int
-EndPoint::open(uint32_t addr) {
+EndPoint::open(uint32_t addr)
+{
   return this->instance()->open(addr);
 }
 
 void
-EndPoint::useMD5Security(ts::ConstBuffer const& key) {
+EndPoint::useMD5Security(ts::ConstBuffer const &key)
+{
   this->instance()->useMD5Security(key);
 }
 
-int EndPoint::getSocket() const {
+int
+EndPoint::getSocket() const
+{
   return m_ptr ? m_ptr->m_fd : ts::NO_FD;
 }
 
 int
-EndPoint::housekeeping() {
+EndPoint::housekeeping()
+{
   // Don't force an instance because if there isn't one,
   // there's no socket either.
   return m_ptr && ts::NO_FD != m_ptr->m_fd ? m_ptr->housekeeping() : -ENOTCONN;
 }
 
 ts::Rv<int>
-EndPoint::handleMessage() {
-  return m_ptr
-    ? m_ptr->handleMessage()
-    : ts::Rv<int>(-ENOTCONN, log(LVL_INFO, "EndPoint::handleMessage called on unconnected instance"));
+EndPoint::handleMessage()
+{
+  return m_ptr ? m_ptr->handleMessage() :
+                 ts::Rv<int>(-ENOTCONN, log(LVL_INFO, "EndPoint::handleMessage called on unconnected instance"));
 }
 // ------------------------------------------------------
-Cache::Cache() {
+Cache::Cache()
+{
 }
 
-Cache::~Cache() {
+Cache::~Cache()
+{
 }
 
-EndPoint::ImplType*
-Cache::make() {
+EndPoint::ImplType *
+Cache::make()
+{
   m_ptr.assign(new ImplType);
   return m_ptr.get();
 }
 
-inline Cache::ImplType*
-Cache::instance() {
-  return static_cast<ImplType*>(this->super::instance());
+inline Cache::ImplType *
+Cache::instance()
+{
+  return static_cast<ImplType *>(this->super::instance());
 }
 
-inline Cache::ImplType* Cache::impl() {
-  return static_cast<ImplType*>(m_ptr.get());
+inline Cache::ImplType *
+Cache::impl()
+{
+  return static_cast<ImplType *>(m_ptr.get());
 }
 
-inline Cache::ImplType const* Cache::impl() const {
-  return static_cast<ImplType*>(m_ptr.get());
+inline Cache::ImplType const *
+Cache::impl() const
+{
+  return static_cast<ImplType *>(m_ptr.get());
 }
 
 Cache::Service
-Cache::defineServiceGroup(
-  ServiceGroup const& svc,
-  ServiceGroup::Result* result
-) {
+Cache::defineServiceGroup(ServiceGroup const &svc, ServiceGroup::Result *result)
+{
   return Service(*this, this->instance()->defineServiceGroup(svc, result));
 }
 
-time_t Cache::waitTime() const {
+time_t
+Cache::waitTime() const
+{
   return m_ptr ? this->impl()->waitTime() : std::numeric_limits<time_t>::max();
 }
 
-Cache&
-Cache::addSeedRouter(uint8_t id, uint32_t addr) {
+Cache &
+Cache::addSeedRouter(uint8_t id, uint32_t addr)
+{
   this->instance()->seedRouter(id, addr);
   return *this;
 }
 
 ts::Errata
-Cache::loadServicesFromFile(char const* path) {
+Cache::loadServicesFromFile(char const *path)
+{
   return this->instance()->loadServicesFromFile(path);
 }
 // ------------------------------------------------------
-Router::Router() {
+Router::Router()
+{
 }
 
-Router::~Router() {
+Router::~Router()
+{
 }
 
-EndPoint::ImplType*
-Router::make() {
+EndPoint::ImplType *
+Router::make()
+{
   m_ptr.assign(new ImplType);
   return m_ptr.get();
 }
 
-inline Router::ImplType*
-Router::instance() {
-  return static_cast<ImplType*>(this->super::instance());
+inline Router::ImplType *
+Router::instance()
+{
+  return static_cast<ImplType *>(this->super::instance());
 }
 
-inline Router::ImplType*
-Router::impl() {
-  return static_cast<ImplType*>(m_ptr.get());
+inline Router::ImplType *
+Router::impl()
+{
+  return static_cast<ImplType *>(m_ptr.get());
 }
 // ------------------------------------------------------
 } // namespace wccp


[47/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/response-header-1/response-header-1.c
----------------------------------------------------------------------
diff --git a/example/response-header-1/response-header-1.c b/example/response-header-1/response-header-1.c
index 814c2d2..2dd9abb 100644
--- a/example/response-header-1/response-header-1.c
+++ b/example/response-header-1/response-header-1.c
@@ -85,18 +85,17 @@ modify_header(TSHttpTxn txnp)
   int num_refreshes = 0;
 
   if (!init_buffer_status)
-    return;                     /* caller reenables */
+    return; /* caller reenables */
 
   if (TSHttpTxnServerRespGet(txnp, &resp_bufp, &resp_loc) != TS_SUCCESS) {
     TSError("couldn't retrieve server response header\n");
-    return;                     /* caller reenables */
+    return; /* caller reenables */
   }
 
   /* TSqa06246/TSqa06144 */
   resp_status = TSHttpHdrStatusGet(resp_bufp, resp_loc);
 
   if (TS_HTTP_STATUS_OK == resp_status) {
-
     TSDebug("resphdr", "Processing 200 OK");
     TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probably should check for errors */
     TSDebug("resphdr", "Created new resp field with loc %p", new_field_loc);
@@ -106,7 +105,7 @@ modify_header(TSHttpTxn txnp)
      */
     TSMimeHdrFieldCopy(resp_bufp, resp_loc, new_field_loc, hdr_bufp, hdr_loc, field_loc);
 
-        /*********** Unclear why this is needed **************/
+    /*********** Unclear why this is needed **************/
     TSMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
 
 
@@ -114,10 +113,8 @@ modify_header(TSHttpTxn txnp)
     TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probably should check for errors */
     TSDebug("resphdr", "Created new resp field with loc %p", new_field_loc);
     TSMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
-    TSMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc,
-                           TS_MIME_FIELD_CACHE_CONTROL, TS_MIME_LEN_CACHE_CONTROL);
-    TSMimeHdrFieldValueStringInsert(resp_bufp, resp_loc, new_field_loc,
-                                     -1, TS_HTTP_VALUE_PUBLIC, TS_HTTP_LEN_PUBLIC);
+    TSMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc, TS_MIME_FIELD_CACHE_CONTROL, TS_MIME_LEN_CACHE_CONTROL);
+    TSMimeHdrFieldValueStringInsert(resp_bufp, resp_loc, new_field_loc, -1, TS_HTTP_VALUE_PUBLIC, TS_HTTP_LEN_PUBLIC);
 
     /*
      * mimehdr2_name  = TSstrdup( "x-date-200-recvd" ) : CurrentDateTime
@@ -133,7 +130,6 @@ modify_header(TSHttpTxn txnp)
     TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
 
   } else if (TS_HTTP_STATUS_NOT_MODIFIED == resp_status) {
-
     TSDebug("resphdr", "Processing 304 Not Modified");
 
     /* N.B.: Protect writes to data (hash on URL + mutex: (ies)) */
@@ -143,17 +139,16 @@ modify_header(TSHttpTxn txnp)
       TSError("STATUS 304, TSHttpTxnCachedRespGet():");
       TSError("couldn't retrieve cached response header\n");
       TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
-      return;                   /* Caller reenables */
+      return; /* Caller reenables */
     }
 
     /* Get the cached MIME field name for this HTTP header */
-    cached_field_loc = TSMimeHdrFieldFind(cached_bufp, cached_loc,
-                                           (const char *) mimehdr1_name, strlen(mimehdr1_name));
+    cached_field_loc = TSMimeHdrFieldFind(cached_bufp, cached_loc, (const char *)mimehdr1_name, strlen(mimehdr1_name));
     if (TS_NULL_MLOC == cached_field_loc) {
       TSError("Can't find header %s in cached document", mimehdr1_name);
       TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
       TSHandleMLocRelease(cached_bufp, TS_NULL_MLOC, cached_loc);
-      return;                   /* Caller reenables */
+      return; /* Caller reenables */
     }
 
     /* Get the cached MIME value for this name in this HTTP header */
@@ -163,7 +158,7 @@ modify_header(TSHttpTxn txnp)
       TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
       TSHandleMLocRelease(cached_bufp, TS_NULL_MLOC, cached_loc);
       TSHandleMLocRelease(cached_bufp, cached_loc, cached_field_loc);
-      return;                   /* Caller reenables */
+      return; /* Caller reenables */
     }
     TSDebug("resphdr", "Header field value is %s, with length %d", chkptr, chklength);
 
@@ -177,17 +172,17 @@ modify_header(TSHttpTxn txnp)
        num_refreshes++ ;
      */
 
-       /* txn origin server response for this transaction stored
-       * in resp_bufp, resp_loc
-       *
-       * Create a new MIME field/value. Cached value has been incremented.
-       * Insert new MIME field/value into the server response buffer,
-       * allow HTTP processing to continue. This will update
-       * (indirectly invalidates) the cached HTTP headers MIME field.
-       * It is apparently not necessary to update all of the MIME fields
-       * in the in-process response in order to have the cached response
-       * become invalid.
-     */
+    /* txn origin server response for this transaction stored
+    * in resp_bufp, resp_loc
+    *
+    * Create a new MIME field/value. Cached value has been incremented.
+    * Insert new MIME field/value into the server response buffer,
+    * allow HTTP processing to continue. This will update
+    * (indirectly invalidates) the cached HTTP headers MIME field.
+    * It is apparently not necessary to update all of the MIME fields
+    * in the in-process response in order to have the cached response
+    * become invalid.
+  */
     TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probaby should check for errrors */
 
     /* mimehdr1_name : TSstrdup( "x-num-served-from-cache" ) ; */
@@ -217,14 +212,14 @@ modify_header(TSHttpTxn txnp)
 static int
 modify_response_header_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_RESPONSE_HDR:
     TSDebug("resphdr", "Called back with TS_EVENT_HTTP_READ_RESPONSE_HDR");
     modify_header(txnp);
     TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
-    /*  fall through  */
+  /*  fall through  */
 
   default:
     break;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/secure-link/secure-link.c
----------------------------------------------------------------------
diff --git a/example/secure-link/secure-link.c b/example/secure-link/secure-link.c
index 9f55e18..04da8b3 100644
--- a/example/secure-link/secure-link.c
+++ b/example/secure-link/secure-link.c
@@ -41,7 +41,7 @@ typedef struct {
 } secure_link_info;
 
 TSRemapStatus
-TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo* rri)
+TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
 {
   int i, len;
   time_t t, e;
@@ -60,22 +60,22 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo* rri)
   TSfree(s);
 
   qh = TSUrlHttpQueryGet(rri->requestBufp, rri->requestUrl, &len);
-  if(qh && len > 0) {
+  if (qh && len > 0) {
     s = (char *)TSstrndup(qh, len);
-    if((ptr = strtok_r(s, "&", &saveptr)) != NULL) {
+    if ((ptr = strtok_r(s, "&", &saveptr)) != NULL) {
       do {
-        if((val = strchr(ptr, '=')) != NULL) {
+        if ((val = strchr(ptr, '=')) != NULL) {
           *val++ = '\0';
-          if(strcmp(ptr, "st") == 0) {
+          if (strcmp(ptr, "st") == 0) {
             token = TSstrdup(val);
-          } else if(strcmp(ptr, "ex") == 0) {
+          } else if (strcmp(ptr, "ex") == 0) {
             expire = TSstrdup(val);
           }
         } else {
           TSError("Invalid parameter [%s]", ptr);
           break;
         }
-      } while((ptr = strtok_r(NULL, "&", &saveptr)) != NULL);
+      } while ((ptr = strtok_r(NULL, "&", &saveptr)) != NULL);
     } else {
       TSError("strtok didn't find a & in the query string");
       /* this is just example, so set fake params to prevent plugin crash */
@@ -88,9 +88,9 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo* rri)
   }
 
   ph = TSUrlPathGet(rri->requestBufp, rri->requestUrl, &len);
-  if(ph && len > 0) {
+  if (ph && len > 0) {
     s = TSstrndup(ph, len);
-    if((ptr = strrchr(s, '/')) != NULL) {
+    if ((ptr = strrchr(s, '/')) != NULL) {
       *++ptr = '\0';
     }
     path = TSstrdup(s);
@@ -108,19 +108,19 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo* rri)
   if (expire)
     MD5_Update(&ctx, expire, strlen(expire));
   MD5_Final(md, &ctx);
-  for(i = 0; i < MD5_DIGEST_LENGTH; i++) {
+  for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
     sprintf(&hash[i * 2], "%02x", md[i]);
   }
   time(&t);
   e = strtol(expire, NULL, 16);
   i = TSREMAP_DID_REMAP;
-  if(e < t || strcmp(hash, token) != 0) {
-    if(e < t) {
+  if (e < t || strcmp(hash, token) != 0) {
+    if (e < t) {
       TSDebug(PLUGIN_NAME, "link expired: [%lu] vs [%lu]", t, e);
     } else {
       TSDebug(PLUGIN_NAME, "tokens mismatch: [%s] vs [%s]", hash, token);
     }
-    if(sli->strict) {
+    if (sli->strict) {
       TSDebug(PLUGIN_NAME, "request is DENY");
       TSHttpTxnSetHttpRetStatus(rh, TS_HTTP_STATUS_FORBIDDEN);
       i = TSREMAP_NO_REMAP;
@@ -128,8 +128,8 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo* rri)
       TSDebug(PLUGIN_NAME, "request is PASS");
     }
   }
-  if(i == TSREMAP_DID_REMAP) {
-    if(TSUrlHttpQuerySet(rri->requestBufp, rri->requestUrl, "", -1) == TS_SUCCESS) {
+  if (i == TSREMAP_DID_REMAP) {
+    if (TSUrlHttpQuerySet(rri->requestBufp, rri->requestUrl, "", -1) == TS_SUCCESS) {
       s = TSUrlStringGet(rri->requestBufp, rri->requestUrl, &len);
       TSDebug(PLUGIN_NAME, "new request string is [%.*s]", len, s);
       TSfree(s);
@@ -158,15 +158,15 @@ TSRemapNewInstance(int argc, char **argv, void **ih, char *errbuf, int errbuf_si
   sli->secret = NULL;
   sli->strict = 0;
 
-  for(i = 2; i < argc; i++) {
-    if((ptr = strchr(argv[i], ':')) != NULL) {
+  for (i = 2; i < argc; i++) {
+    if ((ptr = strchr(argv[i], ':')) != NULL) {
       *ptr++ = '\0';
-      if(strcmp(argv[i], "secret") == 0) {
-        if(sli->secret != NULL) {
+      if (strcmp(argv[i], "secret") == 0) {
+        if (sli->secret != NULL) {
           TSfree(sli->secret);
         }
         sli->secret = TSstrdup(ptr);
-      } else if(strcmp(argv[i], "policy") == 0) {
+      } else if (strcmp(argv[i], "policy") == 0) {
         sli->strict = !strcasecmp(ptr, "strict");
       } else {
         TSDebug(PLUGIN_NAME, "Unknown parameter [%s]", argv[i]);
@@ -176,7 +176,7 @@ TSRemapNewInstance(int argc, char **argv, void **ih, char *errbuf, int errbuf_si
     }
   }
 
-  if(sli->secret == NULL) {
+  if (sli->secret == NULL) {
     sli->secret = TSstrdup("");
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/server-transform/server-transform.c
----------------------------------------------------------------------
diff --git a/example/server-transform/server-transform.c b/example/server-transform/server-transform.c
index 4a2df81..a5c9573 100644
--- a/example/server-transform/server-transform.c
+++ b/example/server-transform/server-transform.c
@@ -59,15 +59,14 @@
 #include "ts/ts.h"
 #include "ink_defs.h"
 
-#define STATE_BUFFER       1
-#define STATE_CONNECT      2
-#define STATE_WRITE        3
-#define STATE_READ_STATUS  4
-#define STATE_READ         5
-#define STATE_BYPASS       6
-
-typedef struct
-{
+#define STATE_BUFFER 1
+#define STATE_CONNECT 2
+#define STATE_WRITE 3
+#define STATE_READ_STATUS 4
+#define STATE_READ 5
+#define STATE_BYPASS 6
+
+typedef struct {
   int state;
   TSHttpTxn txn;
 
@@ -99,7 +98,7 @@ transform_create(TSHttpTxn txnp)
 
   contp = TSTransformCreate(transform_handler, txnp);
 
-  data = (TransformData *) TSmalloc(sizeof(TransformData));
+  data = (TransformData *)TSmalloc(sizeof(TransformData));
   data->state = STATE_BUFFER;
   data->txn = txnp;
   data->input_buf = NULL;
@@ -145,7 +144,7 @@ transform_destroy(TSCont contp)
 }
 
 static int
-transform_connect(TSCont contp, TransformData * data)
+transform_connect(TSCont contp, TransformData *data)
 {
   TSAction action;
   int content_length;
@@ -171,7 +170,7 @@ transform_connect(TSCont contp, TransformData * data)
       temp = TSIOBufferCreate();
       tempReader = TSIOBufferReaderAlloc(temp);
 
-      TSIOBufferWrite(temp, (const char *) &content_length, sizeof(int));
+      TSIOBufferWrite(temp, (const char *)&content_length, sizeof(int));
       TSIOBufferCopy(temp, data->input_reader, content_length, 0);
 
       TSIOBufferReaderFree(data->input_reader);
@@ -191,7 +190,7 @@ transform_connect(TSCont contp, TransformData * data)
   ip_addr.sin_addr.s_addr = server_ip; /* Should be in network byte order */
   ip_addr.sin_port = server_port;
   TSDebug("strans", "net connect..");
-  action = TSNetConnect(contp, (struct sockaddr const*)&ip_addr);
+  action = TSNetConnect(contp, (struct sockaddr const *)&ip_addr);
 
   if (!TSActionDone(action)) {
     data->pending_action = action;
@@ -201,7 +200,7 @@ transform_connect(TSCont contp, TransformData * data)
 }
 
 static int
-transform_write(TSCont contp, TransformData * data)
+transform_write(TSCont contp, TransformData *data)
 {
   int content_length;
 
@@ -217,7 +216,7 @@ transform_write(TSCont contp, TransformData * data)
 }
 
 static int
-transform_read_status(TSCont contp, TransformData * data)
+transform_read_status(TSCont contp, TransformData *data)
 {
   data->state = STATE_READ_STATUS;
 
@@ -233,7 +232,7 @@ transform_read_status(TSCont contp, TransformData * data)
 }
 
 static int
-transform_read(TSCont contp, TransformData * data)
+transform_read(TSCont contp, TransformData *data)
 {
   data->state = STATE_READ;
 
@@ -242,7 +241,7 @@ transform_read(TSCont contp, TransformData * data)
   data->input_reader = NULL;
 
   data->server_vio = TSVConnRead(data->server_vc, contp, data->output_buf, data->content_length);
-  data->output_vc = TSTransformOutputVConnGet((TSVConn) contp);
+  data->output_vc = TSTransformOutputVConnGet((TSVConn)contp);
   if (data->output_vc == NULL) {
     TSError("TSTransformOutputVConnGet returns NULL");
   } else {
@@ -256,7 +255,7 @@ transform_read(TSCont contp, TransformData * data)
 }
 
 static int
-transform_bypass(TSCont contp, TransformData * data)
+transform_bypass(TSCont contp, TransformData *data)
 {
   data->state = STATE_BYPASS;
 
@@ -273,12 +272,11 @@ transform_bypass(TSCont contp, TransformData * data)
   }
 
   TSIOBufferReaderConsume(data->input_reader, sizeof(int));
-  data->output_vc = TSTransformOutputVConnGet((TSVConn) contp);
+  data->output_vc = TSTransformOutputVConnGet((TSVConn)contp);
   if (data->output_vc == NULL) {
     TSError("TSTransformOutputVConnGet returns NULL");
   } else {
-    data->output_vio =
-      TSVConnWrite(data->output_vc, contp, data->input_reader, TSIOBufferReaderAvail(data->input_reader));
+    data->output_vio = TSVConnWrite(data->output_vc, contp, data->input_reader, TSIOBufferReaderAvail(data->input_reader));
     if (data->output_vio == NULL) {
       TSError("TSVConnWrite returns NULL");
     }
@@ -287,7 +285,7 @@ transform_bypass(TSCont contp, TransformData * data)
 }
 
 static int
-transform_buffer_event(TSCont contp, TransformData * data, TSEvent event ATS_UNUSED, void *edata ATS_UNUSED)
+transform_buffer_event(TSCont contp, TransformData *data, TSEvent event ATS_UNUSED, void *edata ATS_UNUSED)
 {
   TSVIO write_vio;
   int towrite;
@@ -358,14 +356,14 @@ transform_buffer_event(TSCont contp, TransformData * data, TSEvent event ATS_UNU
 }
 
 static int
-transform_connect_event(TSCont contp, TransformData * data, TSEvent event, void *edata)
+transform_connect_event(TSCont contp, TransformData *data, TSEvent event, void *edata)
 {
   switch (event) {
   case TS_EVENT_NET_CONNECT:
     TSDebug("strans", "connected");
 
     data->pending_action = NULL;
-    data->server_vc = (TSVConn) edata;
+    data->server_vc = (TSVConn)edata;
     return transform_write(contp, data);
   case TS_EVENT_NET_CONNECT_FAILED:
     TSDebug("strans", "connect failed");
@@ -379,7 +377,7 @@ transform_connect_event(TSCont contp, TransformData * data, TSEvent event, void
 }
 
 static int
-transform_write_event(TSCont contp, TransformData * data, TSEvent event, void *edata ATS_UNUSED)
+transform_write_event(TSCont contp, TransformData *data, TSEvent event, void *edata ATS_UNUSED)
 {
   switch (event) {
   case TS_EVENT_VCONN_WRITE_READY:
@@ -402,7 +400,7 @@ transform_write_event(TSCont contp, TransformData * data, TSEvent event, void *e
 }
 
 static int
-transform_read_status_event(TSCont contp, TransformData * data, TSEvent event, void *edata ATS_UNUSED)
+transform_read_status_event(TSCont contp, TransformData *data, TSEvent event, void *edata ATS_UNUSED)
 {
   switch (event) {
   case TS_EVENT_ERROR:
@@ -420,17 +418,17 @@ transform_read_status_event(TSCont contp, TransformData * data, TSEvent event, v
       buf_ptr = &data->content_length;
       while (read_nbytes > 0) {
         blk = TSIOBufferReaderStart(data->output_reader);
-        buf = (char *) TSIOBufferBlockReadStart(blk, data->output_reader, &avail);
+        buf = (char *)TSIOBufferBlockReadStart(blk, data->output_reader, &avail);
         read_ndone = (avail >= read_nbytes) ? read_nbytes : avail;
         memcpy(buf_ptr, buf, read_ndone);
         if (read_ndone > 0) {
           TSIOBufferReaderConsume(data->output_reader, read_ndone);
           read_nbytes -= read_ndone;
           /* move ptr frwd by read_ndone bytes */
-          buf_ptr = (char *) buf_ptr + read_ndone;
+          buf_ptr = (char *)buf_ptr + read_ndone;
         }
       }
-      //data->content_length = ntohl(data->content_length);
+      // data->content_length = ntohl(data->content_length);
       return transform_read(contp, data);
     }
     return transform_bypass(contp, data);
@@ -442,7 +440,7 @@ transform_read_status_event(TSCont contp, TransformData * data, TSEvent event, v
 }
 
 static int
-transform_read_event(TSCont contp ATS_UNUSED, TransformData * data, TSEvent event, void *edata ATS_UNUSED)
+transform_read_event(TSCont contp ATS_UNUSED, TransformData *data, TSEvent event, void *edata ATS_UNUSED)
 {
   switch (event) {
   case TS_EVENT_ERROR:
@@ -487,7 +485,7 @@ transform_read_event(TSCont contp ATS_UNUSED, TransformData * data, TSEvent even
 }
 
 static int
-transform_bypass_event(TSCont contp ATS_UNUSED, TransformData * data, TSEvent event, void *edata ATS_UNUSED)
+transform_bypass_event(TSCont contp ATS_UNUSED, TransformData *data, TSEvent event, void *edata ATS_UNUSED)
 {
   switch (event) {
   case TS_EVENT_VCONN_WRITE_COMPLETE:
@@ -520,8 +518,7 @@ transform_handler(TSCont contp, TSEvent event, void *edata)
       TSError("Didn't get Continuation's Data. Ignoring Event..");
       return 0;
     }
-    TSDebug("strans", "transform handler event [%d], data->state = [%d]",
-	    event, data->state);
+    TSDebug("strans", "transform handler event [%d], data->state = [%d]", event, data->state);
 
     do {
       switch (data->state) {
@@ -607,7 +604,7 @@ server_response_ok(TSHttpTxn txnp)
 static int
 transform_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_REQUEST_HDR:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/session-1/session-1.c
----------------------------------------------------------------------
diff --git a/example/session-1/session-1.c b/example/session-1/session-1.c
index 8547649..1dde8c7 100644
--- a/example/session-1/session-1.c
+++ b/example/session-1/session-1.c
@@ -69,13 +69,13 @@ ssn_handler(TSCont contp, TSEvent event, void *edata)
   switch (event) {
   case TS_EVENT_HTTP_SSN_START:
 
-    ssnp = (TSHttpSsn) edata;
+    ssnp = (TSHttpSsn)edata;
     handle_session(ssnp, contp);
     TSHttpSsnReenable(ssnp, TS_EVENT_HTTP_CONTINUE);
     return 0;
 
   case TS_EVENT_HTTP_TXN_START:
-    txnp = (TSHttpTxn) edata;
+    txnp = (TSHttpTxn)edata;
     txn_handler(txnp, contp);
     TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
     return 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/ssl-preaccept/ats-util.h
----------------------------------------------------------------------
diff --git a/example/ssl-preaccept/ats-util.h b/example/ssl-preaccept/ats-util.h
index e8f0aef..8973b14 100644
--- a/example/ssl-preaccept/ats-util.h
+++ b/example/ssl-preaccept/ats-util.h
@@ -21,10 +21,10 @@
   limitations under the License.
  */
 
-# if !defined(_ats_util_h)
-# define _ats_util_h
+#if !defined(_ats_util_h)
+#define _ats_util_h
 
-# if defined(__cplusplus)
+#if defined(__cplusplus)
 /** Set data to zero.
 
     Calls @c memset on @a t with a value of zero and a length of @c
@@ -52,12 +52,13 @@
     @endcode
 
  */
-template < typename T > inline void
-ink_zero(
-	 T& t ///< Object to zero.
-	 ) {
+template <typename T>
+inline void
+ink_zero(T &t ///< Object to zero.
+         )
+{
   memset(&t, 0, sizeof(t));
 }
-# endif  /* __cplusplus */
+#endif /* __cplusplus */
 
-# endif // ats-util.h
+#endif // ats-util.h

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/ssl-preaccept/ssl-preaccept.cc
----------------------------------------------------------------------
diff --git a/example/ssl-preaccept/ssl-preaccept.cc b/example/ssl-preaccept/ssl-preaccept.cc
index aa1431d..59b18dc 100644
--- a/example/ssl-preaccept/ssl-preaccept.cc
+++ b/example/ssl-preaccept/ssl-preaccept.cc
@@ -25,28 +25,28 @@
   limitations under the License.
  */
 
-# include <stdio.h>
-# include <memory.h>
-# include <inttypes.h>
-# include <ts/ts.h>
-# include <tsconfig/TsValue.h>
-# include <ts/ink_inet.h>
-# include <getopt.h>
+#include <stdio.h>
+#include <memory.h>
+#include <inttypes.h>
+#include <ts/ts.h>
+#include <tsconfig/TsValue.h>
+#include <ts/ink_inet.h>
+#include <getopt.h>
 
 using ts::config::Configuration;
 using ts::config::Value;
 
-# define PN "ssl-preaccept"
-# define PCP "[" PN " Plugin] "
-
-namespace {
+#define PN "ssl-preaccept"
+#define PCP "[" PN " Plugin] "
 
+namespace
+{
 std::string ConfigPath;
 typedef std::pair<IpAddr, IpAddr> IpRange;
 typedef std::deque<IpRange> IpRangeQueue;
 IpRangeQueue ClientBlindTunnelIp;
 
-Configuration Config;	// global configuration
+Configuration Config; // global configuration
 
 void
 Parse_Addr_String(ts::ConstBuffer const &text, IpRange &range)
@@ -57,11 +57,10 @@ Parse_Addr_String(ts::ConstBuffer const &text, IpRange &range)
   size_t hyphen_pos = textstr.find("-");
   if (hyphen_pos != std::string::npos) {
     std::string addr1 = textstr.substr(0, hyphen_pos);
-    std::string addr2 = textstr.substr(hyphen_pos+1);
+    std::string addr2 = textstr.substr(hyphen_pos + 1);
     range.first.load(ts::ConstBuffer(addr1.c_str(), addr1.length()));
     range.second.load(ts::ConstBuffer(addr2.c_str(), addr2.length()));
-  }
-  else { // Assume it is a single address
+  } else { // Assume it is a single address
     newAddr.load(text);
     range.first = newAddr;
     range.second = newAddr;
@@ -69,7 +68,8 @@ Parse_Addr_String(ts::ConstBuffer const &text, IpRange &range)
 }
 
 /// Get a string value from a config node.
-void Load_Config_Value(Value const& parent, char const* name, IpRangeQueue &addrs)
+void
+Load_Config_Value(Value const &parent, char const *name, IpRangeQueue &addrs)
 {
   Value v = parent[name];
   std::string zret;
@@ -124,12 +124,9 @@ CB_Pre_Accept(TSCont, TSEvent event, void *edata)
   IpAddr ip_client(TSNetVConnRemoteAddrGet(ssl_vc));
   char buff2[INET6_ADDRSTRLEN];
 
-  TSDebug("skh", "Pre accept callback %p - event is %s, target address %s, client address %s"
-          , ssl_vc
-          , event == TS_EVENT_VCONN_PRE_ACCEPT ? "good" : "bad"
-          , ip.toString(buff, sizeof(buff))
-          , ip_client.toString(buff2, sizeof(buff2))
-    );
+  TSDebug("skh", "Pre accept callback %p - event is %s, target address %s, client address %s", ssl_vc,
+          event == TS_EVENT_VCONN_PRE_ACCEPT ? "good" : "bad", ip.toString(buff, sizeof(buff)),
+          ip_client.toString(buff2, sizeof(buff2)));
 
   // Not the worlds most efficient address comparison.  For short lists
   // shouldn't be too bad.  If the client IP is in any of the ranges,
@@ -163,18 +160,16 @@ TSPluginInit(int argc, const char *argv[])
   bool success = false;
   TSPluginRegistrationInfo info;
   TSCont cb_pa = 0; // pre-accept callback continuation
-  static const struct option longopt[] = {
-    { const_cast<char *>("config"), required_argument, NULL, 'c' },
-    { NULL, no_argument, NULL, '\0' }
-  };
+  static const struct option longopt[] = {{const_cast<char *>("config"), required_argument, NULL, 'c'},
+                                          {NULL, no_argument, NULL, '\0'}};
 
-  info.plugin_name = const_cast<char*>("SSL Preaccept test");
-  info.vendor_name = const_cast<char*>("Network Geographics");
-  info.support_email = const_cast<char*>("shinrich@network-geographics.com");
+  info.plugin_name = const_cast<char *>("SSL Preaccept test");
+  info.vendor_name = const_cast<char *>("Network Geographics");
+  info.support_email = const_cast<char *>("shinrich@network-geographics.com");
 
   int opt = 0;
   while (opt >= 0) {
-    opt = getopt_long(argc, (char * const *)argv, "c:", longopt, NULL);
+    opt = getopt_long(argc, (char *const *)argv, "c:", longopt, NULL);
     switch (opt) {
     case 'c':
       ConfigPath = optarg;
@@ -183,7 +178,7 @@ TSPluginInit(int argc, const char *argv[])
     }
   }
   if (ConfigPath.length() == 0) {
-    static char const * const DEFAULT_CONFIG_PATH = "ssl_preaccept.config";
+    static char const *const DEFAULT_CONFIG_PATH = "ssl_preaccept.config";
     ConfigPath = std::string(TSConfigDirGet()) + '/' + std::string(DEFAULT_CONFIG_PATH);
     TSDebug(PN, "No config path set in arguments, using default: %s", DEFAULT_CONFIG_PATH);
   }
@@ -208,4 +203,3 @@ TSPluginInit(int argc, const char *argv[])
 
   return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/ssl-sni-whitelist/ssl-sni-whitelist.cc
----------------------------------------------------------------------
diff --git a/example/ssl-sni-whitelist/ssl-sni-whitelist.cc b/example/ssl-sni-whitelist/ssl-sni-whitelist.cc
index b213e8a..f7f0115 100644
--- a/example/ssl-sni-whitelist/ssl-sni-whitelist.cc
+++ b/example/ssl-sni-whitelist/ssl-sni-whitelist.cc
@@ -23,28 +23,28 @@
   limitations under the License.
  */
 
-# include <stdio.h>
-# include <memory.h>
-# include <inttypes.h>
-# include <ts/ts.h>
-# include <ink_config.h>
-# include <tsconfig/TsValue.h>
-# include <openssl/ssl.h>
-# include <getopt.h>
+#include <stdio.h>
+#include <memory.h>
+#include <inttypes.h>
+#include <ts/ts.h>
+#include <ink_config.h>
+#include <tsconfig/TsValue.h>
+#include <openssl/ssl.h>
+#include <getopt.h>
 
 using ts::config::Configuration;
 using ts::config::Value;
 
-# define PN "ssl-sni-whitelist"
-# define PCP "[" PN " Plugin] "
+#define PN "ssl-sni-whitelist"
+#define PCP "[" PN " Plugin] "
 
-# if TS_USE_TLS_SNI
-
-namespace {
+#if TS_USE_TLS_SNI
 
+namespace
+{
 std::string ConfigPath;
 
-Configuration Config;	// global configuration
+Configuration Config; // global configuration
 
 int
 Load_Config_File()
@@ -108,18 +108,16 @@ TSPluginInit(int argc, const char *argv[])
   bool success = false;
   TSPluginRegistrationInfo info;
   TSCont cb_sni = 0; // sni callback continuation
-  static const struct option longopt[] = {
-    { const_cast<char *>("config"), required_argument, NULL, 'c' },
-    { NULL, no_argument, NULL, '\0' }
-  };
+  static const struct option longopt[] = {{const_cast<char *>("config"), required_argument, NULL, 'c'},
+                                          {NULL, no_argument, NULL, '\0'}};
 
-  info.plugin_name = const_cast<char*>("SSL SNI whitelist");
-  info.vendor_name = const_cast<char*>("Network Geographics");
-  info.support_email = const_cast<char*>("shinrich@network-geographics.com");
+  info.plugin_name = const_cast<char *>("SSL SNI whitelist");
+  info.vendor_name = const_cast<char *>("Network Geographics");
+  info.support_email = const_cast<char *>("shinrich@network-geographics.com");
 
   int opt = 0;
   while (opt >= 0) {
-    opt = getopt_long(argc, (char * const *)argv, "c:", longopt, NULL);
+    opt = getopt_long(argc, (char *const *)argv, "c:", longopt, NULL);
     switch (opt) {
     case 'c':
       ConfigPath = optarg;
@@ -128,7 +126,7 @@ TSPluginInit(int argc, const char *argv[])
     }
   }
   if (ConfigPath.length() == 0) {
-    static char const * const DEFAULT_CONFIG_PATH = "ssl_sni_whitelist.config";
+    static char const *const DEFAULT_CONFIG_PATH = "ssl_sni_whitelist.config";
     ConfigPath = std::string(TSConfigDirGet()) + '/' + std::string(DEFAULT_CONFIG_PATH);
     TSDebug(PN, "No config path set in arguments, using default: %s", DEFAULT_CONFIG_PATH);
   }
@@ -154,12 +152,12 @@ TSPluginInit(int argc, const char *argv[])
   return;
 }
 
-# else // ! TS_USE_TLS_SNI
+#else // ! TS_USE_TLS_SNI
 
 void
 TSPluginInit(int, const char *[])
 {
-    TSError(PCP "requires TLS SNI which is not available.");
+  TSError(PCP "requires TLS SNI which is not available.");
 }
 
-# endif // TS_USE_TLS_SNI
+#endif // TS_USE_TLS_SNI

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/ssl-sni/ssl-sni.cc
----------------------------------------------------------------------
diff --git a/example/ssl-sni/ssl-sni.cc b/example/ssl-sni/ssl-sni.cc
index df9d840..1c47921 100644
--- a/example/ssl-sni/ssl-sni.cc
+++ b/example/ssl-sni/ssl-sni.cc
@@ -26,28 +26,28 @@
  */
 
 
-# include <stdio.h>
-# include <memory.h>
-# include <inttypes.h>
-# include <ts/ts.h>
-# include <ink_config.h>
-# include <tsconfig/TsValue.h>
-# include <openssl/ssl.h>
-# include <getopt.h>
+#include <stdio.h>
+#include <memory.h>
+#include <inttypes.h>
+#include <ts/ts.h>
+#include <ink_config.h>
+#include <tsconfig/TsValue.h>
+#include <openssl/ssl.h>
+#include <getopt.h>
 
 using ts::config::Configuration;
 using ts::config::Value;
 
-# define PN "ssl-sni-test"
-# define PCP "[" PN " Plugin] "
+#define PN "ssl-sni-test"
+#define PCP "[" PN " Plugin] "
 
-# if TS_USE_TLS_SNI
-
-namespace {
+#if TS_USE_TLS_SNI
 
+namespace
+{
 std::string ConfigPath;
 
-Configuration Config;	// global configuration
+Configuration Config; // global configuration
 
 int
 Load_Config_File()
@@ -131,18 +131,16 @@ TSPluginInit(int argc, const char *argv[])
   bool success = false;
   TSPluginRegistrationInfo info;
   TSCont cb_cert = 0; // Certificate callback continuation
-  static const struct option longopt[] = {
-    { const_cast<char *>("config"), required_argument, NULL, 'c' },
-    { NULL, no_argument, NULL, '\0' }
-  };
+  static const struct option longopt[] = {{const_cast<char *>("config"), required_argument, NULL, 'c'},
+                                          {NULL, no_argument, NULL, '\0'}};
 
-  info.plugin_name = const_cast<char*>("SSL SNI callback test");
-  info.vendor_name = const_cast<char*>("Network Geographics");
-  info.support_email = const_cast<char*>("shinrich@network-geographics.com");
+  info.plugin_name = const_cast<char *>("SSL SNI callback test");
+  info.vendor_name = const_cast<char *>("Network Geographics");
+  info.support_email = const_cast<char *>("shinrich@network-geographics.com");
 
   int opt = 0;
   while (opt >= 0) {
-    opt = getopt_long(argc, (char * const *)argv, "c:", longopt, NULL);
+    opt = getopt_long(argc, (char *const *)argv, "c:", longopt, NULL);
     switch (opt) {
     case 'c':
       ConfigPath = optarg;
@@ -151,7 +149,7 @@ TSPluginInit(int argc, const char *argv[])
     }
   }
   if (ConfigPath.length() == 0) {
-    static char const * const DEFAULT_CONFIG_PATH = "ssl_sni.config";
+    static char const *const DEFAULT_CONFIG_PATH = "ssl_sni.config";
     ConfigPath = std::string(TSConfigDirGet()) + '/' + std::string(DEFAULT_CONFIG_PATH);
     TSDebug(PN, "No config path set in arguments, using default: %s", DEFAULT_CONFIG_PATH);
   }
@@ -177,12 +175,12 @@ TSPluginInit(int argc, const char *argv[])
   return;
 }
 
-# else // ! TS_USE_TLS_SNI
+#else // ! TS_USE_TLS_SNI
 
 void
 TSPluginInit(int, const char *[])
 {
-    TSError(PCP "requires TLS SNI which is not available.");
+  TSError(PCP "requires TLS SNI which is not available.");
 }
 
-# endif // TS_USE_TLS_SNI
+#endif // TS_USE_TLS_SNI

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/thread-1/thread-1.c
----------------------------------------------------------------------
diff --git a/example/thread-1/thread-1.c b/example/thread-1/thread-1.c
index 5af7531..a504acf 100644
--- a/example/thread-1/thread-1.c
+++ b/example/thread-1/thread-1.c
@@ -40,7 +40,7 @@
 static void *
 reenable_txn(void *data)
 {
-  TSHttpTxn txnp = (TSHttpTxn) data;
+  TSHttpTxn txnp = (TSHttpTxn)data;
   TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return NULL;
 }
@@ -50,10 +50,10 @@ thread_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
   switch (event) {
   case TS_EVENT_HTTP_OS_DNS:
-      /**
-       * Check if the thread has been created successfully or not.
-       * If the thread has not been created successfully, assert.
-       */
+    /**
+     * Check if the thread has been created successfully or not.
+     * If the thread has not been created successfully, assert.
+     */
     if (!TSThreadCreate(reenable_txn, edata)) {
       TSReleaseAssert(!"Failure in thread creation");
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/thread-pool/include/gen.c
----------------------------------------------------------------------
diff --git a/example/thread-pool/include/gen.c b/example/thread-pool/include/gen.c
index a4ec4e5..c4df4c4 100644
--- a/example/thread-pool/include/gen.c
+++ b/example/thread-pool/include/gen.c
@@ -36,5 +36,4 @@ main(int argc, char *argv[])
   for (i = 0; i < atoi(argv[1]); i++) {
     printf("%d", i % 10);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/thread-pool/psi.c
----------------------------------------------------------------------
diff --git a/example/thread-pool/psi.c b/example/thread-pool/psi.c
index 4d115c4..4601297 100644
--- a/example/thread-pool/psi.c
+++ b/example/thread-pool/psi.c
@@ -63,33 +63,30 @@
 
 
 #define PSI_FILENAME_MAX_SIZE 512
-#define PSI_PATH_MAX_SIZE     256
+#define PSI_PATH_MAX_SIZE 256
 #define PSI_PATH "include"
 
-#define PSI_START_TAG      "<!--include="
-#define PSI_START_TAG_LEN  12
+#define PSI_START_TAG "<!--include="
+#define PSI_START_TAG_LEN 12
 
-#define PSI_END_TAG        "-->"
-#define PSI_END_TAG_LEN    3
+#define PSI_END_TAG "-->"
+#define PSI_END_TAG_LEN 3
 
 #define MIME_FIELD_XPSI "X-Psi"
 
-typedef enum
-{
+typedef enum {
   STATE_READ_DATA = 1,
   STATE_READ_PSI = 2,
-  STATE_DUMP_PSI = 3
+  STATE_DUMP_PSI = 3,
 } PluginState;
 
-typedef enum
-{
+typedef enum {
   PARSE_SEARCH,
   PARSE_EXTRACT,
 } ParseState;
 
 
-typedef struct
-{
+typedef struct {
   unsigned int magic;
   TSVIO output_vio;
   TSIOBuffer output_buffer;
@@ -108,18 +105,16 @@ typedef struct
 } ContData;
 
 
-typedef struct
-{
+typedef struct {
   TSCont contp;
   TSEvent event;
 } TryLockData;
 
 
-typedef enum
-{
+typedef enum {
   STR_SUCCESS,
   STR_PARTIAL,
-  STR_FAIL
+  STR_FAIL,
 } StrOperationResult;
 
 
@@ -145,7 +140,7 @@ cont_data_alloc()
 {
   ContData *data;
 
-  data = (ContData *) TSmalloc(sizeof(ContData));
+  data = (ContData *)TSmalloc(sizeof(ContData));
   data->magic = MAGIC_ALIVE;
   data->output_vio = NULL;
   data->output_buffer = NULL;
@@ -177,7 +172,7 @@ cont_data_alloc()
     none
   -------------------------------------------------------------------------*/
 static void
-cont_data_destroy(ContData * data)
+cont_data_destroy(ContData *data)
 {
   TSDebug(DBG_TAG, "Destroying continuation data");
   if (data) {
@@ -253,7 +248,7 @@ strsearch_ioreader(TSIOBufferReader reader, const char *pattern, int *nparse)
     block = TSIOBufferBlockNext(block);
   }
 
-  *nparse -= index;             /* Adjust nparse so it doesn't include matching chars */
+  *nparse -= index; /* Adjust nparse so it doesn't include matching chars */
   if (index == slen) {
     TSDebug(DBG_TAG, "strfind: match for %s at position %d", pattern, *nparse);
     return STR_SUCCESS;
@@ -306,7 +301,6 @@ strextract_ioreader(TSIOBufferReader reader, int offset, const char *end_pattern
 
     for (ptr = blockptr; ptr < blockptr + blocklen; ptr++, nbytes_so_far++) {
       if (nbytes_so_far >= offset) {
-
         /* Add a new character to the filename */
         buffer[buf_idx++] = *ptr;
 
@@ -381,7 +375,6 @@ parse_data(TSCont contp, TSIOBufferReader input_reader, int avail, int *toconsum
   TSAssert(data->magic == MAGIC_ALIVE);
 
   if (data->parse_state == PARSE_SEARCH) {
-
     /* Search for the start pattern */
     status = strsearch_ioreader(input_reader, PSI_START_TAG, &nparse);
     switch (status) {
@@ -410,8 +403,7 @@ parse_data(TSCont contp, TSIOBufferReader input_reader, int avail, int *toconsum
 
 
   /* And now let's extract the filename */
-  status = strextract_ioreader(input_reader, nparse + PSI_START_TAG_LEN,
-                               PSI_END_TAG, data->psi_filename, &data->psi_filename_len);
+  status = strextract_ioreader(input_reader, nparse + PSI_START_TAG_LEN, PSI_END_TAG, data->psi_filename, &data->psi_filename_len);
   switch (status) {
   case STR_FAIL:
     /* We couldn't extract a valid filename */
@@ -438,7 +430,7 @@ parse_data(TSCont contp, TSIOBufferReader input_reader, int avail, int *toconsum
   return 0;
 }
 
-//TODO: Use libc basename function
+// TODO: Use libc basename function
 //
 /*-------------------------------------------------------------------------
   strip_path
@@ -456,7 +448,7 @@ _basename(const char *filename)
   char *cptr;
   const char *ptr = filename;
 
-  while ((cptr = strchr(ptr, (int) '/')) != NULL) {
+  while ((cptr = strchr(ptr, (int)'/')) != NULL) {
     ptr = cptr + 1;
   }
   return ptr;
@@ -650,7 +642,6 @@ handle_transform(TSCont contp)
 
     /* There are some data available for reading. Let's parse it */
     if (avail > 0) {
-
       /* No need to parse data if there are too few bytes left to contain
          an include command... */
       if (toread > (PSI_START_TAG_LEN + PSI_END_TAG_LEN)) {
@@ -724,7 +715,7 @@ dump_psi(TSCont contp)
   ContData *data;
   int psi_output_len;
 
-  /* TODO: This is odd, do we need to get the input_vio, but never use it ?? */
+/* TODO: This is odd, do we need to get the input_vio, but never use it ?? */
 #if 0
   TSVIO input_vio;
   input_vio = TSVConnWriteVIOGet(contp);
@@ -967,7 +958,7 @@ transform_add(TSHttpTxn txnp)
 static int
 read_response_handler(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_RESPONSE_HDR:
@@ -1025,9 +1016,9 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
   init_queue(&job_queue);
 
   for (i = 0; i < NB_THREADS; i++) {
-    char *thread_name = (char *) TSmalloc(64);
+    char *thread_name = (char *)TSmalloc(64);
     sprintf(thread_name, "Thread[%d]", i);
-    if (!TSThreadCreate((TSThreadFunc) thread_loop, thread_name)) {
+    if (!TSThreadCreate((TSThreadFunc)thread_loop, thread_name)) {
       TSError("[TSPluginInit] Error while creating threads");
       return;
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/thread-pool/test/SDKTest/psi_server.c
----------------------------------------------------------------------
diff --git a/example/thread-pool/test/SDKTest/psi_server.c b/example/thread-pool/test/SDKTest/psi_server.c
index e2b06d6..15f4c6b 100644
--- a/example/thread-pool/test/SDKTest/psi_server.c
+++ b/example/thread-pool/test/SDKTest/psi_server.c
@@ -40,7 +40,7 @@
 #include <stdlib.h>
 #include "ServerAPI.h"
 
-#define PSI_TAG_FORMAT  "<!--include=file%d.txt-->"
+#define PSI_TAG_FORMAT "<!--include=file%d.txt-->"
 #define PSI_TAG_MAX_SIZE 128
 #define PSI_MIME_HEADER "X-Psi: true"
 
@@ -48,19 +48,17 @@
 #define TRUE 1
 #define FALSE 0
 
-typedef struct
-{
+typedef struct {
   int status_code;
   long request_length;
   long bytes_not_sent;
   char header_response[MAX_HEADER_RESPONSE];
-  int done_sent_header;         /* flag to see if header has been sent or not */
+  int done_sent_header; /* flag to see if header has been sent or not */
   int psi;
 } RequestInfo;
 
-typedef struct
-{
-  double psi_ratio;             /* for psi_ratio */
+typedef struct {
+  double psi_ratio; /* for psi_ratio */
 } SCPlugin;
 
 SCPlugin my_plugin;
@@ -84,7 +82,7 @@ TSOptionsProcess(char *option, char *value)
 {
   if (strcmp(option, "psi_ratio") == 0) {
     fprintf(stderr, "psi ratio set to %d %%\n", atoi(value));
-    my_plugin.psi_ratio = (double) (atoi(value)) / 100.0;
+    my_plugin.psi_ratio = (double)(atoi(value)) / 100.0;
   }
 }
 
@@ -103,7 +101,7 @@ int
 TSResponsePrepare(char *req_hdr, int req_len, void **response_id)
 {
   char *len_string;
-  RequestInfo *resp_id = (RequestInfo *) malloc(sizeof(RequestInfo));
+  RequestInfo *resp_id = (RequestInfo *)malloc(sizeof(RequestInfo));
 
   resp_id->psi = generate_psibility();
 
@@ -115,12 +113,11 @@ TSResponsePrepare(char *req_hdr, int req_len, void **response_id)
     resp_id->status_code = 200;
 
     if (resp_id->psi) {
-      sprintf(resp_id->header_response, "%s\r\n%s\r\n%s%ld\r\n%s\r\n\r\n",
-              "HTTP/1.0 200 OK",
-              "Content-type: text/plain", "Content-length: ", resp_id->request_length, PSI_MIME_HEADER);
+      sprintf(resp_id->header_response, "%s\r\n%s\r\n%s%ld\r\n%s\r\n\r\n", "HTTP/1.0 200 OK", "Content-type: text/plain",
+              "Content-length: ", resp_id->request_length, PSI_MIME_HEADER);
     } else {
-      sprintf(resp_id->header_response, "%s\r\n%s\r\n%s%ld\r\n\r\n",
-              "HTTP/1.0 200 OK", "Content-type: text/plain", "Content-length: ", resp_id->request_length);
+      sprintf(resp_id->header_response, "%s\r\n%s\r\n%s%ld\r\n\r\n", "HTTP/1.0 200 OK", "Content-type: text/plain",
+              "Content-length: ", resp_id->request_length);
     }
   } else {
     resp_id->request_length = -1;
@@ -134,20 +131,18 @@ TSResponsePrepare(char *req_hdr, int req_len, void **response_id)
 
 /* put response (response header + response document) into buffer */
 void
-TSResponsePut(void **resp_id /* return */ ,
-               void *resp_buffer /* return */ ,
-               int *resp_bytes /* return */ ,
-               int resp_buffer_size, int bytes_last_response)
+TSResponsePut(void **resp_id /* return */, void *resp_buffer /* return */, int *resp_bytes /* return */, int resp_buffer_size,
+              int bytes_last_response)
 {
   int i = 0;
-  RequestInfo *rid = *((RequestInfo **) resp_id);
+  RequestInfo *rid = *((RequestInfo **)resp_id);
   int psi = 0;
   int len;
   char psi_tag[PSI_TAG_MAX_SIZE];
 
   /* copy the header into the response buffer */
   if (!rid->done_sent_header) {
-    i = sprintf((char *) resp_buffer, "%s", rid->header_response);
+    i = sprintf((char *)resp_buffer, "%s", rid->header_response);
     rid->done_sent_header = TRUE;
   }
 
@@ -162,7 +157,7 @@ TSResponsePut(void **resp_id /* return */ ,
   if (rid->status_code == 200) {
     /* buffer is not large enough to handle all content */
     if (rid->bytes_not_sent + i > resp_buffer_size) {
-      memset((void *) ((char *) resp_buffer + i), 'X', resp_buffer_size - i);
+      memset((void *)((char *)resp_buffer + i), 'X', resp_buffer_size - i);
       *resp_bytes = resp_buffer_size;
       rid->bytes_not_sent -= (resp_buffer_size - i);
     }
@@ -174,22 +169,21 @@ TSResponsePut(void **resp_id /* return */ ,
 
         /* hopefully enough space for our include command */
         if (rid->bytes_not_sent >= len) {
-          memcpy((void *) ((char *) resp_buffer + i), psi_tag, len);
+          memcpy((void *)((char *)resp_buffer + i), psi_tag, len);
           rid->bytes_not_sent -= len;
           i += len;
         }
       }
-      memset((void *) ((char *) resp_buffer + i), 'X', rid->bytes_not_sent);
-      memset((void *) ((char *) resp_buffer + i + rid->bytes_not_sent - 1), 'E', 1);
+      memset((void *)((char *)resp_buffer + i), 'X', rid->bytes_not_sent);
+      memset((void *)((char *)resp_buffer + i + rid->bytes_not_sent - 1), 'E', 1);
       *resp_bytes = rid->bytes_not_sent + i;
       rid->bytes_not_sent = 0;
-
     }
   }
   /* return NULL as the resp_id to indicate
    * if it is the last TSResponsePut call */
   if (rid->bytes_not_sent <= 0 || rid->status_code != 200) {
     free(rid);
-    *((RequestInfo **) resp_id) = NULL;
+    *((RequestInfo **)resp_id) = NULL;
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/thread-pool/thread.c
----------------------------------------------------------------------
diff --git a/example/thread-pool/thread.c b/example/thread-pool/thread.c
index 9e49002..702676f 100644
--- a/example/thread-pool/thread.c
+++ b/example/thread-pool/thread.c
@@ -22,7 +22,6 @@
  */
 
 
-
 #include <stdio.h>
 #include <pthread.h>
 #include "ts/ts.h"
@@ -30,7 +29,7 @@
 #include "thread.h"
 #include "ink_defs.h"
 
-#define DBGTAG  "xthread"
+#define DBGTAG "xthread"
 
 struct timespec tp1;
 struct timespec tp2;
@@ -42,16 +41,16 @@ static pthread_mutex_t cond_mutex;
 
 
 void
-init_queue(Queue * q)
+init_queue(Queue *q)
 {
-  q->head = NULL;               /* Pointer on head cell */
-  q->tail = NULL;               /* Pointer on tail cell */
-  q->nb_elem = 0;               /* Nb elem in the queue */
+  q->head = NULL; /* Pointer on head cell */
+  q->tail = NULL; /* Pointer on tail cell */
+  q->nb_elem = 0; /* Nb elem in the queue */
   q->mutex = TSMutexCreate();
 }
 
 void
-add_to_queue(Queue * q, void *data)
+add_to_queue(Queue *q, void *data)
 {
   Cell *new_cell;
   int n;
@@ -86,14 +85,13 @@ add_to_queue(Queue * q, void *data)
 }
 
 void *
-remove_from_queue(Queue * q)
+remove_from_queue(Queue *q)
 {
   void *data = NULL;
   Cell *remove_cell;
 
   TSMutexLock(q->mutex);
   if (q->nb_elem > 0) {
-
     remove_cell = q->head;
     TSAssert(remove_cell->magic == MAGIC_ALIVE);
 
@@ -110,14 +108,13 @@ remove_from_queue(Queue * q)
     remove_cell->magic = MAGIC_DEAD;
     TSfree(remove_cell);
     q->nb_elem--;
-
   }
   TSMutexUnlock(q->mutex);
   return data;
 }
 
 int
-get_nbelem_queue(Queue * q)
+get_nbelem_queue(Queue *q)
 {
   int nb;
   TSMutexLock(q->mutex);
@@ -141,7 +138,7 @@ job_create(TSCont contp, ExecFunc func, void *data)
 }
 
 void
-job_delete(Job * job)
+job_delete(Job *job)
 {
   job->magic = MAGIC_DEAD;
   TSfree(job);
@@ -187,4 +184,3 @@ thread_loop(void *arg ATS_UNUSED)
     }
   }
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/thread-pool/thread.h
----------------------------------------------------------------------
diff --git a/example/thread-pool/thread.h b/example/thread-pool/thread.h
index b6f5900..fe127a8 100644
--- a/example/thread-pool/thread.h
+++ b/example/thread-pool/thread.h
@@ -22,31 +22,28 @@
  */
 
 
-
 #ifndef _THREAD_H_
 #define _THREAD_H_
 
 #define MAGIC_ALIVE 0xfeedbabe
-#define MAGIC_DEAD  0xdeadbeef
+#define MAGIC_DEAD 0xdeadbeef
 
 /* If more than MAX_JOBS_ALARM are present in queue, the plugin
    will log error messages. This should be tuned based on your application */
 #define MAX_JOBS_ALARM 1000
 
-typedef int (*ExecFunc) (TSCont, void *);
+typedef int (*ExecFunc)(TSCont, void *);
 
 /* Structure that contains all information for a job execution */
-typedef struct
-{
+typedef struct {
   unsigned int magic;
-  TSCont cont;                 /* Continuation to call once job is done */
-  ExecFunc func;                /* Job function */
-  void *data;                   /* Any data to pass to the job function */
+  TSCont cont;   /* Continuation to call once job is done */
+  ExecFunc func; /* Job function */
+  void *data;    /* Any data to pass to the job function */
 } Job;
 
 /* Implementation of the queue for jobs */
-struct cell_rec
-{
+struct cell_rec {
   unsigned int magic;
   void *ptr_data;
   struct cell_rec *ptr_next;
@@ -54,8 +51,7 @@ struct cell_rec
 };
 typedef struct cell_rec Cell;
 
-typedef struct
-{
+typedef struct {
   Cell *head;
   Cell *tail;
   int nb_elem;
@@ -64,19 +60,19 @@ typedef struct
 
 
 /* queue manipulation functions */
-void init_queue(Queue * q);
+void init_queue(Queue *q);
 
-void add_to_queue(Queue * q, void *data);
+void add_to_queue(Queue *q, void *data);
 
-void *remove_from_queue(Queue * q);
+void *remove_from_queue(Queue *q);
 
-int get_nbelem_queue(Queue * q);
+int get_nbelem_queue(Queue *q);
 
 
 /* Job functions */
 Job *job_create(TSCont contp, ExecFunc func, void *data);
 
-void job_delete(Job * job);
+void job_delete(Job *job);
 
 
 /* thread functions */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/version/version.c
----------------------------------------------------------------------
diff --git a/example/version/version.c b/example/version/version.c
index 71aa15e..77c824b 100644
--- a/example/version/version.c
+++ b/example/version/version.c
@@ -53,7 +53,7 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
   info.vendor_name = "MyCompany";
   info.support_email = "ts-api-support@MyCompany.com";
 
-  // partial compilation
+// partial compilation
 #if (TS_VERSION_NUMBER < 3000000)
   if (TSPluginRegister(TS_SDK_VERSION_2_0, &info) != TS_SUCCESS) {
 #else
@@ -62,6 +62,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed. \n");
   }
 
-  TSDebug("debug-version-plugin", "Running in Apache Traffic Server: v%d.%d.%d\n", major_ts_version, minor_ts_version, patch_ts_version);
+  TSDebug("debug-version-plugin", "Running in Apache Traffic Server: v%d.%d.%d\n", major_ts_version, minor_ts_version,
+          patch_ts_version);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/aio/AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index 877bc61..4dd1842 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -28,7 +28,7 @@
 #include "P_AIO.h"
 
 #if AIO_MODE == AIO_MODE_NATIVE
-#define AIO_PERIOD                                -HRTIME_MSECONDS(10)
+#define AIO_PERIOD -HRTIME_MSECONDS(10)
 #else
 
 #define MAX_DISKS_POSSIBLE 100
@@ -65,8 +65,8 @@ uint64_t aio_bytes_written = 0;
 static int
 aio_stats_cb(const char * /* name ATS_UNUSED */, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id)
 {
-  (void) data_type;
-  (void) rsb;
+  (void)data_type;
+  (void)rsb;
   int64_t new_val = 0;
   int64_t diff = 0;
   int64_t count, sum;
@@ -102,7 +102,7 @@ aio_stats_cb(const char * /* name ATS_UNUSED */, RecDataT data_type, RecData *da
   diff = new_val - sum;
   RecSetGlobalRawStatSum(aio_rsb, id, new_val);
   RecSetGlobalRawStatCount(aio_rsb, id, now);
-  data->rec_float = (float) diff *1000.00 / (float) time_diff;
+  data->rec_float = (float)diff * 1000.00 / (float)time_diff;
   return 0;
 }
 
@@ -117,8 +117,8 @@ int
 AIOTestData::ink_aio_stats(int event, void *d)
 {
   ink_hrtime now = ink_get_hrtime();
-  double time_msec = (double) (now - start) / (double) HRTIME_MSECOND;
-  int i = (aio_reqs[0] == NULL)? 1 : 0;
+  double time_msec = (double)(now - start) / (double)HRTIME_MSECOND;
+  int i = (aio_reqs[0] == NULL) ? 1 : 0;
   for (; i < num_filedes; ++i)
     printf("%0.2f\t%i\t%i\t%i\n", time_msec, aio_reqs[i]->filedes, aio_reqs[i]->pending, aio_reqs[i]->queued);
   printf("Num Requests: %i Num Queued: %i num Moved: %i\n\n", data->num_req, data->num_queue, data->num_temp);
@@ -148,17 +148,15 @@ ink_aio_init(ModuleVersion v)
 {
   ink_release_assert(!checkModuleVersion(v, AIO_MODULE_VERSION));
 
-  aio_rsb = RecAllocateRawStatBlock((int) AIO_STAT_COUNT);
-  RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.cache.read_per_sec",
-                     RECD_FLOAT, RECP_PERSISTENT, (int) AIO_STAT_READ_PER_SEC, aio_stats_cb);
-  RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.cache.write_per_sec",
-                     RECD_FLOAT, RECP_PERSISTENT, (int) AIO_STAT_WRITE_PER_SEC, aio_stats_cb);
-  RecRegisterRawStat(aio_rsb, RECT_PROCESS,
-                     "proxy.process.cache.KB_read_per_sec",
-                     RECD_FLOAT, RECP_PERSISTENT, (int) AIO_STAT_KB_READ_PER_SEC, aio_stats_cb);
-  RecRegisterRawStat(aio_rsb, RECT_PROCESS,
-                     "proxy.process.cache.KB_write_per_sec",
-                     RECD_FLOAT, RECP_PERSISTENT, (int) AIO_STAT_KB_WRITE_PER_SEC, aio_stats_cb);
+  aio_rsb = RecAllocateRawStatBlock((int)AIO_STAT_COUNT);
+  RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.cache.read_per_sec", RECD_FLOAT, RECP_PERSISTENT,
+                     (int)AIO_STAT_READ_PER_SEC, aio_stats_cb);
+  RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.cache.write_per_sec", RECD_FLOAT, RECP_PERSISTENT,
+                     (int)AIO_STAT_WRITE_PER_SEC, aio_stats_cb);
+  RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.cache.KB_read_per_sec", RECD_FLOAT, RECP_PERSISTENT,
+                     (int)AIO_STAT_KB_READ_PER_SEC, aio_stats_cb);
+  RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.cache.KB_write_per_sec", RECD_FLOAT, RECP_PERSISTENT,
+                     (int)AIO_STAT_KB_WRITE_PER_SEC, aio_stats_cb);
 #if AIO_MODE != AIO_MODE_NATIVE
   memset(&aio_reqs, 0, MAX_DISKS_POSSIBLE * sizeof(AIO_Reqs *));
   ink_mutex_init(&insert_mutex, NULL);
@@ -176,29 +174,27 @@ ink_aio_start()
   return 0;
 }
 
-#if  AIO_MODE != AIO_MODE_NATIVE
+#if AIO_MODE != AIO_MODE_NATIVE
 
 static void *aio_thread_main(void *arg);
 
-struct AIOThreadInfo:public Continuation
-{
-
+struct AIOThreadInfo : public Continuation {
   AIO_Reqs *req;
   int sleep_wait;
 
-  int start(int event, Event *e)
+  int
+  start(int event, Event *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     aio_thread_main(this);
     return EVENT_DONE;
   }
 
-  AIOThreadInfo(AIO_Reqs *thr_req, int sleep):Continuation(new_ProxyMutex()), req(thr_req), sleep_wait(sleep)
+  AIOThreadInfo(AIO_Reqs *thr_req, int sleep) : Continuation(new_ProxyMutex()), req(thr_req), sleep_wait(sleep)
   {
     SET_HANDLER(&AIOThreadInfo::start);
   }
-
 };
 
 /* priority scheduling */
@@ -227,7 +223,7 @@ aio_init_fildes(int fildes, int fromAPI = 0)
 
   ink_cond_init(&request->aio_cond);
   ink_mutex_init(&request->aio_mutex, NULL);
-  ink_atomiclist_init(&request->aio_temp_list, "temp_list", (uintptr_t) &((AIOCallback *) 0)->link);
+  ink_atomiclist_init(&request->aio_temp_list, "temp_list", (uintptr_t) & ((AIOCallback *)0)->link);
 
   RecInt thread_num;
 
@@ -275,18 +271,17 @@ aio_insert(AIOCallback *op, AIO_Reqs *req)
   num_requests++;
   req->queued++;
 #endif
-  if (op->aiocb.aio_reqprio == AIO_LOWEST_PRIORITY)     // http request
+  if (op->aiocb.aio_reqprio == AIO_LOWEST_PRIORITY) // http request
   {
-    AIOCallback *cb = (AIOCallback *) req->http_aio_todo.tail;
+    AIOCallback *cb = (AIOCallback *)req->http_aio_todo.tail;
     if (!cb)
       req->http_aio_todo.push(op);
     else
       req->http_aio_todo.insert(op, cb);
   } else {
+    AIOCallback *cb = (AIOCallback *)req->aio_todo.tail;
 
-    AIOCallback *cb = (AIOCallback *) req->aio_todo.tail;
-
-    for (; cb; cb = (AIOCallback *) cb->link.prev) {
+    for (; cb; cb = (AIOCallback *)cb->link.prev) {
       if (cb->aiocb.aio_reqprio >= op->aiocb.aio_reqprio) {
         req->aio_todo.insert(op, cb);
         return;
@@ -302,12 +297,12 @@ aio_insert(AIOCallback *op, AIO_Reqs *req)
 static void
 aio_move(AIO_Reqs *req)
 {
-  AIOCallback *next = NULL, *prev = NULL, *cb = (AIOCallback *) ink_atomiclist_popall(&req->aio_temp_list);
+  AIOCallback *next = NULL, *prev = NULL, *cb = (AIOCallback *)ink_atomiclist_popall(&req->aio_temp_list);
   /* flip the list */
   if (!cb)
     return;
   while (cb->link.next) {
-    next = (AIOCallback *) cb->link.next;
+    next = (AIOCallback *)cb->link.next;
     cb->link.next = prev;
     prev = cb;
     cb = next;
@@ -315,7 +310,7 @@ aio_move(AIO_Reqs *req)
   /* fix the last pointer */
   cb->link.next = prev;
   for (; cb; cb = next) {
-    next = (AIOCallback *) cb->link.next;
+    next = (AIOCallback *)cb->link.next;
     cb->link.next = NULL;
     cb->link.prev = NULL;
     aio_insert(cb, req);
@@ -328,10 +323,11 @@ aio_queue_req(AIOCallbackInternal *op, int fromAPI = 0)
 {
   int thread_ndx = 1;
   AIO_Reqs *req = op->aio_req;
-  op->link.next = NULL;;
+  op->link.next = NULL;
+  ;
   op->link.prev = NULL;
 #ifdef AIO_STATS
-  ink_atomic_increment((int *) &data->num_req, 1);
+  ink_atomic_increment((int *)&data->num_req, 1);
 #endif
   if (!fromAPI && (!req || req->filedes != op->aiocb.aio_fildes)) {
     /* search for the matching file descriptor */
@@ -382,7 +378,7 @@ aio_queue_req(AIOCallbackInternal *op, int fromAPI = 0)
 #endif
     ink_atomiclist_push(&req->aio_temp_list, op);
   } else {
-    /* check if any pending requests on the atomic list */
+/* check if any pending requests on the atomic list */
 #ifdef AIO_STATS
     ink_atomic_increment(&data->num_queue, 1);
 #endif
@@ -399,27 +395,26 @@ static inline int
 cache_op(AIOCallbackInternal *op)
 {
   bool read = (op->aiocb.aio_lio_opcode == LIO_READ) ? 1 : 0;
-  for (; op; op = (AIOCallbackInternal *) op->then) {
+  for (; op; op = (AIOCallbackInternal *)op->then) {
     ink_aiocb_t *a = &op->aiocb;
     ssize_t err, res = 0;
 
     while (a->aio_nbytes - res > 0) {
       do {
         if (read)
-          err = pread(a->aio_fildes, ((char *) a->aio_buf) + res, a->aio_nbytes - res, a->aio_offset + res);
+          err = pread(a->aio_fildes, ((char *)a->aio_buf) + res, a->aio_nbytes - res, a->aio_offset + res);
         else
-          err = pwrite(a->aio_fildes, ((char *) a->aio_buf) + res, a->aio_nbytes - res, a->aio_offset + res);
+          err = pwrite(a->aio_fildes, ((char *)a->aio_buf) + res, a->aio_nbytes - res, a->aio_offset + res);
       } while ((err < 0) && (errno == EINTR || errno == ENOBUFS || errno == ENOMEM));
       if (err <= 0) {
-        Warning("cache disk operation failed %s %zd %d\n",
-                (a->aio_lio_opcode == LIO_READ) ? "READ" : "WRITE", err, errno);
+        Warning("cache disk operation failed %s %zd %d\n", (a->aio_lio_opcode == LIO_READ) ? "READ" : "WRITE", err, errno);
         op->aio_result = -errno;
         return (err);
       }
       res += err;
     }
     op->aio_result = res;
-    ink_assert(op->aio_result == (int64_t) a->aio_nbytes);
+    ink_assert(op->aio_result == (int64_t)a->aio_nbytes);
   }
   return 1;
 }
@@ -428,7 +423,7 @@ int
 ink_aio_read(AIOCallback *op, int fromAPI)
 {
   op->aiocb.aio_lio_opcode = LIO_READ;
-  aio_queue_req((AIOCallbackInternal *) op, fromAPI);
+  aio_queue_req((AIOCallbackInternal *)op, fromAPI);
 
   return 1;
 }
@@ -437,7 +432,7 @@ int
 ink_aio_write(AIOCallback *op, int fromAPI)
 {
   op->aiocb.aio_lio_opcode = LIO_WRITE;
-  aio_queue_req((AIOCallbackInternal *) op, fromAPI);
+  aio_queue_req((AIOCallbackInternal *)op, fromAPI);
 
   return 1;
 }
@@ -456,8 +451,8 @@ ink_aio_thread_num_set(int thread_num)
 void *
 aio_thread_main(void *arg)
 {
-  AIOThreadInfo *thr_info = (AIOThreadInfo *) arg;
-  AIO_Reqs *my_aio_req = (AIO_Reqs *) thr_info->req;
+  AIOThreadInfo *thr_info = (AIOThreadInfo *)arg;
+  AIO_Reqs *my_aio_req = (AIO_Reqs *)thr_info->req;
   AIO_Reqs *current_req = NULL;
   AIOCallback *op = NULL;
   ink_mutex_acquire(&my_aio_req->aio_mutex);
@@ -472,7 +467,7 @@ aio_thread_main(void *arg)
 #ifdef AIO_STATS
       num_requests--;
       current_req->queued--;
-      ink_atomic_increment((int *) &current_req->pending, 1);
+      ink_atomic_increment((int *)&current_req->pending, 1);
 #endif
       // update the stats;
       if (op->aiocb.aio_lio_opcode == LIO_WRITE) {
@@ -483,7 +478,7 @@ aio_thread_main(void *arg)
         aio_bytes_read += op->aiocb.aio_nbytes;
       }
       ink_mutex_release(&current_req->aio_mutex);
-      if (cache_op((AIOCallbackInternal *) op) <= 0) {
+      if (cache_op((AIOCallbackInternal *)op) <= 0) {
         if (aio_err_callbck) {
           AIOCallback *callback_op = new AIOCallbackInternal();
           callback_op->aiocb.aio_fildes = op->aiocb.aio_fildes;
@@ -492,9 +487,9 @@ aio_thread_main(void *arg)
           eventProcessor.schedule_imm(callback_op);
         }
       }
-      ink_atomic_increment((int *) &current_req->requests_queued, -1);
+      ink_atomic_increment((int *)&current_req->requests_queued, -1);
 #ifdef AIO_STATS
-      ink_atomic_increment((int *) &current_req->pending, -1);
+      ink_atomic_increment((int *)&current_req->pending, -1);
 #endif
       op->link.prev = NULL;
       op->link.next = NULL;
@@ -516,7 +511,8 @@ aio_thread_main(void *arg)
 }
 #else
 int
-DiskHandler::startAIOEvent(int /* event ATS_UNUSED */, Event *e) {
+DiskHandler::startAIOEvent(int /* event ATS_UNUSED */, Event *e)
+{
   SET_HANDLER(&DiskHandler::mainAIOEvent);
   e->schedule_every(AIO_PERIOD);
   trigger_event = e;
@@ -524,12 +520,13 @@ DiskHandler::startAIOEvent(int /* event ATS_UNUSED */, Event *e) {
 }
 
 int
-DiskHandler::mainAIOEvent(int event, Event *e) {
+DiskHandler::mainAIOEvent(int event, Event *e)
+{
   AIOCallback *op = NULL;
 Lagain:
   int ret = io_getevents(ctx, 0, MAX_AIO_EVENTS, events, NULL);
   for (int i = 0; i < ret; i++) {
-    op = (AIOCallback *) events[i].data;
+    op = (AIOCallback *)events[i].data;
     op->aio_result = events[i].res;
     ink_assert(op->action.continuation);
     complete_list.enqueue(op);
@@ -576,7 +573,8 @@ Lagain:
 }
 
 int
-ink_aio_read(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
+ink_aio_read(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
+{
   op->aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
   op->aiocb.aio_lio_opcode = IO_CMD_PREAD;
   op->aiocb.data = op;
@@ -590,7 +588,8 @@ ink_aio_read(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
 }
 
 int
-ink_aio_write(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
+ink_aio_write(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
+{
   op->aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
   op->aiocb.aio_lio_opcode = IO_CMD_PWRITE;
   op->aiocb.data = op;
@@ -604,7 +603,8 @@ ink_aio_write(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
 }
 
 int
-ink_aio_readv(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
+ink_aio_readv(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
+{
   EThread *t = this_ethread();
   DiskHandler *dh = t->diskHandler;
   AIOCallback *io = op;
@@ -634,7 +634,8 @@ ink_aio_readv(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
 }
 
 int
-ink_aio_writev(AIOCallback *op, int /* fromAPI ATS_UNUSED */) {
+ink_aio_writev(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
+{
   EThread *t = this_ethread();
   DiskHandler *dh = t->diskHandler;
   AIOCallback *io = op;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/aio/I_AIO.h
----------------------------------------------------------------------
diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h
index 2dc864b..806962d 100644
--- a/iocore/aio/I_AIO.h
+++ b/iocore/aio/I_AIO.h
@@ -28,7 +28,7 @@
 
 
  ****************************************************************************/
-#if !defined (_I_AIO_h_)
+#if !defined(_I_AIO_h_)
 #define _I_AIO_h_
 
 #include "libts.h"
@@ -37,23 +37,21 @@
 
 #define AIO_MODULE_MAJOR_VERSION 1
 #define AIO_MODULE_MINOR_VERSION 0
-#define AIO_MODULE_VERSION       makeModuleVersion(AIO_MODULE_MAJOR_VERSION,\
-						   AIO_MODULE_MINOR_VERSION,\
-						   PUBLIC_MODULE_HEADER)
+#define AIO_MODULE_VERSION makeModuleVersion(AIO_MODULE_MAJOR_VERSION, AIO_MODULE_MINOR_VERSION, PUBLIC_MODULE_HEADER)
 
-#define AIO_EVENT_DONE           (AIO_EVENT_EVENTS_START+0)
+#define AIO_EVENT_DONE (AIO_EVENT_EVENTS_START + 0)
 
-#define AIO_MODE_THREAD          0
-#define AIO_MODE_NATIVE          1
+#define AIO_MODE_THREAD 0
+#define AIO_MODE_NATIVE 1
 
 #if TS_USE_LINUX_NATIVE_AIO
-#define AIO_MODE                 AIO_MODE_NATIVE
+#define AIO_MODE AIO_MODE_NATIVE
 #else
-#define AIO_MODE                 AIO_MODE_THREAD
+#define AIO_MODE AIO_MODE_THREAD
 #endif
 
-#define LIO_READ        0x1
-#define LIO_WRITE       0x2
+#define LIO_READ 0x1
+#define LIO_WRITE 0x2
 
 #if AIO_MODE == AIO_MODE_NATIVE
 
@@ -65,23 +63,22 @@ typedef struct iocb ink_aiocb_t;
 typedef struct io_event ink_io_event_t;
 
 // XXX hokey old-school compatibility with ink_aiocb.h ...
-#define aio_nbytes  u.c.nbytes
-#define aio_offset  u.c.offset
-#define aio_buf     u.c.buf
+#define aio_nbytes u.c.nbytes
+#define aio_offset u.c.offset
+#define aio_buf u.c.buf
 
 #else
 
-typedef struct ink_aiocb
-{
+typedef struct ink_aiocb {
   int aio_fildes;
-  volatile void *aio_buf;       /* buffer location */
-  size_t aio_nbytes;            /* length of transfer */
-  off_t aio_offset;             /* file offset */
-
-  int aio_reqprio;              /* request priority offset */
-  int aio_lio_opcode;           /* listio operation */
-  int aio_state;                /* state flag for List I/O */
-  int aio__pad[1];              /* extension padding */
+  volatile void *aio_buf; /* buffer location */
+  size_t aio_nbytes;      /* length of transfer */
+  off_t aio_offset;       /* file offset */
+
+  int aio_reqprio;    /* request priority offset */
+  int aio_lio_opcode; /* listio operation */
+  int aio_state;      /* state flag for List I/O */
+  int aio__pad[1];    /* extension padding */
 } ink_aiocb_t;
 
 bool ink_aio_thread_num_set(int thread_num);
@@ -89,14 +86,13 @@ bool ink_aio_thread_num_set(int thread_num);
 #endif
 
 // AIOCallback::thread special values
-#define AIO_CALLBACK_THREAD_ANY ((EThread*)0) // any regular event thread
-#define AIO_CALLBACK_THREAD_AIO ((EThread*)-1)
+#define AIO_CALLBACK_THREAD_ANY ((EThread *)0) // any regular event thread
+#define AIO_CALLBACK_THREAD_AIO ((EThread *)-1)
 
-#define AIO_LOWEST_PRIORITY      0
-#define AIO_DEFAULT_PRIORITY     AIO_LOWEST_PRIORITY
+#define AIO_LOWEST_PRIORITY 0
+#define AIO_DEFAULT_PRIORITY AIO_LOWEST_PRIORITY
 
-struct AIOCallback: public Continuation
-{
+struct AIOCallback : public Continuation {
   // set before calling aio_read/aio_write
   ink_aiocb_t aiocb;
   Action action;
@@ -106,21 +102,18 @@ struct AIOCallback: public Continuation
   int64_t aio_result;
 
   int ok();
-  AIOCallback() : thread(AIO_CALLBACK_THREAD_ANY), then(0) {
-    aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
-  }
+  AIOCallback() : thread(AIO_CALLBACK_THREAD_ANY), then(0) { aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY; }
 };
 
 #if AIO_MODE == AIO_MODE_NATIVE
 
-struct AIOVec: public Continuation
-{
+struct AIOVec : public Continuation {
   Action action;
   int size;
   int completed;
   AIOCallback *first;
 
-  AIOVec(int sz, AIOCallback *c): Continuation(new_ProxyMutex()), size(sz), completed(0), first(c)
+  AIOVec(int sz, AIOCallback *c) : Continuation(new_ProxyMutex()), size(sz), completed(0), first(c)
   {
     action = c->action;
     SET_HANDLER(&AIOVec::mainEvent);
@@ -129,8 +122,7 @@ struct AIOVec: public Continuation
   int mainEvent(int event, Event *e);
 };
 
-struct DiskHandler: public Continuation
-{
+struct DiskHandler : public Continuation {
   Event *trigger_event;
   io_context_t ctx;
   ink_io_event_t events[MAX_AIO_EVENTS];
@@ -138,7 +130,8 @@ struct DiskHandler: public Continuation
   Que(AIOCallback, link) complete_list;
   int startAIOEvent(int event, Event *e);
   int mainAIOEvent(int event, Event *e);
-  DiskHandler() {
+  DiskHandler()
+  {
     SET_HANDLER(&DiskHandler::startAIOEvent);
     memset(&ctx, 0, sizeof(ctx));
     int ret = io_setup(MAX_AIO_EVENTS, &ctx);
@@ -151,11 +144,13 @@ struct DiskHandler: public Continuation
 
 void ink_aio_init(ModuleVersion version);
 int ink_aio_start();
-void ink_aio_set_callback(Continuation * error_callback);
+void ink_aio_set_callback(Continuation *error_callback);
 
-int ink_aio_read(AIOCallback *op, int fromAPI = 0);   // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
+int ink_aio_read(AIOCallback *op,
+                 int fromAPI = 0); // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
 int ink_aio_write(AIOCallback *op, int fromAPI = 0);
-int ink_aio_readv(AIOCallback *op, int fromAPI = 0);   // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
+int ink_aio_readv(AIOCallback *op,
+                  int fromAPI = 0); // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
 int ink_aio_writev(AIOCallback *op, int fromAPI = 0);
 AIOCallback *new_AIOCallback(void);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/aio/P_AIO.h
----------------------------------------------------------------------
diff --git a/iocore/aio/P_AIO.h b/iocore/aio/P_AIO.h
index d1ce7b2..2e6427a 100644
--- a/iocore/aio/P_AIO.h
+++ b/iocore/aio/P_AIO.h
@@ -37,27 +37,24 @@
 // for debugging
 // #define AIO_STATS 1
 
-#undef  AIO_MODULE_VERSION
-#define AIO_MODULE_VERSION        makeModuleVersion(AIO_MODULE_MAJOR_VERSION,\
-						    AIO_MODULE_MINOR_VERSION,\
-						    PRIVATE_MODULE_HEADER)
+#undef AIO_MODULE_VERSION
+#define AIO_MODULE_VERSION makeModuleVersion(AIO_MODULE_MAJOR_VERSION, AIO_MODULE_MINOR_VERSION, PRIVATE_MODULE_HEADER)
 
 TS_INLINE int
 AIOCallback::ok()
 {
-  return (off_t) aiocb.aio_nbytes == (off_t) aio_result;
+  return (off_t)aiocb.aio_nbytes == (off_t)aio_result;
 }
 
 #if AIO_MODE == AIO_MODE_NATIVE
 
 extern Continuation *aio_err_callbck;
 
-struct AIOCallbackInternal: public AIOCallback
-{
+struct AIOCallbackInternal : public AIOCallback {
   int io_complete(int event, void *data);
   AIOCallbackInternal()
   {
-    memset ((char *) &(this->aiocb), 0, sizeof(this->aiocb));
+    memset((char *)&(this->aiocb), 0, sizeof(this->aiocb));
     SET_HANDLER(&AIOCallbackInternal::io_complete);
   }
 };
@@ -65,8 +62,8 @@ struct AIOCallbackInternal: public AIOCallback
 TS_INLINE int
 AIOCallbackInternal::io_complete(int event, void *data)
 {
-  (void) event;
-  (void) data;
+  (void)event;
+  (void)data;
 
   if (!ok() && aio_err_callbck)
     eventProcessor.schedule_imm(aio_err_callbck, ET_CALL, AIO_EVENT_DONE);
@@ -78,7 +75,8 @@ AIOCallbackInternal::io_complete(int event, void *data)
 }
 
 TS_INLINE int
-AIOVec::mainEvent(int /* event */, Event *) {
+AIOVec::mainEvent(int /* event */, Event *)
+{
   ++completed;
   if (completed < size)
     return EVENT_CONT;
@@ -97,16 +95,15 @@ AIOVec::mainEvent(int /* event */, Event *) {
 
 struct AIO_Reqs;
 
-struct AIOCallbackInternal: public AIOCallback
-{
+struct AIOCallbackInternal : public AIOCallback {
   AIOCallback *first;
   AIO_Reqs *aio_req;
   ink_hrtime sleep_time;
   int io_complete(int event, void *data);
   AIOCallbackInternal()
   {
-    const size_t to_zero = sizeof(AIOCallbackInternal) - (size_t) & (((AIOCallbackInternal *) 0)->aiocb);
-    memset((char *) &(this->aiocb), 0, to_zero);
+    const size_t to_zero = sizeof(AIOCallbackInternal) - (size_t) & (((AIOCallbackInternal *)0)->aiocb);
+    memset((char *)&(this->aiocb), 0, to_zero);
     SET_HANDLER(&AIOCallbackInternal::io_complete);
   }
 };
@@ -114,32 +111,31 @@ struct AIOCallbackInternal: public AIOCallback
 TS_INLINE int
 AIOCallbackInternal::io_complete(int event, void *data)
 {
-  (void) event;
-  (void) data;
+  (void)event;
+  (void)data;
   if (!action.cancelled)
     action.continuation->handleEvent(AIO_EVENT_DONE, this);
   return EVENT_DONE;
 }
 
-struct AIO_Reqs
-{
-  Que(AIOCallback, link) aio_todo;       /* queue for holding non-http requests */
-  Que(AIOCallback, link) http_aio_todo;  /* queue for http requests */
-  /* Atomic list to temporarily hold the request if the
-     lock for a particular queue cannot be acquired */
+struct AIO_Reqs {
+  Que(AIOCallback, link) aio_todo;      /* queue for holding non-http requests */
+  Que(AIOCallback, link) http_aio_todo; /* queue for http requests */
+                                        /* Atomic list to temporarily hold the request if the
+                                           lock for a particular queue cannot be acquired */
   InkAtomicList aio_temp_list;
   ink_mutex aio_mutex;
   ink_cond aio_cond;
-  int index;                    /* position of this struct in the aio_reqs array */
-  volatile int pending;         /* number of outstanding requests on the disk */
-  volatile int queued;          /* total number of aio_todo and http_todo requests */
-  volatile int filedes;         /* the file descriptor for the requests */
+  int index;            /* position of this struct in the aio_reqs array */
+  volatile int pending; /* number of outstanding requests on the disk */
+  volatile int queued;  /* total number of aio_todo and http_todo requests */
+  volatile int filedes; /* the file descriptor for the requests */
   volatile int requests_queued;
 };
 
 #endif // AIO_MODE == AIO_MODE_NATIVE
 #ifdef AIO_STATS
-class AIOTestData:public Continuation
+class AIOTestData : public Continuation
 {
 public:
   int num_req;
@@ -149,7 +145,7 @@ public:
 
   int ink_aio_stats(int event, void *data);
 
-  AIOTestData():Continuation(new_ProxyMutex()), num_req(0), num_temp(0), num_queue(0)
+  AIOTestData() : Continuation(new_ProxyMutex()), num_req(0), num_temp(0), num_queue(0)
   {
     start = ink_get_hrtime();
     SET_HANDLER(&AIOTestData::ink_aio_stats);
@@ -157,8 +153,7 @@ public:
 };
 #endif
 
-enum aio_stat_enum
-{
+enum aio_stat_enum {
   AIO_STAT_READ_PER_SEC,
   AIO_STAT_KB_READ_PER_SEC,
   AIO_STAT_WRITE_PER_SEC,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/aio/test_AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc
index c9d7a9c..eb8691f 100644
--- a/iocore/aio/test_AIO.cc
+++ b/iocore/aio/test_AIO.cc
@@ -66,7 +66,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -89,15 +88,14 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 static void
@@ -120,22 +118,26 @@ init_diags(const char *bdt, const char *bat)
   diags = new Diags(bdt, bat, diags_log_fp);
 
   if (diags_log_fp == NULL) {
-    Warning("couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    Warning("couldn't open diags log file '%s', "
+            "will not log to this file",
+            diags_logpath);
   }
 
   Status("opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 #define MAX_DISK_THREADS 200
 #ifdef DISK_ALIGN
-#define MIN_OFFSET       (32*1024)
+#define MIN_OFFSET (32 * 1024)
 #else
-#define MIN_OFFSET       (8*1024)
+#define MIN_OFFSET (8 * 1024)
 #endif
-enum
-{ READ_MODE, WRITE_MODE, RANDOM_READ_MODE };
+enum {
+  READ_MODE,
+  WRITE_MODE,
+  RANDOM_READ_MODE,
+};
 
 struct AIO_Device;
 volatile int n_accessors = 0;
@@ -170,8 +172,7 @@ int seq_read_size = 0;
 int seq_write_size = 0;
 int rand_read_size = 0;
 
-struct AIO_Device:public Continuation
-{
+struct AIO_Device : public Continuation {
   char *path;
   int fd;
   int id;
@@ -183,14 +184,15 @@ struct AIO_Device:public Continuation
   int hotset_idx;
   int mode;
   AIOCallback *io;
-    AIO_Device(ProxyMutex * m):Continuation(m)
+  AIO_Device(ProxyMutex *m) : Continuation(m)
   {
     hotset_idx = 0;
     io = new_AIOCallback();
     time_start = 0;
     SET_HANDLER(&AIO_Device::do_hotset);
   }
-  int select_mode(double p)
+  int
+  select_mode(double p)
   {
     if (p < real_seq_read_percent)
       return READ_MODE;
@@ -199,28 +201,30 @@ struct AIO_Device:public Continuation
     else
       return RANDOM_READ_MODE;
   };
-  void do_touch_data(off_t orig_len, off_t orig_offset)
+  void
+  do_touch_data(off_t orig_len, off_t orig_offset)
   {
     if (!touch_data)
       return;
-    unsigned int len = (unsigned int) orig_len;
-    unsigned int offset = (unsigned int) orig_offset;
+    unsigned int len = (unsigned int)orig_len;
+    unsigned int offset = (unsigned int)orig_offset;
     offset = offset % 1024;
     char *b = buf;
-    unsigned *x = (unsigned *) b;
+    unsigned *x = (unsigned *)b;
     for (unsigned j = 0; j < (len / sizeof(int)); j++) {
       x[j] = offset;
       offset = (offset + 1) % 1024;
     }
   };
-  int do_check_data(off_t orig_len, off_t orig_offset)
+  int
+  do_check_data(off_t orig_len, off_t orig_offset)
   {
     if (!touch_data)
       return 0;
-    unsigned int len = (unsigned int) orig_len;
-    unsigned int offset = (unsigned int) orig_offset;
+    unsigned int len = (unsigned int)orig_len;
+    unsigned int offset = (unsigned int)orig_offset;
     offset = offset % 1024;
-    unsigned *x = (unsigned *) buf;
+    unsigned *x = (unsigned *)buf;
     for (unsigned j = 0; j < (len / sizeof(int)); j++) {
       if (x[j] != offset)
         return 1;
@@ -228,9 +232,8 @@ struct AIO_Device:public Continuation
     }
     return 0;
   }
-  int do_hotset(int event, Event * e);
-  int do_fd(int event, Event * e);
-
+  int do_hotset(int event, Event *e);
+  int do_fd(int event, Event *e);
 };
 
 void
@@ -266,8 +269,8 @@ dump_summary(void)
   for (int i = 0; i < orig_n_accessors; i++) {
     double secs = (dev[i]->time_end - dev[i]->time_start) / 1000000000.0;
     double ops_sec = (dev[i]->seq_reads + dev[i]->seq_writes + dev[i]->rand_reads) / secs;
-    printf("%s: #sr:%d #sw:%d #rr:%d %0.1f secs %0.1f ops/sec\n",
-           dev[i]->path, dev[i]->seq_reads, dev[i]->seq_writes, dev[i]->rand_reads, secs, ops_sec);
+    printf("%s: #sr:%d #sw:%d #rr:%d %0.1f secs %0.1f ops/sec\n", dev[i]->path, dev[i]->seq_reads, dev[i]->seq_writes,
+           dev[i]->rand_reads, secs, ops_sec);
     total_secs += secs;
     total_seq_reads += dev[i]->seq_reads;
     total_seq_writes += dev[i]->seq_writes;
@@ -283,12 +286,12 @@ dump_summary(void)
   sw /= 1024.0 * 1024.0;
   float rr = (total_rand_reads * rand_read_size) / total_secs;
   rr /= 1024.0 * 1024.0;
-  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_read\n",
-         total_seq_reads, sr, total_seq_reads / total_secs, total_seq_reads / total_secs / n_disk_path);
-  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_write\n",
-         total_seq_writes, sw, total_seq_writes / total_secs, total_seq_writes / total_secs / n_disk_path);
-  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk rand_read\n",
-         total_rand_reads, rr, total_rand_reads / total_secs, total_rand_reads / total_secs / n_disk_path);
+  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_read\n", total_seq_reads, sr, total_seq_reads / total_secs,
+         total_seq_reads / total_secs / n_disk_path);
+  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_write\n", total_seq_writes, sw,
+         total_seq_writes / total_secs, total_seq_writes / total_secs / n_disk_path);
+  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk rand_read\n", total_rand_reads, rr,
+         total_rand_reads / total_secs, total_rand_reads / total_secs / n_disk_path);
   printf("%0.2f total mbytes/sec\n", sr + sw + rr);
   printf("----------------------------------------------------------\n");
 
@@ -301,7 +304,7 @@ dump_summary(void)
 int
 AIO_Device::do_hotset(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
-  off_t max_offset = ((off_t) disk_size) * 1024 * 1024;
+  off_t max_offset = ((off_t)disk_size) * 1024 * 1024;
   io->aiocb.aio_lio_opcode = LIO_WRITE;
   io->aiocb.aio_fildes = fd;
   io->aiocb.aio_offset = MIN_OFFSET + hotset_idx * max_size;
@@ -310,9 +313,8 @@ AIO_Device::do_hotset(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   if (!hotset_idx)
     fprintf(stderr, "Starting hotset document writing \n");
   if (io->aiocb.aio_offset > max_offset) {
-    fprintf(stderr,
-            "Finished hotset documents  [%d] offset [%6.0f] size [%6.0f]\n",
-            hotset_idx, (float) MIN_OFFSET, (float) max_size);
+    fprintf(stderr, "Finished hotset documents  [%d] offset [%6.0f] size [%6.0f]\n", hotset_idx, (float)MIN_OFFSET,
+            (float)max_size);
     SET_HANDLER(&AIO_Device::do_fd);
     eventProcessor.schedule_imm(this);
     return (0);
@@ -341,10 +343,10 @@ AIO_Device::do_fd(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     return 0;
   }
 
-  off_t max_offset = ((off_t) disk_size) * 1024 * 1024; // MB-GB
-  off_t max_hotset_offset = ((off_t) hotset_size) * 1024 * 1024;        // MB-GB
-  off_t seq_read_point = ((off_t) MIN_OFFSET);
-  off_t seq_write_point = ((off_t) MIN_OFFSET) + max_offset / 2 + write_after * 1024 * 1024;
+  off_t max_offset = ((off_t)disk_size) * 1024 * 1024;          // MB-GB
+  off_t max_hotset_offset = ((off_t)hotset_size) * 1024 * 1024; // MB-GB
+  off_t seq_read_point = ((off_t)MIN_OFFSET);
+  off_t seq_write_point = ((off_t)MIN_OFFSET) + max_offset / 2 + write_after * 1024 * 1024;
   seq_write_point += (id % n_disk_path) * (max_offset / (threads_per_disk * 4));
   if (seq_write_point > max_offset)
     seq_write_point = MIN_OFFSET;
@@ -352,7 +354,7 @@ AIO_Device::do_fd(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   if (io->aiocb.aio_lio_opcode == LIO_READ) {
     ink_assert(!do_check_data(io->aiocb.aio_nbytes, io->aiocb.aio_offset));
   }
-  memset((void *) buf, 0, max_size);
+  memset((void *)buf, 0, max_size);
   io->aiocb.aio_fildes = fd;
   io->aiocb.aio_buf = buf;
   io->action = this;
@@ -373,7 +375,7 @@ AIO_Device::do_fd(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     io->aiocb.aio_offset = seq_write_point;
     io->aiocb.aio_nbytes = seq_write_size;
     io->aiocb.aio_lio_opcode = LIO_WRITE;
-    do_touch_data(seq_write_size, ((int) seq_write_point) % 1024);
+    do_touch_data(seq_write_size, ((int)seq_write_point) % 1024);
     ink_assert(ink_aio_write(io) >= 0);
     seq_write_point += seq_write_size;
     seq_write_point += write_skip;
@@ -382,36 +384,36 @@ AIO_Device::do_fd(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 
     seq_writes++;
     break;
-  case RANDOM_READ_MODE:{
-      // fprintf(stderr, "random read started \n");
-      double p, f;
-      p = drand48();
-      f = drand48();
-      off_t o = 0;
-      if (f < hotset_frequency)
-        o = (off_t) p *max_hotset_offset;
-      else
-        o = (off_t) p *(max_offset - rand_read_size);
-      if (o < MIN_OFFSET)
-        o = MIN_OFFSET;
-      o = (o + (seq_read_size - 1)) & (~(seq_read_size - 1));
-      io->aiocb.aio_offset = o;
-      io->aiocb.aio_nbytes = rand_read_size;
-      io->aiocb.aio_lio_opcode = LIO_READ;
-      ink_assert(ink_aio_read(io) >= 0);
-      rand_reads++;
-      break;
-    }
+  case RANDOM_READ_MODE: {
+    // fprintf(stderr, "random read started \n");
+    double p, f;
+    p = drand48();
+    f = drand48();
+    off_t o = 0;
+    if (f < hotset_frequency)
+      o = (off_t)p * max_hotset_offset;
+    else
+      o = (off_t)p * (max_offset - rand_read_size);
+    if (o < MIN_OFFSET)
+      o = MIN_OFFSET;
+    o = (o + (seq_read_size - 1)) & (~(seq_read_size - 1));
+    io->aiocb.aio_offset = o;
+    io->aiocb.aio_nbytes = rand_read_size;
+    io->aiocb.aio_lio_opcode = LIO_READ;
+    ink_assert(ink_aio_read(io) >= 0);
+    rand_reads++;
+    break;
+  }
   }
   return 0;
 }
 
-#define PARAM(_s) \
-        else if (strcmp(field_name, #_s) == 0) { \
-            fin >> _s; \
-            cout << "reading " #_s " = "  \
-                 << _s << endl; \
-				  }
+#define PARAM(_s)                               \
+  else if (strcmp(field_name, #_s) == 0)        \
+  {                                             \
+    fin >> _s;                                  \
+    cout << "reading " #_s " = " << _s << endl; \
+  }
 
 int
 read_config(const char *config_filename)
@@ -433,23 +435,24 @@ read_config(const char *config_filename)
     if (0) {
     }
     PARAM(hotset_size)
-      PARAM(hotset_frequency)
-      PARAM(touch_data)
-      PARAM(use_lseek)
-      PARAM(write_after)
-      PARAM(write_skip)
-      PARAM(disk_size)
-      PARAM(seq_read_percent)
-      PARAM(seq_write_percent)
-      PARAM(rand_read_percent)
-      PARAM(seq_read_size)
-      PARAM(seq_write_size)
-      PARAM(rand_read_size)
-      PARAM(run_time)
-      PARAM(chains)
-      PARAM(threads_per_disk)
-      PARAM(delete_disks)
-      else if (strcmp(field_name, "disk_path") == 0) {
+    PARAM(hotset_frequency)
+    PARAM(touch_data)
+    PARAM(use_lseek)
+    PARAM(write_after)
+    PARAM(write_skip)
+    PARAM(disk_size)
+    PARAM(seq_read_percent)
+    PARAM(seq_write_percent)
+    PARAM(rand_read_percent)
+    PARAM(seq_read_size)
+    PARAM(seq_write_size)
+    PARAM(rand_read_size)
+    PARAM(run_time)
+    PARAM(chains)
+    PARAM(threads_per_disk)
+    PARAM(delete_disks)
+    else if (strcmp(field_name, "disk_path") == 0)
+    {
       assert(n_disk_path < MAX_DISK_THREADS);
       fin >> field_value;
       disk_path[n_disk_path] = strdup(field_value);
@@ -525,7 +528,7 @@ main(int /* argc ATS_UNUSED */, char *argv[])
         perror(disk_path[i]);
         exit(1);
       }
-      dev[n_accessors]->buf = (char *) valloc(max_size);
+      dev[n_accessors]->buf = (char *)valloc(max_size);
       eventProcessor.schedule_imm(dev[n_accessors]);
       n_accessors++;
     }


[07/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_memory.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_memory.h b/lib/ts/ink_memory.h
index 7a8729b..69285f0 100644
--- a/lib/ts/ink_memory.h
+++ b/lib/ts/ink_memory.h
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 #ifndef _ink_memory_h_
-#define	_ink_memory_h_
+#define _ink_memory_h_
 
 #include <ctype.h>
 #include <string.h>
@@ -78,46 +78,46 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif                          /* __cplusplus */
+#endif /* __cplusplus */
 
-  typedef struct iovec IOVec;
+typedef struct iovec IOVec;
 
-  void *  ats_malloc(size_t size);
-  void *  ats_calloc(size_t nelem, size_t elsize);
-  void *  ats_realloc(void *ptr, size_t size);
-  void *  ats_memalign(size_t alignment, size_t size);
-  void    ats_free(void *ptr);
-  void *  ats_free_null(void *ptr);
-  void    ats_memalign_free(void *ptr);
-  int     ats_mallopt(int param, int value);
+void *ats_malloc(size_t size);
+void *ats_calloc(size_t nelem, size_t elsize);
+void *ats_realloc(void *ptr, size_t size);
+void *ats_memalign(size_t alignment, size_t size);
+void ats_free(void *ptr);
+void *ats_free_null(void *ptr);
+void ats_memalign_free(void *ptr);
+int ats_mallopt(int param, int value);
 
-  int     ats_msync(caddr_t addr, size_t len, caddr_t end, int flags);
-  int     ats_madvise(caddr_t addr, size_t len, int flags);
-  int     ats_mlock(caddr_t addr, size_t len);
+int ats_msync(caddr_t addr, size_t len, caddr_t end, int flags);
+int ats_madvise(caddr_t addr, size_t len, int flags);
+int ats_mlock(caddr_t addr, size_t len);
 
-  static inline size_t __attribute__((const)) ats_pagesize(void)
-  {
-    static size_t page_size;
+static inline size_t __attribute__((const)) ats_pagesize(void)
+{
+  static size_t page_size;
 
-    if (page_size)
-      return page_size;
+  if (page_size)
+    return page_size;
 
 #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
-    page_size = (size_t)sysconf(_SC_PAGESIZE);
+  page_size = (size_t)sysconf(_SC_PAGESIZE);
 #elif defined(HAVE_GETPAGESIZE)
-    page_size = (size_t)getpagesize()
+  page_size = (size_t)getpagesize()
 #else
-    page_size = (size_t)8192;
+  page_size = (size_t)8192;
 #endif
 
-    return page_size;
-  }
+  return page_size;
+}
 
 /* Some convenience wrappers around strdup() functionality */
 char *_xstrdup(const char *str, int length, const char *path);
 
-#define ats_strdup(p)        _xstrdup((p), -1, NULL)
-#define ats_strndup(p,n)     _xstrdup((p), n, NULL)
+#define ats_strdup(p) _xstrdup((p), -1, NULL)
+#define ats_strndup(p, n) _xstrdup((p), n, NULL)
 
 #ifdef __cplusplus
 }
@@ -127,15 +127,15 @@ char *_xstrdup(const char *str, int length, const char *path);
 
 template <typename PtrType, typename SizeType>
 static inline IOVec
-make_iovec(PtrType ptr, SizeType sz) {
-  IOVec iov = { ptr, static_cast<size_t>(sz) };
+make_iovec(PtrType ptr, SizeType sz)
+{
+  IOVec iov = {ptr, static_cast<size_t>(sz)};
   return iov;
 }
 
-template <typename PtrType, unsigned N>
-static inline IOVec
-make_iovec(PtrType (&array)[N]) {
-  IOVec iov = { &array[0], static_cast<size_t>(sizeof(array)) };
+template <typename PtrType, unsigned N> static inline IOVec make_iovec(PtrType(&array)[N])
+{
+  IOVec iov = {&array[0], static_cast<size_t>(sizeof(array))};
   return iov;
 }
 
@@ -166,8 +166,10 @@ make_iovec(PtrType (&array)[N]) {
     @endcode
 
  */
-template < typename T > inline void
-ink_zero(T& t) {
+template <typename T>
+inline void
+ink_zero(T &t)
+{
   memset(&t, 0, sizeof(t));
 }
 
@@ -232,18 +234,16 @@ ink_zero(T& t) {
 
 */
 
-template <
-  typename TRAITS ///< Traits object.
->
+template <typename TRAITS ///< Traits object.
+          >
 class ats_scoped_resource
 {
 public:
-  typedef TRAITS Traits; ///< Make template arg available.
+  typedef TRAITS Traits;                          ///< Make template arg available.
   typedef typename TRAITS::value_type value_type; ///< Import value type.
-  typedef ats_scoped_resource self; ///< Self reference type.
+  typedef ats_scoped_resource self;               ///< Self reference type.
 
 public:
-
   /// Default constructor - an empty container.
   ats_scoped_resource() : _r(Traits::initValue()) {}
 
@@ -251,19 +251,20 @@ public:
   explicit ats_scoped_resource(value_type rt) : _r(rt) {}
 
   /// Destructor.
-  ~ats_scoped_resource() {
+  ~ats_scoped_resource()
+  {
     if (Traits::isValid(_r))
       Traits::destroy(_r);
   }
 
   /// Automatic conversion to resource type.
-  operator value_type () const {
-    return _r;
-  }
+  operator value_type() const { return _r; }
   /// Explicit conversion to resource type.
   /// @note Syntactic sugar for @c static_cast<value_type>(instance). Required when passing to var arg function
   /// as automatic conversion won't be done.
-  value_type get() const {
+  value_type
+  get() const
+  {
     return _r;
   }
 
@@ -279,7 +280,9 @@ public:
 
       @return The no longer contained resource.
   */
-  value_type release() {
+  value_type
+  release()
+  {
     value_type zret = _r;
     _r = Traits::initValue();
     return zret;
@@ -291,45 +294,56 @@ public:
 
       @internal This is usually overridden in subclasses to get the return type adjusted.
   */
-  self& operator = (value_type rt) {
-    if (Traits::isValid(_r)) Traits::destroy(_r);
+  self &operator=(value_type rt)
+  {
+    if (Traits::isValid(_r))
+      Traits::destroy(_r);
     _r = rt;
     return *this;
   }
 
   /// Equality.
-  bool operator == (value_type rt) const {
-    return _r == rt;
-  }
+  bool operator==(value_type rt) const { return _r == rt; }
 
   /// Inequality.
-  bool operator != (value_type rt) const {
-    return _r != rt;
-  }
+  bool operator!=(value_type rt) const { return _r != rt; }
 
   /// Test if the contained resource is valid.
-  bool isValid() const {
+  bool
+  isValid() const
+  {
     return Traits::isValid(_r);
   }
 
 protected:
   value_type _r; ///< Resource.
 private:
-  ats_scoped_resource(self const&); ///< Copy constructor not permitted.
-  self& operator = (self const&); ///< Self assignment not permitted.
-
+  ats_scoped_resource(self const &); ///< Copy constructor not permitted.
+  self &operator=(self const &);     ///< Self assignment not permitted.
 };
 
-namespace detail {
+namespace detail
+{
 /** Traits for @c ats_scoped_resource for file descriptors.
  */
-  struct SCOPED_FD_TRAITS
+struct SCOPED_FD_TRAITS {
+  typedef int value_type;
+  static int
+  initValue()
+  {
+    return -1;
+  }
+  static bool
+  isValid(int fd)
   {
-    typedef int value_type;
-    static int initValue() { return -1; }
-    static bool isValid(int fd) { return fd >= 0; }
-    static void destroy(int fd) { close(fd); }
-  };
+    return fd >= 0;
+  }
+  static void
+  destroy(int fd)
+  {
+    close(fd);
+  }
+};
 }
 /** File descriptor as a scoped resource.
  */
@@ -337,7 +351,7 @@ class ats_scoped_fd : public ats_scoped_resource<detail::SCOPED_FD_TRAITS>
 {
 public:
   typedef ats_scoped_resource<detail::SCOPED_FD_TRAITS> super; ///< Super type.
-  typedef ats_scoped_fd self; ///< Self reference type.
+  typedef ats_scoped_fd self;                                  ///< Self reference type.
 
   /// Default constructor - an empty container.
   ats_scoped_fd() : super() {}
@@ -349,38 +363,59 @@ public:
       Any resource currently contained is destroyed.
       This object becomes the owner of @a rt.
   */
-  self& operator = (value_type rt) {
+  self &operator=(value_type rt)
+  {
     super::operator=(rt);
     return *this;
   }
-
 };
 
-namespace detail {
+namespace detail
+{
 /** Traits for @c ats_scoped_resource for pointers from @c ats_malloc.
  */
-  template <
-    typename T ///< Underlying type (not the pointer type).
-  >
-  struct SCOPED_MALLOC_TRAITS
+template <typename T ///< Underlying type (not the pointer type).
+          >
+struct SCOPED_MALLOC_TRAITS {
+  typedef T *value_type;
+  static T *
+  initValue()
+  {
+    return NULL;
+  }
+  static bool
+  isValid(T *t)
+  {
+    return 0 != t;
+  }
+  static void
+  destroy(T *t)
+  {
+    ats_free(t);
+  }
+};
+
+/// Traits for @c ats_scoped_resource for objects using @c new and @c delete.
+template <typename T ///< Underlying type - not the pointer type.
+          >
+struct SCOPED_OBJECT_TRAITS {
+  typedef T *value_type;
+  static T *
+  initValue()
   {
-    typedef T* value_type;
-    static T*  initValue() { return NULL; }
-    static bool isValid(T* t) { return 0 != t; }
-    static void destroy(T* t) { ats_free(t); }
-  };
-
-  /// Traits for @c ats_scoped_resource for objects using @c new and @c delete.
-  template <
-    typename T ///< Underlying type - not the pointer type.
-  >
-  struct SCOPED_OBJECT_TRAITS
+    return NULL;
+  }
+  static bool
+  isValid(T *t)
   {
-    typedef T* value_type;
-    static T* initValue() { return NULL; }
-    static bool isValid(T* t) { return 0 != t; }
-    static void destroy(T* t) { delete t; }
-  };
+    return 0 != t;
+  }
+  static void
+  destroy(T *t)
+  {
+    delete t;
+  }
+};
 }
 
 /** Specialization of @c ats_scoped_resource for strings.
@@ -388,21 +423,19 @@ namespace detail {
 */
 class ats_scoped_str : public ats_scoped_resource<detail::SCOPED_MALLOC_TRAITS<char> >
 {
- public:
+public:
   typedef ats_scoped_resource<detail::SCOPED_MALLOC_TRAITS<char> > super; ///< Super type.
-  typedef ats_scoped_str self; ///< Self reference type.
+  typedef ats_scoped_str self;                                            ///< Self reference type.
 
   /// Default constructor (no string).
-  ats_scoped_str()
-  { }
+  ats_scoped_str() {}
   /// Construct and allocate @a n bytes for a string.
-  explicit ats_scoped_str(size_t n) : super(static_cast<char*>(ats_malloc(n)))
-  { }
+  explicit ats_scoped_str(size_t n) : super(static_cast<char *>(ats_malloc(n))) {}
   /// Put string @a s in this container for cleanup.
-  explicit ats_scoped_str(char* s) : super(s)
-  { }
+  explicit ats_scoped_str(char *s) : super(s) {}
   /// Assign a string @a s to this container.
-  self& operator = (char* s) {
+  self &operator=(char *s)
+  {
     super::operator=(s);
     return *this;
   }
@@ -410,16 +443,16 @@ class ats_scoped_str : public ats_scoped_resource<detail::SCOPED_MALLOC_TRAITS<c
 
 /** Specialization of @c ats_scoped_resource for pointers allocated with @c ats_malloc.
  */
-template <
-  typename T ///< Underlying (not pointer) type.
->
+template <typename T ///< Underlying (not pointer) type.
+          >
 class ats_scoped_mem : public ats_scoped_resource<detail::SCOPED_MALLOC_TRAITS<T> >
 {
 public:
   typedef ats_scoped_resource<detail::SCOPED_MALLOC_TRAITS<T> > super; ///< Super type.
-  typedef ats_scoped_mem self; ///< Self reference.
+  typedef ats_scoped_mem self;                                         ///< Self reference.
 
-  self& operator = (T* ptr) {
+  self &operator=(T *ptr)
+  {
     super::operator=(ptr);
     return *this;
   }
@@ -429,29 +462,27 @@ public:
     This handles a pointer to an object created by @c new and destroyed by @c delete.
 */
 
-template <
-  typename T /// Underlying (not pointer) type.
->
+template <typename T /// Underlying (not pointer) type.
+          >
 class ats_scoped_obj : public ats_scoped_resource<detail::SCOPED_OBJECT_TRAITS<T> >
 {
 public:
   typedef ats_scoped_resource<detail::SCOPED_OBJECT_TRAITS<T> > super; ///< Super type.
-  typedef ats_scoped_obj self; ///< Self reference.
+  typedef ats_scoped_obj self;                                         ///< Self reference.
 
   /// Default constructor - an empty container.
   ats_scoped_obj() : super() {}
 
   /// Construct with contained resource.
-  explicit ats_scoped_obj(T* obj) : super(obj) {}
+  explicit ats_scoped_obj(T *obj) : super(obj) {}
 
-  self& operator = (T* obj) {
+  self &operator=(T *obj)
+  {
     super::operator=(obj);
     return *this;
   }
 
-  T* operator -> () const {
-    return *this;
-  }
+  T *operator->() const { return *this; }
 };
 
 /** Combine two strings as file paths.
@@ -459,25 +490,27 @@ public:
      are handled to yield exactly one separator.
      @return A newly @x ats_malloc string of the combined paths.
 */
-inline char*
-path_join (ats_scoped_str const& lhs, ats_scoped_str  const& rhs)
+inline char *
+path_join(ats_scoped_str const &lhs, ats_scoped_str const &rhs)
 {
   size_t ln = strlen(lhs);
   size_t rn = strlen(rhs);
-  char const* rptr = rhs; // May need to be modified.
+  char const *rptr = rhs; // May need to be modified.
 
-  if (ln && lhs[ln-1] == '/') --ln; // drop trailing separator.
-  if (rn && *rptr == '/') --rn, ++rptr; // drop leading separator.
+  if (ln && lhs[ln - 1] == '/')
+    --ln; // drop trailing separator.
+  if (rn && *rptr == '/')
+    --rn, ++rptr; // drop leading separator.
 
   ats_scoped_str x(ln + rn + 2);
 
   memcpy(x, lhs, ln);
   x[ln] = '/';
-  memcpy(x + ln + 1,  rptr, rn);
-  x[ln+rn+1] = 0; // terminate string.
+  memcpy(x + ln + 1, rptr, rn);
+  x[ln + rn + 1] = 0; // terminate string.
 
   return x.release();
 }
-#endif  /* __cplusplus */
+#endif /* __cplusplus */
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_mutex.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_mutex.h b/lib/ts/ink_mutex.h
index bc84da4..7603627 100644
--- a/lib/ts/ink_mutex.h
+++ b/lib/ts/ink_mutex.h
@@ -49,12 +49,9 @@ class x_pthread_mutexattr_t
 public:
   pthread_mutexattr_t attr;
   x_pthread_mutexattr_t();
-  ~x_pthread_mutexattr_t()
-  {
-  }
+  ~x_pthread_mutexattr_t() {}
 };
-inline
-x_pthread_mutexattr_t::x_pthread_mutexattr_t()
+inline x_pthread_mutexattr_t::x_pthread_mutexattr_t()
 {
   pthread_mutexattr_init(&attr);
 #ifndef POSIX_THREAD_10031c
@@ -65,12 +62,12 @@ x_pthread_mutexattr_t::x_pthread_mutexattr_t()
 extern class x_pthread_mutexattr_t _g_mattr;
 
 static inline int
-ink_mutex_init(ink_mutex * m, const char *name)
+ink_mutex_init(ink_mutex *m, const char *name)
 {
-  (void) name;
+  (void)name;
 
 #if defined(solaris)
-  if ( pthread_mutex_init(m, NULL) != 0 ) {
+  if (pthread_mutex_init(m, NULL) != 0) {
     abort();
   }
 #else
@@ -82,13 +79,13 @@ ink_mutex_init(ink_mutex * m, const char *name)
 }
 
 static inline int
-ink_mutex_destroy(ink_mutex * m)
+ink_mutex_destroy(ink_mutex *m)
 {
   return pthread_mutex_destroy(m);
 }
 
 static inline int
-ink_mutex_acquire(ink_mutex * m)
+ink_mutex_acquire(ink_mutex *m)
 {
   if (pthread_mutex_lock(m) != 0) {
     abort();
@@ -97,7 +94,7 @@ ink_mutex_acquire(ink_mutex * m)
 }
 
 static inline int
-ink_mutex_release(ink_mutex * m)
+ink_mutex_release(ink_mutex *m)
 {
   if (pthread_mutex_unlock(m) != 0) {
     abort();
@@ -106,7 +103,7 @@ ink_mutex_release(ink_mutex * m)
 }
 
 static inline int
-ink_mutex_try_acquire(ink_mutex * m)
+ink_mutex_try_acquire(ink_mutex *m)
 {
   return pthread_mutex_trylock(m) == 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_platform.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_platform.h b/lib/ts/ink_platform.h
index 35eba59..251efe0 100644
--- a/lib/ts/ink_platform.h
+++ b/lib/ts/ink_platform.h
@@ -30,27 +30,27 @@
 #include <stdio.h>
 #include <stdarg.h>
 #ifdef HAVE_STDLIB_H
-# include <stdlib.h>
+#include <stdlib.h>
 #endif
 #include <ctype.h>
 #ifdef HAVE_STRING_H
-# include <string.h>
+#include <string.h>
 #endif
 #ifdef HAVE_STRINGS_H
-# include <strings.h>
+#include <strings.h>
 #endif
 #include <errno.h>
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 #ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
+#include <sys/stat.h>
 #endif
 #include <fcntl.h>
 
 #include <limits.h>
 #ifdef HAVE_UNISTD_H
-# include <unistd.h>
+#include <unistd.h>
 #endif
 #include <sys/stat.h>
 #include <assert.h>
@@ -72,39 +72,39 @@
 #include <sys/mman.h>
 
 #ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
+#include <netinet/in.h>
 #endif
 #ifdef HAVE_NETINET_IN_SYSTM_H
-# include <netinet/in_systm.h>
+#include <netinet/in_systm.h>
 #endif
 #ifdef HAVE_NETINET_TCP_H
-# include <netinet/tcp.h>
+#include <netinet/tcp.h>
 #endif
 #ifdef HAVE_NETINET_IP_H
-# include <netinet/ip.h>
+#include <netinet/ip.h>
 #endif
 #ifdef HAVE_NETINET_IP_ICMP_H
-# include <netinet/ip_icmp.h>
+#include <netinet/ip_icmp.h>
 #endif
 #ifdef HAVE_NETDB_H
-# include <netdb.h>
+#include <netdb.h>
 #endif
 #ifdef HAVE_ARPA_INET_H
-# include <arpa/inet.h>
+#include <arpa/inet.h>
 #endif
 #ifdef HAVE_ARPA_NAMESER_H
-# include <arpa/nameser.h>
+#include <arpa/nameser.h>
 #endif
 #ifdef HAVE_ARPA_NAMESER_COMPAT_H
-# include <arpa/nameser_compat.h>
+#include <arpa/nameser_compat.h>
 #endif
 
 #include <signal.h>
 #ifdef HAVE_SIGINFO_H
-# include <siginfo.h>
+#include <siginfo.h>
 #endif
 #ifdef HAVE_WAIT_H
-# include <wait.h>
+#include <wait.h>
 #endif
 
 #include <syslog.h>
@@ -123,17 +123,17 @@
 
 
 #ifdef HAVE_VALUES_H
-# include <values.h>
+#include <values.h>
 #endif
 #ifdef HAVE_ALLOCA_H
-# include <alloca.h>
+#include <alloca.h>
 #endif
 
 #include <errno.h>
 #include <dirent.h>
 
 #ifdef HAVE_CPIO_H
-# include <cpio.h>
+#include <cpio.h>
 #endif
 
 struct ifafilt;
@@ -152,20 +152,20 @@ struct ifafilt;
 #endif
 
 #ifdef HAVE_MACHINE_ENDIAN_H
-# include <machine/endian.h>
+#include <machine/endian.h>
 #endif
 #ifdef HAVE_ENDIAN_H
-# include <endian.h>
+#include <endian.h>
 #endif
 #ifdef HAVE_SYS_BYTEORDER_H
-# include <sys/byteorder.h>
+#include <sys/byteorder.h>
 #endif
 
 #ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
+#include <sys/ioctl.h>
 #endif
 #ifdef HAVE_SYS_SOCKIO_H
-# include <sys/sockio.h>
+#include <sys/sockio.h>
 #endif
 
 #include <resolv.h>
@@ -176,30 +176,30 @@ typedef unsigned int in_addr_t;
 #endif
 
 #ifdef HAVE_SYS_SYSINFO_H
-# include <sys/sysinfo.h>
+#include <sys/sysinfo.h>
 #endif
 
 #if !defined(darwin)
-# ifdef HAVE_SYS_SYSCTL_H
-#  include <sys/sysctl.h>
-# endif
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
 #endif
 #ifdef HAVE_SYS_SYSTEMINFO_H
-# include <sys/systeminfo.h>
+#include <sys/systeminfo.h>
 #endif
 
 #ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
+#include <dlfcn.h>
 #endif
 #ifdef HAVE_MATH_H
-# include <math.h>
+#include <math.h>
 #endif
 #ifdef HAVE_FLOAT_H
-# include <float.h>
+#include <float.h>
 #endif
 
 #ifdef HAVE_SYS_SYSMACROS_H
-# include <sys/sysmacros.h>
+#include <sys/sysmacros.h>
 #endif
 
 #ifdef HAVE_SYS_PRCTL_H

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_queue.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc
index 6286d8e..e718b3f 100644
--- a/lib/ts/ink_queue.cc
+++ b/lib/ts/ink_queue.cc
@@ -67,7 +67,7 @@ inkcoreapi volatile int64_t fastalloc_mem_total = 0;
 
 // #define MEMPROTECT 1
 
-#define MEMPROTECT_SIZE  0x200
+#define MEMPROTECT_SIZE 0x200
 
 #ifdef MEMPROTECT
 static const int page_size = ats_pagesize();
@@ -77,12 +77,10 @@ ink_freelist_list *freelists = NULL;
 
 inkcoreapi volatile int64_t freelist_allocated_mem = 0;
 
-#define fl_memadd(_x_) \
-   ink_atomic_increment(&freelist_allocated_mem, (int64_t) (_x_));
+#define fl_memadd(_x_) ink_atomic_increment(&freelist_allocated_mem, (int64_t)(_x_));
 
 void
-ink_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size,
-                  uint32_t chunk_size, uint32_t alignment)
+ink_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment)
 {
 #if TS_USE_RECLAIMABLE_FREELIST
   return reclaimable_freelist_init(fl, name, type_size, chunk_size, alignment);
@@ -117,7 +115,8 @@ ink_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size,
 }
 
 void
-ink_freelist_madvise_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment, int advice)
+ink_freelist_madvise_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment,
+                          int advice)
 {
   ink_freelist_init(fl, name, type_size, chunk_size, alignment);
 #if TS_USE_RECLAIMABLE_FREELIST
@@ -128,8 +127,7 @@ ink_freelist_madvise_init(InkFreeList **fl, const char *name, uint32_t type_size
 }
 
 InkFreeList *
-ink_freelist_create(const char *name, uint32_t type_size, uint32_t chunk_size,
-                    uint32_t alignment)
+ink_freelist_create(const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment)
 {
   InkFreeList *f;
 
@@ -145,7 +143,7 @@ int fake_global_for_ink_queue = 0;
 
 int fastmemtotal = 0;
 void *
-ink_freelist_new(InkFreeList * f)
+ink_freelist_new(InkFreeList *f)
 {
 #if TS_USE_FREELIST
 #if TS_USE_RECLAIMABLE_FREELIST
@@ -171,7 +169,7 @@ ink_freelist_new(InkFreeList * f)
 
       void *newp = NULL;
 #ifdef DEBUG
-      char *oldsbrk = (char *) sbrk(0), *newsbrk = NULL;
+      char *oldsbrk = (char *)sbrk(0), *newsbrk = NULL;
 #endif
       if (f->alignment)
         newp = ats_memalign(f->alignment, f->chunk_size * type_size);
@@ -181,21 +179,21 @@ ink_freelist_new(InkFreeList * f)
 
       fl_memadd(f->chunk_size * type_size);
 #ifdef DEBUG
-      newsbrk = (char *) sbrk(0);
+      newsbrk = (char *)sbrk(0);
       ink_atomic_increment(&fastmemtotal, newsbrk - oldsbrk);
-      /*      printf("fastmem %d, %d, %d\n", f->chunk_size * type_size,
-         newsbrk - oldsbrk, fastmemtotal); */
+/*      printf("fastmem %d, %d, %d\n", f->chunk_size * type_size,
+   newsbrk - oldsbrk, fastmemtotal); */
 #endif
       SET_FREELIST_POINTER_VERSION(item, newp, 0);
 
-      ink_atomic_increment((int *) &f->allocated, f->chunk_size);
-      ink_atomic_increment(&fastalloc_mem_total, (int64_t) f->chunk_size * f->type_size);
+      ink_atomic_increment((int *)&f->allocated, f->chunk_size);
+      ink_atomic_increment(&fastalloc_mem_total, (int64_t)f->chunk_size * f->type_size);
 
       /* free each of the new elements */
       for (i = 0; i < f->chunk_size; i++) {
-        char *a = ((char *) FREELIST_POINTER(item)) + i * type_size;
+        char *a = ((char *)FREELIST_POINTER(item)) + i * type_size;
 #ifdef DEADBEEF
-        const char str[4] = { (char) 0xde, (char) 0xad, (char) 0xbe, (char) 0xef };
+        const char str[4] = {(char)0xde, (char)0xad, (char)0xbe, (char)0xef};
         for (int j = 0; j < (int)type_size; j++)
           a[j] = str[j % 4];
 #endif
@@ -207,42 +205,38 @@ ink_freelist_new(InkFreeList * f)
             perror("mprotect");
         }
 #endif /* MEMPROTECT */
-
       }
-      ink_atomic_increment((int *) &f->used, f->chunk_size);
-      ink_atomic_increment(&fastalloc_mem_in_use, (int64_t) f->chunk_size * f->type_size);
+      ink_atomic_increment((int *)&f->used, f->chunk_size);
+      ink_atomic_increment(&fastalloc_mem_in_use, (int64_t)f->chunk_size * f->type_size);
 
     } else {
-      SET_FREELIST_POINTER_VERSION(next, *ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), 0),
-                                   FREELIST_VERSION(item) + 1);
+      SET_FREELIST_POINTER_VERSION(next, *ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), 0), FREELIST_VERSION(item) + 1);
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*)&f->head.data, item.data, next.data);
+      result = ink_atomic_cas((__int128_t *)&f->head.data, item.data, next.data);
 #else
-       result = ink_atomic_cas((int64_t *) & f->head.data, item.data, next.data);
+      result = ink_atomic_cas((int64_t *)&f->head.data, item.data, next.data);
 #endif
 
 #ifdef SANITY
       if (result) {
         if (FREELIST_POINTER(item) == TO_PTR(FREELIST_POINTER(next)))
           ink_fatal("ink_freelist_new: loop detected");
-        if (((uintptr_t) (TO_PTR(FREELIST_POINTER(next)))) & 3)
+        if (((uintptr_t)(TO_PTR(FREELIST_POINTER(next)))) & 3)
           ink_fatal("ink_freelist_new: bad list");
         if (TO_PTR(FREELIST_POINTER(next)))
-          fake_global_for_ink_queue = *(int *) TO_PTR(FREELIST_POINTER(next));
+          fake_global_for_ink_queue = *(int *)TO_PTR(FREELIST_POINTER(next));
       }
 #endif /* SANITY */
-
     }
-  }
-  while (result == 0);
-  ink_assert(!((uintptr_t)TO_PTR(FREELIST_POINTER(item))&(((uintptr_t)f->alignment)-1)));
+  } while (result == 0);
+  ink_assert(!((uintptr_t)TO_PTR(FREELIST_POINTER(item)) & (((uintptr_t)f->alignment) - 1)));
 
-  ink_atomic_increment((int *) &f->used, 1);
-  ink_atomic_increment(&fastalloc_mem_in_use, (int64_t) f->type_size);
+  ink_atomic_increment((int *)&f->used, 1);
+  ink_atomic_increment(&fastalloc_mem_in_use, (int64_t)f->type_size);
 
   return TO_PTR(FREELIST_POINTER(item));
 #endif /* TS_USE_RECLAIMABLE_FREELIST */
-#else // ! TS_USE_FREELIST
+#else  // ! TS_USE_FREELIST
   void *newp = NULL;
 
   if (f->alignment)
@@ -255,26 +249,26 @@ ink_freelist_new(InkFreeList * f)
 }
 
 void
-ink_freelist_free(InkFreeList * f, void *item)
+ink_freelist_free(InkFreeList *f, void *item)
 {
 #if TS_USE_FREELIST
 #if TS_USE_RECLAIMABLE_FREELIST
   return reclaimable_freelist_free(f, item);
 #else
-  volatile void **adr_of_next = (volatile void **) ADDRESS_OF_NEXT(item, 0);
+  volatile void **adr_of_next = (volatile void **)ADDRESS_OF_NEXT(item, 0);
   head_p h;
   head_p item_pair;
   int result = 0;
 
-  // ink_assert(!((long)item&(f->alignment-1))); XXX - why is this no longer working? -bcall
+// ink_assert(!((long)item&(f->alignment-1))); XXX - why is this no longer working? -bcall
 
 #ifdef DEADBEEF
   {
-    static const char str[4] = { (char) 0xde, (char) 0xad, (char) 0xbe, (char) 0xef };
+    static const char str[4] = {(char)0xde, (char)0xad, (char)0xbe, (char)0xef};
 
     // set the entire item to DEADBEEF
     for (int j = 0; j < (int)f->type_size; j++)
-      ((char*)item)[j] = str[j % 4];
+      ((char *)item)[j] = str[j % 4];
   }
 #endif /* DEADBEEF */
 
@@ -283,23 +277,23 @@ ink_freelist_free(InkFreeList * f, void *item)
 #ifdef SANITY
     if (TO_PTR(FREELIST_POINTER(h)) == item)
       ink_fatal("ink_freelist_free: trying to free item twice");
-    if (((uintptr_t) (TO_PTR(FREELIST_POINTER(h)))) & 3)
+    if (((uintptr_t)(TO_PTR(FREELIST_POINTER(h)))) & 3)
       ink_fatal("ink_freelist_free: bad list");
     if (TO_PTR(FREELIST_POINTER(h)))
-      fake_global_for_ink_queue = *(int *) TO_PTR(FREELIST_POINTER(h));
+      fake_global_for_ink_queue = *(int *)TO_PTR(FREELIST_POINTER(h));
 #endif /* SANITY */
     *adr_of_next = FREELIST_POINTER(h);
     SET_FREELIST_POINTER_VERSION(item_pair, FROM_PTR(item), FREELIST_VERSION(h));
     INK_MEMORY_BARRIER;
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*) & f->head, h.data, item_pair.data);
+    result = ink_atomic_cas((__int128_t *)&f->head, h.data, item_pair.data);
 #else
-       result = ink_atomic_cas((int64_t *) & f->head, h.data, item_pair.data);
+    result = ink_atomic_cas((int64_t *)&f->head, h.data, item_pair.data);
 #endif
   }
 
-  ink_atomic_increment((int *) &f->used, -1);
-  ink_atomic_increment(&fastalloc_mem_in_use, -(int64_t) f->type_size);
+  ink_atomic_increment((int *)&f->used, -1);
+  ink_atomic_increment(&fastalloc_mem_in_use, -(int64_t)f->type_size);
 #endif /* TS_USE_RECLAIMABLE_FREELIST */
 #else
   if (f->alignment)
@@ -314,23 +308,23 @@ ink_freelist_free_bulk(InkFreeList *f, void *head, void *tail, size_t num_item)
 {
 #if TS_USE_FREELIST
 #if !TS_USE_RECLAIMABLE_FREELIST
-  volatile void **adr_of_next = (volatile void **) ADDRESS_OF_NEXT(tail, 0);
+  volatile void **adr_of_next = (volatile void **)ADDRESS_OF_NEXT(tail, 0);
   head_p h;
   head_p item_pair;
   int result = 0;
 
-  // ink_assert(!((long)item&(f->alignment-1))); XXX - why is this no longer working? -bcall
+// ink_assert(!((long)item&(f->alignment-1))); XXX - why is this no longer working? -bcall
 
 #ifdef DEADBEEF
   {
-    static const char str[4] = { (char) 0xde, (char) 0xad, (char) 0xbe, (char) 0xef };
+    static const char str[4] = {(char)0xde, (char)0xad, (char)0xbe, (char)0xef};
 
     // set the entire item to DEADBEEF;
-    void* temp = head;
-    for (size_t i = 0; i<num_item; i++) {
-      for (int j = sizeof(void*); j < (int)f->type_size; j++)
-        ((char*)temp)[j] = str[j % 4];
-      *ADDRESS_OF_NEXT(temp, 0) = FROM_PTR(*ADDRESS_OF_NEXT(temp,0));
+    void *temp = head;
+    for (size_t i = 0; i < num_item; i++) {
+      for (int j = sizeof(void *); j < (int)f->type_size; j++)
+        ((char *)temp)[j] = str[j % 4];
+      *ADDRESS_OF_NEXT(temp, 0) = FROM_PTR(*ADDRESS_OF_NEXT(temp, 0));
       temp = TO_PTR(*ADDRESS_OF_NEXT(temp, 0));
     }
   }
@@ -341,32 +335,32 @@ ink_freelist_free_bulk(InkFreeList *f, void *head, void *tail, size_t num_item)
 #ifdef SANITY
     if (TO_PTR(FREELIST_POINTER(h)) == head)
       ink_fatal("ink_freelist_free: trying to free item twice");
-    if (((uintptr_t) (TO_PTR(FREELIST_POINTER(h)))) & 3)
+    if (((uintptr_t)(TO_PTR(FREELIST_POINTER(h)))) & 3)
       ink_fatal("ink_freelist_free: bad list");
     if (TO_PTR(FREELIST_POINTER(h)))
-      fake_global_for_ink_queue = *(int *) TO_PTR(FREELIST_POINTER(h));
+      fake_global_for_ink_queue = *(int *)TO_PTR(FREELIST_POINTER(h));
 #endif /* SANITY */
     *adr_of_next = FREELIST_POINTER(h);
     SET_FREELIST_POINTER_VERSION(item_pair, FROM_PTR(head), FREELIST_VERSION(h));
     INK_MEMORY_BARRIER;
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*) & f->head, h.data, item_pair.data);
-#else /* !TS_HAS_128BIT_CAS */
-       result = ink_atomic_cas((int64_t *) & f->head, h.data, item_pair.data);
+    result = ink_atomic_cas((__int128_t *)&f->head, h.data, item_pair.data);
+#else  /* !TS_HAS_128BIT_CAS */
+    result = ink_atomic_cas((int64_t *)&f->head, h.data, item_pair.data);
 #endif /* TS_HAS_128BIT_CAS */
   }
 
-  ink_atomic_increment((int *) &f->used, -1 * num_item);
-  ink_atomic_increment(&fastalloc_mem_in_use, -(int64_t) f->type_size * num_item);
-#else /* TS_USE_RECLAIMABLE_FREELIST */
+  ink_atomic_increment((int *)&f->used, -1 * num_item);
+  ink_atomic_increment(&fastalloc_mem_in_use, -(int64_t)f->type_size * num_item);
+#else  /* TS_USE_RECLAIMABLE_FREELIST */
   // Avoid compiler warnings
   (void)f;
   (void)head;
   (void)tail;
   (void)num_item;
 #endif /* !TS_USE_RECLAIMABLE_FREELIST */
-#else /* !TS_USE_FREELIST */
-  void * item = head;
+#else  /* !TS_USE_FREELIST */
+  void *item = head;
 
   // Avoid compiler warnings
   (void)tail;
@@ -395,12 +389,12 @@ ink_freelists_snap_baseline()
     fll = fll->next;
   }
 #else // ! TS_USE_FREELIST
-  // TODO?
+// TODO?
 #endif
 }
 
 void
-ink_freelists_dump_baselinerel(FILE * f)
+ink_freelists_dump_baselinerel(FILE *f)
 {
 #if TS_USE_FREELIST
   ink_freelist_list *fll;
@@ -417,8 +411,8 @@ ink_freelists_dump_baselinerel(FILE * f)
     if (a != 0) {
       fprintf(f, " %18" PRIu64 " | %18" PRIu64 " | %7u | %10u | memory/%s\n",
               (uint64_t)(fll->fl->allocated - fll->fl->allocated_base) * (uint64_t)fll->fl->type_size,
-              (uint64_t)(fll->fl->used- fll->fl->used_base) * (uint64_t)fll->fl->type_size,
-              fll->fl->used - fll->fl->used_base, fll->fl->type_size, fll->fl->name ? fll->fl->name : "<unknown>");
+              (uint64_t)(fll->fl->used - fll->fl->used_base) * (uint64_t)fll->fl->type_size, fll->fl->used - fll->fl->used_base,
+              fll->fl->type_size, fll->fl->name ? fll->fl->name : "<unknown>");
     }
     fll = fll->next;
   }
@@ -428,7 +422,7 @@ ink_freelists_dump_baselinerel(FILE * f)
 }
 
 void
-ink_freelists_dump(FILE * f)
+ink_freelists_dump(FILE *f)
 {
 #if TS_USE_FREELIST
   ink_freelist_list *fll;
@@ -440,9 +434,9 @@ ink_freelists_dump(FILE * f)
 
   fll = freelists;
   while (fll) {
-    fprintf(f, " %18" PRIu64 " | %18" PRIu64 " | %10u | memory/%s\n",
-            (uint64_t)fll->fl->allocated * (uint64_t)fll->fl->type_size,
-            (uint64_t)fll->fl->used * (uint64_t)fll->fl->type_size, fll->fl->type_size, fll->fl->name ? fll->fl->name : "<unknown>");
+    fprintf(f, " %18" PRIu64 " | %18" PRIu64 " | %10u | memory/%s\n", (uint64_t)fll->fl->allocated * (uint64_t)fll->fl->type_size,
+            (uint64_t)fll->fl->used * (uint64_t)fll->fl->type_size, fll->fl->type_size,
+            fll->fl->name ? fll->fl->name : "<unknown>");
     fll = fll->next;
   }
 #else // ! TS_USE_FREELIST
@@ -452,7 +446,7 @@ ink_freelists_dump(FILE * f)
 
 
 void
-ink_atomiclist_init(InkAtomicList * l, const char *name, uint32_t offset_to_next)
+ink_atomiclist_init(InkAtomicList *l, const char *name, uint32_t offset_to_next)
 {
   l->name = name;
   l->offset = offset_to_next;
@@ -460,7 +454,7 @@ ink_atomiclist_init(InkAtomicList * l, const char *name, uint32_t offset_to_next
 }
 
 void *
-ink_atomiclist_pop(InkAtomicList * l)
+ink_atomiclist_pop(InkAtomicList *l)
 {
   head_p item;
   head_p next;
@@ -469,15 +463,13 @@ ink_atomiclist_pop(InkAtomicList * l)
     INK_QUEUE_LD(item, l->head);
     if (TO_PTR(FREELIST_POINTER(item)) == NULL)
       return NULL;
-    SET_FREELIST_POINTER_VERSION(next, *ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), l->offset),
-                                 FREELIST_VERSION(item) + 1);
+    SET_FREELIST_POINTER_VERSION(next, *ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), l->offset), FREELIST_VERSION(item) + 1);
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*) & l->head.data, item.data, next.data);
+    result = ink_atomic_cas((__int128_t *)&l->head.data, item.data, next.data);
 #else
-       result = ink_atomic_cas((int64_t *) & l->head.data, item.data, next.data);
+    result = ink_atomic_cas((int64_t *)&l->head.data, item.data, next.data);
 #endif
-  }
-  while (result == 0);
+  } while (result == 0);
   {
     void *ret = TO_PTR(FREELIST_POINTER(item));
     *ADDRESS_OF_NEXT(ret, l->offset) = NULL;
@@ -486,7 +478,7 @@ ink_atomiclist_pop(InkAtomicList * l)
 }
 
 void *
-ink_atomiclist_popall(InkAtomicList * l)
+ink_atomiclist_popall(InkAtomicList *l)
 {
   head_p item;
   head_p next;
@@ -497,12 +489,11 @@ ink_atomiclist_popall(InkAtomicList * l)
       return NULL;
     SET_FREELIST_POINTER_VERSION(next, FROM_PTR(NULL), FREELIST_VERSION(item) + 1);
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*) & l->head.data, item.data, next.data);
+    result = ink_atomic_cas((__int128_t *)&l->head.data, item.data, next.data);
 #else
-       result = ink_atomic_cas((int64_t *) & l->head.data, item.data, next.data);
+    result = ink_atomic_cas((int64_t *)&l->head.data, item.data, next.data);
 #endif
-  }
-  while (result == 0);
+  } while (result == 0);
   {
     void *ret = TO_PTR(FREELIST_POINTER(item));
     void *e = ret;
@@ -517,9 +508,9 @@ ink_atomiclist_popall(InkAtomicList * l)
 }
 
 void *
-ink_atomiclist_push(InkAtomicList * l, void *item)
+ink_atomiclist_push(InkAtomicList *l, void *item)
 {
-  volatile void **adr_of_next = (volatile void **) ADDRESS_OF_NEXT(item, l->offset);
+  volatile void **adr_of_next = (volatile void **)ADDRESS_OF_NEXT(item, l->offset);
   head_p head;
   head_p item_pair;
   int result = 0;
@@ -532,18 +523,17 @@ ink_atomiclist_push(InkAtomicList * l, void *item)
     SET_FREELIST_POINTER_VERSION(item_pair, FROM_PTR(item), FREELIST_VERSION(head));
     INK_MEMORY_BARRIER;
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*) & l->head, head.data, item_pair.data);
+    result = ink_atomic_cas((__int128_t *)&l->head, head.data, item_pair.data);
 #else
-       result = ink_atomic_cas((int64_t *) & l->head, head.data, item_pair.data);
+    result = ink_atomic_cas((int64_t *)&l->head, head.data, item_pair.data);
 #endif
-  }
-  while (result == 0);
+  } while (result == 0);
 
   return TO_PTR(h);
 }
 
 void *
-ink_atomiclist_remove(InkAtomicList * l, void *item)
+ink_atomiclist_remove(InkAtomicList *l, void *item)
 {
   head_p head;
   void *prev = NULL;
@@ -559,9 +549,9 @@ ink_atomiclist_remove(InkAtomicList * l, void *item)
     head_p next;
     SET_FREELIST_POINTER_VERSION(next, item_next, FREELIST_VERSION(head) + 1);
 #if TS_HAS_128BIT_CAS
-       result = ink_atomic_cas((__int128_t*) & l->head.data, head.data, next.data);
+    result = ink_atomic_cas((__int128_t *)&l->head.data, head.data, next.data);
 #else
-       result = ink_atomic_cas((int64_t *) & l->head.data, head.data, next.data);
+    result = ink_atomic_cas((int64_t *)&l->head.data, head.data, next.data);
 #endif
 
     if (result) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_queue.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue.h b/lib/ts/ink_queue.h
index 37e0953..8570d47 100644
--- a/lib/ts/ink_queue.h
+++ b/lib/ts/ink_queue.h
@@ -58,53 +58,50 @@
 */
 
 #ifdef __cplusplus
-extern "C"
-{
-#endif                          /* __cplusplus */
+extern "C" {
+#endif /* __cplusplus */
 
-  extern int fastmemtotal;
+extern int fastmemtotal;
 
-  void ink_queue_load_64(void *dst, void *src);
+void ink_queue_load_64(void *dst, void *src);
 
 #ifdef __x86_64__
-#define INK_QUEUE_LD64(dst,src) *((uint64_t*)&(dst)) = *((uint64_t*)&(src))
+#define INK_QUEUE_LD64(dst, src) *((uint64_t *)&(dst)) = *((uint64_t *)&(src))
 #else
-#define INK_QUEUE_LD64(dst,src) (ink_queue_load_64((void *)&(dst), (void *)&(src)))
+#define INK_QUEUE_LD64(dst, src) (ink_queue_load_64((void *)&(dst), (void *)&(src)))
 #endif
 
 #if TS_HAS_128BIT_CAS
-#define INK_QUEUE_LD(dst, src) do { \
-  *(__int128_t*)&(dst) = __sync_val_compare_and_swap((__int128_t*)&(src), 0, 0); \
-} while (0)
+#define INK_QUEUE_LD(dst, src)                                                         \
+  do {                                                                                 \
+    *(__int128_t *) & (dst) = __sync_val_compare_and_swap((__int128_t *)&(src), 0, 0); \
+  } while (0)
 #else
-#define INK_QUEUE_LD(dst,src) INK_QUEUE_LD64(dst,src)
+#define INK_QUEUE_LD(dst, src) INK_QUEUE_LD64(dst, src)
 #endif
 
 /*
  * Generic Free List Manager
  */
-  // Warning: head_p is read and written in multiple threads without a
-  // lock, use INK_QUEUE_LD to read safely.
-  typedef union
-  {
+// Warning: head_p is read and written in multiple threads without a
+// lock, use INK_QUEUE_LD to read safely.
+typedef union {
 #if (defined(__i386__) || defined(__arm__) || defined(__mips__)) && (SIZEOF_VOIDP == 4)
-    struct
-    {
-      void *pointer;
-      int32_t version;
-    } s;
-    int64_t data;
+  struct {
+    void *pointer;
+    int32_t version;
+  } s;
+  int64_t data;
 #elif TS_HAS_128BIT_CAS
-    struct
-    {
-      void *pointer;
-      int64_t version;
-    } s;
-    __int128_t data;
+  struct {
+    void *pointer;
+    int64_t version;
+  } s;
+  __int128_t data;
 #else
-    int64_t data;
+  int64_t data;
 #endif
-  } head_p;
+} head_p;
 
 /*
  * Why is version required? One scenario is described below
@@ -119,103 +116,99 @@ extern "C"
 #define ZERO_HEAD_P(_x)
 
 #ifdef DEBUG
-#define FROM_PTR(_x) (void*)(((uintptr_t)_x)+1)
-#define TO_PTR(_x) (void*)(((uintptr_t)_x)-1)
+#define FROM_PTR(_x) (void *)(((uintptr_t)_x) + 1)
+#define TO_PTR(_x) (void *)(((uintptr_t)_x) - 1)
 #else
-#define FROM_PTR(_x) ((void*)(_x))
-#define TO_PTR(_x) ((void*)(_x))
+#define FROM_PTR(_x) ((void *)(_x))
+#define TO_PTR(_x) ((void *)(_x))
 #endif
 
 #if (defined(__i386__) || defined(__arm__) || defined(__mips__)) && (SIZEOF_VOIDP == 4)
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
-#define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
-(_x).s.pointer = _p; (_x).s.version = _v
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) \
+  (_x).s.pointer = _p;                           \
+  (_x).s.version = _v
 #elif TS_HAS_128BIT_CAS
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
-#define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
-(_x).s.pointer = _p; (_x).s.version = _v
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) \
+  (_x).s.pointer = _p;                           \
+  (_x).s.version = _v
 #elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__aarch64__)
-#define FREELIST_POINTER(_x) ((void*)(((((intptr_t)(_x).data)<<16)>>16) | \
- (((~((((intptr_t)(_x).data)<<16>>63)-1))>>48)<<48)))  // sign extend
-#define FREELIST_VERSION(_x) (((intptr_t)(_x).data)>>48)
-#define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
-  (_x).data = ((((intptr_t)(_p))&0x0000FFFFFFFFFFFFULL) | (((_v)&0xFFFFULL) << 48))
+#define FREELIST_POINTER(_x) \
+  ((void *)(((((intptr_t)(_x).data) << 16) >> 16) | (((~((((intptr_t)(_x).data) << 16 >> 63) - 1)) >> 48) << 48))) // sign extend
+#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48)
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x0000FFFFFFFFFFFFULL) | (((_v)&0xFFFFULL) << 48))
 #else
 #error "unsupported processor"
 #endif
 
 #if TS_USE_RECLAIMABLE_FREELIST
-  extern float cfg_reclaim_factor;
-  extern int64_t cfg_max_overage;
-  extern int64_t cfg_enable_reclaim;
-  extern int64_t cfg_debug_filter;
+extern float cfg_reclaim_factor;
+extern int64_t cfg_max_overage;
+extern int64_t cfg_enable_reclaim;
+extern int64_t cfg_debug_filter;
 #else
-  struct _InkFreeList
-  {
-    volatile head_p head;
-    const char *name;
-    uint32_t type_size, chunk_size, used, allocated, alignment;
-    uint32_t allocated_base, used_base;
-    int advice;
-  };
-
-  inkcoreapi extern volatile int64_t fastalloc_mem_in_use;
-  inkcoreapi extern volatile int64_t fastalloc_mem_total;
-  inkcoreapi extern volatile int64_t freelist_allocated_mem;
+struct _InkFreeList {
+  volatile head_p head;
+  const char *name;
+  uint32_t type_size, chunk_size, used, allocated, alignment;
+  uint32_t allocated_base, used_base;
+  int advice;
+};
+
+inkcoreapi extern volatile int64_t fastalloc_mem_in_use;
+inkcoreapi extern volatile int64_t fastalloc_mem_total;
+inkcoreapi extern volatile int64_t freelist_allocated_mem;
 #endif
 
-  typedef struct _InkFreeList InkFreeList, *PInkFreeList;
-  typedef struct _ink_freelist_list
-  {
-    InkFreeList *fl;
-    struct _ink_freelist_list *next;
-  } ink_freelist_list;
-  extern ink_freelist_list *freelists;
-
-  /*
-   * alignment must be a power of 2
-   */
-  InkFreeList *ink_freelist_create(const char *name, uint32_t type_size,
-                                   uint32_t chunk_size, uint32_t alignment);
-
-  inkcoreapi void ink_freelist_init(InkFreeList **fl, const char *name,
-                                    uint32_t type_size, uint32_t chunk_size,
-                                    uint32_t alignment);
-  inkcoreapi void ink_freelist_madvise_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment, int advice);
-  inkcoreapi void *ink_freelist_new(InkFreeList * f);
-  inkcoreapi void ink_freelist_free(InkFreeList * f, void *item);
-  inkcoreapi void ink_freelist_free_bulk(InkFreeList * f, void *head, void *tail, size_t num_item);
-  void ink_freelists_dump(FILE * f);
-  void ink_freelists_dump_baselinerel(FILE * f);
-  void ink_freelists_snap_baseline();
-
-  typedef struct
-  {
-    volatile head_p head;
-    const char *name;
-    uint32_t offset;
-  } InkAtomicList;
+typedef struct _InkFreeList InkFreeList, *PInkFreeList;
+typedef struct _ink_freelist_list {
+  InkFreeList *fl;
+  struct _ink_freelist_list *next;
+} ink_freelist_list;
+extern ink_freelist_list *freelists;
+
+/*
+ * alignment must be a power of 2
+ */
+InkFreeList *ink_freelist_create(const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment);
+
+inkcoreapi void ink_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment);
+inkcoreapi void ink_freelist_madvise_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size,
+                                          uint32_t alignment, int advice);
+inkcoreapi void *ink_freelist_new(InkFreeList *f);
+inkcoreapi void ink_freelist_free(InkFreeList *f, void *item);
+inkcoreapi void ink_freelist_free_bulk(InkFreeList *f, void *head, void *tail, size_t num_item);
+void ink_freelists_dump(FILE *f);
+void ink_freelists_dump_baselinerel(FILE *f);
+void ink_freelists_snap_baseline();
+
+typedef struct {
+  volatile head_p head;
+  const char *name;
+  uint32_t offset;
+} InkAtomicList;
 
 #if !defined(INK_QUEUE_NT)
 #define INK_ATOMICLIST_EMPTY(_x) (!(TO_PTR(FREELIST_POINTER((_x.head)))))
 #else
-  /* ink_queue_nt.c doesn't do the FROM/TO pointer swizzling */
-#define INK_ATOMICLIST_EMPTY(_x) (!(      (FREELIST_POINTER((_x.head)))))
+/* ink_queue_nt.c doesn't do the FROM/TO pointer swizzling */
+#define INK_ATOMICLIST_EMPTY(_x) (!((FREELIST_POINTER((_x.head)))))
 #endif
 
-  inkcoreapi void ink_atomiclist_init(InkAtomicList * l, const char *name, uint32_t offset_to_next);
-  inkcoreapi void *ink_atomiclist_push(InkAtomicList * l, void *item);
-  void *ink_atomiclist_pop(InkAtomicList * l);
-  inkcoreapi void *ink_atomiclist_popall(InkAtomicList * l);
+inkcoreapi void ink_atomiclist_init(InkAtomicList *l, const char *name, uint32_t offset_to_next);
+inkcoreapi void *ink_atomiclist_push(InkAtomicList *l, void *item);
+void *ink_atomiclist_pop(InkAtomicList *l);
+inkcoreapi void *ink_atomiclist_popall(InkAtomicList *l);
 /*
  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  * only if only one thread is doing pops it is possible to have a "remove"
  * which only that thread can use as well.
  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  */
-  void *ink_atomiclist_remove(InkAtomicList * l, void *item);
+void *ink_atomiclist_remove(InkAtomicList *l, void *item);
 
 #ifdef __cplusplus
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_queue_ext.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue_ext.cc b/lib/ts/ink_queue_ext.cc
index ac99667..9687a74 100644
--- a/lib/ts/ink_queue_ext.cc
+++ b/lib/ts/ink_queue_ext.cc
@@ -45,11 +45,11 @@
 
 #if TS_USE_RECLAIMABLE_FREELIST
 
-#define CEIL(x,y)   (((x) + (y) - 1L) / (y))
-#define ROUND(x,l)  (((x) + ((l) - 1L)) & ~((l) - 1L))
+#define CEIL(x, y) (((x) + (y)-1L) / (y))
+#define ROUND(x, l) (((x) + ((l)-1L)) & ~((l)-1L))
 #define ITEM_MAGIC 0xFF
 
-#define MAX_NUM_FREELIST  1024
+#define MAX_NUM_FREELIST 1024
 
 /*
  * Configurable Variables
@@ -74,34 +74,21 @@ static __thread InkThreadCache *ThreadCaches[MAX_NUM_FREELIST];
 /*
  * For debug
  */
-#define show_info(tag, f, pCache) \
-  __show_info(stdout, __FILE__, __LINE__, tag, f, pCache)
-#define error_info(tag, f, pCache) \
-  __show_info(stderr, __FILE__, __LINE__, tag, f, pCache)
+#define show_info(tag, f, pCache) __show_info(stdout, __FILE__, __LINE__, tag, f, pCache)
+#define error_info(tag, f, pCache) __show_info(stderr, __FILE__, __LINE__, tag, f, pCache)
 
 static inline void
-__show_info(FILE *fp, const char *file, int line,
-            const char *tag, InkFreeList *f, InkThreadCache *pCache)
+__show_info(FILE *fp, const char *file, int line, const char *tag, InkFreeList *f, InkThreadCache *pCache)
 {
-
   fprintf(fp, "[%lx:%02u][%s:%05d][%s] %6.2fM t:%-8uf:%-4u m:%-4u avg:%-6.1f"
-          " M:%-4u csbase:%-4u csize:%-4u tsize:%-6u cbsize:%u\n",
-         (long)ink_thread_self(), f->thread_cache_idx, file, line, tag,
-         ((double)total_mem_in_byte/1024/1024),
-         pCache->nr_total,
-         pCache->nr_free,
-         pCache->nr_min,
-         pCache->nr_average,
-         pCache->nr_malloc,
-         f->chunk_size_base,
-         f->chunk_size,
-         f->type_size,
-         f->chunk_byte_size);
+              " M:%-4u csbase:%-4u csize:%-4u tsize:%-6u cbsize:%u\n",
+          (long)ink_thread_self(), f->thread_cache_idx, file, line, tag, ((double)total_mem_in_byte / 1024 / 1024),
+          pCache->nr_total, pCache->nr_free, pCache->nr_min, pCache->nr_average, pCache->nr_malloc, f->chunk_size_base,
+          f->chunk_size, f->type_size, f->chunk_byte_size);
 }
 
 static inline void
-memory_alignment_init(InkFreeList *f, uint32_t type_size, uint32_t chunk_size,
-                      uint32_t alignment)
+memory_alignment_init(InkFreeList *f, uint32_t type_size, uint32_t chunk_size, uint32_t alignment)
 {
   uint32_t chunk_byte_size, user_alignment, user_type_size;
 
@@ -128,14 +115,11 @@ memory_alignment_init(InkFreeList *f, uint32_t type_size, uint32_t chunk_size,
   alignment = ats_pagesize();
   chunk_byte_size = ROUND(type_size + sizeof(InkChunkInfo), ats_pagesize());
   if (chunk_byte_size <= MAX_CHUNK_BYTE_SIZE) {
-
-    chunk_byte_size = ROUND(type_size * f->chunk_size_base
-                            + sizeof(InkChunkInfo), ats_pagesize());
+    chunk_byte_size = ROUND(type_size * f->chunk_size_base + sizeof(InkChunkInfo), ats_pagesize());
 
     if (chunk_byte_size > MAX_CHUNK_BYTE_SIZE) {
       chunk_size = (MAX_CHUNK_BYTE_SIZE - sizeof(InkChunkInfo)) / type_size;
-      chunk_byte_size = ROUND(type_size * chunk_size + sizeof(InkChunkInfo),
-                              ats_pagesize());
+      chunk_byte_size = ROUND(type_size * chunk_size + sizeof(InkChunkInfo), ats_pagesize());
     } else
       chunk_size = (chunk_byte_size - sizeof(InkChunkInfo)) / type_size;
 
@@ -169,8 +153,9 @@ memory_alignment_init(InkFreeList *f, uint32_t type_size, uint32_t chunk_size,
  *  1)the _size_ must be a multiple of page_size;
  *  2)the _alignment_ must be a power of page_size;
  */
-static void*
-mmap_align(size_t size, size_t alignment) {
+static void *
+mmap_align(size_t size, size_t alignment)
+{
   uintptr_t ptr;
   size_t adjust, extra = 0;
 
@@ -180,17 +165,13 @@ mmap_align(size_t size, size_t alignment) {
   if (alignment > ats_pagesize()) {
     extra = alignment - ats_pagesize();
   }
-  void* result = mmap(NULL, size + extra,
-                      PROT_READ|PROT_WRITE,
-                      MAP_PRIVATE|MAP_ANON,
-                      -1, 0);
+  void *result = mmap(NULL, size + extra, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
   if (result == MAP_FAILED) {
     ink_stack_trace_dump();
     const char *err_str = "Out of memory, or the process's maximum number of "
                           "mappings would have been exceeded(if so, you can "
                           "enlarge 'vm.max_map_count' by sysctl in linux).";
-    ink_fatal("Failed to mmap %zu bytes, %s", size,
-              (errno == ENOMEM) ? err_str : strerror(errno));
+    ink_fatal("Failed to mmap %zu bytes, %s", size, (errno == ENOMEM) ? err_str : strerror(errno));
   }
 
   /* adjust the return memory so it is aligned */
@@ -202,21 +183,20 @@ mmap_align(size_t size, size_t alignment) {
 
   /* return the unused memory to the system */
   if (adjust > 0) {
-    munmap((void*)ptr, adjust);
+    munmap((void *)ptr, adjust);
   }
   if (adjust < extra) {
-    munmap((void*)(ptr + adjust + size), extra - adjust);
+    munmap((void *)(ptr + adjust + size), extra - adjust);
   }
 
   ptr += adjust;
-  ink_assert((ptr & (alignment -1)) == 0);
-  return (void*)ptr;
+  ink_assert((ptr & (alignment - 1)) == 0);
+  return (void *)ptr;
 }
 
 #ifdef DEBUG
 static inline uint32_t
-get_chunk_item_magic_idx(InkFreeList *f, void *item, InkChunkInfo **ppChunk,
-                          bool do_check = false)
+get_chunk_item_magic_idx(InkFreeList *f, void *item, InkChunkInfo **ppChunk, bool do_check = false)
 {
   uint32_t idx;
   uintptr_t chunk_addr;
@@ -231,11 +211,10 @@ get_chunk_item_magic_idx(InkFreeList *f, void *item, InkChunkInfo **ppChunk,
 
   idx = ((uintptr_t)item - chunk_addr) / f->type_size;
 
-  if (do_check && (idx >= f->chunk_size
-                   || ((uintptr_t)item - chunk_addr) % f->type_size)) {
+  if (do_check && (idx >= f->chunk_size || ((uintptr_t)item - chunk_addr) % f->type_size)) {
     ink_stack_trace_dump();
-    ink_fatal("Invalid address:%p, chunk_addr:%p, type_size:%d, chunk_size:%u, idx:%u",
-              item, (void *)chunk_addr, f->type_size, f->chunk_size, idx);
+    ink_fatal("Invalid address:%p, chunk_addr:%p, type_size:%d, chunk_size:%u, idx:%u", item, (void *)chunk_addr, f->type_size,
+              f->chunk_size, idx);
   }
 
   return idx;
@@ -306,11 +285,11 @@ ink_chunk_create(InkFreeList *f, InkThreadCache *pCache)
   pChunk->link = Link<InkChunkInfo>();
 
 #ifdef DEBUG
-  /*
-   * The content will be initialized to zero when
-   * calls mmap() with MAP_ANONYMOUS flag on linux
-   * platform.
-   */
+/*
+ * The content will be initialized to zero when
+ * calls mmap() with MAP_ANONYMOUS flag on linux
+ * platform.
+ */
 #if !defined(linux)
   memset(pChunk->item_magic, 0, chunk_size * sizeof(unsigned char));
 #endif
@@ -388,13 +367,12 @@ malloc_whole_chunk(InkFreeList *f, InkThreadCache *pCache, InkChunkInfo *pChunk)
 }
 
 static inline void *
-malloc_from_chunk(InkFreeList * /* f ATS_UNUSED */,
-                  InkThreadCache *pCache, InkChunkInfo *pChunk)
+malloc_from_chunk(InkFreeList * /* f ATS_UNUSED */, InkThreadCache *pCache, InkChunkInfo *pChunk)
 {
   void *item;
 
   if ((item = pChunk->inner_free_list)) {
-    pChunk->inner_free_list  = *(void **)item;
+    pChunk->inner_free_list = *(void **)item;
     pChunk->allocated++;
     pCache->nr_total++;
   }
@@ -479,8 +457,7 @@ refresh_average_info(InkThreadCache *pCache)
   if (pCache->status == 1 || nr_free < pCache->nr_min)
     pCache->nr_min = nr_free;
 
-  pCache->nr_average = (nr_average * (1 - cfg_reclaim_factor)) +
-                       (nr_free * cfg_reclaim_factor);
+  pCache->nr_average = (nr_average * (1 - cfg_reclaim_factor)) + (nr_free * cfg_reclaim_factor);
 }
 
 static inline bool
@@ -489,8 +466,7 @@ need_to_reclaim(InkFreeList *f, InkThreadCache *pCache)
   if (!cfg_enable_reclaim)
     return false;
 
-  if(pCache->nr_free >= pCache->nr_average &&
-     pCache->nr_total > f->chunk_size_base) {
+  if (pCache->nr_free >= pCache->nr_average && pCache->nr_total > f->chunk_size_base) {
     if (pCache->nr_overage++ >= cfg_max_overage) {
       pCache->nr_overage = 0;
       return true;
@@ -503,9 +479,7 @@ need_to_reclaim(InkFreeList *f, InkThreadCache *pCache)
 }
 
 void
-reclaimable_freelist_init(InkFreeList **fl, const char *name,
-                          uint32_t type_size, uint32_t chunk_size,
-                          uint32_t alignment)
+reclaimable_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment)
 {
   InkFreeList *f;
   ink_freelist_list *fll = freelists;
@@ -564,7 +538,7 @@ reclaimable_freelist_new(InkFreeList *f)
 
   /* no thread cache, create it */
   if (unlikely((pCache = ThreadCaches[f->thread_cache_idx]) == NULL)) {
-    pCache = (InkThreadCache *) ats_calloc(1, sizeof(InkThreadCache));
+    pCache = (InkThreadCache *)ats_calloc(1, sizeof(InkThreadCache));
 
     pCache->f = f;
     pCache->free_chunk_list = DLL<InkChunkInfo>();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_queue_ext.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue_ext.h b/lib/ts/ink_queue_ext.h
index 22ee6c4..4ff8402 100644
--- a/lib/ts/ink_queue_ext.h
+++ b/lib/ts/ink_queue_ext.h
@@ -34,107 +34,101 @@
 #include "ink_queue.h"
 
 #ifdef __cplusplus
-extern "C"
-{
-#endif                          /* __cplusplus */
+extern "C" {
+#endif /* __cplusplus */
 #if TS_USE_RECLAIMABLE_FREELIST
-  struct _InkThreadCache;
-  struct _InkFreeList;
+struct _InkThreadCache;
+struct _InkFreeList;
 
-  typedef struct _InkChunkInfo
-  {
-    pthread_t tid;
+typedef struct _InkChunkInfo {
+  pthread_t tid;
 
-    uint32_t type_size;
-    uint32_t chunk_size;
-    uint32_t allocated;
-    uint32_t length;
+  uint32_t type_size;
+  uint32_t chunk_size;
+  uint32_t allocated;
+  uint32_t length;
 
-    /*
-     * inner free list will only be
-     * accessed by creator-thread
-     */
-    void *inner_free_list;
-    void *head;
+  /*
+   * inner free list will only be
+   * accessed by creator-thread
+   */
+  void *inner_free_list;
+  void *head;
 
-    struct _InkThreadCache *pThreadCache;
+  struct _InkThreadCache *pThreadCache;
 
-    LINK(_InkChunkInfo, link);
+  LINK(_InkChunkInfo, link);
 
 #ifdef DEBUG
-    /*
-     * magic code for each item,
-     * it's used to check double-free issue.
-     */
-    unsigned char item_magic[0];
+  /*
+   * magic code for each item,
+   * it's used to check double-free issue.
+   */
+  unsigned char item_magic[0];
 #endif
-  } InkChunkInfo;
-
-  typedef struct _InkThreadCache
-  {
-    struct _InkFreeList *f;
-
-    /* outer free list will be accessed by:
-     * - creator-thread, asa producer-thread
-     * - consumer-thread
-     * - neighbor-thread
-     */
-    InkAtomicList outer_free_list;
-
-    /* using for memory reclaim algorithm */
-    float nr_average;
-    uint32_t nr_total;
-    uint32_t nr_free;
-    uint32_t nr_min;
-    uint32_t nr_overage;
-    uint32_t nr_malloc;
-
-    /* represent the status(state) of allocator: Malloc-ing(0) or Free-ing(1),
-     * I use it as an simple state machine - calculating the minimum of free
-     * memory only when the status change from Malloc-ing to Free-ing.
-     */
-    uint32_t status;
-
-    uint32_t nr_free_chunks;
-    DLL<InkChunkInfo> free_chunk_list;
-
-    _InkThreadCache *prev, *next;
-  } InkThreadCache;
-
-  typedef struct _InkFreeList
-  {
-    uint32_t thread_cache_idx;
-
-    uint32_t refcnt;
-    const char *name;
-
-    uint32_t type_size;
-    uint32_t alignment;
-
-    /* number of elements in one chunk */
-    uint32_t chunk_size;
-    /* total byte size of one chuck */
-    uint32_t chunk_byte_size;
-    /* chunk_addr = (uintptr_t)ptr & chunk_addr_mask */
-    uintptr_t chunk_addr_mask;
-
-    uint32_t used;
-    uint32_t allocated;
-    uint32_t allocated_base;
-    uint32_t used_base;
-    uint32_t chunk_size_base;
-
-    uint32_t nr_thread_cache;
-    InkThreadCache *pThreadCache;
-    ink_mutex lock;
-  } InkFreeList, *PInkFreeList;
-
-  /* reclaimable freelist API */
-  void reclaimable_freelist_init(InkFreeList **fl, const char *name,
-                                 uint32_t type_size, uint32_t chunk_size,
-                                 uint32_t alignment);
-  void *reclaimable_freelist_new(InkFreeList *f);
-  void reclaimable_freelist_free(InkFreeList *f, void *item);
+} InkChunkInfo;
+
+typedef struct _InkThreadCache {
+  struct _InkFreeList *f;
+
+  /* outer free list will be accessed by:
+   * - creator-thread, asa producer-thread
+   * - consumer-thread
+   * - neighbor-thread
+   */
+  InkAtomicList outer_free_list;
+
+  /* using for memory reclaim algorithm */
+  float nr_average;
+  uint32_t nr_total;
+  uint32_t nr_free;
+  uint32_t nr_min;
+  uint32_t nr_overage;
+  uint32_t nr_malloc;
+
+  /* represent the status(state) of allocator: Malloc-ing(0) or Free-ing(1),
+   * I use it as an simple state machine - calculating the minimum of free
+   * memory only when the status change from Malloc-ing to Free-ing.
+   */
+  uint32_t status;
+
+  uint32_t nr_free_chunks;
+  DLL<InkChunkInfo> free_chunk_list;
+
+  _InkThreadCache *prev, *next;
+} InkThreadCache;
+
+typedef struct _InkFreeList {
+  uint32_t thread_cache_idx;
+
+  uint32_t refcnt;
+  const char *name;
+
+  uint32_t type_size;
+  uint32_t alignment;
+
+  /* number of elements in one chunk */
+  uint32_t chunk_size;
+  /* total byte size of one chuck */
+  uint32_t chunk_byte_size;
+  /* chunk_addr = (uintptr_t)ptr & chunk_addr_mask */
+  uintptr_t chunk_addr_mask;
+
+  uint32_t used;
+  uint32_t allocated;
+  uint32_t allocated_base;
+  uint32_t used_base;
+  uint32_t chunk_size_base;
+
+  uint32_t nr_thread_cache;
+  InkThreadCache *pThreadCache;
+  ink_mutex lock;
+} InkFreeList, *PInkFreeList;
+
+/* reclaimable freelist API */
+void reclaimable_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32_t chunk_size, uint32_t alignment);
+void *reclaimable_freelist_new(InkFreeList *f);
+void reclaimable_freelist_free(InkFreeList *f, void *item);
 #endif /* END OF TS_USE_RECLAIMABLE_FREELIST */
 #ifdef __cplusplus
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_queue_utils.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue_utils.cc b/lib/ts/ink_queue_utils.cc
index f93898b..25b5b6e 100644
--- a/lib/ts/ink_queue_utils.cc
+++ b/lib/ts/ink_queue_utils.cc
@@ -69,12 +69,12 @@ void
 ink_queue_load_64(void *dst, void *src)
 {
 #if (defined(__i386__) || defined(__arm__) || defined(__mips__)) && (SIZEOF_VOIDP == 4)
-  volatile int32_t src_version = (*(head_p *) src).s.version;
-  void *src_pointer = (*(head_p *) src).s.pointer;
+  volatile int32_t src_version = (*(head_p *)src).s.version;
+  void *src_pointer = (*(head_p *)src).s.pointer;
 
-  (*(head_p *) dst).s.version = src_version;
-  (*(head_p *) dst).s.pointer = src_pointer;
+  (*(head_p *)dst).s.version = src_version;
+  (*(head_p *)dst).s.pointer = src_pointer;
 #else
-  *(void**)dst = *(void**)src;
+  *(void **)dst = *(void **)src;
 #endif
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_rand.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_rand.cc b/lib/ts/ink_rand.cc
index e9989e0..b4c780f 100644
--- a/lib/ts/ink_rand.cc
+++ b/lib/ts/ink_rand.cc
@@ -61,35 +61,40 @@
 #define MM 156
 #define MATRIX_A 0xB5026F5AA96619E9ULL
 #define UM 0xFFFFFFFF80000000ULL /* Most significant 33 bits */
-#define LM 0x7FFFFFFFULL /* Least significant 31 bits */
+#define LM 0x7FFFFFFFULL         /* Least significant 31 bits */
 
-static uint64_t mag01[2]={0ULL, MATRIX_A};
+static uint64_t mag01[2] = {0ULL, MATRIX_A};
 
-InkRand::InkRand(uint64_t d) {
+InkRand::InkRand(uint64_t d)
+{
   seed(d);
 }
 
-void InkRand::seed(uint64_t seed) {
+void
+InkRand::seed(uint64_t seed)
+{
   mt[0] = seed;
-  for (mti=1; mti<NN; mti++)
-    mt[mti] =  (6364136223846793005ULL * (mt[mti-1] ^ (mt[mti-1] >> 62)) + mti);
+  for (mti = 1; mti < NN; mti++)
+    mt[mti] = (6364136223846793005ULL * (mt[mti - 1] ^ (mt[mti - 1] >> 62)) + mti);
 }
 
-uint64_t InkRand::random() {
+uint64_t
+InkRand::random()
+{
   int i;
   uint64_t x;
 
   if (mti >= NN) { /* generate NN words at one time */
-    for (i=0;i<NN-MM;i++) {
-      x = (mt[i]&UM)|(mt[i+1]&LM);
-      mt[i] = mt[i+MM] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
+    for (i = 0; i < NN - MM; i++) {
+      x = (mt[i] & UM) | (mt[i + 1] & LM);
+      mt[i] = mt[i + MM] ^ (x >> 1) ^ mag01[(int)(x & 1ULL)];
     }
-    for (;i<NN-1;i++) {
-      x = (mt[i]&UM)|(mt[i+1]&LM);
-      mt[i] = mt[i+(MM-NN)] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
+    for (; i < NN - 1; i++) {
+      x = (mt[i] & UM) | (mt[i + 1] & LM);
+      mt[i] = mt[i + (MM - NN)] ^ (x >> 1) ^ mag01[(int)(x & 1ULL)];
     }
-    x = (mt[NN-1]&UM)|(mt[0]&LM);
-    mt[NN-1] = mt[MM-1] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
+    x = (mt[NN - 1] & UM) | (mt[0] & LM);
+    mt[NN - 1] = mt[MM - 1] ^ (x >> 1) ^ mag01[(int)(x & 1ULL)];
 
     mti = 0;
   }
@@ -104,6 +109,8 @@ uint64_t InkRand::random() {
   return x;
 }
 
-double InkRand::drandom() {
-  return (random() >> 11) * (1.0/9007199254740991.0);
+double
+InkRand::drandom()
+{
+  return (random() >> 11) * (1.0 / 9007199254740991.0);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_rand.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_rand.h b/lib/ts/ink_rand.h
index f9b78bd..93c4d51 100644
--- a/lib/ts/ink_rand.h
+++ b/lib/ts/ink_rand.h
@@ -80,9 +80,10 @@ private:
   int mti;
 };
 
-inline int ink_rand_r(uint32_t * p) {
-  return (((*p) = (*p) * 1103515245 + 12345) % ((uint32_t) 0x7fffffff + 1));
+inline int
+ink_rand_r(uint32_t *p)
+{
+  return (((*p) = (*p) * 1103515245 + 12345) % ((uint32_t)0x7fffffff + 1));
 }
 
 #endif /* __INK_RAND_H__ */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_res_init.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_res_init.cc b/lib/ts/ink_res_init.cc
index c9a0ed8..8dbe091 100644
--- a/lib/ts/ink_res_init.cc
+++ b/lib/ts/ink_res_init.cc
@@ -90,25 +90,17 @@
 #include "ink_inet.h"
 #include "Tokenizer.h"
 
-#if !defined(isascii)           /* XXX - could be a function */
-# define isascii(c) (!(c & 0200))
+#if !defined(isascii) /* XXX - could be a function */
+#define isascii(c) (!(c & 0200))
 #endif
 
-HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER = {
-  HOST_RES_PREFER_IPV4,
-  HOST_RES_PREFER_IPV6,
-  HOST_RES_PREFER_NONE
-};
+HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER = {HOST_RES_PREFER_IPV4, HOST_RES_PREFER_IPV6, HOST_RES_PREFER_NONE};
 
 HostResPreferenceOrder host_res_default_preference_order;
 
-char const* const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE] = {
-    "only", "client", "ipv4", "ipv6"
-};
+char const *const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE] = {"only", "client", "ipv4", "ipv6"};
 
-char const* const HOST_RES_STYLE_STRING[] = {
-  "invalid", "IPv4", "IPv4 only", "IPv6", "IPv6 only"
-};
+char const *const HOST_RES_STYLE_STRING[] = {"invalid", "IPv4", "IPv4 only", "IPv6", "IPv6 only"};
 
 /*%
  * This routine is for closing the socket if a virtual circuit is used and
@@ -118,16 +110,18 @@ char const* const HOST_RES_STYLE_STRING[] = {
  * This routine is not expected to be user visible.
  */
 static void
-ink_res_nclose(ink_res_state statp) {
+ink_res_nclose(ink_res_state statp)
+{
   if (statp->_vcsock >= 0) {
-    (void) close(statp->_vcsock);
+    (void)close(statp->_vcsock);
     statp->_vcsock = -1;
     statp->_flags &= ~(INK_RES_F_VC | INK_RES_F_CONN);
   }
 }
 
 static void
-ink_res_setservers(ink_res_state statp, IpEndpoint const* set, int cnt) {
+ink_res_setservers(ink_res_state statp, IpEndpoint const *set, int cnt)
+{
   /* close open servers */
   ink_res_nclose(statp);
 
@@ -139,8 +133,8 @@ ink_res_setservers(ink_res_state statp, IpEndpoint const* set, int cnt) {
      the destination and sourcea are the same.
   */
   int nserv = 0;
-  for ( IpEndpoint const* limit = set + cnt ; nserv < INK_MAXNS && set < limit ; ++set ) {
-    IpEndpoint* dst = &statp->nsaddr_list[nserv];
+  for (IpEndpoint const *limit = set + cnt; nserv < INK_MAXNS && set < limit; ++set) {
+    IpEndpoint *dst = &statp->nsaddr_list[nserv];
 
     if (dst == set) {
       if (ats_is_ip(&set->sa))
@@ -153,9 +147,10 @@ ink_res_setservers(ink_res_state statp, IpEndpoint const* set, int cnt) {
 }
 
 int
-ink_res_getservers(ink_res_state statp, sockaddr *set, int cnt) {
+ink_res_getservers(ink_res_state statp, sockaddr *set, int cnt)
+{
   int zret = 0; // return count.
-  IpEndpoint const* src = statp->nsaddr_list;
+  IpEndpoint const *src = statp->nsaddr_list;
 
   for (int i = 0; i < statp->nscount && i < cnt; ++i, ++src) {
     if (ats_ip_copy(set, &src->sa)) {
@@ -201,7 +196,7 @@ ink_res_setoptions(ink_res_state statp, const char *options, const char *source
       if (statp->options & INK_RES_DEBUG)
         printf(";;\ttimeout=%d\n", statp->retrans);
 #endif
-#ifdef	SOLARIS2
+#ifdef SOLARIS2
     } else if (!strncmp(cp, "retrans:", sizeof("retrans:") - 1)) {
       /*
        * For backward compatibility, 'retrans' is
@@ -209,15 +204,15 @@ ink_res_setoptions(ink_res_state statp, const char *options, const char *source
        * without an imposed maximum.
        */
       statp->retrans = atoi(cp + sizeof("retrans:") - 1);
-    } else if (!strncmp(cp, "retry:", sizeof("retry:") - 1)){
+    } else if (!strncmp(cp, "retry:", sizeof("retry:") - 1)) {
       /*
        * For backward compatibility, 'retry' is
        * supported as an alias for 'attempts', though
        * without an imposed maximum.
        */
       statp->retry = atoi(cp + sizeof("retry:") - 1);
-#endif	/* SOLARIS2 */
-    } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
+#endif /* SOLARIS2 */
+    } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)) {
       i = atoi(cp + sizeof("attempts:") - 1);
       if (i <= INK_RES_MAXRETRY)
         statp->retry = i;
@@ -252,8 +247,7 @@ ink_res_setoptions(ink_res_state statp, const char *options, const char *source
 #endif
     else if (!strncmp(cp, "dname", sizeof("dname") - 1)) {
       statp->options |= INK_RES_USE_DNAME;
-    }
-    else {
+    } else {
       /* XXX - print a warning here? */
     }
     /* skip to next run of spaces */
@@ -263,7 +257,8 @@ ink_res_setoptions(ink_res_state statp, const char *options, const char *source
 }
 
 static unsigned
-ink_res_randomid(void) {
+ink_res_randomid(void)
+{
   struct timeval now;
 
   gettimeofday(&now, NULL);
@@ -294,14 +289,14 @@ ink_res_randomid(void) {
  * @internal This function has to be reachable by res_data.c but not publically.
  */
 int
-ink_res_init(
-  ink_res_state statp, ///< State object to update.
-  IpEndpoint const* pHostList, ///< Additional servers.
-  size_t pHostListSize, ///< # of entries in @a pHostList.
-  const char *pDefDomain, ///< Default domain (may be NULL).
-  const char *pSearchList, ///< Unknown
-  const char *pResolvConf ///< Path to configuration file.
-) {
+ink_res_init(ink_res_state statp,         ///< State object to update.
+             IpEndpoint const *pHostList, ///< Additional servers.
+             size_t pHostListSize,        ///< # of entries in @a pHostList.
+             const char *pDefDomain,      ///< Default domain (may be NULL).
+             const char *pSearchList,     ///< Unknown
+             const char *pResolvConf      ///< Path to configuration file.
+             )
+{
   FILE *fp;
   char *cp, **pp;
   int n;
@@ -328,7 +323,7 @@ ink_res_init(
   statp->qhook = NULL;
   statp->rhook = NULL;
 
-#ifdef	SOLARIS2
+#ifdef SOLARIS2
   /*
    * The old libresolv derived the defaultdomain from NIS/NIS+.
    * We want to keep this behaviour
@@ -337,8 +332,7 @@ ink_res_init(
     char buf[sizeof(statp->defdname)], *cp;
     int ret;
 
-    if ((ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf))) > 0 &&
-        (unsigned int)ret <= sizeof(buf)) {
+    if ((ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf))) > 0 && (unsigned int)ret <= sizeof(buf)) {
       if (buf[0] == '+')
         buf[0] = '.';
       cp = strchr(buf, '.');
@@ -346,9 +340,9 @@ ink_res_init(
       ink_strlcpy(statp->defdname, cp, sizeof(statp->defdname));
     }
   }
-#endif	/* SOLARIS2 */
+#endif /* SOLARIS2 */
 
-	/* Allow user to override the local domain definition */
+  /* Allow user to override the local domain definition */
   if ((cp = getenv("LOCALDOMAIN")) != NULL) {
     (void)ink_strlcpy(statp->defdname, cp, sizeof(statp->defdname));
     haveenv++;
@@ -364,7 +358,7 @@ ink_res_init(
     pp = statp->dnsrch;
     *pp++ = cp;
     for (n = 0; *cp && pp < statp->dnsrch + INK_MAXDNSRCH; cp++) {
-      if (*cp == '\n')	/*%< silly backwards compat */
+      if (*cp == '\n') /*%< silly backwards compat */
         break;
       else if (*cp == ' ' || *cp == '\t') {
         *cp = 0;
@@ -428,20 +422,15 @@ ink_res_init(
      we must be provided with atleast a named!
      ------------------------------------------- */
   if (pHostList) {
-    if (pHostListSize > INK_MAXNS) pHostListSize = INK_MAXNS;
-    for (
-        ; nserv < pHostListSize
-          && ats_is_ip(&pHostList[nserv].sa)
-        ; ++nserv
-    ) {
+    if (pHostListSize > INK_MAXNS)
+      pHostListSize = INK_MAXNS;
+    for (; nserv < pHostListSize && ats_is_ip(&pHostList[nserv].sa); ++nserv) {
       ats_ip_copy(&statp->nsaddr_list[nserv].sa, &pHostList[nserv].sa);
     }
   }
 
-#define	MATCH(line, name)                       \
-  (!strncmp(line, name, sizeof(name) - 1) &&    \
-   (line[sizeof(name) - 1] == ' ' ||            \
-    line[sizeof(name) - 1] == '\t'))
+#define MATCH(line, name) \
+  (!strncmp(line, name, sizeof(name) - 1) && (line[sizeof(name) - 1] == ' ' || line[sizeof(name) - 1] == '\t'))
 
   if ((fp = fopen(pResolvConf, "r")) != NULL) {
     /* read the config file */
@@ -451,7 +440,7 @@ ink_res_init(
         continue;
       /* read default domain name */
       if (MATCH(buf, "domain")) {
-        if (haveenv)	/*%< skip if have from environ */
+        if (haveenv) /*%< skip if have from environ */
           continue;
         cp = buf + sizeof("domain") - 1;
         while (*cp == ' ' || *cp == '\t')
@@ -466,7 +455,7 @@ ink_res_init(
       }
       /* set search list */
       if (MATCH(buf, "search")) {
-        if (haveenv)	/*%< skip if have from environ */
+        if (haveenv) /*%< skip if have from environ */
           continue;
         cp = buf + sizeof("search") - 1;
         while (*cp == ' ' || *cp == '\t')
@@ -512,14 +501,11 @@ ink_res_init(
         if ((*cp != '\0') && (*cp != '\n')) {
           memset(&hints, 0, sizeof(hints));
           hints.ai_family = PF_UNSPEC;
-          hints.ai_socktype = SOCK_DGRAM;	/*dummy*/
+          hints.ai_socktype = SOCK_DGRAM; /*dummy*/
           hints.ai_flags = AI_NUMERICHOST;
           sprintf(sbuf, "%d", NAMESERVER_PORT);
           if (getaddrinfo(cp, sbuf, &hints, &ai) == 0) {
-            if (ats_ip_copy(
-                &statp->nsaddr_list[nserv].sa,
-                ai->ai_addr
-            ))
+            if (ats_ip_copy(&statp->nsaddr_list[nserv].sa, ai->ai_addr))
               ++nserv;
             freeaddrinfo(ai);
           }
@@ -531,7 +517,7 @@ ink_res_init(
         continue;
       }
     }
-    (void) fclose(fp);
+    (void)fclose(fp);
   }
 
   if (nserv > 0)
@@ -554,7 +540,7 @@ ink_res_init(
     while (pp < statp->dnsrch + INK_MAXDFLSRCH) {
       if (dots < INK_LOCALDOMAINPARTS)
         break;
-      cp = strchr(cp, '.') + 1;    /*%< we know there is one */
+      cp = strchr(cp, '.') + 1; /*%< we know there is one */
       *pp++ = cp;
       dots--;
     }
@@ -579,21 +565,22 @@ ink_res_init(
 }
 
 void
-parse_host_res_preference(char const* value, HostResPreferenceOrder order) {
+parse_host_res_preference(char const *value, HostResPreferenceOrder order)
+{
   Tokenizer tokens(";/|");
   // preference from the config string.
-  int np = 0; // index in to @a m_host_res_preference
-  bool found[N_HOST_RES_PREFERENCE];  // redundancy check array
-  int n; // # of tokens
-  int i; // index
+  int np = 0;                        // index in to @a m_host_res_preference
+  bool found[N_HOST_RES_PREFERENCE]; // redundancy check array
+  int n;                             // # of tokens
+  int i;                             // index
 
   n = tokens.Initialize(value);
 
-  for ( i = 0 ; i < N_HOST_RES_PREFERENCE ; ++i )
+  for (i = 0; i < N_HOST_RES_PREFERENCE; ++i)
     found[i] = false;
 
-  for ( i = 0 ; i < n && np < N_HOST_RES_PREFERENCE_ORDER ; ++i ) {
-    char const* elt = tokens[i];
+  for (i = 0; i < n && np < N_HOST_RES_PREFERENCE_ORDER; ++i) {
+    char const *elt = tokens[i];
     // special case none/only because that terminates the sequence.
     if (0 == strcasecmp(elt, HOST_RES_PREFERENCE_STRING[HOST_RES_PREFER_NONE])) {
       found[HOST_RES_PREFER_NONE] = true;
@@ -602,7 +589,7 @@ parse_host_res_preference(char const* value, HostResPreferenceOrder order) {
     } else {
       // scan the other types
       HostResPreference ep = HOST_RES_PREFER_NONE;
-      for ( int ip = HOST_RES_PREFER_NONE + 1 ; ip < N_HOST_RES_PREFERENCE ; ++ip ) {
+      for (int ip = HOST_RES_PREFER_NONE + 1; ip < N_HOST_RES_PREFERENCE; ++ip) {
         if (0 == strcasecmp(elt, HOST_RES_PREFERENCE_STRING[ip])) {
           ep = static_cast<HostResPreference>(ip);
           break;
@@ -627,17 +614,17 @@ parse_host_res_preference(char const* value, HostResPreferenceOrder order) {
 }
 
 int
-ts_host_res_order_to_string(HostResPreferenceOrder const& order, char* out, int size)
+ts_host_res_order_to_string(HostResPreferenceOrder const &order, char *out, int size)
 {
   int zret = 0;
   bool first = true;
-  for ( int i = 0 ; i < N_HOST_RES_PREFERENCE_ORDER ; ++i ) {
+  for (int i = 0; i < N_HOST_RES_PREFERENCE_ORDER; ++i) {
     /* Note we use a semi-colon here because this must be compatible
      * with the -httpport command line option which uses comma to
      * separate port descriptors so we cannot use that to separate
      * resolution key words.
      */
-    zret += snprintf(out+zret, size-zret, "%s%s", !first ? ";" : "", HOST_RES_PREFERENCE_STRING[order[i]]);
+    zret += snprintf(out + zret, size - zret, "%s%s", !first ? ";" : "", HOST_RES_PREFERENCE_STRING[order[i]]);
     if (HOST_RES_PREFER_NONE == order[i])
       break;
     first = false;


[10/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Vec.h
----------------------------------------------------------------------
diff --git a/lib/ts/Vec.h b/lib/ts/Vec.h
index b5b3a8d..ea97e8b 100644
--- a/lib/ts/Vec.h
+++ b/lib/ts/Vec.h
@@ -33,34 +33,39 @@
 
 // Simple Vector class, also supports open hashed sets
 
-#define VEC_INTEGRAL_SHIFT_DEFAULT      2               /* power of 2 (1 << VEC_INTEGRAL_SHIFT)*/
-#define VEC_INTEGRAL_SIZE               (1 << (S))
-#define VEC_INITIAL_SHIFT               ((S)+1)
-#define VEC_INITIAL_SIZE                (1 << VEC_INITIAL_SHIFT)
-
-#define SET_LINEAR_SIZE         4               /* must be <= than VEC_INTEGRAL_SIZE */
-#define SET_INITIAL_INDEX       2
-
-template <class C, class A = DefaultAlloc, int S = VEC_INTEGRAL_SHIFT_DEFAULT>  // S must be a power of 2
-class Vec {
- public:
-  size_t        n;
-  size_t        i;      // size index for sets, reserve for vectors
-  C             *v;
-  C             e[VEC_INTEGRAL_SIZE];
+#define VEC_INTEGRAL_SHIFT_DEFAULT 2 /* power of 2 (1 << VEC_INTEGRAL_SHIFT)*/
+#define VEC_INTEGRAL_SIZE (1 << (S))
+#define VEC_INITIAL_SHIFT ((S) + 1)
+#define VEC_INITIAL_SIZE (1 << VEC_INITIAL_SHIFT)
+
+#define SET_LINEAR_SIZE 4 /* must be <= than VEC_INTEGRAL_SIZE */
+#define SET_INITIAL_INDEX 2
+
+template <class C, class A = DefaultAlloc, int S = VEC_INTEGRAL_SHIFT_DEFAULT> // S must be a power of 2
+class Vec
+{
+public:
+  size_t n;
+  size_t i; // size index for sets, reserve for vectors
+  C *v;
+  C e[VEC_INTEGRAL_SIZE];
 
   Vec();
-  Vec<C,A,S>(const Vec<C,A,S> &vv);
-  Vec<C,A,S>(const C c);
+  Vec<C, A, S>(const Vec<C, A, S> &vv);
+  Vec<C, A, S>(const C c);
   ~Vec();
 
   C &operator[](int i) const { return v[i]; }
 
   C get(size_t i) const;
   void add(C a);
-  void push_back(C a) { add(a); } // std::vector name
+  void
+  push_back(C a)
+  {
+    add(a);
+  } // std::vector name
   bool add_exclusive(C a);
-  C& add();
+  C &add();
   void drop();
   C pop();
   void reset();
@@ -71,14 +76,14 @@ class Vec {
   C *set_add(C a);
   void set_remove(C a); // expensive, use BlockHash for cheaper remove
   C *set_add_internal(C a);
-  bool set_union(Vec<C,A,S> &v);
-  int set_intersection(Vec<C,A,S> &v);
-  int some_intersection(Vec<C,A,S> &v);
-  int some_disjunction(Vec<C,A,S> &v);
-  int some_difference(Vec<C,A,S> &v);
-  void set_intersection(Vec<C,A,S> &v, Vec<C,A,S> &result);
-  void set_disjunction(Vec<C,A,S> &v, Vec<C,A,S> &result);
-  void set_difference(Vec<C,A,S> &v, Vec<C,A,S> &result);
+  bool set_union(Vec<C, A, S> &v);
+  int set_intersection(Vec<C, A, S> &v);
+  int some_intersection(Vec<C, A, S> &v);
+  int some_disjunction(Vec<C, A, S> &v);
+  int some_difference(Vec<C, A, S> &v);
+  void set_intersection(Vec<C, A, S> &v, Vec<C, A, S> &result);
+  void set_disjunction(Vec<C, A, S> &v, Vec<C, A, S> &result);
+  void set_difference(Vec<C, A, S> &v, Vec<C, A, S> &result);
   size_t set_count() const;
   size_t count() const;
   C *in(C a);
@@ -89,60 +94,118 @@ class Vec {
   ssize_t index(C a) const;
   void set_to_vec();
   void vec_to_set();
-  void move(Vec<C,A,S> &v);
-  void copy(const Vec<C,A,S> &v);
+  void move(Vec<C, A, S> &v);
+  void copy(const Vec<C, A, S> &v);
   void fill(size_t n);
   void append(const Vec<C> &v);
-  template <typename CountType> void append(const C * src, CountType count);
+  template <typename CountType> void append(const C *src, CountType count);
   void prepend(const Vec<C> &v);
   void remove_index(int index);
-  void remove(C a) { int i = index(a); if (i>=0) remove_index(i); }
-  C& insert(size_t index);
+  void
+  remove(C a)
+  {
+    int i = index(a);
+    if (i >= 0)
+      remove_index(i);
+  }
+  C &insert(size_t index);
   void insert(size_t index, Vec<C> &vv);
   void insert(size_t index, C a);
-  void push(C a) { insert(0, a); }
+  void
+  push(C a)
+  {
+    insert(0, a);
+  }
   void reverse();
   void reserve(size_t n);
-  C* end() const { return v + n; }
-  C &first() const { return v[0]; }
-  C &last() const { return v[n-1]; }
-  Vec<C,A,S>& operator=(Vec<C,A,S> &v) { this->copy(v); return *this; }
-  unsigned length () const { return n; }
+  C *
+  end() const
+  {
+    return v + n;
+  }
+  C &
+  first() const
+  {
+    return v[0];
+  }
+  C &
+  last() const
+  {
+    return v[n - 1];
+  }
+  Vec<C, A, S> &operator=(Vec<C, A, S> &v)
+  {
+    this->copy(v);
+    return *this;
+  }
+  unsigned
+  length() const
+  {
+    return n;
+  }
   // vector::size() intentionally not implemented because it should mean "bytes" not count of elements
   int write(int fd);
   int read(int fd);
-  void qsort(bool (*lt)(C,C));
+  void qsort(bool (*lt)(C, C));
   void qsort(bool (*lt)(const C &, const C &));
 
 private:
-  void move_internal(Vec<C,A,S> &v);
-  void copy_internal(const Vec<C,A,S> &v);
+  void move_internal(Vec<C, A, S> &v);
+  void copy_internal(const Vec<C, A, S> &v);
   void add_internal(C a);
-  C& add_internal();
+  C &add_internal();
   void addx();
 };
 
 // c -- class, p -- pointer to elements of v, v -- vector
-#define forv_Vec(_c, _p, _v) if ((_v).n) for (_c *qq__##_p = (_c*)0, *_p = (_v).v[0]; \
-                    ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = (_v).v[(intptr_t)qq__##_p]) || 1); qq__##_p = (_c*)(((intptr_t)qq__##_p) + 1))
-#define for_Vec(_c, _p, _v) if ((_v).n) for (_c *qq__##_p = (_c*)0, _p = (_v).v[0]; \
-                    ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = (_v).v[(intptr_t)qq__##_p]) || 1); qq__##_p = (_c*)(((intptr_t)qq__##_p) + 1))
-#define forvp_Vec(_c, _p, _v) if ((_v).n) for (_c *qq__##_p = (_c*)0, *_p = &(_v).v[0]; \
-                    ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = &(_v).v[(intptr_t)qq__##_p]) || 1); qq__##_p = (_c*)(((intptr_t)qq__##_p) + 1))
-
-template <class C, class A = DefaultAlloc, int S = VEC_INTEGRAL_SHIFT_DEFAULT> class Accum { public:
-  Vec<C,A,S> asset;
-  Vec<C,A,S> asvec;
-  void add(C c) { if (asset.set_add(c)) asvec.add(c); }
-  void add(Vec<C,A,S> v) { for (int i = 0; i < v.n; i++) if (v.v[i]) add(v.v[i]); }
-  void clear() { asset.clear(); asvec.clear(); }
+#define forv_Vec(_c, _p, _v)                                                                  \
+  if ((_v).n)                                                                                 \
+    for (_c *qq__##_p = (_c *)0, *_p = (_v).v[0];                                             \
+         ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = (_v).v[(intptr_t)qq__##_p]) || 1); \
+         qq__##_p = (_c *)(((intptr_t)qq__##_p) + 1))
+#define for_Vec(_c, _p, _v)                                                                   \
+  if ((_v).n)                                                                                 \
+    for (_c *qq__##_p = (_c *)0, _p = (_v).v[0];                                              \
+         ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = (_v).v[(intptr_t)qq__##_p]) || 1); \
+         qq__##_p = (_c *)(((intptr_t)qq__##_p) + 1))
+#define forvp_Vec(_c, _p, _v)                                                                  \
+  if ((_v).n)                                                                                  \
+    for (_c *qq__##_p = (_c *)0, *_p = &(_v).v[0];                                             \
+         ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = &(_v).v[(intptr_t)qq__##_p]) || 1); \
+         qq__##_p = (_c *)(((intptr_t)qq__##_p) + 1))
+
+template <class C, class A = DefaultAlloc, int S = VEC_INTEGRAL_SHIFT_DEFAULT> class Accum
+{
+public:
+  Vec<C, A, S> asset;
+  Vec<C, A, S> asvec;
+  void
+  add(C c)
+  {
+    if (asset.set_add(c))
+      asvec.add(c);
+  }
+  void
+  add(Vec<C, A, S> v)
+  {
+    for (int i = 0; i < v.n; i++)
+      if (v.v[i])
+        add(v.v[i]);
+  }
+  void
+  clear()
+  {
+    asset.clear();
+    asvec.clear();
+  }
 };
 
 // Intervals store sets in interval format (e.g. [1..10][12..12]).
 // Inclusion test is by binary search on intervals.
 // Deletion is not supported
-class Intervals : public Vec<int> {
- public:
+class Intervals : public Vec<int>
+{
+public:
   void insert(int n);
   bool in(int n) const;
 };
@@ -150,8 +213,9 @@ class Intervals : public Vec<int> {
 // UnionFind supports fast unify and finding of
 // 'representitive elements'.
 // Elements are numbered from 0 to N-1.
-class UnionFind : public Vec<int> {
- public:
+class UnionFind : public Vec<int>
+{
+public:
   // set number of elements, initialized to singletons, may be called repeatedly to increase size
   void size(int n);
   // return representitive element
@@ -165,26 +229,28 @@ extern const uintptr_t open_hash_primes[256];
 
 /* IMPLEMENTATION */
 
-template <class C, class A, int S> inline
-Vec<C,A,S>::Vec() : n(0), i(0), v(0) {
+template <class C, class A, int S> inline Vec<C, A, S>::Vec() : n(0), i(0), v(0)
+{
   memset(&e[0], 0, sizeof(e));
 }
 
-template <class C, class A, int S> inline
-Vec<C,A,S>::Vec(const Vec<C,A,S> &vv) {
+template <class C, class A, int S> inline Vec<C, A, S>::Vec(const Vec<C, A, S> &vv)
+{
   copy(vv);
 }
 
-template <class C, class A, int S> inline
-Vec<C,A,S>::Vec(C c) {
+template <class C, class A, int S> inline Vec<C, A, S>::Vec(C c)
+{
   n = 1;
   i = 0;
   v = &e[0];
   e[0] = c;
 }
 
-template <class C, class A, int S> inline C
-Vec<C,A,S>::get(size_t i) const {
+template <class C, class A, int S>
+inline C
+Vec<C, A, S>::get(size_t i) const
+{
   if (i < n) {
     return v[i];
   } else {
@@ -192,9 +258,11 @@ Vec<C,A,S>::get(size_t i) const {
   }
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::add(C a) {
-  if (n & (VEC_INTEGRAL_SIZE-1))
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::add(C a)
+{
+  if (n & (VEC_INTEGRAL_SIZE - 1))
     v[n++] = a;
   else if (!v)
     (v = e)[n++] = a;
@@ -202,10 +270,12 @@ Vec<C,A,S>::add(C a) {
     add_internal(a);
 }
 
-template <class C, class A, int S> inline C&
-Vec<C,A,S>::add() {
+template <class C, class A, int S>
+inline C &
+Vec<C, A, S>::add()
+{
   C *ret;
-  if (n & (VEC_INTEGRAL_SIZE-1))
+  if (n & (VEC_INTEGRAL_SIZE - 1))
     ret = &v[n++];
   else if (!v)
     ret = &(v = e)[n++];
@@ -214,14 +284,18 @@ Vec<C,A,S>::add() {
   return *ret;
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::drop() {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::drop()
+{
   if (n && 0 == --n)
     clear();
 }
 
-template <class C, class A, int S> inline C
-Vec<C,A,S>::pop() {
+template <class C, class A, int S>
+inline C
+Vec<C, A, S>::pop()
+{
   if (!n)
     return 0;
   n--;
@@ -231,22 +305,26 @@ Vec<C,A,S>::pop() {
   return ret;
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::set_clear() {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::set_clear()
+{
   memset(v, 0, n * sizeof(C));
 }
 
-template <class C, class A, int S> inline C *
-Vec<C,A,S>::set_add(C a) {
+template <class C, class A, int S>
+inline C *
+Vec<C, A, S>::set_add(C a)
+{
   if (n < SET_LINEAR_SIZE) {
     for (C *c = v; c < v + n; c++)
       if (*c == a)
         return 0;
     add(a);
-    return &v[n-1];
+    return &v[n - 1];
   }
   if (n == SET_LINEAR_SIZE) {
-    Vec<C,A,S> vv(*this);
+    Vec<C, A, S> vv(*this);
     clear();
     for (C *c = vv.v; c < vv.v + vv.n; c++) {
       set_add_internal(*c);
@@ -255,17 +333,21 @@ Vec<C,A,S>::set_add(C a) {
   return set_add_internal(a);
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::set_remove(C a) {
-  Vec<C,A,S> tmp;
+template <class C, class A, int S>
+void
+Vec<C, A, S>::set_remove(C a)
+{
+  Vec<C, A, S> tmp;
   tmp.move(*this);
   for (C *c = tmp.v; c < tmp.v + tmp.n; c++)
     if (*c != a)
       set_add(a);
 }
 
-template <class C, class A, int S> inline size_t
-Vec<C,A,S>::count() const {
+template <class C, class A, int S>
+inline size_t
+Vec<C, A, S>::count() const
+{
   int x = 0;
   for (C *c = v; c < v + n; c++)
     if (*c)
@@ -273,16 +355,20 @@ Vec<C,A,S>::count() const {
   return x;
 }
 
-template <class C, class A, int S> inline C*
-Vec<C,A,S>::in(C a) {
+template <class C, class A, int S>
+inline C *
+Vec<C, A, S>::in(C a)
+{
   for (C *c = v; c < v + n; c++)
     if (*c == a)
       return c;
   return NULL;
 }
 
-template <class C, class A, int S> inline bool
-Vec<C,A,S>::add_exclusive(C a) {
+template <class C, class A, int S>
+inline bool
+Vec<C, A, S>::add_exclusive(C a)
+{
   if (!in(a)) {
     add(a);
     return true;
@@ -290,23 +376,29 @@ Vec<C,A,S>::add_exclusive(C a) {
     return false;
 }
 
-template <class C, class A, int S> inline C *
-Vec<C,A,S>::set_in(C a) {
+template <class C, class A, int S>
+inline C *
+Vec<C, A, S>::set_in(C a)
+{
   if (n <= SET_LINEAR_SIZE)
     return in(a);
   return set_in_internal(a);
 }
 
-template <class C, class A, int S> inline C
-Vec<C,A,S>::first_in_set() {
+template <class C, class A, int S>
+inline C
+Vec<C, A, S>::first_in_set()
+{
   for (C *c = v; c < v + n; c++)
     if (*c)
       return *c;
   return 0;
 }
 
-template <class C, class A, int S> inline ssize_t
-Vec<C,A,S>::index(C a) const {
+template <class C, class A, int S>
+inline ssize_t
+Vec<C, A, S>::index(C a) const
+{
   for (C *c = v; c < v + n; c++) {
     if (*c == a) {
       return c - v;
@@ -315,8 +407,10 @@ Vec<C,A,S>::index(C a) const {
   return -1;
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::move_internal(Vec<C,A,S> &vv)  {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::move_internal(Vec<C, A, S> &vv)
+{
   n = vv.n;
   i = vv.i;
   if (vv.v == &vv.e[0]) {
@@ -326,15 +420,19 @@ Vec<C,A,S>::move_internal(Vec<C,A,S> &vv)  {
     v = vv.v;
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::move(Vec<C,A,S> &vv)  {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::move(Vec<C, A, S> &vv)
+{
   move_internal(vv);
   vv.v = 0;
   vv.clear();
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::copy(const Vec<C,A,S> &vv)  {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::copy(const Vec<C, A, S> &vv)
+{
   n = vv.n;
   i = vv.i;
   if (vv.v == &vv.e[0]) {
@@ -348,14 +446,18 @@ Vec<C,A,S>::copy(const Vec<C,A,S> &vv)  {
   }
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::fill(size_t nn)  {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::fill(size_t nn)
+{
   for (size_t i = n; i < nn; i++)
     add() = 0;
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::append(const Vec<C> &vv)  {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::append(const Vec<C> &vv)
+{
   for (C *c = vv.v; c < vv.v + vv.n; c++)
     if (*c != 0)
       add(*c);
@@ -364,15 +466,18 @@ Vec<C,A,S>::append(const Vec<C> &vv)  {
 template <class C, class A, int S>
 template <typename CountType>
 inline void
-Vec<C,A,S>::append(const C * src, CountType count)  {
+Vec<C, A, S>::append(const C *src, CountType count)
+{
   reserve(length() + count);
   for (CountType c = 0; c < count; ++c) {
     add(src[c]);
   }
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::prepend(const Vec<C> &vv)  {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::prepend(const Vec<C> &vv)
+{
   if (vv.n) {
     int oldn = n;
     fill(n + vv.n);
@@ -382,20 +487,26 @@ Vec<C,A,S>::prepend(const Vec<C> &vv)  {
   }
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::add_internal(C a) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::add_internal(C a)
+{
   addx();
   v[n++] = a;
 }
 
-template <class C, class A, int S> C&
-Vec<C,A,S>::add_internal() {
+template <class C, class A, int S>
+C &
+Vec<C, A, S>::add_internal()
+{
   addx();
   return v[n++];
 }
 
-template <class C, class A, int S> C *
-Vec<C,A,S>::set_add_internal(C c) {
+template <class C, class A, int S>
+C *
+Vec<C, A, S>::set_add_internal(C c)
+{
   size_t j, k;
   if (n) {
     uintptr_t h = (uintptr_t)c;
@@ -410,7 +521,7 @@ Vec<C,A,S>::set_add_internal(C c) {
       k = (k + open_hash_primes[j]) % n;
     }
   }
-  Vec<C,A,S> vv;
+  Vec<C, A, S> vv;
   vv.move_internal(*this);
   set_expand();
   if (vv.v) {
@@ -419,8 +530,10 @@ Vec<C,A,S>::set_add_internal(C c) {
   return set_add(c);
 }
 
-template <class C, class A, int S> C *
-Vec<C,A,S>::set_in_internal(C c) {
+template <class C, class A, int S>
+C *
+Vec<C, A, S>::set_in_internal(C c)
+{
   size_t j, k;
   if (n) {
     uintptr_t h = (uintptr_t)c;
@@ -436,8 +549,10 @@ Vec<C,A,S>::set_in_internal(C c) {
   return 0;
 }
 
-template <class C, class A, int S> bool
-Vec<C,A,S>::set_union(Vec<C,A,S> &vv) {
+template <class C, class A, int S>
+bool
+Vec<C, A, S>::set_union(Vec<C, A, S> &vv)
+{
   bool changed = false;
   for (size_t i = 0; i < vv.n; i++) {
     if (vv.v[i]) {
@@ -447,9 +562,11 @@ Vec<C,A,S>::set_union(Vec<C,A,S> &vv) {
   return changed;
 }
 
-template <class C, class A, int S> int
-Vec<C,A,S>::set_intersection(Vec<C,A,S> &vv) {
-  Vec<C,A,S> tv;
+template <class C, class A, int S>
+int
+Vec<C, A, S>::set_intersection(Vec<C, A, S> &vv)
+{
+  Vec<C, A, S> tv;
   tv.move(*this);
   int changed = 0;
   for (int i = 0; i < tv.n; i++)
@@ -462,8 +579,10 @@ Vec<C,A,S>::set_intersection(Vec<C,A,S> &vv) {
   return changed;
 }
 
-template <class C, class A, int S> int
-Vec<C,A,S>::some_intersection(Vec<C,A,S> &vv) {
+template <class C, class A, int S>
+int
+Vec<C, A, S>::some_intersection(Vec<C, A, S> &vv)
+{
   for (int i = 0; i < n; i++)
     if (v[i])
       if (vv.set_in(v[i]))
@@ -471,8 +590,10 @@ Vec<C,A,S>::some_intersection(Vec<C,A,S> &vv) {
   return 0;
 }
 
-template <class C, class A, int S> int
-Vec<C,A,S>::some_disjunction(Vec<C,A,S> &vv) {
+template <class C, class A, int S>
+int
+Vec<C, A, S>::some_disjunction(Vec<C, A, S> &vv)
+{
   for (int i = 0; i < n; i++)
     if (v[i])
       if (!vv.set_in(v[i]))
@@ -484,16 +605,20 @@ Vec<C,A,S>::some_disjunction(Vec<C,A,S> &vv) {
   return 0;
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::set_intersection(Vec<C,A,S> &vv, Vec<C,A,S> &result) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::set_intersection(Vec<C, A, S> &vv, Vec<C, A, S> &result)
+{
   for (int i = 0; i < n; i++)
     if (v[i])
       if (vv.set_in(v[i]))
         result.set_add(v[i]);
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::set_disjunction(Vec<C,A,S> &vv, Vec<C,A,S> &result) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::set_disjunction(Vec<C, A, S> &vv, Vec<C, A, S> &result)
+{
   for (int i = 0; i < n; i++)
     if (v[i])
       if (!vv.set_in(v[i]))
@@ -504,16 +629,20 @@ Vec<C,A,S>::set_disjunction(Vec<C,A,S> &vv, Vec<C,A,S> &result) {
         result.set_add(vv.v[i]);
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::set_difference(Vec<C,A,S> &vv, Vec<C,A,S> &result) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::set_difference(Vec<C, A, S> &vv, Vec<C, A, S> &result)
+{
   for (int i = 0; i < n; i++)
     if (v[i])
       if (!vv.set_in(v[i]))
         result.set_add(v[i]);
 }
 
-template <class C, class A, int S> int
-Vec<C,A,S>::some_difference(Vec<C,A,S> &vv) {
+template <class C, class A, int S>
+int
+Vec<C, A, S>::some_difference(Vec<C, A, S> &vv)
+{
   for (int i = 0; i < n; i++)
     if (v[i])
       if (!vv.set_in(v[i]))
@@ -521,8 +650,10 @@ Vec<C,A,S>::some_difference(Vec<C,A,S> &vv) {
   return 0;
 }
 
-template <class C, class A, int S> size_t
-Vec<C,A,S>::set_count() const {
+template <class C, class A, int S>
+size_t
+Vec<C, A, S>::set_count() const
+{
   size_t x = 0;
   for (size_t i = 0; i < n; i++) {
     if (v[i]) {
@@ -532,18 +663,20 @@ Vec<C,A,S>::set_count() const {
   return x;
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::set_to_vec() {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::set_to_vec()
+{
   C *x = &v[0], *y = x;
   for (; y < v + n; y++) {
     if (*y) {
       if (x != y)
-         *x = *y;
-       x++;
+        *x = *y;
+      x++;
     }
   }
   if (i) {
-    i = prime2[i];  // convert set allocation to reserve
+    i = prime2[i]; // convert set allocation to reserve
     if (i - n > 0)
       memset(&v[n], 0, (i - n) * (sizeof(C)));
   } else {
@@ -553,49 +686,61 @@ Vec<C,A,S>::set_to_vec() {
   }
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::vec_to_set() {
-  Vec<C,A,S> vv;
+template <class C, class A, int S>
+void
+Vec<C, A, S>::vec_to_set()
+{
+  Vec<C, A, S> vv;
   vv.move(*this);
   for (C *c = vv.v; c < vv.v + vv.n; c++)
     set_add(*c);
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::remove_index(int index) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::remove_index(int index)
+{
   if (n > 1)
-    memmove(&v[index], &v[index+1], (n - 1 - index) * sizeof(v[0]));
+    memmove(&v[index], &v[index + 1], (n - 1 - index) * sizeof(v[0]));
   n--;
   if (n <= 0)
     v = e;
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::insert(size_t index, C a) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::insert(size_t index, C a)
+{
   add();
-  memmove(&v[index+1], &v[index], (n - index - 1) * sizeof(C));
+  memmove(&v[index + 1], &v[index], (n - index - 1) * sizeof(C));
   v[index] = a;
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::insert(size_t index, Vec<C> &vv) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::insert(size_t index, Vec<C> &vv)
+{
   fill(n + vv.n);
-  memmove(&v[index+vv.n], &v[index], (n - index - 1) * sizeof(C));
+  memmove(&v[index + vv.n], &v[index], (n - index - 1) * sizeof(C));
   for (int x = 0; x < vv.n; x++)
     v[index + x] = vv[x];
 }
 
-template <class C, class A, int S>  C &
-Vec<C,A,S>::insert(size_t index) {
+template <class C, class A, int S>
+C &
+Vec<C, A, S>::insert(size_t index)
+{
   add();
-  memmove(&v[index+1], &v[index], (n - index - 1) * sizeof(C));
+  memmove(&v[index + 1], &v[index], (n - index - 1) * sizeof(C));
   memset(&v[index], 0, sizeof(C));
   return v[index];
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::reverse() {
-  for (int i = 0; i < n/2; i++) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::reverse()
+{
+  for (int i = 0; i < n / 2; i++) {
     C *s = &v[i], *e = &v[n - 1 - i];
     C t;
     memcpy(&t, s, sizeof(t));
@@ -604,67 +749,79 @@ Vec<C,A,S>::reverse() {
   }
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::copy_internal(const Vec<C,A,S> &vv) {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::copy_internal(const Vec<C, A, S> &vv)
+{
   int l = n, nl = (1 + VEC_INITIAL_SHIFT);
   l = l >> VEC_INITIAL_SHIFT;
-  while (l) { l = l >> 1; nl++; }
+  while (l) {
+    l = l >> 1;
+    nl++;
+  }
   nl = 1 << nl;
-  v = (C*)A::alloc(nl * sizeof(C));
+  v = (C *)A::alloc(nl * sizeof(C));
   memcpy(v, vv.v, n * sizeof(C));
   memset(v + n, 0, (nl - n) * sizeof(C));
-  if (i > n)  // reset reserve
+  if (i > n) // reset reserve
     i = 0;
 }
 
-template <class C, class A, int S> void
-Vec<C,A,S>::set_expand() {
+template <class C, class A, int S>
+void
+Vec<C, A, S>::set_expand()
+{
   if (!n)
     i = SET_INITIAL_INDEX;
   else
     i = i + 1;
   n = prime2[i];
-  v = (C*)A::alloc(n * sizeof(C));
+  v = (C *)A::alloc(n * sizeof(C));
   memset(v, 0, n * sizeof(C));
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::reserve(size_t x) {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::reserve(size_t x)
+{
   if (x <= n)
     return;
   unsigned xx = 1 << VEC_INITIAL_SHIFT;
-  while (xx < x) xx *= 2;
+  while (xx < x)
+    xx *= 2;
   i = xx;
-  void *vv = (void*)v;
-  v = (C*)A::alloc(i * sizeof(C));
+  void *vv = (void *)v;
+  v = (C *)A::alloc(i * sizeof(C));
   if (vv && n)
     memcpy(v, vv, n * sizeof(C));
-  memset(&v[n], 0, (i-n) * sizeof(C));
+  memset(&v[n], 0, (i - n) * sizeof(C));
   if (vv && vv != e)
     A::free(vv);
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::addx() {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::addx()
+{
   if (!v) {
     v = e;
     return;
   }
   if (v == e) {
-    v = (C*)A::alloc(VEC_INITIAL_SIZE * sizeof(C));
+    v = (C *)A::alloc(VEC_INITIAL_SIZE * sizeof(C));
     memcpy(v, &e[0], n * sizeof(C));
     ink_assert(n < VEC_INITIAL_SIZE);
     memset(&v[n], 0, (VEC_INITIAL_SIZE - n) * sizeof(C));
   } else {
-    if ((n & (n-1)) == 0) {
+    if ((n & (n - 1)) == 0) {
       size_t nl = n * 2;
       if (nl <= i) {
         return;
       } else {
         i = 0;
       }
-      void *vv = (void*)v;
-      v = (C*)A::alloc(nl * sizeof(C));
+      void *vv = (void *)v;
+      v = (C *)A::alloc(nl * sizeof(C));
       memcpy(v, vv, n * sizeof(C));
       memset(&v[n], 0, n * sizeof(C));
       A::free(vv);
@@ -672,29 +829,38 @@ Vec<C,A,S>::addx() {
   }
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::reset() {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::reset()
+{
   v = NULL;
   n = 0;
   i = 0;
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::clear() {
-  if (v && v != e) A::free(v);
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::clear()
+{
+  if (v && v != e)
+    A::free(v);
   reset();
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::free_and_clear() {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::free_and_clear()
+{
   for (int x = 0; x < n; x++)
     if (v[x])
       A::free(v[x]);
   clear();
 }
 
-template <class C, class A, int S> inline void
-Vec<C,A,S>::delete_and_clear() {
+template <class C, class A, int S>
+inline void
+Vec<C, A, S>::delete_and_clear()
+{
   for (size_t x = 0; x < n; x++) {
     if (v[x]) {
       delete v[x];
@@ -703,13 +869,16 @@ Vec<C,A,S>::delete_and_clear() {
   clear();
 }
 
-template <class C, class A, int S>
-inline Vec<C,A,S>::~Vec() {
-  if (v && v != e) A::free(v);
+template <class C, class A, int S> inline Vec<C, A, S>::~Vec()
+{
+  if (v && v != e)
+    A::free(v);
 }
 
 template <class C, class A, int S>
-inline int marshal_size(Vec<C,A,S> &v) {
+inline int
+marshal_size(Vec<C, A, S> &v)
+{
   int l = sizeof(int) * 2;
   for (int x = 0; x < v.n; x++)
     l += ::marshal_size(v.v[x]);
@@ -717,22 +886,30 @@ inline int marshal_size(Vec<C,A,S> &v) {
 }
 
 template <class C, class A, int S>
-inline int marshal(Vec<C,A,S> &v, char *buf) {
+inline int
+marshal(Vec<C, A, S> &v, char *buf)
+{
   char *x = buf;
-  *(int*)x = v.n; x += sizeof(int);
-  *(int*)x = v.i; x += sizeof(int);
+  *(int *)x = v.n;
+  x += sizeof(int);
+  *(int *)x = v.i;
+  x += sizeof(int);
   for (int i = 0; i < v.n; i++)
     x += ::marshal(v.v[i], x);
   return x - buf;
 }
 
 template <class C, class A, int S>
-inline int unmarshal(Vec<C,A,S> &v, char *buf) {
+inline int
+unmarshal(Vec<C, A, S> &v, char *buf)
+{
   char *x = buf;
-  v.n = *(int*)x; x += sizeof(int);
-  v.i = *(int*)x; x += sizeof(int);
+  v.n = *(int *)x;
+  x += sizeof(int);
+  v.i = *(int *)x;
+  x += sizeof(int);
   if (v.n) {
-    v.v = (C*)A::alloc(sizeof(C) * v.n);
+    v.v = (C *)A::alloc(sizeof(C) * v.n);
     memset(v.v, 0, sizeof(C) * v.n);
   } else
     v.v = v.e;
@@ -742,30 +919,44 @@ inline int unmarshal(Vec<C,A,S> &v, char *buf) {
 }
 
 template <class C, class A, int S>
-inline int Vec<C,A,S>::write(int fd) {
+inline int
+Vec<C, A, S>::write(int fd)
+{
   int r = 0, t = 0;
-  if ((r = ::write(fd, this, sizeof(*this))) < 0) return r; t += r;
-  if ((r = ::write(fd, v, n * sizeof(C))) < 0) return r; t += r;
+  if ((r = ::write(fd, this, sizeof(*this))) < 0)
+    return r;
+  t += r;
+  if ((r = ::write(fd, v, n * sizeof(C))) < 0)
+    return r;
+  t += r;
   return t;
 }
 
 template <class C, class A, int S>
-inline int Vec<C,A,S>::read(int fd) {
+inline int
+Vec<C, A, S>::read(int fd)
+{
   int r = 0, t = 0;
-  if ((r = ::read(fd, this, sizeof(*this))) < 0) return r; t += r;
-  v = (C*)A::alloc(sizeof(C) * n);
+  if ((r = ::read(fd, this, sizeof(*this))) < 0)
+    return r;
+  t += r;
+  v = (C *)A::alloc(sizeof(C) * n);
   memset(v, 0, sizeof(C) * n);
-  if ((r = ::read(fd, v, n * sizeof(C))) < 0) return r; t += r;
+  if ((r = ::read(fd, v, n * sizeof(C))) < 0)
+    return r;
+  t += r;
   return t;
 }
 
 template <class C>
-inline void qsort_Vec(C *left, C *right, bool (*lt)(C,C)) {
- Lagain:
+inline void
+qsort_Vec(C *left, C *right, bool (*lt)(C, C))
+{
+Lagain:
   if (right - left < 5) {
     for (C *y = right - 1; y > left; y--) {
       for (C *x = left; x < y; x++) {
-        if (lt(x[1],x[0])) {
+        if (lt(x[1], x[0])) {
           C t = x[0];
           x[0] = x[1];
           x[1] = t;
@@ -773,16 +964,20 @@ inline void qsort_Vec(C *left, C *right, bool (*lt)(C,C)) {
       }
     }
   } else {
-    C  *i = left + 1, *j = right - 1;
+    C *i = left + 1, *j = right - 1;
     C x = *left;
     for (;;) {
-      while (lt(x,*j)) j--;
-      while (i < j && lt(*i,x)) i++;
-      if (i >= j) break;
+      while (lt(x, *j))
+        j--;
+      while (i < j && lt(*i, x))
+        i++;
+      if (i >= j)
+        break;
       C t = *i;
       *i = *j;
       *j = t;
-      i++; j--;
+      i++;
+      j--;
     }
     if (j == right - 1) {
       *left = *(right - 1);
@@ -790,18 +985,22 @@ inline void qsort_Vec(C *left, C *right, bool (*lt)(C,C)) {
       right--;
       goto Lagain;
     }
-    if (left < j) qsort_Vec<C>(left, j + 1, lt);
-    if (j + 2 < right) qsort_Vec<C>(j + 1, right, lt);
+    if (left < j)
+      qsort_Vec<C>(left, j + 1, lt);
+    if (j + 2 < right)
+      qsort_Vec<C>(j + 1, right, lt);
   }
 }
 
 template <class C>
-inline void qsort_VecRef(C *left, C *right, bool (*lt)(const C &, const C &)) {
- Lagain:
+inline void
+qsort_VecRef(C *left, C *right, bool (*lt)(const C &, const C &))
+{
+Lagain:
   if (right - left < 5) {
     for (C *y = right - 1; y > left; y--) {
       for (C *x = left; x < y; x++) {
-        if (lt(x[1],x[0])) {
+        if (lt(x[1], x[0])) {
           C t = x[0];
           x[0] = x[1];
           x[1] = t;
@@ -809,16 +1008,20 @@ inline void qsort_VecRef(C *left, C *right, bool (*lt)(const C &, const C &)) {
       }
     }
   } else {
-    C  *i = left + 1, *j = right - 1;
+    C *i = left + 1, *j = right - 1;
     C x = *left;
     for (;;) {
-      while (lt(x,*j)) j--;
-      while (i < j && lt(*i,x)) i++;
-      if (i >= j) break;
+      while (lt(x, *j))
+        j--;
+      while (i < j && lt(*i, x))
+        i++;
+      if (i >= j)
+        break;
       C t = *i;
       *i = *j;
       *j = t;
-      i++; j--;
+      i++;
+      j--;
     }
     if (j == right - 1) {
       *left = *(right - 1);
@@ -826,19 +1029,25 @@ inline void qsort_VecRef(C *left, C *right, bool (*lt)(const C &, const C &)) {
       right--;
       goto Lagain;
     }
-    if (left < j) qsort_VecRef<C>(left, j + 1, lt);
-    if (j + 2 < right) qsort_VecRef<C>(j + 1, right, lt);
+    if (left < j)
+      qsort_VecRef<C>(left, j + 1, lt);
+    if (j + 2 < right)
+      qsort_VecRef<C>(j + 1, right, lt);
   }
 }
 
 template <class C, class A, int S>
-inline void Vec<C,A,S>::qsort(bool (*lt)(C,C)) {
+inline void
+Vec<C, A, S>::qsort(bool (*lt)(C, C))
+{
   if (n)
     qsort_Vec<C>(&v[0], end(), lt);
 }
 
 template <class C, class A, int S>
-inline void Vec<C,A,S>::qsort(bool (*lt)(const C &, const C &)) {
+inline void
+Vec<C, A, S>::qsort(bool (*lt)(const C &, const C &))
+{
   if (n)
     qsort_VecRef<C>(&v[0], end(), lt);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Version.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Version.cc b/lib/ts/Version.cc
index 19fc201..30669c0 100644
--- a/lib/ts/Version.cc
+++ b/lib/ts/Version.cc
@@ -41,30 +41,24 @@ AppVersionInfo::AppVersionInfo()
 
 
 void
-AppVersionInfo::setup(const char *pkg_name, const char *app_name, const char *app_version,
-                      const char *build_date, const char *build_time, const char *build_machine,
-                      const char *build_person, const char *build_cflags)
+AppVersionInfo::setup(const char *pkg_name, const char *app_name, const char *app_version, const char *build_date,
+                      const char *build_time, const char *build_machine, const char *build_person, const char *build_cflags)
 {
   char month_name[8];
   int year, month, day, hour, minute, second;
   bool invalid_datetime;
 
-  static const char *months[] = {
-    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "???"
-  };
+  static const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "???"};
 
-  invalid_datetime =
-      sscanf(build_time, "%d:%d:%d", &hour, &minute, &second) < 3;
-  invalid_datetime |=
-      sscanf(build_date, "%3s %d %d", month_name, &day, &year) < 3;
+  invalid_datetime = sscanf(build_time, "%d:%d:%d", &hour, &minute, &second) < 3;
+  invalid_datetime |= sscanf(build_date, "%3s %d %d", month_name, &day, &year) < 3;
 
   // Jan=1, Feb=2 ... Dec=12, ???=13
   for (month = 0; month < 11; month++) {
     if (strcasecmp(months[month], month_name) == 0)
       break;
   }
-  month ++;
+  month++;
 
   ///////////////////////////////////////////
   // now construct the version information //
@@ -77,7 +71,7 @@ AppVersionInfo::setup(const char *pkg_name, const char *app_name, const char *ap
   // Otherwise take the build timestamp ("??????" if invalid).
   if (0 != strlen(BUILD_NUMBER)) {
     snprintf(BldNumStr, sizeof(BldNumStr), "%s", BUILD_NUMBER);
-  } else if (! invalid_datetime) {
+  } else if (!invalid_datetime) {
     snprintf(BldNumStr, sizeof(BldNumStr), "%02d%02d%02d", month, day, hour);
   } else {
     snprintf(BldNumStr, sizeof(BldNumStr), "??????");
@@ -113,9 +107,8 @@ AppVersionInfo::setup(const char *pkg_name, const char *app_name, const char *ap
   if (FullVersionInfoStr[0] == '\0')
     ink_strlcpy(FullVersionInfoStr, "?", sizeof(FullVersionInfoStr));
 
-  snprintf(FullVersionInfoStr, sizeof(FullVersionInfoStr),
-           "%s - %s - %s - (build # %s on %s at %s)",
-           PkgStr, AppStr, VersionStr, BldNumStr, BldDateStr, BldTimeStr);
+  snprintf(FullVersionInfoStr, sizeof(FullVersionInfoStr), "%s - %s - %s - (build # %s on %s at %s)", PkgStr, AppStr, VersionStr,
+           BldNumStr, BldDateStr, BldTimeStr);
 
   defined = 1;
 }
@@ -127,8 +120,7 @@ AppVersionInfo::setup(const char *pkg_name, const char *app_name, const char *ap
 /**
  * AppVersionInfo class test.
  */
-REGRESSION_TEST(AppVersionInfo)(RegressionTest* t, int /* atype ATS_UNUSED */,
-    int*  pstatus)
+REGRESSION_TEST(AppVersionInfo)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
 {
   *pstatus = REGRESSION_TEST_PASSED;
 
@@ -136,16 +128,13 @@ REGRESSION_TEST(AppVersionInfo)(RegressionTest* t, int /* atype ATS_UNUSED */,
 
   TestBox tb(t, pstatus);
 
-  const char * errMsgFormat = "wrong build number, expected '%s', got '%s'";
-  const char * bench[][3] =
-  {
-      // date, time, resulting build number
-      {"Oct  4 1957", "19:28:34", BUILD_NUMBER},
-      {"Oct  4 1957", "19:28:34", "100419"},
-      {"Apr  4 1957", "09:08:04", "040409"},
-      {" 4 Apr 1957", "09:08:04", "??????"},
-      {"Apr  4 1957", "09-08-04", "??????"}
-  };
+  const char *errMsgFormat = "wrong build number, expected '%s', got '%s'";
+  const char *bench[][3] = {// date, time, resulting build number
+                            {"Oct  4 1957", "19:28:34", BUILD_NUMBER},
+                            {"Oct  4 1957", "19:28:34", "100419"},
+                            {"Apr  4 1957", "09:08:04", "040409"},
+                            {" 4 Apr 1957", "09:08:04", "??????"},
+                            {"Apr  4 1957", "09-08-04", "??????"}};
 
   int benchSize = sizeof(bench) / sizeof(bench[0]);
 
@@ -154,16 +143,12 @@ REGRESSION_TEST(AppVersionInfo)(RegressionTest* t, int /* atype ATS_UNUSED */,
     // possible to change the version value from inside the regression test.
     // If not empty BUILD_NUMBER overrides any result, in this case run only
     // this test (the rest will always fail).
-    info.setup("Apache Traffic Server", "traffic_server", "5.2.1",
-        bench[0][0], bench[0][1], "build_slave", "builder", "");
-    tb.check(0 == strcmp(info.BldNumStr, bench[0][2]), errMsgFormat,
-        bench[0][2], info.BldNumStr);
+    info.setup("Apache Traffic Server", "traffic_server", "5.2.1", bench[0][0], bench[0][1], "build_slave", "builder", "");
+    tb.check(0 == strcmp(info.BldNumStr, bench[0][2]), errMsgFormat, bench[0][2], info.BldNumStr);
   } else {
     for (int i = 1; i < benchSize; i++) {
-      info.setup("Apache Traffic Server", "traffic_server", "5.2.1",
-          bench[i][0], bench[i][1], "build_slave", "builder", "");
-      tb.check(0 == strcmp(info.BldNumStr, bench[i][2]), errMsgFormat,
-          bench[i][2], info.BldNumStr);
+      info.setup("Apache Traffic Server", "traffic_server", "5.2.1", bench[i][0], bench[i][1], "build_slave", "builder", "");
+      tb.check(0 == strcmp(info.BldNumStr, bench[i][2]), errMsgFormat, bench[i][2], info.BldNumStr);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/defalloc.h
----------------------------------------------------------------------
diff --git a/lib/ts/defalloc.h b/lib/ts/defalloc.h
index 90ff451..ce20678 100644
--- a/lib/ts/defalloc.h
+++ b/lib/ts/defalloc.h
@@ -21,14 +21,23 @@
   limitations under the License.
  */
 #ifndef _defalloc_H_
-#define  _defalloc_H_
+#define _defalloc_H_
 
 #include "ink_memory.h"
 
-class DefaultAlloc { public:
-  static void *alloc(int s) { return ats_malloc(s); }
-  static void free(void *p) { ats_free(p); }
+class DefaultAlloc
+{
+public:
+  static void *
+  alloc(int s)
+  {
+    return ats_malloc(s);
+  }
+  static void
+  free(void *p)
+  {
+    ats_free(p);
+  }
 };
 
 #endif
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/fastlz.c
----------------------------------------------------------------------
diff --git a/lib/ts/fastlz.c b/lib/ts/fastlz.c
index 9ce8803..f077edd 100644
--- a/lib/ts/fastlz.c
+++ b/lib/ts/fastlz.c
@@ -36,11 +36,11 @@
  * Give hints to the compiler for branch prediction optimization.
  */
 #if defined(__GNUC__) && (__GNUC__ > 2)
-#define FASTLZ_EXPECT_CONDITIONAL(c)    (__builtin_expect((c), 1))
-#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
+#define FASTLZ_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1))
+#define FASTLZ_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0))
 #else
-#define FASTLZ_EXPECT_CONDITIONAL(c)    (c)
-#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (c)
+#define FASTLZ_EXPECT_CONDITIONAL(c) (c)
+#define FASTLZ_UNEXPECT_CONDITIONAL(c) (c)
 #endif
 
 /*
@@ -59,7 +59,7 @@
  */
 #if !defined(FASTLZ_STRICT_ALIGN)
 #define FASTLZ_STRICT_ALIGN
-#if defined(__i386__) || defined(__386)  /* GNU C, Sun Studio */
+#if defined(__i386__) || defined(__386) /* GNU C, Sun Studio */
 #undef FASTLZ_STRICT_ALIGN
 #elif defined(__i486__) || defined(__i586__) || defined(__i686__) /* GNU C */
 #undef FASTLZ_STRICT_ALIGN
@@ -77,29 +77,34 @@
 /*
  * FIXME: use preprocessor magic to set this on different platforms!
  */
-typedef unsigned char  flzuint8;
+typedef unsigned char flzuint8;
 typedef unsigned short flzuint16;
-typedef unsigned int   flzuint32;
+typedef unsigned int flzuint32;
 
 /* prototypes */
-int fastlz_compress(const void* input, int length, void* output);
-int fastlz_compress_level(int level, const void* input, int length, void* output);
-int fastlz_decompress(const void* input, int length, void* output, int maxout);
+int fastlz_compress(const void *input, int length, void *output);
+int fastlz_compress_level(int level, const void *input, int length, void *output);
+int fastlz_decompress(const void *input, int length, void *output, int maxout);
 
-#define MAX_COPY       32
-#define MAX_LEN       264  /* 256 + 8 */
+#define MAX_COPY 32
+#define MAX_LEN 264 /* 256 + 8 */
 #define MAX_DISTANCE 8192
 
 #if !defined(FASTLZ_STRICT_ALIGN)
-#define FASTLZ_READU16(p) *((const flzuint16*)(p))
+#define FASTLZ_READU16(p) *((const flzuint16 *)(p))
 #else
-#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
+#define FASTLZ_READU16(p) ((p)[0] | (p)[1] << 8)
 #endif
 
-#define HASH_LOG  13
-#define HASH_SIZE (1<< HASH_LOG)
-#define HASH_MASK  (HASH_SIZE-1)
-#define HASH_FUNCTION(v,p) { v = FASTLZ_READU16(p); v ^= FASTLZ_READU16(p+1)^(v>>(16-HASH_LOG));v &= HASH_MASK; }
+#define HASH_LOG 13
+#define HASH_SIZE (1 << HASH_LOG)
+#define HASH_MASK (HASH_SIZE - 1)
+#define HASH_FUNCTION(v, p)                              \
+  {                                                      \
+    v = FASTLZ_READU16(p);                               \
+    v ^= FASTLZ_READU16(p + 1) ^ (v >> (16 - HASH_LOG)); \
+    v &= HASH_MASK;                                      \
+  }
 
 #undef FASTLZ_LEVEL
 #define FASTLZ_LEVEL 1
@@ -108,8 +113,8 @@ int fastlz_decompress(const void* input, int length, void* output, int maxout);
 #undef FASTLZ_DECOMPRESSOR
 #define FASTLZ_COMPRESSOR fastlz1_compress
 #define FASTLZ_DECOMPRESSOR fastlz1_decompress
-static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
-static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
+static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void *input, int length, void *output);
+static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void *input, int length, void *output, int maxout);
 #include "fastlz.c"
 
 #undef FASTLZ_LEVEL
@@ -117,45 +122,48 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
 
 #undef MAX_DISTANCE
 #define MAX_DISTANCE 8191
-#define MAX_FARDISTANCE (65535+MAX_DISTANCE-1)
+#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
 
 #undef FASTLZ_COMPRESSOR
 #undef FASTLZ_DECOMPRESSOR
 #define FASTLZ_COMPRESSOR fastlz2_compress
 #define FASTLZ_DECOMPRESSOR fastlz2_decompress
-static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
-static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
+static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void *input, int length, void *output);
+static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void *input, int length, void *output, int maxout);
 #include "fastlz.c"
 
-int fastlz_compress(const void* input, int length, void* output)
+int
+fastlz_compress(const void *input, int length, void *output)
 {
   /* for short block, choose fastlz1 */
-  if(length < 65536)
+  if (length < 65536)
     return fastlz1_compress(input, length, output);
 
   /* else... */
   return fastlz2_compress(input, length, output);
 }
 
-int fastlz_decompress(const void* input, int length, void* output, int maxout)
+int
+fastlz_decompress(const void *input, int length, void *output, int maxout)
 {
   /* magic identifier for compression level */
-  int level = ((*(const flzuint8*)input) >> 5) + 1;
+  int level = ((*(const flzuint8 *)input) >> 5) + 1;
 
-  if(level == 1)
+  if (level == 1)
     return fastlz1_decompress(input, length, output, maxout);
-  if(level == 2)
+  if (level == 2)
     return fastlz2_decompress(input, length, output, maxout);
 
   /* unknown level, trigger error */
   return 0;
 }
 
-int fastlz_compress_level(int level, const void* input, int length, void* output)
+int
+fastlz_compress_level(int level, const void *input, int length, void *output)
 {
-  if(level == 1)
+  if (level == 1)
     return fastlz1_compress(input, length, output);
-  if(level == 2)
+  if (level == 2)
     return fastlz2_compress(input, length, output);
 
   return 0;
@@ -163,32 +171,30 @@ int fastlz_compress_level(int level, const void* input, int length, void* output
 
 #else /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
 
-static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output)
+static FASTLZ_INLINE int
+FASTLZ_COMPRESSOR(const void *input, int length, void *output)
 {
-  const flzuint8* ip = (const flzuint8*) input;
-  const flzuint8* ip_bound = ip + length - 2;
-  const flzuint8* ip_limit = ip + length - 12;
-  flzuint8* op = (flzuint8*) output;
+  const flzuint8 *ip = (const flzuint8 *)input;
+  const flzuint8 *ip_bound = ip + length - 2;
+  const flzuint8 *ip_limit = ip + length - 12;
+  flzuint8 *op = (flzuint8 *)output;
 
-  const flzuint8* htab[HASH_SIZE];
-  const flzuint8** hslot;
+  const flzuint8 *htab[HASH_SIZE];
+  const flzuint8 **hslot;
   flzuint32 hval;
 
   flzuint32 copy;
 
   /* sanity check */
-  if(FASTLZ_UNEXPECT_CONDITIONAL(length < 4))
-  {
-    if(length)
-    {
+  if (FASTLZ_UNEXPECT_CONDITIONAL(length < 4)) {
+    if (length) {
       /* create literal copy only */
-      *op++ = length-1;
+      *op++ = length - 1;
       ip_bound++;
-      while(ip <= ip_bound)
+      while (ip <= ip_bound)
         *op++ = *ip++;
-      return length+1;
-    }
-    else
+      return length + 1;
+    } else
       return 0;
   }
 
@@ -198,26 +204,24 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
 
   /* we start with literal copy */
   copy = 2;
-  *op++ = MAX_COPY-1;
+  *op++ = MAX_COPY - 1;
   *op++ = *ip++;
   *op++ = *ip++;
 
   /* main loop */
-  while(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
-  {
-    const flzuint8* ref;
+  while (FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit)) {
+    const flzuint8 *ref;
     flzuint32 distance;
 
     /* minimum match length */
     flzuint32 len = 3;
 
     /* comparison starting-point */
-    const flzuint8* anchor = ip;
+    const flzuint8 *anchor = ip;
 
-    /* check for a run */
-#if FASTLZ_LEVEL==2
-    if(ip[0] == ip[-1] && FASTLZ_READU16(ip-1)==FASTLZ_READU16(ip+1))
-    {
+/* check for a run */
+#if FASTLZ_LEVEL == 2
+    if (ip[0] == ip[-1] && FASTLZ_READU16(ip - 1) == FASTLZ_READU16(ip + 1)) {
       distance = 1;
       ref = anchor - 1 + 3;
       goto match;
@@ -225,7 +229,7 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
 #endif
 
     /* find potential match */
-    HASH_FUNCTION(hval,ip);
+    HASH_FUNCTION(hval, ip);
     hslot = htab + hval;
     ref = htab[hval];
 
@@ -236,25 +240,24 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
     *hslot = anchor;
 
     /* is this a match? check the first 3 bytes */
-    if(distance==0 ||
-#if FASTLZ_LEVEL==1
-    (distance >= MAX_DISTANCE) ||
+    if (distance == 0 ||
+#if FASTLZ_LEVEL == 1
+        (distance >= MAX_DISTANCE) ||
 #else
-    (distance >= MAX_FARDISTANCE) ||
+        (distance >= MAX_FARDISTANCE) ||
 #endif
-    *ref++ != *ip++ || *ref++!=*ip++ || *ref++!=*ip++)
+        *ref++ != *ip++ || *ref++ != *ip++ || *ref++ != *ip++)
       goto literal;
 
-#if FASTLZ_LEVEL==2
+#if FASTLZ_LEVEL == 2
     /* far, needs at least 5-byte match */
-    if(distance >= MAX_DISTANCE)
-    {
-      if(*ip++ != *ref++ || *ip++!= *ref++)
+    if (distance >= MAX_DISTANCE) {
+      if (*ip++ != *ref++ || *ip++ != *ref++)
         goto literal;
       len += 2;
     }
 
-    match:
+  match:
 #endif
 
     /* last matched byte */
@@ -263,34 +266,43 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
     /* distance is biased */
     distance--;
 
-    if(!distance)
-    {
+    if (!distance) {
       /* zero distance means a run */
       flzuint8 x = ip[-1];
-      while(ip < ip_bound)
-        if(*ref++ != x) break; else ip++;
-    }
-    else
-    for(;;)
-    {
-      /* safe because the outer check against ip limit */
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      if(*ref++ != *ip++) break;
-      while(ip < ip_bound)
-        if(*ref++ != *ip++) break;
-      break;
-    }
+      while (ip < ip_bound)
+        if (*ref++ != x)
+          break;
+        else
+          ip++;
+    } else
+      for (;;) {
+        /* safe because the outer check against ip limit */
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        if (*ref++ != *ip++)
+          break;
+        while (ip < ip_bound)
+          if (*ref++ != *ip++)
+            break;
+        break;
+      }
 
     /* if we have copied something, adjust the copy count */
-    if(copy)
+    if (copy)
       /* copy is biased, '0' means 1 byte copy */
-      *(op-copy-1) = copy-1;
+      *(op - copy - 1) = copy - 1;
     else
       /* back, to overwrite the copy count */
       op--;
@@ -302,40 +314,31 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
     ip -= 3;
     len = ip - anchor;
 
-    /* encode the match */
-#if FASTLZ_LEVEL==2
-    if(distance < MAX_DISTANCE)
-    {
-      if(len < 7)
-      {
+/* encode the match */
+#if FASTLZ_LEVEL == 2
+    if (distance < MAX_DISTANCE) {
+      if (len < 7) {
         *op++ = (len << 5) + (distance >> 8);
         *op++ = (distance & 255);
-      }
-      else
-      {
+      } else {
         *op++ = (7 << 5) + (distance >> 8);
-        for(len-=7; len >= 255; len-= 255)
+        for (len -= 7; len >= 255; len -= 255)
           *op++ = 255;
         *op++ = len;
         *op++ = (distance & 255);
       }
-    }
-    else
-    {
+    } else {
       /* far away, but not yet in the another galaxy... */
-      if(len < 7)
-      {
+      if (len < 7) {
         distance -= MAX_DISTANCE;
         *op++ = (len << 5) + 31;
         *op++ = 255;
         *op++ = distance >> 8;
         *op++ = distance & 255;
-      }
-      else
-      {
+      } else {
         distance -= MAX_DISTANCE;
         *op++ = (7 << 5) + 31;
-        for(len-=7; len >= 255; len-= 255)
+        for (len -= 7; len >= 255; len -= 255)
           *op++ = 255;
         *op++ = len;
         *op++ = 255;
@@ -345,22 +348,18 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
     }
 #else
 
-    if(FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN-2))
-      while(len > MAX_LEN-2)
-      {
+    if (FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN - 2))
+      while (len > MAX_LEN - 2) {
         *op++ = (7 << 5) + (distance >> 8);
-        *op++ = MAX_LEN - 2 - 7 -2;
+        *op++ = MAX_LEN - 2 - 7 - 2;
         *op++ = (distance & 255);
-        len -= MAX_LEN-2;
+        len -= MAX_LEN - 2;
       }
 
-    if(len < 7)
-    {
+    if (len < 7) {
       *op++ = (len << 5) + (distance >> 8);
       *op++ = (distance & 255);
-    }
-    else
-    {
+    } else {
       *op++ = (7 << 5) + (distance >> 8);
       *op++ = len - 7;
       *op++ = (distance & 255);
@@ -368,127 +367,118 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
 #endif
 
     /* update the hash at match boundary */
-    HASH_FUNCTION(hval,ip);
+    HASH_FUNCTION(hval, ip);
     htab[hval] = ip++;
-    HASH_FUNCTION(hval,ip);
+    HASH_FUNCTION(hval, ip);
     htab[hval] = ip++;
 
     /* assuming literal copy */
-    *op++ = MAX_COPY-1;
+    *op++ = MAX_COPY - 1;
 
     continue;
 
-    literal:
-      *op++ = *anchor++;
-      ip = anchor;
-      copy++;
-      if(FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY))
-      {
-        copy = 0;
-        *op++ = MAX_COPY-1;
-      }
+  literal:
+    *op++ = *anchor++;
+    ip = anchor;
+    copy++;
+    if (FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY)) {
+      copy = 0;
+      *op++ = MAX_COPY - 1;
+    }
   }
 
   /* left-over as literal copy */
   ip_bound++;
-  while(ip <= ip_bound)
-  {
+  while (ip <= ip_bound) {
     *op++ = *ip++;
     copy++;
-    if(copy == MAX_COPY)
-    {
+    if (copy == MAX_COPY) {
       copy = 0;
-      *op++ = MAX_COPY-1;
+      *op++ = MAX_COPY - 1;
     }
   }
 
   /* if we have copied something, adjust the copy length */
-  if(copy)
-    *(op-copy-1) = copy-1;
+  if (copy)
+    *(op - copy - 1) = copy - 1;
   else
     op--;
 
-#if FASTLZ_LEVEL==2
+#if FASTLZ_LEVEL == 2
   /* marker for fastlz2 */
-  *(flzuint8*)output |= (1 << 5);
+  *(flzuint8 *)output |= (1 << 5);
 #endif
 
-  return op - (flzuint8*)output;
+  return op - (flzuint8 *)output;
 }
 
-static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout)
+static FASTLZ_INLINE int
+FASTLZ_DECOMPRESSOR(const void *input, int length, void *output, int maxout)
 {
-  const flzuint8* ip = (const flzuint8*) input;
-  const flzuint8* ip_limit  = ip + length;
-  flzuint8* op = (flzuint8*) output;
-  flzuint8* op_limit = op + maxout;
+  const flzuint8 *ip = (const flzuint8 *)input;
+  const flzuint8 *ip_limit = ip + length;
+  flzuint8 *op = (flzuint8 *)output;
+  flzuint8 *op_limit = op + maxout;
   flzuint32 ctrl = (*ip++) & 31;
   int loop = 1;
 
-  do
-  {
-    const flzuint8* ref = op;
+  do {
+    const flzuint8 *ref = op;
     flzuint32 len = ctrl >> 5;
     flzuint32 ofs = (ctrl & 31) << 8;
 
-    if(ctrl >= 32)
-    {
-#if FASTLZ_LEVEL==2
+    if (ctrl >= 32) {
+#if FASTLZ_LEVEL == 2
       flzuint8 code;
 #endif
       len--;
       ref -= ofs;
-      if (len == 7-1)
-#if FASTLZ_LEVEL==1
+      if (len == 7 - 1)
+#if FASTLZ_LEVEL == 1
         len += *ip++;
       ref -= *ip++;
 #else
-        do
-        {
+        do {
           code = *ip++;
           len += code;
-        } while (code==255);
+        } while (code == 255);
       code = *ip++;
       ref -= code;
 
       /* match from 16-bit distance */
-      if(FASTLZ_UNEXPECT_CONDITIONAL(code==255))
-      if(FASTLZ_EXPECT_CONDITIONAL(ofs==(31 << 8)))
-      {
-        ofs = (*ip++) << 8;
-        ofs += *ip++;
-        ref = op - ofs - MAX_DISTANCE;
-      }
+      if (FASTLZ_UNEXPECT_CONDITIONAL(code == 255))
+        if (FASTLZ_EXPECT_CONDITIONAL(ofs == (31 << 8))) {
+          ofs = (*ip++) << 8;
+          ofs += *ip++;
+          ref = op - ofs - MAX_DISTANCE;
+        }
 #endif
 
 #ifdef FASTLZ_SAFE
       if (FASTLZ_UNEXPECT_CONDITIONAL(op + len + 3 > op_limit))
         return 0;
 
-      if (FASTLZ_UNEXPECT_CONDITIONAL(ref-1 < (flzuint8 *)output))
+      if (FASTLZ_UNEXPECT_CONDITIONAL(ref - 1 < (flzuint8 *)output))
         return 0;
 #endif
 
-      if(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
+      if (FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
         ctrl = *ip++;
       else
         loop = 0;
 
-      if(ref == op)
-      {
+      if (ref == op) {
         /* optimize copy for a run */
         flzuint8 b = ref[-1];
         *op++ = b;
         *op++ = b;
         *op++ = b;
-        for(; len; --len)
+        for (; len; --len)
           *op++ = b;
-      }
-      else
-      {
+      } else {
 #if !defined(FASTLZ_STRICT_ALIGN)
-        const flzuint16* p;
-        flzuint16* q;
+        const flzuint16 *p;
+        flzuint16 *q;
 #endif
         /* copy from reference */
         ref--;
@@ -498,33 +488,29 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
 
 #if !defined(FASTLZ_STRICT_ALIGN)
         /* copy a byte, so that now it's word aligned */
-        if(len & 1)
-        {
+        if (len & 1) {
           *op++ = *ref++;
           len--;
         }
 
         /* copy 16-bit at once */
-        q = (flzuint16*) op;
+        q = (flzuint16 *)op;
         op += len;
-        p = (const flzuint16*) ref;
-        for(len>>=1; len > 4; len-=4)
-        {
+        p = (const flzuint16 *)ref;
+        for (len >>= 1; len > 4; len -= 4) {
           *q++ = *p++;
           *q++ = *p++;
           *q++ = *p++;
           *q++ = *p++;
         }
-        for(; len; --len)
+        for (; len; --len)
           *q++ = *p++;
 #else
-        for(; len; --len)
+        for (; len; --len)
           *op++ = *ref++;
 #endif
       }
-    }
-    else
-    {
+    } else {
       ctrl++;
 #ifdef FASTLZ_SAFE
       if (FASTLZ_UNEXPECT_CONDITIONAL(op + ctrl > op_limit))
@@ -534,17 +520,16 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
 #endif
 
       *op++ = *ip++;
-      for(--ctrl; ctrl; ctrl--)
+      for (--ctrl; ctrl; ctrl--)
         *op++ = *ip++;
 
       loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
-      if(loop)
+      if (loop)
         ctrl = *ip++;
     }
-  }
-  while(FASTLZ_EXPECT_CONDITIONAL(loop));
+  } while (FASTLZ_EXPECT_CONDITIONAL(loop));
 
-  return op - (flzuint8*)output;
+  return op - (flzuint8 *)output;
 }
 
 #endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/fastlz.h
----------------------------------------------------------------------
diff --git a/lib/ts/fastlz.h b/lib/ts/fastlz.h
index e5ca8df..a71f992 100644
--- a/lib/ts/fastlz.h
+++ b/lib/ts/fastlz.h
@@ -29,13 +29,13 @@
 
 #define FASTLZ_VERSION 0x000100
 
-#define FASTLZ_VERSION_MAJOR     0
-#define FASTLZ_VERSION_MINOR     0
-#define FASTLZ_VERSION_REVISION  0
+#define FASTLZ_VERSION_MAJOR 0
+#define FASTLZ_VERSION_MINOR 0
+#define FASTLZ_VERSION_REVISION 0
 
 #define FASTLZ_VERSION_STRING "0.1.0"
 
-#if defined (__cplusplus)
+#if defined(__cplusplus)
 extern "C" {
 #endif
 
@@ -53,7 +53,7 @@ extern "C" {
   The input buffer and the output buffer can not overlap.
 */
 
-int fastlz_compress(const void* input, int length, void* output);
+int fastlz_compress(const void *input, int length, void *output);
 
 /**
   Decompress a block of compressed data and returns the size of the
@@ -67,7 +67,7 @@ int fastlz_compress(const void* input, int length, void* output);
   more than what is specified in maxout.
  */
 
-int fastlz_decompress(const void* input, int length, void* output, int maxout);
+int fastlz_decompress(const void *input, int length, void *output, int maxout);
 
 /**
   Compress a block of data in the input buffer and returns the size of
@@ -91,9 +91,9 @@ int fastlz_decompress(const void* input, int length, void* output, int maxout);
   decompressed using the function fastlz_decompress above.
 */
 
-int fastlz_compress_level(int level, const void* input, int length, void* output);
+int fastlz_compress_level(int level, const void *input, int length, void *output);
 
-#if defined (__cplusplus)
+#if defined(__cplusplus)
 }
 #endif
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_aiocb.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_aiocb.h b/lib/ts/ink_aiocb.h
index 0271d2e..0689437 100644
--- a/lib/ts/ink_aiocb.h
+++ b/lib/ts/ink_aiocb.h
@@ -36,28 +36,27 @@
 
 /* TODO use native aiocb where possible */
 
-#define	LIO_READ	0x1
-#define	LIO_WRITE	0x2
+#define LIO_READ 0x1
+#define LIO_WRITE 0x2
 
-struct ink_aiocb
-{
+struct ink_aiocb {
   int aio_fildes;
-#if	defined(__STDC__)
-  volatile void *aio_buf;       /* buffer location */
+#if defined(__STDC__)
+  volatile void *aio_buf; /* buffer location */
 #else
-  void *aio_buf;                /* buffer location */
+  void *aio_buf; /* buffer location */
 #endif
-  size_t aio_nbytes;            /* length of transfer */
+  size_t aio_nbytes; /* length of transfer */
 
   // TODO change to off_t
-  off_t aio_offset;         /* file offset */
+  off_t aio_offset; /* file offset */
 
-  int aio_reqprio;              /* request priority offset */
+  int aio_reqprio; /* request priority offset */
   //    struct sigevent aio_sigevent;   /* signal number and offset */
-  int aio_lio_opcode;           /* listio operation */
+  int aio_lio_opcode; /* listio operation */
   //    aio_result_t    aio_resultp;    /* results */
-  int aio_state;                /* state flag for List I/O */
-  int aio__pad[1];              /* extension padding */
+  int aio_state;   /* state flag for List I/O */
+  int aio__pad[1]; /* extension padding */
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_align.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_align.h b/lib/ts/ink_align.h
index f865d8d..63f966a 100644
--- a/lib/ts/ink_align.h
+++ b/lib/ts/ink_align.h
@@ -25,7 +25,7 @@
 #ifndef _ink_align_h_
 #define _ink_align_h_
 
-# include "ink_time.h"
+#include "ink_time.h"
 
 union Alias32 {
   uint8_t byte[4];
@@ -48,8 +48,7 @@ union Alias64 {
 
 #define INK_MIN_ALIGN 8
 /* INK_ALIGN() is only to be used to align on a power of 2 boundary */
-#define INK_ALIGN(size, boundary) \
-    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
+#define INK_ALIGN(size, boundary) (((size) + ((boundary)-1)) & ~((boundary)-1))
 
 /** Default alignment */
 #define INK_ALIGN_DEFAULT(size) INK_ALIGN(size, INK_MIN_ALIGN)
@@ -60,13 +59,13 @@ union Alias64 {
 static inline void *
 align_pointer_forward(const void *pointer_, size_t alignment)
 {
-  char *pointer = (char *) pointer_;
+  char *pointer = (char *)pointer_;
   //
   // Round up alignment..
   //
-  pointer = (char *) INK_ALIGN((ptrdiff_t) pointer, alignment);
+  pointer = (char *)INK_ALIGN((ptrdiff_t)pointer, alignment);
 
-  return (void *) pointer;
+  return (void *)pointer;
 }
 
 //
@@ -76,8 +75,8 @@ align_pointer_forward(const void *pointer_, size_t alignment)
 static inline void *
 align_pointer_forward_and_zero(const void *pointer_, size_t alignment)
 {
-  char *pointer = (char *) pointer_;
-  char *aligned = (char *) INK_ALIGN((ptrdiff_t) pointer, alignment);
+  char *pointer = (char *)pointer_;
+  char *aligned = (char *)INK_ALIGN((ptrdiff_t)pointer, alignment);
   //
   // Fill the skippings..
   //
@@ -86,7 +85,7 @@ align_pointer_forward_and_zero(const void *pointer_, size_t alignment)
     pointer++;
   }
 
-  return (void *) aligned;
+  return (void *)aligned;
 }
 
 //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_apidefs.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_apidefs.h b/lib/ts/ink_apidefs.h
index 16f1bb9..0eb1d04 100644
--- a/lib/ts/ink_apidefs.h
+++ b/lib/ts/ink_apidefs.h
@@ -31,17 +31,17 @@
 
 #if defined(__GNUC__) || defined(__clang__)
 #ifndef likely
-#define likely(x)	__builtin_expect (!!(x), 1)
+#define likely(x) __builtin_expect(!!(x), 1)
 #endif
 #ifndef unlikely
-#define unlikely(x)	__builtin_expect (!!(x), 0)
+#define unlikely(x) __builtin_expect(!!(x), 0)
 #endif
 #else
 #ifndef likely
-#define likely(x)	(x)
+#define likely(x) (x)
 #endif
 #ifndef unlikely
-#define unlikely(x)	(x)
+#define unlikely(x) (x)
 #endif
 #endif
 
@@ -65,7 +65,7 @@
 
 #if !defined(TS_NONNULL)
 #if defined(__GNUC__) || defined(__clang__)
-#define TS_NONNULL(...) __attribute__((nonnull (__VA_ARGS__)))
+#define TS_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
 #else
 #define TS_NONNULL(...)
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_args.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_args.cc b/lib/ts/ink_args.cc
index c121813..12ab5c0 100644
--- a/lib/ts/ink_args.cc
+++ b/lib/ts/ink_args.cc
@@ -32,49 +32,41 @@ Process arguments
 //  Global variables
 //
 
-const char *file_arguments[MAX_FILE_ARGUMENTS] = { 0 };
-const char *program_name = (char *) "Traffic Server";
+const char *file_arguments[MAX_FILE_ARGUMENTS] = {0};
+const char *program_name = (char *)"Traffic Server";
 unsigned n_file_arguments = 0;
 
 //
 //  Local variables
 //
 
-static const char *argument_types_keys = (char *) "ISDfFTL";
-static const char *argument_types_descriptions[] = {
-  (char *) "int  ",
-  (char *) "str  ",
-  (char *) "dbl  ",
-  (char *) "off  ",
-  (char *) "on   ",
-  (char *) "tog  ",
-  (char *) "i64  ",
-  (char *) "     "
-};
+static const char *argument_types_keys = (char *)"ISDfFTL";
+static const char *argument_types_descriptions[] = {(char *)"int  ",  (char *) "str  ", (char *) "dbl  ", (char *) "off  ",
+                                                    (char *) "on   ", (char *) "tog  ", (char *) "i64  ", (char *) "     "};
 
 //
 // Functions
 //
 
 static bool
-arg_is_version_flag(const ArgumentDescription * arg)
+arg_is_version_flag(const ArgumentDescription *arg)
 {
   return strcmp(arg->name, "version") == 0 && arg->key == 'V';
 }
 
 static void
-append_file_argument(const char * arg)
+append_file_argument(const char *arg)
 {
-    if (n_file_arguments >= countof(file_arguments)) {
-      ink_fatal("too many files");
-    }
+  if (n_file_arguments >= countof(file_arguments)) {
+    ink_fatal("too many files");
+  }
 
-    file_arguments[n_file_arguments++] = arg;
+  file_arguments[n_file_arguments++] = arg;
 }
 
 static bool
-process_arg(const AppVersionInfo * appinfo, const ArgumentDescription * argument_descriptions,
-            unsigned n_argument_descriptions, int i, const char ***argv)
+process_arg(const AppVersionInfo *appinfo, const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions,
+            int i, const char ***argv)
 {
   const char *arg = NULL;
 
@@ -86,9 +78,9 @@ process_arg(const AppVersionInfo * appinfo, const ArgumentDescription * argument
   if (argument_descriptions[i].type) {
     char type = argument_descriptions[i].type[0];
     if (type == 'F' || type == 'f') {
-      *(int *) argument_descriptions[i].location = type == 'F' ? 1 : 0;
+      *(int *)argument_descriptions[i].location = type == 'F' ? 1 : 0;
     } else if (type == 'T') {
-      *(int *) argument_descriptions[i].location = !*(int *) argument_descriptions[i].location;
+      *(int *)argument_descriptions[i].location = !*(int *)argument_descriptions[i].location;
     } else {
       arg = *++(**argv) ? **argv : *++(*argv);
       if (!arg) {
@@ -96,20 +88,20 @@ process_arg(const AppVersionInfo * appinfo, const ArgumentDescription * argument
       }
       switch (type) {
       case 'I':
-        *(int *) argument_descriptions[i].location = atoi(arg);
+        *(int *)argument_descriptions[i].location = atoi(arg);
         break;
       case 'D':
-        *(double *) argument_descriptions[i].location = atof(arg);
+        *(double *)argument_descriptions[i].location = atof(arg);
         break;
       case 'L':
-        *(int64_t *) argument_descriptions[i].location = ink_atoi64(arg);
+        *(int64_t *)argument_descriptions[i].location = ink_atoi64(arg);
         break;
       case 'S':
         if (argument_descriptions[i].type[1] == '*') {
-          char ** out = (char **)argument_descriptions[i].location;
+          char **out = (char **)argument_descriptions[i].location;
           *out = ats_strdup(arg);
         } else {
-          ink_strlcpy((char *) argument_descriptions[i].location, arg, atoi(argument_descriptions[i].type + 1));
+          ink_strlcpy((char *)argument_descriptions[i].location, arg, atoi(argument_descriptions[i].type + 1));
         }
         break;
       default:
@@ -129,7 +121,7 @@ process_arg(const AppVersionInfo * appinfo, const ArgumentDescription * argument
 
 
 void
-show_argument_configuration(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions)
+show_argument_configuration(const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions)
 {
   printf("Argument Configuration\n");
   for (unsigned i = 0; i < n_argument_descriptions; i++) {
@@ -139,19 +131,19 @@ show_argument_configuration(const ArgumentDescription * argument_descriptions, u
       case 'F':
       case 'f':
       case 'T':
-        printf(*(int *) argument_descriptions[i].location ? "TRUE" : "FALSE");
+        printf(*(int *)argument_descriptions[i].location ? "TRUE" : "FALSE");
         break;
       case 'I':
-        printf("%d", *(int *) argument_descriptions[i].location);
+        printf("%d", *(int *)argument_descriptions[i].location);
         break;
       case 'D':
-        printf("%f", *(double *) argument_descriptions[i].location);
+        printf("%f", *(double *)argument_descriptions[i].location);
         break;
       case 'L':
-        printf("%" PRId64 "", *(int64_t *) argument_descriptions[i].location);
+        printf("%" PRId64 "", *(int64_t *)argument_descriptions[i].location);
         break;
       case 'S':
-        printf("%s", (char *) argument_descriptions[i].location);
+        printf("%s", (char *)argument_descriptions[i].location);
         break;
       default:
         ink_fatal("bad argument description");
@@ -163,16 +155,17 @@ show_argument_configuration(const ArgumentDescription * argument_descriptions, u
 }
 
 void
-process_args(const AppVersionInfo * appinfo, const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions, const char **argv, const char *usage_string)
+process_args(const AppVersionInfo *appinfo, const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions,
+             const char **argv, const char *usage_string)
 {
   if (!process_args_ex(appinfo, argument_descriptions, n_argument_descriptions, argv)) {
-      usage(argument_descriptions, n_argument_descriptions, usage_string);
+    usage(argument_descriptions, n_argument_descriptions, usage_string);
   }
 }
 
 bool
-process_args_ex(const AppVersionInfo * appinfo, const ArgumentDescription * argument_descriptions,
-                  unsigned n_argument_descriptions, const char **argv)
+process_args_ex(const AppVersionInfo *appinfo, const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions,
+                const char **argv)
 {
   unsigned i = 0;
   //
@@ -188,16 +181,16 @@ process_args_ex(const AppVersionInfo * appinfo, const ArgumentDescription * argu
       case 'f':
       case 'F':
       case 'I':
-        *(int *) argument_descriptions[i].location = atoi(env);
+        *(int *)argument_descriptions[i].location = atoi(env);
         break;
       case 'D':
-        *(double *) argument_descriptions[i].location = atof(env);
+        *(double *)argument_descriptions[i].location = atof(env);
         break;
       case 'L':
-        *(int64_t *) argument_descriptions[i].location = atoll(env);
+        *(int64_t *)argument_descriptions[i].location = atoll(env);
         break;
       case 'S':
-        ink_strlcpy((char *) argument_descriptions[i].location, env, atoi(argument_descriptions[i].type + 1));
+        ink_strlcpy((char *)argument_descriptions[i].location, env, atoi(argument_descriptions[i].type + 1));
         break;
       }
     }
@@ -206,7 +199,6 @@ process_args_ex(const AppVersionInfo * appinfo, const ArgumentDescription * argu
   //
   program_name = appinfo->AppStr;
   while (*++argv) {
-
     // Hack for supporting '-' as a file argument.
     if (strcmp(*argv, "-") == 0) {
       append_file_argument(*argv);
@@ -249,7 +241,6 @@ process_args_ex(const AppVersionInfo * appinfo, const ArgumentDescription * argu
         }
       }
     }
-
   }
 
   // If we have any arguments left, slurp them up into file_arguments.
@@ -263,11 +254,11 @@ process_args_ex(const AppVersionInfo * appinfo, const ArgumentDescription * argu
 }
 
 void
-usage(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions, const char *usage_string)
+usage(const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions, const char *usage_string)
 {
-  (void) argument_descriptions;
-  (void) n_argument_descriptions;
-  (void) usage_string;
+  (void)argument_descriptions;
+  (void)n_argument_descriptions;
+  (void)usage_string;
   if (usage_string)
     fprintf(stderr, "%s\n", usage_string);
   else
@@ -279,25 +270,24 @@ usage(const ArgumentDescription * argument_descriptions, unsigned n_argument_des
 
     fprintf(stderr, "  ");
 
-    if ('-' == argument_descriptions[i].key) fprintf(stderr, "   ");
-    else fprintf(stderr, "-%c,", argument_descriptions[i].key);
+    if ('-' == argument_descriptions[i].key)
+      fprintf(stderr, "   ");
+    else
+      fprintf(stderr, "-%c,", argument_descriptions[i].key);
 
-    fprintf(stderr, " --%-17s %s",
-            argument_descriptions[i].name,
+    fprintf(stderr, " --%-17s %s", argument_descriptions[i].name,
             argument_types_descriptions[argument_descriptions[i].type ?
-                                        strchr(argument_types_keys,
-                                               argument_descriptions[i].type[0]) -
-                                        argument_types_keys : strlen(argument_types_keys)
-            ]);
+                                          strchr(argument_types_keys, argument_descriptions[i].type[0]) - argument_types_keys :
+                                          strlen(argument_types_keys)]);
     switch (argument_descriptions[i].type ? argument_descriptions[i].type[0] : 0) {
     case 0:
       fprintf(stderr, "          ");
       break;
     case 'L':
-      fprintf(stderr, " %-9" PRId64 "", *(int64_t *) argument_descriptions[i].location);
+      fprintf(stderr, " %-9" PRId64 "", *(int64_t *)argument_descriptions[i].location);
       break;
     case 'S': {
-      char * location;
+      char *location;
       if (argument_descriptions[i].type[1] == '*') {
         location = *(char **)argument_descriptions[i].location;
       } else {
@@ -316,16 +306,16 @@ usage(const ArgumentDescription * argument_descriptions, unsigned n_argument_des
       break;
     }
     case 'D':
-      fprintf(stderr, " %-9.3f", *(double *) argument_descriptions[i].location);
+      fprintf(stderr, " %-9.3f", *(double *)argument_descriptions[i].location);
       break;
     case 'I':
-      fprintf(stderr, " %-9d", *(int *) argument_descriptions[i].location);
+      fprintf(stderr, " %-9d", *(int *)argument_descriptions[i].location);
       break;
     case 'T':
     case 'f':
     case 'F':
       if (argument_descriptions[i].location) {
-        fprintf(stderr, " %-9s", *(int *) argument_descriptions[i].location ? "true " : "false");
+        fprintf(stderr, " %-9s", *(int *)argument_descriptions[i].location ? "true " : "false");
       } else {
         fprintf(stderr, " %-9s", "false");
       }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_args.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_args.h b/lib/ts/ink_args.h
index 824f919..f535fda 100644
--- a/lib/ts/ink_args.h
+++ b/lib/ts/ink_args.h
@@ -44,23 +44,22 @@ Process arguments
 struct ArgumentDescription;
 class AppVersionInfo;
 
-typedef void ArgumentFunction(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions, const char *arg);
+typedef void ArgumentFunction(const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions, const char *arg);
 
-struct ArgumentDescription
-{
+struct ArgumentDescription {
   const char *name;
   char key; // set to '-' if no single character key.
-  /*
-     "I" = integer
-     "L" = int64_t
-     "D" = double (floating point)
-     "T" = toggle
-     "F" = set flag to TRUE (default is FALSE)
-     "f" = set flag to FALSE (default is TRUE)
-     "T" = toggle
-     "S80" = read string, 80 chars max
-     "S*" = read unbounded string, allocating
-   */
+            /*
+               "I" = integer
+               "L" = int64_t
+               "D" = double (floating point)
+               "T" = toggle
+               "F" = set flag to TRUE (default is FALSE)
+               "f" = set flag to FALSE (default is TRUE)
+               "T" = toggle
+               "S80" = read string, 80 chars max
+               "S*" = read unbounded string, allocating
+             */
   const char *description;
   const char *type;
   void *location;
@@ -68,27 +67,33 @@ struct ArgumentDescription
   ArgumentFunction *pfn;
 };
 
-#define VERSION_ARGUMENT_DESCRIPTION() {"version", 'V', "Print version string", NULL, NULL, NULL, NULL}
-#define HELP_ARGUMENT_DESCRIPTION() {"help", 'h', "Print usage information", NULL, NULL, NULL, usage}
+#define VERSION_ARGUMENT_DESCRIPTION()                             \
+  {                                                                \
+    "version", 'V', "Print version string", NULL, NULL, NULL, NULL \
+  }
+#define HELP_ARGUMENT_DESCRIPTION()                                 \
+  {                                                                 \
+    "help", 'h', "Print usage information", NULL, NULL, NULL, usage \
+  }
 
 /* Global Data
 */
-extern const char *file_arguments[];  // exported by process_args()
+extern const char *file_arguments[]; // exported by process_args()
 extern unsigned n_file_arguments;    // exported by process_args()
-extern const char *program_name;      // exported by process_args()
+extern const char *program_name;     // exported by process_args()
 
 /* Print out arguments and values
 */
-void show_argument_configuration(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions);
+void show_argument_configuration(const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions);
 
-void usage(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions, const char *arg_unused) TS_NORETURN;
+void usage(const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions, const char *arg_unused) TS_NORETURN;
 
 /* Process all arguments
 */
-void process_args(const AppVersionInfo * appinfo, const ArgumentDescription * argument_descriptions,
-                  unsigned n_argument_descriptions, const char **argv, const char *usage_string = 0);
+void process_args(const AppVersionInfo *appinfo, const ArgumentDescription *argument_descriptions, unsigned n_argument_descriptions,
+                  const char **argv, const char *usage_string = 0);
 
-bool process_args_ex(const AppVersionInfo * appinfo, const ArgumentDescription * argument_descriptions,
-                  unsigned n_argument_descriptions, const char **argv);
+bool process_args_ex(const AppVersionInfo *appinfo, const ArgumentDescription *argument_descriptions,
+                     unsigned n_argument_descriptions, const char **argv);
 
 #endif /*_INK_ARGS_H*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_assert.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_assert.h b/lib/ts/ink_assert.h
index 7e89da3..cadefcb 100644
--- a/lib/ts/ink_assert.h
+++ b/lib/ts/ink_assert.h
@@ -32,9 +32,8 @@ Assertions
 #include "ink_error.h"
 
 #ifdef __cplusplus
-extern "C"
-{
-#endif                          /* __cplusplus */
+extern "C" {
+#endif /* __cplusplus */
 
 /* don't use assert, no really DON'T use assert */
 #undef assert
@@ -44,23 +43,19 @@ extern "C"
 #undef __ASSERT_H__
 #define __ASSERT_H__
 
-  inkcoreapi void _ink_assert(const char *a, const char *f, int l) TS_NORETURN;
+inkcoreapi void _ink_assert(const char *a, const char *f, int l) TS_NORETURN;
 
 #if defined(DEBUG) || defined(__clang_analyzer__) || defined(__COVERITY__)
-#define ink_assert(EX) ( \
-            (void)(likely(EX) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__))\
-)
+#define ink_assert(EX) ((void)(likely(EX) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__)))
 #else
 #define ink_assert(EX) (void)(EX)
 #endif
 
-#define ink_release_assert(EX) ( \
-            (void)(likely(EX) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__)) \
-)
+#define ink_release_assert(EX) ((void)(likely(EX) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__)))
 
 #ifdef __cplusplus
 }
-#endif                          /* __cplusplus */
+#endif /* __cplusplus */
 
 #endif /*_INK_ASSERT_H*/
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_atomic.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_atomic.h b/lib/ts/ink_atomic.h
index 1fcd60a..84fc470 100644
--- a/lib/ts/ink_atomic.h
+++ b/lib/ts/ink_atomic.h
@@ -35,7 +35,7 @@
  ****************************************************************************/
 
 #ifndef _ink_atomic_h_
-#define	_ink_atomic_h_
+#define _ink_atomic_h_
 
 #include <stdio.h>
 #include <string.h>
@@ -69,30 +69,38 @@ typedef vvoidp *pvvoidp;
 
 // ink_atomic_swap(ptr, value)
 // Writes @value into @ptr, returning the previous value.
-template <typename T> static inline T
-ink_atomic_swap(volatile T * mem, T value) {
+template <typename T>
+static inline T
+ink_atomic_swap(volatile T *mem, T value)
+{
   return __sync_lock_test_and_set(mem, value);
 }
 
 // ink_atomic_cas(mem, prev, next)
 // Atomically store the value @next into the pointer @mem, but only if the current value at @mem is @prev.
 // Returns true if @next was successfully stored.
-template <typename T> static inline bool
-ink_atomic_cas(volatile T * mem, T prev, T next) {
+template <typename T>
+static inline bool
+ink_atomic_cas(volatile T *mem, T prev, T next)
+{
   return __sync_bool_compare_and_swap(mem, prev, next);
 }
 
 // ink_atomic_increment(ptr, count)
 // Increment @ptr by @count, returning the previous value.
-template <typename Type, typename Amount> static inline Type
-ink_atomic_increment(volatile Type * mem, Amount count) {
+template <typename Type, typename Amount>
+static inline Type
+ink_atomic_increment(volatile Type *mem, Amount count)
+{
   return __sync_fetch_and_add(mem, (Type)count);
 }
 
 // ink_atomic_decrement(ptr, count)
 // Decrement @ptr by @count, returning the previous value.
-template <typename Type, typename Amount> static inline Type
-ink_atomic_decrement(volatile Type * mem, Amount count) {
+template <typename Type, typename Amount>
+static inline Type
+ink_atomic_decrement(volatile Type *mem, Amount count)
+{
   return __sync_fetch_and_sub(mem, (Type)count);
 }
 
@@ -100,9 +108,10 @@ ink_atomic_decrement(volatile Type * mem, Amount count) {
 #if (defined(__arm__) || defined(__mips__)) && (SIZEOF_VOIDP == 4)
 extern ink_mutex __global_death;
 
-template<>
+template <>
 inline int64_t
-ink_atomic_swap<int64_t>(pvint64 mem, int64_t value) {
+ink_atomic_swap<int64_t>(pvint64 mem, int64_t value)
+{
   int64_t old;
   ink_mutex_acquire(&__global_death);
   old = *mem;
@@ -111,20 +120,25 @@ ink_atomic_swap<int64_t>(pvint64 mem, int64_t value) {
   return old;
 }
 
-template<>
+template <>
 inline bool
-ink_atomic_cas<int64_t>(pvint64 mem, int64_t old, int64_t new_value) {
+ink_atomic_cas<int64_t>(pvint64 mem, int64_t old, int64_t new_value)
+{
   int64_t curr;
   ink_mutex_acquire(&__global_death);
   curr = *mem;
-  if(old == curr) *mem = new_value;
+  if (old == curr)
+    *mem = new_value;
   ink_mutex_release(&__global_death);
-  if(old == curr) return 1;
+  if (old == curr)
+    return 1;
   return 0;
 }
 
-template<typename Amount> static inline int64_t
-ink_atomic_increment(pvint64 mem, Amount value) {
+template <typename Amount>
+static inline int64_t
+ink_atomic_increment(pvint64 mem, Amount value)
+{
   int64_t curr;
   ink_mutex_acquire(&__global_death);
   curr = *mem;
@@ -133,8 +147,10 @@ ink_atomic_increment(pvint64 mem, Amount value) {
   return curr;
 }
 
-template<typename Amount> static inline int64_t
-ink_atomic_decrement(pvint64 mem, Amount value) {
+template <typename Amount>
+static inline int64_t
+ink_atomic_decrement(pvint64 mem, Amount value)
+{
   int64_t curr;
   ink_mutex_acquire(&__global_death);
   curr = *mem;
@@ -143,8 +159,10 @@ ink_atomic_decrement(pvint64 mem, Amount value) {
   return curr;
 }
 
-template<typename Amount> static inline uint64_t
-ink_atomic_increment(pvuint64 mem, Amount value) {
+template <typename Amount>
+static inline uint64_t
+ink_atomic_increment(pvuint64 mem, Amount value)
+{
   uint64_t curr;
   ink_mutex_acquire(&__global_death);
   curr = *mem;
@@ -153,8 +171,10 @@ ink_atomic_increment(pvuint64 mem, Amount value) {
   return curr;
 }
 
-template<typename Amount> static inline uint64_t
-ink_atomic_decrement(pvuint64 mem, Amount value) {
+template <typename Amount>
+static inline uint64_t
+ink_atomic_decrement(pvuint64 mem, Amount value)
+{
   uint64_t curr;
   ink_mutex_acquire(&__global_death);
   curr = *mem;
@@ -174,4 +194,4 @@ ink_atomic_decrement(pvuint64 mem, Amount value) {
 #error Need a compiler / libc that supports atomic operations, e.g. gcc v4.1.2 or later
 #endif
 
-#endif                          /* _ink_atomic_h_ */
+#endif /* _ink_atomic_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_auth_api.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_auth_api.cc b/lib/ts/ink_auth_api.cc
index be82c46..401a66c 100644
--- a/lib/ts/ink_auth_api.cc
+++ b/lib/ts/ink_auth_api.cc
@@ -28,8 +28,7 @@
 #include "ink_auth_api.h"
 
 static int s_rand_seed = time(NULL); // + s_rand_seed;
-static InkRand
-s_rand_gen(ink_rand_r((unsigned int *) &s_rand_seed) ^ (uintptr_t) &s_rand_seed);
+static InkRand s_rand_gen(ink_rand_r((unsigned int *) & s_rand_seed) ^ (uintptr_t)&s_rand_seed);
 
 inline uint32_t
 ink_get_rand_intrn()
@@ -38,14 +37,14 @@ ink_get_rand_intrn()
 }
 
 inline void
-ink_make_token_intrn(INK_AUTH_TOKEN * tok, const INK_AUTH_SEED * const *seeds, int slen)
+ink_make_token_intrn(INK_AUTH_TOKEN *tok, const INK_AUTH_SEED *const *seeds, int slen)
 {
   INK_DIGEST_CTX ctx;
   ink_code_incr_md5_init(&ctx);
   while (slen-- > 0) {
-    ink_code_incr_md5_update(&ctx, (const char *) seeds[slen]->data(), seeds[slen]->length());
+    ink_code_incr_md5_update(&ctx, (const char *)seeds[slen]->data(), seeds[slen]->length());
   }
-  ink_code_incr_md5_final((char *) &(tok->u8[0]), &ctx);
+  ink_code_incr_md5_final((char *)&(tok->u8[0]), &ctx);
 }
 
 uint32_t
@@ -55,15 +54,15 @@ ink_get_rand()
 }
 
 void
-ink_make_token(INK_AUTH_TOKEN * tok, const INK_AUTH_TOKEN & mask, const INK_AUTH_SEED * const *seeds, int slen)
+ink_make_token(INK_AUTH_TOKEN *tok, const INK_AUTH_TOKEN &mask, const INK_AUTH_SEED *const *seeds, int slen)
 {
   ink_make_token_intrn(tok, seeds, slen);
-  for (int i = 3; i >= 0; i--)  // randomize masked bits
+  for (int i = 3; i >= 0; i--) // randomize masked bits
     tok->u32[i] ^= mask.u32[i] & ink_get_rand_intrn();
 }
 
 uint32_t
-ink_make_token32(uint32_t mask, const INK_AUTH_SEED * const *seeds, int slen)
+ink_make_token32(uint32_t mask, const INK_AUTH_SEED *const *seeds, int slen)
 {
   INK_AUTH_TOKEN tok;
   ink_make_token_intrn(&tok, seeds, slen);
@@ -73,10 +72,10 @@ ink_make_token32(uint32_t mask, const INK_AUTH_SEED * const *seeds, int slen)
 }
 
 uint64_t
-ink_make_token64(uint64_t mask, const INK_AUTH_SEED * const *seeds, int slen)
+ink_make_token64(uint64_t mask, const INK_AUTH_SEED *const *seeds, int slen)
 {
   INK_AUTH_TOKEN tok;
   ink_make_token_intrn(&tok, seeds, slen);
   tok.u64[1] ^= tok.u64[0];
-  return tok.u64[1] ^ (mask & ((uint64_t) ink_get_rand_intrn() + (((uint64_t) ink_get_rand_intrn()) << 32)));
+  return tok.u64[1] ^ (mask & ((uint64_t)ink_get_rand_intrn() + (((uint64_t)ink_get_rand_intrn()) << 32)));
 }


[24/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/Socks.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Socks.cc b/iocore/net/Socks.cc
index cfdd214..a0350f6 100644
--- a/iocore/net/Socks.cc
+++ b/iocore/net/Socks.cc
@@ -39,7 +39,7 @@ socks_conf_struct *g_socks_conf_stuff = 0;
 ClassAllocator<SocksEntry> socksAllocator("socksAllocator");
 
 void
-SocksEntry::init(ProxyMutex * m, SocksNetVC * vc, unsigned char socks_support, unsigned char ver)
+SocksEntry::init(ProxyMutex *m, SocksNetVC *vc, unsigned char socks_support, unsigned char ver)
 {
   mutex = m;
   buf = new_MIOBuffer();
@@ -65,7 +65,7 @@ SocksEntry::init(ProxyMutex * m, SocksNetVC * vc, unsigned char socks_support, u
   assert(ats_is_ip4(&target_addr));
   ats_ip_copy(&req_data.dest_ip, &target_addr);
 
-  //we dont have information about the source. set to destination's
+  // we dont have information about the source. set to destination's
   ats_ip_copy(&req_data.src_ip, &target_addr);
 
   server_params = SocksServerConfig::acquire();
@@ -88,10 +88,9 @@ SocksEntry::findServer()
     ink_assert(server_result.r == PARENT_UNDEFINED);
     server_params->findParent(&req_data, &server_result);
   } else {
-
     socks_conf_struct *conf = netProcessor.socks_conf_stuff;
     if ((nattempts - 1) % conf->per_server_connection_attempts)
-      return;                   //attempt again
+      return; // attempt again
 
     server_params->markParentDown(&server_result);
 
@@ -122,14 +121,13 @@ SocksEntry::findServer()
 #else
   if (nattempts > netProcessor.socks_conf_stuff->connection_attempts)
     memset(&server_addr, 0, sizeof(server_addr));
-  else ats_ip_copy(&server_addr, &g_socks_conf_stuff->server_addr);
+  else
+    ats_ip_copy(&server_addr, &g_socks_conf_stuff->server_addr);
 #endif // SOCKS_WITH_TS
 
   char buff[INET6_ADDRSTRLEN];
-  Debug("SocksParents", "findServer result: %s:%d",
-  ats_ip_ntop(&server_addr.sa, buff, sizeof(buff)),
-  ats_ip_port_host_order(&server_addr)
-  );
+  Debug("SocksParents", "findServer result: %s:%d", ats_ip_ntop(&server_addr.sa, buff, sizeof(buff)),
+        ats_ip_port_host_order(&server_addr));
 }
 
 void
@@ -162,7 +160,7 @@ SocksEntry::free()
     } else {
       netVConnection->do_io_read(this, 0, 0);
       netVConnection->do_io_write(this, 0, 0);
-      netVConnection->action_ = action_;        //assign the original continuation
+      netVConnection->action_ = action_; // assign the original continuation
       ats_ip_copy(&netVConnection->server_addr, &server_addr);
       Debug("Socks", "Sent success to HTTP");
       NET_INCREMENT_DYN_STAT(socks_connections_successful_stat);
@@ -183,12 +181,12 @@ int
 SocksEntry::startEvent(int event, void *data)
 {
   if (event == NET_EVENT_OPEN) {
-    netVConnection = (SocksNetVC *) data;
+    netVConnection = (SocksNetVC *)data;
 
     if (version == SOCKS5_VERSION)
       auth_handler = &socks5BasicAuthHandler;
 
-    SET_HANDLER((SocksEntryHandler) & SocksEntry::mainEvent);
+    SET_HANDLER((SocksEntryHandler)&SocksEntry::mainEvent);
     mainEvent(NET_EVENT_OPEN, data);
   } else {
     if (timeout) {
@@ -238,38 +236,30 @@ SocksEntry::mainEvent(int event, void *data)
   unsigned char *p;
 
   switch (event) {
-
   case NET_EVENT_OPEN:
     buf->reset();
     unsigned short ts;
-    p = (unsigned char *) buf->start();
+    p = (unsigned char *)buf->start();
     ink_assert(netVConnection);
 
     if (auth_handler) {
       n_bytes = invokeSocksAuthHandler(auth_handler, SOCKS_AUTH_OPEN, p);
     } else {
-
-      //Debug("Socks", " Got NET_EVENT_OPEN to SOCKS server\n");
+      // Debug("Socks", " Got NET_EVENT_OPEN to SOCKS server\n");
 
       p[n_bytes++] = version;
       p[n_bytes++] = (socks_cmd == NORMAL_SOCKS) ? SOCKS_CONNECT : socks_cmd;
       ts = ntohs(ats_ip_port_cast(&server_addr));
 
       if (version == SOCKS5_VERSION) {
-        p[n_bytes++] = 0;       //Reserved
+        p[n_bytes++] = 0; // Reserved
         if (ats_is_ip4(&server_addr)) {
-          p[n_bytes++] = 1;       //IPv4 addr
-          memcpy(p + n_bytes,
-            &server_addr.sin.sin_addr,
-            4
-          );
+          p[n_bytes++] = 1; // IPv4 addr
+          memcpy(p + n_bytes, &server_addr.sin.sin_addr, 4);
           n_bytes += 4;
         } else if (ats_is_ip6(&server_addr)) {
-          p[n_bytes++] = 4;       //IPv6 addr
-          memcpy(p + n_bytes,
-            &server_addr.sin6.sin6_addr,
-            TS_IP6_SIZE
-          );
+          p[n_bytes++] = 4; // IPv6 addr
+          memcpy(p + n_bytes, &server_addr.sin6.sin6_addr, TS_IP6_SIZE);
           n_bytes += TS_IP6_SIZE;
         } else {
           Debug("Socks", "SOCKS supports only IP addresses.");
@@ -281,19 +271,15 @@ SocksEntry::mainEvent(int event, void *data)
 
       if (version == SOCKS4_VERSION) {
         if (ats_is_ip4(&server_addr)) {
-          //for socks4, ip addr is after the port
-          memcpy(p + n_bytes,
-            &server_addr.sin.sin_addr,
-            4
-          );
+          // for socks4, ip addr is after the port
+          memcpy(p + n_bytes, &server_addr.sin.sin_addr, 4);
           n_bytes += 4;
 
-          p[n_bytes++] = 0;       // NULL
+          p[n_bytes++] = 0; // NULL
         } else {
           Debug("Socks", "SOCKS v4 supports only IPv4 addresses.");
         }
       }
-
     }
 
     buf->fill(n_bytes);
@@ -304,7 +290,7 @@ SocksEntry::mainEvent(int event, void *data)
     }
 
     netVConnection->do_io_write(this, n_bytes, reader, 0);
-    //Debug("Socks", "Sent the request to the SOCKS server\n");
+    // Debug("Socks", "Sent the request to the SOCKS server\n");
 
     ret = EVENT_CONT;
     break;
@@ -321,16 +307,15 @@ SocksEntry::mainEvent(int event, void *data)
       write_done = true;
     }
 
-    buf->reset();               // Use the same buffer for a read now
+    buf->reset(); // Use the same buffer for a read now
 
     if (auth_handler)
       n_bytes = invokeSocksAuthHandler(auth_handler, SOCKS_AUTH_WRITE_COMPLETE, NULL);
     else if (socks_cmd == NORMAL_SOCKS)
-      n_bytes = (version == SOCKS5_VERSION)
-        ? SOCKS5_REP_LEN : SOCKS4_REP_LEN;
+      n_bytes = (version == SOCKS5_VERSION) ? SOCKS5_REP_LEN : SOCKS4_REP_LEN;
     else {
       Debug("Socks", "Tunnelling the connection");
-      //let the client handle the response
+      // let the client handle the response
       free();
       break;
     }
@@ -346,8 +331,8 @@ SocksEntry::mainEvent(int event, void *data)
     ret = EVENT_CONT;
 
     if (version == SOCKS5_VERSION && auth_handler == NULL) {
-      VIO *vio = (VIO *) data;
-      p = (unsigned char *) buf->start();
+      VIO *vio = (VIO *)data;
+      p = (unsigned char *)buf->start();
 
       if (vio->ndone >= 5) {
         int reply_len;
@@ -365,7 +350,7 @@ SocksEntry::mainEvent(int event, void *data)
           break;
         default:
           reply_len = INT_MAX;
-          Debug("Socks", "Illegal address type(%d) in Socks server", (int) p[3]);
+          Debug("Socks", "Illegal address type(%d) in Socks server", (int)p[3]);
         }
 
         if (vio->ndone >= reply_len) {
@@ -377,14 +362,14 @@ SocksEntry::mainEvent(int event, void *data)
 
     if (ret == EVENT_CONT)
       break;
-    // Fall Through
+  // Fall Through
   case VC_EVENT_READ_COMPLETE:
     if (timeout) {
       timeout->cancel(this);
       timeout = NULL;
     }
-    //Debug("Socks", "Successfully read the reply from the SOCKS server\n");
-    p = (unsigned char *) buf->start();
+    // Debug("Socks", "Successfully read the reply from the SOCKS server\n");
+    p = (unsigned char *)buf->start();
 
     if (auth_handler) {
       SocksAuthHandler temp = auth_handler;
@@ -399,20 +384,19 @@ SocksEntry::mainEvent(int event, void *data)
       }
 
     } else {
-
       bool success;
       if (version == SOCKS5_VERSION) {
         success = (p[0] == SOCKS5_VERSION && p[1] == SOCKS5_REQ_GRANTED);
-        Debug("Socks", "received reply of length %" PRId64" addr type %d", ((VIO *) data)->ndone, (int) p[3]);
+        Debug("Socks", "received reply of length %" PRId64 " addr type %d", ((VIO *)data)->ndone, (int)p[3]);
       } else
         success = (p[0] == 0 && p[1] == SOCKS4_REQ_GRANTED);
 
-      //ink_assert(*(p) == 0);
-      if (!success) {           // SOCKS request failed
-        Debug("Socks", "Socks request denied %d", (int) *(p + 1));
+      // ink_assert(*(p) == 0);
+      if (!success) { // SOCKS request failed
+        Debug("Socks", "Socks request denied %d", (int)*(p + 1));
         lerrno = ESOCK_DENIED;
       } else {
-        Debug("Socks", "Socks request successful %d", (int) *(p + 1));
+        Debug("Socks", "Socks request successful %d", (int)*(p + 1));
         lerrno = 0;
       }
       free();
@@ -427,13 +411,13 @@ SocksEntry::mainEvent(int event, void *data)
       free();
       break;
     }
-    /* else
-       This is server_connect_timeout. So we treat this as server being
-       down.
-       Should cancel any pending connect() action. Important on windows
+  /* else
+     This is server_connect_timeout. So we treat this as server being
+     down.
+     Should cancel any pending connect() action. Important on windows
 
-       fall through
-     */
+     fall through
+   */
   case VC_EVENT_ERROR:
     /*This is mostly ECONNREFUSED on Unix */
     SET_HANDLER(&SocksEntry::startEvent);
@@ -460,7 +444,7 @@ SocksEntry::mainEvent(int event, void *data)
 }
 
 void
-loadSocksConfiguration(socks_conf_struct * socks_conf_stuff)
+loadSocksConfiguration(socks_conf_struct *socks_conf_stuff)
 {
   int socks_config_fd = -1;
   ats_scoped_str config_pathname;
@@ -468,7 +452,7 @@ loadSocksConfiguration(socks_conf_struct * socks_conf_stuff)
   char *tmp;
 #endif
 
-  socks_conf_stuff->accept_enabled = 0; //initialize it INKqa08593
+  socks_conf_stuff->accept_enabled = 0; // initialize it INKqa08593
   socks_conf_stuff->socks_needed = REC_ConfigReadInteger("proxy.config.socks.socks_needed");
   if (!socks_conf_stuff->socks_needed) {
     Debug("Socks", "Socks Turned Off");
@@ -485,19 +469,18 @@ loadSocksConfiguration(socks_conf_struct * socks_conf_stuff)
 
   socks_conf_stuff->server_connect_timeout = REC_ConfigReadInteger("proxy.config.socks.server_connect_timeout");
   socks_conf_stuff->socks_timeout = REC_ConfigReadInteger("proxy.config.socks.socks_timeout");
-  Debug("Socks", "server connect timeout: %d socks respnonse timeout %d",
-        socks_conf_stuff->server_connect_timeout, socks_conf_stuff->socks_timeout);
+  Debug("Socks", "server connect timeout: %d socks respnonse timeout %d", socks_conf_stuff->server_connect_timeout,
+        socks_conf_stuff->socks_timeout);
 
-  socks_conf_stuff->per_server_connection_attempts =
-    REC_ConfigReadInteger("proxy.config.socks.per_server_connection_attempts");
+  socks_conf_stuff->per_server_connection_attempts = REC_ConfigReadInteger("proxy.config.socks.per_server_connection_attempts");
   socks_conf_stuff->connection_attempts = REC_ConfigReadInteger("proxy.config.socks.connection_attempts");
 
   socks_conf_stuff->accept_enabled = REC_ConfigReadInteger("proxy.config.socks.accept_enabled");
   socks_conf_stuff->accept_port = REC_ConfigReadInteger("proxy.config.socks.accept_port");
   socks_conf_stuff->http_port = REC_ConfigReadInteger("proxy.config.socks.http_port");
   Debug("SocksProxy", "Read SocksProxy info: accept_enabled = %d "
-        "accept_port = %d http_port = %d", socks_conf_stuff->accept_enabled,
-        socks_conf_stuff->accept_port, socks_conf_stuff->http_port);
+                      "accept_port = %d http_port = %d",
+        socks_conf_stuff->accept_enabled, socks_conf_stuff->accept_port, socks_conf_stuff->http_port);
 
 #ifdef SOCKS_WITH_TS
   SocksServerConfig::startup();
@@ -511,19 +494,15 @@ loadSocksConfiguration(socks_conf_struct * socks_conf_stuff)
     goto error;
   }
 
-  socks_config_fd =::open(config_pathname, O_RDONLY);
+  socks_config_fd = ::open(config_pathname, O_RDONLY);
 
   if (socks_config_fd < 0) {
     Error("SOCKS Config: could not open config file '%s'. SOCKS Turned off", (const char *)config_pathname);
     goto error;
   }
 #ifdef SOCKS_WITH_TS
-  tmp = Load_IpMap_From_File(
-    &socks_conf_stuff->ip_map,
-    socks_config_fd,
-    "no_socks"
-  );
-//  tmp = socks_conf_stuff->ip_range.read_table_from_file(socks_config_fd, "no_socks");
+  tmp = Load_IpMap_From_File(&socks_conf_stuff->ip_map, socks_config_fd, "no_socks");
+  //  tmp = socks_conf_stuff->ip_range.read_table_from_file(socks_config_fd, "no_socks");
 
   if (tmp) {
     Error("SOCKS Config: Error while reading ip_range: %s.", tmp);
@@ -546,16 +525,15 @@ error:
   socks_conf_stuff->accept_enabled = 0;
   if (socks_config_fd >= 0)
     ::close(socks_config_fd);
-
 }
 
 int
-loadSocksAuthInfo(int fd, socks_conf_struct * socks_stuff)
+loadSocksAuthInfo(int fd, socks_conf_struct *socks_stuff)
 {
   char c = '\0';
-  char line[256] = { 0 };       // initialize all chars to nil
-  char user_name[256] = { 0 };
-  char passwd[256] = { 0 };
+  char line[256] = {0}; // initialize all chars to nil
+  char user_name[256] = {0};
+  char passwd[256] = {0};
 
   if (lseek(fd, 0, SEEK_SET) < 0) {
     Warning("Can not seek on Socks configuration file\n");
@@ -597,25 +575,24 @@ loadSocksAuthInfo(int fd, socks_conf_struct * socks_stuff)
 }
 
 int
-socks5BasicAuthHandler(int event, unsigned char *p, void (**h_ptr) (void))
+socks5BasicAuthHandler(int event, unsigned char *p, void (**h_ptr)(void))
 {
-  //for more info on Socks5 see RFC 1928
+  // for more info on Socks5 see RFC 1928
   int ret = 0;
   char *pass_phrase = netProcessor.socks_conf_stuff->user_name_n_passwd;
 
   switch (event) {
-
   case SOCKS_AUTH_OPEN:
-    p[ret++] = SOCKS5_VERSION;  //version
-    p[ret++] = (pass_phrase) ? 2 : 1;   //#Methods
-    p[ret++] = 0;               //no authentication
+    p[ret++] = SOCKS5_VERSION;        // version
+    p[ret++] = (pass_phrase) ? 2 : 1; //#Methods
+    p[ret++] = 0;                     // no authentication
     if (pass_phrase)
       p[ret++] = 2;
 
     break;
 
   case SOCKS_AUTH_WRITE_COMPLETE:
-    //return number of bytes to read
+    // return number of bytes to read
     ret = 2;
     break;
 
@@ -623,44 +600,45 @@ socks5BasicAuthHandler(int event, unsigned char *p, void (**h_ptr) (void))
 
     if (p[0] == SOCKS5_VERSION) {
       switch (p[1]) {
-
-      case 0:                  // no authentication required
+      case 0: // no authentication required
         Debug("Socks", "No authentication required for Socks server");
-        //make sure this is ok for us. right now it is always ok for us.
+        // make sure this is ok for us. right now it is always ok for us.
         *h_ptr = NULL;
         break;
 
       case 2:
         Debug("Socks", "Socks server wants username/passwd");
         if (!pass_phrase) {
-          Debug("Socks", "Buggy Socks server: asks for username/passwd " "when not supplied as an option");
+          Debug("Socks", "Buggy Socks server: asks for username/passwd "
+                         "when not supplied as an option");
           ret = -1;
           *h_ptr = NULL;
         } else
-          *(SocksAuthHandler *) h_ptr = &socks5PasswdAuthHandler;
+          *(SocksAuthHandler *)h_ptr = &socks5PasswdAuthHandler;
 
         break;
 
       case 0xff:
-        Debug("Socks", "None of the Socks authentcations is acceptable " "to the server");
+        Debug("Socks", "None of the Socks authentcations is acceptable "
+                       "to the server");
         *h_ptr = NULL;
         ret = -1;
         break;
 
       default:
-        Debug("Socks", "Unexpected Socks auth method (%d) from the server", (int) p[1]);
+        Debug("Socks", "Unexpected Socks auth method (%d) from the server", (int)p[1]);
         ret = -1;
         break;
       }
     } else {
-      Debug("Socks", "authEvent got wrong version %d from the Socks server", (int) p[0]);
+      Debug("Socks", "authEvent got wrong version %d from the Socks server", (int)p[0]);
       ret = -1;
     }
 
     break;
 
   default:
-    //This should be inpossible
+    // This should be inpossible
     ink_assert(!"bad case value");
     ret = -1;
     break;
@@ -669,48 +647,46 @@ socks5BasicAuthHandler(int event, unsigned char *p, void (**h_ptr) (void))
 }
 
 int
-socks5PasswdAuthHandler(int event, unsigned char *p, void (**h_ptr) (void))
+socks5PasswdAuthHandler(int event, unsigned char *p, void (**h_ptr)(void))
 {
-  //for more info see RFC 1929
+  // for more info see RFC 1929
   int ret = 0;
   char *pass_phrase;
   int pass_len;
 
   switch (event) {
-
   case SOCKS_AUTH_OPEN:
     pass_phrase = netProcessor.socks_conf_stuff->user_name_n_passwd;
     pass_len = netProcessor.socks_conf_stuff->user_name_n_passwd_len;
     ink_assert(pass_phrase);
 
-    p[0] = 1;                   //version
+    p[0] = 1; // version
     memcpy(&p[1], pass_phrase, pass_len);
 
     ret = 1 + pass_len;
     break;
 
   case SOCKS_AUTH_WRITE_COMPLETE:
-    //return number of bytes to read
+    // return number of bytes to read
     ret = 2;
     break;
 
   case SOCKS_AUTH_READ_COMPLETE:
 
-    //if (p[0] == 1) { // skip this. its not clear what this should be.
+    // if (p[0] == 1) { // skip this. its not clear what this should be.
     // NEC thinks it is 5 RFC seems to indicate 1.
     switch (p[1]) {
-
     case 0:
       Debug("Socks", "Username/Passwd succeded");
       *h_ptr = NULL;
       break;
 
     default:
-      Debug("Socks", "Username/Passwd authentication failed ret_code: %d", (int) p[1]);
+      Debug("Socks", "Username/Passwd authentication failed ret_code: %d", (int)p[1]);
       ret = -1;
     }
     //}
-    //else {
+    // else {
     //  Debug("Socks", "authPassEvent got wrong version %d from "
     //        "Socks server\n", (int)p[0]);
     //  ret = -1;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixConnection.cc b/iocore/net/UnixConnection.cc
index 420add1..303175a 100644
--- a/iocore/net/UnixConnection.cc
+++ b/iocore/net/UnixConnection.cc
@@ -31,10 +31,10 @@
 // set in the OS
 // #define RECV_BUF_SIZE            (1024*64)
 // #define SEND_BUF_SIZE            (1024*64)
-#define FIRST_RANDOM_PORT        16000
-#define LAST_RANDOM_PORT         32000
+#define FIRST_RANDOM_PORT 16000
+#define LAST_RANDOM_PORT 32000
 
-#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
+#define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y))
 
 #if TS_USE_TPROXY
 #if !defined(IP_TRANSPARENT)
@@ -46,12 +46,10 @@ unsigned int const IP_TRANSPARENT = 19;
 // Functions
 //
 int
-Connection::setup_mc_send(
-  sockaddr const* mc_addr,
-  sockaddr const* my_addr,
-  bool non_blocking, unsigned char mc_ttl, bool mc_loopback, Continuation * c
-) {
-  (void) c;
+Connection::setup_mc_send(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking, unsigned char mc_ttl,
+                          bool mc_loopback, Continuation *c)
+{
+  (void)c;
   ink_assert(fd == NO_FD);
   int res = 0;
   int enable_reuseaddr = 1;
@@ -62,7 +60,7 @@ Connection::setup_mc_send(
 
   fd = res;
 
-  if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0)) {
+  if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&enable_reuseaddr, sizeof(enable_reuseaddr)) < 0)) {
     goto Lerror;
   }
 
@@ -82,18 +80,18 @@ Connection::setup_mc_send(
       goto Lerror;
 
   // Set MultiCast TTL to specified value
-  if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char *) &mc_ttl, sizeof(mc_ttl)) < 0))
+  if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&mc_ttl, sizeof(mc_ttl)) < 0))
     goto Lerror;
 
   // Set MultiCast Interface to specified value
-  if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char *) &mc_if, sizeof(mc_if)) < 0))
+  if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char *)&mc_if, sizeof(mc_if)) < 0))
     goto Lerror;
 
   // Disable MultiCast loopback if requested
   if (!mc_loopback) {
     char loop = 0;
 
-    if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &loop, sizeof(loop)) < 0))
+    if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&loop, sizeof(loop)) < 0))
       goto Lerror;
   }
   return 0;
@@ -106,14 +104,12 @@ Lerror:
 
 
 int
-Connection::setup_mc_receive(
-  sockaddr const* mc_addr,
-  sockaddr const* my_addr,
-  bool non_blocking, Connection * sendChan, Continuation * c
-) {
+Connection::setup_mc_receive(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking, Connection *sendChan,
+                             Continuation *c)
+{
   ink_assert(fd == NO_FD);
-  (void) sendChan;
-  (void) c;
+  (void)sendChan;
+  (void)c;
   int res = 0;
   int enable_reuseaddr = 1;
   IpAddr inaddr_any(INADDR_ANY);
@@ -128,7 +124,7 @@ Connection::setup_mc_receive(
     goto Lerror;
 #endif
 
-  if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0))
+  if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&enable_reuseaddr, sizeof(enable_reuseaddr)) < 0))
     goto Lerror;
 
   addr.assign(inaddr_any, ats_ip_port_cast(mc_addr));
@@ -146,7 +142,7 @@ Connection::setup_mc_receive(
     mc_request.imr_multiaddr.s_addr = ats_ip4_addr_cast(mc_addr);
     mc_request.imr_interface.s_addr = ats_ip4_addr_cast(my_addr);
 
-    if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mc_request, sizeof(mc_request)) < 0))
+    if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mc_request, sizeof(mc_request)) < 0))
       goto Lerror;
   }
   return 0;
@@ -157,42 +153,51 @@ Lerror:
   return res;
 }
 
-namespace {
-  /** Struct to make cleaning up resources easier.
-
-      By default, the @a method is invoked on the @a object when
-      this object is destructed. This can be prevented by calling
-      the @c reset method.
-
-      This is not overly useful in the allocate, check, return case
-      but very handy if there are
-      - multiple resources (each can have its own cleaner)
-      - multiple checks against the resource
-      In such cases, rather than trying to track all the resources
-      that might need cleaned up, you can set up a cleaner at allocation
-      and only have to deal with them on success, which is generally
-      singular.
-
-      @code
-      self::some_method (...) {
-        /// allocate resource
-        cleaner<self> clean_up(this, &self::cleanup);
-        // modify or check the resource
-        if (fail) return FAILURE; // cleanup() is called
-        /// success!
-        clean_up.reset(); // cleanup() not called after this
-        return SUCCESS;
-      @endcode
-   */
-  template <typename T> struct cleaner {
-    T* obj; ///< Object instance.
-    typedef void (T::*method)(); ///< Method signature.
-    method m;
-
-    cleaner(T* _obj, method  _method) : obj(_obj), m(_method) {}
-    ~cleaner() { if (obj) (obj->*m)(); }
-    void reset() { obj = 0; }
-  };
+namespace
+{
+/** Struct to make cleaning up resources easier.
+
+    By default, the @a method is invoked on the @a object when
+    this object is destructed. This can be prevented by calling
+    the @c reset method.
+
+    This is not overly useful in the allocate, check, return case
+    but very handy if there are
+    - multiple resources (each can have its own cleaner)
+    - multiple checks against the resource
+    In such cases, rather than trying to track all the resources
+    that might need cleaned up, you can set up a cleaner at allocation
+    and only have to deal with them on success, which is generally
+    singular.
+
+    @code
+    self::some_method (...) {
+      /// allocate resource
+      cleaner<self> clean_up(this, &self::cleanup);
+      // modify or check the resource
+      if (fail) return FAILURE; // cleanup() is called
+      /// success!
+      clean_up.reset(); // cleanup() not called after this
+      return SUCCESS;
+    @endcode
+ */
+template <typename T> struct cleaner {
+  T *obj;                      ///< Object instance.
+  typedef void (T::*method)(); ///< Method signature.
+  method m;
+
+  cleaner(T *_obj, method _method) : obj(_obj), m(_method) {}
+  ~cleaner()
+  {
+    if (obj)
+      (obj->*m)();
+  }
+  void
+  reset()
+  {
+    obj = 0;
+  }
+};
 }
 
 /** Default options.
@@ -215,15 +220,13 @@ namespace {
 NetVCOptions const Connection::DEFAULT_OPTIONS;
 
 int
-Connection::open(NetVCOptions const& opt)
+Connection::open(NetVCOptions const &opt)
 {
   ink_assert(fd == NO_FD);
   int enable_reuseaddr = 1; // used for sockopt setting
-  int res = 0; // temp result
+  int res = 0;              // temp result
   IpEndpoint local_addr;
-  sock_type = NetVCOptions::USE_UDP == opt.ip_proto
-    ? SOCK_DGRAM
-    : SOCK_STREAM;
+  sock_type = NetVCOptions::USE_UDP == opt.ip_proto ? SOCK_DGRAM : SOCK_STREAM;
   int family;
 
   // Need to do address calculations first, so we can determine the
@@ -231,9 +234,7 @@ Connection::open(NetVCOptions const& opt)
   ink_zero(local_addr);
 
   bool is_any_address = false;
-  if (NetVCOptions::FOREIGN_ADDR == opt.addr_binding ||
-    NetVCOptions::INTF_ADDR == opt.addr_binding
-  ) {
+  if (NetVCOptions::FOREIGN_ADDR == opt.addr_binding || NetVCOptions::INTF_ADDR == opt.addr_binding) {
     // Same for now, transparency for foreign addresses must be handled
     // *after* the socket is created, and we need to do this calculation
     // before the socket to get the IP family correct.
@@ -249,7 +250,8 @@ Connection::open(NetVCOptions const& opt)
   }
 
   res = socketManager.socket(family, sock_type, 0);
-  if (-1 == res) return -errno;
+  if (-1 == res)
+    return -errno;
 
   fd = res;
   // mark fd for close until we succeed.
@@ -257,20 +259,14 @@ Connection::open(NetVCOptions const& opt)
 
   // Try setting the various socket options, if requested.
 
-  if (-1 == safe_setsockopt(fd,
-                            SOL_SOCKET,
-                            SO_REUSEADDR,
-                            reinterpret_cast<char *>(&enable_reuseaddr),
-                            sizeof(enable_reuseaddr)))
+  if (-1 == safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char *>(&enable_reuseaddr), sizeof(enable_reuseaddr)))
     return -errno;
 
   if (NetVCOptions::FOREIGN_ADDR == opt.addr_binding) {
-    static char const * const DEBUG_TEXT = "::open setsockopt() IP_TRANSPARENT";
+    static char const *const DEBUG_TEXT = "::open setsockopt() IP_TRANSPARENT";
 #if TS_USE_TPROXY
     int value = 1;
-    if (-1 == safe_setsockopt(fd, SOL_IP, TS_IP_TRANSPARENT,
-                              reinterpret_cast<char*>(&value), sizeof(value)
-                              )) {
+    if (-1 == safe_setsockopt(fd, SOL_IP, TS_IP_TRANSPARENT, reinterpret_cast<char *>(&value), sizeof(value))) {
       Debug("socket", "%s - fail %d:%s", DEBUG_TEXT, errno, strerror(errno));
       return -errno;
     } else {
@@ -306,7 +302,7 @@ Connection::open(NetVCOptions const& opt)
   // apply dynamic options
   apply_options(opt);
 
-  if(local_addr.port() || !is_any_address) {
+  if (local_addr.port() || !is_any_address) {
     if (-1 == socketManager.ink_bind(fd, &local_addr.sa, ats_ip_size(&local_addr.sa)))
       return -errno;
   }
@@ -317,7 +313,8 @@ Connection::open(NetVCOptions const& opt)
 }
 
 int
-Connection::connect(sockaddr const* target, NetVCOptions const& opt) {
+Connection::connect(sockaddr const *target, NetVCOptions const &opt)
+{
   ink_assert(fd != NO_FD);
   ink_assert(is_bound);
   ink_assert(!is_connected);
@@ -335,14 +332,14 @@ Connection::connect(sockaddr const* target, NetVCOptions const& opt) {
   // (Is EWOULDBLOCK ok? Does that start the connect?)
   // We also want to handle the cases where the connect blocking
   // and IO blocking differ, by turning it on or off as needed.
-  if (-1 == res
-      && (opt.f_blocking_connect
-          || ! (EINPROGRESS == errno || EWOULDBLOCK == errno))) {
+  if (-1 == res && (opt.f_blocking_connect || !(EINPROGRESS == errno || EWOULDBLOCK == errno))) {
     return -errno;
   } else if (opt.f_blocking_connect && !opt.f_blocking) {
-    if (-1 == safe_nonblocking(fd)) return -errno;
+    if (-1 == safe_nonblocking(fd))
+      return -errno;
   } else if (!opt.f_blocking_connect && opt.f_blocking) {
-    if (-1 == safe_blocking(fd)) return -errno;
+    if (-1 == safe_blocking(fd))
+      return -errno;
   }
 
   cleanup.reset();
@@ -357,7 +354,7 @@ Connection::_cleanup()
 }
 
 void
-Connection::apply_options(NetVCOptions const& opt)
+Connection::apply_options(NetVCOptions const &opt)
 {
   // Set options which can be changed after a connection is established
   // ignore other changes
@@ -372,7 +369,7 @@ Connection::apply_options(NetVCOptions const& opt)
     }
     if (opt.sockopt_flags & NetVCOptions::SOCK_OPT_LINGER_ON) {
       struct linger l;
-      l.l_onoff  = 1;
+      l.l_onoff = 1;
       l.l_linger = 0;
       safe_setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, sizeof(l));
       Debug("socket", "::open:: setsockopt() turn on SO_LINGER on socket");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index a654483..03c3bec 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -40,7 +40,8 @@ int update_cop_config(const char *name, RecDataT data_type, RecData data, void *
 // INKqa10496
 // One Inactivity cop runs on each thread once every second and
 // loops through the list of NetVCs and calls the timeouts
-class InactivityCop : public Continuation {
+class InactivityCop : public Continuation
+{
 public:
   InactivityCop(ProxyMutex *m)
     : Continuation(m), default_inactivity_timeout(0), total_connections_in(0), max_connections_in(0), connections_per_thread_in(0)
@@ -54,13 +55,16 @@ public:
     RecRegisterConfigUpdateCb("proxy.config.net.default_inactivity_timeout", update_cop_config, (void *)this);
   }
 
-  int check_inactivity(int event, Event *e) {
-    (void) event;
+  int
+  check_inactivity(int event, Event *e)
+  {
+    (void)event;
     ink_hrtime now = ink_get_hrtime();
     NetHandler &nh = *get_NetHandler(this_ethread());
     total_connections_in = 0;
     // Copy the list and use pop() to catch any closes caused by callbacks.
-    forl_LL(UnixNetVConnection, vc, nh.open_list) {
+    forl_LL(UnixNetVConnection, vc, nh.open_list)
+    {
       if (vc->thread == this_ethread()) {
         if (vc->from_accept_thread == true) {
           ++total_connections_in;
@@ -72,8 +76,8 @@ public:
       // If we cannot get the lock don't stop just keep cleaning
       MUTEX_TRY_LOCK(lock, vc->mutex, this_ethread());
       if (!lock.is_locked()) {
-       NET_INCREMENT_DYN_STAT(inactivity_cop_lock_acquire_failure_stat);
-       continue;
+        NET_INCREMENT_DYN_STAT(inactivity_cop_lock_acquire_failure_stat);
+        continue;
       }
 
       if (vc->closed) {
@@ -83,13 +87,12 @@ public:
 
       // set a default inactivity timeout if one is not set
       if (vc->next_inactivity_timeout_at == 0 && default_inactivity_timeout > 0) {
-        Debug("inactivity_cop", "vc: %p inactivity timeout not set, setting a default of %d", vc,
-            default_inactivity_timeout);
+        Debug("inactivity_cop", "vc: %p inactivity timeout not set, setting a default of %d", vc, default_inactivity_timeout);
         vc->set_inactivity_timeout(HRTIME_SECONDS(default_inactivity_timeout));
         NET_INCREMENT_DYN_STAT(default_inactivity_timeout_stat);
       } else {
-        Debug("inactivity_cop_verbose", "vc: %p now: %" PRId64 " timeout at: %" PRId64 " timeout in: %" PRId64, vc,
-            now, ink_hrtime_to_sec(vc->next_inactivity_timeout_at), ink_hrtime_to_sec(vc->inactivity_timeout_in));
+        Debug("inactivity_cop_verbose", "vc: %p now: %" PRId64 " timeout at: %" PRId64 " timeout in: %" PRId64, vc, now,
+              ink_hrtime_to_sec(vc->next_inactivity_timeout_at), ink_hrtime_to_sec(vc->inactivity_timeout_in));
       }
 
       if (vc->next_inactivity_timeout_at && vc->next_inactivity_timeout_at < now) {
@@ -99,8 +102,8 @@ public:
           NET_SUM_DYN_STAT(keep_alive_lru_timeout_total_stat, diff);
           NET_INCREMENT_DYN_STAT(keep_alive_lru_timeout_count_stat);
         }
-        Debug("inactivity_cop_verbose", "vc: %p now: %" PRId64 " timeout at: %" PRId64 " timeout in: %" PRId64, vc,
-            now, vc->next_inactivity_timeout_at, vc->inactivity_timeout_in);
+        Debug("inactivity_cop_verbose", "vc: %p now: %" PRId64 " timeout at: %" PRId64 " timeout in: %" PRId64, vc, now,
+              vc->next_inactivity_timeout_at, vc->inactivity_timeout_in);
         vc->handleEvent(EVENT_IMMEDIATE, e);
       }
     }
@@ -111,13 +114,25 @@ public:
     return 0;
   }
 
-  void set_max_connections(const int32_t x) { max_connections_in = x; }
-  void set_connections_per_thread(const int32_t x) { connections_per_thread_in = x; }
-  void set_default_timeout(const int x) { default_inactivity_timeout = x; }
+  void
+  set_max_connections(const int32_t x)
+  {
+    max_connections_in = x;
+  }
+  void
+  set_connections_per_thread(const int32_t x)
+  {
+    connections_per_thread_in = x;
+  }
+  void
+  set_default_timeout(const int x)
+  {
+    default_inactivity_timeout = x;
+  }
 
 private:
   void keep_alive_lru(NetHandler &nh, ink_hrtime now, Event *e);
-  int default_inactivity_timeout;  // only used when one is not set for some bad reason
+  int default_inactivity_timeout; // only used when one is not set for some bad reason
   int32_t total_connections_in;
   int32_t max_connections_in;
   int32_t connections_per_thread_in;
@@ -126,7 +141,7 @@ private:
 int
 update_cop_config(const char *name, RecDataT data_type ATS_UNUSED, RecData data, void *cookie)
 {
-  InactivityCop * cop = static_cast<InactivityCop *>(cookie);
+  InactivityCop *cop = static_cast<InactivityCop *>(cookie);
   ink_assert(cop != NULL);
 
   if (cop != NULL) {
@@ -140,13 +155,13 @@ update_cop_config(const char *name, RecDataT data_type ATS_UNUSED, RecData data,
       Debug("inactivity_cop_dynamic", "proxy.config.net.default_inactivity_timeout updated to %" PRId64, data.rec_int);
       cop->set_default_timeout(data.rec_int);
     }
-
   }
 
   return REC_ERR_OKAY;
 }
 
-void InactivityCop::keep_alive_lru(NetHandler &nh, const ink_hrtime now, Event *e)
+void
+InactivityCop::keep_alive_lru(NetHandler &nh, const ink_hrtime now, Event *e)
 {
   // maximum incoming connections is set to 0 then the feature is disabled
   if (max_connections_in == 0) {
@@ -156,8 +171,7 @@ void InactivityCop::keep_alive_lru(NetHandler &nh, const ink_hrtime now, Event *
   if (connections_per_thread_in == 0) {
     // figure out the number of threads and calculate the number of connections per thread
     const int event_threads = eventProcessor.n_threads_for_type[ET_NET];
-    const int ssl_threads = (ET_NET == SSLNetProcessor::ET_SSL) ? 0 :
-        eventProcessor.n_threads_for_type[SSLNetProcessor::ET_SSL];
+    const int ssl_threads = (ET_NET == SSLNetProcessor::ET_SSL) ? 0 : eventProcessor.n_threads_for_type[SSLNetProcessor::ET_SSL];
     connections_per_thread_in = max_connections_in / (event_threads + ssl_threads);
   }
 
@@ -169,8 +183,9 @@ void InactivityCop::keep_alive_lru(NetHandler &nh, const ink_hrtime now, Event *
   to_process = min((int32_t)nh.keep_alive_lru_size, to_process);
 
   Debug("inactivity_cop_dynamic", "max cons: %d active: %d idle: %d process: %d"
-        " net type: %d ssl type: %d", connections_per_thread_in, total_connections_in - nh.keep_alive_lru_size,
-        nh.keep_alive_lru_size, to_process, ET_NET, SSLNetProcessor::ET_SSL);
+                                  " net type: %d ssl type: %d",
+        connections_per_thread_in, total_connections_in - nh.keep_alive_lru_size, nh.keep_alive_lru_size, to_process, ET_NET,
+        SSLNetProcessor::ET_SSL);
 
   // loop over the non-active connections and try to close them
   UnixNetVConnection *vc = nh.keep_alive_list.head;
@@ -195,9 +210,9 @@ void InactivityCop::keep_alive_lru(NetHandler &nh, const ink_hrtime now, Event *
       NET_SUM_DYN_STAT(keep_alive_lru_timeout_total_stat, diff);
       NET_INCREMENT_DYN_STAT(keep_alive_lru_timeout_count_stat);
     }
-    Debug("inactivity_cop_dynamic", "closing connection NetVC=%p idle: %u now: %" PRId64 " at: %" PRId64
-          " in: %" PRId64 " diff: %" PRId64,
-          vc, nh.keep_alive_lru_size, ink_hrtime_to_sec(now), ink_hrtime_to_sec(vc->next_inactivity_timeout_at),
+    Debug("inactivity_cop_dynamic",
+          "closing connection NetVC=%p idle: %u now: %" PRId64 " at: %" PRId64 " in: %" PRId64 " diff: %" PRId64, vc,
+          nh.keep_alive_lru_size, ink_hrtime_to_sec(now), ink_hrtime_to_sec(vc->next_inactivity_timeout_at),
           ink_hrtime_to_sec(vc->inactivity_timeout_in), diff);
     if (vc->closed) {
       close_UnixNetVConnection(vc, e->ethread);
@@ -211,27 +226,30 @@ void InactivityCop::keep_alive_lru(NetHandler &nh, const ink_hrtime now, Event *
 
   if (total_idle_count > 0) {
     Debug("inactivity_cop_dynamic", "max cons: %d active: %d idle: %d already closed: %d, close event: %d"
-          " mean idle: %d\n", connections_per_thread_in,
-          total_connections_in - nh.keep_alive_lru_size - closed - handle_event,
-          nh.keep_alive_lru_size, closed, handle_event, total_idle_time / total_idle_count);
+                                    " mean idle: %d\n",
+          connections_per_thread_in, total_connections_in - nh.keep_alive_lru_size - closed - handle_event, nh.keep_alive_lru_size,
+          closed, handle_event, total_idle_time / total_idle_count);
   }
 }
 #endif
 
-PollCont::PollCont(ProxyMutex *m, int pt):Continuation(m), net_handler(NULL), nextPollDescriptor(NULL), poll_timeout(pt) {
+PollCont::PollCont(ProxyMutex *m, int pt) : Continuation(m), net_handler(NULL), nextPollDescriptor(NULL), poll_timeout(pt)
+{
   pollDescriptor = new PollDescriptor;
   pollDescriptor->init();
   SET_HANDLER(&PollCont::pollEvent);
 }
 
-PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt):Continuation(m), net_handler(nh), nextPollDescriptor(NULL), poll_timeout(pt)
+PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt)
+  : Continuation(m), net_handler(nh), nextPollDescriptor(NULL), poll_timeout(pt)
 {
   pollDescriptor = new PollDescriptor;
   pollDescriptor->init();
   SET_HANDLER(&PollCont::pollEvent);
 }
 
-PollCont::~PollCont() {
+PollCont::~PollCont()
+{
   delete pollDescriptor;
   if (nextPollDescriptor != NULL) {
     delete nextPollDescriptor;
@@ -243,51 +261,47 @@ PollCont::~PollCont() {
 // and stores the resultant events in ePoll_Triggered_Events
 //
 int
-PollCont::pollEvent(int event, Event *e) {
-  (void) event;
-  (void) e;
+PollCont::pollEvent(int event, Event *e)
+{
+  (void)event;
+  (void)e;
 
   if (likely(net_handler)) {
     /* checking to see whether there are connections on the ready_queue (either read or write) that need processing [ebalsa] */
-    if (likely
-        (!net_handler->read_ready_list.empty() || !net_handler->write_ready_list.empty() ||
-         !net_handler->read_enable_list.empty() || !net_handler->write_enable_list.empty())) {
-      NetDebug("iocore_net_poll", "rrq: %d, wrq: %d, rel: %d, wel: %d",
-               net_handler->read_ready_list.empty(),
+    if (likely(!net_handler->read_ready_list.empty() || !net_handler->write_ready_list.empty() ||
+               !net_handler->read_enable_list.empty() || !net_handler->write_enable_list.empty())) {
+      NetDebug("iocore_net_poll", "rrq: %d, wrq: %d, rel: %d, wel: %d", net_handler->read_ready_list.empty(),
                net_handler->write_ready_list.empty(), net_handler->read_enable_list.empty(),
                net_handler->write_enable_list.empty());
-      poll_timeout = 0;         //poll immediately returns -- we have triggered stuff to process right now
+      poll_timeout = 0; // poll immediately returns -- we have triggered stuff to process right now
     } else {
       poll_timeout = net_config_poll_timeout;
     }
   }
-  // wait for fd's to tigger, or don't wait if timeout is 0
+// wait for fd's to tigger, or don't wait if timeout is 0
 #if TS_USE_EPOLL
-  pollDescriptor->result = epoll_wait(pollDescriptor->epoll_fd,
-                                      pollDescriptor->ePoll_Triggered_Events, POLL_DESCRIPTOR_SIZE, poll_timeout);
-  NetDebug("iocore_net_poll", "[PollCont::pollEvent] epoll_fd: %d, timeout: %d, results: %d", pollDescriptor->epoll_fd, poll_timeout,
-           pollDescriptor->result);
+  pollDescriptor->result =
+    epoll_wait(pollDescriptor->epoll_fd, pollDescriptor->ePoll_Triggered_Events, POLL_DESCRIPTOR_SIZE, poll_timeout);
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] epoll_fd: %d, timeout: %d, results: %d", pollDescriptor->epoll_fd,
+           poll_timeout, pollDescriptor->result);
 #elif TS_USE_KQUEUE
   struct timespec tv;
   tv.tv_sec = poll_timeout / 1000;
   tv.tv_nsec = 1000000 * (poll_timeout % 1000);
-  pollDescriptor->result = kevent(pollDescriptor->kqueue_fd, NULL, 0,
-                                  pollDescriptor->kq_Triggered_Events,
-                                  POLL_DESCRIPTOR_SIZE,
-                                  &tv);
-  NetDebug("iocore_net_poll", "[PollCont::pollEvent] kueue_fd: %d, timeout: %d, results: %d", pollDescriptor->kqueue_fd, poll_timeout,
-           pollDescriptor->result);
+  pollDescriptor->result =
+    kevent(pollDescriptor->kqueue_fd, NULL, 0, pollDescriptor->kq_Triggered_Events, POLL_DESCRIPTOR_SIZE, &tv);
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] kueue_fd: %d, timeout: %d, results: %d", pollDescriptor->kqueue_fd,
+           poll_timeout, pollDescriptor->result);
 #elif TS_USE_PORT
   int retval;
   timespec_t ptimeout;
   ptimeout.tv_sec = poll_timeout / 1000;
   ptimeout.tv_nsec = 1000000 * (poll_timeout % 1000);
   unsigned nget = 1;
-  if((retval = port_getn(pollDescriptor->port_fd,
-                         pollDescriptor->Port_Triggered_Events,
-                         POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) < 0) {
+  if ((retval = port_getn(pollDescriptor->port_fd, pollDescriptor->Port_Triggered_Events, POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) <
+      0) {
     pollDescriptor->result = 0;
-    switch(errno) {
+    switch (errno) {
     case EINTR:
     case EAGAIN:
     case ETIME:
@@ -302,9 +316,8 @@ PollCont::pollEvent(int event, Event *e) {
   } else {
     pollDescriptor->result = (int)nget;
   }
-  NetDebug("iocore_net_poll", "[PollCont::pollEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)",
-           retval,retval < 0 ? strerror(errno) : "ok",
-           pollDescriptor->port_fd, pollDescriptor->Port_Triggered_Events,
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)", retval,
+           retval < 0 ? strerror(errno) : "ok", pollDescriptor->port_fd, pollDescriptor->Port_Triggered_Events,
            POLL_DESCRIPTOR_SIZE, nget, poll_timeout, pollDescriptor->result);
 #else
 #error port me
@@ -313,12 +326,13 @@ PollCont::pollEvent(int event, Event *e) {
 }
 
 static void
-net_signal_hook_callback(EThread *thread) {
+net_signal_hook_callback(EThread *thread)
+{
 #if HAVE_EVENTFD
   uint64_t counter;
   ATS_UNUSED_RETURN(read(thread->evfd, &counter, sizeof(uint64_t)));
 #elif TS_USE_PORT
-  /* Nothing to drain or do */
+/* Nothing to drain or do */
 #else
   char dummy[1024];
   ATS_UNUSED_RETURN(read(thread->evpipe[0], &dummy[0], 1024));
@@ -326,7 +340,8 @@ net_signal_hook_callback(EThread *thread) {
 }
 
 static void
-net_signal_hook_function(EThread *thread) {
+net_signal_hook_function(EThread *thread)
+{
 #if HAVE_EVENTFD
   uint64_t counter = 1;
   ATS_UNUSED_RETURN(write(thread->evfd, &counter, sizeof(uint64_t)));
@@ -342,8 +357,8 @@ net_signal_hook_function(EThread *thread) {
 void
 initialize_thread_for_net(EThread *thread)
 {
-  new((ink_dummy_for_new *) get_NetHandler(thread)) NetHandler();
-  new((ink_dummy_for_new *) get_PollCont(thread)) PollCont(thread->mutex, get_NetHandler(thread));
+  new ((ink_dummy_for_new *)get_NetHandler(thread)) NetHandler();
+  new ((ink_dummy_for_new *)get_PollCont(thread)) PollCont(thread->mutex, get_NetHandler(thread));
   get_NetHandler(thread)->mutex = new_ProxyMutex();
   PollCont *pc = get_PollCont(thread);
   PollDescriptor *pd = pc->pollDescriptor;
@@ -356,7 +371,7 @@ initialize_thread_for_net(EThread *thread)
 #endif
 
   thread->signal_hook = net_signal_hook_function;
-  thread->ep = (EventIO*)ats_malloc(sizeof(EventIO));
+  thread->ep = (EventIO *)ats_malloc(sizeof(EventIO));
   thread->ep->type = EVENTIO_ASYNC_SIGNAL;
 #if HAVE_EVENTFD
   thread->ep->start(pd, thread->evfd, 0, EVENTIO_READ);
@@ -367,9 +382,9 @@ initialize_thread_for_net(EThread *thread)
 
 // NetHandler method definitions
 
-NetHandler::NetHandler():Continuation(NULL), trigger_event(0), keep_alive_lru_size(0)
+NetHandler::NetHandler() : Continuation(NULL), trigger_event(0), keep_alive_lru_size(0)
 {
-  SET_HANDLER((NetContHandler) & NetHandler::startNetEvent);
+  SET_HANDLER((NetContHandler)&NetHandler::startNetEvent);
 }
 
 //
@@ -379,8 +394,8 @@ NetHandler::NetHandler():Continuation(NULL), trigger_event(0), keep_alive_lru_si
 int
 NetHandler::startNetEvent(int event, Event *e)
 {
-  (void) event;
-  SET_HANDLER((NetContHandler) & NetHandler::mainNetEvent);
+  (void)event;
+  SET_HANDLER((NetContHandler)&NetHandler::mainNetEvent);
   e->schedule_every(NET_PERIOD);
   trigger_event = e;
   return EVENT_CONT;
@@ -423,8 +438,8 @@ int
 NetHandler::mainNetEvent(int event, Event *e)
 {
   ink_assert(trigger_event == e && (event == EVENT_INTERVAL || event == EVENT_POLL));
-  (void) event;
-  (void) e;
+  (void)event;
+  (void)e;
   EventIO *epd = NULL;
   int poll_timeout;
 
@@ -440,22 +455,23 @@ NetHandler::mainNetEvent(int event, Event *e)
   UnixNetVConnection *vc = NULL;
 #if TS_USE_EPOLL
   pd->result = epoll_wait(pd->epoll_fd, pd->ePoll_Triggered_Events, POLL_DESCRIPTOR_SIZE, poll_timeout);
-  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] epoll_wait(%d,%d), result=%d", pd->epoll_fd,poll_timeout,pd->result);
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] epoll_wait(%d,%d), result=%d", pd->epoll_fd, poll_timeout,
+           pd->result);
 #elif TS_USE_KQUEUE
   struct timespec tv;
   tv.tv_sec = poll_timeout / 1000;
   tv.tv_nsec = 1000000 * (poll_timeout % 1000);
   pd->result = kevent(pd->kqueue_fd, NULL, 0, pd->kq_Triggered_Events, POLL_DESCRIPTOR_SIZE, &tv);
-  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] kevent(%d,%d), result=%d", pd->kqueue_fd,poll_timeout,pd->result);
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] kevent(%d,%d), result=%d", pd->kqueue_fd, poll_timeout, pd->result);
 #elif TS_USE_PORT
   int retval;
   timespec_t ptimeout;
   ptimeout.tv_sec = poll_timeout / 1000;
   ptimeout.tv_nsec = 1000000 * (poll_timeout % 1000);
   unsigned nget = 1;
-  if((retval = port_getn(pd->port_fd, pd->Port_Triggered_Events, POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) < 0) {
+  if ((retval = port_getn(pd->port_fd, pd->Port_Triggered_Events, POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) < 0) {
     pd->result = 0;
-    switch(errno) {
+    switch (errno) {
     case EINTR:
     case EAGAIN:
     case ETIME:
@@ -470,10 +486,9 @@ NetHandler::mainNetEvent(int event, Event *e)
   } else {
     pd->result = (int)nget;
   }
-  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)",
-           retval,retval < 0 ? strerror(errno) : "ok",
-           pd->port_fd, pd->Port_Triggered_Events,
-           POLL_DESCRIPTOR_SIZE, nget, poll_timeout, pd->result);
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)", retval,
+           retval < 0 ? strerror(errno) : "ok", pd->port_fd, pd->Port_Triggered_Events, POLL_DESCRIPTOR_SIZE, nget, poll_timeout,
+           pd->result);
 
 #else
 #error port me
@@ -481,32 +496,31 @@ NetHandler::mainNetEvent(int event, Event *e)
 
   vc = NULL;
   for (int x = 0; x < pd->result; x++) {
-    epd = (EventIO*) get_ev_data(pd,x);
+    epd = (EventIO *)get_ev_data(pd, x);
     if (epd->type == EVENTIO_READWRITE_VC) {
       vc = epd->data.vc;
-      if (get_ev_events(pd,x) & (EVENTIO_READ|EVENTIO_ERROR)) {
+      if (get_ev_events(pd, x) & (EVENTIO_READ | EVENTIO_ERROR)) {
         vc->read.triggered = 1;
         if (!read_ready_list.in(vc))
           read_ready_list.enqueue(vc);
-        else if (get_ev_events(pd,x) & EVENTIO_ERROR) {
+        else if (get_ev_events(pd, x) & EVENTIO_ERROR) {
           // check for unhandled epoll events that should be handled
           Debug("iocore_net_main", "Unhandled epoll event on read: 0x%04x read.enabled=%d closed=%d read.netready_queue=%d",
-                get_ev_events(pd,x), vc->read.enabled, vc->closed, read_ready_list.in(vc));
+                get_ev_events(pd, x), vc->read.enabled, vc->closed, read_ready_list.in(vc));
         }
       }
       vc = epd->data.vc;
-      if (get_ev_events(pd,x) & (EVENTIO_WRITE|EVENTIO_ERROR)) {
+      if (get_ev_events(pd, x) & (EVENTIO_WRITE | EVENTIO_ERROR)) {
         vc->write.triggered = 1;
         if (!write_ready_list.in(vc))
           write_ready_list.enqueue(vc);
-        else if (get_ev_events(pd,x) & EVENTIO_ERROR) {
+        else if (get_ev_events(pd, x) & EVENTIO_ERROR) {
           // check for unhandled epoll events that should be handled
-          Debug("iocore_net_main",
-                "Unhandled epoll event on write: 0x%04x write.enabled=%d closed=%d write.netready_queue=%d",
-                get_ev_events(pd,x), vc->write.enabled, vc->closed, write_ready_list.in(vc));
+          Debug("iocore_net_main", "Unhandled epoll event on write: 0x%04x write.enabled=%d closed=%d write.netready_queue=%d",
+                get_ev_events(pd, x), vc->write.enabled, vc->closed, write_ready_list.in(vc));
         }
-      } else if (!(get_ev_events(pd,x) & EVENTIO_ERROR)) {
-        Debug("iocore_net_main", "Unhandled epoll event: 0x%04x", get_ev_events(pd,x));
+      } else if (!(get_ev_events(pd, x) & EVENTIO_ERROR)) {
+        Debug("iocore_net_main", "Unhandled epoll event: 0x%04x", get_ev_events(pd, x));
       }
     } else if (epd->type == EVENTIO_DNS_CONNECTION) {
       if (epd->data.dnscon != NULL) {
@@ -518,13 +532,13 @@ NetHandler::mainNetEvent(int event, Event *e)
     } else if (epd->type == EVENTIO_ASYNC_SIGNAL) {
       net_signal_hook_callback(trigger_event->ethread);
     }
-    ev_next_event(pd,x);
+    ev_next_event(pd, x);
   }
 
   pd->result = 0;
 
 #if defined(USE_EDGE_TRIGGER)
- // UnixNetVConnection *
+  // UnixNetVConnection *
   while ((vc = read_ready_list.dequeue())) {
     if (vc->closed)
       close_UnixNetVConnection(vc, trigger_event->ethread);
@@ -557,7 +571,7 @@ NetHandler::mainNetEvent(int event, Event *e)
 #endif
     }
   }
-#else /* !USE_EDGE_TRIGGER */
+#else  /* !USE_EDGE_TRIGGER */
   while ((vc = read_ready_list.dequeue())) {
     if (vc->closed)
       close_UnixNetVConnection(vc, trigger_event->ethread);
@@ -578,4 +592,3 @@ NetHandler::mainNetEvent(int event, Event *e)
 
   return EVENT_CONT;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index b396084..e735ec8 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -26,9 +26,9 @@
 #ifdef ROUNDUP
 #undef ROUNDUP
 #endif
-#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
+#define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y))
 
-typedef int (NetAccept::*NetAcceptHandler) (int, void *);
+typedef int (NetAccept::*NetAcceptHandler)(int, void *);
 volatile int dummy_volatile = 0;
 int accept_till_done = 1;
 
@@ -44,7 +44,7 @@ safe_delay(int msec)
 // delaying to let some of the current connections complete
 //
 static int
-send_throttle_message(NetAccept * na)
+send_throttle_message(NetAccept *na)
 {
   struct pollfd afd;
   Connection con[100];
@@ -54,8 +54,7 @@ send_throttle_message(NetAccept * na)
   afd.events = POLLIN;
 
   int n = 0;
-  while (check_net_throttle(ACCEPT, ink_get_hrtime()) && n < THROTTLE_AT_ONCE - 1
-         && (socketManager.poll(&afd, 1, 0) > 0)) {
+  while (check_net_throttle(ACCEPT, ink_get_hrtime()) && n < THROTTLE_AT_ONCE - 1 && (socketManager.poll(&afd, 1, 0) > 0)) {
     int res = 0;
     if ((res = na->server.accept(&con[n])) < 0)
       return res;
@@ -65,8 +64,7 @@ send_throttle_message(NetAccept * na)
   int i = 0;
   for (i = 0; i < n; i++) {
     socketManager.read(con[i].fd, dummy_read_request, 4096);
-    socketManager.write(con[i].fd, unix_netProcessor.throttle_error_message,
-                        strlen(unix_netProcessor.throttle_error_message));
+    socketManager.write(con[i].fd, unix_netProcessor.throttle_error_message, strlen(unix_netProcessor.throttle_error_message));
   }
   safe_delay(NET_THROTTLE_DELAY / 2);
   for (i = 0; i < n; i++)
@@ -79,9 +77,9 @@ send_throttle_message(NetAccept * na)
 // General case network connection accept code
 //
 int
-net_accept(NetAccept * na, void *ep, bool blockable)
+net_accept(NetAccept *na, void *ep, bool blockable)
 {
-  Event *e = (Event *) ep;
+  Event *e = (Event *)ep;
   int res = 0;
   int count = 0;
   int loop = accept_till_done;
@@ -90,10 +88,10 @@ net_accept(NetAccept * na, void *ep, bool blockable)
   if (!blockable)
     if (!MUTEX_TAKE_TRY_LOCK_FOR(na->action_->mutex, e->ethread, na->action_->continuation))
       return 0;
-  //do-while for accepting all the connections
-  //added by YTS Team, yamsat
+  // do-while for accepting all the connections
+  // added by YTS Team, yamsat
   do {
-    vc = (UnixNetVConnection *) na->alloc_cache;
+    vc = (UnixNetVConnection *)na->alloc_cache;
     if (!vc) {
       vc = (UnixNetVConnection *)na->getNetProcessor()->allocate_vc(e->ethread);
       NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
@@ -122,8 +120,8 @@ net_accept(NetAccept * na, void *ep, bool blockable)
     vc->mutex = new_ProxyMutex();
     vc->action_ = *na->action_;
     vc->set_is_transparent(na->server.f_inbound_transparent);
-    vc->closed  = 0;
-    SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::acceptEvent);
+    vc->closed = 0;
+    SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)&UnixNetVConnection::acceptEvent);
 
     if (e->ethread->is_event_type(na->etype))
       vc->handleEvent(EVENT_NONE, e);
@@ -160,7 +158,7 @@ NetAccept::init_accept_loop(const char *thr_name)
 // use it for high connection rates as well.
 //
 void
-NetAccept::init_accept(EThread * t)
+NetAccept::init_accept(EThread *t)
 {
   if (!t)
     t = eventProcessor.assign_thread(etype);
@@ -171,7 +169,7 @@ NetAccept::init_accept(EThread * t)
   }
   if (do_listen(NON_BLOCKING))
     return;
-  SET_HANDLER((NetAcceptHandler) & NetAccept::acceptEvent);
+  SET_HANDLER((NetAcceptHandler)&NetAccept::acceptEvent);
   period = ACCEPT_PERIOD;
   t->schedule_every(this, period, etype);
 }
@@ -185,9 +183,9 @@ NetAccept::init_accept_per_thread()
   if (do_listen(NON_BLOCKING))
     return;
   if (accept_fn == net_accept)
-    SET_HANDLER((NetAcceptHandler) & NetAccept::acceptFastEvent);
+    SET_HANDLER((NetAcceptHandler)&NetAccept::acceptFastEvent);
   else
-    SET_HANDLER((NetAcceptHandler) & NetAccept::acceptEvent);
+    SET_HANDLER((NetAcceptHandler)&NetAccept::acceptEvent);
   period = ACCEPT_PERIOD;
 
   NetAccept *a;
@@ -213,7 +211,6 @@ NetAccept::do_listen(bool non_blocking, bool transparent)
 
   if (server.fd != NO_FD) {
     if ((res = server.setup_fd_for_listen(non_blocking, recv_bufsize, send_bufsize, transparent))) {
-
       Warning("unable to listen on main accept port %d: errno = %d, %s", ntohs(server.accept_addr.port()), errno, strerror(errno));
       goto Lretry;
     }
@@ -233,15 +230,15 @@ NetAccept::do_listen(bool non_blocking, bool transparent)
 }
 
 int
-NetAccept::do_blocking_accept(EThread * t)
+NetAccept::do_blocking_accept(EThread *t)
 {
   int res = 0;
   int loop = accept_till_done;
   UnixNetVConnection *vc = NULL;
   Connection con;
 
-  //do-while for accepting all the connections
-  //added by YTS Team, yamsat
+  // do-while for accepting all the connections
+  // added by YTS Team, yamsat
   do {
     ink_hrtime now = ink_get_hrtime();
 
@@ -260,8 +257,8 @@ NetAccept::do_blocking_accept(EThread * t)
     if ((res = server.accept(&con)) < 0) {
     Lerror:
       int seriousness = accept_error_seriousness(res);
-      if (seriousness >= 0) {   // not so bad
-        if (!seriousness)       // bad enough to warn about
+      if (seriousness >= 0) { // not so bad
+        if (!seriousness)     // bad enough to warn about
           check_transient_accept_error(res);
         safe_delay(NET_THROTTLE_DELAY);
         return 0;
@@ -297,8 +294,8 @@ NetAccept::do_blocking_accept(EThread * t)
     vc->set_is_transparent(server.f_inbound_transparent);
     vc->mutex = new_ProxyMutex();
     vc->action_ = *action_;
-    SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::acceptEvent);
-    //eventProcessor.schedule_imm(vc, getEtype());
+    SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)&UnixNetVConnection::acceptEvent);
+    // eventProcessor.schedule_imm(vc, getEtype());
     eventProcessor.schedule_imm_signal(vc, getEtype());
   } while (loop);
 
@@ -309,9 +306,9 @@ NetAccept::do_blocking_accept(EThread * t)
 int
 NetAccept::acceptEvent(int event, void *ep)
 {
-  (void) event;
-  Event *e = (Event *) ep;
-  //PollDescriptor *pd = get_PollDescriptor(e->ethread);
+  (void)event;
+  Event *e = (Event *)ep;
+  // PollDescriptor *pd = get_PollDescriptor(e->ethread);
   ProxyMutex *m = 0;
 
   if (action_->mutex)
@@ -327,24 +324,22 @@ NetAccept::acceptEvent(int event, void *ep)
       return EVENT_DONE;
     }
 
-    //ink_assert(ifd < 0 || event == EVENT_INTERVAL || (pd->nfds > ifd && pd->pfd[ifd].fd == server.fd));
-    //if (ifd < 0 || event == EVENT_INTERVAL || (pd->pfd[ifd].revents & (POLLIN | POLLERR | POLLHUP | POLLNVAL))) {
-    //ink_assert(!"incomplete");
-      int res;
-      if ((res = accept_fn(this, e, false)) < 0) {
-        NET_DECREMENT_DYN_STAT(net_accepts_currently_open_stat);
-        /* INKqa11179 */
-        Warning("Accept on port %d failed with error no %d",
-          ats_ip_port_host_order(&server.addr), res
-        );
-        Warning("Traffic Server may be unable to accept more network" "connections on %d",
-          ats_ip_port_host_order(&server.addr)
-        );
-        e->cancel();
-        delete this;
-        return EVENT_DONE;
-      }
-      //}
+    // ink_assert(ifd < 0 || event == EVENT_INTERVAL || (pd->nfds > ifd && pd->pfd[ifd].fd == server.fd));
+    // if (ifd < 0 || event == EVENT_INTERVAL || (pd->pfd[ifd].revents & (POLLIN | POLLERR | POLLHUP | POLLNVAL))) {
+    // ink_assert(!"incomplete");
+    int res;
+    if ((res = accept_fn(this, e, false)) < 0) {
+      NET_DECREMENT_DYN_STAT(net_accepts_currently_open_stat);
+      /* INKqa11179 */
+      Warning("Accept on port %d failed with error no %d", ats_ip_port_host_order(&server.addr), res);
+      Warning("Traffic Server may be unable to accept more network"
+              "connections on %d",
+              ats_ip_port_host_order(&server.addr));
+      e->cancel();
+      delete this;
+      return EVENT_DONE;
+    }
+    //}
   }
   return EVENT_CONT;
 }
@@ -353,9 +348,9 @@ NetAccept::acceptEvent(int event, void *ep)
 int
 NetAccept::acceptFastEvent(int event, void *ep)
 {
-  Event *e = (Event *) ep;
-  (void) event;
-  (void) e;
+  Event *e = (Event *)ep;
+  (void)event;
+  (void)e;
   int bufsz, res;
   Connection con;
 
@@ -395,7 +390,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
           }
         }
       }
-      if (sockopt_flags & 1) {  // we have to disable Nagle
+      if (sockopt_flags & 1) { // we have to disable Nagle
         safe_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, SOCKOPT_ON, sizeof(int));
         Debug("socket", "::acceptFastEvent: setsockopt() TCP_NODELAY on socket");
       }
@@ -427,7 +422,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
 #if defined(linux)
           || res == -EPIPE
 #endif
-        ) {
+          ) {
         goto Ldone;
       } else if (accept_error_seriousness(res) >= 0) {
         check_transient_accept_error(res);
@@ -449,9 +444,9 @@ NetAccept::acceptFastEvent(int event, void *ep)
 
     vc->nh = get_NetHandler(e->ethread);
 
-    SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::mainEvent);
+    SET_CONTINUATION_HANDLER(vc, (NetVConnHandler)&UnixNetVConnection::mainEvent);
 
-    if (vc->ep.start(pd, vc, EVENTIO_READ|EVENTIO_WRITE) < 0) {
+    if (vc->ep.start(pd, vc, EVENTIO_READ | EVENTIO_WRITE) < 0) {
       Warning("[NetAccept::acceptFastEvent]: Error in inserting fd[%d] in kevent\n", vc->con.fd);
       close_UnixNetVConnection(vc, e->ethread);
       return EVENT_DONE;
@@ -487,14 +482,14 @@ Lerror:
 
 
 int
-NetAccept::acceptLoopEvent(int event, Event * e)
+NetAccept::acceptLoopEvent(int event, Event *e)
 {
-  (void) event;
-  (void) e;
+  (void)event;
+  (void)e;
   EThread *t = this_ethread();
 
   while (do_blocking_accept(t) >= 0)
-      ;
+    ;
 
   // Don't think this ever happens ...
   NET_DECREMENT_DYN_STAT(net_accepts_currently_open_stat);
@@ -509,19 +504,10 @@ NetAccept::acceptLoopEvent(int event, Event * e)
 //
 
 NetAccept::NetAccept()
-  : Continuation(NULL),
-    period(0),
-    alloc_cache(0),
-    ifd(-1),
-    callback_on_open(false),
-    backdoor(false),
-    recv_bufsize(0),
-    send_bufsize(0),
-    sockopt_flags(0),
-    packet_mark(0),
-    packet_tos(0),
-    etype(0)
-{ }
+  : Continuation(NULL), period(0), alloc_cache(0), ifd(-1), callback_on_open(false), backdoor(false), recv_bufsize(0),
+    send_bufsize(0), sockopt_flags(0), packet_mark(0), packet_tos(0), etype(0)
+{
+}
 
 
 //
@@ -547,7 +533,8 @@ NetAccept::clone() const
 // Virtual function allows the correct
 // etype to be used in NetAccept functions (ET_SSL
 // or ET_NET).
-EventType NetAccept::getEtype() const
+EventType
+NetAccept::getEtype() const
 {
   return etype;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixNetPages.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetPages.cc b/iocore/net/UnixNetPages.cc
index a734fa4..4b7ff39 100644
--- a/iocore/net/UnixNetPages.cc
+++ b/iocore/net/UnixNetPages.cc
@@ -27,13 +27,13 @@
 #include "I_Tasks.h"
 
 struct ShowNet;
-typedef int (ShowNet::*ShowNetEventHandler) (int event, Event * data);
-struct ShowNet: public ShowCont
-{
+typedef int (ShowNet::*ShowNetEventHandler)(int event, Event *data);
+struct ShowNet : public ShowCont {
   int ithread;
   IpEndpoint addr;
 
-  int showMain(int event, Event * e)
+  int
+  showMain(int event, Event *e)
   {
     CHECK_SHOW(begin("Net"));
     CHECK_SHOW(show("<H3>Show <A HREF=\"./connections\">Connections</A></H3>\n"
@@ -44,11 +44,13 @@ struct ShowNet: public ShowCont
                     "</form>\n"
                     "<form method = GET action = \"./ports\">\n"
                     "Show Connections to/from Port (e.g. 80):<br>\n"
-                    "<input type=text name=name size=64 maxlength=256>\n" "</form>\n"));
+                    "<input type=text name=name size=64 maxlength=256>\n"
+                    "</form>\n"));
     return complete(event, e);
   }
 
-  int showConnectionsOnThread(int event, Event * e)
+  int
+  showConnectionsOnThread(int event, Event *e)
   {
     EThread *ethread = e->ethread;
     NetHandler *nh = get_NetHandler(ethread);
@@ -59,58 +61,46 @@ struct ShowNet: public ShowCont
     }
 
     ink_hrtime now = ink_get_hrtime();
-    forl_LL(UnixNetVConnection, vc, nh->open_list) {
-//      uint16_t port = ats_ip_port_host_order(&addr.sa);
+    forl_LL(UnixNetVConnection, vc, nh->open_list)
+    {
+      //      uint16_t port = ats_ip_port_host_order(&addr.sa);
       if (ats_is_ip(&addr) && addr != vc->server_addr)
         continue;
-//      if (port && port != ats_ip_port_host_order(&vc->server_addr.sa) && port != vc->accept_port)
-//        continue;
+      //      if (port && port != ats_ip_port_host_order(&vc->server_addr.sa) && port != vc->accept_port)
+      //        continue;
       char ipbuf[INET6_ADDRSTRLEN];
       ats_ip_ntop(&vc->server_addr.sa, ipbuf, sizeof(ipbuf));
       char opt_ipbuf[INET6_ADDRSTRLEN];
       char interbuf[80];
-      snprintf(interbuf, sizeof(interbuf), "[%s] %s:%d",
-        vc->options.toString(vc->options.addr_binding),
-        vc->options.local_ip.toString(opt_ipbuf, sizeof(opt_ipbuf)),
-        vc->options.local_port
-      );
+      snprintf(interbuf, sizeof(interbuf), "[%s] %s:%d", vc->options.toString(vc->options.addr_binding),
+               vc->options.local_ip.toString(opt_ipbuf, sizeof(opt_ipbuf)), vc->options.local_port);
       CHECK_SHOW(show("<tr>"
                       //"<td><a href=\"/connection/%d\">%d</a></td>"
-                      "<td>%d</td>"     // ID
-                      "<td>%s</td>"     // ipbuf
-                      "<td>%d</td>"     // port
-                      "<td>%d</td>"     // fd
-                      "<td>%s</td>"     // interbuf
-//                      "<td>%d</td>"     // accept port
-                      "<td>%d secs ago</td>"    // start time
-                      "<td>%d</td>"     // thread id
-                      "<td>%d</td>"     // read enabled
-                      "<td>%" PRId64 "</td>"     // read NBytes
-                      "<td>%" PRId64 "</td>"     // read NDone
-                      "<td>%d</td>"     // write enabled
-                      "<td>%" PRId64 "</td>"     // write nbytes
-                      "<td>%" PRId64 "</td>"     // write ndone
-                      "<td>%d secs</td>"        // Inactivity timeout at
-                      "<td>%d secs</td>"        // Activity timeout at
-                      "<td>%d</td>"     // shutdown
-                      "<td>-%s</td>"    // comments
+                      "<td>%d</td>"          // ID
+                      "<td>%s</td>"          // ipbuf
+                      "<td>%d</td>"          // port
+                      "<td>%d</td>"          // fd
+                      "<td>%s</td>"          // interbuf
+                                             //                      "<td>%d</td>"     // accept port
+                      "<td>%d secs ago</td>" // start time
+                      "<td>%d</td>"          // thread id
+                      "<td>%d</td>"          // read enabled
+                      "<td>%" PRId64 "</td>" // read NBytes
+                      "<td>%" PRId64 "</td>" // read NDone
+                      "<td>%d</td>"          // write enabled
+                      "<td>%" PRId64 "</td>" // write nbytes
+                      "<td>%" PRId64 "</td>" // write ndone
+                      "<td>%d secs</td>"     // Inactivity timeout at
+                      "<td>%d secs</td>"     // Activity timeout at
+                      "<td>%d</td>"          // shutdown
+                      "<td>-%s</td>"         // comments
                       "</tr>\n",
-                      vc->id,
-                      ipbuf,
-                      ats_ip_port_host_order(&vc->server_addr),
-                      vc->con.fd,
-                      interbuf,
-//                      vc->accept_port,
-                      (int) ((now - vc->submit_time) / HRTIME_SECOND),
-                      ethread->id,
-                      vc->read.enabled,
-                      vc->read.vio.nbytes,
-                      vc->read.vio.ndone,
-                      vc->write.enabled,
-                      vc->write.vio.nbytes,
-                      vc->write.vio.ndone,
-                      (int) (vc->inactivity_timeout_in / HRTIME_SECOND),
-                      (int) (vc->active_timeout_in / HRTIME_SECOND), vc->f.shutdown, vc->closed ? "closed " : ""));
+                      vc->id, ipbuf, ats_ip_port_host_order(&vc->server_addr), vc->con.fd, interbuf,
+                      //                      vc->accept_port,
+                      (int)((now - vc->submit_time) / HRTIME_SECOND), ethread->id, vc->read.enabled, vc->read.vio.nbytes,
+                      vc->read.vio.ndone, vc->write.enabled, vc->write.vio.nbytes, vc->write.vio.ndone,
+                      (int)(vc->inactivity_timeout_in / HRTIME_SECOND), (int)(vc->active_timeout_in / HRTIME_SECOND),
+                      vc->f.shutdown, vc->closed ? "closed " : ""));
     }
     ithread++;
     if (ithread < eventProcessor.n_threads_for_type[ET_NET])
@@ -122,7 +112,8 @@ struct ShowNet: public ShowCont
     return EVENT_CONT;
   }
 
-  int showConnections(int event, Event * e)
+  int
+  showConnections(int event, Event *e)
   {
     CHECK_SHOW(begin("Net Connections"));
     CHECK_SHOW(show("<H3>Connections</H3>\n"
@@ -151,7 +142,8 @@ struct ShowNet: public ShowCont
     return EVENT_CONT;
   }
 
-  int showSingleThread(int event, Event * e)
+  int
+  showSingleThread(int event, Event *e)
   {
     EThread *ethread = e->ethread;
     NetHandler *nh = get_NetHandler(ethread);
@@ -165,15 +157,13 @@ struct ShowNet: public ShowCont
     CHECK_SHOW(show("<H3>Thread: %d</H3>\n", ithread));
     CHECK_SHOW(show("<table border=1>\n"));
     int connections = 0;
-    forl_LL(UnixNetVConnection, vc, nh->open_list)
-      connections++;
+    forl_LL(UnixNetVConnection, vc, nh->open_list) connections++;
     CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n", "Connections", connections));
-    //CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n", "Last Poll Size", pollDescriptor->nfds));
+    // CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n", "Last Poll Size", pollDescriptor->nfds));
     CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n", "Last Poll Ready", pollDescriptor->result));
     CHECK_SHOW(show("</table>\n"));
     CHECK_SHOW(show("<table border=1>\n"));
-    CHECK_SHOW(show
-               ("<tr><th>#</th><th>Read Priority</th><th>Read Bucket</th><th>Write Priority</th><th>Write Bucket</th></tr>\n"));
+    CHECK_SHOW(show("<tr><th>#</th><th>Read Priority</th><th>Read Bucket</th><th>Write Priority</th><th>Write Bucket</th></tr>\n"));
     CHECK_SHOW(show("</table>\n"));
     ithread++;
     if (ithread < eventProcessor.n_threads_for_type[ET_NET])
@@ -183,35 +173,38 @@ struct ShowNet: public ShowCont
     return EVENT_CONT;
   }
 
-  int showThreads(int event, Event * e)
+  int
+  showThreads(int event, Event *e)
   {
     CHECK_SHOW(begin("Net Threads"));
     SET_HANDLER(&ShowNet::showSingleThread);
     eventProcessor.eventthread[ET_NET][0]->schedule_imm(this); // This can not use ET_TASK
     return EVENT_CONT;
   }
-  int showSingleConnection(int event, Event * e)
+  int
+  showSingleConnection(int event, Event *e)
   {
     CHECK_SHOW(begin("Net Connection"));
     return complete(event, e);
   }
-  int showHostnames(int event, Event * e)
+  int
+  showHostnames(int event, Event *e)
   {
     CHECK_SHOW(begin("Net Connections to/from Host"));
     return complete(event, e);
   }
 
-ShowNet(Continuation * c, HTTPHdr * h):
-  ShowCont(c, h), ithread(0) {
+  ShowNet(Continuation *c, HTTPHdr *h) : ShowCont(c, h), ithread(0)
+  {
     memset(&addr, 0, sizeof(addr));
     SET_HANDLER(&ShowNet::showMain);
   }
 };
 
 #undef STREQ_PREFIX
-#define STREQ_PREFIX(_x,_n,_s) (!ptr_len_ncasecmp(_x,_n,_s,sizeof(_s)-1))
+#define STREQ_PREFIX(_x, _n, _s) (!ptr_len_ncasecmp(_x, _n, _s, sizeof(_s) - 1))
 Action *
-register_ShowNet(Continuation * c, HTTPHdr * h)
+register_ShowNet(Continuation *c, HTTPHdr *h)
 {
   ShowNet *s = new ShowNet(c, h);
   int path_len;
@@ -240,10 +233,9 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
     if (s->sarg)
       gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
     if (gn)
-      ats_ip_port_cast(&s->addr.sa) = htons(atoi(gn+1));
+      ats_ip_port_cast(&s->addr.sa) = htons(atoi(gn + 1));
     SET_CONTINUATION_HANDLER(s, &ShowNet::showConnections);
   }
   eventProcessor.schedule_imm(s, ET_TASK);
   return &s->action;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index a07aed8..fdc58ab 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -28,7 +28,7 @@
 
 NetProcessor::AcceptOptions const NetProcessor::DEFAULT_ACCEPT_OPTIONS;
 
-NetProcessor::AcceptOptions&
+NetProcessor::AcceptOptions &
 NetProcessor::AcceptOptions::reset()
 {
   local_port = 0;
@@ -57,38 +57,37 @@ net_next_connection_number()
 {
   unsigned int res = 0;
   do {
-    res = (unsigned int)
-      ink_atomic_increment(&net_connection_number, 1);
+    res = (unsigned int)ink_atomic_increment(&net_connection_number, 1);
   } while (!res);
   return res;
 }
 
 Action *
-NetProcessor::accept(Continuation* cont, AcceptOptions const& opt)
+NetProcessor::accept(Continuation *cont, AcceptOptions const &opt)
 {
-  Debug("iocore_net_processor", "NetProcessor::accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0x",
-        opt.local_port, opt.recv_bufsize, opt.send_bufsize, opt.sockopt_flags);
+  Debug("iocore_net_processor", "NetProcessor::accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0x", opt.local_port,
+        opt.recv_bufsize, opt.send_bufsize, opt.sockopt_flags);
 
-  return ((UnixNetProcessor *) this)->accept_internal(cont, NO_FD, opt);
+  return ((UnixNetProcessor *)this)->accept_internal(cont, NO_FD, opt);
 }
 
 Action *
-NetProcessor::main_accept(Continuation *cont, SOCKET fd, AcceptOptions const& opt)
+NetProcessor::main_accept(Continuation *cont, SOCKET fd, AcceptOptions const &opt)
 {
-  UnixNetProcessor* this_unp = static_cast<UnixNetProcessor*>(this);
+  UnixNetProcessor *this_unp = static_cast<UnixNetProcessor *>(this);
   Debug("iocore_net_processor", "NetProcessor::main_accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0x",
         opt.local_port, opt.recv_bufsize, opt.send_bufsize, opt.sockopt_flags);
   return this_unp->accept_internal(cont, fd, opt);
 }
 
 Action *
-UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions const& opt)
+UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions const &opt)
 {
   EventType upgraded_etype = opt.etype; // setEtype requires non-const ref.
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
   int accept_threads = opt.accept_threads; // might be changed.
-  IpEndpoint accept_ip; // local binding address.
+  IpEndpoint accept_ip;                    // local binding address.
   char thr_name[MAX_THREAD_NAME_LENGTH];
 
   NetAccept *na = createNetAccept();
@@ -120,7 +119,7 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
   ats_ip_copy(&na->server.accept_addr, &accept_ip);
   na->server.f_inbound_transparent = opt.f_inbound_transparent;
   if (opt.f_inbound_transparent) {
-    Debug( "http_tproxy", "Marking accept server %p on port %d as inbound transparent", na, opt.local_port);
+    Debug("http_tproxy", "Marking accept server %p on port %d as inbound transparent", na, opt.local_port);
   }
 
   int should_filter_int = 0;
@@ -143,20 +142,19 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
   if (na->callback_on_open)
     na->mutex = cont->mutex;
   if (opt.frequent_accept) { // true
-    if (accept_threads > 0)  {
+    if (accept_threads > 0) {
       if (0 == na->do_listen(BLOCKING, opt.f_inbound_transparent)) {
+        for (int i = 1; i < accept_threads; ++i) {
+          NetAccept *a = na->clone();
 
-        for (int i=1; i < accept_threads; ++i) {
-          NetAccept * a = na->clone();
-
-          snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i-1, ats_ip_port_host_order(&accept_ip));
+          snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i - 1, ats_ip_port_host_order(&accept_ip));
           a->init_accept_loop(thr_name);
           Debug("iocore_net_accept", "Created accept thread #%d for port %d", i, ats_ip_port_host_order(&accept_ip));
         }
 
         // Start the "template" accept thread last.
         Debug("iocore_net_accept", "Created accept thread #%d for port %d", accept_threads, ats_ip_port_host_order(&accept_ip));
-        snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", accept_threads-1, ats_ip_port_host_order(&accept_ip));
+        snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", accept_threads - 1, ats_ip_port_host_order(&accept_ip));
         na->init_accept_loop(thr_name);
       }
     } else {
@@ -174,24 +172,21 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
   }
 #endif
 #ifdef TCP_INIT_CWND
- int tcp_init_cwnd = 0;
- REC_ReadConfigInteger(tcp_init_cwnd, "proxy.config.http.server_tcp_init_cwnd");
- if(tcp_init_cwnd > 0) {
+  int tcp_init_cwnd = 0;
+  REC_ReadConfigInteger(tcp_init_cwnd, "proxy.config.http.server_tcp_init_cwnd");
+  if (tcp_init_cwnd > 0) {
     Debug("net", "Setting initial congestion window to %d", tcp_init_cwnd);
-    if(setsockopt(na->server.fd, IPPROTO_TCP, TCP_INIT_CWND, &tcp_init_cwnd, sizeof(int)) != 0) {
+    if (setsockopt(na->server.fd, IPPROTO_TCP, TCP_INIT_CWND, &tcp_init_cwnd, sizeof(int)) != 0) {
       Error("Cannot set initial congestion window to %d", tcp_init_cwnd);
     }
- }
+  }
 #endif
   return na->action_;
 }
 
 Action *
-UnixNetProcessor::connect_re_internal(
-  Continuation * cont,
-  sockaddr const* target,
-  NetVCOptions * opt
-) {
+UnixNetProcessor::connect_re_internal(Continuation *cont, sockaddr const *target, NetVCOptions *opt)
+{
   ProxyMutex *mutex = cont->mutex;
   EThread *t = mutex->thread_holding;
   UnixNetVConnection *vc = (UnixNetVConnection *)this->allocate_vc(t);
@@ -213,7 +208,7 @@ UnixNetProcessor::connect_re_internal(
                            */
                           !socks_conf_stuff->ip_map.contains(target))
 #endif
-    );
+                        );
   SocksEntry *socksEntry = NULL;
 
   NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
@@ -228,7 +223,7 @@ UnixNetProcessor::connect_re_internal(
     char buff[INET6_ADDRPORTSTRLEN];
     Debug("Socks", "Using Socks ip: %s\n", ats_ip_nptop(target, buff, sizeof(buff)));
     socksEntry = socksAllocator.alloc();
-    socksEntry->init(cont->mutex, vc, opt->socks_support, opt->socks_version);        /*XXXX remove last two args */
+    socksEntry->init(cont->mutex, vc, opt->socks_support, opt->socks_version); /*XXXX remove last two args */
     socksEntry->action_ = cont;
     cont = socksEntry;
     if (!ats_is_ip(&socksEntry->server_addr)) {
@@ -266,14 +261,12 @@ UnixNetProcessor::connect_re_internal(
 }
 
 Action *
-UnixNetProcessor::connect(Continuation * cont, UnixNetVConnection ** /* avc */, sockaddr const* target,
-                          NetVCOptions * opt)
+UnixNetProcessor::connect(Continuation *cont, UnixNetVConnection ** /* avc */, sockaddr const *target, NetVCOptions *opt)
 {
   return connect_re(cont, target, opt);
 }
 
-struct CheckConnect:public Continuation
-{
+struct CheckConnect : public Continuation {
   UnixNetVConnection *vc;
   Action action_;
   MIOBuffer *buf;
@@ -282,12 +275,13 @@ struct CheckConnect:public Continuation
   int recursion;
   ink_hrtime timeout;
 
-  int handle_connect(int event, Event * e)
+  int
+  handle_connect(int event, Event *e)
   {
     connect_status = event;
     switch (event) {
     case NET_EVENT_OPEN:
-      vc = (UnixNetVConnection *) e;
+      vc = (UnixNetVConnection *)e;
       Debug("iocore_net_connect", "connect Net open");
       vc->do_io_write(this, 10, /* some non-zero number just to get the poll going */
                       reader);
@@ -296,25 +290,24 @@ struct CheckConnect:public Continuation
       return EVENT_CONT;
       break;
 
-      case NET_EVENT_OPEN_FAILED:
-        Debug("iocore_net_connect", "connect Net open failed");
+    case NET_EVENT_OPEN_FAILED:
+      Debug("iocore_net_connect", "connect Net open failed");
       if (!action_.cancelled)
-        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) e);
+        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *)e);
       break;
 
-      case VC_EVENT_WRITE_READY:int sl, ret;
+    case VC_EVENT_WRITE_READY:
+      int sl, ret;
       socklen_t sz;
-      if (!action_.cancelled)
-      {
+      if (!action_.cancelled) {
         sz = sizeof(int);
-          ret = getsockopt(vc->con.fd, SOL_SOCKET, SO_ERROR, (char *) &sl, &sz);
-        if (!ret && sl == 0)
-        {
+        ret = getsockopt(vc->con.fd, SOL_SOCKET, SO_ERROR, (char *)&sl, &sz);
+        if (!ret && sl == 0) {
           Debug("iocore_net_connect", "connection established");
           /* disable write on vc */
           vc->write.enabled = 0;
           vc->cancel_inactivity_timeout();
-          //write_disable(get_NetHandler(this_ethread()), vc);
+          // write_disable(get_NetHandler(this_ethread()), vc);
           /* clean up vc fields */
           vc->write.vio.nbytes = 0;
           vc->write.vio.op = VIO::NONE;
@@ -323,32 +316,31 @@ struct CheckConnect:public Continuation
 
           action_.continuation->handleEvent(NET_EVENT_OPEN, vc);
           delete this;
-            return EVENT_DONE;
+          return EVENT_DONE;
         }
       }
       vc->do_io_close();
       if (!action_.cancelled)
-        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) -ENET_CONNECT_FAILED);
+        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *)-ENET_CONNECT_FAILED);
       break;
     case VC_EVENT_INACTIVITY_TIMEOUT:
       Debug("iocore_net_connect", "connect timed out");
       vc->do_io_close();
       if (!action_.cancelled)
-        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) -ENET_CONNECT_TIMEOUT);
+        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *)-ENET_CONNECT_TIMEOUT);
       break;
     default:
       ink_assert(!"unknown connect event");
       if (!action_.cancelled)
-        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) -ENET_CONNECT_FAILED);
-
+        action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *)-ENET_CONNECT_FAILED);
     }
     if (!recursion)
       delete this;
     return EVENT_DONE;
   }
 
-  Action *connect_s(Continuation * cont, sockaddr const* target,
-                    int _timeout, NetVCOptions * opt)
+  Action *
+  connect_s(Continuation *cont, sockaddr const *target, int _timeout, NetVCOptions *opt)
   {
     action_ = cont;
     timeout = HRTIME_SECONDS(_timeout);
@@ -363,13 +355,15 @@ struct CheckConnect:public Continuation
     }
   }
 
-  CheckConnect(ProxyMutex * m = NULL):Continuation(m), connect_status(-1), recursion(0), timeout(0) {
+  CheckConnect(ProxyMutex *m = NULL) : Continuation(m), connect_status(-1), recursion(0), timeout(0)
+  {
     SET_HANDLER(&CheckConnect::handle_connect);
     buf = new_empty_MIOBuffer(1);
     reader = buf->alloc_reader();
   }
 
-  ~CheckConnect() {
+  ~CheckConnect()
+  {
     buf->dealloc_all_readers();
     buf->clear();
     free_MIOBuffer(buf);
@@ -377,8 +371,7 @@ struct CheckConnect:public Continuation
 };
 
 Action *
-NetProcessor::connect_s(Continuation * cont, sockaddr const* target,
-                        int timeout, NetVCOptions * opt)
+NetProcessor::connect_s(Continuation *cont, sockaddr const *target, int timeout, NetVCOptions *opt)
 {
   Debug("iocore_net_connect", "NetProcessor::connect_s called");
   CheckConnect *c = new CheckConnect(cont->mutex);
@@ -386,7 +379,6 @@ NetProcessor::connect_s(Continuation * cont, sockaddr const* target,
 }
 
 
-
 struct PollCont;
 
 // This is a little odd, in that the actual threads are created before calling the processor.
@@ -406,7 +398,7 @@ UnixNetProcessor::start(int, size_t)
   netthreads = eventProcessor.eventthread[etype];
   for (int i = 0; i < n_netthreads; ++i) {
     initialize_thread_for_net(netthreads[i]);
-    extern void initialize_thread_for_http_sessions(EThread *thread, int thread_index);
+    extern void initialize_thread_for_http_sessions(EThread * thread, int thread_index);
     initialize_thread_for_http_sessions(netthreads[i], i);
   }
 
@@ -419,7 +411,8 @@ UnixNetProcessor::start(int, size_t)
     socks_conf_stuff = new socks_conf_struct;
     loadSocksConfiguration(socks_conf_stuff);
     if (!socks_conf_stuff->socks_needed && socks_conf_stuff->accept_enabled) {
-      Warning("We can not have accept_enabled and socks_needed turned off" " disabling Socks accept\n");
+      Warning("We can not have accept_enabled and socks_needed turned off"
+              " disabling Socks accept\n");
       socks_conf_stuff->accept_enabled = 0;
     } else {
       // this is sslNetprocessor
@@ -436,9 +429,9 @@ UnixNetProcessor::start(int, size_t)
      } */
 
 
-/*
- * Stat pages
- */
+  /*
+   * Stat pages
+   */
   extern Action *register_ShowNet(Continuation * c, HTTPHdr * h);
   if (etype == ET_NET)
     statPagesManager.register_http("net", register_ShowNet);
@@ -469,9 +462,8 @@ UnixNetProcessor::allocate_vc(EThread *t)
   return vc;
 }
 
-struct socks_conf_struct *
-NetProcessor::socks_conf_stuff = NULL;
+struct socks_conf_struct *NetProcessor::socks_conf_stuff = NULL;
 int NetProcessor::accept_mss = 0;
 
 UnixNetProcessor unix_netProcessor;
-NetProcessor & netProcessor = unix_netProcessor;
+NetProcessor &netProcessor = unix_netProcessor;


[31/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Tasks.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Tasks.h b/iocore/eventsystem/I_Tasks.h
index 64d66a6..aa91e43 100644
--- a/iocore/eventsystem/I_Tasks.h
+++ b/iocore/eventsystem/I_Tasks.h
@@ -22,17 +22,17 @@
 
  */
 
-#if !defined (I_Tasks_h)
+#if !defined(I_Tasks_h)
 #define I_Tasks_h
 
 #include "I_EventSystem.h"
 
 extern EventType ET_TASK;
 
-class TasksProcessor: public Processor
+class TasksProcessor : public Processor
 {
- public:
-  int start(int task_threads, size_t stacksize=DEFAULT_STACKSIZE);
+public:
+  int start(int task_threads, size_t stacksize = DEFAULT_STACKSIZE);
 };
 
 extern TasksProcessor tasksProcessor;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_Thread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
index 2f9a018..0fde539 100644
--- a/iocore/eventsystem/I_Thread.h
+++ b/iocore/eventsystem/I_Thread.h
@@ -61,20 +61,21 @@
 
 #if !defined(_I_EventSystem_h) && !defined(_P_EventSystem_h)
 #error "include I_EventSystem.h or P_EventSystem.h"
--- -include I_Event.h or P_Event.h
+-- - include I_Event.h or
+  P_Event.h
 #endif
 #include "libts.h"
 #include "I_ProxyAllocator.h"
-class Thread;
+  class Thread;
 class ProxyMutex;
 
 #define THREADAPI
 #define THREADAPI_RETURN_TYPE void *
-typedef THREADAPI_RETURN_TYPE(THREADAPI * ThreadFunction) (void *arg);
+typedef THREADAPI_RETURN_TYPE(THREADAPI *ThreadFunction)(void *arg);
 
 extern ProxyMutex *global_mutex;
 
-static const int MAX_THREAD_NAME_LENGTH  = 16;
+static const int MAX_THREAD_NAME_LENGTH = 16;
 static const int DEFAULT_STACKSIZE = 1048576; // 1MB
 
 
@@ -95,7 +96,6 @@ static const int DEFAULT_STACKSIZE = 1048576; // 1MB
 class Thread
 {
 public:
-
   /*-------------------------------------------*\
   | Common Interface                            |
   \*-------------------------------------------*/
@@ -120,7 +120,7 @@ public:
   // PRIVATE
   void set_specific();
   Thread();
-  virtual ~ Thread();
+  virtual ~Thread();
 
   static ink_hrtime cur_time;
   inkcoreapi static ink_thread_key thread_data_key;
@@ -146,13 +146,15 @@ public:
 private:
   // prevent unauthorized copies (Not implemented)
   Thread(const Thread &);
-  Thread & operator =(const Thread &);
+  Thread &operator=(const Thread &);
 
 public:
-  ink_thread start(const char* name, size_t stacksize=DEFAULT_STACKSIZE, ThreadFunction f=NULL, void *a=NULL);
+  ink_thread start(const char *name, size_t stacksize = DEFAULT_STACKSIZE, ThreadFunction f = NULL, void *a = NULL);
 
-  virtual void execute()
-  {  }
+  virtual void
+  execute()
+  {
+  }
 };
 
 extern ink_hrtime ink_get_hrtime();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_VConnection.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_VConnection.h b/iocore/eventsystem/I_VConnection.h
index d4ca8a3..559e537 100644
--- a/iocore/eventsystem/I_VConnection.h
+++ b/iocore/eventsystem/I_VConnection.h
@@ -22,52 +22,53 @@
 
  */
 
-#if !defined (_I_VConnection_h_)
+#if !defined(_I_VConnection_h_)
 #define _I_VConnection_h_
 
 #include "libts.h"
 #include "I_EventSystem.h"
 #if !defined(I_VIO_h)
 #error "include I_VIO.h"
--- -include I_VIO.h
+-- -
+  include I_VIO.h
 #endif
 
 //
 // Data Types
 //
-#define VCONNECTION_CACHE_DATA_BASE     0
-#define VCONNECTION_NET_DATA_BASE       100
-#define VCONNECTION_API_DATA_BASE       200
+#define VCONNECTION_CACHE_DATA_BASE 0
+#define VCONNECTION_NET_DATA_BASE 100
+#define VCONNECTION_API_DATA_BASE 200
 
 //
 // Event signals
 //
 
-#define VC_EVENT_NONE                    EVENT_NONE
+#define VC_EVENT_NONE EVENT_NONE
 
 /** When a Continuation is first scheduled on a processor. */
-#define VC_EVENT_IMMEDIATE               EVENT_IMMEDIATE
+#define VC_EVENT_IMMEDIATE EVENT_IMMEDIATE
 
-#define	VC_EVENT_READ_READY              VC_EVENT_EVENTS_START
+#define VC_EVENT_READ_READY VC_EVENT_EVENTS_START
 
 /**
   Any data in the accociated buffer *will be written* when the
   Continuation returns.
 
 */
-#define	VC_EVENT_WRITE_READY             (VC_EVENT_EVENTS_START+1)
+#define VC_EVENT_WRITE_READY (VC_EVENT_EVENTS_START + 1)
 
-#define	VC_EVENT_READ_COMPLETE           (VC_EVENT_EVENTS_START+2)
-#define	VC_EVENT_WRITE_COMPLETE          (VC_EVENT_EVENTS_START+3)
+#define VC_EVENT_READ_COMPLETE (VC_EVENT_EVENTS_START + 2)
+#define VC_EVENT_WRITE_COMPLETE (VC_EVENT_EVENTS_START + 3)
 
 /**
   No more data (end of stream). It should be interpreted by a
   protocol engine as either a COMPLETE or ERROR.
 
 */
-#define	VC_EVENT_EOS                     (VC_EVENT_EVENTS_START+4)
+#define VC_EVENT_EOS (VC_EVENT_EVENTS_START + 4)
 
-#define	VC_EVENT_ERROR                   EVENT_ERROR
+#define VC_EVENT_ERROR EVENT_ERROR
 
 /**
   VC_EVENT_INACTIVITY_TIMEOUT indiates that the operation (read or write) has:
@@ -79,16 +80,16 @@
        (for a write, no data has been written to the connection)
 
 */
-#define	VC_EVENT_INACTIVITY_TIMEOUT      (VC_EVENT_EVENTS_START+5)
+#define VC_EVENT_INACTIVITY_TIMEOUT (VC_EVENT_EVENTS_START + 5)
 
 /**
   Total time for some operation has been exeeded, regardless of any
   intermediate progress.
 
 */
-#define	VC_EVENT_ACTIVE_TIMEOUT          (VC_EVENT_EVENTS_START+6)
+#define VC_EVENT_ACTIVE_TIMEOUT (VC_EVENT_EVENTS_START + 6)
 
-#define	VC_EVENT_OOB_COMPLETE            (VC_EVENT_EVENTS_START+7)
+#define VC_EVENT_OOB_COMPLETE (VC_EVENT_EVENTS_START + 7)
 
 //
 // Event names
@@ -107,26 +108,24 @@
 //
 // Event return codes
 //
-#define VC_EVENT_DONE                CONTINUATION_DONE
-#define VC_EVENT_CONT                CONTINUATION_CONT
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//      Support Data Structures
-//
-//////////////////////////////////////////////////////////////////////////////
-
-/** Used in VConnection::shutdown(). */
-enum ShutdownHowTo_t
-{
-  IO_SHUTDOWN_READ = 0,
-  IO_SHUTDOWN_WRITE,
-  IO_SHUTDOWN_READWRITE
-};
+#define VC_EVENT_DONE CONTINUATION_DONE
+#define VC_EVENT_CONT CONTINUATION_CONT
+
+  //////////////////////////////////////////////////////////////////////////////
+  //
+  //      Support Data Structures
+  //
+  //////////////////////////////////////////////////////////////////////////////
+
+  /** Used in VConnection::shutdown(). */
+  enum ShutdownHowTo_t {
+    IO_SHUTDOWN_READ = 0,
+    IO_SHUTDOWN_WRITE,
+    IO_SHUTDOWN_READWRITE
+  };
 
 /** Used in VConnection::get_data(). */
-enum TSApiDataType
-{
+enum TSApiDataType {
   TS_API_DATA_READ_VIO = VCONNECTION_API_DATA_BASE,
   TS_API_DATA_WRITE_VIO,
   TS_API_DATA_OUTPUT_VC,
@@ -134,7 +133,7 @@ enum TSApiDataType
 };
 
 extern "C" {
-    typedef struct tsapi_vio* TSVIO;
+typedef struct tsapi_vio *TSVIO;
 }
 
 /**
@@ -147,11 +146,10 @@ extern "C" {
   It is also a Continuation that is called back from processors.
 
 */
-class VConnection:public Continuation
+class VConnection : public Continuation
 {
 public:
-
-  virtual ~ VConnection();
+  virtual ~VConnection();
 
   /**
     Read data from the VConnection.
@@ -249,8 +247,7 @@ public:
     @return VIO representing the scheduled IO operation.
 
   */
-  virtual VIO *do_io_write(Continuation *c = NULL,
-                           int64_t nbytes = INT64_MAX, IOBufferReader *buf = 0, bool owner = false) = 0;
+  virtual VIO *do_io_write(Continuation *c = NULL, int64_t nbytes = INT64_MAX, IOBufferReader *buf = 0, bool owner = false) = 0;
 
   /**
     Indicate that the VConnection is no longer needed.
@@ -312,7 +309,7 @@ public:
   */
   virtual void do_io_shutdown(ShutdownHowTo_t howto) = 0;
 
-    VConnection(ProxyMutex *aMutex);
+  VConnection(ProxyMutex *aMutex);
 
   /** @deprecated */
   VIO *do_io(int op, Continuation *c = NULL, int64_t nbytes = INT64_MAX, MIOBuffer *buf = 0, int data = 0);
@@ -339,10 +336,11 @@ public:
     @return True if the oparation is successful.
 
   */
-  virtual bool get_data(int id, void *data)
+  virtual bool
+  get_data(int id, void *data)
   {
-    (void) id;
-    (void) data;
+    (void)id;
+    (void)data;
     return false;
   }
 
@@ -359,15 +357,15 @@ public:
     @return True if the oparation is successful.
 
   */
-  virtual bool set_data(int id, void *data)
+  virtual bool
+  set_data(int id, void *data)
   {
-    (void) id;
-    (void) data;
+    (void)id;
+    (void)data;
     return false;
   }
 
 public:
-
   /**
     The error code from the last error.
 
@@ -378,25 +376,34 @@ public:
   int lerrno;
 };
 
-struct DummyVConnection: public VConnection
-{
-  virtual VIO *do_io_write(Continuation * /* c ATS_UNUSED */, int64_t /* nbytes ATS_UNUSED */, IOBufferReader * /* buf ATS_UNUSED */, bool /* owner ATS_UNUSED */) {
-    ink_assert(!"VConnection::do_io_write -- " "cannot use default implementation");
+struct DummyVConnection : public VConnection {
+  virtual VIO *
+  do_io_write(Continuation * /* c ATS_UNUSED */, int64_t /* nbytes ATS_UNUSED */, IOBufferReader * /* buf ATS_UNUSED */,
+              bool /* owner ATS_UNUSED */)
+  {
+    ink_assert(!"VConnection::do_io_write -- "
+                "cannot use default implementation");
     return NULL;
   }
-  virtual VIO *do_io_read(Continuation * /* c ATS_UNUSED */, int64_t /* nbytes ATS_UNUSED */, MIOBuffer * /* buf ATS_UNUSED */) {
-    ink_assert(!"VConnection::do_io_read -- " "cannot use default implementation");
+  virtual VIO *
+  do_io_read(Continuation * /* c ATS_UNUSED */, int64_t /* nbytes ATS_UNUSED */, MIOBuffer * /* buf ATS_UNUSED */)
+  {
+    ink_assert(!"VConnection::do_io_read -- "
+                "cannot use default implementation");
     return NULL;
   }
-  virtual void do_io_close(int /* alerrno ATS_UNUSED */) {
-    ink_assert(!"VConnection::do_io_close -- " "cannot use default implementation");
-  }
-  virtual void do_io_shutdown(ShutdownHowTo_t /* howto ATS_UNUSED */ )
+  virtual void
+  do_io_close(int /* alerrno ATS_UNUSED */)
   {
-    ink_assert(!"VConnection::do_io_shutdown -- " "cannot use default implementation");
+    ink_assert(!"VConnection::do_io_close -- "
+                "cannot use default implementation");
   }
-DummyVConnection(ProxyMutex *m):VConnection(m) {
+  virtual void do_io_shutdown(ShutdownHowTo_t /* howto ATS_UNUSED */)
+  {
+    ink_assert(!"VConnection::do_io_shutdown -- "
+                "cannot use default implementation");
   }
+  DummyVConnection(ProxyMutex *m) : VConnection(m) {}
 };
 
 #endif /*_I_VConnection_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/I_VIO.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_VIO.h b/iocore/eventsystem/I_VIO.h
index 7887339..8d8bf97 100644
--- a/iocore/eventsystem/I_VIO.h
+++ b/iocore/eventsystem/I_VIO.h
@@ -22,14 +22,15 @@
 
  */
 
-#if !defined (I_VIO_h)
+#if !defined(I_VIO_h)
 #define I_VIO_h
 
 #include "libts.h"
 #include "I_EventSystem.h"
 #if !defined(I_IOBuffer_h)
 #error "include I_IOBuffer.h"
--- -include I_IOBuffer.h
+-- -
+  include I_IOBuffer.h
 #endif
 #include "ink_apidefs.h"
   class Continuation;
@@ -73,13 +74,11 @@ class ProxyMutex;
 class VIO
 {
 public:
-  ~VIO()
-  {
-  }
+  ~VIO() {}
 
   /** Interface for the VConnection that owns this handle. */
   Continuation *get_continuation();
-  void set_continuation(Continuation * cont);
+  void set_continuation(Continuation *cont);
 
   /**
     Set nbytes to be what is current available.
@@ -103,8 +102,8 @@ public:
   /////////////////////
   // buffer settings //
   /////////////////////
-  void set_writer(MIOBuffer * writer);
-  void set_reader(IOBufferReader * reader);
+  void set_writer(MIOBuffer *writer);
+  void set_reader(IOBufferReader *reader);
   MIOBuffer *get_writer();
   IOBufferReader *get_reader();
 
@@ -145,15 +144,22 @@ public:
   VIO(int aop);
   VIO();
 
-  enum
-  {
-    NONE = 0, READ, WRITE, CLOSE, ABORT,
-    SHUTDOWN_READ, SHUTDOWN_WRITE, SHUTDOWN_READWRITE,
-    SEEK, PREAD, PWRITE, STAT
+  enum {
+    NONE = 0,
+    READ,
+    WRITE,
+    CLOSE,
+    ABORT,
+    SHUTDOWN_READ,
+    SHUTDOWN_WRITE,
+    SHUTDOWN_READWRITE,
+    SEEK,
+    PREAD,
+    PWRITE,
+    STAT,
   };
 
 public:
-
   /**
     Continuation to callback.
 
@@ -161,7 +167,7 @@ public:
     call with events for this operation.
 
   */
-  Continuation * _cont;
+  Continuation *_cont;
 
   /**
     Number of bytes to be done for this operation.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/Inline.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Inline.cc b/iocore/eventsystem/Inline.cc
index 87d810e..dc708c2 100644
--- a/iocore/eventsystem/Inline.cc
+++ b/iocore/eventsystem/Inline.cc
@@ -28,4 +28,3 @@
 
 #define TS_INLINE
 #include "P_EventSystem.h"
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/Lock.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Lock.cc b/iocore/eventsystem/Lock.cc
index c58160a..855a1b2 100644
--- a/iocore/eventsystem/Lock.cc
+++ b/iocore/eventsystem/Lock.cc
@@ -34,32 +34,29 @@
 ClassAllocator<ProxyMutex> mutexAllocator("mutexAllocator");
 
 void
-lock_waiting(const SrcLoc& srcloc, const char *handler)
+lock_waiting(const SrcLoc &srcloc, const char *handler)
 {
   if (is_diags_on("locks")) {
     char buf[128];
-    fprintf(stderr, "WARNING: waiting on lock %s for %s\n",
-            srcloc.str(buf, sizeof(buf)), handler ? handler : "UNKNOWN");
+    fprintf(stderr, "WARNING: waiting on lock %s for %s\n", srcloc.str(buf, sizeof(buf)), handler ? handler : "UNKNOWN");
   }
 }
 
 void
-lock_holding(const SrcLoc& srcloc, const char *handler)
+lock_holding(const SrcLoc &srcloc, const char *handler)
 {
   if (is_diags_on("locks")) {
     char buf[128];
-    fprintf(stderr, "WARNING: holding lock %s too long for %s\n",
-            srcloc.str(buf, sizeof(buf)), handler ? handler : "UNKNOWN");
-    }
+    fprintf(stderr, "WARNING: holding lock %s too long for %s\n", srcloc.str(buf, sizeof(buf)), handler ? handler : "UNKNOWN");
+  }
 }
 
 void
-lock_taken(const SrcLoc& srcloc, const char *handler)
+lock_taken(const SrcLoc &srcloc, const char *handler)
 {
   if (is_diags_on("locks")) {
     char buf[128];
-    fprintf(stderr, "WARNING: lock %s taken too many times for %s\n",
-            srcloc.str(buf, sizeof(buf)), handler ? handler : "UNKNOWN");
+    fprintf(stderr, "WARNING: lock %s taken too many times for %s\n", srcloc.str(buf, sizeof(buf)), handler ? handler : "UNKNOWN");
   }
 }
 
@@ -70,25 +67,20 @@ ProxyMutex::print_lock_stats(int flag)
   if (flag) {
     if (total_acquires < 10)
       return;
-    printf("Lock Stats (Dying):successful %d (%.2f%%), unsuccessful %d (%.2f%%) blocking %d \n",
-           successful_nonblocking_acquires,
-           (nonblocking_acquires > 0 ?
-            successful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0),
+    printf("Lock Stats (Dying):successful %d (%.2f%%), unsuccessful %d (%.2f%%) blocking %d \n", successful_nonblocking_acquires,
+           (nonblocking_acquires > 0 ? successful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0),
            unsuccessful_nonblocking_acquires,
-           (nonblocking_acquires > 0 ?
-            unsuccessful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0), blocking_acquires);
+           (nonblocking_acquires > 0 ? unsuccessful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0), blocking_acquires);
     fflush(stdout);
   } else {
     if (!(total_acquires % 100)) {
-      printf("Lock Stats (Alive):successful %d (%.2f%%), unsuccessful %d (%.2f%%) blocking %d \n",
-             successful_nonblocking_acquires,
-             (nonblocking_acquires > 0 ?
-              successful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0),
+      printf("Lock Stats (Alive):successful %d (%.2f%%), unsuccessful %d (%.2f%%) blocking %d \n", successful_nonblocking_acquires,
+             (nonblocking_acquires > 0 ? successful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0),
              unsuccessful_nonblocking_acquires,
-             (nonblocking_acquires > 0 ?
-              unsuccessful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0), blocking_acquires);
+             (nonblocking_acquires > 0 ? unsuccessful_nonblocking_acquires * 100.0 / nonblocking_acquires : 0.0),
+             blocking_acquires);
       fflush(stdout);
     }
   }
 }
-#endif //LOCK_CONTENTION_PROFILING
+#endif // LOCK_CONTENTION_PROFILING

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/PQ-List.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/PQ-List.cc b/iocore/eventsystem/PQ-List.cc
index 483b6b1..8d7944d 100644
--- a/iocore/eventsystem/PQ-List.cc
+++ b/iocore/eventsystem/PQ-List.cc
@@ -30,10 +30,10 @@ PriorityEventQueue::PriorityEventQueue()
 }
 
 void
-PriorityEventQueue::check_ready(ink_hrtime now, EThread * t)
+PriorityEventQueue::check_ready(ink_hrtime now, EThread *t)
 {
   int i, j, k = 0;
-  uint32_t check_buckets = (uint32_t) (now / PQ_BUCKET_TIME(0));
+  uint32_t check_buckets = (uint32_t)(now / PQ_BUCKET_TIME(0));
   uint32_t todo_buckets = check_buckets ^ last_check_buckets;
   last_check_time = now;
   last_check_buckets = check_buckets;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_EventSystem.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_EventSystem.h b/iocore/eventsystem/P_EventSystem.h
index d54e916..26f9680 100644
--- a/iocore/eventsystem/P_EventSystem.h
+++ b/iocore/eventsystem/P_EventSystem.h
@@ -45,10 +45,8 @@
 #include "P_ProtectedQueue.h"
 #include "P_UnixEventProcessor.h"
 #include "P_UnixSocketManager.h"
-#undef  EVENT_SYSTEM_MODULE_VERSION
-#define EVENT_SYSTEM_MODULE_VERSION makeModuleVersion(                    \
-                                       EVENT_SYSTEM_MODULE_MAJOR_VERSION, \
-                                       EVENT_SYSTEM_MODULE_MINOR_VERSION, \
-                                       PRIVATE_MODULE_HEADER)
+#undef EVENT_SYSTEM_MODULE_VERSION
+#define EVENT_SYSTEM_MODULE_VERSION \
+  makeModuleVersion(EVENT_SYSTEM_MODULE_MAJOR_VERSION, EVENT_SYSTEM_MODULE_MINOR_VERSION, PRIVATE_MODULE_HEADER)
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_Freer.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_Freer.h b/iocore/eventsystem/P_Freer.h
index 391f0ec..e3f29f7 100644
--- a/iocore/eventsystem/P_Freer.h
+++ b/iocore/eventsystem/P_Freer.h
@@ -31,75 +31,68 @@
 // NUMA socket affinity. We'll potentially return these on an arbitarily
 // selected processor/socket.
 
-template<class C> struct DeleterContinuation: public Continuation
-{
-public:                        // Needed by WinNT compiler (compiler bug)
-  C * p;
-  int dieEvent(int event, void *e)
+template <class C> struct DeleterContinuation : public Continuation {
+public: // Needed by WinNT compiler (compiler bug)
+  C *p;
+  int
+  dieEvent(int event, void *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     if (p)
       delete p;
     delete this;
-      return EVENT_DONE;
-  }
-  DeleterContinuation(C * ap):Continuation(new_ProxyMutex()), p(ap)
-  {
-    SET_HANDLER(&DeleterContinuation::dieEvent);
+    return EVENT_DONE;
   }
+  DeleterContinuation(C *ap) : Continuation(new_ProxyMutex()), p(ap) { SET_HANDLER(&DeleterContinuation::dieEvent); }
 };
 
-template<class C> TS_INLINE void
-new_Deleter(C * ap, ink_hrtime t)
+template <class C>
+TS_INLINE void
+new_Deleter(C *ap, ink_hrtime t)
 {
-  eventProcessor.schedule_in(new DeleterContinuation<C> (ap), t, ET_TASK);
+  eventProcessor.schedule_in(new DeleterContinuation<C>(ap), t, ET_TASK);
 }
 
-template<class C> struct FreeCallContinuation: public Continuation
-{
-public:                        // Needed by WinNT compiler (compiler bug)
-  C * p;
-  int dieEvent(int event, void *e)
+template <class C> struct FreeCallContinuation : public Continuation {
+public: // Needed by WinNT compiler (compiler bug)
+  C *p;
+  int
+  dieEvent(int event, void *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     p->free();
     delete this;
-      return EVENT_DONE;
-  }
-  FreeCallContinuation(C * ap):Continuation(NULL), p(ap)
-  {
-    SET_HANDLER(&FreeCallContinuation::dieEvent);
+    return EVENT_DONE;
   }
+  FreeCallContinuation(C *ap) : Continuation(NULL), p(ap) { SET_HANDLER(&FreeCallContinuation::dieEvent); }
 };
 
-template<class C> TS_INLINE void
-new_FreeCaller(C * ap, ink_hrtime t)
+template <class C>
+TS_INLINE void
+new_FreeCaller(C *ap, ink_hrtime t)
 {
-  eventProcessor.schedule_in(new FreeCallContinuation<C> (ap), t, ET_TASK);
+  eventProcessor.schedule_in(new FreeCallContinuation<C>(ap), t, ET_TASK);
 }
 
 struct FreerContinuation;
-typedef int (FreerContinuation::*FreerContHandler) (int, void *);
+typedef int (FreerContinuation::*FreerContHandler)(int, void *);
 
-struct FreerContinuation: public Continuation
-{
+struct FreerContinuation : public Continuation {
   void *p;
 
-  int dieEvent(int event, Event * e)
+  int
+  dieEvent(int event, Event *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     ats_free(p);
     delete this;
     return EVENT_DONE;
   }
 
-  FreerContinuation(void *ap):Continuation(NULL), p(ap)
-  {
-    SET_HANDLER((FreerContHandler) & FreerContinuation::dieEvent);
-  }
+  FreerContinuation(void *ap) : Continuation(NULL), p(ap) { SET_HANDLER((FreerContHandler)&FreerContinuation::dieEvent); }
 };
 
 TS_INLINE void
@@ -108,11 +101,11 @@ new_Freer(void *ap, ink_hrtime t)
   eventProcessor.schedule_in(new FreerContinuation(ap), t, ET_TASK);
 }
 
-template<class C> struct DereferContinuation: public Continuation
-{
+template <class C> struct DereferContinuation : public Continuation {
   C *p;
 
-  int dieEvent(int, Event *)
+  int
+  dieEvent(int, Event *)
   {
     p->refcount_dec();
     if (REF_COUNT_OBJ_REFCOUNT_DEC(p) == 0) {
@@ -123,16 +116,14 @@ template<class C> struct DereferContinuation: public Continuation
     return EVENT_DONE;
   }
 
-  DereferContinuation(C * ap):Continuation(NULL), p(ap)
-  {
-    SET_HANDLER(&DereferContinuation::dieEvent);
-  }
+  DereferContinuation(C *ap) : Continuation(NULL), p(ap) { SET_HANDLER(&DereferContinuation::dieEvent); }
 };
 
-template<class C> TS_INLINE void
-new_Derefer(C * ap, ink_hrtime t)
+template <class C>
+TS_INLINE void
+new_Derefer(C *ap, ink_hrtime t)
 {
-  eventProcessor.schedule_in(new DereferContinuation<C> (ap), t, ET_TASK);
+  eventProcessor.schedule_in(new DereferContinuation<C>(ap), t, ET_TASK);
 }
 
 #endif /* _Freer_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_IOBuffer.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_IOBuffer.h b/iocore/eventsystem/P_IOBuffer.h
index 0e0a7ab..3b8c323 100644
--- a/iocore/eventsystem/P_IOBuffer.h
+++ b/iocore/eventsystem/P_IOBuffer.h
@@ -22,8 +22,7 @@
  */
 
 
-
-#if !defined (_P_IOBuffer_h)
+#if !defined(_P_IOBuffer_h)
 #define _P_IOBuffer_h
 
 #include "libts.h"
@@ -72,9 +71,8 @@ index_to_buffer_size(int64_t idx)
 }
 
 TS_INLINE IOBufferBlock *
-iobufferblock_clone(IOBufferBlock * b, int64_t offset, int64_t len)
+iobufferblock_clone(IOBufferBlock *b, int64_t offset, int64_t len)
 {
-
   IOBufferBlock *start_buf = NULL;
   IOBufferBlock *current_buf = NULL;
 
@@ -109,7 +107,7 @@ iobufferblock_clone(IOBufferBlock * b, int64_t offset, int64_t len)
 }
 
 TS_INLINE IOBufferBlock *
-iobufferblock_skip(IOBufferBlock * b, int64_t *poffset, int64_t *plen, int64_t write)
+iobufferblock_skip(IOBufferBlock *b, int64_t *poffset, int64_t *plen, int64_t write)
 {
   int64_t offset = *poffset;
   int64_t len = write;
@@ -186,70 +184,69 @@ IOBufferData::block_size()
 TS_INLINE IOBufferData *
 new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                           const char *location,
+  const char *location,
 #endif
-                           void *b, int64_t size, int64_t asize_index)
+  void *b, int64_t size, int64_t asize_index)
 {
-  (void) size;
+  (void)size;
   IOBufferData *d = THREAD_ALLOC(ioDataAllocator, this_thread());
   d->_size_index = asize_index;
-  ink_assert(BUFFER_SIZE_INDEX_IS_CONSTANT(asize_index)
-             || size <= d->block_size());
+  ink_assert(BUFFER_SIZE_INDEX_IS_CONSTANT(asize_index) || size <= d->block_size());
 #ifdef TRACK_BUFFER_USER
   d->_location = location;
 #endif
-  d->_data = (char *) b;
+  d->_data = (char *)b;
   return d;
 }
 
 TS_INLINE IOBufferData *
 new_constant_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                                    const char *loc,
+  const char *loc,
 #endif
-                                    void *b, int64_t size)
+  void *b, int64_t size)
 {
   return new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                                    loc,
+    loc,
 #endif
-                                    b, size, BUFFER_SIZE_INDEX_FOR_CONSTANT_SIZE(size));
+    b, size, BUFFER_SIZE_INDEX_FOR_CONSTANT_SIZE(size));
 }
 
 TS_INLINE IOBufferData *
 new_xmalloc_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                                   const char *location,
+  const char *location,
 #endif
-                                   void *b, int64_t size)
+  void *b, int64_t size)
 {
   return new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                                    location,
+    location,
 #endif
-                                    b, size, BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(size));
+    b, size, BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(size));
 }
 
 TS_INLINE IOBufferData *
 new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                           const char *location,
+  const char *location,
 #endif
-                           void *b, int64_t size)
+  void *b, int64_t size)
 {
   return new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                                    location,
+    location,
 #endif
-                                    b, size, iobuffer_size_to_index(size));
+    b, size, iobuffer_size_to_index(size));
 }
 
 TS_INLINE IOBufferData *
 new_IOBufferData_internal(
 #ifdef TRACK_BUFFER_USER
-                           const char *loc,
+  const char *loc,
 #endif
-                           int64_t size_index, AllocType type)
+  int64_t size_index, AllocType type)
 {
   IOBufferData *d = THREAD_ALLOC(ioDataAllocator, this_thread());
 #ifdef TRACK_BUFFER_USER
@@ -276,7 +273,7 @@ IOBufferData::alloc(int64_t size_index, AllocType type)
   switch (type) {
   case MEMALIGNED:
     if (BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(size_index))
-      _data = (char *) ioBufAllocator[size_index].alloc_void();
+      _data = (char *)ioBufAllocator[size_index].alloc_void();
     // coverity[dead_error_condition]
     else if (BUFFER_SIZE_INDEX_IS_XMALLOCED(size_index))
       _data = (char *)ats_memalign(ats_pagesize(), index_to_buffer_size(size_index));
@@ -284,7 +281,7 @@ IOBufferData::alloc(int64_t size_index, AllocType type)
   default:
   case DEFAULT_ALLOC:
     if (BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(size_index))
-      _data = (char *) ioBufAllocator[size_index].alloc_void();
+      _data = (char *)ioBufAllocator[size_index].alloc_void();
     else if (BUFFER_SIZE_INDEX_IS_XMALLOCED(size_index))
       _data = (char *)ats_malloc(BUFFER_SIZE_FOR_XMALLOC(size_index));
     break;
@@ -305,7 +302,7 @@ IOBufferData::dealloc()
     if (BUFFER_SIZE_INDEX_IS_FAST_ALLOCATED(_size_index))
       ioBufAllocator[_size_index].free_void(_data);
     else if (BUFFER_SIZE_INDEX_IS_XMALLOCED(_size_index))
-      ::free((void *) _data);
+      ::free((void *)_data);
     break;
   default:
   case DEFAULT_ALLOC:
@@ -336,7 +333,7 @@ IOBufferData::free()
 TS_INLINE IOBufferBlock *
 new_IOBufferBlock_internal(
 #ifdef TRACK_BUFFER_USER
-                            const char *location
+  const char *location
 #endif
   )
 {
@@ -350,9 +347,9 @@ new_IOBufferBlock_internal(
 TS_INLINE IOBufferBlock *
 new_IOBufferBlock_internal(
 #ifdef TRACK_BUFFER_USER
-                            const char *location,
+  const char *location,
 #endif
-                            IOBufferData * d, int64_t len, int64_t offset)
+  IOBufferData *d, int64_t len, int64_t offset)
 {
   IOBufferBlock *b = THREAD_ALLOC(ioBlockAllocator, this_thread());
 #ifdef TRACK_BUFFER_USER
@@ -363,13 +360,11 @@ new_IOBufferBlock_internal(
 }
 
 TS_INLINE
-IOBufferBlock::IOBufferBlock():
-_start(0),
-_end(0),
-_buf_end(0)
+IOBufferBlock::IOBufferBlock()
+  : _start(0), _end(0), _buf_end(0)
 #ifdef TRACK_BUFFER_USER
-,
-_location(0)
+    ,
+    _location(0)
 #endif
 {
   return;
@@ -467,7 +462,7 @@ IOBufferBlock::set_internal(void *b, int64_t len, int64_t asize_index)
 #else
   data = new_IOBufferData_internal(BUFFER_SIZE_NOT_ALLOCATED);
 #endif
-  data->_data = (char *) b;
+  data->_data = (char *)b;
 #ifdef TRACK_BUFFER_USER
   iobuffer_mem_inc(_location, asize_index);
 #endif
@@ -477,7 +472,7 @@ IOBufferBlock::set_internal(void *b, int64_t len, int64_t asize_index)
 }
 
 TS_INLINE void
-IOBufferBlock::set(IOBufferData * d, int64_t len, int64_t offset)
+IOBufferBlock::set(IOBufferData *d, int64_t len, int64_t offset)
 {
   data = d;
   _start = buf() + offset;
@@ -588,7 +583,7 @@ IOBufferReader::block_read_avail()
   if (block == 0)
     return 0;
   skip_empty_blocks();
-  return (int64_t) (block->end() - (block->start() + start_offset));
+  return (int64_t)(block->end() - (block->start() + start_offset));
 }
 
 TS_INLINE int
@@ -624,7 +619,7 @@ inline bool
 IOBufferReader::is_read_avail_more_than(int64_t size)
 {
   int64_t t = -start_offset;
-  IOBufferBlock* b = block;
+  IOBufferBlock *b = block;
   while (b) {
     t += b->read_avail();
     if (t > size) {
@@ -655,14 +650,11 @@ IOBufferReader::consume(int64_t n)
   ink_assert(read_avail() >= 0);
 }
 
-TS_INLINE char &
-IOBufferReader::operator[] (int64_t i)
+TS_INLINE char &IOBufferReader::operator[](int64_t i)
 {
-  static char
-    _error = '\0';
+  static char _error = '\0';
 
-  IOBufferBlock *
-    b = block;
+  IOBufferBlock *b = block;
   i += start_offset;
   while (b) {
     int64_t bytes = b->read_avail();
@@ -751,18 +743,18 @@ MIOBuffer::MIOBuffer()
 }
 
 TS_INLINE
-MIOBuffer::~
-MIOBuffer()
+MIOBuffer::~MIOBuffer()
 {
   _writer = NULL;
   dealloc_all_readers();
 }
 
-TS_INLINE MIOBuffer * new_MIOBuffer_internal(
+TS_INLINE MIOBuffer *
+new_MIOBuffer_internal(
 #ifdef TRACK_BUFFER_USER
-                                               const char *location,
+  const char *location,
 #endif
-                                               int64_t size_index)
+  int64_t size_index)
 {
   MIOBuffer *b = THREAD_ALLOC(ioAllocator, this_thread());
 #ifdef TRACK_BUFFER_USER
@@ -773,18 +765,19 @@ TS_INLINE MIOBuffer * new_MIOBuffer_internal(
 }
 
 TS_INLINE void
-free_MIOBuffer(MIOBuffer * mio)
+free_MIOBuffer(MIOBuffer *mio)
 {
   mio->_writer = NULL;
   mio->dealloc_all_readers();
   THREAD_FREE(mio, ioAllocator, this_thread());
 }
 
-TS_INLINE MIOBuffer * new_empty_MIOBuffer_internal(
+TS_INLINE MIOBuffer *
+new_empty_MIOBuffer_internal(
 #ifdef TRACK_BUFFER_USER
-                                                     const char *location,
+  const char *location,
 #endif
-                                                     int64_t size_index)
+  int64_t size_index)
 {
   MIOBuffer *b = THREAD_ALLOC(ioAllocator, this_thread());
   b->size_index = size_index;
@@ -795,13 +788,13 @@ TS_INLINE MIOBuffer * new_empty_MIOBuffer_internal(
 }
 
 TS_INLINE void
-free_empty_MIOBuffer(MIOBuffer * mio)
+free_empty_MIOBuffer(MIOBuffer *mio)
 {
   THREAD_FREE(mio, ioAllocator, this_thread());
 }
 
 TS_INLINE IOBufferReader *
-MIOBuffer::alloc_accessor(MIOBufferAccessor * anAccessor)
+MIOBuffer::alloc_accessor(MIOBufferAccessor *anAccessor)
 {
   int i;
   for (i = 0; i < MAX_MIOBUFFER_READERS; i++)
@@ -844,7 +837,7 @@ MIOBuffer::block_size()
   return index_to_buffer_size(size_index);
 }
 TS_INLINE IOBufferReader *
-MIOBuffer::clone_reader(IOBufferReader * r)
+MIOBuffer::clone_reader(IOBufferReader *r)
 {
   int i;
   for (i = 0; i < MAX_MIOBUFFER_READERS; i++)
@@ -888,7 +881,7 @@ MIOBuffer::block_write_avail()
 //
 ////////////////////////////////////////////////////////////////
 TS_INLINE void
-MIOBuffer::append_block_internal(IOBufferBlock * b)
+MIOBuffer::append_block_internal(IOBufferBlock *b)
 {
   // It would be nice to remove an empty buffer at the beginning,
   // but this breaks HTTP.
@@ -911,7 +904,7 @@ MIOBuffer::append_block_internal(IOBufferBlock * b)
 }
 
 TS_INLINE void
-MIOBuffer::append_block(IOBufferBlock * b)
+MIOBuffer::append_block(IOBufferBlock *b)
 {
   ink_assert(b->read_avail());
   append_block_internal(b);
@@ -1113,7 +1106,7 @@ MIOBuffer::alloc_xmalloc(int64_t buf_size)
 }
 
 TS_INLINE void
-MIOBuffer::dealloc_reader(IOBufferReader * e)
+MIOBuffer::dealloc_reader(IOBufferReader *e)
 {
   if (e->accessor) {
     ink_assert(e->accessor->writer() == this);
@@ -1150,7 +1143,7 @@ MIOBuffer::set_size_index(int64_t size)
 }
 
 TS_INLINE void
-MIOBufferAccessor::reader_for(MIOBuffer * abuf)
+MIOBufferAccessor::reader_for(MIOBuffer *abuf)
 {
   mbuf = abuf;
   if (abuf)
@@ -1160,7 +1153,7 @@ MIOBufferAccessor::reader_for(MIOBuffer * abuf)
 }
 
 TS_INLINE void
-MIOBufferAccessor::reader_for(IOBufferReader * areader)
+MIOBufferAccessor::reader_for(IOBufferReader *areader)
 {
   if (entry == areader)
     return;
@@ -1170,15 +1163,14 @@ MIOBufferAccessor::reader_for(IOBufferReader * areader)
 }
 
 TS_INLINE void
-MIOBufferAccessor::writer_for(MIOBuffer * abuf)
+MIOBufferAccessor::writer_for(MIOBuffer *abuf)
 {
   mbuf = abuf;
   entry = NULL;
 }
 
 TS_INLINE
-MIOBufferAccessor::~
-MIOBufferAccessor()
+MIOBufferAccessor::~MIOBufferAccessor()
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_ProtectedQueue.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_ProtectedQueue.h b/iocore/eventsystem/P_ProtectedQueue.h
index aa6720b..93eca04 100644
--- a/iocore/eventsystem/P_ProtectedQueue.h
+++ b/iocore/eventsystem/P_ProtectedQueue.h
@@ -38,7 +38,7 @@ ProtectedQueue::ProtectedQueue()
 {
   Event e;
   ink_mutex_init(&lock, "ProtectedQueue");
-  ink_atomiclist_init(&al, "ProtectedQueue", (char *) &e.link.next - (char *) &e);
+  ink_atomiclist_init(&al, "ProtectedQueue", (char *)&e.link.next - (char *)&e);
   ink_cond_init(&might_have_data);
 }
 
@@ -66,7 +66,7 @@ ProtectedQueue::try_signal()
 
 // Called from the same thread (don't need to signal)
 TS_INLINE void
-ProtectedQueue::enqueue_local(Event * e)
+ProtectedQueue::enqueue_local(Event *e)
 {
   ink_assert(!e->in_the_prot_queue && !e->in_the_priority_queue);
   e->in_the_prot_queue = 1;
@@ -74,7 +74,7 @@ ProtectedQueue::enqueue_local(Event * e)
 }
 
 TS_INLINE void
-ProtectedQueue::remove(Event * e)
+ProtectedQueue::remove(Event *e)
 {
   ink_assert(e->in_the_prot_queue);
   if (!ink_atomiclist_remove(&al, e))

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_Thread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_Thread.h b/iocore/eventsystem/P_Thread.h
index 780fcfe..04c111d 100644
--- a/iocore/eventsystem/P_Thread.h
+++ b/iocore/eventsystem/P_Thread.h
@@ -33,12 +33,11 @@
 
 #include "I_Thread.h"
 
-  ///////////////////////////////////////////////
-  // Common Interface impl                     //
-  ///////////////////////////////////////////////
+///////////////////////////////////////////////
+// Common Interface impl                     //
+///////////////////////////////////////////////
 TS_INLINE
-Thread::~
-Thread()
+Thread::~Thread()
 {
 }
 
@@ -51,7 +50,7 @@ Thread::set_specific()
 TS_INLINE Thread *
 this_thread()
 {
-  return (Thread *) ink_thread_getspecific(Thread::thread_data_key);
+  return (Thread *)ink_thread_getspecific(Thread::thread_data_key);
 }
 
 TS_INLINE ink_hrtime

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_UnixEThread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_UnixEThread.h b/iocore/eventsystem/P_UnixEThread.h
index 462de69..19afaa4 100644
--- a/iocore/eventsystem/P_UnixEThread.h
+++ b/iocore/eventsystem/P_UnixEThread.h
@@ -37,59 +37,59 @@
 const int DELAY_FOR_RETRY = HRTIME_MSECONDS(10);
 
 TS_INLINE Event *
-EThread::schedule_spawn(Continuation * cont)
+EThread::schedule_spawn(Continuation *cont)
 {
   Event *e = EVENT_ALLOC(eventAllocator, this);
   return schedule(e->init(cont, 0, 0));
 }
 
 TS_INLINE Event *
-EThread::schedule_imm(Continuation * cont, int callback_event, void *cookie)
+EThread::schedule_imm(Continuation *cont, int callback_event, void *cookie)
 {
-  Event *e =::eventAllocator.alloc();
+  Event *e = ::eventAllocator.alloc();
   e->callback_event = callback_event;
   e->cookie = cookie;
   return schedule(e->init(cont, 0, 0));
 }
 
 TS_INLINE Event *
-EThread::schedule_imm_signal(Continuation * cont, int callback_event, void *cookie)
+EThread::schedule_imm_signal(Continuation *cont, int callback_event, void *cookie)
 {
-  Event *e =::eventAllocator.alloc();
+  Event *e = ::eventAllocator.alloc();
   e->callback_event = callback_event;
   e->cookie = cookie;
   return schedule(e->init(cont, 0, 0), true);
 }
 
 TS_INLINE Event *
-EThread::schedule_at(Continuation * cont, ink_hrtime t, int callback_event, void *cookie)
+EThread::schedule_at(Continuation *cont, ink_hrtime t, int callback_event, void *cookie)
 {
-  Event *e =::eventAllocator.alloc();
+  Event *e = ::eventAllocator.alloc();
   e->callback_event = callback_event;
   e->cookie = cookie;
   return schedule(e->init(cont, t, 0));
 }
 
 TS_INLINE Event *
-EThread::schedule_in(Continuation * cont, ink_hrtime t, int callback_event, void *cookie)
+EThread::schedule_in(Continuation *cont, ink_hrtime t, int callback_event, void *cookie)
 {
-  Event *e =::eventAllocator.alloc();
+  Event *e = ::eventAllocator.alloc();
   e->callback_event = callback_event;
   e->cookie = cookie;
   return schedule(e->init(cont, ink_get_based_hrtime() + t, 0));
 }
 
 TS_INLINE Event *
-EThread::schedule_every(Continuation * cont, ink_hrtime t, int callback_event, void *cookie)
+EThread::schedule_every(Continuation *cont, ink_hrtime t, int callback_event, void *cookie)
 {
-  Event *e =::eventAllocator.alloc();
+  Event *e = ::eventAllocator.alloc();
   e->callback_event = callback_event;
   e->cookie = cookie;
   return schedule(e->init(cont, ink_get_based_hrtime() + t, t));
 }
 
 TS_INLINE Event *
-EThread::schedule(Event * e, bool fast_signal)
+EThread::schedule(Event *e, bool fast_signal)
 {
   e->ethread = this;
   ink_assert(tt == REGULAR);
@@ -103,7 +103,7 @@ EThread::schedule(Event * e, bool fast_signal)
 }
 
 TS_INLINE Event *
-EThread::schedule_imm_local(Continuation * cont, int callback_event, void *cookie)
+EThread::schedule_imm_local(Continuation *cont, int callback_event, void *cookie)
 {
   Event *e = EVENT_ALLOC(eventAllocator, this);
   e->callback_event = callback_event;
@@ -112,7 +112,7 @@ EThread::schedule_imm_local(Continuation * cont, int callback_event, void *cooki
 }
 
 TS_INLINE Event *
-EThread::schedule_at_local(Continuation * cont, ink_hrtime t, int callback_event, void *cookie)
+EThread::schedule_at_local(Continuation *cont, ink_hrtime t, int callback_event, void *cookie)
 {
   Event *e = EVENT_ALLOC(eventAllocator, this);
   e->callback_event = callback_event;
@@ -121,7 +121,7 @@ EThread::schedule_at_local(Continuation * cont, ink_hrtime t, int callback_event
 }
 
 TS_INLINE Event *
-EThread::schedule_in_local(Continuation * cont, ink_hrtime t, int callback_event, void *cookie)
+EThread::schedule_in_local(Continuation *cont, ink_hrtime t, int callback_event, void *cookie)
 {
   Event *e = EVENT_ALLOC(eventAllocator, this);
   e->callback_event = callback_event;
@@ -130,7 +130,7 @@ EThread::schedule_in_local(Continuation * cont, ink_hrtime t, int callback_event
 }
 
 TS_INLINE Event *
-EThread::schedule_every_local(Continuation * cont, ink_hrtime t, int callback_event, void *cookie)
+EThread::schedule_every_local(Continuation *cont, ink_hrtime t, int callback_event, void *cookie)
 {
   Event *e = EVENT_ALLOC(eventAllocator, this);
   e->callback_event = callback_event;
@@ -139,7 +139,7 @@ EThread::schedule_every_local(Continuation * cont, ink_hrtime t, int callback_ev
 }
 
 TS_INLINE Event *
-EThread::schedule_local(Event * e)
+EThread::schedule_local(Event *e)
 {
   if (tt != REGULAR) {
     ink_assert(tt == DEDICATED);
@@ -159,11 +159,11 @@ EThread::schedule_local(Event * e)
 TS_INLINE EThread *
 this_ethread()
 {
-  return (EThread *) this_thread();
+  return (EThread *)this_thread();
 }
 
 TS_INLINE void
-EThread::free_event(Event * e)
+EThread::free_event(Event *e)
 {
   ink_assert(!e->in_the_priority_queue && !e->in_the_prot_queue);
   e->mutex = NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_UnixEvent.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_UnixEvent.h b/iocore/eventsystem/P_UnixEvent.h
index 54469a9..a224443 100644
--- a/iocore/eventsystem/P_UnixEvent.h
+++ b/iocore/eventsystem/P_UnixEvent.h
@@ -25,7 +25,7 @@
 #define _P_UnixEvent_h_
 
 TS_INLINE Event *
-Event::init(Continuation * c, ink_hrtime atimeout_at, ink_hrtime aperiod)
+Event::init(Continuation *c, ink_hrtime atimeout_at, ink_hrtime aperiod)
 {
   continuation = c;
   timeout_at = atimeout_at;
@@ -43,15 +43,9 @@ Event::free()
 }
 
 TS_INLINE
-Event::Event():
-  ethread(0),
-  in_the_prot_queue(false),
-  in_the_priority_queue(false),
-  immediate(false),
-  globally_allocated(true),
-  in_heap(false),
-  timeout_at(0),
-  period(0)
+Event::Event()
+  : ethread(0), in_the_prot_queue(false), in_the_priority_queue(false), immediate(false), globally_allocated(true), in_heap(false),
+    timeout_at(0), period(0)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_UnixEventProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_UnixEventProcessor.h b/iocore/eventsystem/P_UnixEventProcessor.h
index d9a1e73..132c977 100644
--- a/iocore/eventsystem/P_UnixEventProcessor.h
+++ b/iocore/eventsystem/P_UnixEventProcessor.h
@@ -29,11 +29,7 @@ const int LOAD_BALANCE_INTERVAL = 1;
 
 
 TS_INLINE
-EventProcessor::EventProcessor():
-n_ethreads(0),
-n_thread_groups(0),
-n_dthreads(0),
-thread_data_used(0)
+EventProcessor::EventProcessor() : n_ethreads(0), n_thread_groups(0), n_dthreads(0), thread_data_used(0)
 {
   memset(all_ethreads, 0, sizeof(all_ethreads));
   memset(all_dthreads, 0, sizeof(all_dthreads));
@@ -46,7 +42,7 @@ EventProcessor::allocate(int size)
 {
   static off_t start = INK_ALIGN(offsetof(EThread, thread_private), 16);
   static off_t loss = start - offsetof(EThread, thread_private);
-  size = INK_ALIGN(size, 16);       // 16 byte alignment
+  size = INK_ALIGN(size, 16); // 16 byte alignment
 
   int old;
   do {
@@ -55,7 +51,7 @@ EventProcessor::allocate(int size)
       return -1;
   } while (!ink_atomic_cas(&thread_data_used, old, old + size));
 
-  return (off_t) (old + start);
+  return (off_t)(old + start);
 }
 
 TS_INLINE EThread *
@@ -72,7 +68,7 @@ EventProcessor::assign_thread(EventType etype)
 }
 
 TS_INLINE Event *
-EventProcessor::schedule(Event * e, EventType etype, bool fast_signal)
+EventProcessor::schedule(Event *e, EventType etype, bool fast_signal)
 {
   ink_assert(etype < MAX_EVENT_TYPES);
   e->ethread = assign_thread(etype);
@@ -86,7 +82,7 @@ EventProcessor::schedule(Event * e, EventType etype, bool fast_signal)
 
 
 TS_INLINE Event *
-EventProcessor::schedule_imm_signal(Continuation * cont, EventType et, int callback_event, void *cookie)
+EventProcessor::schedule_imm_signal(Continuation *cont, EventType et, int callback_event, void *cookie)
 {
   Event *e = eventAllocator.alloc();
 
@@ -100,7 +96,7 @@ EventProcessor::schedule_imm_signal(Continuation * cont, EventType et, int callb
 }
 
 TS_INLINE Event *
-EventProcessor::schedule_imm(Continuation * cont, EventType et, int callback_event, void *cookie)
+EventProcessor::schedule_imm(Continuation *cont, EventType et, int callback_event, void *cookie)
 {
   Event *e = eventAllocator.alloc();
 
@@ -114,7 +110,7 @@ EventProcessor::schedule_imm(Continuation * cont, EventType et, int callback_eve
 }
 
 TS_INLINE Event *
-EventProcessor::schedule_at(Continuation * cont, ink_hrtime t, EventType et, int callback_event, void *cookie)
+EventProcessor::schedule_at(Continuation *cont, ink_hrtime t, EventType et, int callback_event, void *cookie)
 {
   Event *e = eventAllocator.alloc();
 
@@ -126,7 +122,7 @@ EventProcessor::schedule_at(Continuation * cont, ink_hrtime t, EventType et, int
 }
 
 TS_INLINE Event *
-EventProcessor::schedule_in(Continuation * cont, ink_hrtime t, EventType et, int callback_event, void *cookie)
+EventProcessor::schedule_in(Continuation *cont, ink_hrtime t, EventType et, int callback_event, void *cookie)
 {
   Event *e = eventAllocator.alloc();
 
@@ -137,7 +133,7 @@ EventProcessor::schedule_in(Continuation * cont, ink_hrtime t, EventType et, int
 }
 
 TS_INLINE Event *
-EventProcessor::schedule_every(Continuation * cont, ink_hrtime t, EventType et, int callback_event, void *cookie)
+EventProcessor::schedule_every(Continuation *cont, ink_hrtime t, EventType et, int callback_event, void *cookie)
 {
   Event *e = eventAllocator.alloc();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_UnixSocketManager.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_UnixSocketManager.h b/iocore/eventsystem/P_UnixSocketManager.h
index e1976eb..280bd61 100644
--- a/iocore/eventsystem/P_UnixSocketManager.h
+++ b/iocore/eventsystem/P_UnixSocketManager.h
@@ -40,7 +40,7 @@
 // These limits are currently disabled
 //
 // 1024 - stdin, stderr, stdout
-#define EPOLL_MAX_DESCRIPTOR_SIZE                32768
+#define EPOLL_MAX_DESCRIPTOR_SIZE 32768
 
 TS_INLINE bool
 transient_error()
@@ -64,7 +64,7 @@ SocketManager::accept(int s, struct sockaddr *addr, socklen_t *addrlen)
 {
   int r;
   do {
-    r =::accept(s, addr, addrlen);
+    r = ::accept(s, addr, addrlen);
     if (likely(r >= 0))
       break;
     r = -errno;
@@ -78,7 +78,7 @@ SocketManager::open(const char *path, int oflag, mode_t mode)
 {
   int s;
   do {
-    s =::open(path, oflag, mode);
+    s = ::open(path, oflag, mode);
     if (likely(s >= 0))
       break;
     s = -errno;
@@ -91,7 +91,7 @@ SocketManager::read(int fd, void *buf, int size, void * /* pOLP ATS_UNUSED */)
 {
   int64_t r;
   do {
-    r =::read(fd, buf, size);
+    r = ::read(fd, buf, size);
     if (likely(r >= 0))
       break;
     r = -errno;
@@ -104,7 +104,7 @@ SocketManager::pread(int fd, void *buf, int size, off_t offset, char * /* tag AT
 {
   int64_t r;
   do {
-    r =::pread(fd, buf, size, offset);
+    r = ::pread(fd, buf, size, offset);
     if (r < 0)
       r = -errno;
   } while (r == -EINTR);
@@ -117,7 +117,7 @@ SocketManager::readv(int fd, struct iovec *vector, size_t count)
   int64_t r;
   do {
     // coverity[tainted_data_argument]
-    if (likely((r =::readv(fd, vector, count)) >= 0))
+    if (likely((r = ::readv(fd, vector, count)) >= 0))
       break;
     r = -errno;
   } while (transient_error());
@@ -135,8 +135,8 @@ SocketManager::vector_io(int fd, struct iovec *vector, size_t count, int read_re
   int current_count;
   int64_t current_request_bytes;
 
-  for (n_vec = 0; n_vec < (int) count; n_vec += max_iovecs_per_request) {
-    current_count = min(max_iovecs_per_request, ((int) (count - n_vec)));
+  for (n_vec = 0; n_vec < (int)count; n_vec += max_iovecs_per_request) {
+    current_count = min(max_iovecs_per_request, ((int)(count - n_vec)));
     do {
       // coverity[tainted_data_argument]
       r = read_request ? ::readv(fd, &vector[n_vec], current_count) : ::writev(fd, &vector[n_vec], current_count);
@@ -150,7 +150,7 @@ SocketManager::vector_io(int fd, struct iovec *vector, size_t count, int read_re
     }
     bytes_xfered += r;
 
-    if ((n_vec + max_iovecs_per_request) >= (int) count)
+    if ((n_vec + max_iovecs_per_request) >= (int)count)
       break;
 
     // Compute bytes in current vector
@@ -176,7 +176,7 @@ SocketManager::recv(int fd, void *buf, int size, int flags)
 {
   int r;
   do {
-    if (unlikely((r =::recv(fd, (char *) buf, size, flags)) < 0)) {
+    if (unlikely((r = ::recv(fd, (char *)buf, size, flags)) < 0)) {
       r = -errno;
     }
   } while (r == -EINTR);
@@ -188,7 +188,7 @@ SocketManager::recvfrom(int fd, void *buf, int size, int flags, struct sockaddr
 {
   int r;
   do {
-    r =::recvfrom(fd, (char *) buf, size, flags, addr, addrlen);
+    r = ::recvfrom(fd, (char *)buf, size, flags, addr, addrlen);
     if (unlikely(r < 0))
       r = -errno;
   } while (r == -EINTR);
@@ -200,7 +200,7 @@ SocketManager::write(int fd, void *buf, int size, void * /* pOLP ATS_UNUSED */)
 {
   int64_t r;
   do {
-    if (likely((r =::write(fd, buf, size)) >= 0))
+    if (likely((r = ::write(fd, buf, size)) >= 0))
       break;
     r = -errno;
   } while (r == -EINTR);
@@ -212,7 +212,7 @@ SocketManager::pwrite(int fd, void *buf, int size, off_t offset, char * /* tag A
 {
   int64_t r;
   do {
-    if (unlikely((r =::pwrite(fd, buf, size, offset)) < 0))
+    if (unlikely((r = ::pwrite(fd, buf, size, offset)) < 0))
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -223,7 +223,7 @@ SocketManager::writev(int fd, struct iovec *vector, size_t count)
 {
   int64_t r;
   do {
-    if (likely((r =::writev(fd, vector, count)) >= 0))
+    if (likely((r = ::writev(fd, vector, count)) >= 0))
       break;
     r = -errno;
   } while (transient_error());
@@ -242,18 +242,18 @@ SocketManager::send(int fd, void *buf, int size, int flags)
 {
   int r;
   do {
-    if (unlikely((r =::send(fd, (char *) buf, size, flags)) < 0))
+    if (unlikely((r = ::send(fd, (char *)buf, size, flags)) < 0))
       r = -errno;
   } while (r == -EINTR);
   return r;
 }
 
 TS_INLINE int
-SocketManager::sendto(int fd, void *buf, int len, int flags, struct sockaddr const* to, int tolen)
+SocketManager::sendto(int fd, void *buf, int len, int flags, struct sockaddr const *to, int tolen)
 {
   int r;
   do {
-    if (unlikely((r =::sendto(fd, (char *) buf, len, flags, to, tolen)) < 0))
+    if (unlikely((r = ::sendto(fd, (char *)buf, len, flags, to, tolen)) < 0))
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -264,7 +264,7 @@ SocketManager::sendmsg(int fd, struct msghdr *m, int flags, void * /* pOLP ATS_U
 {
   int r;
   do {
-    if (unlikely((r =::sendmsg(fd, m, flags)) < 0))
+    if (unlikely((r = ::sendmsg(fd, m, flags)) < 0))
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -275,7 +275,7 @@ SocketManager::lseek(int fd, off_t offset, int whence)
 {
   int64_t r;
   do {
-    if ((r =::lseek(fd, offset, whence)) < 0)
+    if ((r = ::lseek(fd, offset, whence)) < 0)
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -286,7 +286,7 @@ SocketManager::fstat(int fd, struct stat *buf)
 {
   int r;
   do {
-    if ((r =::fstat(fd, buf)) >= 0)
+    if ((r = ::fstat(fd, buf)) >= 0)
       break;
     r = -errno;
   } while (transient_error());
@@ -298,7 +298,7 @@ SocketManager::unlink(char *buf)
 {
   int r;
   do {
-    if ((r =::unlink(buf)) < 0)
+    if ((r = ::unlink(buf)) < 0)
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -309,7 +309,7 @@ SocketManager::fsync(int fildes)
 {
   int r;
   do {
-    if ((r =::fsync(fildes)) < 0)
+    if ((r = ::fsync(fildes)) < 0)
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -320,7 +320,7 @@ SocketManager::ftruncate(int fildes, off_t length)
 {
   int r;
   do {
-    if ((r =::ftruncate(fildes, length)) < 0)
+    if ((r = ::ftruncate(fildes, length)) < 0)
       r = -errno;
   } while (r == -EINTR);
   return r;
@@ -331,7 +331,7 @@ SocketManager::poll(struct pollfd *fds, unsigned long nfds, int timeout)
 {
   int r;
   do {
-    if ((r =::poll(fds, nfds, timeout)) >= 0)
+    if ((r = ::poll(fds, nfds, timeout)) >= 0)
       break;
     r = -errno;
   } while (transient_error());
@@ -346,7 +346,7 @@ SocketManager::epoll_create(int size)
   if (size <= 0)
     size = EPOLL_MAX_DESCRIPTOR_SIZE;
   do {
-    if (likely((r =::epoll_create(size)) >= 0))
+    if (likely((r = ::epoll_create(size)) >= 0))
       break;
     r = -errno;
   } while (errno == -EINTR);
@@ -359,7 +359,7 @@ SocketManager::epoll_close(int epfd)
   int r = 0;
   if (likely(epfd >= 0)) {
     do {
-      if (likely((r =::close(epfd)) == 0))
+      if (likely((r = ::close(epfd)) == 0))
         break;
       r = -errno;
     } while (errno == -EINTR);
@@ -372,7 +372,7 @@ SocketManager::epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
 {
   int r;
   do {
-    if (likely((r =::epoll_ctl(epfd, op, fd, event)) == 0))
+    if (likely((r = ::epoll_ctl(epfd, op, fd, event)) == 0))
       break;
     r = -errno;
   } while (errno == -EINTR);
@@ -384,7 +384,7 @@ SocketManager::epoll_wait(int epfd, struct epoll_event *events, int maxevents, i
 {
   int r;
   do {
-    if ((r =::epoll_wait(epfd, events, maxevents, timeout)) >= 0)
+    if ((r = ::epoll_wait(epfd, events, maxevents, timeout)) >= 0)
       break;
     r = -errno;
   } while (errno == -EINTR);
@@ -401,16 +401,14 @@ SocketManager::kqueue()
 }
 
 TS_INLINE int
-SocketManager::kevent(int kq, const struct kevent *changelist, int nchanges,
-                      struct kevent *eventlist, int nevents,
+SocketManager::kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents,
                       const struct timespec *timeout)
 {
   int r;
   do {
-    r =::kevent(kq, changelist, nchanges,
-                eventlist, nevents, timeout);
+    r = ::kevent(kq, changelist, nchanges, eventlist, nevents, timeout);
     if (likely(r >= 0)) {
-        break;
+      break;
     }
     r = -errno;
   } while (errno == -EINTR);
@@ -426,12 +424,11 @@ SocketManager::port_create()
 }
 
 TS_INLINE int
-SocketManager::port_associate(int port, int source, uintptr_t obj,
-                              int events, void *user)
+SocketManager::port_associate(int port, int source, uintptr_t obj, int events, void *user)
 {
   int r;
-  r =::port_associate(port, source, obj, events, user);
-  if(r < 0)
+  r = ::port_associate(port, source, obj, events, user);
+  if (r < 0)
     r = -errno;
   return r;
 }
@@ -440,22 +437,21 @@ TS_INLINE int
 SocketManager::port_dissociate(int port, int source, uintptr_t obj)
 {
   int r;
-  r =::port_dissociate(port, source, obj);
-  if(r < 0)
+  r = ::port_dissociate(port, source, obj);
+  if (r < 0)
     r = -errno;
   return r;
 }
 
 TS_INLINE int
-SocketManager::port_getn(int port, port_event_t *list, uint_t max,
-                         uint_t *nget, timespec_t *timeout)
+SocketManager::port_getn(int port, port_event_t *list, uint_t max, uint_t *nget, timespec_t *timeout)
 {
   int r;
   do {
-    if ((r =::port_getn(port, list, max, nget, timeout)) >= 0)
+    if ((r = ::port_getn(port, list, max, nget, timeout)) >= 0)
       break;
     r = -errno;
-  } while (errno == -EINTR); //TODO: possible EAGAIN(undocumented)
+  } while (errno == -EINTR); // TODO: possible EAGAIN(undocumented)
   return r;
 }
 #endif /* TS_USE_PORT */
@@ -468,7 +464,7 @@ SocketManager::get_sndbuf_size(int s)
   int bszsz, r;
 
   bszsz = sizeof(bsz);
-  r = safe_getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &bsz, &bszsz);
+  r = safe_getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&bsz, &bszsz);
   return (r == 0 ? bsz : r);
 }
 
@@ -479,32 +475,32 @@ SocketManager::get_rcvbuf_size(int s)
   int bszsz, r;
 
   bszsz = sizeof(bsz);
-  r = safe_getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &bsz, &bszsz);
+  r = safe_getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&bsz, &bszsz);
   return (r == 0 ? bsz : r);
 }
 
 TS_INLINE int
 SocketManager::set_sndbuf_size(int s, int bsz)
 {
-  return safe_setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &bsz, sizeof(bsz));
+  return safe_setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&bsz, sizeof(bsz));
 }
 
 TS_INLINE int
 SocketManager::set_rcvbuf_size(int s, int bsz)
 {
-  return safe_setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &bsz, sizeof(bsz));
+  return safe_setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&bsz, sizeof(bsz));
 }
 
 TS_INLINE int
 SocketManager::getsockname(int s, struct sockaddr *sa, socklen_t *sz)
 {
-  return::getsockname(s, sa, sz);
+  return ::getsockname(s, sa, sz);
 }
 
 TS_INLINE int
 SocketManager::socket(int domain, int type, int protocol, bool /* bNonBlocking ATS_UNUSED */)
 {
-  return::socket(domain, type, protocol);
+  return ::socket(domain, type, protocol);
 }
 
 TS_INLINE int
@@ -518,7 +514,7 @@ SocketManager::shutdown(int s, int how)
 {
   int res;
   do {
-    if (unlikely((res =::shutdown(s, how)) < 0))
+    if (unlikely((res = ::shutdown(s, how)) < 0))
       res = -errno;
   } while (res == -EINTR);
   return res;
@@ -529,7 +525,7 @@ SocketManager::lockf(int s, int f, off_t size)
 {
   int res;
   do {
-    if ((res =::lockf(s, f, size)) < 0)
+    if ((res = ::lockf(s, f, size)) < 0)
       res = -errno;
   } while (res == -EINTR);
   return res;
@@ -540,7 +536,7 @@ SocketManager::dup(int s)
 {
   int res;
   do {
-    if ((res =::dup(s)) >= 0)
+    if ((res = ::dup(s)) >= 0)
       break;
     res = -errno;
   } while (res == -EINTR);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_VConnection.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_VConnection.h b/iocore/eventsystem/P_VConnection.h
index 89945c1..ec7b773 100644
--- a/iocore/eventsystem/P_VConnection.h
+++ b/iocore/eventsystem/P_VConnection.h
@@ -22,7 +22,7 @@
  */
 
 
-#if !defined (P_VConnection_h)
+#if !defined(P_VConnection_h)
 #define P_VConnection_h
 #include "I_EventSystem.h"
 
@@ -57,17 +57,13 @@ get_vc_event_name(int event)
 
 
 TS_INLINE
-VConnection::VConnection(ProxyMutex * aMutex)
-  :
-Continuation(aMutex),
-lerrno(0)
+VConnection::VConnection(ProxyMutex *aMutex) : Continuation(aMutex), lerrno(0)
 {
   SET_HANDLER(0);
 }
 
 TS_INLINE
-VConnection::~
-VConnection()
+VConnection::~VConnection()
 {
 }
 
@@ -84,7 +80,7 @@ VConnection()
 //////////////////////////////////////////////////////////////////////////////
 
 TS_INLINE VIO *
-vc_do_io_write(VConnection * vc, Continuation * cont, int64_t nbytes, MIOBuffer * buf, int64_t offset)
+vc_do_io_write(VConnection *vc, Continuation *cont, int64_t nbytes, MIOBuffer *buf, int64_t offset)
 {
   IOBufferReader *reader = buf->alloc_reader();
 
@@ -95,7 +91,7 @@ vc_do_io_write(VConnection * vc, Continuation * cont, int64_t nbytes, MIOBuffer
 }
 
 TS_INLINE VIO *
-VConnection::do_io(int op, Continuation * c, int64_t nbytes, MIOBuffer * cb, int data)
+VConnection::do_io(int op, Continuation *c, int64_t nbytes, MIOBuffer *cb, int data)
 {
   switch (op) {
   case VIO::READ:
@@ -131,7 +127,7 @@ VConnection::reenable(VIO *)
 {
 }
 TS_INLINE void
-VConnection::reenable_re(VIO * vio)
+VConnection::reenable_re(VIO *vio)
 {
   reenable(vio);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/P_VIO.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_VIO.h b/iocore/eventsystem/P_VIO.h
index 39d88b2..eb622c1 100644
--- a/iocore/eventsystem/P_VIO.h
+++ b/iocore/eventsystem/P_VIO.h
@@ -22,20 +22,14 @@
  */
 
 
-#if !defined ( P_VIO_h)
-#define  P_VIO_h
+#if !defined(P_VIO_h)
+#define P_VIO_h
 #include "I_VIO.h"
 
 TS_INLINE
-VIO::VIO(int aop)
-  :_cont(NULL),
-   nbytes(0),
-   ndone(0),
-   op(aop),
-   buffer(),
-   vc_server(0),
-   mutex(0)
-{ }
+VIO::VIO(int aop) : _cont(NULL), nbytes(0), ndone(0), op(aop), buffer(), vc_server(0), mutex(0)
+{
+}
 
 /////////////////////////////////////////////////////////////
 //
@@ -43,15 +37,9 @@ VIO::VIO(int aop)
 //
 /////////////////////////////////////////////////////////////
 TS_INLINE
-VIO::VIO()
-  :_cont(0),
-   nbytes(0),
-   ndone(0),
-   op(VIO::NONE),
-   buffer(),
-   vc_server(0),
-   mutex(0)
-{ }
+VIO::VIO() : _cont(0), nbytes(0), ndone(0), op(VIO::NONE), buffer(), vc_server(0), mutex(0)
+{
+}
 
 TS_INLINE Continuation *
 VIO::get_continuation()
@@ -59,12 +47,12 @@ VIO::get_continuation()
   return _cont;
 }
 TS_INLINE void
-VIO::set_writer(MIOBuffer * writer)
+VIO::set_writer(MIOBuffer *writer)
 {
   buffer.writer_for(writer);
 }
 TS_INLINE void
-VIO::set_reader(IOBufferReader * reader)
+VIO::set_reader(IOBufferReader *reader)
 {
   buffer.reader_for(reader);
 }
@@ -98,7 +86,7 @@ VIO::done()
 //
 /////////////////////////////////////////////////////////////
 TS_INLINE void
-VIO::set_continuation(Continuation * acont)
+VIO::set_continuation(Continuation *acont)
 {
   if (vc_server)
     vc_server->set_continuation(this, acont);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/Processor.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Processor.cc b/iocore/eventsystem/Processor.cc
index f46741e..1615dd1 100644
--- a/iocore/eventsystem/Processor.cc
+++ b/iocore/eventsystem/Processor.cc
@@ -51,7 +51,7 @@
 
 Processor::Processor()
 {
-}                               /* End Processor::Processor() */
+} /* End Processor::Processor() */
 
 
 //////////////////////////////////////////////////////////////////////////////
@@ -64,7 +64,7 @@ Processor::Processor()
 
 Processor::~Processor()
 {
-}                               /* End Processor::~Processor() */
+} /* End Processor::~Processor() */
 
 //////////////////////////////////////////////////////////////////
 //
@@ -75,7 +75,7 @@ Thread *
 Processor::create_thread(int /* thread_index */)
 {
   ink_release_assert(!"Processor::create_thread -- no default implementation");
-  return ((Thread *) 0);
+  return ((Thread *)0);
 }
 
 //////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/ProtectedQueue.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/ProtectedQueue.cc b/iocore/eventsystem/ProtectedQueue.cc
index cc735a3..f8e8cf6 100644
--- a/iocore/eventsystem/ProtectedQueue.cc
+++ b/iocore/eventsystem/ProtectedQueue.cc
@@ -45,7 +45,7 @@
 extern ClassAllocator<Event> eventAllocator;
 
 void
-ProtectedQueue::enqueue(Event *e , bool fast_signal)
+ProtectedQueue::enqueue(Event *e, bool fast_signal)
 {
   ink_assert(!e->in_the_prot_queue && !e->in_the_priority_queue);
   EThread *e_ethread = e->ethread;
@@ -81,7 +81,7 @@ ProtectedQueue::enqueue(Event *e , bool fast_signal)
             // convert to direct map, put each ethread (sig_e[i]) into
             // the direct map loation: sig_e[sig_e[i]->id]
             for (int i = 0; i < t; i++) {
-              EThread *cur = sig_e[i];  // put this ethread
+              EThread *cur = sig_e[i]; // put this ethread
               while (cur) {
                 EThread *next = sig_e[cur->id]; // into this location
                 if (next == cur)
@@ -106,17 +106,17 @@ ProtectedQueue::enqueue(Event *e , bool fast_signal)
 }
 
 void
-flush_signals(EThread * thr)
+flush_signals(EThread *thr)
 {
   ink_assert(this_ethread() == thr);
   int n = thr->n_ethreads_to_be_signalled;
   if (n > eventProcessor.n_ethreads)
-    n = eventProcessor.n_ethreads;      // MAX
+    n = eventProcessor.n_ethreads; // MAX
   int i;
 
-  // Since the lock is only there to prevent a race in ink_cond_timedwait
-  // the lock is taken only for a short time, thus it is unlikely that
-  // this code has any effect.
+// Since the lock is only there to prevent a race in ink_cond_timedwait
+// the lock is taken only for a short time, thus it is unlikely that
+// this code has any effect.
 #ifdef EAGER_SIGNALLING
   for (i = 0; i < n; i++) {
     // Try to signal as many threads as possible without blocking.
@@ -140,7 +140,7 @@ flush_signals(EThread * thr)
 void
 ProtectedQueue::dequeue_timed(ink_hrtime cur_time, ink_hrtime timeout, bool sleep)
 {
-  (void) cur_time;
+  (void)cur_time;
   Event *e;
   if (sleep) {
     ink_mutex_acquire(&lock);
@@ -151,7 +151,7 @@ ProtectedQueue::dequeue_timed(ink_hrtime cur_time, ink_hrtime timeout, bool slee
     ink_mutex_release(&lock);
   }
 
-  e = (Event *) ink_atomiclist_popall(&al);
+  e = (Event *)ink_atomiclist_popall(&al);
   // invert the list, to preserve order
   SLL<Event, Event::Link_link> l, t;
   t.head = e;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/ProxyAllocator.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/ProxyAllocator.cc b/iocore/eventsystem/ProxyAllocator.cc
index 67fa579..12a82cb 100644
--- a/iocore/eventsystem/ProxyAllocator.cc
+++ b/iocore/eventsystem/ProxyAllocator.cc
@@ -25,13 +25,13 @@
 int thread_freelist_high_watermark = 512;
 int thread_freelist_low_watermark = 32;
 
-void*
+void *
 thread_alloc(Allocator &a, ProxyAllocator &l)
 {
 #if TS_USE_FREELIST && !TS_USE_RECLAIMABLE_FREELIST
   if (l.freelist) {
-    void *v = (void *) l.freelist;
-    l.freelist = *(void **) l.freelist;
+    void *v = (void *)l.freelist;
+    l.freelist = *(void **)l.freelist;
     --(l.allocated);
     return v;
   }
@@ -45,13 +45,13 @@ void
 thread_freeup(Allocator &a, ProxyAllocator &l)
 {
 #if !TS_USE_RECLAIMABLE_FREELIST
-  void *head = (void *) l.freelist;
+  void *head = (void *)l.freelist;
 #endif
-  void *tail = (void *) l.freelist;
+  void *tail = (void *)l.freelist;
   size_t count = 0;
-  while(l.freelist && l.allocated > thread_freelist_low_watermark){
+  while (l.freelist && l.allocated > thread_freelist_low_watermark) {
     tail = l.freelist;
-    l.freelist = *(void **) l.freelist;
+    l.freelist = *(void **)l.freelist;
     --(l.allocated);
     ++count;
 #if TS_USE_RECLAIMABLE_FREELIST
@@ -61,7 +61,7 @@ thread_freeup(Allocator &a, ProxyAllocator &l)
 #if !TS_USE_RECLAIMABLE_FREELIST
   if (unlikely(count == 1)) {
     a.free_void(tail);
-  } else if(count > 0) {
+  } else if (count > 0) {
     a.free_void_bulk(head, tail, count);
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/SocketManager.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/SocketManager.cc b/iocore/eventsystem/SocketManager.cc
index 59c120b..65af386 100644
--- a/iocore/eventsystem/SocketManager.cc
+++ b/iocore/eventsystem/SocketManager.cc
@@ -30,8 +30,7 @@
 
 SocketManager socketManager;
 
-SocketManager::SocketManager()
-  : pagesize(ats_pagesize())
+SocketManager::SocketManager() : pagesize(ats_pagesize())
 {
 }
 
@@ -41,9 +40,9 @@ SocketManager::~SocketManager()
 }
 
 int
-SocketManager::ink_bind(int s, struct sockaddr const* name, int namelen, short Proto)
+SocketManager::ink_bind(int s, struct sockaddr const *name, int namelen, short Proto)
 {
-  (void) Proto;
+  (void)Proto;
   return safe_bind(s, name, namelen);
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/Thread.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Thread.cc b/iocore/eventsystem/Thread.cc
index 1a9c581..3dabb82 100644
--- a/iocore/eventsystem/Thread.cc
+++ b/iocore/eventsystem/Thread.cc
@@ -30,30 +30,28 @@
 **************************************************************************/
 #include "P_EventSystem.h"
 
-  ///////////////////////////////////////////////
-  // Common Interface impl                     //
-  ///////////////////////////////////////////////
+///////////////////////////////////////////////
+// Common Interface impl                     //
+///////////////////////////////////////////////
 
 static ink_thread_key init_thread_key();
 
 ProxyMutex *global_mutex = NULL;
-ink_hrtime
-  Thread::cur_time = 0;
-inkcoreapi ink_thread_key
-  Thread::thread_data_key = init_thread_key();
+ink_hrtime Thread::cur_time = 0;
+inkcoreapi ink_thread_key Thread::thread_data_key = init_thread_key();
 
 Thread::Thread()
 {
   mutex = new_ProxyMutex();
   mutex_ptr = mutex;
-  MUTEX_TAKE_LOCK(mutex, (EThread *) this);
+  MUTEX_TAKE_LOCK(mutex, (EThread *)this);
   mutex->nthread_holding = THREAD_MUTEX_THREAD_HOLDING;
 }
 
 static void
 key_destructor(void *value)
 {
-  (void) value;
+  (void)value;
 }
 
 ink_thread_key
@@ -63,12 +61,11 @@ init_thread_key()
   return Thread::thread_data_key;
 }
 
-  ///////////////////////////////////////////////
-  // Unix & non-NT Interface impl              //
-  ///////////////////////////////////////////////
+///////////////////////////////////////////////
+// Unix & non-NT Interface impl              //
+///////////////////////////////////////////////
 
-struct thread_data_internal
-{
+struct thread_data_internal {
   ThreadFunction f;
   void *a;
   Thread *me;
@@ -78,7 +75,7 @@ struct thread_data_internal
 static void *
 spawn_thread_internal(void *a)
 {
-  thread_data_internal *p = (thread_data_internal *) a;
+  thread_data_internal *p = (thread_data_internal *)a;
 
   p->me->set_specific();
   ink_set_thread_name(p->name);
@@ -91,7 +88,7 @@ spawn_thread_internal(void *a)
 }
 
 ink_thread
-Thread::start(const char* name, size_t stacksize, ThreadFunction f, void *a)
+Thread::start(const char *name, size_t stacksize, ThreadFunction f, void *a)
 {
   thread_data_internal *p = (thread_data_internal *)ats_malloc(sizeof(thread_data_internal));
 
@@ -100,7 +97,7 @@ Thread::start(const char* name, size_t stacksize, ThreadFunction f, void *a)
   p->me = this;
   memset(p->name, 0, MAX_THREAD_NAME_LENGTH);
   ink_strlcpy(p->name, name, MAX_THREAD_NAME_LENGTH);
-  tid = ink_thread_create(spawn_thread_internal, (void *) p, 0, stacksize);
+  tid = ink_thread_create(spawn_thread_internal, (void *)p, 0, stacksize);
 
   return tid;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/UnixEThread.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc
index cb4838b..a30a4e3 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -34,53 +34,42 @@
 
 struct AIOCallback;
 
-#define MAX_HEARTBEATS_MISSED         	10
-#define NO_HEARTBEAT                  	-1
-#define THREAD_MAX_HEARTBEAT_MSECONDS	60
-#define NO_ETHREAD_ID                   -1
+#define MAX_HEARTBEATS_MISSED 10
+#define NO_HEARTBEAT -1
+#define THREAD_MAX_HEARTBEAT_MSECONDS 60
+#define NO_ETHREAD_ID -1
 
 EThread::EThread()
-  : generator((uint64_t)ink_get_hrtime_internal() ^ (uint64_t)(uintptr_t)this),
-   ethreads_to_be_signalled(NULL),
-   n_ethreads_to_be_signalled(0),
-   main_accept_index(-1),
-   id(NO_ETHREAD_ID), event_types(0),
-   signal_hook(0),
-   tt(REGULAR)
+  : generator((uint64_t)ink_get_hrtime_internal() ^ (uint64_t)(uintptr_t) this), ethreads_to_be_signalled(NULL),
+    n_ethreads_to_be_signalled(0), main_accept_index(-1), id(NO_ETHREAD_ID), event_types(0), signal_hook(0), tt(REGULAR)
 {
   memset(thread_private, 0, PER_THREAD_DATA);
 }
 
 EThread::EThread(ThreadType att, int anid)
-  : generator((uint64_t)ink_get_hrtime_internal() ^ (uint64_t)(uintptr_t)this),
-    ethreads_to_be_signalled(NULL),
-    n_ethreads_to_be_signalled(0),
-    main_accept_index(-1),
-    id(anid),
-    event_types(0),
-    signal_hook(0),
-    tt(att),
+  : generator((uint64_t)ink_get_hrtime_internal() ^ (uint64_t)(uintptr_t) this), ethreads_to_be_signalled(NULL),
+    n_ethreads_to_be_signalled(0), main_accept_index(-1), id(anid), event_types(0), signal_hook(0), tt(att),
     server_session_pool(NULL)
 {
   ethreads_to_be_signalled = (EThread **)ats_malloc(MAX_EVENT_THREADS * sizeof(EThread *));
-  memset((char *) ethreads_to_be_signalled, 0, MAX_EVENT_THREADS * sizeof(EThread *));
+  memset((char *)ethreads_to_be_signalled, 0, MAX_EVENT_THREADS * sizeof(EThread *));
   memset(thread_private, 0, PER_THREAD_DATA);
 #if HAVE_EVENTFD
   evfd = eventfd(0, O_NONBLOCK | FD_CLOEXEC);
   if (evfd < 0) {
     if (errno == EINVAL) { // flags invalid for kernel <= 2.6.26
-      evfd = eventfd(0,0);
+      evfd = eventfd(0, 0);
       if (evfd < 0)
-        Fatal("EThread::EThread: %d=eventfd(0,0),errno(%d)",evfd,errno);
+        Fatal("EThread::EThread: %d=eventfd(0,0),errno(%d)", evfd, errno);
     } else
-      Fatal("EThread::EThread: %d=eventfd(0,O_NONBLOCK | FD_CLOEXEC),errno(%d)",evfd,errno);
+      Fatal("EThread::EThread: %d=eventfd(0,O_NONBLOCK | FD_CLOEXEC),errno(%d)", evfd, errno);
   }
   fcntl(evfd, F_SETFD, FD_CLOEXEC);
   fcntl(evfd, F_SETFL, O_NONBLOCK);
 #elif TS_USE_PORT
-  /* Solaris ports requires no crutches to do cross thread signaling.
-   * We'll just port_send the event straight over the port.
-   */
+/* Solaris ports requires no crutches to do cross thread signaling.
+ * We'll just port_send the event straight over the port.
+ */
 #else
   ink_release_assert(pipe(evpipe) >= 0);
   fcntl(evpipe[0], F_SETFD, FD_CLOEXEC);
@@ -90,14 +79,9 @@ EThread::EThread(ThreadType att, int anid)
 #endif
 }
 
-EThread::EThread(ThreadType att, Event * e)
- : generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t) this)),
-   ethreads_to_be_signalled(NULL),
-   n_ethreads_to_be_signalled(0),
-   main_accept_index(-1),
-   id(NO_ETHREAD_ID), event_types(0),
-   signal_hook(0),
-   tt(att), oneevent(e)
+EThread::EThread(ThreadType att, Event *e)
+  : generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t) this)), ethreads_to_be_signalled(NULL), n_ethreads_to_be_signalled(0),
+    main_accept_index(-1), id(NO_ETHREAD_ID), event_types(0), signal_hook(0), tt(att), oneevent(e)
 {
   ink_assert(att == DEDICATED);
   memset(thread_private, 0, PER_THREAD_DATA);
@@ -118,17 +102,17 @@ EThread::~EThread()
 bool
 EThread::is_event_type(EventType et)
 {
-  return !!(event_types & (1 << (int) et));
+  return !!(event_types & (1 << (int)et));
 }
 
 void
 EThread::set_event_type(EventType et)
 {
-  event_types |= (1 << (int) et);
+  event_types |= (1 << (int)et);
 }
 
 void
-EThread::process_event(Event * e, int calling_code)
+EThread::process_event(Event *e, int calling_code)
 {
   ink_assert((!e->in_the_prot_queue && !e->in_the_priority_queue));
   MUTEX_TRY_LOCK_FOR(lock, e->mutex.m_ptr, this, e->continuation);
@@ -174,129 +158,129 @@ EThread::process_event(Event * e, int calling_code)
 //
 
 void
-EThread::execute() {
+EThread::execute()
+{
   switch (tt) {
+  case REGULAR: {
+    Event *e;
+    Que(Event, link) NegativeQueue;
+    ink_hrtime next_time = 0;
 
-    case REGULAR: {
-      Event *e;
-      Que(Event, link) NegativeQueue;
-      ink_hrtime next_time = 0;
-
-      // give priority to immediate events
-      for (;;) {
-        // execute all the available external events that have
-        // already been dequeued
-        cur_time = ink_get_based_hrtime_internal();
-        while ((e = EventQueueExternal.dequeue_local())) {
+    // give priority to immediate events
+    for (;;) {
+      // execute all the available external events that have
+      // already been dequeued
+      cur_time = ink_get_based_hrtime_internal();
+      while ((e = EventQueueExternal.dequeue_local())) {
+        if (e->cancelled)
+          free_event(e);
+        else if (!e->timeout_at) { // IMMEDIATE
+          ink_assert(e->period == 0);
+          process_event(e, e->callback_event);
+        } else if (e->timeout_at > 0) // INTERVAL
+          EventQueue.enqueue(e, cur_time);
+        else { // NEGATIVE
+          Event *p = NULL;
+          Event *a = NegativeQueue.head;
+          while (a && a->timeout_at > e->timeout_at) {
+            p = a;
+            a = a->link.next;
+          }
+          if (!a)
+            NegativeQueue.enqueue(e);
+          else
+            NegativeQueue.insert(e, p);
+        }
+      }
+      bool done_one;
+      do {
+        done_one = false;
+        // execute all the eligible internal events
+        EventQueue.check_ready(cur_time, this);
+        while ((e = EventQueue.dequeue_ready(cur_time))) {
+          ink_assert(e);
+          ink_assert(e->timeout_at > 0);
           if (e->cancelled)
-             free_event(e);
-          else if (!e->timeout_at) { // IMMEDIATE
-            ink_assert(e->period == 0);
+            free_event(e);
+          else {
+            done_one = true;
             process_event(e, e->callback_event);
-          } else if (e->timeout_at > 0) // INTERVAL
-            EventQueue.enqueue(e, cur_time);
-          else { // NEGATIVE
-            Event *p = NULL;
-            Event *a = NegativeQueue.head;
-            while (a && a->timeout_at > e->timeout_at) {
-              p = a;
-              a = a->link.next;
-            }
-            if (!a)
-              NegativeQueue.enqueue(e);
-            else
-              NegativeQueue.insert(e, p);
           }
         }
-        bool done_one;
-        do {
-          done_one = false;
-          // execute all the eligible internal events
-          EventQueue.check_ready(cur_time, this);
-          while ((e = EventQueue.dequeue_ready(cur_time))) {
-            ink_assert(e);
-            ink_assert(e->timeout_at > 0);
+      } while (done_one);
+      // execute any negative (poll) events
+      if (NegativeQueue.head) {
+        if (n_ethreads_to_be_signalled)
+          flush_signals(this);
+        // dequeue all the external events and put them in a local
+        // queue. If there are no external events available, don't
+        // do a cond_timedwait.
+        if (!INK_ATOMICLIST_EMPTY(EventQueueExternal.al))
+          EventQueueExternal.dequeue_timed(cur_time, next_time, false);
+        while ((e = EventQueueExternal.dequeue_local())) {
+          if (!e->timeout_at)
+            process_event(e, e->callback_event);
+          else {
             if (e->cancelled)
               free_event(e);
             else {
-              done_one = true;
-              process_event(e, e->callback_event);
+              // If its a negative event, it must be a result of
+              // a negative event, which has been turned into a
+              // timed-event (because of a missed lock), executed
+              // before the poll. So, it must
+              // be executed in this round (because you can't have
+              // more than one poll between two executions of a
+              // negative event)
+              if (e->timeout_at < 0) {
+                Event *p = NULL;
+                Event *a = NegativeQueue.head;
+                while (a && a->timeout_at > e->timeout_at) {
+                  p = a;
+                  a = a->link.next;
+                }
+                if (!a)
+                  NegativeQueue.enqueue(e);
+                else
+                  NegativeQueue.insert(e, p);
+              } else
+                EventQueue.enqueue(e, cur_time);
             }
           }
-        } while (done_one);
-        // execute any negative (poll) events
-        if (NegativeQueue.head) {
-          if (n_ethreads_to_be_signalled)
-            flush_signals(this);
-          // dequeue all the external events and put them in a local
-          // queue. If there are no external events available, don't
-          // do a cond_timedwait.
-          if (!INK_ATOMICLIST_EMPTY(EventQueueExternal.al))
-            EventQueueExternal.dequeue_timed(cur_time, next_time, false);
-          while ((e = EventQueueExternal.dequeue_local())) {
-            if (!e->timeout_at)
-              process_event(e, e->callback_event);
-            else {
-              if (e->cancelled)
-                free_event(e);
-              else {
-                // If its a negative event, it must be a result of
-                // a negative event, which has been turned into a
-                // timed-event (because of a missed lock), executed
-                // before the poll. So, it must
-                // be executed in this round (because you can't have
-                // more than one poll between two executions of a
-                // negative event)
-                if (e->timeout_at < 0) {
-                  Event *p = NULL;
-                  Event *a = NegativeQueue.head;
-                  while (a && a->timeout_at > e->timeout_at) {
-                    p = a;
-                    a = a->link.next;
-                  }
-                  if (!a)
-                    NegativeQueue.enqueue(e);
-                  else
-                    NegativeQueue.insert(e, p);
-                } else
-                  EventQueue.enqueue(e, cur_time);
-              }
-            }
-          }
-          // execute poll events
-          while ((e = NegativeQueue.dequeue()))
-            process_event(e, EVENT_POLL);
-          if (!INK_ATOMICLIST_EMPTY(EventQueueExternal.al))
-            EventQueueExternal.dequeue_timed(cur_time, next_time, false);
-        } else {                // Means there are no negative events
-          next_time = EventQueue.earliest_timeout();
-          ink_hrtime sleep_time = next_time - cur_time;
+        }
+        // execute poll events
+        while ((e = NegativeQueue.dequeue()))
+          process_event(e, EVENT_POLL);
+        if (!INK_ATOMICLIST_EMPTY(EventQueueExternal.al))
+          EventQueueExternal.dequeue_timed(cur_time, next_time, false);
+      } else { // Means there are no negative events
+        next_time = EventQueue.earliest_timeout();
+        ink_hrtime sleep_time = next_time - cur_time;
 
-          if (sleep_time > THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND) {
-            next_time = cur_time + THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND;
-          }
-          // dequeue all the external events and put them in a local
-          // queue. If there are no external events available, do a
-          // cond_timedwait.
-          if (n_ethreads_to_be_signalled)
-            flush_signals(this);
-          EventQueueExternal.dequeue_timed(cur_time, next_time, true);
+        if (sleep_time > THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND) {
+          next_time = cur_time + THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND;
         }
+        // dequeue all the external events and put them in a local
+        // queue. If there are no external events available, do a
+        // cond_timedwait.
+        if (n_ethreads_to_be_signalled)
+          flush_signals(this);
+        EventQueueExternal.dequeue_timed(cur_time, next_time, true);
       }
     }
+  }
 
-    case DEDICATED: {
-      // coverity[lock]
-      MUTEX_TAKE_LOCK_FOR(oneevent->mutex, this, oneevent->continuation);
-      oneevent->continuation->handleEvent(EVENT_IMMEDIATE, oneevent);
-      MUTEX_UNTAKE_LOCK(oneevent->mutex, this);
-      free_event(oneevent);
-      break;
-    }
+  case DEDICATED: {
+    // coverity[lock]
+    MUTEX_TAKE_LOCK_FOR(oneevent->mutex, this, oneevent->continuation);
+    oneevent->continuation->handleEvent(EVENT_IMMEDIATE, oneevent);
+    MUTEX_UNTAKE_LOCK(oneevent->mutex, this);
+    free_event(oneevent);
+    break;
+  }
 
-    default:
-      ink_assert(!"bad case value (execute)");
-      break;
-  }                             /* End switch */
+  default:
+    ink_assert(!"bad case value (execute)");
+    break;
+  } /* End switch */
   // coverity[missing_unlock]
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/UnixEventProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc
index f431dda..54fec71 100644
--- a/iocore/eventsystem/UnixEventProcessor.cc
+++ b/iocore/eventsystem/UnixEventProcessor.cc
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 
-#include "P_EventSystem.h"      /* MAGIC_EDITING_TAG */
+#include "P_EventSystem.h" /* MAGIC_EDITING_TAG */
 #include <sched.h>
 #if TS_USE_HWLOC
 #include <alloca.h>
@@ -30,7 +30,7 @@
 #include "ink_defs.h"
 
 EventType
-EventProcessor::spawn_event_threads(int n_threads, const char* et_name, size_t stacksize)
+EventProcessor::spawn_event_threads(int n_threads, const char *et_name, size_t stacksize)
 {
   char thr_name[MAX_THREAD_NAME_LENGTH];
   EventType new_thread_group_id;
@@ -40,7 +40,7 @@ EventProcessor::spawn_event_threads(int n_threads, const char* et_name, size_t s
   ink_release_assert((n_ethreads + n_threads) <= MAX_EVENT_THREADS);
   ink_release_assert(n_thread_groups < MAX_EVENT_TYPES);
 
-  new_thread_group_id = (EventType) n_thread_groups;
+  new_thread_group_id = (EventType)n_thread_groups;
 
   for (i = 0; i < n_threads; i++) {
     EThread *t = new EThread(REGULAR, n_ethreads + i);
@@ -92,7 +92,7 @@ EventProcessor::start(int n_event_threads, size_t stacksize)
     all_ethreads[i] = t;
 
     eventthread[ET_CALL][i] = t;
-    t->set_event_type((EventType) ET_CALL);
+    t->set_event_type((EventType)ET_CALL);
   }
   n_threads_for_type[ET_CALL] = n_event_threads;
 
@@ -104,31 +104,31 @@ EventProcessor::start(int n_event_threads, size_t stacksize)
   int obj_count = 0;
   char *obj_name;
 
-  switch(affinity) {
-    case 4:           // assign threads to logical processing units
+  switch (affinity) {
+  case 4: // assign threads to logical processing units
 // Older versions of libhwloc (eg. Ubuntu 10.04) don't have HWLOC_OBJ_PU.
 #if HAVE_HWLOC_OBJ_PU
-      obj_type = HWLOC_OBJ_PU;
-      obj_name = (char *) "Logical Processor";
-      break;
+    obj_type = HWLOC_OBJ_PU;
+    obj_name = (char *)"Logical Processor";
+    break;
 #endif
-    case 3:           // assign threads to real cores
-      obj_type = HWLOC_OBJ_CORE;
-      obj_name = (char *) "Core";
-      break;
-    case 1:           // assign threads to NUMA nodes (often 1:1 with sockets)
-      obj_type = HWLOC_OBJ_NODE;
-      obj_name = (char *) "NUMA Node";
-      if (hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type) > 0) {
-        break;
-      }
-    case 2:           // assign threads to sockets
-      obj_type = HWLOC_OBJ_SOCKET;
-      obj_name = (char *) "Socket";
+  case 3: // assign threads to real cores
+    obj_type = HWLOC_OBJ_CORE;
+    obj_name = (char *)"Core";
+    break;
+  case 1: // assign threads to NUMA nodes (often 1:1 with sockets)
+    obj_type = HWLOC_OBJ_NODE;
+    obj_name = (char *)"NUMA Node";
+    if (hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type) > 0) {
       break;
-    default:         // assign threads to the machine as a whole (a level below SYSTEM)
-      obj_type = HWLOC_OBJ_MACHINE;
-      obj_name = (char *) "Machine";
+    }
+  case 2: // assign threads to sockets
+    obj_type = HWLOC_OBJ_SOCKET;
+    obj_name = (char *)"Socket";
+    break;
+  default: // assign threads to the machine as a whole (a level below SYSTEM)
+    obj_type = HWLOC_OBJ_MACHINE;
+    obj_name = (char *)"Machine";
   }
 
   obj_count = hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type);
@@ -144,11 +144,11 @@ EventProcessor::start(int n_event_threads, size_t stacksize)
       obj = hwloc_get_obj_by_type(ink_get_topology(), obj_type, i % obj_count);
 #if HWLOC_API_VERSION >= 0x00010100
       int cpu_mask_len = hwloc_bitmap_snprintf(NULL, 0, obj->cpuset) + 1;
-      char *cpu_mask = (char *) alloca(cpu_mask_len);
+      char *cpu_mask = (char *)alloca(cpu_mask_len);
       hwloc_bitmap_snprintf(cpu_mask, cpu_mask_len, obj->cpuset);
-      Debug("iocore_thread","EThread: %d %s: %d CPU Mask: %s\n", i, obj_name, obj->logical_index, cpu_mask);
+      Debug("iocore_thread", "EThread: %d %s: %d CPU Mask: %s\n", i, obj_name, obj->logical_index, cpu_mask);
 #else
-      Debug("iocore_thread","EThread: %d %s: %d\n", i, obj_name, obj->logical_index);
+      Debug("iocore_thread", "EThread: %d %s: %d\n", i, obj_name, obj->logical_index);
 #endif // HWLOC_API_VERSION
       hwloc_set_thread_cpubind(ink_get_topology(), tid, obj->cpuset, HWLOC_CPUBIND_STRICT);
     } else {
@@ -167,7 +167,7 @@ EventProcessor::shutdown()
 }
 
 Event *
-EventProcessor::spawn_thread(Continuation *cont, const char* thr_name, size_t stacksize)
+EventProcessor::spawn_thread(Continuation *cont, const char *thr_name, size_t stacksize)
 {
   ink_release_assert(n_dthreads < MAX_EVENT_THREADS);
   Event *e = eventAllocator.alloc();


[18/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecHttp.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecHttp.h b/lib/records/I_RecHttp.h
index 32a9f2d..9dbd8c0 100644
--- a/lib/records/I_RecHttp.h
+++ b/lib/records/I_RecHttp.h
@@ -31,19 +31,20 @@
 #include <ts/apidefs.h>
 
 /// Load default inbound IP addresses from the configuration file.
-void RecHttpLoadIp(
-  char const* name,    ///< Name of value in configuration file.
-  IpAddr& ip4, ///< [out] IPv4 address.
-  IpAddr& ip6  ///< [out] Ipv6 address.
-);
+void RecHttpLoadIp(char const *name, ///< Name of value in configuration file.
+                   IpAddr &ip4,      ///< [out] IPv4 address.
+                   IpAddr &ip6       ///< [out] Ipv6 address.
+                   );
 
 /** A set of session protocols.
     This depends on using @c SessionProtocolNameRegistry to get the indices.
 */
-class SessionProtocolSet {
+class SessionProtocolSet
+{
   typedef SessionProtocolSet self; ///< Self reference type.
   /// Storage for the set - a bit vector.
   uint32_t m_bits;
+
 public:
   // The right way.
   //  static int const MAX = sizeof(m_bits) * CHAR_BIT;
@@ -51,40 +52,79 @@ public:
   static int const MAX = sizeof(uint32_t) * 8;
   /// Default constructor.
   /// Constructs and empty set.
-  SessionProtocolSet() : m_bits(0) { }
+  SessionProtocolSet() : m_bits(0) {}
 
-  uint32_t indexToMask(int idx) const {
-    return 0 <= idx && idx < static_cast<int>(MAX)
-      ? static_cast<uint32_t>(1) << idx
-      : 0
-      ;
+  uint32_t
+  indexToMask(int idx) const
+  {
+    return 0 <= idx && idx < static_cast<int>(MAX) ? static_cast<uint32_t>(1) << idx : 0;
   }
 
   /// Mark the protocol at @a idx as present.
-  void markIn(int idx) { m_bits |= this->indexToMask(idx); }
+  void
+  markIn(int idx)
+  {
+    m_bits |= this->indexToMask(idx);
+  }
   /// Mark all the protocols in @a that as present in @a this.
-  void markIn(self const& that) { m_bits |= that.m_bits; }
+  void
+  markIn(self const &that)
+  {
+    m_bits |= that.m_bits;
+  }
   /// Mark the protocol at a idx as not present.
-  void markOut(int idx) { m_bits &= ~this->indexToMask(idx); }
+  void
+  markOut(int idx)
+  {
+    m_bits &= ~this->indexToMask(idx);
+  }
   /// Mark the protocols in @a that as not in @a this.
-  void markOut(self const& that) { m_bits &= ~(that.m_bits); }
+  void
+  markOut(self const &that)
+  {
+    m_bits &= ~(that.m_bits);
+  }
   /// Test if a protocol is in the set.
-  bool contains(int idx) const { return 0 != (m_bits & this->indexToMask(idx)); }
+  bool
+  contains(int idx) const
+  {
+    return 0 != (m_bits & this->indexToMask(idx));
+  }
   /// Test if all the protocols in @a that are in @a this protocol set.
-  bool contains(self const& that) const { return that.m_bits == (that.m_bits & m_bits); }
+  bool
+  contains(self const &that) const
+  {
+    return that.m_bits == (that.m_bits & m_bits);
+  }
   /// Mark all possible protocols.
-  void markAllIn() { m_bits = ~static_cast<uint32_t>(0); }
+  void
+  markAllIn()
+  {
+    m_bits = ~static_cast<uint32_t>(0);
+  }
   /// Clear all protocols.
-  void markAllOut() { m_bits = 0; }
+  void
+  markAllOut()
+  {
+    m_bits = 0;
+  }
 
   /// Check for intersection.
-  bool intersects(self const& that) { return 0 != (m_bits & that.m_bits); }
+  bool
+  intersects(self const &that)
+  {
+    return 0 != (m_bits & that.m_bits);
+  }
 
   /// Check for empty set.
-  bool isEmpty() const { return m_bits == 0; }
+  bool
+  isEmpty() const
+  {
+    return m_bits == 0;
+  }
 
   /// Equality (identical sets).
-  bool operator == (self const& that) const { return m_bits == that.m_bits; }
+  bool operator==(self const &that) const { return m_bits == that.m_bits; }
 };
 
 // Predefined sets of protocols, useful for configuration.
@@ -107,10 +147,11 @@ extern SessionProtocolSet DEFAULT_TLS_SESSION_PROTOCOL_SET;
     If the size gets much larger we should consider doing something more
     clever.
 */
-class SessionProtocolNameRegistry {
- public:
-  static int const MAX  = SessionProtocolSet::MAX; ///< Maximum # of registered names.
-  static int const INVALID = -1; ///< Normalized invalid index value.
+class SessionProtocolNameRegistry
+{
+public:
+  static int const MAX = SessionProtocolSet::MAX; ///< Maximum # of registered names.
+  static int const INVALID = -1;                  ///< Normalized invalid index value.
 
   /// Default constructor.
   /// Creates empty registry with no names.
@@ -124,34 +165,34 @@ class SessionProtocolNameRegistry {
       The name is copied internally.
       @return The index for the registered @a name.
   */
-  int toIndex(char const* name);
+  int toIndex(char const *name);
 
   /** Get the index for @a name, registering it if needed.
       The caller @b guarantees @a name is persistent and immutable.
       @return The index for the registered @a name.
   */
-  int toIndexConst(char const* name);
+  int toIndexConst(char const *name);
 
   /** Convert a @a name to an index.
       @return The index for @a name or @c INVALID if it is not registered.
   */
-  int indexFor(char const* name) const;
+  int indexFor(char const *name) const;
 
   /** Convert an @a index to the corresponding name.
       @return A pointer to the name or @c NULL if the index isn't registered.
   */
-  char const* nameFor(int index) const;
+  char const *nameFor(int index) const;
 
   /// Mark protocols as present in @a sp_set based on the names in @a value.
   /// The names can be separated by ;/|,: and space.
   /// @internal This is separated out to make it easy to access from the plugin API
   /// implementation.
-  void markIn(char const* value, SessionProtocolSet& sp_set);
+  void markIn(char const *value, SessionProtocolSet &sp_set);
 
- protected:
-  unsigned int m_n; ///< Index of first unused slot.
-  char const* m_names[MAX]; ///< Pointers to registered names.
-  uint8_t m_flags[MAX]; ///< Flags for each name.
+protected:
+  unsigned int m_n;         ///< Index of first unused slot.
+  char const *m_names[MAX]; ///< Pointers to registered names.
+  uint8_t m_flags[MAX];     ///< Flags for each name.
 
   static uint8_t const F_ALLOCATED = 0x1; ///< Flag for allocated by this instance.
 };
@@ -189,10 +230,10 @@ public:
     TRANSPORT_PLUGIN        /// < Protocol plugin connection
   };
 
-  int m_fd; ///< Pre-opened file descriptor if present.
+  int m_fd;             ///< Pre-opened file descriptor if present.
   TransportType m_type; ///< Type of connection.
-  in_port_t m_port; ///< Port on which to listen.
-  uint8_t m_family; ///< IP address family.
+  in_port_t m_port;     ///< Port on which to listen.
+  uint8_t m_family;     ///< IP address family.
   /// True if inbound connects (from client) are transparent.
   bool m_inbound_transparent_p;
   /// True if outbound connections (to origin servers) are transparent.
@@ -221,9 +262,8 @@ public:
 
       @return The IP address for @a family
   */
-  IpAddr& outboundIp(
-    uint16_t family ///< IP address family.
-  );
+  IpAddr &outboundIp(uint16_t family ///< IP address family.
+                     );
 
   /// Check for SSL port.
   bool isSSL() const;
@@ -235,22 +275,20 @@ public:
   /// @a opts should not contain any whitespace, only the option string.
   /// This object's internal state is updated as specified by @a opts.
   /// @return @c true if a port option was successfully processed, @c false otherwise.
-  bool processOptions(
-    char const* opts ///< String containing the options.
-  );
+  bool processOptions(char const *opts ///< String containing the options.
+                      );
 
   /** Global instance.
 
       This is provided because most of the work with this data is used as a singleton
       and it's handy to encapsulate it here.
   */
-  static Vec<self>& global();
+  static Vec<self> &global();
 
   /// Check for SSL ports.
   /// @return @c true if any port in @a ports is an SSL port.
-  static bool hasSSL(
-		     Group const& ports ///< Ports to check.
-		     );
+  static bool hasSSL(Group const &ports ///< Ports to check.
+                     );
 
   /// Check for SSL ports.
   /// @return @c true if any global port is an SSL port.
@@ -265,9 +303,8 @@ public:
       @return @c true if at least one valid port description was
       found, @c false if none.
   */
-  static bool loadConfig(
-    Vec<self>& ports ///< Destination for found port data.
-  );
+  static bool loadConfig(Vec<self> &ports ///< Destination for found port data.
+                         );
 
   /** Load all relevant configuration data into the global ports.
 
@@ -284,10 +321,9 @@ public:
       @note This is used primarily internally but is available if needed.
       @return @c true if a valid port was found, @c false if none.
   */
-  static bool loadValue(
-    Vec<self>& ports, ///< Destination for found port data.
-    char const* value ///< Source port data.
-  );
+  static bool loadValue(Vec<self> &ports, ///< Destination for found port data.
+                        char const *value ///< Source port data.
+                        );
 
   /** Load ports from a value string into the global ports.
 
@@ -296,15 +332,13 @@ public:
 
       @return @c true if a valid port was found, @c false if none.
   */
-  static bool loadValue(
-    char const* value ///< Source port data.
-  );
+  static bool loadValue(char const *value ///< Source port data.
+                        );
 
   /// Load default value if @a ports is empty.
   /// @return @c true if the default was needed / loaded.
-  static bool loadDefaultIfEmpty(
-    Vec<self>& ports ///< Load target.
-  );
+  static bool loadDefaultIfEmpty(Vec<self> &ports ///< Load target.
+                                 );
 
   /// Load default value into the global set if it is empty.
   /// @return @c true if the default was needed / loaded.
@@ -315,101 +349,119 @@ public:
       are checked.
       @return The port if found, @c NULL if not.
   */
-  static self* findHttp(
-			Group const& ports, ///< Group to search.
-			uint16_t family = AF_UNSPEC  ///< Desired address family.
-			);
+  static self *findHttp(Group const &ports,         ///< Group to search.
+                        uint16_t family = AF_UNSPEC ///< Desired address family.
+                        );
 
   /** Find an HTTP port in the global ports.
       If @a family is specified then only ports for that family
       are checked.
       @return The port if found, @c NULL if not.
   */
-  static self* findHttp(uint16_t family = AF_UNSPEC);
+  static self *findHttp(uint16_t family = AF_UNSPEC);
 
   /** Create text description to be used for inter-process access.
       Prints the file descriptor and then any options.
 
       @return The number of characters used for the description.
   */
-  int print(
-    char* out, ///< Output string.
-    size_t n ///< Maximum output length.
-  );
+  int print(char *out, ///< Output string.
+            size_t n   ///< Maximum output length.
+            );
 
-  static char const* const PORTS_CONFIG_NAME; ///< New unified port descriptor.
+  static char const *const PORTS_CONFIG_NAME; ///< New unified port descriptor.
 
   /// Default value if no other values can be found.
-  static char const* const DEFAULT_VALUE;
+  static char const *const DEFAULT_VALUE;
 
   // Keywords (lower case versions, but compares should be case insensitive)
-  static char const* const OPT_FD_PREFIX; ///< Prefix for file descriptor value.
-  static char const* const OPT_OUTBOUND_IP_PREFIX; ///< Prefix for inbound IP address.
-  static char const* const OPT_INBOUND_IP_PREFIX; ///< Prefix for outbound IP address.
-  static char const* const OPT_IPV6; ///< IPv6.
-  static char const* const OPT_IPV4; ///< IPv4
-  static char const* const OPT_TRANSPARENT_INBOUND; ///< Inbound transparent.
-  static char const* const OPT_TRANSPARENT_OUTBOUND; ///< Outbound transparent.
-  static char const* const OPT_TRANSPARENT_FULL; ///< Full transparency.
-  static char const* const OPT_TRANSPARENT_PASSTHROUGH; ///< Pass-through non-HTTP.
-  static char const* const OPT_SSL; ///< SSL (experimental)
-  static char const* const OPT_PLUGIN; ///< Protocol Plugin handle (experimental)
-  static char const* const OPT_BLIND_TUNNEL; ///< Blind tunnel.
-  static char const* const OPT_COMPRESSED; ///< Compressed.
-  static char const* const OPT_HOST_RES_PREFIX; ///< Set DNS family preference.
-  static char const* const OPT_PROTO_PREFIX; ///< Transport layer protocols.
-
-  static Vec<self>& m_global; ///< Global ("default") data.
+  static char const *const OPT_FD_PREFIX;               ///< Prefix for file descriptor value.
+  static char const *const OPT_OUTBOUND_IP_PREFIX;      ///< Prefix for inbound IP address.
+  static char const *const OPT_INBOUND_IP_PREFIX;       ///< Prefix for outbound IP address.
+  static char const *const OPT_IPV6;                    ///< IPv6.
+  static char const *const OPT_IPV4;                    ///< IPv4
+  static char const *const OPT_TRANSPARENT_INBOUND;     ///< Inbound transparent.
+  static char const *const OPT_TRANSPARENT_OUTBOUND;    ///< Outbound transparent.
+  static char const *const OPT_TRANSPARENT_FULL;        ///< Full transparency.
+  static char const *const OPT_TRANSPARENT_PASSTHROUGH; ///< Pass-through non-HTTP.
+  static char const *const OPT_SSL;                     ///< SSL (experimental)
+  static char const *const OPT_PLUGIN;                  ///< Protocol Plugin handle (experimental)
+  static char const *const OPT_BLIND_TUNNEL;            ///< Blind tunnel.
+  static char const *const OPT_COMPRESSED;              ///< Compressed.
+  static char const *const OPT_HOST_RES_PREFIX;         ///< Set DNS family preference.
+  static char const *const OPT_PROTO_PREFIX;            ///< Transport layer protocols.
+
+  static Vec<self> &m_global; ///< Global ("default") data.
 
 protected:
   /// Process @a value for DNS resolution family preferences.
-  void processFamilyPreference(char const* value);
+  void processFamilyPreference(char const *value);
   /// Process @a value for session protocol preferences.
-  void processSessionProtocolPreference(char const* value);
+  void processSessionProtocolPreference(char const *value);
 
   /** Check a prefix option and find the value.
       @return The address of the start of the value, or @c NULL if the prefix doesn't match.
   */
 
-  char const* checkPrefix( char const* src ///< Input text
-                         , char const* prefix ///< Keyword prefix
-                         , size_t prefix_len ///< Length of keyword prefix.
-                         );
+  char const *checkPrefix(char const *src ///< Input text
+                          ,
+                          char const *prefix ///< Keyword prefix
+                          ,
+                          size_t prefix_len ///< Length of keyword prefix.
+                          );
 };
 
-inline bool HttpProxyPort::isSSL() const { return TRANSPORT_SSL == m_type; }
-inline bool HttpProxyPort::isPlugin() const { return TRANSPORT_PLUGIN == m_type; }
+inline bool
+HttpProxyPort::isSSL() const
+{
+  return TRANSPORT_SSL == m_type;
+}
+inline bool
+HttpProxyPort::isPlugin() const
+{
+  return TRANSPORT_PLUGIN == m_type;
+}
 
-inline IpAddr&
-HttpProxyPort::outboundIp(uint16_t family) {
+inline IpAddr &
+HttpProxyPort::outboundIp(uint16_t family)
+{
   static IpAddr invalid; // dummy to make compiler happy about return.
-  if (AF_INET == family) return m_outbound_ip4;
-  else if (AF_INET6 == family) return m_outbound_ip6;
+  if (AF_INET == family)
+    return m_outbound_ip4;
+  else if (AF_INET6 == family)
+    return m_outbound_ip6;
   ink_release_assert(!"Invalid family for outbound address on proxy port.");
   return invalid; // never happens but compiler insists.
 }
 
 inline bool
-HttpProxyPort::loadValue(char const* value) {
+HttpProxyPort::loadValue(char const *value)
+{
   return self::loadValue(m_global, value);
 }
 inline bool
-HttpProxyPort::loadConfig() {
+HttpProxyPort::loadConfig()
+{
   return self::loadConfig(m_global);
 }
 inline bool
-HttpProxyPort::loadDefaultIfEmpty() {
+HttpProxyPort::loadDefaultIfEmpty()
+{
   return self::loadDefaultIfEmpty(m_global);
 }
-inline Vec<HttpProxyPort>&
-HttpProxyPort::global() {
+inline Vec<HttpProxyPort> &
+HttpProxyPort::global()
+{
   return m_global;
 }
 inline bool
-HttpProxyPort::hasSSL() {
+HttpProxyPort::hasSSL()
+{
   return self::hasSSL(m_global);
 }
-inline HttpProxyPort* HttpProxyPort::findHttp(uint16_t family) {
+inline HttpProxyPort *
+HttpProxyPort::findHttp(uint16_t family)
+{
   return self::findHttp(m_global, family);
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecLocal.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecLocal.h b/lib/records/I_RecLocal.h
index 8af8c33..fdec68c 100644
--- a/lib/records/I_RecLocal.h
+++ b/lib/records/I_RecLocal.h
@@ -32,7 +32,7 @@ class FileManager;
 // Initialization
 //-------------------------------------------------------------------------
 
-int RecLocalInit(Diags * diags = NULL);
+int RecLocalInit(Diags *diags = NULL);
 int RecLocalInitMessage();
 int RecLocalStart(FileManager *);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecMutex.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecMutex.h b/lib/records/I_RecMutex.h
index ace1d26..1d6d498 100644
--- a/lib/records/I_RecMutex.h
+++ b/lib/records/I_RecMutex.h
@@ -32,16 +32,15 @@
   by the SAME thread. This is a trimmed down version of ProxyMutex.
 
 */
-struct RecMutex
-{
+struct RecMutex {
   size_t nthread_holding;
   ink_thread thread_holding;
   ink_mutex the_mutex;
 };
 
-int rec_mutex_init(RecMutex * m, const char *name = NULL);
-int rec_mutex_destroy(RecMutex * m);
-int rec_mutex_acquire(RecMutex * m);
-int rec_mutex_release(RecMutex * m);
+int rec_mutex_init(RecMutex *m, const char *name = NULL);
+int rec_mutex_destroy(RecMutex *m);
+int rec_mutex_acquire(RecMutex *m);
+int rec_mutex_release(RecMutex *m);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecProcess.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecProcess.h b/lib/records/I_RecProcess.h
index 123041e..dd1e08d 100644
--- a/lib/records/I_RecProcess.h
+++ b/lib/records/I_RecProcess.h
@@ -31,7 +31,7 @@
 //-------------------------------------------------------------------------
 // Initialization/Starting
 //-------------------------------------------------------------------------
-int RecProcessInit(RecModeT mode_type, Diags * diags = NULL);
+int RecProcessInit(RecModeT mode_type, Diags *diags = NULL);
 int RecProcessInitMessage(RecModeT mode_type);
 int RecProcessStart(void);
 
@@ -47,7 +47,8 @@ void RecProcess_set_remote_sync_interval_ms(int ms);
 //-------------------------------------------------------------------------
 RecRawStatBlock *RecAllocateRawStatBlock(int num_stats);
 
-int _RecRegisterRawStat(RecRawStatBlock * rsb, RecT rec_type, const char *name, RecDataT data_type, RecPersistT persist_type, int id, RecRawStatSyncCb sync_cb);
+int _RecRegisterRawStat(RecRawStatBlock *rsb, RecT rec_type, const char *name, RecDataT data_type, RecPersistT persist_type, int id,
+                        RecRawStatSyncCb sync_cb);
 #define RecRegisterRawStat(rsb, rec_type, name, data_type, persist_type, id, sync_cb) \
   _RecRegisterRawStat((rsb), (rec_type), (name), (data_type), REC_PERSISTENCE_TYPE(persist_type), (id), (sync_cb))
 
@@ -65,13 +66,12 @@ int _RecRegisterRawStat(RecRawStatBlock * rsb, RecT rec_type, const char *name,
 //-------------------------------------------------------------------------
 // Predefined RawStat Callbacks
 //-------------------------------------------------------------------------
-int RecRawStatSyncSum(const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
-int RecRawStatSyncCount(const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
-int RecRawStatSyncAvg(const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
-int RecRawStatSyncHrTimeAvg(const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
-int RecRawStatSyncIntMsecsToFloatSeconds(const char *name, RecDataT data_type,
-                                         RecData * data, RecRawStatBlock * rsb, int id);
-int RecRawStatSyncMHrTimeAvg(const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
+int RecRawStatSyncSum(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
+int RecRawStatSyncCount(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
+int RecRawStatSyncAvg(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
+int RecRawStatSyncHrTimeAvg(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
+int RecRawStatSyncIntMsecsToFloatSeconds(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
+int RecRawStatSyncMHrTimeAvg(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
 
 
 //-------------------------------------------------------------------------
@@ -81,35 +81,35 @@ int RecRawStatSyncMHrTimeAvg(const char *name, RecDataT data_type, RecData * dat
 // Note: The following RecIncrRawStatXXX calls are fast and don't
 // require any ink_atomic_xxx64()'s to be executed.  Use these RawStat
 // functions over other RawStat functions whenever possible.
-inline int RecIncrRawStat(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr = 1);
-inline int RecIncrRawStatSum(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr = 1);
-inline int RecIncrRawStatCount(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr = 1);
-int RecIncrRawStatBlock(RecRawStatBlock * rsb, EThread * ethread, RecRawStat * stat_array);
+inline int RecIncrRawStat(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t incr = 1);
+inline int RecIncrRawStatSum(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t incr = 1);
+inline int RecIncrRawStatCount(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t incr = 1);
+int RecIncrRawStatBlock(RecRawStatBlock *rsb, EThread *ethread, RecRawStat *stat_array);
 
-int RecSetRawStatSum(RecRawStatBlock * rsb, int id, int64_t data);
-int RecSetRawStatCount(RecRawStatBlock * rsb, int id, int64_t data);
-int RecSetRawStatBlock(RecRawStatBlock * rsb, RecRawStat * stat_array);
+int RecSetRawStatSum(RecRawStatBlock *rsb, int id, int64_t data);
+int RecSetRawStatCount(RecRawStatBlock *rsb, int id, int64_t data);
+int RecSetRawStatBlock(RecRawStatBlock *rsb, RecRawStat *stat_array);
 
-int RecGetRawStatSum(RecRawStatBlock * rsb, int id, int64_t * data);
-int RecGetRawStatCount(RecRawStatBlock * rsb, int id, int64_t * data);
+int RecGetRawStatSum(RecRawStatBlock *rsb, int id, int64_t *data);
+int RecGetRawStatCount(RecRawStatBlock *rsb, int id, int64_t *data);
 
 
 //-------------------------------------------------------------------------
 // Global RawStat Items (e.g. same as above, but no thread-local behavior)
 //-------------------------------------------------------------------------
-int RecIncrGlobalRawStat(RecRawStatBlock * rsb, int id, int64_t incr = 1);
-int RecIncrGlobalRawStatSum(RecRawStatBlock * rsb, int id, int64_t incr = 1);
-int RecIncrGlobalRawStatCount(RecRawStatBlock * rsb, int id, int64_t incr = 1);
+int RecIncrGlobalRawStat(RecRawStatBlock *rsb, int id, int64_t incr = 1);
+int RecIncrGlobalRawStatSum(RecRawStatBlock *rsb, int id, int64_t incr = 1);
+int RecIncrGlobalRawStatCount(RecRawStatBlock *rsb, int id, int64_t incr = 1);
 
-int RecSetGlobalRawStatSum(RecRawStatBlock * rsb, int id, int64_t data);
-int RecSetGlobalRawStatCount(RecRawStatBlock * rsb, int id, int64_t data);
+int RecSetGlobalRawStatSum(RecRawStatBlock *rsb, int id, int64_t data);
+int RecSetGlobalRawStatCount(RecRawStatBlock *rsb, int id, int64_t data);
 
-int RecGetGlobalRawStatSum(RecRawStatBlock * rsb, int id, int64_t * data);
-int RecGetGlobalRawStatCount(RecRawStatBlock * rsb, int id, int64_t * data);
+int RecGetGlobalRawStatSum(RecRawStatBlock *rsb, int id, int64_t *data);
+int RecGetGlobalRawStatCount(RecRawStatBlock *rsb, int id, int64_t *data);
 
-RecRawStat *RecGetGlobalRawStatPtr(RecRawStatBlock * rsb, int id);
-int64_t *RecGetGlobalRawStatSumPtr(RecRawStatBlock * rsb, int id);
-int64_t *RecGetGlobalRawStatCountPtr(RecRawStatBlock * rsb, int id);
+RecRawStat *RecGetGlobalRawStatPtr(RecRawStatBlock *rsb, int id);
+int64_t *RecGetGlobalRawStatSumPtr(RecRawStatBlock *rsb, int id);
+int64_t *RecGetGlobalRawStatCountPtr(RecRawStatBlock *rsb, int id);
 
 
 //-------------------------------------------------------------------------
@@ -118,17 +118,17 @@ int64_t *RecGetGlobalRawStatCountPtr(RecRawStatBlock * rsb, int id);
 // inlined functions that are used very frequently.
 // FIXME: move it to Inline.cc
 inline RecRawStat *
-raw_stat_get_tlp(RecRawStatBlock * rsb, int id, EThread * ethread)
+raw_stat_get_tlp(RecRawStatBlock *rsb, int id, EThread *ethread)
 {
   ink_assert((id >= 0) && (id < rsb->max_stats));
   if (ethread == NULL) {
     ethread = this_ethread();
   }
-  return (((RecRawStat *) ((char *) (ethread) + rsb->ethr_stat_offset)) + id);
+  return (((RecRawStat *)((char *)(ethread) + rsb->ethr_stat_offset)) + id);
 }
 
 inline int
-RecIncrRawStat(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr)
+RecIncrRawStat(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t incr)
 {
   RecRawStat *tlp = raw_stat_get_tlp(rsb, id, ethread);
   tlp->sum += incr;
@@ -137,7 +137,7 @@ RecIncrRawStat(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr)
 }
 
 inline int
-RecDecrRawStat(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t decr)
+RecDecrRawStat(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t decr)
 {
   RecRawStat *tlp = raw_stat_get_tlp(rsb, id, ethread);
   tlp->sum -= decr;
@@ -146,7 +146,7 @@ RecDecrRawStat(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t decr)
 }
 
 inline int
-RecIncrRawStatSum(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr)
+RecIncrRawStatSum(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t incr)
 {
   RecRawStat *tlp = raw_stat_get_tlp(rsb, id, ethread);
   tlp->sum += incr;
@@ -154,7 +154,7 @@ RecIncrRawStatSum(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr
 }
 
 inline int
-RecIncrRawStatCount(RecRawStatBlock * rsb, EThread * ethread, int id, int64_t incr)
+RecIncrRawStatCount(RecRawStatBlock *rsb, EThread *ethread, int id, int64_t incr)
 {
   RecRawStat *tlp = raw_stat_get_tlp(rsb, id, ethread);
   tlp->count += incr;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecSignals.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecSignals.h b/lib/records/I_RecSignals.h
index 1461c45..28f2ed8 100644
--- a/lib/records/I_RecSignals.h
+++ b/lib/records/I_RecSignals.h
@@ -25,24 +25,24 @@
 #define _I_REC_SIGNALS_H_
 
 // copy from mgmt/BaseManager.h
-#define REC_SIGNAL_PID                          0
-#define REC_SIGNAL_MACHINE_UP                   1
-#define REC_SIGNAL_MACHINE_DOWN                 2
-#define REC_SIGNAL_CONFIG_ERROR                 3
-#define REC_SIGNAL_SYSTEM_ERROR                 4
-#define REC_SIGNAL_LOG_SPACE_CRISIS             5
-#define REC_SIGNAL_CONFIG_FILE_READ             6
-#define REC_SIGNAL_CACHE_ERROR                  7
-#define REC_SIGNAL_CACHE_WARNING                8
-#define REC_SIGNAL_LOGGING_ERROR                9
-#define REC_SIGNAL_LOGGING_WARNING              10
+#define REC_SIGNAL_PID 0
+#define REC_SIGNAL_MACHINE_UP 1
+#define REC_SIGNAL_MACHINE_DOWN 2
+#define REC_SIGNAL_CONFIG_ERROR 3
+#define REC_SIGNAL_SYSTEM_ERROR 4
+#define REC_SIGNAL_LOG_SPACE_CRISIS 5
+#define REC_SIGNAL_CONFIG_FILE_READ 6
+#define REC_SIGNAL_CACHE_ERROR 7
+#define REC_SIGNAL_CACHE_WARNING 8
+#define REC_SIGNAL_LOGGING_ERROR 9
+#define REC_SIGNAL_LOGGING_WARNING 10
 // Currently unused: 11
-#define REC_SIGNAL_PLUGIN_CONFIG_REG            12
-#define REC_SIGNAL_PLUGIN_ADD_REC               13
-#define REC_SIGNAL_PLUGIN_SET_CONFIG            14
-#define REC_SIGNAL_LOG_FILES_ROLLED             15
-#define REC_SIGNAL_LIBRECORDS                   16
-#define REC_SIGNAL_HTTP_CONGESTED_SERVER        20
-#define REC_SIGNAL_HTTP_ALLEVIATED_SERVER       21
+#define REC_SIGNAL_PLUGIN_CONFIG_REG 12
+#define REC_SIGNAL_PLUGIN_ADD_REC 13
+#define REC_SIGNAL_PLUGIN_SET_CONFIG 14
+#define REC_SIGNAL_LOG_FILES_ROLLED 15
+#define REC_SIGNAL_LIBRECORDS 16
+#define REC_SIGNAL_HTTP_CONGESTED_SERVER 20
+#define REC_SIGNAL_HTTP_ALLEVIATED_SERVER 21
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/P_RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/P_RecCore.cc b/lib/records/P_RecCore.cc
index abe222d..7a896f9 100644
--- a/lib/records/P_RecCore.cc
+++ b/lib/records/P_RecCore.cc
@@ -40,7 +40,7 @@ RecModeT g_mode_type = RECM_NULL;
 // send_reset_message
 //-------------------------------------------------------------------------
 static int
-send_reset_message(RecRecord * record)
+send_reset_message(RecRecord *record)
 {
   RecMessage *m;
 
@@ -60,7 +60,7 @@ send_reset_message(RecRecord * record)
 // send_set_message
 //-------------------------------------------------------------------------
 static int
-send_set_message(RecRecord * record)
+send_set_message(RecRecord *record)
 {
   RecMessage *m;
 
@@ -80,7 +80,7 @@ send_set_message(RecRecord * record)
 // send_register_message
 //-------------------------------------------------------------------------
 int
-send_register_message(RecRecord * record)
+send_register_message(RecRecord *record)
 {
   RecMessage *m;
 
@@ -143,7 +143,6 @@ send_pull_message(RecMessageT msg_type)
 
   m = RecMessageAlloc(msg_type);
   switch (msg_type) {
-
   case RECG_PULL_REQ:
     // We're requesting all of the records from our peer.  No payload
     // here, just send the message.
@@ -157,8 +156,7 @@ send_pull_message(RecMessageT msg_type)
     num_records = g_num_records;
     for (i = 0; i < num_records; i++) {
       r = &(g_records[i]);
-      if (i_am_the_record_owner(r->rec_type) ||
-          (REC_TYPE_IS_STAT(r->rec_type) && !(r->registered)) ||
+      if (i_am_the_record_owner(r->rec_type) || (REC_TYPE_IS_STAT(r->rec_type) && !(r->registered)) ||
           (REC_TYPE_IS_STAT(r->rec_type) && (r->stat_meta.persist_type == RECP_NON_PERSISTENT))) {
         rec_mutex_acquire(&(r->lock));
         m = RecMessageMarshal_Realloc(m, r);
@@ -172,7 +170,6 @@ send_pull_message(RecMessageT msg_type)
   default:
     RecMessageFree(m);
     return REC_ERR_FAIL;
-
   }
 
   RecMessageSend(m);
@@ -186,13 +183,12 @@ send_pull_message(RecMessageT msg_type)
 // recv_message_cb
 //-------------------------------------------------------------------------
 int
-recv_message_cb(RecMessage * msg, RecMessageT msg_type, void */* cookie */)
+recv_message_cb(RecMessage *msg, RecMessageT msg_type, void * /* cookie */)
 {
   RecRecord *r;
   RecMessageItr itr;
 
   switch (msg_type) {
-
   case RECG_SET:
 
     RecDebug(DL_Note, "[recv] RECG_SET [%d bytes]", sizeof(RecMessageHdr) + msg->o_end - msg->o_start);
@@ -228,8 +224,7 @@ recv_message_cb(RecMessage * msg, RecMessageT msg_type, void */* cookie */)
         if (REC_TYPE_IS_STAT(r->rec_type)) {
           RecRegisterStat(r->rec_type, r->name, r->data_type, r->data_default, r->stat_meta.persist_type);
         } else if (REC_TYPE_IS_CONFIG(r->rec_type)) {
-          RecRegisterConfig(r->rec_type, r->name, r->data_type,
-                            r->data_default, r->config_meta.update_type,
+          RecRegisterConfig(r->rec_type, r->name, r->data_type, r->data_default, r->config_meta.update_type,
                             r->config_meta.check_type, r->config_meta.check_expr, r->config_meta.access_type);
         }
       } while (RecMessageUnmarshalNext(msg, &itr, &r) != REC_ERR_FAIL);
@@ -262,7 +257,6 @@ recv_message_cb(RecMessage * msg, RecMessageT msg_type, void */* cookie */)
   default:
     ink_assert(!"Unexpected RecG type");
     return REC_ERR_FAIL;
-
   }
 
   return REC_ERR_OKAY;
@@ -272,25 +266,21 @@ recv_message_cb(RecMessage * msg, RecMessageT msg_type, void */* cookie */)
 //-------------------------------------------------------------------------
 // RecRegisterStatXXX
 //-------------------------------------------------------------------------
-#define REC_REGISTER_STAT_XXX(A, B) \
-  ink_assert((rec_type == RECT_NODE)    || \
-                   (rec_type == RECT_CLUSTER) || \
-                   (rec_type == RECT_PROCESS) || \
-                   (rec_type == RECT_LOCAL)   || \
-                   (rec_type == RECT_PLUGIN));   \
-  RecRecord *r; \
-  RecData my_data_default; \
-  my_data_default.A = data_default; \
-  if ((r = RecRegisterStat(rec_type, name, B, my_data_default, \
-                           persist_type)) != NULL) { \
-    if (i_am_the_record_owner(r->rec_type)) { \
-      r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED; \
-    } else { \
-      send_register_message(r); \
-    } \
-    return REC_ERR_OKAY; \
-  } else { \
-    return REC_ERR_FAIL; \
+#define REC_REGISTER_STAT_XXX(A, B)                                                                                             \
+  ink_assert((rec_type == RECT_NODE) || (rec_type == RECT_CLUSTER) || (rec_type == RECT_PROCESS) || (rec_type == RECT_LOCAL) || \
+             (rec_type == RECT_PLUGIN));                                                                                        \
+  RecRecord *r;                                                                                                                 \
+  RecData my_data_default;                                                                                                      \
+  my_data_default.A = data_default;                                                                                             \
+  if ((r = RecRegisterStat(rec_type, name, B, my_data_default, persist_type)) != NULL) {                                        \
+    if (i_am_the_record_owner(r->rec_type)) {                                                                                   \
+      r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED;                                                             \
+    } else {                                                                                                                    \
+      send_register_message(r);                                                                                                 \
+    }                                                                                                                           \
+    return REC_ERR_OKAY;                                                                                                        \
+  } else {                                                                                                                      \
+    return REC_ERR_FAIL;                                                                                                        \
   }
 
 int
@@ -321,36 +311,32 @@ _RecRegisterStatCounter(RecT rec_type, const char *name, RecCounter data_default
 //-------------------------------------------------------------------------
 // RecRegisterConfigXXX
 //-------------------------------------------------------------------------
-#define REC_REGISTER_CONFIG_XXX(A, B) \
-  RecRecord *r; \
-  RecData my_data_default; \
-  my_data_default.A = data_default; \
-  if ((r = RecRegisterConfig(rec_type, name, B, my_data_default, \
-                             update_type, check_type,              \
-                             check_regex, access_type)) != NULL) { \
-    if (i_am_the_record_owner(r->rec_type)) { \
-      r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED; \
-    } else { \
-      send_register_message(r); \
-    } \
-    return REC_ERR_OKAY; \
-  } else { \
-    return REC_ERR_FAIL; \
+#define REC_REGISTER_CONFIG_XXX(A, B)                                                                                           \
+  RecRecord *r;                                                                                                                 \
+  RecData my_data_default;                                                                                                      \
+  my_data_default.A = data_default;                                                                                             \
+  if ((r = RecRegisterConfig(rec_type, name, B, my_data_default, update_type, check_type, check_regex, access_type)) != NULL) { \
+    if (i_am_the_record_owner(r->rec_type)) {                                                                                   \
+      r->sync_required = r->sync_required | REC_PEER_SYNC_REQUIRED;                                                             \
+    } else {                                                                                                                    \
+      send_register_message(r);                                                                                                 \
+    }                                                                                                                           \
+    return REC_ERR_OKAY;                                                                                                        \
+  } else {                                                                                                                      \
+    return REC_ERR_FAIL;                                                                                                        \
   }
 
 int
-RecRegisterConfigInt(RecT rec_type, const char *name,
-                     RecInt data_default, RecUpdateT update_type,
-                     RecCheckT check_type, const char *check_regex, RecAccessT access_type)
+RecRegisterConfigInt(RecT rec_type, const char *name, RecInt data_default, RecUpdateT update_type, RecCheckT check_type,
+                     const char *check_regex, RecAccessT access_type)
 {
   ink_assert((rec_type == RECT_CONFIG) || (rec_type == RECT_LOCAL));
   REC_REGISTER_CONFIG_XXX(rec_int, RECD_INT);
 }
 
 int
-RecRegisterConfigFloat(RecT rec_type, const char *name,
-                       RecFloat data_default, RecUpdateT update_type,
-                       RecCheckT check_type, const char *check_regex, RecAccessT access_type)
+RecRegisterConfigFloat(RecT rec_type, const char *name, RecFloat data_default, RecUpdateT update_type, RecCheckT check_type,
+                       const char *check_regex, RecAccessT access_type)
 {
   ink_assert((rec_type == RECT_CONFIG) || (rec_type == RECT_LOCAL));
   REC_REGISTER_CONFIG_XXX(rec_float, RECD_FLOAT);
@@ -358,9 +344,8 @@ RecRegisterConfigFloat(RecT rec_type, const char *name,
 
 
 int
-RecRegisterConfigString(RecT rec_type, const char *name,
-                        const char *data_default_tmp, RecUpdateT update_type,
-                        RecCheckT check_type, const char *check_regex, RecAccessT access_type)
+RecRegisterConfigString(RecT rec_type, const char *name, const char *data_default_tmp, RecUpdateT update_type, RecCheckT check_type,
+                        const char *check_regex, RecAccessT access_type)
 {
   RecString data_default = (RecString)data_default_tmp;
   ink_assert((rec_type == RECT_CONFIG) || (rec_type == RECT_LOCAL));
@@ -368,9 +353,8 @@ RecRegisterConfigString(RecT rec_type, const char *name,
 }
 
 int
-RecRegisterConfigCounter(RecT rec_type, const char *name,
-                         RecCounter data_default, RecUpdateT update_type,
-                         RecCheckT check_type, const char *check_regex, RecAccessT access_type)
+RecRegisterConfigCounter(RecT rec_type, const char *name, RecCounter data_default, RecUpdateT update_type, RecCheckT check_type,
+                         const char *check_regex, RecAccessT access_type)
 {
   ink_assert((rec_type == RECT_CONFIG) || (rec_type == RECT_LOCAL));
   REC_REGISTER_CONFIG_XXX(rec_counter, RECD_COUNTER);
@@ -392,7 +376,7 @@ RecSetRecord(RecT rec_type, const char *name, RecDataT data_type, RecData *data,
     ink_rwlock_wrlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r1)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r1)) {
     if (i_am_the_record_owner(r1->rec_type)) {
       rec_mutex_acquire(&(r1->lock));
       if ((data_type != RECD_NULL) && (r1->data_type != data_type)) {
@@ -473,8 +457,7 @@ RecSetRecord(RecT rec_type, const char *name, RecDataT data_type, RecData *data,
     } else {
       err = send_set_message(r1);
     }
-    ink_hash_table_insert(g_records_ht, name, (void *) r1);
-
+    ink_hash_table_insert(g_records_ht, name, (void *)r1);
   }
 
 Ldone:
@@ -628,14 +611,14 @@ RecSyncStatsFile()
 
 // Consume a parsed record, pushing it into the records hash table.
 static void
-RecConsumeConfigEntry(RecT rec_type, RecDataT data_type, const char * name, const char * value, bool inc_version)
+RecConsumeConfigEntry(RecT rec_type, RecDataT data_type, const char *name, const char *value, bool inc_version)
 {
-    RecData data;
+  RecData data;
 
-    memset(&data, 0, sizeof(RecData));
-    RecDataSetFromString(data_type, &data, value);
-    RecSetRecord(rec_type, name, data_type, &data, NULL, false, inc_version);
-    RecDataClear(data_type, &data);
+  memset(&data, 0, sizeof(RecData));
+  RecDataSetFromString(data_type, &data, value);
+  RecSetRecord(rec_type, name, data_type, &data, NULL, false, inc_version);
+  RecDataClear(data_type, &data);
 }
 
 //-------------------------------------------------------------------------
@@ -663,7 +646,7 @@ RecReadConfigFile(bool inc_version)
 // RecSyncConfigFile
 //-------------------------------------------------------------------------
 int
-RecSyncConfigToTB(textBuffer * tb, bool *inc_version)
+RecSyncConfigToTB(textBuffer *tb, bool *inc_version)
 {
   int err = REC_ERR_FAIL;
 
@@ -695,7 +678,7 @@ RecSyncConfigToTB(textBuffer * tb, bool *inc_version)
             cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
             cfe->entry_type = RECE_RECORD;
             cfe->entry = ats_strdup(r->name);
-            enqueue(g_rec_config_contents_llq, (void *) cfe);
+            enqueue(g_rec_config_contents_llq, (void *)cfe);
             ink_hash_table_insert(g_rec_config_contents_ht, r->name, NULL);
           }
           r->sync_required = r->sync_required & ~REC_DISK_SYNC_REQUIRED;
@@ -722,12 +705,12 @@ RecSyncConfigToTB(textBuffer * tb, bool *inc_version)
 
       LLQrec *llq_rec = g_rec_config_contents_llq->head;
       while (llq_rec != NULL) {
-        cfe = (RecConfigFileEntry *) llq_rec->data;
+        cfe = (RecConfigFileEntry *)llq_rec->data;
         if (cfe->entry_type == RECE_COMMENT) {
           tb->copyFrom(cfe->entry, strlen(cfe->entry));
           tb->copyFrom("\n", 1);
         } else {
-          if (ink_hash_table_lookup(g_records_ht, cfe->entry, (void **) &r)) {
+          if (ink_hash_table_lookup(g_records_ht, cfe->entry, (void **)&r)) {
             rec_mutex_acquire(&(r->lock));
             // rec_type
             switch (r->rec_type) {
@@ -831,7 +814,7 @@ RecExecConfigUpdateCbs(unsigned int update_required_type)
       if ((r->config_meta.update_required & update_required_type) && (r->config_meta.update_cb_list)) {
         RecConfigUpdateCbList *cur_callback = NULL;
         for (cur_callback = r->config_meta.update_cb_list; cur_callback; cur_callback = cur_callback->next) {
-          (*(cur_callback->update_cb)) (r->name, r->data_type, r->data, cur_callback->update_cookie);
+          (*(cur_callback->update_cb))(r->name, r->data_type, r->data, cur_callback->update_cookie);
         }
         r->config_meta.update_required = r->config_meta.update_required & ~update_required_type;
       }
@@ -852,7 +835,7 @@ RecResetStatRecord(const char *name)
   RecRecord *r1 = NULL;
   int err = REC_ERR_OKAY;
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r1)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r1)) {
     if (i_am_the_record_owner(r1->rec_type)) {
       rec_mutex_acquire(&(r1->lock));
       ++(r1->version);
@@ -895,8 +878,7 @@ RecResetStatRecord(RecT type, bool all)
     RecRecord *r1 = &(g_records[i]);
 
     if (REC_TYPE_IS_STAT(r1->rec_type) && ((type == RECT_NULL) || (r1->rec_type == type)) &&
-        (all || (r1->stat_meta.persist_type != RECP_NON_PERSISTENT)) &&
-        (r1->data_type != RECD_STRING)) {
+        (all || (r1->stat_meta.persist_type != RECP_NON_PERSISTENT)) && (r1->data_type != RECD_STRING)) {
       if (i_am_the_record_owner(r1->rec_type)) {
         rec_mutex_acquire(&(r1->lock));
         ++(r1->version);
@@ -934,7 +916,7 @@ RecSetSyncRequired(char *name, bool lock)
     ink_rwlock_wrlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r1)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r1)) {
     if (i_am_the_record_owner(r1->rec_type)) {
       rec_mutex_acquire(&(r1->lock));
       r1->sync_required = REC_SYNC_REQUIRED;
@@ -971,7 +953,8 @@ RecSetSyncRequired(char *name, bool lock)
   return err;
 }
 
-int RecWriteConfigFile(textBuffer *tb)
+int
+RecWriteConfigFile(textBuffer *tb)
 {
 #define TMP_FILENAME_EXT_STR ".tmp"
 #define TMP_FILENAME_EXT_LEN (sizeof(TMP_FILENAME_EXT_STR) - 1)
@@ -997,15 +980,13 @@ int RecWriteConfigFile(textBuffer *tb)
   RecHandle h_file = RecFileOpenW(tmp_filename);
   do {
     if (h_file == REC_HANDLE_INVALID) {
-      RecLog(DL_Warning, "open file: %s to write fail, errno: %d, error info: %s",
-          tmp_filename, errno, strerror(errno));
+      RecLog(DL_Warning, "open file: %s to write fail, errno: %d, error info: %s", tmp_filename, errno, strerror(errno));
       result = REC_ERR_FAIL;
       break;
     }
 
     if (RecFileWrite(h_file, tb->bufPtr(), tb->spaceUsed(), &nbytes) != REC_ERR_OKAY) {
-      RecLog(DL_Warning, "write to file: %s fail, errno: %d, error info: %s",
-          tmp_filename, errno, strerror(errno));
+      RecLog(DL_Warning, "write to file: %s fail, errno: %d, error info: %s", tmp_filename, errno, strerror(errno));
       result = REC_ERR_FAIL;
       break;
     }
@@ -1017,22 +998,20 @@ int RecWriteConfigFile(textBuffer *tb)
     }
 
     if (RecFileSync(h_file) != REC_ERR_OKAY) {
-      RecLog(DL_Warning, "fsync file: %s fail, errno: %d, error info: %s",
-          tmp_filename, errno, strerror(errno));
+      RecLog(DL_Warning, "fsync file: %s fail, errno: %d, error info: %s", tmp_filename, errno, strerror(errno));
       result = REC_ERR_FAIL;
       break;
     }
     if (RecFileClose(h_file) != REC_ERR_OKAY) {
-      RecLog(DL_Warning, "close file: %s fail, errno: %d, error info: %s",
-          tmp_filename, errno, strerror(errno));
+      RecLog(DL_Warning, "close file: %s fail, errno: %d, error info: %s", tmp_filename, errno, strerror(errno));
       result = REC_ERR_FAIL;
       break;
     }
     h_file = REC_HANDLE_INVALID;
 
     if (rename(tmp_filename, g_rec_config_fpath) != 0) {
-      RecLog(DL_Warning, "rename file %s to %s fail, errno: %d, error info: %s",
-          tmp_filename, g_rec_config_fpath, errno, strerror(errno));
+      RecLog(DL_Warning, "rename file %s to %s fail, errno: %d, error info: %s", tmp_filename, g_rec_config_fpath, errno,
+             strerror(errno));
       result = REC_ERR_FAIL;
       break;
     }
@@ -1048,4 +1027,3 @@ int RecWriteConfigFile(textBuffer *tb)
   }
   return result;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/P_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecCore.h b/lib/records/P_RecCore.h
index 92d0c2e..6f9b6e2 100644
--- a/lib/records/P_RecCore.h
+++ b/lib/records/P_RecCore.h
@@ -51,29 +51,27 @@ extern ink_mutex g_rec_config_lock;
 // Initialization
 //-------------------------------------------------------------------------
 
-int RecCoreInit(RecModeT mode_type, Diags * diags);
+int RecCoreInit(RecModeT mode_type, Diags *diags);
 
 //-------------------------------------------------------------------------
 // Registration/Insertion
 //-------------------------------------------------------------------------
 
-RecRecord *RecRegisterStat(RecT rec_type, const char *name, RecDataT data_type,
-                           RecData data_default, RecPersistT persist_type);
+RecRecord *RecRegisterStat(RecT rec_type, const char *name, RecDataT data_type, RecData data_default, RecPersistT persist_type);
 
-RecRecord *RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type,
-                             RecData data_default, RecUpdateT update_type,
+RecRecord *RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type, RecData data_default, RecUpdateT update_type,
                              RecCheckT check_type, const char *check_regex, RecAccessT access_type = RECA_NULL);
 
-RecRecord *RecForceInsert(RecRecord * record);
+RecRecord *RecForceInsert(RecRecord *record);
 
 //-------------------------------------------------------------------------
 // Setting/Getting
 //-------------------------------------------------------------------------
 
-int RecSetRecord(RecT rec_type, const char *name, RecDataT data_type,
-                 RecData *data, RecRawStat *raw_stat, bool lock = true, bool inc_version = true);
+int RecSetRecord(RecT rec_type, const char *name, RecDataT data_type, RecData *data, RecRawStat *raw_stat, bool lock = true,
+                 bool inc_version = true);
 
-int RecGetRecord_Xmalloc(const char *name, RecDataT data_type, RecData * data, bool lock = true);
+int RecGetRecord_Xmalloc(const char *name, RecDataT data_type, RecData *data, bool lock = true);
 
 //-------------------------------------------------------------------------
 // Read/Sync to Disk
@@ -83,7 +81,7 @@ int RecReadStatsFile();
 int RecSyncStatsFile();
 int RecReadConfigFile(bool inc_version);
 int RecWriteConfigFile(textBuffer *tb);
-int RecSyncConfigToTB(textBuffer * tb, bool *inc_version = NULL);
+int RecSyncConfigToTB(textBuffer *tb, bool *inc_version = NULL);
 
 //-------------------------------------------------------------------------
 // Misc
@@ -92,15 +90,14 @@ int RecSyncConfigToTB(textBuffer * tb, bool *inc_version = NULL);
 bool i_am_the_record_owner(RecT rec_type);
 int send_push_message();
 int send_pull_message(RecMessageT msg_type);
-int send_register_message(RecRecord * record);
-int recv_message_cb(RecMessage * msg, RecMessageT msg_type, void *cookie);
+int send_register_message(RecRecord *record);
+int recv_message_cb(RecMessage *msg, RecMessageT msg_type, void *cookie);
 RecUpdateT RecExecConfigUpdateCbs(unsigned int update_required_type);
 int RecExecStatUpdateFuncs();
 int RecExecRawStatUpdateFuncs();
 
 void RecDumpRecordsHt(RecT rec_type = RECT_NULL);
 
-void
-RecDumpRecords(RecT rec_type, RecDumpEntryCb callback, void *edata);
+void RecDumpRecords(RecT rec_type, RecDumpEntryCb callback, void *edata);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/P_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecDefs.h b/lib/records/P_RecDefs.h
index 17cfbb2..4e63d88 100644
--- a/lib/records/P_RecDefs.h
+++ b/lib/records/P_RecDefs.h
@@ -26,59 +26,55 @@
 
 #include "I_RecDefs.h"
 
-#define REC_CONFIG_FILE                "records.config"
-#define REC_SHADOW_EXT                 ".shadow"
-#define REC_RAW_STATS_FILE             "records.snap"
-#define REC_PIPE_NAME                  "librecords_pipe"
+#define REC_CONFIG_FILE "records.config"
+#define REC_SHADOW_EXT ".shadow"
+#define REC_RAW_STATS_FILE "records.snap"
+#define REC_PIPE_NAME "librecords_pipe"
 
-#define REC_MESSAGE_ELE_MAGIC           0xF00DF00D
+#define REC_MESSAGE_ELE_MAGIC 0xF00DF00D
 
 // This is for the internal stats and configs, as well as API stats. We currently use
 // about 1600 stats + configs for the core, but we're allocating 2000 for some growth.
 // TODO: if/when we switch to a new config system, we should make this run-time dynamic.
-#define REC_MAX_RECORDS                 (2000 + TS_MAX_API_STATS)
+#define REC_MAX_RECORDS (2000 + TS_MAX_API_STATS)
 
-#define REC_CONFIG_UPDATE_INTERVAL_MS  3000
-#define REC_REMOTE_SYNC_INTERVAL_MS    5000
+#define REC_CONFIG_UPDATE_INTERVAL_MS 3000
+#define REC_REMOTE_SYNC_INTERVAL_MS 5000
 
-#define REC_RAW_STAT_SYNC_INTERVAL_MS  5000
-#define REC_STAT_UPDATE_INTERVAL_MS    10000
+#define REC_RAW_STAT_SYNC_INTERVAL_MS 5000
+#define REC_STAT_UPDATE_INTERVAL_MS 10000
 
 //-------------------------------------------------------------------------
 // Record Items
 //-------------------------------------------------------------------------
 
-#define REC_LOCAL_UPDATE_REQUIRED       1
-#define REC_PROCESS_UPDATE_REQUIRED     (REC_LOCAL_UPDATE_REQUIRED << 1)
-#define REC_UPDATE_REQUIRED             (REC_LOCAL_UPDATE_REQUIRED | REC_PROCESS_UPDATE_REQUIRED)
+#define REC_LOCAL_UPDATE_REQUIRED 1
+#define REC_PROCESS_UPDATE_REQUIRED (REC_LOCAL_UPDATE_REQUIRED << 1)
+#define REC_UPDATE_REQUIRED (REC_LOCAL_UPDATE_REQUIRED | REC_PROCESS_UPDATE_REQUIRED)
 
-#define REC_DISK_SYNC_REQUIRED          1
-#define REC_PEER_SYNC_REQUIRED          (REC_DISK_SYNC_REQUIRED << 1)
-#define REC_INC_CONFIG_VERSION          (REC_PEER_SYNC_REQUIRED << 1)
-#define REC_SYNC_REQUIRED               (REC_DISK_SYNC_REQUIRED | REC_PEER_SYNC_REQUIRED)
+#define REC_DISK_SYNC_REQUIRED 1
+#define REC_PEER_SYNC_REQUIRED (REC_DISK_SYNC_REQUIRED << 1)
+#define REC_INC_CONFIG_VERSION (REC_PEER_SYNC_REQUIRED << 1)
+#define REC_SYNC_REQUIRED (REC_DISK_SYNC_REQUIRED | REC_PEER_SYNC_REQUIRED)
 
-enum RecEntryT
-{
+enum RecEntryT {
   RECE_NULL,
   RECE_COMMENT,
-  RECE_RECORD
+  RECE_RECORD,
 };
 
-struct RecConfigFileEntry
-{
+struct RecConfigFileEntry {
   RecEntryT entry_type;
   char *entry;
 };
 
-typedef struct RecConfigCbList_t
-{
+typedef struct RecConfigCbList_t {
   RecConfigUpdateCb update_cb;
   void *update_cookie;
   struct RecConfigCbList_t *next;
 } RecConfigUpdateCbList;
 
-typedef struct RecStatUpdateFuncList_t
-{
+typedef struct RecStatUpdateFuncList_t {
   RecRawStatBlock *rsb;
   int id;
   RecStatUpdateFunc update_func;
@@ -86,8 +82,7 @@ typedef struct RecStatUpdateFuncList_t
   struct RecStatUpdateFuncList_t *next;
 } RecStatUpdateFuncList;
 
-struct RecStatMeta
-{
+struct RecStatMeta {
   RecRawStat data_raw;
   RecRawStatSyncCb sync_cb;
   RecRawStatBlock *sync_rsb;
@@ -95,8 +90,7 @@ struct RecStatMeta
   RecPersistT persist_type;
 };
 
-struct RecConfigMeta
-{
+struct RecConfigMeta {
   unsigned char update_required;
   RecConfigUpdateCbList *update_cb_list;
   void *update_cookie;
@@ -106,8 +100,7 @@ struct RecConfigMeta
   RecAccessT access_type;
 };
 
-struct RecRecord
-{
+struct RecRecord {
   RecT rec_type;
   const char *name;
   RecDataT data_type;
@@ -117,8 +110,7 @@ struct RecRecord
   unsigned char sync_required;
   uint32_t version;
   bool registered;
-  union
-  {
+  union {
     RecStatMeta stat_meta;
     RecConfigMeta config_meta;
   };
@@ -127,8 +119,7 @@ struct RecRecord
 };
 
 // Used for cluster. TODO: Do we still need this?
-struct RecRecords
-{
+struct RecRecords {
   int num_recs;
   RecRecord *recs;
 };
@@ -137,43 +128,39 @@ struct RecRecords
 // Message Items
 //-------------------------------------------------------------------------
 
-enum RecMessageT
-{
+enum RecMessageT {
   RECG_NULL,
   RECG_SET,
   RECG_REGISTER,
   RECG_PUSH,
   RECG_PULL_REQ,
   RECG_PULL_ACK,
-  RECG_RESET
+  RECG_RESET,
 };
 
-struct RecMessageHdr
-{
+struct RecMessageHdr {
   RecMessageT msg_type;
   int o_start;
   int o_write;
   int o_end;
   int entries;
-  int alignment;                //needs to be 8 byte aligned
+  int alignment; // needs to be 8 byte aligned
 };
 
-struct RecMessageEleHdr
-{
+struct RecMessageEleHdr {
   unsigned int magic;
   int o_next;
 };
 
-struct RecMessageItr
-{
+struct RecMessageItr {
   RecMessageEleHdr *ele_hdr;
   int next;
 };
 
 typedef RecMessageHdr RecMessage;
 
-typedef void (*RecDumpEntryCb) (RecT rec_type, void *edata, int registered, const char *name, int data_type, RecData *datum);
+typedef void (*RecDumpEntryCb)(RecT rec_type, void *edata, int registered, const char *name, int data_type, RecData *datum);
 
-typedef int (*RecMessageRecvCb) (RecMessage * msg, RecMessageT msg_type, void *cookie);
+typedef int (*RecMessageRecvCb)(RecMessage *msg, RecMessageT msg_type, void *cookie);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/P_RecMessage.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecMessage.h b/lib/records/P_RecMessage.h
index 468ff03..2538c02 100644
--- a/lib/records/P_RecMessage.h
+++ b/lib/records/P_RecMessage.h
@@ -30,7 +30,7 @@
 // Initialization
 //-------------------------------------------------------------------------
 
-//int RecMessageInit();
+// int RecMessageInit();
 void RecMessageRegister();
 
 //-------------------------------------------------------------------------
@@ -38,13 +38,13 @@ void RecMessageRegister();
 //-------------------------------------------------------------------------
 
 RecMessage *RecMessageAlloc(RecMessageT msg_type, int initial_size = 256);
-int RecMessageFree(RecMessage * msg);
+int RecMessageFree(RecMessage *msg);
 
-RecMessage *RecMessageMarshal_Realloc(RecMessage * msg, const RecRecord * record);
-int RecMessageUnmarshalFirst(RecMessage * msg, RecMessageItr * itr, RecRecord ** record);
-int RecMessageUnmarshalNext(RecMessage * msg, RecMessageItr * itr, RecRecord ** record);
+RecMessage *RecMessageMarshal_Realloc(RecMessage *msg, const RecRecord *record);
+int RecMessageUnmarshalFirst(RecMessage *msg, RecMessageItr *itr, RecRecord **record);
+int RecMessageUnmarshalNext(RecMessage *msg, RecMessageItr *itr, RecRecord **record);
 
-int RecMessageSend(RecMessage * msg);
+int RecMessageSend(RecMessage *msg);
 int RecMessageRegisterRecvCb(RecMessageRecvCb recv_cb, void *cookie);
 void *RecMessageRecvThis(void *cookie, char *data_raw, int data_len);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/P_RecProcess.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecProcess.h b/lib/records/P_RecProcess.h
index 4ebf774..b271188 100644
--- a/lib/records/P_RecProcess.h
+++ b/lib/records/P_RecProcess.h
@@ -37,7 +37,7 @@
 // Protected Interface
 //-------------------------------------------------------------------------
 
-int RecRegisterRawStatSyncCb(const char *name, RecRawStatSyncCb sync_cb, RecRawStatBlock * rsb, int id);
+int RecRegisterRawStatSyncCb(const char *name, RecRawStatSyncCb sync_cb, RecRawStatBlock *rsb, int id);
 
 int RecExecRawStatSyncCbs();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/P_RecUtils.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecUtils.h b/lib/records/P_RecUtils.h
index de8f018..c7e7eaa 100644
--- a/lib/records/P_RecUtils.h
+++ b/lib/records/P_RecUtils.h
@@ -34,14 +34,9 @@
 //-------------------------------------------------------------------------
 
 #define REC_TYPE_IS_STAT(rec_type) \
-  (((rec_type) == RECT_PROCESS) || \
-   ((rec_type) == RECT_PLUGIN) || \
-   ((rec_type) == RECT_NODE) || \
-   ((rec_type) == RECT_CLUSTER))
+  (((rec_type) == RECT_PROCESS) || ((rec_type) == RECT_PLUGIN) || ((rec_type) == RECT_NODE) || ((rec_type) == RECT_CLUSTER))
 
-#define REC_TYPE_IS_CONFIG(rec_type) \
-  (((rec_type) == RECT_CONFIG) || \
-   ((rec_type) == RECT_LOCAL))
+#define REC_TYPE_IS_CONFIG(rec_type) (((rec_type) == RECT_CONFIG) || ((rec_type) == RECT_LOCAL))
 
 
 //-------------------------------------------------------------------------
@@ -56,13 +51,13 @@ RecRecord *RecAlloc(RecT rec_type, const char *name, RecDataT data_type);
 // RecData Utils
 //-------------------------------------------------------------------------
 
-void RecDataClear(RecDataT type, RecData * data);
-void RecDataSetMax(RecDataT type, RecData * data);
-void RecDataSetMin(RecDataT type, RecData * data);
-bool RecDataSet(RecDataT data_type, RecData * data_dst, RecData * data_src);
-bool RecDataSetFromInk64(RecDataT data_type, RecData * data_dst, int64_t data_int64);
-bool RecDataSetFromFloat(RecDataT data_type, RecData * data_dst, float data_float);
-bool RecDataSetFromString(RecDataT data_type, RecData * data_dst, const char *data_string);
+void RecDataClear(RecDataT type, RecData *data);
+void RecDataSetMax(RecDataT type, RecData *data);
+void RecDataSetMin(RecDataT type, RecData *data);
+bool RecDataSet(RecDataT data_type, RecData *data_dst, RecData *data_src);
+bool RecDataSetFromInk64(RecDataT data_type, RecData *data_dst, int64_t data_int64);
+bool RecDataSetFromFloat(RecDataT data_type, RecData *data_dst, float data_float);
+bool RecDataSetFromString(RecDataT data_type, RecData *data_dst, const char *data_string);
 int RecDataCmp(RecDataT type, RecData left, RecData right);
 RecData RecDataAdd(RecDataT type, RecData left, RecData right);
 RecData RecDataSub(RecDataT type, RecData left, RecData right);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecConfigParse.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecConfigParse.cc b/lib/records/RecConfigParse.cc
index 43b033d..ce418e4 100644
--- a/lib/records/RecConfigParse.cc
+++ b/lib/records/RecConfigParse.cc
@@ -34,10 +34,10 @@
 #include "P_RecCore.h"
 #include "I_Layout.h"
 
-const char     *g_rec_config_fpath = NULL;
-LLQ            *g_rec_config_contents_llq = NULL;
-InkHashTable   *g_rec_config_contents_ht = NULL;
-ink_mutex       g_rec_config_lock;
+const char *g_rec_config_fpath = NULL;
+LLQ *g_rec_config_contents_llq = NULL;
+InkHashTable *g_rec_config_contents_ht = NULL;
+ink_mutex g_rec_config_lock;
 
 //-------------------------------------------------------------------------
 // RecConfigFileInit
@@ -45,9 +45,9 @@ ink_mutex       g_rec_config_lock;
 void
 RecConfigFileInit(void)
 {
-    ink_mutex_init(&g_rec_config_lock, NULL);
-    g_rec_config_contents_llq = create_queue();
-    g_rec_config_contents_ht = ink_hash_table_create(InkHashTableKeyType_String);
+  ink_mutex_init(&g_rec_config_lock, NULL);
+  g_rec_config_contents_llq = create_queue();
+  g_rec_config_contents_ht = ink_hash_table_create(InkHashTableKeyType_String);
 }
 
 //-------------------------------------------------------------------------
@@ -85,16 +85,20 @@ RecFileImport_Xmalloc(const char *file, char **file_buf, int *file_size)
 // RecConfigOverrideFromEnvironment
 //-------------------------------------------------------------------------
 const char *
-RecConfigOverrideFromEnvironment(const char * name, const char * value)
+RecConfigOverrideFromEnvironment(const char *name, const char *value)
 {
   ats_scoped_str envname(ats_strdup(name));
-  const char * envval = NULL;
+  const char *envval = NULL;
 
   // Munge foo.bar.config into FOO_BAR_CONFIG.
-  for (char * c = envname; *c != '\0'; ++c) {
+  for (char *c = envname; *c != '\0'; ++c) {
     switch (*c) {
-      case '.': *c = '_'; break;
-      default: *c = ParseRules::ink_toupper(*c); break;
+    case '.':
+      *c = '_';
+      break;
+    default:
+      *c = ParseRules::ink_toupper(*c);
+      break;
     }
   }
 
@@ -110,7 +114,7 @@ RecConfigOverrideFromEnvironment(const char * name, const char * value)
 // RecParseConfigFile
 //-------------------------------------------------------------------------
 int
-RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_version)
+RecConfigFileParse(const char *path, RecConfigEntryCallback handler, bool inc_version)
 {
   char *fbuf;
   int fsize;
@@ -139,7 +143,7 @@ RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_v
   }
   // clear our g_rec_config_contents_xxx structures
   while (!queue_is_empty(g_rec_config_contents_llq)) {
-    cfe = (RecConfigFileEntry *) dequeue(g_rec_config_contents_llq);
+    cfe = (RecConfigFileEntry *)dequeue(g_rec_config_contents_llq);
     ats_free(cfe->entry);
     ats_free(cfe);
   }
@@ -235,7 +239,7 @@ RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_v
     cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
     cfe->entry_type = RECE_RECORD;
     cfe->entry = ats_strdup(name_str);
-    enqueue(g_rec_config_contents_llq, (void *) cfe);
+    enqueue(g_rec_config_contents_llq, (void *)cfe);
     ink_hash_table_insert(g_rec_config_contents_ht, name_str, NULL);
     goto L_done;
 
@@ -245,7 +249,7 @@ RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_v
     cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
     cfe->entry_type = RECE_COMMENT;
     cfe->entry = ats_strdup(line);
-    enqueue(g_rec_config_contents_llq, (void *) cfe);
+    enqueue(g_rec_config_contents_llq, (void *)cfe);
 
   L_done:
     line = line_tok.iterNext(&line_tok_state);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index f24cd84..b326e14 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -43,7 +43,7 @@ register_record(RecT rec_type, const char *name, RecDataT data_type, RecData dat
 {
   RecRecord *r = NULL;
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     ink_release_assert(r->rec_type == rec_type);
     ink_release_assert(r->data_type == data_type);
     // Note: do not set r->data as we want to keep the previous value
@@ -55,7 +55,7 @@ register_record(RecT rec_type, const char *name, RecDataT data_type, RecData dat
     // Set the r->data to its default value as this is a new record
     RecDataSet(r->data_type, &(r->data), &(data_default));
     RecDataSet(r->data_type, &(r->data_default), &(data_default));
-    ink_hash_table_insert(g_records_ht, name, (void *) r);
+    ink_hash_table_insert(g_records_ht, name, (void *)r);
 
     if (REC_TYPE_IS_STAT(r->rec_type)) {
       r->stat_meta.persist_type = persist_type;
@@ -76,7 +76,7 @@ register_record(RecT rec_type, const char *name, RecDataT data_type, RecData dat
 static int
 link_int(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie)
 {
-  RecInt *rec_int = (RecInt *) cookie;
+  RecInt *rec_int = (RecInt *)cookie;
   ink_atomic_swap(rec_int, data.rec_int);
   return REC_ERR_OKAY;
 }
@@ -84,28 +84,28 @@ link_int(const char * /* name */, RecDataT /* data_type */, RecData data, void *
 static int
 link_int32(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie)
 {
-  *((int32_t *) cookie) = (int32_t) data.rec_int;
+  *((int32_t *)cookie) = (int32_t)data.rec_int;
   return REC_ERR_OKAY;
 }
 
 static int
 link_uint32(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie)
 {
-  *((uint32_t *) cookie) = (uint32_t) data.rec_int;
+  *((uint32_t *)cookie) = (uint32_t)data.rec_int;
   return REC_ERR_OKAY;
 }
 
 static int
 link_float(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie)
 {
-  *((RecFloat *) cookie) = data.rec_float;
+  *((RecFloat *)cookie) = data.rec_float;
   return REC_ERR_OKAY;
 }
 
 static int
 link_counter(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie)
 {
-  RecCounter *rec_counter = (RecCounter *) cookie;
+  RecCounter *rec_counter = (RecCounter *)cookie;
   ink_atomic_swap(rec_counter, data.rec_counter);
   return REC_ERR_OKAY;
 }
@@ -115,7 +115,7 @@ link_counter(const char * /* name */, RecDataT /* data_type */, RecData data, vo
 static int
 link_byte(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie)
 {
-  RecByte *rec_byte = (RecByte *) cookie;
+  RecByte *rec_byte = (RecByte *)cookie;
   RecByte byte = static_cast<RecByte>(data.rec_int);
 
   ink_atomic_swap(rec_byte, byte);
@@ -207,69 +207,69 @@ RecCoreInit(RecModeT mode_type, Diags *_diags)
 // RecLinkCnfigXXX
 //-------------------------------------------------------------------------
 int
-RecLinkConfigInt(const char *name, RecInt * rec_int)
+RecLinkConfigInt(const char *name, RecInt *rec_int)
 {
   if (RecGetRecordInt(name, rec_int) == REC_ERR_FAIL) {
     return REC_ERR_FAIL;
   }
-  return RecRegisterConfigUpdateCb(name, link_int, (void *) rec_int);
+  return RecRegisterConfigUpdateCb(name, link_int, (void *)rec_int);
 }
 
 int
-RecLinkConfigInt32(const char *name, int32_t * p_int32)
+RecLinkConfigInt32(const char *name, int32_t *p_int32)
 {
-  return RecRegisterConfigUpdateCb(name, link_int32, (void *) p_int32);
+  return RecRegisterConfigUpdateCb(name, link_int32, (void *)p_int32);
 }
 
 int
-RecLinkConfigUInt32(const char *name, uint32_t * p_uint32)
+RecLinkConfigUInt32(const char *name, uint32_t *p_uint32)
 {
-  return RecRegisterConfigUpdateCb(name, link_uint32, (void *) p_uint32);
+  return RecRegisterConfigUpdateCb(name, link_uint32, (void *)p_uint32);
 }
 
 int
-RecLinkConfigFloat(const char *name, RecFloat * rec_float)
+RecLinkConfigFloat(const char *name, RecFloat *rec_float)
 {
   if (RecGetRecordFloat(name, rec_float) == REC_ERR_FAIL) {
     return REC_ERR_FAIL;
   }
-  return RecRegisterConfigUpdateCb(name, link_float, (void *) rec_float);
+  return RecRegisterConfigUpdateCb(name, link_float, (void *)rec_float);
 }
 
 int
-RecLinkConfigCounter(const char *name, RecCounter * rec_counter)
+RecLinkConfigCounter(const char *name, RecCounter *rec_counter)
 {
   if (RecGetRecordCounter(name, rec_counter) == REC_ERR_FAIL) {
     return REC_ERR_FAIL;
   }
-  return RecRegisterConfigUpdateCb(name, link_counter, (void *) rec_counter);
+  return RecRegisterConfigUpdateCb(name, link_counter, (void *)rec_counter);
 }
 
 int
-RecLinkConfigString(const char *name, RecString * rec_string)
+RecLinkConfigString(const char *name, RecString *rec_string)
 {
   if (RecGetRecordString_Xmalloc(name, rec_string) == REC_ERR_FAIL) {
     return REC_ERR_FAIL;
   }
-  return RecRegisterConfigUpdateCb(name, link_string_alloc, (void *) rec_string);
+  return RecRegisterConfigUpdateCb(name, link_string_alloc, (void *)rec_string);
 }
 
 int
-RecLinkConfigByte(const char *name, RecByte * rec_byte)
+RecLinkConfigByte(const char *name, RecByte *rec_byte)
 {
   if (RecGetRecordByte(name, rec_byte) == REC_ERR_FAIL) {
     return REC_ERR_FAIL;
   }
-  return RecRegisterConfigUpdateCb(name, link_byte, (void *) rec_byte);
+  return RecRegisterConfigUpdateCb(name, link_byte, (void *)rec_byte);
 }
 
 int
-RecLinkConfigBool(const char *name, RecBool * rec_bool)
+RecLinkConfigBool(const char *name, RecBool *rec_bool)
 {
   if (RecGetRecordBool(name, rec_bool) == REC_ERR_FAIL) {
     return REC_ERR_FAIL;
   }
-  return RecRegisterConfigUpdateCb(name, link_byte, (void *) rec_bool);
+  return RecRegisterConfigUpdateCb(name, link_byte, (void *)rec_bool);
 }
 
 
@@ -284,7 +284,7 @@ RecRegisterConfigUpdateCb(const char *name, RecConfigUpdateCb update_cb, void *c
 
   ink_rwlock_rdlock(&g_records_rwlock);
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (REC_TYPE_IS_CONFIG(r->rec_type)) {
       /* -- upgrade to support a list of callback functions
@@ -341,7 +341,7 @@ RecGetRecordInt(const char *name, RecInt *rec_int, bool lock)
 }
 
 int
-RecGetRecordFloat(const char *name, RecFloat * rec_float, bool lock)
+RecGetRecordFloat(const char *name, RecFloat *rec_float, bool lock)
 {
   int err;
   RecData data;
@@ -358,7 +358,7 @@ RecGetRecordString(const char *name, char *buf, int buf_len, bool lock)
   if (lock) {
     ink_rwlock_rdlock(&g_records_rwlock);
   }
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (!r->registered || (r->data_type != RECD_STRING)) {
       err = REC_ERR_FAIL;
@@ -380,7 +380,7 @@ RecGetRecordString(const char *name, char *buf, int buf_len, bool lock)
 }
 
 int
-RecGetRecordString_Xmalloc(const char *name, RecString * rec_string, bool lock)
+RecGetRecordString_Xmalloc(const char *name, RecString *rec_string, bool lock)
 {
   int err;
   RecData data;
@@ -390,7 +390,7 @@ RecGetRecordString_Xmalloc(const char *name, RecString * rec_string, bool lock)
 }
 
 int
-RecGetRecordCounter(const char *name, RecCounter * rec_counter, bool lock)
+RecGetRecordCounter(const char *name, RecCounter *rec_counter, bool lock)
 {
   int err;
   RecData data;
@@ -424,7 +424,7 @@ RecGetRecordBool(const char *name, RecBool *rec_bool, bool lock)
 //-------------------------------------------------------------------------
 
 int
-RecLookupRecord(const char *name, void (*callback)(const RecRecord *, void *), void * data, bool lock)
+RecLookupRecord(const char *name, void (*callback)(const RecRecord *, void *), void *data, bool lock)
 {
   int err = REC_ERR_FAIL;
   RecRecord *r;
@@ -433,7 +433,7 @@ RecLookupRecord(const char *name, void (*callback)(const RecRecord *, void *), v
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     callback(r, data);
     err = REC_ERR_OKAY;
@@ -448,7 +448,7 @@ RecLookupRecord(const char *name, void (*callback)(const RecRecord *, void *), v
 }
 
 int
-RecGetRecordType(const char *name, RecT * rec_type, bool lock)
+RecGetRecordType(const char *name, RecT *rec_type, bool lock)
 {
   int err = REC_ERR_FAIL;
   RecRecord *r;
@@ -457,7 +457,7 @@ RecGetRecordType(const char *name, RecT * rec_type, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     *rec_type = r->rec_type;
     err = REC_ERR_OKAY;
@@ -473,7 +473,7 @@ RecGetRecordType(const char *name, RecT * rec_type, bool lock)
 
 
 int
-RecGetRecordDataType(const char *name, RecDataT * data_type, bool lock)
+RecGetRecordDataType(const char *name, RecDataT *data_type, bool lock)
 {
   int err = REC_ERR_FAIL;
   RecRecord *r = NULL;
@@ -482,7 +482,7 @@ RecGetRecordDataType(const char *name, RecDataT * data_type, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (!r->registered) {
       err = REC_ERR_FAIL;
@@ -501,7 +501,7 @@ RecGetRecordDataType(const char *name, RecDataT * data_type, bool lock)
 }
 
 int
-RecGetRecordPersistenceType(const char *name, RecPersistT * persist_type, bool lock)
+RecGetRecordPersistenceType(const char *name, RecPersistT *persist_type, bool lock)
 {
   int err = REC_ERR_FAIL;
   RecRecord *r = NULL;
@@ -512,7 +512,7 @@ RecGetRecordPersistenceType(const char *name, RecPersistT * persist_type, bool l
 
   *persist_type = RECP_NULL;
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (REC_TYPE_IS_STAT(r->rec_type)) {
       *persist_type = r->stat_meta.persist_type;
@@ -529,7 +529,7 @@ RecGetRecordPersistenceType(const char *name, RecPersistT * persist_type, bool l
 }
 
 int
-RecGetRecordOrderAndId(const char *name, int* order, int* id, bool lock)
+RecGetRecordOrderAndId(const char *name, int *order, int *id, bool lock)
 {
   int err = REC_ERR_FAIL;
   RecRecord *r = NULL;
@@ -538,7 +538,7 @@ RecGetRecordOrderAndId(const char *name, int* order, int* id, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     if (r->registered) {
       rec_mutex_acquire(&(r->lock));
       if (order)
@@ -567,7 +567,7 @@ RecGetRecordUpdateType(const char *name, RecUpdateT *update_type, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (REC_TYPE_IS_CONFIG(r->rec_type)) {
       *update_type = r->config_meta.update_type;
@@ -596,7 +596,7 @@ RecGetRecordCheckType(const char *name, RecCheckT *check_type, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (REC_TYPE_IS_CONFIG(r->rec_type)) {
       *check_type = r->config_meta.check_type;
@@ -625,7 +625,7 @@ RecGetRecordCheckExpr(const char *name, char **check_expr, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (REC_TYPE_IS_CONFIG(r->rec_type)) {
       *check_expr = r->config_meta.check_expr;
@@ -653,7 +653,7 @@ RecGetRecordDefaultDataString_Xmalloc(char *name, char **buf, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     *buf = (char *)ats_malloc(sizeof(char) * 1024);
     memset(*buf, 0, 1024);
     err = REC_ERR_OKAY;
@@ -704,7 +704,7 @@ RecGetRecordAccessType(const char *name, RecAccessT *access, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     *access = r->config_meta.access_type;
     err = REC_ERR_OKAY;
@@ -729,7 +729,7 @@ RecSetRecordAccessType(const char *name, RecAccessT access, bool lock)
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     r->config_meta.access_type = access;
     err = REC_ERR_OKAY;
@@ -758,7 +758,7 @@ RecRegisterStat(RecT rec_type, const char *name, RecDataT data_type, RecData dat
     // type we are registering, then that means that it changed between the previous software
     // version and the current version. If the metric changed to non-persistent, reset to the
     // new default value.
-    if ((r->stat_meta.persist_type == RECP_NULL ||r->stat_meta.persist_type == RECP_PERSISTENT) &&
+    if ((r->stat_meta.persist_type == RECP_NULL || r->stat_meta.persist_type == RECP_PERSISTENT) &&
         persist_type == RECP_NON_PERSISTENT) {
       RecDebug(DL_Debug, "resetting default value for formerly persisted stat '%s'", r->name);
       RecDataSet(r->data_type, &(r->data), &(data_default));
@@ -779,8 +779,7 @@ RecRegisterStat(RecT rec_type, const char *name, RecDataT data_type, RecData dat
 // RecRegisterConfig
 //-------------------------------------------------------------------------
 RecRecord *
-RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type,
-                  RecData data_default, RecUpdateT update_type,
+RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type, RecData data_default, RecUpdateT update_type,
                   RecCheckT check_type, const char *check_expr, RecAccessT access_type)
 {
   RecRecord *r;
@@ -815,7 +814,7 @@ RecGetRecord_Xmalloc(const char *name, RecDataT data_type, RecData *data, bool l
     ink_rwlock_rdlock(&g_records_rwlock);
   }
 
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (!r->registered || (r->data_type != data_type)) {
       err = REC_ERR_FAIL;
@@ -842,14 +841,14 @@ RecGetRecord_Xmalloc(const char *name, RecDataT data_type, RecData *data, bool l
 // RecForceInsert
 //-------------------------------------------------------------------------
 RecRecord *
-RecForceInsert(RecRecord * record)
+RecForceInsert(RecRecord *record)
 {
   RecRecord *r = NULL;
   bool r_is_a_new_record;
 
   ink_rwlock_wrlock(&g_records_rwlock);
 
-  if (ink_hash_table_lookup(g_records_ht, record->name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, record->name, (void **)&r)) {
     r_is_a_new_record = false;
     rec_mutex_acquire(&(r->lock));
     r->rec_type = record->rec_type;
@@ -882,7 +881,7 @@ RecForceInsert(RecRecord * record)
   }
 
   if (r_is_a_new_record) {
-    ink_hash_table_insert(g_records_ht, r->name, (void *) r);
+    ink_hash_table_insert(g_records_ht, r->name, (void *)r);
   } else {
     rec_mutex_release(&(r->lock));
   }
@@ -900,7 +899,7 @@ RecForceInsert(RecRecord * record)
 static void
 debug_record_callback(RecT /* rec_type */, void * /* edata */, int registered, const char *name, int data_type, RecData *datum)
 {
-  switch(data_type) {
+  switch (data_type) {
   case RECD_INT:
     RecDebug(DL_Note, "  ([%d] '%s', '%" PRId64 "')", registered, name, datum->rec_int);
     break;
@@ -908,8 +907,7 @@ debug_record_callback(RecT /* rec_type */, void * /* edata */, int registered, c
     RecDebug(DL_Note, "  ([%d] '%s', '%f')", registered, name, datum->rec_float);
     break;
   case RECD_STRING:
-    RecDebug(DL_Note, "  ([%d] '%s', '%s')",
-             registered, name, datum->rec_string ? datum->rec_string : "NULL");
+    RecDebug(DL_Note, "  ([%d] '%s', '%s')", registered, name, datum->rec_string ? datum->rec_string : "NULL");
     break;
   case RECD_COUNTER:
     RecDebug(DL_Note, "  ([%d] '%s', '%" PRId64 "')", registered, name, datum->rec_counter);
@@ -936,7 +934,8 @@ RecDumpRecords(RecT rec_type, RecDumpEntryCb callback, void *edata)
 }
 
 void
-RecDumpRecordsHt(RecT rec_type) {
+RecDumpRecordsHt(RecT rec_type)
+{
   RecDebug(DL_Note, "Dumping Records:");
   RecDumpRecords(rec_type, debug_record_callback, NULL);
 }
@@ -951,7 +950,7 @@ int
 RecGetRecordPrefix_Xmalloc(char *prefix, char **buf, int *buf_len)
 {
   int num_records = g_num_records;
-  int result_size = num_records * 256;  /* estimate buffer size */
+  int result_size = num_records * 256; /* estimate buffer size */
   int num_matched = 0;
   char *result = NULL;
 
@@ -978,7 +977,8 @@ RecGetRecordPrefix_Xmalloc(char *prefix, char **buf, int *buf_len)
         break;
       case RECD_STRING:
         num_matched++;
-        bytes_written = snprintf(result + total_bytes_written, bytes_avail, "%s=%s\r\n", r->name, r->data.rec_string ? r->data.rec_string : "NULL");
+        bytes_written = snprintf(result + total_bytes_written, bytes_avail, "%s=%s\r\n", r->name,
+                                 r->data.rec_string ? r->data.rec_string : "NULL");
         break;
       case RECD_COUNTER:
         num_matched++;
@@ -988,7 +988,7 @@ RecGetRecordPrefix_Xmalloc(char *prefix, char **buf, int *buf_len)
         break;
       }
 
-      if(bytes_written <= 0 || bytes_written > bytes_avail) {
+      if (bytes_written <= 0 || bytes_written > bytes_avail) {
         error = 1;
       } else
         total_bytes_written += bytes_written;
@@ -997,7 +997,7 @@ RecGetRecordPrefix_Xmalloc(char *prefix, char **buf, int *buf_len)
     }
   }
 
-  if(error || total_bytes_written == result_size) {
+  if (error || total_bytes_written == result_size) {
     RecLog(DL_Error, "Stat system was unable to fully generate stat list, size exceeded limit of %d", result_size);
   }
 
@@ -1023,7 +1023,7 @@ char *
 REC_ConfigReadString(const char *name)
 {
   char *t = 0;
-  RecGetRecordString_Xmalloc(name, (RecString *) & t);
+  RecGetRecordString_Xmalloc(name, (RecString *)&t);
   return t;
 }
 
@@ -1031,7 +1031,7 @@ RecFloat
 REC_ConfigReadFloat(const char *name)
 {
   RecFloat t = 0;
-  RecGetRecordFloat(name, (RecFloat *) & t);
+  RecGetRecordFloat(name, (RecFloat *)&t);
   return t;
 }
 
@@ -1039,7 +1039,7 @@ RecCounter
 REC_ConfigReadCounter(const char *name)
 {
   RecCounter t = 0;
-  RecGetRecordCounter(name, (RecCounter *) & t);
+  RecGetRecordCounter(name, (RecCounter *)&t);
   return t;
 }
 
@@ -1048,7 +1048,7 @@ REC_ConfigReadCounter(const char *name)
 // Backwards compatibility. TODO: Should remove these.
 //-------------------------------------------------------------------------
 RecInt
-REC_readInteger(const char *name, bool * found, bool lock)
+REC_readInteger(const char *name, bool *found, bool lock)
 {
   ink_assert(name);
   RecInt _tmp = 0;
@@ -1060,7 +1060,7 @@ REC_readInteger(const char *name, bool * found, bool lock)
 }
 
 RecFloat
-REC_readFloat(char *name, bool * found, bool lock)
+REC_readFloat(char *name, bool *found, bool lock)
 {
   ink_assert(name);
   RecFloat _tmp = 0.0;
@@ -1072,7 +1072,7 @@ REC_readFloat(char *name, bool * found, bool lock)
 }
 
 RecCounter
-REC_readCounter(char *name, bool * found, bool lock)
+REC_readCounter(char *name, bool *found, bool lock)
 {
   ink_assert(name);
   RecCounter _tmp = 0;
@@ -1084,7 +1084,7 @@ REC_readCounter(char *name, bool * found, bool lock)
 }
 
 RecString
-REC_readString(const char *name, bool * found, bool lock)
+REC_readString(const char *name, bool *found, bool lock)
 {
   ink_assert(name);
   RecString _tmp = NULL;
@@ -1176,7 +1176,7 @@ RecConfigReadSnapshotDir()
 // RecConfigReadConfigPath
 //-------------------------------------------------------------------------
 char *
-RecConfigReadConfigPath(const char * file_variable, const char * default_value)
+RecConfigReadConfigPath(const char *file_variable, const char *default_value)
 {
   ats_scoped_str sysconfdir(RecConfigReadConfigDir());
 
@@ -1203,7 +1203,7 @@ RecConfigReadConfigPath(const char * file_variable, const char * default_value)
 // RecConfigReadPrefixPath
 //-------------------------------------------------------------------------
 char *
-RecConfigReadPrefixPath(const char * file_variable, const char * default_value)
+RecConfigReadPrefixPath(const char *file_variable, const char *default_value)
 {
   char buf[PATH_NAME_MAX + 1];
 
@@ -1235,7 +1235,7 @@ RecConfigReadPersistentStatsPath()
 }
 
 void
-RecSignalWarning(int sig, const char * fmt, ...)
+RecSignalWarning(int sig, const char *fmt, ...)
 {
   char msg[1024];
   va_list args;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecDebug.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecDebug.cc b/lib/records/RecDebug.cc
index 836ff23..8bae9db 100644
--- a/lib/records/RecDebug.cc
+++ b/lib/records/RecDebug.cc
@@ -30,7 +30,7 @@ static Diags *g_diags = NULL;
 // RecSetDiags
 //-------------------------------------------------------------------------
 int
-RecSetDiags(Diags * _diags)
+RecSetDiags(Diags *_diags)
 {
   // Warning! It's very dangerous to change diags on the fly!  This
   // function only exists so that we can boot-strap TM on startup.


[33/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index f6cc2c7..bd185ce 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -28,11 +28,11 @@
 #include "I_SplitDNS.h"
 #endif
 
-#define SRV_COST    (RRFIXEDSZ+0)
-#define SRV_WEIGHT  (RRFIXEDSZ+2)
-#define SRV_PORT    (RRFIXEDSZ+4)
-#define SRV_SERVER  (RRFIXEDSZ+6)
-#define SRV_FIXEDSZ (RRFIXEDSZ+6)
+#define SRV_COST (RRFIXEDSZ + 0)
+#define SRV_WEIGHT (RRFIXEDSZ + 2)
+#define SRV_PORT (RRFIXEDSZ + 4)
+#define SRV_SERVER (RRFIXEDSZ + 6)
+#define SRV_FIXEDSZ (RRFIXEDSZ + 6)
 
 EventType ET_DNS = ET_CALL;
 
@@ -56,14 +56,19 @@ char *dns_local_ipv6 = NULL;
 char *dns_local_ipv4 = NULL;
 int dns_thread = 0;
 int dns_prefer_ipv6 = 0;
-namespace {
-  // Currently only used for A and AAAA.
-  inline char const* QtypeName(int qtype) {
-    return T_AAAA == qtype ? "AAAA" : T_A == qtype ? "A" : "*";
-  }
-  inline bool is_addr_query(int qtype) {
-    return qtype == T_A || qtype == T_AAAA;
-  }
+namespace
+{
+// Currently only used for A and AAAA.
+inline char const *
+QtypeName(int qtype)
+{
+  return T_AAAA == qtype ? "AAAA" : T_A == qtype ? "A" : "*";
+}
+inline bool
+is_addr_query(int qtype)
+{
+  return qtype == T_A || qtype == T_AAAA;
+}
 }
 
 DNSProcessor dnsProcessor;
@@ -90,73 +95,77 @@ static int attempt_num_entries = 1;
 char try_server_names[DEFAULT_NUM_TRY_SERVER][MAXDNAME];
 
 static inline char *
-strnchr(char *s, char c, int len) {
+strnchr(char *s, char c, int len)
+{
   while (*s && *s != c && len)
     ++s, --len;
-  return *s == c ? s : (char *) NULL;
+  return *s == c ? s : (char *)NULL;
 }
 
 static inline uint16_t
-ink_get16(const uint8_t *src) {
+ink_get16(const uint8_t *src)
+{
   uint16_t dst;
 
   NS_GET16(dst, src);
   return dst;
 }
 
-void HostEnt::free() {
+void
+HostEnt::free()
+{
   dnsBufAllocator.free(this);
 }
 
 void
 make_ipv4_ptr(in_addr_t addr, char *buffer)
 {
-    char *p = buffer;
-    uint8_t const* u = reinterpret_cast<uint8_t*>(&addr);
-
-    if (u[3] > 99)
-      *p++ = (u[3] / 100) + '0';
-    if (u[3] > 9)
-      *p++ = ((u[3] / 10) % 10) + '0';
-    *p++ = u[3] % 10 + '0';
-    *p++ = '.';
-    if (u[2] > 99)
-      *p++ = (u[2] / 100) + '0';
-    if (u[2] > 9)
-      *p++ = ((u[2] / 10) % 10) + '0';
-    *p++ = u[2] % 10 + '0';
-    *p++ = '.';
-    if (u[1] > 99)
-      *p++ = (u[1] / 100) + '0';
-    if (u[1] > 9)
-      *p++ = ((u[1] / 10) % 10) + '0';
-    *p++ = u[1] % 10 + '0';
-    *p++ = '.';
-    if (u[0] > 99)
-      *p++ = (u[0] / 100) + '0';
-    if (u[0] > 9)
-      *p++ = ((u[0] / 10) % 10) + '0';
-    *p++ = u[0] % 10 + '0';
-    *p++ = '.';
-    ink_strlcpy(p, "in-addr.arpa", MAXDNAME - (p - buffer + 1));
+  char *p = buffer;
+  uint8_t const *u = reinterpret_cast<uint8_t *>(&addr);
+
+  if (u[3] > 99)
+    *p++ = (u[3] / 100) + '0';
+  if (u[3] > 9)
+    *p++ = ((u[3] / 10) % 10) + '0';
+  *p++ = u[3] % 10 + '0';
+  *p++ = '.';
+  if (u[2] > 99)
+    *p++ = (u[2] / 100) + '0';
+  if (u[2] > 9)
+    *p++ = ((u[2] / 10) % 10) + '0';
+  *p++ = u[2] % 10 + '0';
+  *p++ = '.';
+  if (u[1] > 99)
+    *p++ = (u[1] / 100) + '0';
+  if (u[1] > 9)
+    *p++ = ((u[1] / 10) % 10) + '0';
+  *p++ = u[1] % 10 + '0';
+  *p++ = '.';
+  if (u[0] > 99)
+    *p++ = (u[0] / 100) + '0';
+  if (u[0] > 9)
+    *p++ = ((u[0] / 10) % 10) + '0';
+  *p++ = u[0] % 10 + '0';
+  *p++ = '.';
+  ink_strlcpy(p, "in-addr.arpa", MAXDNAME - (p - buffer + 1));
 }
 
 void
-make_ipv6_ptr(in6_addr const* addr, char *buffer)
+make_ipv6_ptr(in6_addr const *addr, char *buffer)
 {
-    const char hex_digit[] = "0123456789abcdef";
-    char *p = buffer;
-    uint8_t const* src = addr->s6_addr;
-    int i;
+  const char hex_digit[] = "0123456789abcdef";
+  char *p = buffer;
+  uint8_t const *src = addr->s6_addr;
+  int i;
 
-    for (i = TS_IP6_SIZE-1 ; i >= 0; --i) {
-        *p++ = hex_digit[src[i] & 0x0f];
-        *p++ = '.';
-        *p++ = hex_digit[src[i] >> 4];
-        *p++ = '.';
-    }
+  for (i = TS_IP6_SIZE - 1; i >= 0; --i) {
+    *p++ = hex_digit[src[i] & 0x0f];
+    *p++ = '.';
+    *p++ = hex_digit[src[i] >> 4];
+    *p++ = '.';
+  }
 
-    ink_strlcpy(p, "ip6.arpa", MAXDNAME - (p - buffer + 1));
+  ink_strlcpy(p, "ip6.arpa", MAXDNAME - (p - buffer + 1));
 }
 
 //  Public functions
@@ -164,7 +173,8 @@ make_ipv6_ptr(in6_addr const* addr, char *buffer)
 //  See documentation is header files and Memos
 //
 int
-DNSProcessor::start(int, size_t stacksize) {
+DNSProcessor::start(int, size_t stacksize)
+{
   //
   // Read configuration
   //
@@ -192,10 +202,10 @@ DNSProcessor::start(int, size_t stacksize) {
   }
   thread = eventProcessor.eventthread[ET_DNS][0];
 
-  dns_failover_try_period = dns_timeout + 1;    // Modify the "default" accordingly
+  dns_failover_try_period = dns_timeout + 1; // Modify the "default" accordingly
 
   if (SplitDNSConfig::gsplit_dns_enabled) {
-    //reconfigure after threads start
+    // reconfigure after threads start
     SplitDNSConfig::reconfigure();
   }
 
@@ -207,7 +217,7 @@ DNSProcessor::start(int, size_t stacksize) {
 }
 
 void
-DNSProcessor::open(sockaddr const* target)
+DNSProcessor::open(sockaddr const *target)
 {
   DNSHandler *h = new DNSHandler;
 
@@ -246,23 +256,25 @@ DNSProcessor::dns_init()
     int i;
     char *last;
     char *ns_list = ats_strdup(dns_ns_list);
-    char *ns = (char *) strtok_r(ns_list, " ,;\t\r", &last);
+    char *ns = (char *)strtok_r(ns_list, " ,;\t\r", &last);
 
-    for (i = 0, nserv = 0 ; (i < MAX_NAMED) && ns ; ++i) {
+    for (i = 0, nserv = 0; (i < MAX_NAMED) && ns; ++i) {
       Debug("dns", "Nameserver list - parsing \"%s\"\n", ns);
       bool err = false;
       int prt = DOMAIN_SERVICE_PORT;
-      char* colon = 0; // where the port colon is.
+      char *colon = 0; // where the port colon is.
       // Check for IPv6 notation.
       if ('[' == *ns) {
-        char* ndx = strchr(ns+1, ']');
+        char *ndx = strchr(ns + 1, ']');
         if (ndx) {
-          if (':' == ndx[1]) colon = ndx+1;
+          if (':' == ndx[1])
+            colon = ndx + 1;
         } else {
           err = true;
           Warning("Unmatched '[' in address for nameserver '%s', discarding.", ns);
         }
-      } else colon = strchr(ns, ':');
+      } else
+        colon = strchr(ns, ':');
 
       if (!err && colon) {
         *colon = '\0';
@@ -285,13 +297,11 @@ DNSProcessor::dns_init()
 
         ats_ip_port_cast(&nameserver[nserv].sa) = htons(prt);
 
-        Debug("dns", "Adding nameserver %s to nameserver list",
-          ats_ip_nptop(&nameserver[nserv].sa, buff, sizeof(buff))
-        );
+        Debug("dns", "Adding nameserver %s to nameserver list", ats_ip_nptop(&nameserver[nserv].sa, buff, sizeof(buff)));
         ++nserv;
       }
 
-      ns = (char *) strtok_r(NULL, " ,;\t\r", &last);
+      ns = (char *)strtok_r(NULL, " ,;\t\r", &last);
     }
     ats_free(ns_list);
   }
@@ -334,11 +344,10 @@ DNSProcessor::dns_init()
 inline int
 ink_dn_expand(const u_char *msg, const u_char *eom, const u_char *comp_dn, u_char *exp_dn, int length)
 {
-  return::dn_expand((unsigned char *) msg, (unsigned char *) eom, (unsigned char *) comp_dn, (char *) exp_dn, length);
+  return ::dn_expand((unsigned char *)msg, (unsigned char *)eom, (unsigned char *)comp_dn, (char *)exp_dn, length);
 }
 
-DNSProcessor::DNSProcessor()
-  : thread(NULL), handler(NULL)
+DNSProcessor::DNSProcessor() : thread(NULL), handler(NULL)
 {
   ink_zero(l_res);
   ink_zero(local_ipv6);
@@ -346,20 +355,17 @@ DNSProcessor::DNSProcessor()
 }
 
 void
-DNSEntry::init(const char *x, int len, int qtype_arg, Continuation* acont,
-               DNSProcessor::Options const& opt)
+DNSEntry::init(const char *x, int len, int qtype_arg, Continuation *acont, DNSProcessor::Options const &opt)
 {
   qtype = qtype_arg;
   host_res_style = opt.host_res_style;
   if (is_addr_query(qtype)) {
-      // adjust things based on family preference.
-      if (HOST_RES_IPV4 == host_res_style ||
-          HOST_RES_IPV4_ONLY == host_res_style) {
-          qtype = T_A;
-      } else if (HOST_RES_IPV6 == host_res_style ||
-                 HOST_RES_IPV6_ONLY == host_res_style) {
-          qtype = T_AAAA;
-      }
+    // adjust things based on family preference.
+    if (HOST_RES_IPV4 == host_res_style || HOST_RES_IPV4_ONLY == host_res_style) {
+      qtype = T_A;
+    } else if (HOST_RES_IPV6 == host_res_style || HOST_RES_IPV6_ONLY == host_res_style) {
+      qtype = T_AAAA;
+    }
   }
   submit_time = ink_get_hrtime();
   action = acont;
@@ -389,8 +395,8 @@ DNSEntry::init(const char *x, int len, int qtype_arg, Continuation* acont,
       qname_len = ink_strlcpy(qname, x, MAXDNAME);
       orig_qname_len = qname_len;
     }
-  } else {                    //T_PTR
-    IpAddr const* ip = reinterpret_cast<IpAddr const*>(x);
+  } else { // T_PTR
+    IpAddr const *ip = reinterpret_cast<IpAddr const *>(x);
     if (ip->isIp6())
       make_ipv6_ptr(&ip->_addr._ip6, qname);
     else if (ip->isIp4())
@@ -399,7 +405,7 @@ DNSEntry::init(const char *x, int len, int qtype_arg, Continuation* acont,
       ink_assert(!"T_PTR query to DNS must be IP address.");
   }
 
-  SET_HANDLER((DNSEntryHandler) & DNSEntry::mainEvent);
+  SET_HANDLER((DNSEntryHandler)&DNSEntry::mainEvent);
 }
 
 /**
@@ -408,7 +414,7 @@ DNSEntry::init(const char *x, int len, int qtype_arg, Continuation* acont,
 
 */
 void
-DNSHandler::open_con(sockaddr const* target, bool failed, int icon)
+DNSHandler::open_con(sockaddr const *target, bool failed, int icon)
 {
   ip_port_text_buffer ip_text;
   PollDescriptor *pd = get_PollDescriptor(dnsProcessor.thread);
@@ -421,20 +427,18 @@ DNSHandler::open_con(sockaddr const* target, bool failed, int icon)
 
   Debug("dns", "open_con: opening connection %s", ats_ip_nptop(target, ip_text, sizeof ip_text));
 
-  if (con[icon].fd != NO_FD) {  // Remove old FD from epoll fd
+  if (con[icon].fd != NO_FD) { // Remove old FD from epoll fd
     con[icon].eio.stop();
     con[icon].close();
   }
 
-  if (con[icon].connect(
-      target, DNSConnection::Options()
-        .setNonBlockingConnect(true)
-        .setNonBlockingIo(true)
-        .setUseTcp(false)
-        .setBindRandomPort(true)
-        .setLocalIpv6(&local_ipv6.sa)
-        .setLocalIpv4(&local_ipv4.sa)
-    ) < 0) {
+  if (con[icon].connect(target, DNSConnection::Options()
+                                  .setNonBlockingConnect(true)
+                                  .setNonBlockingIo(true)
+                                  .setUseTcp(false)
+                                  .setBindRandomPort(true)
+                                  .setLocalIpv6(&local_ipv6.sa)
+                                  .setLocalIpv4(&local_ipv4.sa)) < 0) {
     Debug("dns", "opening connection %s FAILED for %d", ip_text, icon);
     if (!failed) {
       if (dns_ns_rr)
@@ -455,7 +459,8 @@ DNSHandler::open_con(sockaddr const* target, bool failed, int icon)
 }
 
 void
-DNSHandler::validate_ip() {
+DNSHandler::validate_ip()
+{
   if (!ip.isValid()) {
     // Invalid, switch to default.
     // seems that res_init always sets m_res.nscount to at least 1!
@@ -497,10 +502,7 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e)
         if (ats_is_ip(sa)) {
           open_con(sa, false, n_con);
           ++n_con;
-          Debug("dns_pas", "opened connection to %s, n_con = %d",
-            ats_ip_nptop(sa, buff, sizeof(buff)),
-            n_con
-          );
+          Debug("dns_pas", "opened connection to %s, n_con = %d", ats_ip_nptop(sa, buff, sizeof(buff)), n_con);
         }
       }
       dns_ns_rr_init_down = 0;
@@ -512,7 +514,7 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e)
 
     return EVENT_CONT;
   } else {
-    ink_assert(false);          // I.e. this should never really happen
+    ink_assert(false); // I.e. this should never really happen
     return EVENT_DONE;
   }
 }
@@ -529,7 +531,7 @@ DNSHandler::startEvent_sdns(int /* event ATS_UNUSED */, Event *e)
 
   SET_HANDLER(&DNSHandler::mainEvent);
   open_con(&ip.sa, false, n_con);
-  ++n_con;                      // TODO should n_con be zeroed?
+  ++n_con; // TODO should n_con be zeroed?
 
   e->schedule_every(DNS_PERIOD);
   return EVENT_CONT;
@@ -538,9 +540,7 @@ DNSHandler::startEvent_sdns(int /* event ATS_UNUSED */, Event *e)
 static inline int
 _ink_res_mkquery(ink_res_state res, char *qname, int qtype, char *buffer)
 {
-  int r = ink_res_mkquery(res, QUERY, qname, C_IN, qtype,
-                          NULL, 0, NULL, (unsigned char *) buffer,
-                          MAX_DNS_PACKET_LEN);
+  int r = ink_res_mkquery(res, QUERY, qname, C_IN, qtype, NULL, 0, NULL, (unsigned char *)buffer, MAX_DNS_PACKET_LEN);
   return r;
 }
 
@@ -568,7 +568,7 @@ DNSHandler::retry_named(int ndx, ink_hrtime t, bool reopen)
   int r = _ink_res_mkquery(m_res, try_server_names[try_servers], T_A, buffer);
   try_servers = (try_servers + 1) % countof(try_server_names);
   ink_assert(r >= 0);
-  if (r >= 0) {                 // looking for a bounce
+  if (r >= 0) { // looking for a bounce
     int res = socketManager.send(con[ndx].fd, buffer, r, 0);
     Debug("dns", "ping result = %d", res);
   }
@@ -596,7 +596,7 @@ DNSHandler::try_primary_named(bool reopen)
     else
       try_servers = (try_servers + 1) % countof(try_server_names);
     ink_assert(r >= 0);
-    if (r >= 0) {               // looking for a bounce
+    if (r >= 0) { // looking for a bounce
       int res = socketManager.send(con[0].fd, buffer, r, 0);
       Debug("dns", "ping result = %d", res);
     }
@@ -607,13 +607,13 @@ DNSHandler::try_primary_named(bool reopen)
 void
 DNSHandler::switch_named(int ndx)
 {
-  for (DNSEntry *e = entries.head; e; e = (DNSEntry *) e->link.next) {
+  for (DNSEntry *e = entries.head; e; e = (DNSEntry *)e->link.next) {
     e->written_flag = 0;
     if (e->retries < dns_retries)
-      ++(e->retries);           // give them another chance
+      ++(e->retries); // give them another chance
   }
   in_flight = 0;
-  received_one(ndx);            // reset failover counters
+  received_one(ndx); // reset failover counters
 }
 
 /** Fail over to another name server. */
@@ -628,19 +628,18 @@ DNSHandler::failover()
 
     if (max_nscount > MAX_NAMED)
       max_nscount = MAX_NAMED;
-    sockaddr const* old_addr = &m_res->nsaddr_list[name_server].sa;
+    sockaddr const *old_addr = &m_res->nsaddr_list[name_server].sa;
     name_server = (name_server + 1) % max_nscount;
     Debug("dns", "failover: failing over to name_server=%d", name_server);
 
     IpEndpoint target;
     ats_ip_copy(&target.sa, &m_res->nsaddr_list[name_server].sa);
 
-    Warning("failover: connection to DNS server %s lost, move to %s",
-      ats_ip_ntop(old_addr, buff1, sizeof(buff1)),
-      ats_ip_ntop(&target.sa, buff2, sizeof(buff2))
-    );
+    Warning("failover: connection to DNS server %s lost, move to %s", ats_ip_ntop(old_addr, buff1, sizeof(buff1)),
+            ats_ip_ntop(&target.sa, buff2, sizeof(buff2)));
 
-    if (!target.isValid()) target.setToLoopback(AF_INET);
+    if (!target.isValid())
+      target.setToLoopback(AF_INET);
 
     open_con(&target.sa, true, name_server);
     if (n_con <= name_server)
@@ -648,9 +647,7 @@ DNSHandler::failover()
     switch_named(name_server);
   } else {
     ip_text_buffer buff;
-    Warning("failover: connection to DNS server %s lost, retrying",
-      ats_ip_ntop(&ip.sa, buff, sizeof(buff))
-    );
+    Warning("failover: connection to DNS server %s lost, retrying", ats_ip_ntop(&ip.sa, buff, sizeof(buff)));
   }
 }
 
@@ -664,9 +661,7 @@ DNSHandler::rr_failure(int ndx)
     // mark this nameserver as down
     Debug("dns", "rr_failure: Marking nameserver %d as down", ndx);
     ns_down[ndx] = 1;
-    Warning("connection to DNS server %s lost, marking as down",
-      ats_ip_ntop(&m_res->nsaddr_list[ndx].sa, buff, sizeof(buff))
-    );
+    Warning("connection to DNS server %s lost, marking as down", ats_ip_ntop(&m_res->nsaddr_list[ndx].sa, buff, sizeof(buff)));
   }
 
   int nscount = m_res->nscount;
@@ -687,20 +682,20 @@ DNSHandler::rr_failure(int ndx)
     Warning("connection to all DNS servers lost, retrying");
     // actual retries will be done in retry_named called from mainEvent
     // mark any outstanding requests as not sent for later retry
-    for (DNSEntry *e = entries.head; e; e = (DNSEntry *) e->link.next) {
+    for (DNSEntry *e = entries.head; e; e = (DNSEntry *)e->link.next) {
       e->written_flag = 0;
       if (e->retries < dns_retries)
-        ++(e->retries);         // give them another chance
+        ++(e->retries); // give them another chance
       --in_flight;
       DNS_DECREMENT_DYN_STAT(dns_in_flight_stat);
     }
   } else {
     // move outstanding requests that were sent to this nameserver to another
-    for (DNSEntry *e = entries.head; e; e = (DNSEntry *) e->link.next) {
+    for (DNSEntry *e = entries.head; e; e = (DNSEntry *)e->link.next) {
       if (e->which_ns == ndx) {
         e->written_flag = 0;
         if (e->retries < dns_retries)
-          ++(e->retries);       // give them another chance
+          ++(e->retries); // give them another chance
         --in_flight;
         DNS_DECREMENT_DYN_STAT(dns_in_flight_stat);
       }
@@ -708,16 +703,21 @@ DNSHandler::rr_failure(int ndx)
   }
 }
 
-static inline unsigned int get_rcode(char* buff) {
-  return reinterpret_cast<HEADER*>(buff)->rcode;
+static inline unsigned int
+get_rcode(char *buff)
+{
+  return reinterpret_cast<HEADER *>(buff)->rcode;
 }
 
-static inline unsigned int get_rcode(HostEnt* ent) {
-  return get_rcode(reinterpret_cast<char*>(ent));
+static inline unsigned int
+get_rcode(HostEnt *ent)
+{
+  return get_rcode(reinterpret_cast<char *>(ent));
 }
 
 static bool
-good_rcode(char *buff) {
+good_rcode(char *buff)
+{
   unsigned int r = get_rcode(buff);
   return NOERROR == r || NXDOMAIN == r;
 }
@@ -729,7 +729,7 @@ DNSHandler::recv_dns(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   DNSConnection *dnsc = NULL;
   ip_text_buffer ipbuff1, ipbuff2;
 
-  while ((dnsc = (DNSConnection *) triggered.dequeue())) {
+  while ((dnsc = (DNSConnection *)triggered.dequeue())) {
     while (1) {
       IpEndpoint from_ip;
       socklen_t from_length = sizeof(from_ip);
@@ -753,10 +753,8 @@ DNSHandler::recv_dns(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 
       // verify that this response came from the correct server
       if (!ats_ip_addr_eq(&dnsc->ip.sa, &from_ip.sa)) {
-        Warning("unexpected DNS response from %s (expected %s)",
-          ats_ip_ntop(&from_ip.sa, ipbuff1, sizeof ipbuff1),
-          ats_ip_ntop(&dnsc->ip.sa, ipbuff2, sizeof ipbuff2)
-        );
+        Warning("unexpected DNS response from %s (expected %s)", ats_ip_ntop(&from_ip.sa, ipbuff1, sizeof ipbuff1),
+                ats_ip_ntop(&dnsc->ip.sa, ipbuff2, sizeof ipbuff2));
         continue;
       }
       hostent_cache = 0;
@@ -768,8 +766,7 @@ DNSHandler::recv_dns(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
           received_one(dnsc->num);
           if (ns_down[dnsc->num]) {
             Warning("connection to DNS server %s restored",
-              ats_ip_ntop(&m_res->nsaddr_list[dnsc->num].sa, ipbuff1, sizeof ipbuff1)
-            );
+                    ats_ip_ntop(&m_res->nsaddr_list[dnsc->num].sa, ipbuff1, sizeof ipbuff1));
             ns_down[dnsc->num] = 0;
           }
         }
@@ -831,7 +828,7 @@ DNSHandler::mainEvent(int event, Event *e)
         try_primary_named(false);
         ++failover_soon_number[name_server];
       }
-    } else if (name_server)     // not on the primary named
+    } else if (name_server) // not on the primary named
       try_primary_named(true);
   }
 
@@ -845,7 +842,7 @@ DNSHandler::mainEvent(int event, Event *e)
 inline static DNSEntry *
 get_dns(DNSHandler *h, uint16_t id)
 {
-  for (DNSEntry *e = h->entries.head; e; e = (DNSEntry *) e->link.next) {
+  for (DNSEntry *e = h->entries.head; e; e = (DNSEntry *)e->link.next) {
     if (e->once_written_flag) {
       for (int j = 0; j < MAX_DNS_RETRIES; j++) {
         if (e->id[j] == id) {
@@ -855,7 +852,8 @@ get_dns(DNSHandler *h, uint16_t id)
         }
       }
     }
-  Lnext:;
+  Lnext:
+    ;
   }
   return NULL;
 }
@@ -864,7 +862,7 @@ get_dns(DNSHandler *h, uint16_t id)
 inline static DNSEntry *
 get_entry(DNSHandler *h, char *qname, int qtype)
 {
-  for (DNSEntry *e = h->entries.head; e; e = (DNSEntry *) e->link.next) {
+  for (DNSEntry *e = h->entries.head; e; e = (DNSEntry *)e->link.next) {
     if (e->qtype == qtype) {
       if (is_addr_query(qtype)) {
         if (!strcmp(qname, e->qname))
@@ -893,7 +891,7 @@ write_dns(DNSHandler *h)
   if (h->in_flight < dns_max_dns_in_flight) {
     DNSEntry *e = h->entries.head;
     while (e) {
-      DNSEntry *n = (DNSEntry *) e->link.next;
+      DNSEntry *n = (DNSEntry *)e->link.next;
       if (!e->written_flag) {
         if (dns_ns_rr) {
           int ns_start = h->name_server;
@@ -918,19 +916,19 @@ DNSHandler::get_query_id()
   uint16_t q1, q2;
   q2 = q1 = (uint16_t)(generator.random() & 0xFFFF);
   if (query_id_in_use(q2)) {
-    uint16_t i = q2>>6;
+    uint16_t i = q2 >> 6;
     while (qid_in_flight[i] == UINT64_MAX) {
-      if (++i ==  sizeof(qid_in_flight)/sizeof(uint64_t)) {
+      if (++i == sizeof(qid_in_flight) / sizeof(uint64_t)) {
         i = 0;
       }
-      if (i == q1>>6) {
+      if (i == q1 >> 6) {
         Error("[iocore_dns] get_query_id: Exhausted all DNS query ids");
         return q1;
       }
     }
     i <<= 6;
     q2 &= 0x3F;
-    while (query_id_in_use(i+q2)) {
+    while (query_id_in_use(i + q2)) {
       ++q2;
       q2 &= 0x3F;
       if (q2 == (q1 & 0x3F)) {
@@ -970,7 +968,7 @@ write_dns_event(DNSHandler *h, DNSEntry *e)
   uint16_t i = h->get_query_id();
   blob._h.id = htons(i);
   if (e->id[dns_retries - e->retries] >= 0) {
-    //clear previous id in case named was switched or domain was expanded
+    // clear previous id in case named was switched or domain was expanded
     h->release_query_id(e->id[dns_retries - e->retries]);
   }
   e->id[dns_retries - e->retries] = i;
@@ -1001,7 +999,7 @@ write_dns_event(DNSHandler *h, DNSEntry *e)
     e->timeout->cancel();
 
   if (h->txn_lookup_timeout) {
-    e->timeout = h->mutex->thread_holding->schedule_in(e, HRTIME_MSECONDS(h->txn_lookup_timeout));      //this is in msec
+    e->timeout = h->mutex->thread_holding->schedule_in(e, HRTIME_MSECONDS(h->txn_lookup_timeout)); // this is in msec
   } else {
     e->timeout = h->mutex->thread_holding->schedule_in(e, HRTIME_SECONDS(dns_timeout));
   }
@@ -1015,9 +1013,9 @@ write_dns_event(DNSHandler *h, DNSEntry *e)
 int
 DNSEntry::delayEvent(int event, Event *e)
 {
-  (void) event;
+  (void)event;
   if (dnsProcessor.handler) {
-    SET_HANDLER((DNSEntryHandler) & DNSEntry::mainEvent);
+    SET_HANDLER((DNSEntryHandler)&DNSEntry::mainEvent);
     return handleEvent(EVENT_IMMEDIATE, e);
   }
   e->schedule_in(DNS_DELAY_PERIOD);
@@ -1032,46 +1030,45 @@ DNSEntry::mainEvent(int event, Event *e)
   default:
     ink_assert(!"bad case");
     return EVENT_DONE;
-  case EVENT_IMMEDIATE:{
-      if (!dnsH)
-        dnsH = dnsProcessor.handler;
-      if (!dnsH) {
-        Debug("dns", "handler not found, retrying...");
-        SET_HANDLER((DNSEntryHandler) & DNSEntry::delayEvent);
-        return handleEvent(event, e);
-      }
+  case EVENT_IMMEDIATE: {
+    if (!dnsH)
+      dnsH = dnsProcessor.handler;
+    if (!dnsH) {
+      Debug("dns", "handler not found, retrying...");
+      SET_HANDLER((DNSEntryHandler)&DNSEntry::delayEvent);
+      return handleEvent(event, e);
+    }
 
-      // trailing '.' indicates no domain expansion
-      if (dns_search && ('.' != qname[orig_qname_len - 1])) {
-        domains = dnsH->m_res->dnsrch;
-        // start domain expansion straight away
-        // if lookup name has no '.'
-        if (domains && !strnchr(qname, '.', MAXDNAME)) {
-          qname[orig_qname_len] = '.';
-          qname_len = orig_qname_len + 1 + ink_strlcpy(qname + orig_qname_len + 1, *domains,
-                                                       MAXDNAME - (orig_qname_len + 1));
-          ++domains;
-        }
-      } else {
-        domains = NULL;
-      }
-      Debug("dns", "enqueing query %s", qname);
-      DNSEntry *dup = get_entry(dnsH, qname, qtype);
-      if (dup) {
-        Debug("dns", "collapsing NS request");
-        dup->dups.enqueue(this);
-      } else {
-        Debug("dns", "adding first to collapsing queue");
-        dnsH->entries.enqueue(this);
-        write_dns(dnsH);
+    // trailing '.' indicates no domain expansion
+    if (dns_search && ('.' != qname[orig_qname_len - 1])) {
+      domains = dnsH->m_res->dnsrch;
+      // start domain expansion straight away
+      // if lookup name has no '.'
+      if (domains && !strnchr(qname, '.', MAXDNAME)) {
+        qname[orig_qname_len] = '.';
+        qname_len = orig_qname_len + 1 + ink_strlcpy(qname + orig_qname_len + 1, *domains, MAXDNAME - (orig_qname_len + 1));
+        ++domains;
       }
-      return EVENT_DONE;
+    } else {
+      domains = NULL;
     }
+    Debug("dns", "enqueing query %s", qname);
+    DNSEntry *dup = get_entry(dnsH, qname, qtype);
+    if (dup) {
+      Debug("dns", "collapsing NS request");
+      dup->dups.enqueue(this);
+    } else {
+      Debug("dns", "adding first to collapsing queue");
+      dnsH->entries.enqueue(this);
+      write_dns(dnsH);
+    }
+    return EVENT_DONE;
+  }
   case EVENT_INTERVAL:
     Debug("dns", "timeout for query %s", qname);
     if (dnsH->txn_lookup_timeout) {
       timeout = NULL;
-      dns_result(dnsH, this, result_ent, false);        //do not retry -- we are over TXN timeout on DNS alone!
+      dns_result(dnsH, this, result_ent, false); // do not retry -- we are over TXN timeout on DNS alone!
       return EVENT_DONE;
     }
     if (written_flag) {
@@ -1087,7 +1084,7 @@ DNSEntry::mainEvent(int event, Event *e)
 }
 
 Action *
-DNSProcessor::getby(const char *x, int len, int type, Continuation *cont, Options const& opt)
+DNSProcessor::getby(const char *x, int len, int type, Continuation *cont, Options const &opt)
 {
   Debug("dns", "received query %s type = %d, timeout = %d", x, type, opt.timeout);
   if (type == T_SRV) {
@@ -1109,7 +1106,8 @@ DNSProcessor::getby(const char *x, int len, int type, Continuation *cont, Option
   is a retry-able and we have retries left.
 */
 static void
-dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry) {
+dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry)
+{
   ProxyMutex *mutex = h->mutex;
   bool cancelled = (e->action.cancelled ? true : false);
 
@@ -1132,8 +1130,8 @@ dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry) {
           Debug("dns", "domain too large %.*s + %s", e->orig_qname_len, e->qname, *e->domains);
         } else {
           e->qname[e->orig_qname_len] = '.';
-          e->qname_len = e->orig_qname_len + 1 + ink_strlcpy(e->qname + e->orig_qname_len + 1, *e->domains,
-                                                             MAXDNAME - (e->orig_qname_len + 1));
+          e->qname_len =
+            e->orig_qname_len + 1 + ink_strlcpy(e->qname + e->orig_qname_len + 1, *e->domains, MAXDNAME - (e->orig_qname_len + 1));
           ++(e->domains);
           e->retries = dns_retries;
           Debug("dns", "new name = %s retries = %d", e->qname, e->retries);
@@ -1171,8 +1169,8 @@ dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry) {
   if (is_debug_tag_set("dns")) {
     if (is_addr_query(e->qtype)) {
       ip_text_buffer buff;
-      char const* ptr = "<none>";
-      char const* result = "FAIL";
+      char const *ptr = "<none>";
+      char const *result = "FAIL";
       if (ent) {
         result = "SUCCESS";
         ptr = inet_ntop(e->qtype == T_AAAA ? AF_INET6 : AF_INET, ent->ent.h_addr_list[0], buff, sizeof(buff));
@@ -1280,8 +1278,8 @@ static bool
 dns_process(DNSHandler *handler, HostEnt *buf, int len)
 {
   ProxyMutex *mutex = handler->mutex;
-  HEADER *h = (HEADER *) (buf->buf);
-  DNSEntry *e = get_dns(handler, (uint16_t) ntohs(h->id));
+  HEADER *h = (HEADER *)(buf->buf);
+  DNSEntry *e = get_dns(handler, (uint16_t)ntohs(h->id));
   bool retry = false;
   bool server_ok = true;
   uint32_t temp_ttl = 0;
@@ -1290,8 +1288,8 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
   // Do we have an entry for this id?
   //
   if (!e || !e->written_flag) {
-    Debug("dns", "unknown DNS id = %u", (uint16_t) ntohs(h->id));
-    return false;               // cannot count this as a success
+    Debug("dns", "unknown DNS id = %u", (uint16_t)ntohs(h->id));
+    return false; // cannot count this as a success
   }
   //
   // It is no longer in flight
@@ -1308,28 +1306,27 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
     default:
       Warning("Unknown DNS error %d for [%s]", h->rcode, e->qname);
       retry = true;
-      server_ok = false;        // could be server problems
+      server_ok = false; // could be server problems
       goto Lerror;
-    case SERVFAIL:             // recoverable error
+    case SERVFAIL: // recoverable error
       retry = true;
-    case FORMERR:              // unrecoverable errors
+    case FORMERR: // unrecoverable errors
     case REFUSED:
     case NOTIMP:
       Debug("dns", "DNS error %d for [%s]", h->rcode, e->qname);
-      server_ok = false;        // could be server problems
+      server_ok = false; // could be server problems
       goto Lerror;
     case NOERROR:
     case NXDOMAIN:
-    case 6:                    // YXDOMAIN
-    case 7:                    // YXRRSET
-    case 8:                    // NOTAUTH
-    case 9:                    // NOTAUTH
-    case 10:                   // NOTZONE
+    case 6:  // YXDOMAIN
+    case 7:  // YXRRSET
+    case 8:  // NOTAUTH
+    case 9:  // NOTAUTH
+    case 10: // NOTZONE
       Debug("dns", "DNS error %d for [%s]", h->rcode, e->qname);
       goto Lerror;
     }
   } else {
-
     //
     // Initialize local data
     //
@@ -1340,19 +1337,19 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
     int ancount = ntohs(h->ancount);
     unsigned char *bp = buf->hostbuf;
     int buflen = sizeof(buf->hostbuf);
-    u_char *cp = ((u_char *) h) + HFIXEDSZ;
-    u_char *eom = (u_char *) h + len;
+    u_char *cp = ((u_char *)h) + HFIXEDSZ;
+    u_char *eom = (u_char *)h + len;
     int n;
     ink_assert(buf->srv_hosts.srv_host_count == 0 && buf->srv_hosts.srv_hosts_length == 0);
     buf->srv_hosts.srv_host_count = 0;
     buf->srv_hosts.srv_hosts_length = 0;
-    unsigned& num_srv = buf->srv_hosts.srv_host_count;
+    unsigned &num_srv = buf->srv_hosts.srv_host_count;
     int rname_len = -1;
 
     //
     // Expand name
     //
-    if ((n = ink_dn_expand((u_char *) h, eom, cp, bp, buflen)) < 0)
+    if ((n = ink_dn_expand((u_char *)h, eom, cp, bp, buflen)) < 0)
       goto Lerror;
 
     // Should we validate the query name?
@@ -1361,14 +1358,14 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
       int rlen = strlen((char *)bp);
 
       rname_len = rlen; // Save for later use
-      if ((qlen > 0) && ('.' == e->qname[qlen-1]))
+      if ((qlen > 0) && ('.' == e->qname[qlen - 1]))
         --qlen;
-      if ((rlen > 0) && ('.' == bp[rlen-1]))
+      if ((rlen > 0) && ('.' == bp[rlen - 1]))
         --rlen;
       // TODO: At some point, we might want to care about the case here, and use an algorithm
       // to randomly pick upper case characters in the query, and validate the response with
       // case sensitivity.
-      if ((qlen != rlen) || (strncasecmp(e->qname, (const char*)bp, qlen) != 0)) {
+      if ((qlen != rlen) || (strncasecmp(e->qname, (const char *)bp, qlen) != 0)) {
         // Bad mojo, forged?
         Warning("received DNS response with query name of '%s', but response query name is '%s'", e->qname, bp);
         goto Lerror;
@@ -1383,7 +1380,7 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
         n = strlen((char *)bp) + 1;
       else
         n = rname_len + 1;
-      buf->ent.h_name = (char *) bp;
+      buf->ent.h_name = (char *)bp;
       bp += n;
       buflen -= n;
     }
@@ -1391,10 +1388,10 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
     // Configure HostEnt data structure
     //
     u_char **ap = buf->host_aliases;
-    buf->ent.h_aliases = (char **) buf->host_aliases;
-    u_char **hap = (u_char **) buf->h_addr_ptrs;
+    buf->ent.h_aliases = (char **)buf->host_aliases;
+    u_char **hap = (u_char **)buf->h_addr_ptrs;
     *hap = NULL;
-    buf->ent.h_addr_list = (char **) buf->h_addr_ptrs;
+    buf->ent.h_addr_list = (char **)buf->h_addr_ptrs;
 
     //
     // INKqa10938: For customer (i.e. USPS) with closed environment, need to
@@ -1423,7 +1420,7 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
     /* added for SRV support [ebalsa]
        this skips the query section (qdcount)
      */
-    unsigned char *here = (unsigned char *) buf->buf + HFIXEDSZ;
+    unsigned char *here = (unsigned char *)buf->buf + HFIXEDSZ;
     if (e->qtype == T_SRV) {
       for (int ctr = ntohs(h->qdcount); ctr > 0; ctr--) {
         int strlen = dn_skipname(here, eom);
@@ -1436,7 +1433,7 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
     int answer = false, error = false;
 
     while (ancount-- > 0 && cp < eom && !error) {
-      n = ink_dn_expand((u_char *) h, eom, cp, bp, buflen);
+      n = ink_dn_expand((u_char *)h, eom, cp, bp, buflen);
       if (n < 0) {
         ++error;
         break;
@@ -1444,7 +1441,7 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
       cp += n;
       short int type;
       NS_GET16(type, cp);
-      cp += NS_INT16SZ;  // NS_GET16(cls, cp);
+      cp += NS_INT16SZ;       // NS_GET16(cls, cp);
       NS_GET32(temp_ttl, cp); // NOTE: this is not a "long" but 32-bits (from nameser_compat.h)
       if ((temp_ttl < buf->ttl) || (buf->ttl == 0))
         buf->ttl = temp_ttl;
@@ -1456,22 +1453,22 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
       if (is_addr_query(e->qtype) && type == T_CNAME) {
         if (ap >= &buf->host_aliases[DNS_MAX_ALIASES - 1])
           continue;
-        n = ink_dn_expand((u_char *) h, eom, cp, tbuf, sizeof(tbuf));
+        n = ink_dn_expand((u_char *)h, eom, cp, tbuf, sizeof(tbuf));
         if (n < 0) {
           ++error;
           break;
         }
         cp += n;
-        *ap++ = (unsigned char *) bp;
-        n = strlen((char *) bp) + 1;
+        *ap++ = (unsigned char *)bp;
+        n = strlen((char *)bp) + 1;
         bp += n;
         buflen -= n;
-        n = strlen((char *) tbuf) + 1;
+        n = strlen((char *)tbuf) + 1;
         if (n > buflen) {
           ++error;
           break;
         }
-        ink_strlcpy((char *) bp, (char *) tbuf, buflen);
+        ink_strlcpy((char *)bp, (char *)tbuf, buflen);
         bp += n;
         buflen -= n;
         Debug("dns", "received cname = %s", tbuf);
@@ -1485,35 +1482,35 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
       // Decode names
       //
       if (type == T_PTR) {
-        n = ink_dn_expand((u_char *) h, eom, cp, bp, buflen);
+        n = ink_dn_expand((u_char *)h, eom, cp, bp, buflen);
         if (n < 0) {
           ++error;
           break;
         }
         cp += n;
         if (!answer) {
-          buf->ent.h_name = (char *) bp;
+          buf->ent.h_name = (char *)bp;
           Debug("dns", "received PTR name = %s", bp);
-          n = strlen((char *) bp) + 1;
+          n = strlen((char *)bp) + 1;
           bp += n;
           buflen -= n;
         } else if (ap < &buf->host_aliases[DNS_MAX_ALIASES - 1]) {
           *ap++ = bp;
           Debug("dns", "received PTR alias = %s", bp);
-          n = strlen((char *) bp) + 1;
+          n = strlen((char *)bp) + 1;
           bp += n;
           buflen -= n;
         }
       } else if (type == T_SRV) {
         if (num_srv >= HOST_DB_MAX_ROUND_ROBIN_INFO)
           break;
-        cp = here;              /* hack */
+        cp = here; /* hack */
         int strlen = dn_skipname(cp, eom);
         cp += strlen;
         const unsigned char *srv_off = cp;
         cp += SRV_FIXEDSZ;
         cp += dn_skipname(cp, eom);
-        here = cp;              /* hack */
+        here = cp; /* hack */
         SRV *srv = &buf->srv_hosts.hosts[num_srv];
         int r = ink_ns_name_ntop(srv_off + SRV_SERVER, srv->host, MAXDNAME);
         if (r <= 0) {
@@ -1522,14 +1519,13 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
           goto Lerror;
         }
         Debug("dns_srv", "Discovered SRV record [from NS lookup] with cost:%d weight:%d port:%d with host:%s",
-            ink_get16(srv_off + SRV_COST),
-            ink_get16(srv_off + SRV_WEIGHT), ink_get16(srv_off + SRV_PORT), srv->host);
+              ink_get16(srv_off + SRV_COST), ink_get16(srv_off + SRV_WEIGHT), ink_get16(srv_off + SRV_PORT), srv->host);
 
         srv->port = ink_get16(srv_off + SRV_PORT);
         srv->priority = ink_get16(srv_off + SRV_COST);
         srv->weight = ink_get16(srv_off + SRV_WEIGHT);
         srv->host_len = r;
-        srv->host[r-1] = '\0';
+        srv->host[r - 1] = '\0';
         srv->key = makeHostHash(srv->host);
 
         if (srv->host[0] != '\0')
@@ -1547,27 +1543,26 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
           int nn;
           buf->ent.h_length = n;
           buf->ent.h_addrtype = T_A == type ? AF_INET : AF_INET6;
-          buf->ent.h_name = (char *) bp;
-          nn = strlen((char *) bp) + 1;
+          buf->ent.h_name = (char *)bp;
+          nn = strlen((char *)bp) + 1;
           Debug("dns", "received %s name = %s", QtypeName(type), bp);
           bp += nn;
           buflen -= nn;
         }
         // attempt to use the original buffer (if it is word aligned)
-        if (!(((uintptr_t) cp) % sizeof(unsigned int))) {
+        if (!(((uintptr_t)cp) % sizeof(unsigned int))) {
           *hap++ = cp;
           cp += n;
         } else {
           ip_text_buffer ip_string;
-          bp = (unsigned char *) align_pointer_forward(bp, sizeof(int));
+          bp = (unsigned char *)align_pointer_forward(bp, sizeof(int));
           if (bp + n >= buf->hostbuf + DNS_HOSTBUF_SIZE) {
             ++error;
             break;
           }
           memcpy((*hap++ = bp), cp, n);
           Debug("dns", "received %s = %s", QtypeName(type),
-            inet_ntop(T_AAAA == type ? AF_INET6 : AF_INET, bp, ip_string, sizeof(ip_string))
-          );
+                inet_ntop(T_AAAA == type ? AF_INET6 : AF_INET, bp, ip_string, sizeof(ip_string)));
           bp += n;
           cp += n;
         }
@@ -1584,14 +1579,15 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
       //
       if (!buf->ent.h_name) {
         Debug("dns", "inserting name = %s", e->qname);
-        ink_strlcpy((char *) bp, e->qname, sizeof(buf->hostbuf) - (bp - buf->hostbuf));
-        buf->ent.h_name = (char *) bp;
+        ink_strlcpy((char *)bp, e->qname, sizeof(buf->hostbuf) - (bp - buf->hostbuf));
+        buf->ent.h_name = (char *)bp;
       }
       dns_result(handler, e, buf, retry);
       return server_ok;
     }
   }
-Lerror:;
+Lerror:
+  ;
   DNS_INCREMENT_DYN_STAT(dns_lookup_fail_stat);
   dns_result(handler, e, NULL, retry);
   return server_ok;
@@ -1614,55 +1610,45 @@ ink_dns_init(ModuleVersion v)
   init_called = 1;
   // do one time stuff
   // create a stat block for HostDBStats
-  dns_rsb = RecAllocateRawStatBlock((int) DNS_Stat_Count);
+  dns_rsb = RecAllocateRawStatBlock((int)DNS_Stat_Count);
 
   //
   // Register statistics callbacks
   //
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.total_dns_lookups",
-                     RECD_INT, RECP_PERSISTENT, (int) dns_total_lookups_stat, RecRawStatSyncSum);
-
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.lookup_avg_time",
-                     RECD_INT, RECP_PERSISTENT, (int) dns_response_time_stat, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.total_dns_lookups", RECD_INT, RECP_PERSISTENT,
+                     (int)dns_total_lookups_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.success_avg_time",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) dns_success_time_stat, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.lookup_avg_time", RECD_INT, RECP_PERSISTENT,
+                     (int)dns_response_time_stat, RecRawStatSyncHrTimeAvg);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.lookup_successes",
-                     RECD_INT, RECP_PERSISTENT, (int) dns_lookup_success_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.success_avg_time", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)dns_success_time_stat, RecRawStatSyncHrTimeAvg);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.fail_avg_time",
-                     RECD_INT, RECP_PERSISTENT, (int) dns_fail_time_stat, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.lookup_successes", RECD_INT, RECP_PERSISTENT,
+                     (int)dns_lookup_success_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.lookup_failures",
-                     RECD_INT, RECP_PERSISTENT, (int) dns_lookup_fail_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.fail_avg_time", RECD_INT, RECP_PERSISTENT, (int)dns_fail_time_stat,
+                     RecRawStatSyncHrTimeAvg);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.retries", RECD_INT, RECP_PERSISTENT, (int) dns_retries_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.lookup_failures", RECD_INT, RECP_PERSISTENT,
+                     (int)dns_lookup_fail_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.max_retries_exceeded",
-                     RECD_INT, RECP_PERSISTENT, (int) dns_max_retries_exceeded_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.retries", RECD_INT, RECP_PERSISTENT, (int)dns_retries_stat,
+                     RecRawStatSyncSum);
 
-  RecRegisterRawStat(dns_rsb, RECT_PROCESS,
-                     "proxy.process.dns.in_flight",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) dns_in_flight_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.max_retries_exceeded", RECD_INT, RECP_PERSISTENT,
+                     (int)dns_max_retries_exceeded_stat, RecRawStatSyncSum);
 
+  RecRegisterRawStat(dns_rsb, RECT_PROCESS, "proxy.process.dns.in_flight", RECD_INT, RECP_NON_PERSISTENT, (int)dns_in_flight_stat,
+                     RecRawStatSyncSum);
 }
 
 
 #ifdef TS_HAS_TESTS
 struct DNSRegressionContinuation;
-typedef int (DNSRegressionContinuation::*DNSRegContHandler) (int, void *);
+typedef int (DNSRegressionContinuation::*DNSRegContHandler)(int, void *);
 
-struct DNSRegressionContinuation: public Continuation
-{
+struct DNSRegressionContinuation : public Continuation {
   int hosts;
   const char **hostnames;
   int type;
@@ -1672,21 +1658,22 @@ struct DNSRegressionContinuation: public Continuation
   int i;
   RegressionTest *test;
 
-  int mainEvent(int event, HostEnt *he)
+  int
+  mainEvent(int event, HostEnt *he)
   {
-    (void) event;
+    (void)event;
     if (event == DNS_EVENT_LOOKUP) {
       if (he) {
         struct in_addr in;
         ++found;
-        in.s_addr = *(unsigned int *) he->ent.h_addr_list[0];
+        in.s_addr = *(unsigned int *)he->ent.h_addr_list[0];
         rprintf(test, "host %s [%s] = %s\n", hostnames[i - 1], he->ent.h_name, inet_ntoa(in));
       } else {
         rprintf(test, "host %s not found\n", hostnames[i - 1]);
       }
     }
     if (i < hosts) {
-        dnsProcessor.gethostbyname(this, hostnames[i], DNSProcessor::Options().setHostResStyle(HOST_RES_IPV4_ONLY));
+      dnsProcessor.gethostbyname(this, hostnames[i], DNSProcessor::Options().setHostResStyle(HOST_RES_IPV4_ONLY));
       ++i;
       return EVENT_CONT;
     } else {
@@ -1699,22 +1686,18 @@ struct DNSRegressionContinuation: public Continuation
   }
 
   DNSRegressionContinuation(int ahosts, int atofind, const char **ahostnames, RegressionTest *t, int atype, int *astatus)
-   :  Continuation(new_ProxyMutex()), hosts(ahosts), hostnames(ahostnames), type(atype),
-      status(astatus), found(0), tofind(atofind), i(0), test(t) {
-    SET_HANDLER((DNSRegContHandler) & DNSRegressionContinuation::mainEvent);
+    : Continuation(new_ProxyMutex()), hosts(ahosts), hostnames(ahostnames), type(atype), status(astatus), found(0), tofind(atofind),
+      i(0), test(t)
+  {
+    SET_HANDLER((DNSRegContHandler)&DNSRegressionContinuation::mainEvent);
   }
 };
 
-static const char *dns_test_hosts[] = {
-  "www.apple.com",
-  "www.ibm.com",
-  "www.microsoft.com",
-  "www.coke.com"
-};
+static const char *dns_test_hosts[] = {"www.apple.com", "www.ibm.com", "www.microsoft.com", "www.coke.com"};
 
-REGRESSION_TEST(DNS) (RegressionTest *t, int atype, int *pstatus) {
-  eventProcessor.schedule_in(new DNSRegressionContinuation(4, 4, dns_test_hosts, t, atype, pstatus),
-                             HRTIME_SECONDS(1));
+REGRESSION_TEST(DNS)(RegressionTest *t, int atype, int *pstatus)
+{
+  eventProcessor.schedule_in(new DNSRegressionContinuation(4, 4, dns_test_hosts, t, atype, pstatus), HRTIME_SECONDS(1));
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/DNSConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNSConnection.cc b/iocore/dns/DNSConnection.cc
index 2b982be..bba1fe0 100644
--- a/iocore/dns/DNSConnection.cc
+++ b/iocore/dns/DNSConnection.cc
@@ -36,10 +36,10 @@
 // set in the OS
 // #define RECV_BUF_SIZE            (1024*64)
 // #define SEND_BUF_SIZE            (1024*64)
-#define FIRST_RANDOM_PORT        (16000)
-#define LAST_RANDOM_PORT         (60000)
+#define FIRST_RANDOM_PORT (16000)
+#define LAST_RANDOM_PORT (60000)
 
-#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
+#define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y))
 
 DNSConnection::Options const DNSConnection::DEFAULT_OPTIONS;
 
@@ -47,8 +47,7 @@ DNSConnection::Options const DNSConnection::DEFAULT_OPTIONS;
 // Functions
 //
 
-DNSConnection::DNSConnection():
-  fd(NO_FD), num(0), generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t) this)), handler(NULL)
+DNSConnection::DNSConnection() : fd(NO_FD), num(0), generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t) this)), handler(NULL)
 {
   memset(&ip, 0, sizeof(ip));
 }
@@ -79,7 +78,7 @@ DNSConnection::trigger()
 }
 
 int
-DNSConnection::connect(sockaddr const* addr, Options const& opt)
+DNSConnection::connect(sockaddr const *addr, Options const &opt)
 //                       bool non_blocking_connect, bool use_tcp, bool non_blocking, bool bind_random_port)
 {
   ink_assert(fd == NO_FD);
@@ -114,11 +113,11 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
     }
     bind_size = sizeof(sockaddr_in6);
   } else if (AF_INET == af) {
-      if (ats_is_ip4(opt._local_ipv4))
-        ats_ip_copy(&bind_addr.sa, opt._local_ipv4);
-      else
-        bind_addr.sin.sin_addr.s_addr = INADDR_ANY;
-      bind_size = sizeof(sockaddr_in);
+    if (ats_is_ip4(opt._local_ipv4))
+      ats_ip_copy(&bind_addr.sa, opt._local_ipv4);
+    else
+      bind_addr.sin.sin_addr.s_addr = INADDR_ANY;
+    bind_size = sizeof(sockaddr_in);
   } else {
     ink_assert(!"Target DNS address must be IP.");
   }
@@ -148,19 +147,20 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
       goto Lok;
     }
     Warning("unable to bind random DNS port");
-  Lok:;
+  Lok:
+    ;
   } else if (ats_is_ip(&bind_addr.sa)) {
     ip_text_buffer b;
     res = socketManager.ink_bind(fd, &bind_addr.sa, bind_size, Proto);
-    if (res < 0) Warning("Unable to bind local address to %s.",
-      ats_ip_ntop(&bind_addr.sa, b, sizeof b));
+    if (res < 0)
+      Warning("Unable to bind local address to %s.", ats_ip_ntop(&bind_addr.sa, b, sizeof b));
   }
 
   if (opt._non_blocking_connect)
     if ((res = safe_nonblocking(fd)) < 0)
       goto Lerror;
 
-  // cannot do this after connection on non-blocking connect
+// cannot do this after connection on non-blocking connect
 #ifdef SET_TCP_NO_DELAY
   if (opt._use_tcp)
     if ((res = safe_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, SOCKOPT_ON, sizeof(int))) < 0)
@@ -176,7 +176,7 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
 #endif
 
   ats_ip_copy(&ip.sa, addr);
-  res =::connect(fd, addr, ats_ip_size(addr));
+  res = ::connect(fd, addr, ats_ip_size(addr));
 
   if (!res || ((res < 0) && (errno == EINPROGRESS || errno == EWOULDBLOCK))) {
     if (!opt._non_blocking_connect && opt._non_blocking_io)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/I_DNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/I_DNSProcessor.h b/iocore/dns/I_DNSProcessor.h
index 31c21ea..510cf5c 100644
--- a/iocore/dns/I_DNSProcessor.h
+++ b/iocore/dns/I_DNSProcessor.h
@@ -26,12 +26,12 @@
 
 #include "SRV.h"
 
-#define  MAX_DNS_PACKET_LEN         8192
-#define  DNS_MAX_ALIASES              35
-#define  DNS_MAX_ADDRS                35
-#define  DNS_HOSTBUF_SIZE           8192
-#define  DOMAIN_SERVICE_PORT          53
-#define  DEFAULT_DOMAIN_NAME_SERVER    0        // use the default server
+#define MAX_DNS_PACKET_LEN 8192
+#define DNS_MAX_ALIASES 35
+#define DNS_MAX_ADDRS 35
+#define DNS_HOSTBUF_SIZE 8192
+#define DOMAIN_SERVICE_PORT 53
+#define DEFAULT_DOMAIN_NAME_SERVER 0 // use the default server
 
 
 /**
@@ -53,9 +53,10 @@ struct HostEnt : RefCountObj {
 
   virtual void free();
 
-  HostEnt() {
-    size_t base = sizeof(force_VFPT_to_top);  // preserve VFPT
-    memset(((char*)this) + base, 0, sizeof(*this) - base);
+  HostEnt()
+  {
+    size_t base = sizeof(force_VFPT_to_top); // preserve VFPT
+    memset(((char *)this) + base, 0, sizeof(*this) - base);
   }
 };
 
@@ -63,8 +64,7 @@ extern EventType ET_DNS;
 
 struct DNSHandler;
 
-struct DNSProcessor: public Processor
-{
+struct DNSProcessor : public Processor {
   // Public Interface
   //
 
@@ -74,7 +74,7 @@ struct DNSProcessor: public Processor
 
     /// Query handler to use.
     /// Default: single threaded handler.
-    DNSHandler* handler;
+    DNSHandler *handler;
     /// Query timeout value.
     /// Default: @c DEFAULT_DNS_TIMEOUT (or as set in records.config)
     int timeout; ///< Timeout value for request.
@@ -87,19 +87,19 @@ struct DNSProcessor: public Processor
 
     /// Set @a handler option.
     /// @return This object.
-    self& setHandler(DNSHandler* handler);
+    self &setHandler(DNSHandler *handler);
 
     /// Set @a timeout option.
     /// @return This object.
-    self& setTimeout(int timeout);
+    self &setTimeout(int timeout);
 
     /// Set host query @a style option.
     /// @return This object.
-    self& setHostResStyle(HostResStyle style);
+    self &setHostResStyle(HostResStyle style);
 
     /// Reset to default constructed values.
     /// @return This object.
-    self& reset();
+    self &reset();
   };
 
   // DNS lookup
@@ -108,21 +108,21 @@ struct DNSProcessor: public Processor
   // NOTE: the HostEnt *block is freed when the function returns
   //
 
-  Action *gethostbyname(Continuation *cont, const char *name, Options const& opt);
-  Action *getSRVbyname(Continuation *cont, const char *name, Options const& opt);
-  Action *gethostbyname(Continuation *cont, const char *name, int len, Options const& opt);
-  Action *gethostbyaddr(Continuation *cont, IpAddr const* ip, Options const& opt);
+  Action *gethostbyname(Continuation *cont, const char *name, Options const &opt);
+  Action *getSRVbyname(Continuation *cont, const char *name, Options const &opt);
+  Action *gethostbyname(Continuation *cont, const char *name, int len, Options const &opt);
+  Action *gethostbyaddr(Continuation *cont, IpAddr const *ip, Options const &opt);
 
 
   // Processor API
   //
   /* currently dns system uses event threads
    * dont pass any value to the call */
-  int start(int no_of_extra_dns_threads=0, size_t stacksize=DEFAULT_STACKSIZE);
+  int start(int no_of_extra_dns_threads = 0, size_t stacksize = DEFAULT_STACKSIZE);
 
   // Open/close a link to a 'named' (done in start())
   //
-  void open(sockaddr const* ns = 0);
+  void open(sockaddr const *ns = 0);
 
   DNSProcessor();
 
@@ -141,7 +141,7 @@ struct DNSProcessor: public Processor
       For address resolution ( @a type is @c T_PTR ), @a x should be a
       @c sockaddr cast to  @c char @c const* .
    */
-  Action *getby(const char *x, int len, int type, Continuation *cont, Options const& opt);
+  Action *getby(const char *x, int len, int type, Continuation *cont, Options const &opt);
 
   void dns_init();
 };
@@ -157,58 +157,55 @@ extern DNSProcessor dnsProcessor;
 //
 
 inline Action *
-DNSProcessor::getSRVbyname(Continuation *cont, const char *name, Options const& opt)
+DNSProcessor::getSRVbyname(Continuation *cont, const char *name, Options const &opt)
 {
   return getby(name, 0, T_SRV, cont, opt);
 }
 
 inline Action *
-DNSProcessor::gethostbyname(Continuation *cont, const char *name, Options const& opt)
+DNSProcessor::gethostbyname(Continuation *cont, const char *name, Options const &opt)
 {
   return getby(name, 0, T_A, cont, opt);
 }
 
 inline Action *
-DNSProcessor::gethostbyname(Continuation *cont, const char *name, int len, Options const& opt)
+DNSProcessor::gethostbyname(Continuation *cont, const char *name, int len, Options const &opt)
 {
   return getby(name, len, T_A, cont, opt);
 }
 
 inline Action *
-DNSProcessor::gethostbyaddr(Continuation *cont, IpAddr const* addr, Options const& opt)
+DNSProcessor::gethostbyaddr(Continuation *cont, IpAddr const *addr, Options const &opt)
 {
-  return getby(reinterpret_cast<char const*>(addr), 0, T_PTR, cont, opt);
+  return getby(reinterpret_cast<char const *>(addr), 0, T_PTR, cont, opt);
 }
 
-inline DNSProcessor::Options::Options()
-                    : handler(0)
-                    , timeout(0)
-                    , host_res_style(HOST_RES_IPV4)
+inline DNSProcessor::Options::Options() : handler(0), timeout(0), host_res_style(HOST_RES_IPV4)
 {
 }
 
-inline DNSProcessor::Options&
-DNSProcessor::Options::setHandler(DNSHandler* h)
+inline DNSProcessor::Options &
+DNSProcessor::Options::setHandler(DNSHandler *h)
 {
   handler = h;
   return *this;
 }
 
-inline DNSProcessor::Options&
+inline DNSProcessor::Options &
 DNSProcessor::Options::setTimeout(int t)
 {
   timeout = t;
   return *this;
 }
 
-inline DNSProcessor::Options&
+inline DNSProcessor::Options &
 DNSProcessor::Options::setHostResStyle(HostResStyle style)
 {
   host_res_style = style;
   return *this;
 }
 
-inline DNSProcessor::Options&
+inline DNSProcessor::Options &
 DNSProcessor::Options::reset()
 {
   *this = Options();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/I_SplitDNS.h
----------------------------------------------------------------------
diff --git a/iocore/dns/I_SplitDNS.h b/iocore/dns/I_SplitDNS.h
index 11cad06..2142de2 100644
--- a/iocore/dns/I_SplitDNS.h
+++ b/iocore/dns/I_SplitDNS.h
@@ -35,9 +35,7 @@
 
 #define SPLITDNS_MODULE_MAJOR_VERSION 1
 #define SPLITDNS_MODULE_MINOR_VERSION 0
-#define SPLITDNS_MODULE_VERSION makeModuleVersion(                 \
-                                    SPLITDNS_MODULE_MAJOR_VERSION, \
-                                    SPLITDNS_MODULE_MINOR_VERSION, \
-                                    PUBLIC_MODULE_HEADER)
+#define SPLITDNS_MODULE_VERSION \
+  makeModuleVersion(SPLITDNS_MODULE_MAJOR_VERSION, SPLITDNS_MODULE_MINOR_VERSION, PUBLIC_MODULE_HEADER)
 
 #endif //_I_SPLIT_DNS_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/I_SplitDNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/I_SplitDNSProcessor.h b/iocore/dns/I_SplitDNSProcessor.h
index a2bf094..dd7f260 100644
--- a/iocore/dns/I_SplitDNSProcessor.h
+++ b/iocore/dns/I_SplitDNSProcessor.h
@@ -38,16 +38,14 @@ struct SplitDNS;
    -------------------------------------------------------------- */
 
 
-struct SplitDNSConfig
-{
-
+struct SplitDNSConfig {
   static void startup();
 
   static bool isSplitDNSEnabled();
 
   static void reconfigure();
   static SplitDNS *acquire();
-  static void release(SplitDNS * params);
+  static void release(SplitDNS *params);
   static void print();
 
   static int m_id;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/Inline.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/Inline.cc b/iocore/dns/Inline.cc
index 7ced38a..27da8cd 100644
--- a/iocore/dns/Inline.cc
+++ b/iocore/dns/Inline.cc
@@ -28,5 +28,3 @@
 
 #define TS_INLINE
 #include "P_DNS.h"
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/P_DNS.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_DNS.h b/iocore/dns/P_DNS.h
index 632367c..b37320e 100644
--- a/iocore/dns/P_DNS.h
+++ b/iocore/dns/P_DNS.h
@@ -27,7 +27,7 @@
 
 
  ****************************************************************************/
-#if !defined (_P_DNS_h_)
+#if !defined(_P_DNS_h_)
 #define _P_DNS_h_
 
 #include "libts.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/P_DNSConnection.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_DNSConnection.h b/iocore/dns/P_DNSConnection.h
index eedd54c..8fac46e 100644
--- a/iocore/dns/P_DNSConnection.h
+++ b/iocore/dns/P_DNSConnection.h
@@ -57,19 +57,19 @@ struct DNSConnection {
     bool _bind_random_port;
     /// Bind to this local address when using IPv6.
     /// Default: unset, bind to IN6ADDR_ANY.
-    sockaddr const* _local_ipv6;
+    sockaddr const *_local_ipv6;
     /// Bind to this local address when using IPv4.
     /// Default: unset, bind to INADDRY_ANY.
-    sockaddr const* _local_ipv4;
+    sockaddr const *_local_ipv4;
 
     Options();
 
-    self& setUseTcp(bool p);
-    self& setNonBlockingConnect(bool p);
-    self& setNonBlockingIo(bool p);
-    self& setBindRandomPort(bool p);
-    self& setLocalIpv6(sockaddr const* addr);
-    self& setLocalIpv4(sockaddr const* addr);
+    self &setUseTcp(bool p);
+    self &setNonBlockingConnect(bool p);
+    self &setNonBlockingIo(bool p);
+    self &setBindRandomPort(bool p);
+    self &setLocalIpv6(sockaddr const *addr);
+    self &setLocalIpv4(sockaddr const *addr);
   };
 
   int fd;
@@ -78,13 +78,13 @@ struct DNSConnection {
   LINK(DNSConnection, link);
   EventIO eio;
   InkRand generator;
-  DNSHandler* handler;
+  DNSHandler *handler;
 
-  int connect(sockaddr const* addr, Options const& opt = DEFAULT_OPTIONS);
-/*
-              bool non_blocking_connect = NON_BLOCKING_CONNECT,
-              bool use_tcp = CONNECT_WITH_TCP, bool non_blocking = NON_BLOCKING, bool bind_random_port = BIND_ANY_PORT);
-*/
+  int connect(sockaddr const *addr, Options const &opt = DEFAULT_OPTIONS);
+  /*
+                bool non_blocking_connect = NON_BLOCKING_CONNECT,
+                bool use_tcp = CONNECT_WITH_TCP, bool non_blocking = NON_BLOCKING, bool bind_random_port = BIND_ANY_PORT);
+  */
   int close();
   void trigger();
 
@@ -95,26 +95,45 @@ struct DNSConnection {
 };
 
 inline DNSConnection::Options::Options()
-  : _non_blocking_connect(true)
-  , _non_blocking_io(true)
-  , _use_tcp(false)
-  , _bind_random_port(true)
-  , _local_ipv6(0)
-  , _local_ipv4(0)
+  : _non_blocking_connect(true), _non_blocking_io(true), _use_tcp(false), _bind_random_port(true), _local_ipv6(0), _local_ipv4(0)
 {
 }
 
-inline DNSConnection::Options&
-DNSConnection::Options::setNonBlockingIo(bool p) { _non_blocking_io = p; return *this; }
-inline DNSConnection::Options&
-DNSConnection::Options::setNonBlockingConnect(bool p) { _non_blocking_connect = p; return *this; }
-inline DNSConnection::Options&
-DNSConnection::Options::setUseTcp(bool p) { _use_tcp = p; return *this; }
-inline DNSConnection::Options&
-DNSConnection::Options::setBindRandomPort(bool p) { _bind_random_port = p; return *this; }
-inline DNSConnection::Options&
-DNSConnection::Options::setLocalIpv4(sockaddr const* ip) { _local_ipv4 = ip; return *this; }
-inline DNSConnection::Options&
-DNSConnection::Options::setLocalIpv6(sockaddr const* ip) { _local_ipv6 = ip; return *this; }
+inline DNSConnection::Options &
+DNSConnection::Options::setNonBlockingIo(bool p)
+{
+  _non_blocking_io = p;
+  return *this;
+}
+inline DNSConnection::Options &
+DNSConnection::Options::setNonBlockingConnect(bool p)
+{
+  _non_blocking_connect = p;
+  return *this;
+}
+inline DNSConnection::Options &
+DNSConnection::Options::setUseTcp(bool p)
+{
+  _use_tcp = p;
+  return *this;
+}
+inline DNSConnection::Options &
+DNSConnection::Options::setBindRandomPort(bool p)
+{
+  _bind_random_port = p;
+  return *this;
+}
+inline DNSConnection::Options &
+DNSConnection::Options::setLocalIpv4(sockaddr const *ip)
+{
+  _local_ipv4 = ip;
+  return *this;
+}
+inline DNSConnection::Options &
+DNSConnection::Options::setLocalIpv6(sockaddr const *ip)
+{
+  _local_ipv6 = ip;
+  return *this;
+}
 
 #endif /*_P_DNSConnection_h*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/P_DNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h
index ccfa31a..09c2384 100644
--- a/iocore/dns/P_DNSProcessor.h
+++ b/iocore/dns/P_DNSProcessor.h
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 
-#if !defined (_P_DNSProcessor_h_)
+#if !defined(_P_DNSProcessor_h_)
 #define _P_DNSProcessor_h_
 
 /*
@@ -33,19 +33,19 @@
 */
 #include "I_EventSystem.h"
 
-#define MAX_NAMED                           32
-#define DEFAULT_DNS_RETRIES                 5
-#define MAX_DNS_RETRIES                     9
-#define DEFAULT_DNS_TIMEOUT                 30
-#define MAX_DNS_IN_FLIGHT                   2048
-#define DEFAULT_FAILOVER_NUMBER             (DEFAULT_DNS_RETRIES + 1)
-#define DEFAULT_FAILOVER_PERIOD             (DEFAULT_DNS_TIMEOUT + 30)
+#define MAX_NAMED 32
+#define DEFAULT_DNS_RETRIES 5
+#define MAX_DNS_RETRIES 9
+#define DEFAULT_DNS_TIMEOUT 30
+#define MAX_DNS_IN_FLIGHT 2048
+#define DEFAULT_FAILOVER_NUMBER (DEFAULT_DNS_RETRIES + 1)
+#define DEFAULT_FAILOVER_PERIOD (DEFAULT_DNS_TIMEOUT + 30)
 // how many seconds before FAILOVER_PERIOD to try the primary with
 // a well known address
-#define DEFAULT_FAILOVER_TRY_PERIOD         (DEFAULT_DNS_TIMEOUT + 1)
-#define DEFAULT_DNS_SEARCH           1
-#define FAILOVER_SOON_RETRY          5
-#define NO_NAMESERVER_SELECTED       -1
+#define DEFAULT_FAILOVER_TRY_PERIOD (DEFAULT_DNS_TIMEOUT + 1)
+#define DEFAULT_DNS_SEARCH 1
+#define FAILOVER_SOON_RETRY 5
+#define NO_NAMESERVER_SELECTED -1
 
 //
 // Config
@@ -63,13 +63,13 @@ extern unsigned int dns_sequence_number;
 // Constants
 //
 
-#define DNS_PERIOD                          HRTIME_MSECONDS(-100)
-#define DNS_DELAY_PERIOD                    HRTIME_MSECONDS(10)
-#define DNS_SEQUENCE_NUMBER_RESTART_OFFSET  4000
-#define DNS_PRIMARY_RETRY_PERIOD            HRTIME_SECONDS(5)
-#define DNS_PRIMARY_REOPEN_PERIOD           HRTIME_SECONDS(60)
-#define BAD_DNS_RESULT                      ((HostEnt*)(uintptr_t)-1)
-#define DEFAULT_NUM_TRY_SERVER              8
+#define DNS_PERIOD HRTIME_MSECONDS(-100)
+#define DNS_DELAY_PERIOD HRTIME_MSECONDS(10)
+#define DNS_SEQUENCE_NUMBER_RESTART_OFFSET 4000
+#define DNS_PRIMARY_RETRY_PERIOD HRTIME_SECONDS(5)
+#define DNS_PRIMARY_REOPEN_PERIOD HRTIME_SECONDS(60)
+#define BAD_DNS_RESULT ((HostEnt *)(uintptr_t)-1)
+#define DEFAULT_NUM_TRY_SERVER 8
 
 // these are from nameser.h
 #ifndef HFIXEDSZ
@@ -82,16 +82,15 @@ extern unsigned int dns_sequence_number;
 
 // Events
 
-#define DNS_EVENT_LOOKUP             DNS_EVENT_EVENTS_START
+#define DNS_EVENT_LOOKUP DNS_EVENT_EVENTS_START
 
 extern int dns_fd;
 
 void *dns_udp_receiver(void *arg);
 
 
-//Stats
-enum DNS_Stats
-{
+// Stats
+enum DNS_Stats {
   dns_total_lookups_stat,
   dns_response_time_stat,
   dns_success_time_stat,
@@ -113,31 +112,25 @@ extern RecRawStatBlock *dns_rsb;
 
 // Stat Macros
 
-#define DNS_DEBUG_COUNT_DYN_STAT(_x, _y)                            \
-  RecIncrRawStatCount(dns_rsb, mutex->thread_holding, (int)_x, _y)
+#define DNS_DEBUG_COUNT_DYN_STAT(_x, _y) RecIncrRawStatCount(dns_rsb, mutex->thread_holding, (int)_x, _y)
 
-#define DNS_INCREMENT_DYN_STAT(_x)                              \
-  RecIncrRawStatSum(dns_rsb, mutex->thread_holding, (int)_x, 1)
+#define DNS_INCREMENT_DYN_STAT(_x) RecIncrRawStatSum(dns_rsb, mutex->thread_holding, (int)_x, 1)
 
-#define DNS_DECREMENT_DYN_STAT(_x)                                \
-  RecIncrRawStatSum(dns_rsb, mutex->thread_holding, (int)_x, -1)
+#define DNS_DECREMENT_DYN_STAT(_x) RecIncrRawStatSum(dns_rsb, mutex->thread_holding, (int)_x, -1)
 
-#define DNS_SUM_DYN_STAT(_x, _r)                                  \
-  RecIncrRawStatSum(dns_rsb, mutex->thread_holding, (int)_x, _r)
+#define DNS_SUM_DYN_STAT(_x, _r) RecIncrRawStatSum(dns_rsb, mutex->thread_holding, (int)_x, _r)
 
-#define DNS_READ_DYN_STAT(_x, _count, _sum) do {    \
-    RecGetRawStatSum(dns_rsb, (int)_x, &_sum);      \
-    RecGetRawStatCount(dns_rsb, (int)_x, &_count);  \
+#define DNS_READ_DYN_STAT(_x, _count, _sum)        \
+  do {                                             \
+    RecGetRawStatSum(dns_rsb, (int)_x, &_sum);     \
+    RecGetRawStatCount(dns_rsb, (int)_x, &_count); \
   } while (0)
 
-#define DNS_SET_DYN_COUNT(_x, _count)           \
-  RecSetRawStatCount(dns_rsb, _x, _count);
+#define DNS_SET_DYN_COUNT(_x, _count) RecSetRawStatCount(dns_rsb, _x, _count);
 
-#define DNS_INCREMENT_THREAD_DYN_STAT(_s, _t)   \
-  RecIncrRawStatSum(dns_rsb, _t, (int) _s, 1);
+#define DNS_INCREMENT_THREAD_DYN_STAT(_s, _t) RecIncrRawStatSum(dns_rsb, _t, (int)_s, 1);
 
-#define DNS_DECREMENT_THREAD_DYN_STAT(_s, _t)   \
-  RecIncrRawStatSum(dns_rsb, _t, (int) _s, -1);
+#define DNS_DECREMENT_THREAD_DYN_STAT(_s, _t) RecIncrRawStatSum(dns_rsb, _t, (int)_s, -1);
 
 /**
   One DNSEntry is allocated per outstanding request. This continuation
@@ -145,10 +138,9 @@ extern RecRawStatBlock *dns_rsb;
   information about the request and its status.
 
 */
-struct DNSEntry: public Continuation
-{
+struct DNSEntry : public Continuation {
   int id[MAX_DNS_RETRIES];
-  int qtype; ///< Type of query to send.
+  int qtype;                   ///< Type of query to send.
   HostResStyle host_res_style; ///< Preferred IP address family.
   int retries;
   int which_ns;
@@ -173,16 +165,12 @@ struct DNSEntry: public Continuation
   int delayEvent(int event, Event *e);
   int post(DNSHandler *h, HostEnt *ent);
   int postEvent(int event, Event *e);
-  void init(const char *x, int len, int qtype_arg, Continuation *acont, DNSProcessor::Options const& opt);
-
-   DNSEntry()
-     : Continuation(NULL),
-       qtype(0),
-       host_res_style(HOST_RES_NONE),
-       retries(DEFAULT_DNS_RETRIES),
-       which_ns(NO_NAMESERVER_SELECTED), submit_time(0), send_time(0), qname_len(0),
-       orig_qname_len(0), domains(0), timeout(0), result_ent(0), dnsH(0), written_flag(false),
-       once_written_flag(false), last(false)
+  void init(const char *x, int len, int qtype_arg, Continuation *acont, DNSProcessor::Options const &opt);
+
+  DNSEntry()
+    : Continuation(NULL), qtype(0), host_res_style(HOST_RES_NONE), retries(DEFAULT_DNS_RETRIES), which_ns(NO_NAMESERVER_SELECTED),
+      submit_time(0), send_time(0), qname_len(0), orig_qname_len(0), domains(0), timeout(0), result_ent(0), dnsH(0),
+      written_flag(false), once_written_flag(false), last(false)
   {
     for (int i = 0; i < MAX_DNS_RETRIES; i++)
       id[i] = -1;
@@ -191,7 +179,7 @@ struct DNSEntry: public Continuation
 };
 
 
-typedef int (DNSEntry::*DNSEntryHandler) (int, void *);
+typedef int (DNSEntry::*DNSEntryHandler)(int, void *);
 
 struct DNSEntry;
 
@@ -200,8 +188,7 @@ struct DNSEntry;
   UDP port.
 
 */
-struct DNSHandler: public Continuation
-{
+struct DNSHandler : public Continuation {
   /// This is used as the target if round robin isn't set.
   IpEndpoint ip;
   IpEndpoint local_ipv6; ///< Local V6 address if set.
@@ -228,14 +215,16 @@ struct DNSHandler: public Continuation
 
   InkRand generator;
   // bitmap of query ids in use
-  uint64_t qid_in_flight[(USHRT_MAX+1)/64];
+  uint64_t qid_in_flight[(USHRT_MAX + 1) / 64];
 
-  void received_one(int i)
+  void
+  received_one(int i)
   {
     failover_number[i] = failover_soon_number[i] = crossed_failover_number[i] = 0;
   }
 
-  void sent_one()
+  void
+  sent_one()
   {
     ++failover_number[name_server];
     Debug("dns", "sent_one: failover_number for resolver %d is %d", name_server, failover_number[name_server]);
@@ -243,18 +232,20 @@ struct DNSHandler: public Continuation
       crossed_failover_number[name_server] = ink_get_hrtime();
   }
 
-  bool failover_now(int i)
+  bool
+  failover_now(int i)
   {
     if (is_debug_tag_set("dns")) {
       Debug("dns", "failover_now: Considering immediate failover, target time is %" PRId64 "",
             (ink_hrtime)HRTIME_SECONDS(dns_failover_period));
       Debug("dns", "\tdelta time is %" PRId64 "", (ink_get_hrtime() - crossed_failover_number[i]));
     }
-    return (crossed_failover_number[i] &&
-            ((ink_get_hrtime() - crossed_failover_number[i]) > HRTIME_SECONDS(dns_failover_period)));
+    return (crossed_failover_number[i] && ((ink_get_hrtime() - crossed_failover_number[i]) > HRTIME_SECONDS(dns_failover_period)));
   }
 
-  bool failover_soon(int i) {
+  bool
+  failover_soon(int i)
+  {
     return (crossed_failover_number[i] &&
             ((ink_get_hrtime() - crossed_failover_number[i]) >
              (HRTIME_SECONDS(dns_failover_try_period + failover_soon_number[i] * FAILOVER_SOON_RETRY))));
@@ -265,7 +256,7 @@ struct DNSHandler: public Continuation
   int startEvent_sdns(int event, Event *e);
   int mainEvent(int event, Event *e);
 
-  void open_con(sockaddr const* addr, bool failed = false, int icon = 0);
+  void open_con(sockaddr const *addr, bool failed = false, int icon = 0);
   void failover();
   void rr_failure(int ndx);
   void recover();
@@ -274,16 +265,22 @@ struct DNSHandler: public Continuation
   void switch_named(int ndx);
   uint16_t get_query_id();
 
-  void release_query_id(uint16_t qid) {
-    qid_in_flight[qid >> 6] &= (uint64_t)~(0x1ULL << (qid & 0x3F));
+  void
+  release_query_id(uint16_t qid)
+  {
+    qid_in_flight[qid >> 6] &= (uint64_t) ~(0x1ULL << (qid & 0x3F));
   };
 
-  void set_query_id_in_use(uint16_t qid) {
+  void
+  set_query_id_in_use(uint16_t qid)
+  {
     qid_in_flight[qid >> 6] |= (uint64_t)(0x1ULL << (qid & 0x3F));
   };
 
-  bool query_id_in_use(uint16_t qid) {
-    return (qid_in_flight[(uint16_t)(qid) >> 6] & (uint64_t)(0x1ULL << ((uint16_t)(qid) & 0x3F))) != 0;
+  bool
+  query_id_in_use(uint16_t qid)
+  {
+    return (qid_in_flight[(uint16_t)(qid) >> 6] & (uint64_t)(0x1ULL << ((uint16_t)(qid)&0x3F))) != 0;
   };
 
   DNSHandler();
@@ -298,8 +295,7 @@ private:
 
    A record for an single server
    -------------------------------------------------------------- */
-struct DNSServer
-{
+struct DNSServer {
   IpEndpoint x_server_ip[MAXNS];
   char x_dns_ip_line[MAXDNAME * 2];
 
@@ -308,8 +304,7 @@ struct DNSServer
 
   DNSHandler *x_dnsH;
 
-  DNSServer()
-  : x_dnsH(NULL)
+  DNSServer() : x_dnsH(NULL)
   {
     memset(x_server_ip, 0, sizeof(x_server_ip));
 
@@ -320,10 +315,10 @@ struct DNSServer
 };
 
 
-TS_INLINE DNSHandler::DNSHandler()
- : Continuation(NULL), n_con(0), in_flight(0), name_server(0), in_write_dns(0),
-  hostent_cache(0), last_primary_retry(0), last_primary_reopen(0),
-  m_res(0), txn_lookup_timeout(0), generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t)this))
+TS_INLINE
+DNSHandler::DNSHandler()
+  : Continuation(NULL), n_con(0), in_flight(0), name_server(0), in_write_dns(0), hostent_cache(0), last_primary_retry(0),
+    last_primary_reopen(0), m_res(0), txn_lookup_timeout(0), generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t) this))
 {
   ats_ip_invalidate(&ip);
   for (int i = 0; i < MAX_NAMED; i++) {
@@ -339,8 +334,7 @@ TS_INLINE DNSHandler::DNSHandler()
   Debug("net_epoll", "inline DNSHandler::DNSHandler()");
 }
 
-#define DOT_SEPARATED(_x)                                   \
-  ((unsigned char*)&(_x))[0], ((unsigned char*)&(_x))[1],   \
-    ((unsigned char*)&(_x))[2], ((unsigned char*)&(_x))[3]
+#define DOT_SEPARATED(_x) \
+  ((unsigned char *)&(_x))[0], ((unsigned char *)&(_x))[1], ((unsigned char *)&(_x))[2], ((unsigned char *)&(_x))[3]
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/P_SplitDNS.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_SplitDNS.h b/iocore/dns/P_SplitDNS.h
index d63c1d5..64f78cc 100644
--- a/iocore/dns/P_SplitDNS.h
+++ b/iocore/dns/P_SplitDNS.h
@@ -38,11 +38,9 @@
 #include "ControlMatcher.h"
 #include "P_SplitDNSProcessor.h"
 
-#undef  SPLITDNS_MODULE_VERSION
-#define SPLITDNS_MODULE_VERSION makeModuleVersion(                 \
-                                    SPLITDNS_MODULE_MAJOR_VERSION, \
-                                    SPLITDNS_MODULE_MINOR_VERSION, \
-                                    PRIVATE_MODULE_HEADER)
+#undef SPLITDNS_MODULE_VERSION
+#define SPLITDNS_MODULE_VERSION \
+  makeModuleVersion(SPLITDNS_MODULE_MAJOR_VERSION, SPLITDNS_MODULE_MINOR_VERSION, PRIVATE_MODULE_HEADER)
 
 
 #endif /* _P_SPLIT_DNS_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/P_SplitDNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_SplitDNSProcessor.h b/iocore/dns/P_SplitDNSProcessor.h
index bc06c87..7d63a99 100644
--- a/iocore/dns/P_SplitDNSProcessor.h
+++ b/iocore/dns/P_SplitDNSProcessor.h
@@ -54,10 +54,10 @@ struct SplitDNSResult;
 
 struct DNSServer;
 
-enum DNSResultType
-{ DNS_SRVR_UNDEFINED = 0,
+enum DNSResultType {
+  DNS_SRVR_UNDEFINED = 0,
   DNS_SRVR_SPECIFIED,
-  DNS_SRVR_FAIL
+  DNS_SRVR_FAIL,
 };
 
 typedef ControlMatcher<SplitDNSRecord, SplitDNSResult> DNS_table;
@@ -66,8 +66,7 @@ typedef ControlMatcher<SplitDNSRecord, SplitDNSResult> DNS_table;
 /* --------------------------------------------------------------
    **                struct SplitDNSResult
    -------------------------------------------------------------- */
-struct SplitDNSResult
-{
+struct SplitDNSResult {
   SplitDNSResult();
 
   /* ------------
@@ -91,13 +90,12 @@ struct SplitDNSResult
 /* --------------------------------------------------------------
    **                struct SplitDNS
    -------------------------------------------------------------- */
-struct SplitDNS:public ConfigInfo
-{
+struct SplitDNS : public ConfigInfo {
   SplitDNS();
   ~SplitDNS();
 
   void *getDNSRecord(const char *hostname);
-  void findServer(RequestData * rdata, SplitDNSResult * result);
+  void findServer(RequestData *rdata, SplitDNSResult *result);
 
 
   DNS_table *m_DNSSrvrTable;
@@ -117,7 +115,8 @@ struct SplitDNS:public ConfigInfo
 /* --------------------------------------------------------------
    SplitDNSConfig::isSplitDNSEnabled()
    -------------------------------------------------------------- */
-TS_INLINE bool SplitDNSConfig::isSplitDNSEnabled()
+TS_INLINE bool
+SplitDNSConfig::isSplitDNSEnabled()
 {
   return (gsplit_dns_enabled ? true : false);
 }
@@ -133,18 +132,17 @@ TS_INLINE bool SplitDNSConfig::isSplitDNSEnabled()
 
    A record for an single server
    -------------------------------------------------------------- */
-class DNSRequestData: public RequestData
+class DNSRequestData : public RequestData
 {
 public:
-
   DNSRequestData();
 
   char *get_string();
 
   const char *get_host();
 
-  sockaddr const* get_ip(); // unused required virtual method.
-  sockaddr const* get_client_ip(); // unused required virtual method.
+  sockaddr const *get_ip();        // unused required virtual method.
+  sockaddr const *get_client_ip(); // unused required virtual method.
 
   const char *m_pHost;
 };
@@ -153,8 +151,8 @@ public:
 /* --------------------------------------------------------------
    DNSRequestData::get_string()
    -------------------------------------------------------------- */
-TS_INLINE DNSRequestData::DNSRequestData()
-: m_pHost(0)
+TS_INLINE
+DNSRequestData::DNSRequestData() : m_pHost(0)
 {
 }
 
@@ -165,7 +163,7 @@ TS_INLINE DNSRequestData::DNSRequestData()
 TS_INLINE char *
 DNSRequestData::get_string()
 {
-  return ats_strdup((char *) m_pHost);
+  return ats_strdup((char *)m_pHost);
 }
 
 
@@ -182,7 +180,8 @@ DNSRequestData::get_host()
 /* --------------------------------------------------------------
    DNSRequestData::get_ip()
    -------------------------------------------------------------- */
-TS_INLINE sockaddr const* DNSRequestData::get_ip()
+TS_INLINE sockaddr const *
+DNSRequestData::get_ip()
 {
   return NULL;
 }
@@ -191,7 +190,8 @@ TS_INLINE sockaddr const* DNSRequestData::get_ip()
 /* --------------------------------------------------------------
    DNSRequestData::get_client_ip()
    -------------------------------------------------------------- */
-TS_INLINE sockaddr const* DNSRequestData::get_client_ip()
+TS_INLINE sockaddr const *
+DNSRequestData::get_client_ip()
 {
   return NULL;
 }
@@ -201,20 +201,19 @@ TS_INLINE sockaddr const* DNSRequestData::get_client_ip()
 
    A record for a configuration line in the splitdns.config file
    -------------------------------------------------------------- */
-class SplitDNSRecord: public ControlBase
+class SplitDNSRecord : public ControlBase
 {
 public:
-
   SplitDNSRecord();
   ~SplitDNSRecord();
 
-  config_parse_error Init(matcher_line * line_info);
+  config_parse_error Init(matcher_line *line_info);
 
   const char *ProcessDNSHosts(char *val);
   const char *ProcessDomainSrchList(char *val);
   const char *ProcessDefDomain(char *val);
 
-  void UpdateMatch(SplitDNSResult * result, RequestData * rdata);
+  void UpdateMatch(SplitDNSResult *result, RequestData *rdata);
   void Print();
 
   DNSServer m_servers;
@@ -226,16 +225,18 @@ public:
 /* --------------------------------------------------------------
    SplitDNSRecord::SplitDNSRecord()
    -------------------------------------------------------------- */
-TS_INLINE SplitDNSRecord::SplitDNSRecord()
-: m_dnsSrvr_cnt(0), m_domain_srch_list(0)
-{ }
+TS_INLINE
+SplitDNSRecord::SplitDNSRecord() : m_dnsSrvr_cnt(0), m_domain_srch_list(0)
+{
+}
 
 
 /* --------------------------------------------------------------
    SplitDNSRecord::~SplitDNSRecord()
    -------------------------------------------------------------- */
 TS_INLINE SplitDNSRecord::~SplitDNSRecord()
-{ }
+{
+}
 
 
 /* ------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/dns/SRV.h
----------------------------------------------------------------------
diff --git a/iocore/dns/SRV.h b/iocore/dns/SRV.h
index 8e3e697..45fe130 100644
--- a/iocore/dns/SRV.h
+++ b/iocore/dns/SRV.h
@@ -29,11 +29,10 @@
 
 struct HostDBInfo;
 
-#define HOST_DB_MAX_ROUND_ROBIN_INFO  16
-#define RAND_INV_RANGE(r) ((int) ((RAND_MAX + 1) / (r)))
+#define HOST_DB_MAX_ROUND_ROBIN_INFO 16
+#define RAND_INV_RANGE(r) ((int)((RAND_MAX + 1) / (r)))
 
-struct SRV
-{
+struct SRV {
   unsigned int weight;
   unsigned int port;
   unsigned int priority;
@@ -42,33 +41,24 @@ struct SRV
   unsigned int key;
   char host[MAXDNAME];
 
-  SRV():weight(0), port(0), priority(0), ttl(0), host_len(0), key(0)
-  {
-    host[0] = '\0';
-  }
+  SRV() : weight(0), port(0), priority(0), ttl(0), host_len(0), key(0) { host[0] = '\0'; }
 };
 
-inline bool
-operator<(const SRV &left, const SRV &right)
+inline bool operator<(const SRV &left, const SRV &right)
 {
   // lower priorities first, then the key
   return (left.priority == right.priority) ? (left.key < right.key) : (left.priority < right.priority);
 }
 
 
-struct SRVHosts
-{
+struct SRVHosts {
   unsigned srv_host_count;
   unsigned srv_hosts_length;
   SRV hosts[HOST_DB_MAX_ROUND_ROBIN_INFO];
 
-  ~SRVHosts()
-  {
-  }
+  ~SRVHosts() {}
 
-  SRVHosts():srv_host_count(0), srv_hosts_length(0)
-  {
-  }
+  SRVHosts() : srv_host_count(0), srv_hosts_length(0) {}
 };
 
 #endif


[42/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/I_Store.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Store.h b/iocore/cache/I_Store.h
index c49ab38..6ebfd6e 100644
--- a/iocore/cache/I_Store.h
+++ b/iocore/cache/I_Store.h
@@ -33,12 +33,11 @@
 
 #include "libts.h"
 
-#define STORE_BLOCK_SIZE       8192
-#define STORE_BLOCK_SHIFT      13
+#define STORE_BLOCK_SIZE 8192
+#define STORE_BLOCK_SHIFT 13
 #define DEFAULT_HW_SECTOR_SIZE 512
 
-enum span_error_t
-{
+enum span_error_t {
   SPAN_ERROR_OK,
   SPAN_ERROR_UNKNOWN,
   SPAN_ERROR_NOT_FOUND,
@@ -48,50 +47,57 @@ enum span_error_t
   SPAN_ERROR_MEDIA_PROBE,
 };
 
-struct span_diskid_t
-{
+struct span_diskid_t {
   int64_t id[2];
 
-  bool operator < (const span_diskid_t& rhs) const {
-    return id[0] < rhs.id[0] && id[1] < rhs.id[1];
-  }
+  bool operator<(const span_diskid_t &rhs) const { return id[0] < rhs.id[0] && id[1] < rhs.id[1]; }
 
-  bool operator == (const span_diskid_t& rhs) const {
-    return id[0] == rhs.id[0] && id[1] == rhs.id[1];
-  }
+  bool operator==(const span_diskid_t &rhs) const { return id[0] == rhs.id[0] && id[1] == rhs.id[1]; }
 
-  int64_t& operator[] (unsigned i) {
-    return id[i];
-  }
+  int64_t &operator[](unsigned i) { return id[i]; }
 };
 
 //
 // A Store is a place to store data.
 // Those on the same disk should be in a linked list.
 //
-struct Span
-{
-  int64_t blocks;                 // in STORE_BLOCK_SIZE blocks
-  int64_t offset;                 // used only if (file == true); in bytes
+struct Span {
+  int64_t blocks; // in STORE_BLOCK_SIZE blocks
+  int64_t offset; // used only if (file == true); in bytes
   unsigned hw_sector_size;
   unsigned alignment;
   span_diskid_t disk_id;
-  int forced_volume_num;  ///< Force span in to specific volume.
+  int forced_volume_num; ///< Force span in to specific volume.
 private:
   bool is_mmapable_internal;
+
 public:
-  bool file_pathname;           // the pathname is a file
+  bool file_pathname; // the pathname is a file
   // v- used as a magic location for copy constructor.
   // we memcpy everything before this member and do explicit assignment for the rest.
   ats_scoped_str pathname;
   ats_scoped_str hash_base_string; ///< Used to seed the stripe assignment hash.
   SLINK(Span, link);
 
-  bool is_mmapable() const { return is_mmapable_internal; }
-  void set_mmapable(bool s) { is_mmapable_internal = s; }
-  int64_t size() const { return blocks * STORE_BLOCK_SIZE; }
+  bool
+  is_mmapable() const
+  {
+    return is_mmapable_internal;
+  }
+  void
+  set_mmapable(bool s)
+  {
+    is_mmapable_internal = s;
+  }
+  int64_t
+  size() const
+  {
+    return blocks * STORE_BLOCK_SIZE;
+  }
 
-  int64_t total_blocks() const {
+  int64_t
+  total_blocks() const
+  {
     if (link.next) {
       return blocks + link.next->total_blocks();
     } else {
@@ -99,16 +105,21 @@ public:
     }
   }
 
-  Span *nth(unsigned i) {
+  Span *
+  nth(unsigned i)
+  {
     Span *x = this;
     while (x && i--)
       x = x->link.next;
     return x;
   }
 
-  unsigned paths() const {
+  unsigned
+  paths() const
+  {
     int i = 0;
-    for (const Span * x = this; x; i++, x = x->link.next);
+    for (const Span *x = this; x; i++, x = x->link.next)
+      ;
     return i;
   }
 
@@ -117,28 +128,27 @@ public:
 
   /// Duplicate this span and all chained spans.
   Span *dup();
-  int64_t end() const { return offset + blocks; }
+  int64_t
+  end() const
+  {
+    return offset + blocks;
+  }
 
   const char *init(const char *n, int64_t size);
 
   // 0 on success -1 on failure
-  int path(char *filename,      // for non-file, the filename in the director
-           int64_t * offset,      // for file, start offset (unsupported)
-           char *buf, int buflen);      // where to store the path
+  int path(char *filename,         // for non-file, the filename in the director
+           int64_t *offset,        // for file, start offset (unsupported)
+           char *buf, int buflen); // where to store the path
 
   /// Set the hash seed string.
-  void hash_base_string_set(char const* s);
+  void hash_base_string_set(char const *s);
   /// Set the volume number.
   void volume_number_set(int n);
 
   Span()
-    : blocks(0)
-    , offset(0)
-    , hw_sector_size(DEFAULT_HW_SECTOR_SIZE)
-    , alignment(0)
-    , forced_volume_num(-1)
-    , is_mmapable_internal(false)
-    , file_pathname(false)
+    : blocks(0), offset(0), hw_sector_size(DEFAULT_HW_SECTOR_SIZE), alignment(0), forced_volume_num(-1),
+      is_mmapable_internal(false), file_pathname(false)
   {
     disk_id[0] = disk_id[1] = 0;
   }
@@ -146,51 +156,56 @@ public:
   /// Copy constructor.
   /// @internal Prior to this implementation handling the char* pointers was done manual
   /// at every call site. We also need this because we have ats_scoped_str members.
-  Span(Span const& that) {
-    memcpy(this, &that, reinterpret_cast<intptr_t>(&(static_cast<Span*>(0)->pathname)));
-    if (that.pathname) pathname = ats_strdup(that.pathname);
-    if (that.hash_base_string) hash_base_string = ats_strdup(that.hash_base_string);
+  Span(Span const &that)
+  {
+    memcpy(this, &that, reinterpret_cast<intptr_t>(&(static_cast<Span *>(0)->pathname)));
+    if (that.pathname)
+      pathname = ats_strdup(that.pathname);
+    if (that.hash_base_string)
+      hash_base_string = ats_strdup(that.hash_base_string);
     link.next = NULL;
   }
 
   ~Span();
 
-  static const char * errorstr(span_error_t serr);
+  static const char *errorstr(span_error_t serr);
 };
 
-struct Store
-{
+struct Store {
   //
   // Public Interface
   // Thread-safe operations
   //
 
   // spread evenly on all disks
-  void spread_alloc(Store & s, unsigned int blocks, bool mmapable = true);
-  void alloc(Store & s, unsigned int blocks, bool only_one = false, bool mmapable = true);
+  void spread_alloc(Store &s, unsigned int blocks, bool mmapable = true);
+  void alloc(Store &s, unsigned int blocks, bool only_one = false, bool mmapable = true);
 
-  Span *alloc_one(unsigned int blocks, bool mmapable) {
+  Span *
+  alloc_one(unsigned int blocks, bool mmapable)
+  {
     Store s;
     alloc(s, blocks, true, mmapable);
     if (s.n_disks) {
       Span *t = s.disk[0];
-        s.disk[0] = NULL;
-        return t;
+      s.disk[0] = NULL;
+      return t;
     }
 
     return NULL;
   }
   // try to allocate, return (s == gotten, diff == not gotten)
-  void try_realloc(Store & s, Store & diff);
+  void try_realloc(Store &s, Store &diff);
 
   // free back the contents of a store.
   // must have been JUST allocated (no intervening allocs/frees)
-  void free(Store & s);
-  void add(Span * s);
-  void add(Store & s);
-  void dup(Store & s);
+  void free(Store &s);
+  void add(Span *s);
+  void add(Store &s);
+  void dup(Store &s);
   void sort();
-  void extend(unsigned i)
+  void
+  extend(unsigned i)
   {
     if (i > n_disks) {
       disk = (Span **)ats_realloc(disk, i * sizeof(Span *));
@@ -202,14 +217,16 @@ struct Store
   }
 
   // Non Thread-safe operations
-  unsigned int total_blocks(unsigned after = 0) const {
+  unsigned int
+  total_blocks(unsigned after = 0) const
+  {
     int64_t t = 0;
     for (unsigned i = after; i < n_disks; i++) {
       if (disk[i]) {
         t += disk[i]->total_blocks();
       }
     }
-    return (unsigned int) t;
+    return (unsigned int)t;
   }
   // 0 on success -1 on failure
   // these operations are NOT thread-safe
@@ -244,6 +261,6 @@ struct Store
 };
 
 // store either free or in the cache, can be stolen for reconfiguration
-void stealStore(Store & s, int blocks);
+void stealStore(Store &s, int blocks);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/Inline.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Inline.cc b/iocore/cache/Inline.cc
index c1b63c4..ecd72d2 100644
--- a/iocore/cache/Inline.cc
+++ b/iocore/cache/Inline.cc
@@ -28,5 +28,3 @@
 
 #define TS_INLINE
 #include "P_Cache.h"
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheArray.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheArray.h b/iocore/cache/P_CacheArray.h
index 681290a..69a1feb 100644
--- a/iocore/cache/P_CacheArray.h
+++ b/iocore/cache/P_CacheArray.h
@@ -24,22 +24,22 @@
 #ifndef __CACHE_ARRAY_H__
 #define __CACHE_ARRAY_H__
 
-#define FAST_DATA_SIZE    4
+#define FAST_DATA_SIZE 4
 
 
-template<class T> struct CacheArray
-{
-  CacheArray(const T * val, int initial_size = 0);
-   ~CacheArray();
+template <class T> struct CacheArray {
+  CacheArray(const T *val, int initial_size = 0);
+  ~CacheArray();
 
-  operator  const T *() const;
-  operator  T *();
-    T & operator[] (int idx);
-    T & operator() (int idx);
+  operator const T *() const;
+  operator T *();
+  T &operator[](int idx);
+  T &operator()(int idx);
   T *detach();
   int length();
   void clear();
-  void set_length(int i)
+  void
+  set_length(int i)
   {
     pos = i - 1;
   }
@@ -54,12 +54,10 @@ template<class T> struct CacheArray
 };
 
 
-template<class T> TS_INLINE CacheArray<T>::CacheArray(const T * val, int initial_size)
-  :
-data(NULL),
-default_val(val),
-size(0),
-pos(-1)
+template <class T>
+TS_INLINE
+CacheArray<T>::CacheArray(const T *val, int initial_size)
+  : data(NULL), default_val(val), size(0), pos(-1)
 {
   if (initial_size > 0) {
     int i = 1;
@@ -71,32 +69,32 @@ pos(-1)
   }
 }
 
-template<class T> TS_INLINE CacheArray<T>::~CacheArray()
+template <class T> TS_INLINE CacheArray<T>::~CacheArray()
 {
   if (data) {
     if (data != fast_data) {
-      delete[]data;
+      delete[] data;
     }
   }
 }
 
-template<class T> TS_INLINE CacheArray<T>::operator  const T *()
-const
+template <class T> TS_INLINE CacheArray<T>::operator const T *() const
 {
-  return
-    data;
+  return data;
 }
 
-template <class T> TS_INLINE CacheArray <T>::operator T *()
+template <class T> TS_INLINE CacheArray<T>::operator T *()
 {
   return data;
 }
 
-template<class T> TS_INLINE T & CacheArray<T>::operator [](int idx) {
+template <class T> TS_INLINE T &CacheArray<T>::operator[](int idx)
+{
   return data[idx];
 }
 
-template<class T> TS_INLINE T & CacheArray<T>::operator ()(int idx) {
+template <class T> TS_INLINE T &CacheArray<T>::operator()(int idx)
+{
   if (idx >= size) {
     int new_size;
 
@@ -120,7 +118,9 @@ template<class T> TS_INLINE T & CacheArray<T>::operator ()(int idx) {
   return data[idx];
 }
 
-template<class T> TS_INLINE T * CacheArray<T>::detach()
+template <class T>
+TS_INLINE T *
+CacheArray<T>::detach()
 {
   T *d;
 
@@ -130,16 +130,20 @@ template<class T> TS_INLINE T * CacheArray<T>::detach()
   return d;
 }
 
-template<class T> TS_INLINE int CacheArray<T>::length()
+template <class T>
+TS_INLINE int
+CacheArray<T>::length()
 {
   return pos + 1;
 }
 
-template<class T> TS_INLINE void CacheArray<T>::clear()
+template <class T>
+TS_INLINE void
+CacheArray<T>::clear()
 {
   if (data) {
     if (data != fast_data) {
-      delete[]data;
+      delete[] data;
     }
     data = NULL;
   }
@@ -148,7 +152,9 @@ template<class T> TS_INLINE void CacheArray<T>::clear()
   pos = -1;
 }
 
-template<class T> TS_INLINE void CacheArray<T>::resize(int new_size)
+template <class T>
+TS_INLINE void
+CacheArray<T>::resize(int new_size)
 {
   if (new_size > size) {
     T *new_data;
@@ -170,7 +176,7 @@ template<class T> TS_INLINE void CacheArray<T>::resize(int new_size)
 
     if (data) {
       if (data != fast_data) {
-        delete[]data;
+        delete[] data;
       }
     }
     data = new_data;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheBC.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheBC.h b/iocore/cache/P_CacheBC.h
index cc1c400..2164692 100644
--- a/iocore/cache/P_CacheBC.h
+++ b/iocore/cache/P_CacheBC.h
@@ -25,105 +25,117 @@
 #ifndef _P_CACHE_BC_H__
 #define _P_CACHE_BC_H__
 
-namespace cache_bc {
-
-  /* This looks kind of dumb, but I think it's useful. We import external structure
-     dependencies in to this namespace so we can at least (1) notice them and
-     (2) change them if the current structure changes.
-  */
-
-  typedef HTTPHdr HTTPHdr_v21;
-  typedef HdrHeap HdrHeap_v23;
-  typedef CryptoHash CryptoHash_v23;
-  typedef HTTPCacheAlt HTTPCacheAlt_v23;
-
-  /** Cache backwards compatibility structure - the fragment table.
-      This is copied from @c HTTPCacheAlt in @c HTTP.h.
-  */
-  struct HTTPCacheFragmentTable {
-    /// # of fragment offsets in this alternate.
-    /// @note This is one less than the number of fragments.
-    int m_frag_offset_count;
-    /// Type of offset for a fragment.
-    typedef uint64_t FragOffset;
-    /// Table of fragment offsets.
-    /// @note The offsets are forward looking so that frag[0] is the
-    /// first byte past the end of fragment 0 which is also the first
-    /// byte of fragment 1. For this reason there is no fragment offset
-    /// for the last fragment.
-    FragOffset *m_frag_offsets;
-    /// # of fragment offsets built in to object.
-    static int const N_INTEGRAL_FRAG_OFFSETS = 4;
-    /// Integral fragment offset table.
-    FragOffset m_integral_frag_offsets[N_INTEGRAL_FRAG_OFFSETS];
-  };
-
-  // From before moving the fragment table to the alternate.
-  struct HTTPCacheAlt_v21
+namespace cache_bc
+{
+/* This looks kind of dumb, but I think it's useful. We import external structure
+   dependencies in to this namespace so we can at least (1) notice them and
+   (2) change them if the current structure changes.
+*/
+
+typedef HTTPHdr HTTPHdr_v21;
+typedef HdrHeap HdrHeap_v23;
+typedef CryptoHash CryptoHash_v23;
+typedef HTTPCacheAlt HTTPCacheAlt_v23;
+
+/** Cache backwards compatibility structure - the fragment table.
+    This is copied from @c HTTPCacheAlt in @c HTTP.h.
+*/
+struct HTTPCacheFragmentTable {
+  /// # of fragment offsets in this alternate.
+  /// @note This is one less than the number of fragments.
+  int m_frag_offset_count;
+  /// Type of offset for a fragment.
+  typedef uint64_t FragOffset;
+  /// Table of fragment offsets.
+  /// @note The offsets are forward looking so that frag[0] is the
+  /// first byte past the end of fragment 0 which is also the first
+  /// byte of fragment 1. For this reason there is no fragment offset
+  /// for the last fragment.
+  FragOffset *m_frag_offsets;
+  /// # of fragment offsets built in to object.
+  static int const N_INTEGRAL_FRAG_OFFSETS = 4;
+  /// Integral fragment offset table.
+  FragOffset m_integral_frag_offsets[N_INTEGRAL_FRAG_OFFSETS];
+};
+
+// From before moving the fragment table to the alternate.
+struct HTTPCacheAlt_v21 {
+  uint32_t m_magic;
+
+  int32_t m_writeable;
+  int32_t m_unmarshal_len;
+
+  int32_t m_id;
+  int32_t m_rid;
+
+  int32_t m_object_key[4];
+  int32_t m_object_size[2];
+
+  HTTPHdr_v21 m_request_hdr;
+  HTTPHdr_v21 m_response_hdr;
+
+  time_t m_request_sent_time;
+  time_t m_response_received_time;
+
+  RefCountObj *m_ext_buffer;
+
+  // The following methods were added for BC support.
+  // Checks itself to verify that it is unmarshalled and v21 format.
+  bool
+  is_unmarshalled_format() const
   {
-    uint32_t m_magic;
-
-    int32_t m_writeable;
-    int32_t m_unmarshal_len;
-
-    int32_t m_id;
-    int32_t m_rid;
-
-    int32_t m_object_key[4];
-    int32_t m_object_size[2];
-
-    HTTPHdr_v21 m_request_hdr;
-    HTTPHdr_v21 m_response_hdr;
-
-    time_t m_request_sent_time;
-    time_t m_response_received_time;
-
-    RefCountObj *m_ext_buffer;
-
-    // The following methods were added for BC support.
-    // Checks itself to verify that it is unmarshalled and v21 format.
-    bool is_unmarshalled_format() const {
-      return CACHE_ALT_MAGIC_MARSHALED == m_magic && reinterpret_cast<intptr_t>(m_request_hdr.m_heap) == sizeof(*this);
-    }
-  };
-
-  /// Really just a namespace, doesn't depend on any of the members.
-  struct HTTPInfo_v21 {
-    typedef uint64_t FragOffset;
-    /// Version upgrade methods
-    /// @a src , @a dst , and @a n are updated upon return.
-    /// @a n is the space in @a dst remaining.
-    /// @return @c false if something went wrong.
-    static bool copy_and_upgrade_unmarshalled_to_v23(char*& dst, char*& src, size_t& length, int n_frags, FragOffset* frag_offsets);
-    /// The size of the marshalled data of a marshalled alternate header.
-    static size_t marshalled_length(void* data);
-  };
-
-  /// Pre version 24.
-  struct Doc_v23
-  {
-    uint32_t magic;         // DOC_MAGIC
-    uint32_t len;           // length of this segment (including hlen, flen & sizeof(Doc), unrounded)
-    uint64_t total_len;     // total length of document
-    CryptoHash_v23 first_key;    ///< first key in object.
-    CryptoHash_v23 key; ///< Key for this doc.
-    uint32_t hlen; ///< Length of this header.
-    uint32_t doc_type:8;       ///< Doc type - indicates the format of this structure and its content.
-    uint32_t _flen:24;   ///< Fragment table length.
-    uint32_t sync_serial;
-    uint32_t write_serial;
-    uint32_t pinned;        // pinned until
-    uint32_t checksum;
-
-    char* hdr();
-    char* data();
-    size_t data_len();
-  };
-
-  static size_t const sizeofDoc_v23 = sizeof(Doc_v23);
-  char* Doc_v23::data() { return reinterpret_cast<char*>(this) + sizeofDoc_v23 + _flen + hlen; }
-  size_t Doc_v23::data_len() { return len - sizeofDoc_v23 - hlen; }
-  char* Doc_v23::hdr() {  return reinterpret_cast<char*>(this) + sizeofDoc_v23; }
+    return CACHE_ALT_MAGIC_MARSHALED == m_magic && reinterpret_cast<intptr_t>(m_request_hdr.m_heap) == sizeof(*this);
+  }
+};
+
+/// Really just a namespace, doesn't depend on any of the members.
+struct HTTPInfo_v21 {
+  typedef uint64_t FragOffset;
+  /// Version upgrade methods
+  /// @a src , @a dst , and @a n are updated upon return.
+  /// @a n is the space in @a dst remaining.
+  /// @return @c false if something went wrong.
+  static bool copy_and_upgrade_unmarshalled_to_v23(char *&dst, char *&src, size_t &length, int n_frags, FragOffset *frag_offsets);
+  /// The size of the marshalled data of a marshalled alternate header.
+  static size_t marshalled_length(void *data);
+};
+
+/// Pre version 24.
+struct Doc_v23 {
+  uint32_t magic;           // DOC_MAGIC
+  uint32_t len;             // length of this segment (including hlen, flen & sizeof(Doc), unrounded)
+  uint64_t total_len;       // total length of document
+  CryptoHash_v23 first_key; ///< first key in object.
+  CryptoHash_v23 key;       ///< Key for this doc.
+  uint32_t hlen;            ///< Length of this header.
+  uint32_t doc_type : 8;    ///< Doc type - indicates the format of this structure and its content.
+  uint32_t _flen : 24;      ///< Fragment table length.
+  uint32_t sync_serial;
+  uint32_t write_serial;
+  uint32_t pinned; // pinned until
+  uint32_t checksum;
+
+  char *hdr();
+  char *data();
+  size_t data_len();
+};
+
+static size_t const sizeofDoc_v23 = sizeof(Doc_v23);
+char *
+Doc_v23::data()
+{
+  return reinterpret_cast<char *>(this) + sizeofDoc_v23 + _flen + hlen;
+}
+size_t
+Doc_v23::data_len()
+{
+  return len - sizeofDoc_v23 - hlen;
+}
+char *
+Doc_v23::hdr()
+{
+  return reinterpret_cast<char *>(this) + sizeofDoc_v23;
+}
 
 
 } // namespace cache_bc

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheDir.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index b63e02b..0a31c32 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -37,24 +37,24 @@ struct CacheVC;
 
 // Constants
 
-#define DIR_TAG_WIDTH			12
-#define DIR_MASK_TAG(_t)                ((_t) & ((1 << DIR_TAG_WIDTH) - 1))
-#define SIZEOF_DIR           		10
-#define ESTIMATED_OBJECT_SIZE           8000
-
-#define MAX_DIR_SEGMENTS                (32 * (1<<16))
-#define DIR_DEPTH                       4
-#define DIR_SIZE_WIDTH                  6
-#define DIR_BLOCK_SIZES                 4
-#define DIR_BLOCK_SHIFT(_i)             (3*(_i))
-#define DIR_BLOCK_SIZE(_i)              (CACHE_BLOCK_SIZE << DIR_BLOCK_SHIFT(_i))
-#define DIR_SIZE_WITH_BLOCK(_i)         ((1<<DIR_SIZE_WIDTH) * DIR_BLOCK_SIZE(_i))
-#define DIR_OFFSET_BITS                 40
-#define DIR_OFFSET_MAX                  ((((off_t)1) << DIR_OFFSET_BITS) - 1)
-
-#define SYNC_MAX_WRITE                  (2 * 1024 * 1024)
-#define SYNC_DELAY                      HRTIME_MSECONDS(500)
-#define DO_NOT_REMOVE_THIS              0
+#define DIR_TAG_WIDTH 12
+#define DIR_MASK_TAG(_t) ((_t) & ((1 << DIR_TAG_WIDTH) - 1))
+#define SIZEOF_DIR 10
+#define ESTIMATED_OBJECT_SIZE 8000
+
+#define MAX_DIR_SEGMENTS (32 * (1 << 16))
+#define DIR_DEPTH 4
+#define DIR_SIZE_WIDTH 6
+#define DIR_BLOCK_SIZES 4
+#define DIR_BLOCK_SHIFT(_i) (3 * (_i))
+#define DIR_BLOCK_SIZE(_i) (CACHE_BLOCK_SIZE << DIR_BLOCK_SHIFT(_i))
+#define DIR_SIZE_WITH_BLOCK(_i) ((1 << DIR_SIZE_WIDTH) * DIR_BLOCK_SIZE(_i))
+#define DIR_OFFSET_BITS 40
+#define DIR_OFFSET_MAX ((((off_t)1) << DIR_OFFSET_BITS) - 1)
+
+#define SYNC_MAX_WRITE (2 * 1024 * 1024)
+#define SYNC_DELAY HRTIME_MSECONDS(500)
+#define DO_NOT_REMOVE_THIS 0
 
 // Debugging Options
 
@@ -69,49 +69,46 @@ struct CacheVC;
 #define CHECK_DIR(_d) ((void)0)
 #endif
 
-#define dir_index(_e, _i) ((Dir*)((char*)(_e)->dir + (SIZEOF_DIR * (_i))))
-#define dir_assign(_e,_x) do {                \
-    (_e)->w[0] = (_x)->w[0];                  \
-    (_e)->w[1] = (_x)->w[1];                  \
-    (_e)->w[2] = (_x)->w[2];                  \
-    (_e)->w[3] = (_x)->w[3];                  \
-    (_e)->w[4] = (_x)->w[4];                  \
-} while (0)
-#define dir_assign_data(_e,_x) do {           \
-  unsigned short next = dir_next(_e);         \
-  dir_assign(_e, _x);		              \
-  dir_set_next(_e, next);                     \
-} while(0)
+#define dir_index(_e, _i) ((Dir *)((char *)(_e)->dir + (SIZEOF_DIR * (_i))))
+#define dir_assign(_e, _x)   \
+  do {                       \
+    (_e)->w[0] = (_x)->w[0]; \
+    (_e)->w[1] = (_x)->w[1]; \
+    (_e)->w[2] = (_x)->w[2]; \
+    (_e)->w[3] = (_x)->w[3]; \
+    (_e)->w[4] = (_x)->w[4]; \
+  } while (0)
+#define dir_assign_data(_e, _x)         \
+  do {                                  \
+    unsigned short next = dir_next(_e); \
+    dir_assign(_e, _x);                 \
+    dir_set_next(_e, next);             \
+  } while (0)
 #if !TS_USE_INTERIM_CACHE
 // entry is valid
-#define dir_valid(_d, _e)                                               \
-  (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) :   \
-                                        vol_out_of_phase_valid(_d, _e))
+#define dir_valid(_d, _e) (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : vol_out_of_phase_valid(_d, _e))
 // entry is valid and outside of write aggregation region
-#define dir_agg_valid(_d, _e)                                            \
-  (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) :    \
-                                        vol_out_of_phase_agg_valid(_d, _e))
+#define dir_agg_valid(_d, _e) (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : vol_out_of_phase_agg_valid(_d, _e))
 // entry may be valid or overwritten in the last aggregated write
-#define dir_write_valid(_d, _e)                                         \
-  (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) :   \
-                                        vol_out_of_phase_write_valid(_d, _e))
-#define dir_agg_buf_valid(_d, _e)                                          \
-  (_d->header->phase == dir_phase(_e) && vol_in_phase_agg_buf_valid(_d, _e))
+#define dir_write_valid(_d, _e) \
+  (_d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : vol_out_of_phase_write_valid(_d, _e))
+#define dir_agg_buf_valid(_d, _e) (_d->header->phase == dir_phase(_e) && vol_in_phase_agg_buf_valid(_d, _e))
 #endif
 #define dir_is_empty(_e) (!dir_offset(_e))
-#define dir_clear(_e) do { \
-    (_e)->w[0] = 0; \
-    (_e)->w[1] = 0; \
-    (_e)->w[2] = 0; \
-    (_e)->w[3] = 0; \
-    (_e)->w[4] = 0; \
-} while (0)
-#define dir_clean(_e) dir_set_offset(_e,0)
+#define dir_clear(_e) \
+  do {                \
+    (_e)->w[0] = 0;   \
+    (_e)->w[1] = 0;   \
+    (_e)->w[2] = 0;   \
+    (_e)->w[3] = 0;   \
+    (_e)->w[4] = 0;   \
+  } while (0)
+#define dir_clean(_e) dir_set_offset(_e, 0)
 #define dir_segment(_s, _d) vol_dir_segment(_d, _s)
 
 // OpenDir
 
-#define OPEN_DIR_BUCKETS           256
+#define OPEN_DIR_BUCKETS 256
 
 struct EvacuationBlock;
 typedef uint32_t DirInfo;
@@ -124,23 +121,22 @@ typedef uint32_t DirInfo;
 // The accessors prevent unaligned memory access which
 // is often either less efficient or unsupported depending
 // on the processor.
-struct Dir
-{
+struct Dir {
 #if DO_NOT_REMOVE_THIS
   // THE BIT-FIELD INTERPRETATION OF THIS STRUCT WHICH HAS TO
   // USE MACROS TO PREVENT UNALIGNED LOADS
   // bits are numbered from lowest in u16 to highest
   // always index as u16 to avoid byte order issues
-  unsigned int offset:24;       // (0,1:0-7) 16M * 512 = 8GB
-  unsigned int big:2;           // (1:8-9) 512 << (3 * big)
-  unsigned int size:6;          // (1:10-15) 6**2 = 64, 64*512 = 32768 .. 64*256=16MB
-  unsigned int tag:12;          // (2:0-11) 2048 / 8 entries/bucket = .4%
-  unsigned int phase:1;         // (2:12)
-  unsigned int head:1;          // (2:13) first segment in a document
-  unsigned int pinned:1;        // (2:14)
-  unsigned int token:1;         // (2:15)
-  unsigned int next:16;         // (3)
-  inku16 offset_high;           // 8GB * 65k = 0.5PB (4)
+  unsigned int offset : 24; // (0,1:0-7) 16M * 512 = 8GB
+  unsigned int big : 2;     // (1:8-9) 512 << (3 * big)
+  unsigned int size : 6;    // (1:10-15) 6**2 = 64, 64*512 = 32768 .. 64*256=16MB
+  unsigned int tag : 12;    // (2:0-11) 2048 / 8 entries/bucket = .4%
+  unsigned int phase : 1;   // (2:12)
+  unsigned int head : 1;    // (2:13) first segment in a document
+  unsigned int pinned : 1;  // (2:14)
+  unsigned int token : 1;   // (2:15)
+  unsigned int next : 16;   // (3)
+  inku16 offset_high;       // 8GB * 65k = 0.5PB (4)
 #else
   uint16_t w[5];
   Dir() { dir_clear(this); }
@@ -149,21 +145,20 @@ struct Dir
 
 // INTERNAL: do not access these members directly, use the
 // accessors below (e.g. dir_offset, dir_set_offset)
-struct FreeDir
-{
+struct FreeDir {
 #if DO_NOT_REMOVE_THIS
   // THE BIT-FIELD INTERPRETATION OF THIS STRUCT WHICH HAS TO
   // USE MACROS TO PREVENT UNALIGNED LOADS
-  unsigned int offset:24;       // 0: empty
-  unsigned int reserved:8;
-  unsigned int prev:16;         // (2)
-  unsigned int next:16;         // (3)
+  unsigned int offset : 24; // 0: empty
+  unsigned int reserved : 8;
+  unsigned int prev : 16; // (2)
+  unsigned int next : 16; // (3)
 #if TS_USE_INTERIM_CACHE == 1
-  unsigned int offset_high:12;   // 8GB * 4K = 32TB
-  unsigned int index:3;          // interim index
-  unsigned int ininterim:1;          // in interim or not
+  unsigned int offset_high : 12; // 8GB * 4K = 32TB
+  unsigned int index : 3;        // interim index
+  unsigned int ininterim : 1;    // in interim or not
 #else
-  inku16 offset_high;           // 0: empty
+  inku16 offset_high; // 0: empty
 #endif
 #else
   uint16_t w[5];
@@ -177,75 +172,75 @@ struct FreeDir
 #define dir_set_indisk(_e) ((_e)->w[4] &= 0x0FFF);
 #define dir_get_index(_e) (((_e)->w[4] >> 12) & 0x7)
 #define dir_set_index(_e, i) ((_e)->w[4] |= (i << 12))
-#define dir_offset(_e) ((int64_t)                \
-  (((uint64_t)(_e)->w[0]) |           \
-  (((uint64_t)((_e)->w[1] & 0xFF)) << 16) |       \
-  (((uint64_t)((_e)->w[4] & 0x0FFF)) << 24)))
-#define dir_set_offset(_e, _o) do {            \
-  (_e)->w[0] = (uint16_t)_o;        \
-  (_e)->w[1] = (uint16_t)((((_o) >> 16) & 0xFF) | ((_e)->w[1] & 0xFF00));       \
-  (_e)->w[4] = (((_e)->w[4] & 0xF000) | ((uint16_t)((_o) >> 24)));                                          \
-} while (0)
-#define dir_get_offset(_e) ((int64_t)                                     \
-                         (((uint64_t)(_e)->w[0]) |                        \
-                          (((uint64_t)((_e)->w[1] & 0xFF)) << 16) |       \
-                          (((uint64_t)(_e)->w[4]) << 24)))
+#define dir_offset(_e) \
+  ((int64_t)(((uint64_t)(_e)->w[0]) | (((uint64_t)((_e)->w[1] & 0xFF)) << 16) | (((uint64_t)((_e)->w[4] & 0x0FFF)) << 24)))
+#define dir_set_offset(_e, _o)                                              \
+  do {                                                                      \
+    (_e)->w[0] = (uint16_t)_o;                                              \
+    (_e)->w[1] = (uint16_t)((((_o) >> 16) & 0xFF) | ((_e)->w[1] & 0xFF00)); \
+    (_e)->w[4] = (((_e)->w[4] & 0xF000) | ((uint16_t)((_o) >> 24)));        \
+  } while (0)
+#define dir_get_offset(_e) \
+  ((int64_t)(((uint64_t)(_e)->w[0]) | (((uint64_t)((_e)->w[1] & 0xFF)) << 16) | (((uint64_t)(_e)->w[4]) << 24)))
 
 void clear_interim_dir(Vol *v);
 void clear_interimvol_dir(Vol *v, int offset);
 void dir_clean_range_interimvol(off_t start, off_t end, InterimCacheVol *svol);
 
 #else
-#define dir_offset(_e) ((int64_t)                                         \
-                         (((uint64_t)(_e)->w[0]) |                        \
-                          (((uint64_t)((_e)->w[1] & 0xFF)) << 16) |       \
-                          (((uint64_t)(_e)->w[4]) << 24)))
-#define dir_set_offset(_e,_o) do { \
-    (_e)->w[0] = (uint16_t)_o;                                                    \
-    (_e)->w[1] = (uint16_t)((((_o) >> 16) & 0xFF) | ((_e)->w[1] & 0xFF00));       \
-    (_e)->w[4] = (uint16_t)((_o) >> 24);                                          \
-} while (0)
+#define dir_offset(_e) \
+  ((int64_t)(((uint64_t)(_e)->w[0]) | (((uint64_t)((_e)->w[1] & 0xFF)) << 16) | (((uint64_t)(_e)->w[4]) << 24)))
+#define dir_set_offset(_e, _o)                                              \
+  do {                                                                      \
+    (_e)->w[0] = (uint16_t)_o;                                              \
+    (_e)->w[1] = (uint16_t)((((_o) >> 16) & 0xFF) | ((_e)->w[1] & 0xFF00)); \
+    (_e)->w[4] = (uint16_t)((_o) >> 24);                                    \
+  } while (0)
 #endif
 #define dir_bit(_e, _w, _b) ((uint32_t)(((_e)->w[_w] >> (_b)) & 1))
-#define dir_set_bit(_e, _w, _b, _v) (_e)->w[_w] = (uint16_t)(((_e)->w[_w] & ~(1<<(_b))) | (((_v)?1:0)<<(_b)))
-#define dir_big(_e) ((uint32_t)((((_e)->w[1]) >> 8)&0x3))
-#define dir_set_big(_e, _v) (_e)->w[1] = (uint16_t)(((_e)->w[1] & 0xFCFF) | (((uint16_t)(_v))&0x3)<<8)
+#define dir_set_bit(_e, _w, _b, _v) (_e)->w[_w] = (uint16_t)(((_e)->w[_w] & ~(1 << (_b))) | (((_v) ? 1 : 0) << (_b)))
+#define dir_big(_e) ((uint32_t)((((_e)->w[1]) >> 8) & 0x3))
+#define dir_set_big(_e, _v) (_e)->w[1] = (uint16_t)(((_e)->w[1] & 0xFCFF) | (((uint16_t)(_v)) & 0x3) << 8)
 #define dir_size(_e) ((uint32_t)(((_e)->w[1]) >> 10))
-#define dir_set_size(_e, _v) (_e)->w[1] = (uint16_t)(((_e)->w[1] & ((1<<10)-1)) | ((_v)<<10))
-#define dir_set_approx_size(_e, _s) do {                         \
-  if ((_s) <= DIR_SIZE_WITH_BLOCK(0)) {                          \
-    dir_set_big(_e,0);                                           \
-    dir_set_size(_e,((_s)-1) / DIR_BLOCK_SIZE(0));               \
-  } else if ((_s) <= DIR_SIZE_WITH_BLOCK(1)) {                   \
-    dir_set_big(_e,1);                                           \
-    dir_set_size(_e,((_s)-1) / DIR_BLOCK_SIZE(1));               \
-  } else if ((_s) <= DIR_SIZE_WITH_BLOCK(2)) {                   \
-    dir_set_big(_e,2);                                           \
-    dir_set_size(_e,((_s)-1) / DIR_BLOCK_SIZE(2));               \
-  } else {                                                       \
-    dir_set_big(_e,3);                                           \
-    dir_set_size(_e,((_s)-1) / DIR_BLOCK_SIZE(3));               \
-  }                                                              \
-} while (0)
+#define dir_set_size(_e, _v) (_e)->w[1] = (uint16_t)(((_e)->w[1] & ((1 << 10) - 1)) | ((_v) << 10))
+#define dir_set_approx_size(_e, _s)                   \
+  do {                                                \
+    if ((_s) <= DIR_SIZE_WITH_BLOCK(0)) {             \
+      dir_set_big(_e, 0);                             \
+      dir_set_size(_e, ((_s)-1) / DIR_BLOCK_SIZE(0)); \
+    } else if ((_s) <= DIR_SIZE_WITH_BLOCK(1)) {      \
+      dir_set_big(_e, 1);                             \
+      dir_set_size(_e, ((_s)-1) / DIR_BLOCK_SIZE(1)); \
+    } else if ((_s) <= DIR_SIZE_WITH_BLOCK(2)) {      \
+      dir_set_big(_e, 2);                             \
+      dir_set_size(_e, ((_s)-1) / DIR_BLOCK_SIZE(2)); \
+    } else {                                          \
+      dir_set_big(_e, 3);                             \
+      dir_set_size(_e, ((_s)-1) / DIR_BLOCK_SIZE(3)); \
+    }                                                 \
+  } while (0)
 #define dir_approx_size(_e) ((dir_size(_e) + 1) * DIR_BLOCK_SIZE(dir_big(_e)))
-#define round_to_approx_dir_size(_s) (_s <= DIR_SIZE_WITH_BLOCK(0) ? ROUND_TO(_s, DIR_BLOCK_SIZE(0)) : \
-                                      (_s <= DIR_SIZE_WITH_BLOCK(1) ? ROUND_TO(_s, DIR_BLOCK_SIZE(1)) : \
-                                       (_s <= DIR_SIZE_WITH_BLOCK(2) ? ROUND_TO(_s, DIR_BLOCK_SIZE(2)) : \
-                                        ROUND_TO(_s, DIR_BLOCK_SIZE(3)))))
-#define dir_tag(_e) ((uint32_t)((_e)->w[2]&((1<<DIR_TAG_WIDTH)-1)))
-#define dir_set_tag(_e,_t) (_e)->w[2] = (uint16_t)(((_e)->w[2]&~((1<<DIR_TAG_WIDTH)-1)) | ((_t)&((1<<DIR_TAG_WIDTH)-1)))
-#define dir_phase(_e) dir_bit(_e,2,12)
-#define dir_set_phase(_e,_v) dir_set_bit(_e,2,12,_v)
-#define dir_head(_e) dir_bit(_e,2,13)
-#define dir_set_head(_e, _v) dir_set_bit(_e,2,13,_v)
-#define dir_pinned(_e) dir_bit(_e,2,14)
-#define dir_set_pinned(_e, _v) dir_set_bit(_e,2,14,_v)
-#define dir_token(_e) dir_bit(_e,2,15)
-#define dir_set_token(_e, _v) dir_set_bit(_e,2,15,_v)
+#define round_to_approx_dir_size(_s)      \
+  (_s <= DIR_SIZE_WITH_BLOCK(0) ?         \
+     ROUND_TO(_s, DIR_BLOCK_SIZE(0)) :    \
+     (_s <= DIR_SIZE_WITH_BLOCK(1) ?      \
+        ROUND_TO(_s, DIR_BLOCK_SIZE(1)) : \
+        (_s <= DIR_SIZE_WITH_BLOCK(2) ? ROUND_TO(_s, DIR_BLOCK_SIZE(2)) : ROUND_TO(_s, DIR_BLOCK_SIZE(3)))))
+#define dir_tag(_e) ((uint32_t)((_e)->w[2] & ((1 << DIR_TAG_WIDTH) - 1)))
+#define dir_set_tag(_e, _t) \
+  (_e)->w[2] = (uint16_t)(((_e)->w[2] & ~((1 << DIR_TAG_WIDTH) - 1)) | ((_t) & ((1 << DIR_TAG_WIDTH) - 1)))
+#define dir_phase(_e) dir_bit(_e, 2, 12)
+#define dir_set_phase(_e, _v) dir_set_bit(_e, 2, 12, _v)
+#define dir_head(_e) dir_bit(_e, 2, 13)
+#define dir_set_head(_e, _v) dir_set_bit(_e, 2, 13, _v)
+#define dir_pinned(_e) dir_bit(_e, 2, 14)
+#define dir_set_pinned(_e, _v) dir_set_bit(_e, 2, 14, _v)
+#define dir_token(_e) dir_bit(_e, 2, 15)
+#define dir_set_token(_e, _v) dir_set_bit(_e, 2, 15, _v)
 #define dir_next(_e) (_e)->w[3]
 #define dir_set_next(_e, _o) (_e)->w[3] = (uint16_t)(_o)
 #define dir_prev(_e) (_e)->w[2]
-#define dir_set_prev(_e,_o) (_e)->w[2] = (uint16_t)(_o)
+#define dir_set_prev(_e, _o) (_e)->w[2] = (uint16_t)(_o)
 
 // INKqa11166 - Cache can not store 2 HTTP alternates simultaneously.
 // To allow this, move the vector from the CacheVC to the OpenDirEntry.
@@ -254,36 +249,35 @@ void dir_clean_range_interimvol(off_t start, off_t end, InterimCacheVol *svol);
 // is deleted/inserted into the vector just before writing the vector disk
 // (CacheVC::updateVector).
 LINK_FORWARD_DECLARATION(CacheVC, opendir_link) // forward declaration
-struct OpenDirEntry
-{
-  DLL<CacheVC, Link_CacheVC_opendir_link> writers;       // list of all the current writers
-  DLL<CacheVC, Link_CacheVC_opendir_link> readers;         // list of all the current readers - not used
-  CacheHTTPInfoVector vector;   // Vector for the http document. Each writer
-                                // maintains a pointer to this vector and
-                                // writes it down to disk.
-  CacheKey single_doc_key;      // Key for the resident alternate.
-  Dir single_doc_dir;           // Directory for the resident alternate
-  Dir first_dir;                // Dir for the vector. If empty, a new dir is
-                                // inserted, otherwise this dir is overwritten
-  uint16_t num_writers;           // num of current writers
-  uint16_t max_writers;           // max number of simultaneous writers allowed
-  bool dont_update_directory;   // if set, the first_dir is not updated.
-  bool move_resident_alt;       // if set, single_doc_dir is inserted.
-  volatile bool reading_vec;    // somebody is currently reading the vector
-  volatile bool writing_vec;    // somebody is currently writing the vector
+struct OpenDirEntry {
+  DLL<CacheVC, Link_CacheVC_opendir_link> writers; // list of all the current writers
+  DLL<CacheVC, Link_CacheVC_opendir_link> readers; // list of all the current readers - not used
+  CacheHTTPInfoVector vector;                      // Vector for the http document. Each writer
+                                                   // maintains a pointer to this vector and
+                                                   // writes it down to disk.
+  CacheKey single_doc_key;                         // Key for the resident alternate.
+  Dir single_doc_dir;                              // Directory for the resident alternate
+  Dir first_dir;                                   // Dir for the vector. If empty, a new dir is
+                                                   // inserted, otherwise this dir is overwritten
+  uint16_t num_writers;                            // num of current writers
+  uint16_t max_writers;                            // max number of simultaneous writers allowed
+  bool dont_update_directory;                      // if set, the first_dir is not updated.
+  bool move_resident_alt;                          // if set, single_doc_dir is inserted.
+  volatile bool reading_vec;                       // somebody is currently reading the vector
+  volatile bool writing_vec;                       // somebody is currently writing the vector
 
   LINK(OpenDirEntry, link);
 
   int wait(CacheVC *c, int msec);
 
-  bool has_multiple_writers()
+  bool
+  has_multiple_writers()
   {
     return num_writers > 1;
   }
 };
 
-struct OpenDir: public Continuation
-{
+struct OpenDir : public Continuation {
   Queue<CacheVC, Link_CacheVC_opendir_link> delayed_readers;
   DLL<OpenDirEntry> bucket[OPEN_DIR_BUCKETS];
 
@@ -295,8 +289,7 @@ struct OpenDir: public Continuation
   OpenDir();
 };
 
-struct CacheSync: public Continuation
-{
+struct CacheSync : public Continuation {
   int vol_idx;
   char *buf;
   size_t buflen;
@@ -307,7 +300,7 @@ struct CacheSync: public Continuation
   int mainEvent(int event, Event *e);
   void aio_write(int fd, char *b, int n, off_t o);
 
- CacheSync():Continuation(new_ProxyMutex()), vol_idx(0), buf(0), buflen(0), writepos(0), trigger(0), start_time(0)
+  CacheSync() : Continuation(new_ProxyMutex()), vol_idx(0), buf(0), buflen(0), writepos(0), trigger(0), start_time(0)
   {
     SET_HANDLER(&CacheSync::mainEvent);
   }
@@ -321,7 +314,7 @@ int dir_probe(CacheKey *, Vol *, Dir *, Dir **);
 int dir_insert(CacheKey *key, Vol *d, Dir *to_part);
 int dir_overwrite(CacheKey *key, Vol *d, Dir *to_part, Dir *overwrite, bool must_overwrite = true);
 int dir_delete(CacheKey *key, Vol *d, Dir *del);
-int dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock ** eblock);
+int dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock **eblock);
 int dir_lookaside_insert(EvacuationBlock *b, Vol *d, Dir *to);
 int dir_lookaside_fixup(CacheKey *key, Vol *d);
 void dir_lookaside_cleanup(Vol *d);
@@ -331,9 +324,8 @@ void dir_sync_init();
 int check_dir(Vol *d);
 void dir_clean_vol(Vol *d);
 void dir_clear_range(off_t start, off_t end, Vol *d);
-int dir_segment_accounted(int s, Vol *d, int offby = 0,
-                          int *free = 0, int *used = 0,
-                          int *empty = 0, int *valid = 0, int *agg_valid = 0, int *avg_size = 0);
+int dir_segment_accounted(int s, Vol *d, int offby = 0, int *free = 0, int *used = 0, int *empty = 0, int *valid = 0,
+                          int *agg_valid = 0, int *avg_size = 0);
 uint64_t dir_entries_used(Vol *d);
 void sync_cache_dir_on_shutdown();
 
@@ -343,7 +335,7 @@ extern Dir empty_dir;
 
 // Inline Funtions
 
-#define dir_in_seg(_s, _i) ((Dir*)(((char*)(_s)) + (SIZEOF_DIR *(_i))))
+#define dir_in_seg(_s, _i) ((Dir *)(((char *)(_s)) + (SIZEOF_DIR * (_i))))
 
 TS_INLINE bool
 dir_compare_tag(Dir *e, CacheKey *key)
@@ -373,9 +365,9 @@ TS_INLINE int64_t
 dir_to_offset(Dir *d, Dir *seg)
 {
 #if DIR_DEPTH < 5
-  return (((char*)d) - ((char*)seg))/SIZEOF_DIR;
+  return (((char *)d) - ((char *)seg)) / SIZEOF_DIR;
 #else
-  int64_t i = (int64_t)((((char*)d) - ((char*)seg))/SIZEOF_DIR);
+  int64_t i = (int64_t)((((char *)d) - ((char *)seg)) / SIZEOF_DIR);
   i = i - (i / DIR_DEPTH);
   return i;
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheDisk.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheDisk.h b/iocore/cache/P_CacheDisk.h
index a197435..8b51de2 100644
--- a/iocore/cache/P_CacheDisk.h
+++ b/iocore/cache/P_CacheDisk.h
@@ -28,70 +28,63 @@
 
 extern int cache_config_max_disk_errors;
 
-#define DISK_BAD(_x)                    ((_x)->num_errors >= cache_config_max_disk_errors)
-#define DISK_BAD_SIGNALLED(_x)          (_x->num_errors > cache_config_max_disk_errors)
-#define SET_DISK_BAD(_x)                (_x->num_errors = cache_config_max_disk_errors)
-#define SET_DISK_OKAY(_x)               (_x->num_errors = 0)
+#define DISK_BAD(_x) ((_x)->num_errors >= cache_config_max_disk_errors)
+#define DISK_BAD_SIGNALLED(_x) (_x->num_errors > cache_config_max_disk_errors)
+#define SET_DISK_BAD(_x) (_x->num_errors = cache_config_max_disk_errors)
+#define SET_DISK_OKAY(_x) (_x->num_errors = 0)
 
-#define VOL_BLOCK_SIZE                  (1024 * 1024 * 128)
-#define MIN_VOL_SIZE                    VOL_BLOCK_SIZE
-#define ROUND_DOWN_TO_VOL_BLOCK(_x)     (((_x) &~ (VOL_BLOCK_SIZE - 1)))
-#define VOL_BLOCK_SHIFT                 27
-#define ROUND_DOWN_TO_STORE_BLOCK(_x)   (((_x) >> STORE_BLOCK_SHIFT) << STORE_BLOCK_SHIFT)
+#define VOL_BLOCK_SIZE (1024 * 1024 * 128)
+#define MIN_VOL_SIZE VOL_BLOCK_SIZE
+#define ROUND_DOWN_TO_VOL_BLOCK(_x) (((_x) & ~(VOL_BLOCK_SIZE - 1)))
+#define VOL_BLOCK_SHIFT 27
+#define ROUND_DOWN_TO_STORE_BLOCK(_x) (((_x) >> STORE_BLOCK_SHIFT) << STORE_BLOCK_SHIFT)
 
-#define STORE_BLOCKS_PER_VOL            (VOL_BLOCK_SIZE / STORE_BLOCK_SIZE)
-#define DISK_HEADER_MAGIC               0xABCD1237
+#define STORE_BLOCKS_PER_VOL (VOL_BLOCK_SIZE / STORE_BLOCK_SIZE)
+#define DISK_HEADER_MAGIC 0xABCD1237
 
 /* each disk vol block has a corresponding Vol object */
 struct CacheDisk;
 
-struct DiskVolBlock
-{
-  uint64_t offset;  // offset in bytes from the start of the disk
-  uint64_t len;  // length in in store blocks
+struct DiskVolBlock {
+  uint64_t offset; // offset in bytes from the start of the disk
+  uint64_t len;    // length in in store blocks
   int number;
-  unsigned int type:3;
-  unsigned int free:1;
+  unsigned int type : 3;
+  unsigned int free : 1;
 };
 
-struct DiskVolBlockQueue
-{
+struct DiskVolBlockQueue {
   DiskVolBlock *b;
-  int new_block;                /* whether an existing vol or a new one */
+  int new_block; /* whether an existing vol or a new one */
   LINK(DiskVolBlockQueue, link);
 
-  DiskVolBlockQueue()
-    : b(NULL), new_block(0)
-  { }
+  DiskVolBlockQueue() : b(NULL), new_block(0) {}
 };
 
-struct DiskVol
-{
-  int num_volblocks;           /* number of disk volume blocks in this volume */
-  int vol_number;              /* the volume number of this volume */
-  uint64_t size;                  /* size in store blocks */
+struct DiskVol {
+  int num_volblocks; /* number of disk volume blocks in this volume */
+  int vol_number;    /* the volume number of this volume */
+  uint64_t size;     /* size in store blocks */
   CacheDisk *disk;
   Queue<DiskVolBlockQueue> dpb_queue;
 };
 
-struct DiskHeader
-{
+struct DiskHeader {
   unsigned int magic;
-  unsigned int num_volumes;            /* number of discrete volumes (DiskVol) */
-  unsigned int num_free;               /* number of disk volume blocks free */
-  unsigned int num_used;               /* number of disk volume blocks in use */
-  unsigned int num_diskvol_blks;       /* number of disk volume blocks */
+  unsigned int num_volumes;      /* number of discrete volumes (DiskVol) */
+  unsigned int num_free;         /* number of disk volume blocks free */
+  unsigned int num_used;         /* number of disk volume blocks in use */
+  unsigned int num_diskvol_blks; /* number of disk volume blocks */
   uint64_t num_blocks;
   DiskVolBlock vol_info[1];
 };
 
-struct CacheDisk: public Continuation
-{
+struct CacheDisk : public Continuation {
   DiskHeader *header;
   char *path;
   int header_len;
   AIOCallbackInternal io;
-  off_t len;                // in blocks (STORE_BLOCK)
+  off_t len; // in blocks (STORE_BLOCK)
   off_t start;
   off_t skip;
   off_t num_usable_blocks;
@@ -105,18 +98,16 @@ struct CacheDisk: public Continuation
   int cleared;
 
   // Extra configuration values
-  int forced_volume_num; ///< Volume number for this disk.
+  int forced_volume_num;           ///< Volume number for this disk.
   ats_scoped_str hash_base_string; ///< Base string for hash seed.
 
   CacheDisk()
-    : Continuation(new_ProxyMutex()), header(NULL),
-      path(NULL), header_len(0), len(0), start(0), skip(0),
-      num_usable_blocks(0), fd(-1), free_space(0), wasted_space(0),
-      disk_vols(NULL), free_blocks(NULL), num_errors(0), cleared(0),
-      forced_volume_num(-1)
-  { }
+    : Continuation(new_ProxyMutex()), header(NULL), path(NULL), header_len(0), len(0), start(0), skip(0), num_usable_blocks(0),
+      fd(-1), free_space(0), wasted_space(0), disk_vols(NULL), free_blocks(NULL), num_errors(0), cleared(0), forced_volume_num(-1)
+  {
+  }
 
-   ~CacheDisk();
+  ~CacheDisk();
 
   int open(bool clear);
   int open(char *s, off_t blocks, off_t skip, int hw_sector_size, int fildes, bool clear);
@@ -131,7 +122,6 @@ struct CacheDisk: public Continuation
   int delete_all_volumes();
   void update_header();
   DiskVol *get_diskvol(int vol_number);
-
 };
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheHosting.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h
index ce376cc..21d2b1a 100644
--- a/iocore/cache/P_CacheHosting.h
+++ b/iocore/cache/P_CacheHosting.h
@@ -25,7 +25,7 @@
 #define __P_CACHE_HOSTING_H__
 #include "P_Cache.h"
 
-#define CACHE_MEM_FREE_TIMEOUT     HRTIME_SECONDS(1)
+#define CACHE_MEM_FREE_TIMEOUT HRTIME_SECONDS(1)
 
 struct Vol;
 struct CacheVol;
@@ -33,8 +33,7 @@ struct CacheVol;
 struct CacheHostResult;
 struct Cache;
 
-struct CacheHostRecord
-{
+struct CacheHostRecord {
   int Init(CacheType typ);
   int Init(matcher_line *line_info, CacheType typ);
   void UpdateMatch(CacheHostResult *r, char *rd);
@@ -55,46 +54,55 @@ struct CacheHostRecord
   CacheVol **cp;
   int num_cachevols;
 
-  CacheHostRecord():
-    type(CACHE_NONE_TYPE), vols(NULL), good_num_vols(0), num_vols(0),
-    num_initialized(0), vol_hash_table(0), cp(NULL), num_cachevols(0)
-  { }
-
+  CacheHostRecord()
+    : type(CACHE_NONE_TYPE), vols(NULL), good_num_vols(0), num_vols(0), num_initialized(0), vol_hash_table(0), cp(NULL),
+      num_cachevols(0)
+  {
+  }
 };
 
 void build_vol_hash_table(CacheHostRecord *cp);
 
-struct CacheHostResult
-{
+struct CacheHostResult {
   CacheHostRecord *record;
 
-  CacheHostResult()
-    : record(NULL)
-  { }
+  CacheHostResult() : record(NULL) {}
 };
 
 
 class CacheHostMatcher
 {
 public:
-  CacheHostMatcher(const char * name, CacheType typ);
+  CacheHostMatcher(const char *name, CacheType typ);
   ~CacheHostMatcher();
 
-  void Match(char const* rdata, int rlen, CacheHostResult *result);
+  void Match(char const *rdata, int rlen, CacheHostResult *result);
   void AllocateSpace(int num_entries);
   void NewEntry(matcher_line *line_info);
   void Print();
 
-  int getNumElements() const { return num_el; }
-  CacheHostRecord *getDataArray() const { return data_array; }
-  HostLookup *getHLookup() const { return host_lookup; }
+  int
+  getNumElements() const
+  {
+    return num_el;
+  }
+  CacheHostRecord *
+  getDataArray() const
+  {
+    return data_array;
+  }
+  HostLookup *
+  getHLookup() const
+  {
+    return host_lookup;
+  }
 
 private:
   static void PrintFunc(void *opaque_data);
-  HostLookup *host_lookup;      // Data structure to do the lookups
-  CacheHostRecord *data_array;  // array of all data items
-  int array_len;                // the length of the arrays
-  int num_el;                   // the number of itmems in the tree
+  HostLookup *host_lookup;     // Data structure to do the lookups
+  CacheHostRecord *data_array; // array of all data items
+  int array_len;               // the length of the arrays
+  int num_el;                  // the number of itmems in the tree
   CacheType type;
 };
 
@@ -104,20 +112,29 @@ public:
   // Parameter name must not be deallocated before this
   //  object is
   CacheHostTable(Cache *c, CacheType typ);
-   ~CacheHostTable();
-  int BuildTable(const char * config_file_path);
-  int BuildTableFromString(const char * config_file_path, char *str);
-  void Match(char const* rdata, int rlen, CacheHostResult *result);
+  ~CacheHostTable();
+  int BuildTable(const char *config_file_path);
+  int BuildTableFromString(const char *config_file_path, char *str);
+  void Match(char const *rdata, int rlen, CacheHostResult *result);
   void Print();
 
-  int getEntryCount() const { return m_numEntries; }
-  CacheHostMatcher *getHostMatcher() const { return hostMatch; }
+  int
+  getEntryCount() const
+  {
+    return m_numEntries;
+  }
+  CacheHostMatcher *
+  getHostMatcher() const
+  {
+    return hostMatch;
+  }
 
   static int config_callback(const char *, RecDataT, RecData, void *);
 
-  void register_config_callback(CacheHostTable ** p)
+  void
+  register_config_callback(CacheHostTable **p)
   {
-    REC_RegisterConfigUpdateFunc("proxy.config.cache.hosting_filename", CacheHostTable::config_callback, (void *) p);
+    REC_RegisterConfigUpdateFunc("proxy.config.cache.hosting_filename", CacheHostTable::config_callback, (void *)p);
   }
 
   CacheType type;
@@ -128,26 +145,25 @@ public:
 private:
   CacheHostMatcher *hostMatch;
   const matcher_tags *config_tags;
-  const char *matcher_name;     // Used for Debug/Warning/Error messages
+  const char *matcher_name; // Used for Debug/Warning/Error messages
 };
 
 struct CacheHostTableConfig;
-typedef int (CacheHostTableConfig::*CacheHostTabHandler) (int, void *);
-struct CacheHostTableConfig: public Continuation
-{
+typedef int (CacheHostTableConfig::*CacheHostTabHandler)(int, void *);
+struct CacheHostTableConfig : public Continuation {
   CacheHostTable **ppt;
-  CacheHostTableConfig(CacheHostTable ** appt)
-    : Continuation(NULL), ppt(appt)
+  CacheHostTableConfig(CacheHostTable **appt) : Continuation(NULL), ppt(appt)
   {
-    SET_HANDLER((CacheHostTabHandler) & CacheHostTableConfig::mainEvent);
+    SET_HANDLER((CacheHostTabHandler)&CacheHostTableConfig::mainEvent);
   }
 
-  int mainEvent(int event, Event *e)
+  int
+  mainEvent(int event, Event *e)
   {
-    (void) e;
-    (void) event;
+    (void)e;
+    (void)event;
     CacheHostTable *t = new CacheHostTable((*ppt)->cache, (*ppt)->type);
-    CacheHostTable *old = (CacheHostTable *) ink_atomic_swap(&t, *ppt);
+    CacheHostTable *old = (CacheHostTable *)ink_atomic_swap(&t, *ppt);
     new_Deleter(old, CACHE_MEM_FREE_TIMEOUT);
     return EVENT_DONE;
   }
@@ -155,8 +171,7 @@ struct CacheHostTableConfig: public Continuation
 
 
 /* list of volumes in the volume.config file */
-struct ConfigVol
-{
+struct ConfigVol {
   int number;
   CacheType scheme;
   off_t size;
@@ -166,8 +181,7 @@ struct ConfigVol
   LINK(ConfigVol, link);
 };
 
-struct ConfigVolumes
-{
+struct ConfigVolumes {
   int num_volumes;
   int num_http_volumes;
   int num_stream_volumes;
@@ -175,7 +189,8 @@ struct ConfigVolumes
   void read_config_file();
   void BuildListFromString(char *config_file_path, char *file_buf);
 
-  void clear_all(void)
+  void
+  clear_all(void)
   {
     // remove all the volumes from the queue
     for (int i = 0; i < num_volumes; i++) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheHttp.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheHttp.h b/iocore/cache/P_CacheHttp.h
index e64a200..c5bf87e 100644
--- a/iocore/cache/P_CacheHttp.h
+++ b/iocore/cache/P_CacheHttp.h
@@ -36,42 +36,40 @@ typedef HTTPInfo CacheHTTPInfo;
 
 
 #define OFFSET_BITS 24
-enum
-{
+enum {
   OWNER_NONE = 0,
   OWNER_CACHE = 1,
-  OWNER_HTTP = 2
+  OWNER_HTTP = 2,
 };
 
 #else
-struct CacheHTTPInfo
-{
+struct CacheHTTPInfo {
 };
 
-#endif //HTTP_CACHE
+#endif // HTTP_CACHE
 
-struct vec_info
-{
+struct vec_info {
   CacheHTTPInfo alternate;
 };
 
-struct CacheHTTPInfoVector
-{
+struct CacheHTTPInfoVector {
   void *magic;
 
-    CacheHTTPInfoVector();
-   ~CacheHTTPInfoVector();
+  CacheHTTPInfoVector();
+  ~CacheHTTPInfoVector();
 
-  int count()
+  int
+  count()
   {
     return xcount;
   }
-  int insert(CacheHTTPInfo * info, int id = -1);
+  int insert(CacheHTTPInfo *info, int id = -1);
   CacheHTTPInfo *get(int idx);
-  void detach(int idx, CacheHTTPInfo * r);
+  void detach(int idx, CacheHTTPInfo *r);
   void remove(int idx, bool destroy);
   void clear(bool destroy = true);
-  void reset()
+  void
+  reset()
   {
     xcount = 0;
     data.clear();
@@ -80,8 +78,8 @@ struct CacheHTTPInfoVector
 
   int marshal_length();
   int marshal(char *buf, int length);
-  uint32_t get_handles(const char *buf, int length, RefCountObj * block_ptr = NULL);
-  int unmarshal(const char *buf, int length, RefCountObj * block_ptr);
+  uint32_t get_handles(const char *buf, int length, RefCountObj *block_ptr = NULL);
+  int unmarshal(const char *buf, int length, RefCountObj *block_ptr);
 
   CacheArray<vec_info> data;
   int xcount;


[49/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/StatType.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatType.h b/cmd/traffic_manager/StatType.h
index 03e8f7a..3ab0367 100644
--- a/cmd/traffic_manager/StatType.h
+++ b/cmd/traffic_manager/StatType.h
@@ -31,23 +31,23 @@
  ****************************************************************************/
 
 #ifndef _STATTYPE_H_
-#define	_STATTYPE_H_
+#define _STATTYPE_H_
 
 #include "StatXML.h"
 #include "WebMgmtUtils.h"
 
-#define BYTES_TO_MBIT_SCALE (8/1000000.0)
+#define BYTES_TO_MBIT_SCALE (8 / 1000000.0)
 
 /* Structs used in Average Statistics calculations */
-struct StatDataSamples
-{
+struct StatDataSamples {
   ink_hrtime previous_time;
   ink_hrtime current_time;
   RecDataT data_type;
   RecData previous_value;
   RecData current_value;
 
-  RecData diff_value(const char *name)
+  RecData
+  diff_value(const char *name)
   {
     RecData tmp;
 
@@ -62,7 +62,8 @@ struct StatDataSamples
       return tmp;
     }
   }
-  ink_hrtime diff_time()
+  ink_hrtime
+  diff_time()
   {
     return (current_time - previous_time);
   }
@@ -73,8 +74,8 @@ struct StatDataSamples
 #define inline
 #endif
 
-#define MODULE      "StatPro"   // Statistics processor debug tag
-#define MODULE_INIT "StatProInit"       // Statistics processor debug tag
+#define MODULE "StatPro"          // Statistics processor debug tag
+#define MODULE_INIT "StatProInit" // Statistics processor debug tag
 
 /***************************************************************
  *                       StatExprToken
@@ -85,9 +86,7 @@ struct StatDataSamples
  ***************************************************************/
 class StatExprToken
 {
-
 public:
-
   char m_arith_symbol;
   char *m_token_name;
   RecDataT m_token_type;
@@ -107,10 +106,7 @@ public:
 
   LINK(StatExprToken, link);
   StatExprToken();
-  inline ~ StatExprToken()
-  {
-    clean();
-  };
+  inline ~StatExprToken() { clean(); };
   void clean();
 
   bool statVarSet(RecDataT, RecData);
@@ -123,14 +119,9 @@ public:
  **/
 class StatExprList
 {
-
 public:
-
   StatExprList();
-  inline ~ StatExprList()
-  {
-    clean();
-  };
+  inline ~StatExprList() { clean(); };
   void clean();
 
   void enqueue(StatExprToken *);
@@ -144,7 +135,6 @@ public:
   void print(const char *);
 
 private:
-
   size_t m_size;
   Queue<StatExprToken> m_tokenList;
 };
@@ -156,12 +146,10 @@ private:
  ***************************************************************/
 class StatObject
 {
-
 public:
-
   unsigned m_id;
   bool m_debug;
-  char *m_expr_string;          /* for debugging using only */
+  char *m_expr_string; /* for debugging using only */
   StatExprToken *m_node_dest;
   StatExprToken *m_cluster_dest;
   StatExprList *m_expression;
@@ -179,10 +167,7 @@ public:
   // Member functions
   StatObject();
   StatObject(unsigned);
-  inline ~ StatObject()
-  {
-    clean();
-  };
+  inline ~StatObject() { clean(); };
   void clean();
   void assignDst(const char *, bool, bool);
   void assignExpr(char *);
@@ -193,7 +178,6 @@ public:
   void setTokenValue(StatExprToken *, bool cluster = false);
 
 private:
-
   void infix2postfix();
 };
 
@@ -204,26 +188,20 @@ private:
  **/
 class StatObjectList
 {
-
 public:
-
   // Member functions
   StatObjectList();
-  inline ~ StatObjectList()
-  {
-    clean();
-  };
+  inline ~StatObjectList() { clean(); };
   void clean();
-  void enqueue(StatObject * object);
+  void enqueue(StatObject *object);
   StatObject *first();
-  StatObject *next(StatObject * current);
+  StatObject *next(StatObject *current);
   void print(const char *prefix = "");
-  short Eval();                 // return the number of statistics object processed
+  short Eval(); // return the number of statistics object processed
 
   size_t m_size;
 
 private:
-
   Queue<StatObject> m_statList;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/StatXML.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatXML.cc b/cmd/traffic_manager/StatXML.cc
index 277b84a..1d6a7ba 100644
--- a/cmd/traffic_manager/StatXML.cc
+++ b/cmd/traffic_manager/StatXML.cc
@@ -33,7 +33,6 @@
 unsigned short
 XML_extractContent(const char *name, char *content, size_t result_len)
 {
-
   char c;
   int contentIndex = 0;
 
@@ -55,7 +54,6 @@ XML_extractContent(const char *name, char *content, size_t result_len)
   }
 
   return (strlen(content));
-
 }
 
 
@@ -66,7 +64,6 @@ XML_extractContent(const char *name, char *content, size_t result_len)
 bool
 isOperator(char c)
 {
-
   switch (c) {
   case '+':
   case '-':
@@ -78,5 +75,4 @@ isOperator(char c)
   default:
     return false;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/StatXML.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatXML.h b/cmd/traffic_manager/StatXML.h
index b31063b..249be2f 100644
--- a/cmd/traffic_manager/StatXML.h
+++ b/cmd/traffic_manager/StatXML.h
@@ -23,18 +23,17 @@
 
 
 #ifndef _STATXML_H_
-#define	_STATXML_H_
+#define _STATXML_H_
 
 #include "WebMgmtUtils.h"
 #include "List.h"
 
-typedef enum
-{
+typedef enum {
   INVALID_TAG = -1,
   ROOT_TAG,
   STAT_TAG,
   DST_TAG,
-  EXPR_TAG
+  EXPR_TAG,
 } StatXMLTag;
 
 /***************************************************************

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/traffic_manager.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc
index 6b099b7..5133c18 100644
--- a/cmd/traffic_manager/traffic_manager.cc
+++ b/cmd/traffic_manager/traffic_manager.cc
@@ -68,8 +68,8 @@ static void printUsage(void);
 extern "C" int getpwnam_r(const char *name, struct passwd *result, char *buffer, size_t buflen, struct passwd **resptr);
 #endif
 
-static StatProcessor *statProcessor;   // Statistics Processors
-static AppVersionInfo appVersionInfo;  // Build info for this application
+static StatProcessor *statProcessor;  // Statistics Processors
+static AppVersionInfo appVersionInfo; // Build info for this application
 
 static inkcoreapi DiagsConfig *diagsConfig;
 static char debug_tags[1024] = "";
@@ -86,8 +86,8 @@ static int fds_limit;
 // TODO: Use positive instead negative selection
 //       Thsis should just be #if defined(solaris)
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
-static void SignalHandler(int sig, siginfo_t * t, void *f);
-static void SignalAlrmHandler(int sig, siginfo_t * t, void *f);
+static void SignalHandler(int sig, siginfo_t *t, void *f);
+static void SignalAlrmHandler(int sig, siginfo_t *t, void *f);
 #else
 static void SignalHandler(int sig);
 static void SignalAlrmHandler(int sig);
@@ -129,11 +129,11 @@ check_lockfile()
   Lockfile server_lockfile(lockfile);
   err = server_lockfile.Open(&holding_pid);
   if (err == 1) {
-    server_lockfile.Close();    // no server running
+    server_lockfile.Close(); // no server running
   } else {
     char *reason = strerror(-err);
     if (err == 0) {
-      // TODO: Add PID_FMT_T instead duplicating code just for printing
+// TODO: Add PID_FMT_T instead duplicating code just for printing
 #if defined(solaris)
       fprintf(stderr, "FATAL: Lockfile '%s' says server already running as PID %d\n", lockfile, (int)holding_pid);
 #else
@@ -142,8 +142,7 @@ check_lockfile()
       mgmt_elog(stderr, 0, "FATAL: Lockfile '%s' says server already running as PID %d\n", lockfile, holding_pid);
     } else {
       fprintf(stderr, "FATAL: Can't open server lockfile '%s' (%s)\n", lockfile, (reason ? reason : "Unknown Reason"));
-      mgmt_elog(stderr, 0, "FATAL: Can't open server lockfile '%s' (%s)\n",
-                lockfile, (reason ? reason : "Unknown Reason"));
+      mgmt_elog(stderr, 0, "FATAL: Can't open server lockfile '%s' (%s)\n", lockfile, (reason ? reason : "Unknown Reason"));
     }
     exit(1);
   }
@@ -184,7 +183,7 @@ initSignalHandlers()
   struct sigaction sigHandler, sigChldHandler, sigAlrmHandler;
   sigset_t sigsToBlock;
 
-  // Set up the signal handler
+// Set up the signal handler
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
   sigHandler.sa_handler = NULL;
   sigHandler.sa_sigaction = SignalHandler;
@@ -202,9 +201,9 @@ initSignalHandlers()
   sigaction(SIGHUP, &sigHandler, NULL);
   sigaction(SIGUSR2, &sigHandler, NULL);
 
-  // Don't block the signal on entry to the signal
-  //   handler so we can reissue it and get a core
-  //   file in the appropriate circumstances
+// Don't block the signal on entry to the signal
+//   handler so we can reissue it and get a core
+//   file in the appropriate circumstances
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
   sigHandler.sa_flags = SA_RESETHAND | SA_SIGINFO;
 #else
@@ -282,7 +281,7 @@ init_dirs()
 static void
 chdir_root()
 {
-  const char * prefix = Layout::get()->prefix;
+  const char *prefix = Layout::get()->prefix;
 
   if (chdir(prefix) < 0) {
     mgmt_elog(0, "unable to change to root directory \"%s\" [%d '%s']\n", prefix, errno, strerror(errno));
@@ -319,26 +318,26 @@ set_process_limits(int fds_throttle)
 
     lim.rlim_cur = lim.rlim_max = static_cast<rlim_t>(maxfiles * file_max_pct);
     if (setrlimit(RLIMIT_NOFILE, &lim) == 0 && getrlimit(RLIMIT_NOFILE, &lim) == 0) {
-      fds_limit = (int) lim.rlim_cur;
-      syslog(LOG_NOTICE, "NOTE: RLIMIT_NOFILE(%d):cur(%d),max(%d)",RLIMIT_NOFILE, (int)lim.rlim_cur, (int)lim.rlim_max);
+      fds_limit = (int)lim.rlim_cur;
+      syslog(LOG_NOTICE, "NOTE: RLIMIT_NOFILE(%d):cur(%d),max(%d)", RLIMIT_NOFILE, (int)lim.rlim_cur, (int)lim.rlim_max);
     }
   }
 
   if (getrlimit(RLIMIT_NOFILE, &lim) == 0) {
-    if (fds_throttle > (int) (lim.rlim_cur + FD_THROTTLE_HEADROOM)) {
-      lim.rlim_cur = (lim.rlim_max = (rlim_t) fds_throttle);
+    if (fds_throttle > (int)(lim.rlim_cur + FD_THROTTLE_HEADROOM)) {
+      lim.rlim_cur = (lim.rlim_max = (rlim_t)fds_throttle);
       if (!setrlimit(RLIMIT_NOFILE, &lim) && !getrlimit(RLIMIT_NOFILE, &lim)) {
-        fds_limit = (int) lim.rlim_cur;
-	      syslog(LOG_NOTICE, "NOTE: RLIMIT_NOFILE(%d):cur(%d),max(%d)",RLIMIT_NOFILE, (int)lim.rlim_cur, (int)lim.rlim_max);
+        fds_limit = (int)lim.rlim_cur;
+        syslog(LOG_NOTICE, "NOTE: RLIMIT_NOFILE(%d):cur(%d),max(%d)", RLIMIT_NOFILE, (int)lim.rlim_cur, (int)lim.rlim_max);
       }
     }
   }
-
 }
 
 #if TS_HAS_WCCP
 static void
-Errata_Logger(ts::Errata const& err) {
+Errata_Logger(ts::Errata const &err)
+{
   size_t n;
   static size_t const SIZE = 4096;
   char buff[SIZE];
@@ -346,28 +345,33 @@ Errata_Logger(ts::Errata const& err) {
     ts::Errata::Code code = err.top().getCode();
     n = err.write(buff, SIZE, 1, 0, 2, "> ");
     // strip trailing newlines.
-    while (n && (buff[n-1] == '\n' || buff[n-1] == '\r'))
+    while (n && (buff[n - 1] == '\n' || buff[n - 1] == '\r'))
       buff[--n] = 0;
     // log it.
-    if (code > 1) mgmt_elog(0, "[WCCP]%s", buff);
-    else if (code > 0) mgmt_log("[WCCP]%s", buff);
-    else Debug("WCCP", "%s", buff);
+    if (code > 1)
+      mgmt_elog(0, "[WCCP]%s", buff);
+    else if (code > 0)
+      mgmt_log("[WCCP]%s", buff);
+    else
+      Debug("WCCP", "%s", buff);
   }
 }
 
 static void
-Init_Errata_Logging() {
+Init_Errata_Logging()
+{
   ts::Errata::registerSink(&Errata_Logger);
 }
 #endif
 
 static void
-millisleep(int ms) {
+millisleep(int ms)
+{
   struct timespec ts;
 
   ts.tv_sec = ms / 1000;
   ts.tv_nsec = (ms - ts.tv_sec * 1000) * 1000 * 1000;
-  nanosleep(&ts, NULL); //we use nanosleep instead of sleep because it does not interact with signals
+  nanosleep(&ts, NULL); // we use nanosleep instead of sleep because it does not interact with signals
 }
 
 int
@@ -396,7 +400,7 @@ main(int argc, char **argv)
   int cluster_mcport = -1, cluster_rsport = -1;
   // TODO: This seems completely incomplete, disabled for now
   //  int dump_config = 0, dump_process = 0, dump_node = 0, dump_cluster = 0, dump_local = 0;
-  char* proxy_port = 0;
+  char *proxy_port = 0;
   int proxy_backdoor = -1;
   char *envVar = NULL, *group_addr = NULL, *tsArgs = NULL;
   bool log_to_syslog = true;
@@ -406,8 +410,7 @@ main(int argc, char **argv)
   ink_thread webThrId;
 
   // Set up the application version info
-  appVersionInfo.setup(PACKAGE_NAME,"traffic_manager", PACKAGE_VERSION,
-                       __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
+  appVersionInfo.setup(PACKAGE_NAME, "traffic_manager", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
   initSignalHandlers();
 
   // Process Environment Variables
@@ -427,7 +430,7 @@ main(int argc, char **argv)
     group_addr = envVar;
   }
 
-  for (int i = 1; i < argc; i++) {      /* Process command line args */
+  for (int i = 1; i < argc; i++) { /* Process command line args */
 
     if (argv[i][0] == '-') {
       if ((strcmp(argv[i], "-version") == 0) || (strcmp(argv[i], "-V") == 0)) {
@@ -440,7 +443,6 @@ main(int argc, char **argv)
       } else {
         // The rest of the options require an argument in the form of -<Flag> <val>
         if ((i + 1) < argc) {
-
           if (strcmp(argv[i], "-aconfPort") == 0) {
             ++i;
             aconf_port_arg = atoi(argv[i]);
@@ -463,7 +465,7 @@ main(int argc, char **argv)
 #endif
           } else if (strcmp(argv[i], "-path") == 0) {
             ++i;
-            //bugfixed by YTS Team, yamsat(id-59703)
+            // bugfixed by YTS Team, yamsat(id-59703)
             if ((strlen(argv[i]) > PATH_NAME_MAX)) {
               fprintf(stderr, "\n   Path exceeded the maximum allowed characters.\n");
               exit(1);
@@ -478,7 +480,7 @@ main(int argc, char **argv)
           } else if (strcmp(argv[i], "-recordsConf") == 0) {
             ++i;
             recs_conf = argv[i];
-            // TODO: This seems completely incomplete, disabled for now
+// TODO: This seems completely incomplete, disabled for now
 #if 0
           } else if (strcmp(argv[i], "-printRecords") == 0) {
             ++i;
@@ -547,9 +549,10 @@ main(int argc, char **argv)
   RecLocalInit();
   LibRecordsConfigInit();
 
-  init_dirs();// setup critical directories, needs LibRecords
+  init_dirs(); // setup critical directories, needs LibRecords
 
-  if (RecGetRecordString("proxy.config.admin.user_id", userToRunAs, sizeof(userToRunAs)) != TS_ERR_OKAY || strlen(userToRunAs) == 0) {
+  if (RecGetRecordString("proxy.config.admin.user_id", userToRunAs, sizeof(userToRunAs)) != TS_ERR_OKAY ||
+      strlen(userToRunAs) == 0) {
     mgmt_fatal(stderr, 0, "proxy.config.admin.user_id is not set\n");
   }
 
@@ -605,8 +608,8 @@ main(int argc, char **argv)
   RecSetRecordString("proxy.node.version.manager.build_date", appVersionInfo.BldDateStr);
   RecSetRecordString("proxy.node.version.manager.build_machine", appVersionInfo.BldMachineStr);
   RecSetRecordString("proxy.node.version.manager.build_person", appVersionInfo.BldPersonStr);
-//    RecSetRecordString("proxy.node.version.manager.build_compile_flags",
-//                       appVersionInfo.BldCompileFlagsStr);
+  //    RecSetRecordString("proxy.node.version.manager.build_compile_flags",
+  //                       appVersionInfo.BldCompileFlagsStr);
 
   if (log_to_syslog) {
     char sys_var[] = "proxy.config.syslog_facility";
@@ -657,7 +660,7 @@ main(int argc, char **argv)
   RecLocalStart(configFiles);
 
   /* Update cmd line overrides/environmental overrides/etc */
-  if (tsArgs) {                 /* Passed command line args for proxy */
+  if (tsArgs) { /* Passed command line args for proxy */
     ats_free(lmgmt->proxy_options);
     lmgmt->proxy_options = tsArgs;
     mgmt_log(stderr, "[main] Traffic Server Args: '%s'\n", lmgmt->proxy_options);
@@ -690,14 +693,14 @@ main(int argc, char **argv)
   in_addr_t group_addr_ip = inet_network(group_addr);
 
   if (!(min_ip < group_addr_ip && group_addr_ip < max_ip)) {
-    mgmt_fatal(0, "[TrafficManager] Multi-Cast group addr '%s' is not in the permitted range of %s\n",
-               group_addr, "224.0.1.0 - 239.255.255.255");
+    mgmt_fatal(0, "[TrafficManager] Multi-Cast group addr '%s' is not in the permitted range of %s\n", group_addr,
+               "224.0.1.0 - 239.255.255.255");
   }
 
   /* TODO: Do we really need to init cluster communication? */
-  lmgmt->initCCom(appVersionInfo, configFiles, cluster_mcport, group_addr, cluster_rsport);       /* Setup cluster communication */
+  lmgmt->initCCom(appVersionInfo, configFiles, cluster_mcport, group_addr, cluster_rsport); /* Setup cluster communication */
 
-  lmgmt->initMgmtProcessServer();       /* Setup p-to-p process server */
+  lmgmt->initMgmtProcessServer(); /* Setup p-to-p process server */
 
   // Now that we know our cluster ip address, add the
   //   UI record for this machine
@@ -711,8 +714,8 @@ main(int argc, char **argv)
   // can keep a consistent euid when create mgmtapi/eventapi unix
   // sockets in webIntr_main thread.
   //
-  webThrId = ink_thread_create(webIntr_main, NULL);     /* Spin web agent thread */
-  Debug("lm", "Created Web Agent thread (%"  PRId64 ")", (int64_t)webThrId);
+  webThrId = ink_thread_create(webIntr_main, NULL); /* Spin web agent thread */
+  Debug("lm", "Created Web Agent thread (%" PRId64 ")", (int64_t)webThrId);
 
   ticker = time(NULL);
   mgmt_log("[TrafficManager] Setup complete\n");
@@ -726,7 +729,7 @@ main(int argc, char **argv)
   RecRegisterStatInt(RECT_NODE, "proxy.node.config.restart_required.manager", 0, RECP_NON_PERSISTENT);
   RecRegisterStatInt(RECT_NODE, "proxy.node.config.restart_required.cop", 0, RECP_NON_PERSISTENT);
 
-  int sleep_time = 0; //sleep_time given in sec
+  int sleep_time = 0; // sleep_time given in sec
 
   for (;;) {
     lmgmt->processEventQueue();
@@ -746,7 +749,7 @@ main(int argc, char **argv)
       lmgmt->ccom->sendSharedData();
       lmgmt->virt_map->lt_runGambit();
     } else {
-      if (!lmgmt->run_proxy) {  /* Down if we are not going to start another immed. */
+      if (!lmgmt->run_proxy) { /* Down if we are not going to start another immed. */
         /* Proxy is not up, so no addrs should be */
         lmgmt->virt_map->downOurAddrs();
       }
@@ -793,7 +796,7 @@ main(int argc, char **argv)
     if (lmgmt->run_proxy && !lmgmt->processRunning()) { /* Make sure we still have a proxy up */
       if (sleep_time) {
         mgmt_log(stderr, "Relaunching proxy after %d sec...", sleep_time);
-        millisleep(1000 * sleep_time); //we use millisleep instead of sleep because it doesnt interfere with signals
+        millisleep(1000 * sleep_time); // we use millisleep instead of sleep because it doesnt interfere with signals
         sleep_time = (sleep_time > 30) ? 60 : sleep_time * 2;
       } else {
         sleep_time = 1;
@@ -804,7 +807,7 @@ main(int argc, char **argv)
       } else {
         just_started++;
       }
-    } else {                    /* Give the proxy a chance to fire up */
+    } else { /* Give the proxy a chance to fire up */
       just_started++;
     }
 
@@ -821,37 +824,37 @@ main(int argc, char **argv)
 #ifdef NEED_PSIGNAL
           mgmt_log(stderr, "[main] Proxy terminated due to Sig %d. Relaunching after %d sec...\n", sig, sleep_time);
 #else
-          mgmt_log(stderr, "[main] Proxy terminated due to Sig %d: %s. Relaunching after %d sec...\n", sig, strsignal(sig), sleep_time);
+          mgmt_log(stderr, "[main] Proxy terminated due to Sig %d: %s. Relaunching after %d sec...\n", sig, strsignal(sig),
+                   sleep_time);
 #endif /* NEED_PSIGNAL */
         }
       }
       mgmt_log(stderr, "[main] Proxy launch failed, retrying after %d sec...\n", sleep_time);
     }
-
   }
 
   if (statProcessor) {
-    delete(statProcessor);
+    delete (statProcessor);
   }
 
 #ifndef MGMT_SERVICE
   return 0;
 #endif
 
-}                               /* End main */
+} /* End main */
 
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
 static void
-SignalAlrmHandler(int /* sig ATS_UNUSED */, siginfo_t * t, void * /* c ATS_UNUSED */)
+SignalAlrmHandler(int /* sig ATS_UNUSED */, siginfo_t *t, void * /* c ATS_UNUSED */)
 #else
 static void
 SignalAlrmHandler(int /* sig ATS_UNUSED */)
 #endif
 {
-  /*
-     fprintf(stderr, "[TrafficManager] ==> SIGALRM received\n");
-     mgmt_elog(stderr, 0, "[TrafficManager] ==> SIGALRM received\n");
-   */
+/*
+   fprintf(stderr, "[TrafficManager] ==> SIGALRM received\n");
+   mgmt_elog(stderr, 0, "[TrafficManager] ==> SIGALRM received\n");
+ */
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
   if (t) {
     if (t->si_code <= 0) {
@@ -873,7 +876,7 @@ SignalAlrmHandler(int /* sig ATS_UNUSED */)
 
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
 static void
-SignalHandler(int sig, siginfo_t * t, void *c)
+SignalHandler(int sig, siginfo_t *t, void *c)
 #else
 static void
 SignalHandler(int sig)
@@ -909,7 +912,6 @@ SignalHandler(int sig)
   if (lmgmt && !clean) {
     clean = 1;
     if (lmgmt->watched_process_pid != -1) {
-
       if (sig == SIGTERM || sig == SIGINT) {
         kill(lmgmt->watched_process_pid, sig);
         waitpid(lmgmt->watched_process_pid, &status, 0);
@@ -940,7 +942,7 @@ SignalHandler(int sig)
   fprintf(stderr, "[TrafficManager] ==> signal2 #%d\n", sig);
   mgmt_elog(stderr, 0, "[TrafficManager] ==> signal2 #%d\n", sig);
   _exit(sig);
-}                               /* End SignalHandler */
+} /* End SignalHandler */
 
 // void SigChldHandler(int sig)
 //
@@ -995,7 +997,7 @@ printUsage()
   fprintf(stderr, "   [...] can be one+ of: [config process node cluster local all]\n");
   fprintf(stderr, "----------------------------------------------------------------------------\n");
   exit(0);
-}                               /* End printUsage */
+} /* End printUsage */
 
 void
 fileUpdated(char *fname, bool incVersion)
@@ -1071,10 +1073,9 @@ fileUpdated(char *fname, bool incVersion)
     lmgmt->signalFileChange("proxy.config.prefetch.config_file");
   } else {
     mgmt_elog(stderr, 0, "[fileUpdated] Unknown config file updated '%s'\n", fname);
-
   }
   return;
-}                               /* End fileUpdate */
+} /* End fileUpdate */
 
 #if TS_USE_POSIX_CAP
 /** Restore capabilities after user id change.
@@ -1096,16 +1097,17 @@ fileUpdated(char *fname, bool incVersion)
  */
 
 int
-restoreCapabilities() {
-  int zret = 0; // return value.
+restoreCapabilities()
+{
+  int zret = 0;                   // return value.
   cap_t cap_set = cap_get_proc(); // current capabilities
   // Make a list of the capabilities we want turned on.
   cap_value_t cap_list[] = {
-    CAP_NET_ADMIN, ///< Set socket transparency.
+    CAP_NET_ADMIN,        ///< Set socket transparency.
     CAP_NET_BIND_SERVICE, ///< Low port (e.g. 80) binding.
-    CAP_IPC_LOCK ///< Lock IPC objects.
+    CAP_IPC_LOCK          ///< Lock IPC objects.
   };
-  static int const CAP_COUNT = sizeof(cap_list)/sizeof(*cap_list);
+  static int const CAP_COUNT = sizeof(cap_list) / sizeof(*cap_list);
 
   cap_set_flag(cap_set, CAP_EFFECTIVE, CAP_COUNT, cap_list, CAP_SET);
   zret = cap_set_proc(cap_set);
@@ -1122,7 +1124,7 @@ restoreCapabilities() {
 //  If we are not root, do nothing
 //
 void
-runAsUser(const char * userName)
+runAsUser(const char *userName)
 {
   if (getuid() == 0 || geteuid() == 0) {
     ImpersonateUser(userName, IMPERSONATE_EFFECTIVE);
@@ -1132,6 +1134,5 @@ runAsUser(const char * userName)
       mgmt_elog(stderr, 0, "[runAsUser] Error: Failed to restore capabilities after switch to user %s.\n", userName);
     }
 #endif
-
   }
-}                               /* End runAsUser() */
+} /* End runAsUser() */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_top/stats.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_top/stats.h b/cmd/traffic_top/stats.h
index 714781b..4b48bde 100644
--- a/cmd/traffic_top/stats.h
+++ b/cmd/traffic_top/stats.h
@@ -33,8 +33,10 @@
 using namespace std;
 
 struct LookupItem {
-  LookupItem(const char *s, const char *n, const int t): pretty(s), name(n), type(t) {}
-  LookupItem(const char *s, const char *n, const char *d, const int t): pretty(s), name(n), numerator(n), denominator(d), type(t) {}
+  LookupItem(const char *s, const char *n, const int t) : pretty(s), name(n), type(t) {}
+  LookupItem(const char *s, const char *n, const char *d, const int t) : pretty(s), name(n), numerator(n), denominator(d), type(t)
+  {
+  }
   const char *pretty;
   const char *name;
   const char *numerator;
@@ -45,19 +47,21 @@ extern size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream);
 extern char curl_error[CURL_ERROR_SIZE];
 extern string response;
 
-namespace constant {
-  const char global[] = "\"global\": {\n";
-  const char start[] = "\"proxy.process.";
-  const char seperator[] = "\": \"";
-  const char end[] = "\",\n";
+namespace constant
+{
+const char global[] = "\"global\": {\n";
+const char start[] = "\"proxy.process.";
+const char seperator[] = "\": \"";
+const char end[] = "\",\n";
 };
 
 
 //----------------------------------------------------------------------------
-class Stats {
+class Stats
+{
 public:
-  Stats(const string &url): _url(url) {
-
+  Stats(const string &url) : _url(url)
+  {
     if (url != "") {
       if (_url.substr(0, 4) != "http") {
         // looks like it is a host using it the old way
@@ -104,7 +108,8 @@ public:
     lookup_table.insert(make_pair("client_conn", LookupItem("New Conn", "proxy.process.http.total_client_connections", 2)));
     lookup_table.insert(make_pair("client_req_conn", LookupItem("Req/Conn", "client_req", "client_conn", 3)));
     lookup_table.insert(make_pair("client_curr_conn", LookupItem("Curr Conn", "proxy.process.http.current_client_connections", 1)));
-    lookup_table.insert(make_pair("client_actv_conn", LookupItem("Active Con", "proxy.process.http.current_active_client_connections", 1)));
+    lookup_table.insert(
+      make_pair("client_actv_conn", LookupItem("Active Con", "proxy.process.http.current_active_client_connections", 1)));
 
     lookup_table.insert(make_pair("server_req", LookupItem("Requests", "proxy.process.http.outgoing_requests", 2)));
     lookup_table.insert(make_pair("server_conn", LookupItem("New Conn", "proxy.process.http.total_server_connections", 2)));
@@ -112,10 +117,14 @@ public:
     lookup_table.insert(make_pair("server_curr_conn", LookupItem("Curr Conn", "proxy.process.http.current_server_connections", 1)));
 
 
-    lookup_table.insert(make_pair("client_head", LookupItem("Head Bytes", "proxy.process.http.user_agent_response_header_total_size", 2)));
-    lookup_table.insert(make_pair("client_body", LookupItem("Body Bytes", "proxy.process.http.user_agent_response_document_total_size", 2)));
-    lookup_table.insert(make_pair("server_head", LookupItem("Head Bytes", "proxy.process.http.origin_server_response_header_total_size", 2)));
-    lookup_table.insert(make_pair("server_body", LookupItem("Body Bytes", "proxy.process.http.origin_server_response_document_total_size", 2)));
+    lookup_table.insert(
+      make_pair("client_head", LookupItem("Head Bytes", "proxy.process.http.user_agent_response_header_total_size", 2)));
+    lookup_table.insert(
+      make_pair("client_body", LookupItem("Body Bytes", "proxy.process.http.user_agent_response_document_total_size", 2)));
+    lookup_table.insert(
+      make_pair("server_head", LookupItem("Head Bytes", "proxy.process.http.origin_server_response_header_total_size", 2)));
+    lookup_table.insert(
+      make_pair("server_body", LookupItem("Body Bytes", "proxy.process.http.origin_server_response_document_total_size", 2)));
 
     // not used directly
     lookup_table.insert(make_pair("ram_hit", LookupItem("Ram Hit", "proxy.process.cache.ram_cache.hits", 2)));
@@ -127,7 +136,8 @@ public:
     lookup_table.insert(make_pair("client_abort", LookupItem("Clnt Abort", "proxy.process.http.err_client_abort_count_stat", 2)));
     lookup_table.insert(make_pair("conn_fail", LookupItem("Conn Fail", "proxy.process.http.err_connect_fail_count_stat", 2)));
     lookup_table.insert(make_pair("abort", LookupItem("Abort", "proxy.process.http.transaction_counts.errors.aborts", 2)));
-    lookup_table.insert(make_pair("t_conn_fail", LookupItem("Conn Fail", "proxy.process.http.transaction_counts.errors.connect_failed", 2)));
+    lookup_table.insert(
+      make_pair("t_conn_fail", LookupItem("Conn Fail", "proxy.process.http.transaction_counts.errors.connect_failed", 2)));
     lookup_table.insert(make_pair("other_err", LookupItem("Other Err", "proxy.process.http.transaction_counts.errors.other", 2)));
 
     // percentage
@@ -142,12 +152,18 @@ public:
     lookup_table.insert(make_pair("not", LookupItem("Not Cache", "proxy.process.http.transaction_counts.miss_not_cacheable", 5)));
     lookup_table.insert(make_pair("no", LookupItem("No Cache", "proxy.process.http.transaction_counts.miss_client_no_cache", 5)));
 
-    lookup_table.insert(make_pair("fresh_time", LookupItem("Fresh (ms)", "proxy.process.http.transaction_totaltime.hit_fresh", "fresh", 8)));
-    lookup_table.insert(make_pair("reval_time", LookupItem("Reval (ms)", "proxy.process.http.transaction_totaltime.hit_revalidated", "reval", 8)));
-    lookup_table.insert(make_pair("cold_time", LookupItem("Cold (ms)", "proxy.process.http.transaction_totaltime.miss_cold", "cold", 8)));
-    lookup_table.insert(make_pair("changed_time", LookupItem("Chang (ms)", "proxy.process.http.transaction_totaltime.miss_changed", "changed", 8)));
-    lookup_table.insert(make_pair("not_time", LookupItem("Not (ms)", "proxy.process.http.transaction_totaltime.miss_not_cacheable", "not", 8)));
-    lookup_table.insert(make_pair("no_time", LookupItem("No (ms)", "proxy.process.http.transaction_totaltime.miss_client_no_cache", "no", 8)));
+    lookup_table.insert(
+      make_pair("fresh_time", LookupItem("Fresh (ms)", "proxy.process.http.transaction_totaltime.hit_fresh", "fresh", 8)));
+    lookup_table.insert(
+      make_pair("reval_time", LookupItem("Reval (ms)", "proxy.process.http.transaction_totaltime.hit_revalidated", "reval", 8)));
+    lookup_table.insert(
+      make_pair("cold_time", LookupItem("Cold (ms)", "proxy.process.http.transaction_totaltime.miss_cold", "cold", 8)));
+    lookup_table.insert(
+      make_pair("changed_time", LookupItem("Chang (ms)", "proxy.process.http.transaction_totaltime.miss_changed", "changed", 8)));
+    lookup_table.insert(
+      make_pair("not_time", LookupItem("Not (ms)", "proxy.process.http.transaction_totaltime.miss_not_cacheable", "not", 8)));
+    lookup_table.insert(
+      make_pair("no_time", LookupItem("No (ms)", "proxy.process.http.transaction_totaltime.miss_client_no_cache", "no", 8)));
 
     lookup_table.insert(make_pair("get", LookupItem("GET", "proxy.process.http.get_requests", 5)));
     lookup_table.insert(make_pair("head", LookupItem("HEAD", "proxy.process.http.head_requests", 5)));
@@ -225,8 +241,9 @@ public:
     lookup_table.insert(make_pair("client_dyn_ka", LookupItem("Dynamic KA", "ka_total", "ka_count", 3)));
   }
 
-  void getStats() {
-
+  void
+  getStats()
+  {
     if (_url == "") {
       int64_t value = 0;
       if (_old_stats != NULL) {
@@ -239,8 +256,7 @@ public:
       gettimeofday(&_time, NULL);
       double now = _time.tv_sec + (double)_time.tv_usec / 1000000;
 
-      for (map<string, LookupItem>::const_iterator lookup_it = lookup_table.begin();
-           lookup_it != lookup_table.end(); ++lookup_it) {
+      for (map<string, LookupItem>::const_iterator lookup_it = lookup_table.begin(); lookup_it != lookup_table.end(); ++lookup_it) {
         const LookupItem &item = lookup_it->second;
 
         if (item.type == 1 || item.type == 2 || item.type == 5 || item.type == 8) {
@@ -252,8 +268,8 @@ public:
             (*_stats)[key] = strValue;
           } else {
             if (TSRecordGetInt(item.name, &value) != TS_ERR_OKAY) {
-              fprintf(stderr, "Error getting stat: %s when calling TSRecordGetInt() failed: file \"%s\", line %d\n\n",
-                  item.name, __FILE__, __LINE__);
+              fprintf(stderr, "Error getting stat: %s when calling TSRecordGetInt() failed: file \"%s\", line %d\n\n", item.name,
+                      __FILE__, __LINE__);
               abort();
             }
             string key = item.name;
@@ -310,7 +326,9 @@ public:
     }
   }
 
-  int64_t getValue(const string &key, const map<string, string> *stats) const {
+  int64_t
+  getValue(const string &key, const map<string, string> *stats) const
+  {
     map<string, string>::const_iterator stats_it = stats->find(key);
     if (stats_it == stats->end())
       return 0;
@@ -318,14 +336,18 @@ public:
     return value;
   }
 
-  void getStat(const string &key, double &value, int overrideType = 0) {
+  void
+  getStat(const string &key, double &value, int overrideType = 0)
+  {
     string strtmp;
     int typetmp;
     getStat(key, value, strtmp, typetmp, overrideType);
   }
 
 
-  void getStat(const string &key, string &value) {
+  void
+  getStat(const string &key, string &value)
+  {
     map<string, LookupItem>::const_iterator lookup_it = lookup_table.find(key);
     assert(lookup_it != lookup_table.end());
     const LookupItem &item = lookup_it->second;
@@ -337,7 +359,9 @@ public:
       value = stats_it->second.c_str();
   }
 
-  void getStat(const string &key, double &value, string &prettyName, int &type, int overrideType = 0) {
+  void
+  getStat(const string &key, double &value, string &prettyName, int &type, int overrideType = 0)
+  {
     map<string, LookupItem>::const_iterator lookup_it = lookup_table.find(key);
     assert(lookup_it != lookup_table.end());
     const LookupItem &item = lookup_it->second;
@@ -401,7 +425,9 @@ public:
     }
   }
 
-  bool toggleAbsolute() {
+  bool
+  toggleAbsolute()
+  {
     if (_absolute == true)
       _absolute = false;
     else
@@ -410,7 +436,9 @@ public:
     return _absolute;
   }
 
-  void parseResponse(const string &response) {
+  void
+  parseResponse(const string &response)
+  {
     // move past global
     size_t pos = response.find(constant::global);
     pos += sizeof(constant::global) - 1;
@@ -424,23 +452,29 @@ public:
       if (start == string::npos || seperator == string::npos || end == string::npos)
         return;
 
-      //cout << constant::start << " " << start << endl;
-      //cout << constant::seperator << " " << seperator << endl;
-      //cout << constant::end << " " << end << endl;
+      // cout << constant::start << " " << start << endl;
+      // cout << constant::seperator << " " << seperator << endl;
+      // cout << constant::end << " " << end << endl;
 
       string key = response.substr(start + 1, seperator - start - 1);
-      string value = response.substr(seperator + sizeof(constant::seperator) - 1, end - seperator - sizeof(constant::seperator) + 1);
+      string value =
+        response.substr(seperator + sizeof(constant::seperator) - 1, end - seperator - sizeof(constant::seperator) + 1);
 
       (*_stats)[key] = value;
-      //cout << "key " << key << " " << "value " << value << endl;
+      // cout << "key " << key << " " << "value " << value << endl;
       pos = end + sizeof(constant::end) - 1;
-      //cout << "pos: " << pos << endl;
+      // cout << "pos: " << pos << endl;
     }
   }
 
-  const string& getHost() const { return _host; }
+  const string &
+  getHost() const
+  {
+    return _host;
+  }
 
-  ~Stats() {
+  ~Stats()
+  {
     if (_stats != NULL) {
       delete _stats;
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_top/traffic_top.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_top/traffic_top.cc b/cmd/traffic_top/traffic_top.cc
index 71d8729..2f34c5a 100644
--- a/cmd/traffic_top/traffic_top.cc
+++ b/cmd/traffic_top/traffic_top.cc
@@ -38,17 +38,17 @@
 #define NCURSES_NOMACROS 1
 
 #if defined HAVE_NCURSESW_CURSES_H
-#  include <ncursesw/curses.h>
+#include <ncursesw/curses.h>
 #elif defined HAVE_NCURSESW_H
-#  include <ncursesw.h>
+#include <ncursesw.h>
 #elif defined HAVE_NCURSES_CURSES_H
-#  include <ncurses/curses.h>
+#include <ncurses/curses.h>
 #elif defined HAVE_NCURSES_H
-#  include <ncurses.h>
+#include <ncurses.h>
 #elif defined HAVE_CURSES_H
-#  include <curses.h>
+#include <curses.h>
 #else
-#  error "SysV or X/Open-compatible Curses header file required"
+#error "SysV or X/Open-compatible Curses header file required"
 #endif
 
 #include "stats.h"
@@ -57,19 +57,22 @@ using namespace std;
 char curl_error[CURL_ERROR_SIZE];
 string response;
 
-namespace colorPair {
-  const short red = 1;
-  const short yellow = 2;
-  const short green = 3;
-  const short blue = 4;
-  //  const short black = 5;
-  const short grey = 6;
-  const short cyan = 7;
-  const short border = 8;
+namespace colorPair
+{
+const short red = 1;
+const short yellow = 2;
+const short green = 3;
+const short blue = 4;
+//  const short black = 5;
+const short grey = 6;
+const short cyan = 7;
+const short border = 8;
 };
 
 //----------------------------------------------------------------------------
-static void prettyPrint(const int x, const int y, const double number, const int type) {
+static void
+prettyPrint(const int x, const int y, const double number, const int type)
+{
   char buffer[32];
   char exp = ' ';
   double my_number = number;
@@ -119,7 +122,9 @@ static void prettyPrint(const int x, const int y, const double number, const int
 }
 
 //----------------------------------------------------------------------------
-static void makeTable(const int x, const int y, const list<string> &items, Stats &stats) {
+static void
+makeTable(const int x, const int y, const list<string> &items, Stats &stats)
+{
   int my_y = y;
 
   for (list<string>::const_iterator it = items.begin(); it != items.end(); ++it) {
@@ -134,16 +139,19 @@ static void makeTable(const int x, const int y, const list<string> &items, Stats
 }
 
 //----------------------------------------------------------------------------
-size_t write_data(void *ptr, size_t size, size_t nmemb, void * /* stream */)
+size_t
+write_data(void *ptr, size_t size, size_t nmemb, void * /* stream */)
 {
-  response.append((char*)ptr, size * nmemb);
-  //cout << "appending: " << size * nmemb << endl;
-  //int written = fwrite(ptr, size, nmemb, (FILE *)stream);
+  response.append((char *)ptr, size * nmemb);
+  // cout << "appending: " << size * nmemb << endl;
+  // int written = fwrite(ptr, size, nmemb, (FILE *)stream);
   return size * nmemb;
 }
 
 //----------------------------------------------------------------------------
-static void response_code_page(Stats &stats) {
+static void
+response_code_page(Stats &stats)
+{
   attron(COLOR_PAIR(colorPair::border));
   attron(A_BOLD);
   mvprintw(0, 0, "                              RESPONSE CODES                                   ");
@@ -205,27 +213,34 @@ static void response_code_page(Stats &stats) {
 }
 
 //----------------------------------------------------------------------------
-static void help(const string &host, const string &version) {
+static void
+help(const string &host, const string &version)
+{
   timeout(1000);
 
-  while(1) {
+  while (1) {
     clear();
     time_t now = time(NULL);
     struct tm *nowtm = localtime(&now);
     char timeBuf[32];
     strftime(timeBuf, sizeof(timeBuf), "%H:%M:%S", nowtm);
 
-    //clear();
-    attron(A_BOLD); mvprintw(0, 0, "Overview:"); attroff(A_BOLD);
-    mvprintw(1, 0,
+    // clear();
+    attron(A_BOLD);
+    mvprintw(0, 0, "Overview:");
+    attroff(A_BOLD);
+    mvprintw(
+      1, 0,
       "traffic_top is a top like program for Apache Traffic Server (ATS). "
       "There is a lot of statistical information gathered by ATS. "
       "This program tries to show some of the more important stats and gives a good overview of what the proxy server is doing. "
       "Hopefully this can be used as a tool for diagnosing the proxy server if there are problems.");
 
-    attron(A_BOLD); mvprintw(7, 0, "Definitions:"); attroff(A_BOLD);
-    mvprintw(8,  0, "Fresh      => Requests that were servered by fresh entries in cache");
-    mvprintw(9,  0, "Revalidate => Requests that contacted the origin to verify if still valid");
+    attron(A_BOLD);
+    mvprintw(7, 0, "Definitions:");
+    attroff(A_BOLD);
+    mvprintw(8, 0, "Fresh      => Requests that were servered by fresh entries in cache");
+    mvprintw(9, 0, "Revalidate => Requests that contacted the origin to verify if still valid");
     mvprintw(10, 0, "Cold       => Requests that were not in cache at all");
     mvprintw(11, 0, "Changed    => Requests that required entries in cache to be updated");
     mvprintw(12, 0, "Changed    => Requests that can't be cached for some reason");
@@ -243,14 +258,16 @@ static void help(const string &host, const string &version) {
   }
 }
 
-static void usage()
+static void
+usage()
 {
   fprintf(stderr, "Usage: traffic_top [-s seconds] [URL|hostname|hostname:port]\n");
   exit(1);
 }
 
 //----------------------------------------------------------------------------
-void main_stats_page(Stats &stats)
+void
+main_stats_page(Stats &stats)
 {
   attron(COLOR_PAIR(colorPair::border));
   attron(A_BOLD);
@@ -364,13 +381,14 @@ void main_stats_page(Stats &stats)
 }
 
 //----------------------------------------------------------------------------
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
 {
   int sleep_time = 5000;
   bool absolute = false;
   int opt;
   while ((opt = getopt(argc, argv, "s:")) != -1) {
-    switch(opt) {
+    switch (opt) {
     case 's':
       sleep_time = atoi(optarg) * 1000;
       break;
@@ -395,7 +413,7 @@ int main(int argc, char **argv)
   initscr();
   curs_set(0);
 
-  start_color();			/* Start color functionality	*/
+  start_color(); /* Start color functionality	*/
 
   init_pair(colorPair::red, COLOR_RED, COLOR_BLACK);
   init_pair(colorPair::yellow, COLOR_YELLOW, COLOR_BLACK);
@@ -407,11 +425,14 @@ int main(int argc, char **argv)
   //  mvchgat(0, 0, -1, A_BLINK, 1, NULL);
 
 
-  enum Page {MAIN_PAGE, RESPONSE_PAGE};
+  enum Page {
+    MAIN_PAGE,
+    RESPONSE_PAGE,
+  };
   Page page = MAIN_PAGE;
   string page_alt = "(r)esponse";
 
-  while(1) {
+  while (1) {
     attron(COLOR_PAIR(colorPair::border));
     attron(A_BOLD);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_via/traffic_via.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_via/traffic_via.cc b/cmd/traffic_via/traffic_via.cc
index 46b0fc7..7426d1b 100644
--- a/cmd/traffic_via/traffic_via.cc
+++ b/cmd/traffic_via/traffic_via.cc
@@ -39,179 +39,176 @@
 #include <pcre.h>
 #endif
 
-#define SUBSTRING_VECTOR_COUNT 30 //Should be multiple of 3
+#define SUBSTRING_VECTOR_COUNT 30 // Should be multiple of 3
 
 static AppVersionInfo appVersionInfo;
 
-struct VIA
-{
-  VIA(const char * t) : title(t), next(NULL) { memset(viaData, 0, sizeof(viaData)); }
+struct VIA {
+  VIA(const char *t) : title(t), next(NULL) { memset(viaData, 0, sizeof(viaData)); }
 
-  ~VIA() {
-    delete next;
-  }
+  ~VIA() { delete next; }
 
-  const char * title;
-  const char * viaData[128];
-  VIA * next;
+  const char *title;
+  const char *viaData[128];
+  VIA *next;
 };
 
-//Function to get via header table for every field/category in the via header
+// Function to get via header table for every field/category in the via header
 static VIA *
 detailViaLookup(char flag)
 {
-  VIA * viaTable;
+  VIA *viaTable;
 
-  //Detailed via codes after ":"
+  // Detailed via codes after ":"
   switch (flag) {
   case 't':
     viaTable = new VIA("Tunnel info");
-    viaTable->viaData[(unsigned char) ' '] = "no tunneling";
-    viaTable->viaData[(unsigned char) 'U'] = "tunneling because of url (url suggests dynamic content)";
-    viaTable->viaData[(unsigned char) 'M'] = "tunneling due to a method (e.g. CONNECT)";
-    viaTable->viaData[(unsigned char) 'O'] = "tunneling because cache is turned off";
-    viaTable->viaData[(unsigned char) 'F'] = "tunneling due to a header field (such as presence of If-Range header)";
-    viaTable->viaData[(unsigned char) 'N'] = "tunneling due to no forward";
-    viaTable->viaData[(unsigned char) 'A'] = "tunnel authorization";
+    viaTable->viaData[(unsigned char)' '] = "no tunneling";
+    viaTable->viaData[(unsigned char)'U'] = "tunneling because of url (url suggests dynamic content)";
+    viaTable->viaData[(unsigned char)'M'] = "tunneling due to a method (e.g. CONNECT)";
+    viaTable->viaData[(unsigned char)'O'] = "tunneling because cache is turned off";
+    viaTable->viaData[(unsigned char)'F'] = "tunneling due to a header field (such as presence of If-Range header)";
+    viaTable->viaData[(unsigned char)'N'] = "tunneling due to no forward";
+    viaTable->viaData[(unsigned char)'A'] = "tunnel authorization";
     break;
   case 'c':
-    //Cache type
-    viaTable = new VIA( "Cache Type");
-    viaTable->viaData[(unsigned char) 'C'] = "cache";
-    viaTable->viaData[(unsigned char) 'L'] = "cluster, (not used)";
-    viaTable->viaData[(unsigned char) 'I'] = "icp";
-    viaTable->viaData[(unsigned char) 'P'] = "parent";
-    viaTable->viaData[(unsigned char) 'S'] = "server";
-    viaTable->viaData[(unsigned char) ' '] = "unknown";
-
-    //Cache Lookup Result
+    // Cache type
+    viaTable = new VIA("Cache Type");
+    viaTable->viaData[(unsigned char)'C'] = "cache";
+    viaTable->viaData[(unsigned char)'L'] = "cluster, (not used)";
+    viaTable->viaData[(unsigned char)'I'] = "icp";
+    viaTable->viaData[(unsigned char)'P'] = "parent";
+    viaTable->viaData[(unsigned char)'S'] = "server";
+    viaTable->viaData[(unsigned char)' '] = "unknown";
+
+    // Cache Lookup Result
     viaTable->next = new VIA("Cache Lookup Result");
-    viaTable->next->viaData[(unsigned char) 'C'] = "cache hit but config forces revalidate";
-    viaTable->next->viaData[(unsigned char) 'I'] = "conditional miss (client sent conditional, fresh in cache, returned 412)";
-    viaTable->next->viaData[(unsigned char) ' '] = "cache miss or no cache lookup";
-    viaTable->next->viaData[(unsigned char) 'U'] = "cache hit, but client forces revalidate (e.g. Pragma: no-cache)";
-    viaTable->next->viaData[(unsigned char) 'D'] = "cache hit, but method forces revalidated (e.g. ftp, not anonymous)";
-    viaTable->next->viaData[(unsigned char) 'M'] = "cache miss (url not in cache)";
-    viaTable->next->viaData[(unsigned char) 'N'] = "conditional hit (client sent conditional, doc fresh in cache, returned 304)";
-    viaTable->next->viaData[(unsigned char) 'H'] = "cache hit";
-    viaTable->next->viaData[(unsigned char) 'S'] = "cache hit, but expired";
-    viaTable->next->viaData[(unsigned char) 'K'] = "cookie miss";
+    viaTable->next->viaData[(unsigned char)'C'] = "cache hit but config forces revalidate";
+    viaTable->next->viaData[(unsigned char)'I'] = "conditional miss (client sent conditional, fresh in cache, returned 412)";
+    viaTable->next->viaData[(unsigned char)' '] = "cache miss or no cache lookup";
+    viaTable->next->viaData[(unsigned char)'U'] = "cache hit, but client forces revalidate (e.g. Pragma: no-cache)";
+    viaTable->next->viaData[(unsigned char)'D'] = "cache hit, but method forces revalidated (e.g. ftp, not anonymous)";
+    viaTable->next->viaData[(unsigned char)'M'] = "cache miss (url not in cache)";
+    viaTable->next->viaData[(unsigned char)'N'] = "conditional hit (client sent conditional, doc fresh in cache, returned 304)";
+    viaTable->next->viaData[(unsigned char)'H'] = "cache hit";
+    viaTable->next->viaData[(unsigned char)'S'] = "cache hit, but expired";
+    viaTable->next->viaData[(unsigned char)'K'] = "cookie miss";
     break;
   case 'i':
     viaTable = new VIA("ICP status");
-    viaTable->viaData[(unsigned char) ' '] = "no icp";
-    viaTable->viaData[(unsigned char) 'S'] = "connection opened successfully";
-    viaTable->viaData[(unsigned char) 'F'] = "connection open failed";
+    viaTable->viaData[(unsigned char)' '] = "no icp";
+    viaTable->viaData[(unsigned char)'S'] = "connection opened successfully";
+    viaTable->viaData[(unsigned char)'F'] = "connection open failed";
     break;
   case 'p':
     viaTable = new VIA("Parent proxy connection status");
-    viaTable->viaData[(unsigned char) ' '] = "no parent proxy or unknown";
-    viaTable->viaData[(unsigned char) 'S'] = "connection opened successfully";
-    viaTable->viaData[(unsigned char) 'F'] = "connection open failed";
+    viaTable->viaData[(unsigned char)' '] = "no parent proxy or unknown";
+    viaTable->viaData[(unsigned char)'S'] = "connection opened successfully";
+    viaTable->viaData[(unsigned char)'F'] = "connection open failed";
     break;
   case 's':
     viaTable = new VIA("Origin server connection status");
-    viaTable->viaData[(unsigned char) ' '] = "no server connection needed";
-    viaTable->viaData[(unsigned char) 'S'] = "connection opened successfully";
-    viaTable->viaData[(unsigned char) 'F'] = "connection open failed";
+    viaTable->viaData[(unsigned char)' '] = "no server connection needed";
+    viaTable->viaData[(unsigned char)'S'] = "connection opened successfully";
+    viaTable->viaData[(unsigned char)'F'] = "connection open failed";
     break;
   default:
     viaTable = NULL;
-    fprintf(stderr, "%s: %s: %c\n", appVersionInfo.AppStr, "Invalid VIA header character",flag);
+    fprintf(stderr, "%s: %s: %c\n", appVersionInfo.AppStr, "Invalid VIA header character", flag);
     break;
   }
 
   return viaTable;
 }
 
-//Function to get via header table for every field/category in the via header
+// Function to get via header table for every field/category in the via header
 static VIA *
 standardViaLookup(char flag)
 {
-  VIA * viaTable;
+  VIA *viaTable;
 
-  //Via codes before ":"
+  // Via codes before ":"
   switch (flag) {
-    case 'u':
-      viaTable = new VIA("Request headers received from client");
-      viaTable->viaData[(unsigned char) 'C'] = "cookie";
-      viaTable->viaData[(unsigned char) 'E'] = "error in request";
-      viaTable->viaData[(unsigned char) 'S'] = "simple request (not conditional)";
-      viaTable->viaData[(unsigned char) 'N'] = "no-cache";
-      viaTable->viaData[(unsigned char) 'I'] = "IMS";
-      viaTable->viaData[(unsigned char) ' '] = "unknown";
-      break;
-    case 'c':
-      viaTable = new VIA( "Result of Traffic Server cache lookup for URL");
-      viaTable->viaData[(unsigned char) 'A'] = "in cache, not acceptable (a cache \"MISS\")";
-      viaTable->viaData[(unsigned char) 'H'] = "in cache, fresh (a cache \"HIT\")";
-      viaTable->viaData[(unsigned char) 'S'] = "in cache, stale (a cache \"MISS\")";
-      viaTable->viaData[(unsigned char) 'R'] = "in cache, fresh Ram hit (a cache \"HIT\")";
-      viaTable->viaData[(unsigned char) 'M'] = "miss (a cache \"MISS\")";
-      viaTable->viaData[(unsigned char) ' '] = "no cache lookup";
-      break;
-    case 's':
-      viaTable = new VIA("Response information received from origin server");
-      viaTable->viaData[(unsigned char) 'E'] = "error in response";
-      viaTable->viaData[(unsigned char) 'S'] = "connection opened successfully";
-      viaTable->viaData[(unsigned char) 'N'] = "not-modified";
-      viaTable->viaData[(unsigned char) ' '] = "no server connection needed";
-      break;
-    case 'f':
-      viaTable = new VIA("Result of document write-to-cache:");
-      viaTable->viaData[(unsigned char) 'U'] = "updated old cache copy";
-      viaTable->viaData[(unsigned char) 'D'] = "cached copy deleted";
-      viaTable->viaData[(unsigned char) 'W'] = "written into cache (new copy)";
-      viaTable->viaData[(unsigned char) ' '] = "no cache write performed";
-      break;
-    case 'p':
-      viaTable = new VIA("Proxy operation result");
-      viaTable->viaData[(unsigned char) 'R'] = "origin server revalidated";
-      viaTable->viaData[(unsigned char) ' '] = "unknown";
-      viaTable->viaData[(unsigned char) 'S'] = "served or connection opened successfully";
-      viaTable->viaData[(unsigned char) 'N'] = "not-modified";
-      break;
-    case 'e':
-      viaTable = new VIA("Error codes (if any)");
-      viaTable->viaData[(unsigned char) 'A'] = "authorization failure";
-      viaTable->viaData[(unsigned char) 'H'] = "header syntax unacceptable";
-      viaTable->viaData[(unsigned char) 'C'] = "connection to server failed";
-      viaTable->viaData[(unsigned char) 'T'] = "connection timed out";
-      viaTable->viaData[(unsigned char) 'S'] = "server related error";
-      viaTable->viaData[(unsigned char) 'D'] = "dns failure";
-      viaTable->viaData[(unsigned char) 'N'] = "no error";
-      viaTable->viaData[(unsigned char) 'F'] = "request forbidden";
-      viaTable->viaData[(unsigned char) 'R'] = "cache read error";
-      viaTable->viaData[(unsigned char) ' '] = "unknown";
-      break;
-    default:
-      viaTable = NULL;
-      fprintf(stderr, "%s: %s: %c\n", appVersionInfo.AppStr, "Invalid VIA header character",flag);
-      break;
+  case 'u':
+    viaTable = new VIA("Request headers received from client");
+    viaTable->viaData[(unsigned char)'C'] = "cookie";
+    viaTable->viaData[(unsigned char)'E'] = "error in request";
+    viaTable->viaData[(unsigned char)'S'] = "simple request (not conditional)";
+    viaTable->viaData[(unsigned char)'N'] = "no-cache";
+    viaTable->viaData[(unsigned char)'I'] = "IMS";
+    viaTable->viaData[(unsigned char)' '] = "unknown";
+    break;
+  case 'c':
+    viaTable = new VIA("Result of Traffic Server cache lookup for URL");
+    viaTable->viaData[(unsigned char)'A'] = "in cache, not acceptable (a cache \"MISS\")";
+    viaTable->viaData[(unsigned char)'H'] = "in cache, fresh (a cache \"HIT\")";
+    viaTable->viaData[(unsigned char)'S'] = "in cache, stale (a cache \"MISS\")";
+    viaTable->viaData[(unsigned char)'R'] = "in cache, fresh Ram hit (a cache \"HIT\")";
+    viaTable->viaData[(unsigned char)'M'] = "miss (a cache \"MISS\")";
+    viaTable->viaData[(unsigned char)' '] = "no cache lookup";
+    break;
+  case 's':
+    viaTable = new VIA("Response information received from origin server");
+    viaTable->viaData[(unsigned char)'E'] = "error in response";
+    viaTable->viaData[(unsigned char)'S'] = "connection opened successfully";
+    viaTable->viaData[(unsigned char)'N'] = "not-modified";
+    viaTable->viaData[(unsigned char)' '] = "no server connection needed";
+    break;
+  case 'f':
+    viaTable = new VIA("Result of document write-to-cache:");
+    viaTable->viaData[(unsigned char)'U'] = "updated old cache copy";
+    viaTable->viaData[(unsigned char)'D'] = "cached copy deleted";
+    viaTable->viaData[(unsigned char)'W'] = "written into cache (new copy)";
+    viaTable->viaData[(unsigned char)' '] = "no cache write performed";
+    break;
+  case 'p':
+    viaTable = new VIA("Proxy operation result");
+    viaTable->viaData[(unsigned char)'R'] = "origin server revalidated";
+    viaTable->viaData[(unsigned char)' '] = "unknown";
+    viaTable->viaData[(unsigned char)'S'] = "served or connection opened successfully";
+    viaTable->viaData[(unsigned char)'N'] = "not-modified";
+    break;
+  case 'e':
+    viaTable = new VIA("Error codes (if any)");
+    viaTable->viaData[(unsigned char)'A'] = "authorization failure";
+    viaTable->viaData[(unsigned char)'H'] = "header syntax unacceptable";
+    viaTable->viaData[(unsigned char)'C'] = "connection to server failed";
+    viaTable->viaData[(unsigned char)'T'] = "connection timed out";
+    viaTable->viaData[(unsigned char)'S'] = "server related error";
+    viaTable->viaData[(unsigned char)'D'] = "dns failure";
+    viaTable->viaData[(unsigned char)'N'] = "no error";
+    viaTable->viaData[(unsigned char)'F'] = "request forbidden";
+    viaTable->viaData[(unsigned char)'R'] = "cache read error";
+    viaTable->viaData[(unsigned char)' '] = "unknown";
+    break;
+  default:
+    viaTable = NULL;
+    fprintf(stderr, "%s: %s: %c\n", appVersionInfo.AppStr, "Invalid VIA header character", flag);
+    break;
   }
 
   return viaTable;
 }
 
-//Function to print via header
+// Function to print via header
 static void
-printViaHeader(const char * header)
+printViaHeader(const char *header)
 {
-  VIA * viaTable = NULL;
-  VIA * viaEntry = NULL;
+  VIA *viaTable = NULL;
+  VIA *viaEntry = NULL;
   bool isDetail = false;
 
   printf("Via Header Details:\n");
 
-  //Loop through input via header flags
-  for (const char * c = header; *c; ++c) {
+  // Loop through input via header flags
+  for (const char *c = header; *c; ++c) {
     if (*c == ':') {
       isDetail = true;
       continue;
     }
 
     if (islower(*c)) {
-      //Get the via header table
+      // Get the via header table
       delete viaTable;
       viaEntry = viaTable = isDetail ? detailViaLookup(*c) : standardViaLookup(*c);
     } else {
@@ -226,41 +223,43 @@ printViaHeader(const char * header)
   delete viaTable;
 }
 
-//Check validity of via header and then decode it
+// Check validity of via header and then decode it
 static TSMgmtError
-decodeViaHeader(const char * str)
+decodeViaHeader(const char *str)
 {
   size_t viaHdrLength = strlen(str);
   char tmp[viaHdrLength + 2];
-  char * Via = tmp;
+  char *Via = tmp;
 
   strncpy(Via, str, viaHdrLength + 1); // Safe to call strcpy.
   printf("Via header is %s, Length is %zu\n", Via, viaHdrLength);
 
-  //Via header inside square brackets
-  if (Via[0] == '[' && Via[viaHdrLength-1] == ']') {
+  // Via header inside square brackets
+  if (Via[0] == '[' && Via[viaHdrLength - 1] == ']') {
     viaHdrLength = viaHdrLength - 2;
     Via++;
-    Via[viaHdrLength] = '\0'; //null terminate the string after trimming
+    Via[viaHdrLength] = '\0'; // null terminate the string after trimming
   }
 
   if (viaHdrLength == 5) {
-    Via = strcat(Via, " ");  //Add one space character before decoding via header
+    Via = strcat(Via, " "); // Add one space character before decoding via header
     ++viaHdrLength;
   }
 
   if (viaHdrLength == 24 || viaHdrLength == 6) {
-    //Decode via header
+    // Decode via header
     printViaHeader(Via);
     return TS_ERR_OKAY;
   }
-  //Invalid header size, come out.
+  // Invalid header size, come out.
   printf("\nInvalid VIA header. VIA header length should be 6 or 24 characters\n");
-  printf("Valid via header format is [u<client-stuff>c<cache-lookup-stuff>s<server-stuff>f<cache-fill-stuff>p<proxy-stuff>]e<error-codes>:t<tunneling-info>c<cache type><cache-lookup-result>i<icp-conn-info>p<parent-proxy-conn-info>s<server-conn-info>]");
+  printf("Valid via header format is "
+         "[u<client-stuff>c<cache-lookup-stuff>s<server-stuff>f<cache-fill-stuff>p<proxy-stuff>]e<error-codes>:t<tunneling-info>c<"
+         "cache type><cache-lookup-result>i<icp-conn-info>p<parent-proxy-conn-info>s<server-conn-info>]");
   return TS_ERR_FAIL;
 }
 
-//Read user input from stdin
+// Read user input from stdin
 static TSMgmtError
 filterViaHeader()
 {
@@ -271,11 +270,12 @@ filterViaHeader()
   int errOffset;
   int pcreExecCode;
   int i;
-  const char *viaPattern = "\\[([ucsfpe]+[^\\]]+)\\]"; //Regex to match via header with in [] which can start with character class ucsfpe
+  const char *viaPattern =
+    "\\[([ucsfpe]+[^\\]]+)\\]"; // Regex to match via header with in [] which can start with character class ucsfpe
   char *viaHeaderString;
   char viaHeader[1024];
 
-  //Compile PCRE via header pattern
+  // Compile PCRE via header pattern
   compiledReg = pcre_compile(viaPattern, 0, &err, &errOffset, NULL);
 
   if (compiledReg == NULL) {
@@ -283,34 +283,36 @@ filterViaHeader()
     return TS_ERR_FAIL;
   }
 
-  //Read all lines from stdin
+  // Read all lines from stdin
   while (fgets(viaHeader, sizeof(viaHeader), stdin)) {
-    //Trim new line character and null terminate it
-    char* newLinePtr = strchr(viaHeader, '\n');
+    // Trim new line character and null terminate it
+    char *newLinePtr = strchr(viaHeader, '\n');
     if (newLinePtr) {
       *newLinePtr = '\0';
     }
-    //Match for via header pattern
-    pcreExecCode = pcre_exec(compiledReg, extraReg, viaHeader, (int)sizeof(viaHeader), 0, 0, subStringVector, SUBSTRING_VECTOR_COUNT);
+    // Match for via header pattern
+    pcreExecCode =
+      pcre_exec(compiledReg, extraReg, viaHeader, (int)sizeof(viaHeader), 0, 0, subStringVector, SUBSTRING_VECTOR_COUNT);
 
-    //Match failed, don't worry. Continue to next line.
-    if (pcreExecCode < 0) continue;
+    // Match failed, don't worry. Continue to next line.
+    if (pcreExecCode < 0)
+      continue;
 
-    //Match successful, but too many substrings
+    // Match successful, but too many substrings
     if (pcreExecCode == 0) {
-      pcreExecCode = SUBSTRING_VECTOR_COUNT/3;
+      pcreExecCode = SUBSTRING_VECTOR_COUNT / 3;
       printf("Too many substrings were found. %d substrings couldn't fit into subStringVector\n", pcreExecCode - 1);
     }
 
-    //Loop based on number of matches found
+    // Loop based on number of matches found
     for (i = 1; i < pcreExecCode; i++) {
-      //Point to beginning of matched substring
-      char *subStringBegin = viaHeader + subStringVector[2*i];
-      //Get length of matched substring
-      int subStringLen = subStringVector[2*i+1] - subStringVector[2*i];
+      // Point to beginning of matched substring
+      char *subStringBegin = viaHeader + subStringVector[2 * i];
+      // Get length of matched substring
+      int subStringLen = subStringVector[2 * i + 1] - subStringVector[2 * i];
       viaHeaderString = subStringBegin;
       sprintf(viaHeaderString, "%.*s", subStringLen, subStringBegin);
-      //Decode matched substring
+      // Decode matched substring
       decodeViaHeader(viaHeaderString);
     }
   }
@@ -327,8 +329,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
 
   /* see 'ink_args.h' for meanings of the various fields */
   ArgumentDescription argument_descriptions[] = {
-    VERSION_ARGUMENT_DESCRIPTION(),
-    HELP_ARGUMENT_DESCRIPTION(),
+    VERSION_ARGUMENT_DESCRIPTION(), HELP_ARGUMENT_DESCRIPTION(),
   };
 
   process_args(&appVersionInfo, argument_descriptions, countof(argument_descriptions), argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_wccp/wccp_client.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_wccp/wccp_client.cc b/cmd/traffic_wccp/wccp_client.cc
index 4e28032..7d08fcb 100644
--- a/cmd/traffic_wccp/wccp_client.cc
+++ b/cmd/traffic_wccp/wccp_client.cc
@@ -47,28 +47,26 @@
 bool do_debug = false;
 bool do_daemon = false;
 
-static char const USAGE_TEXT[] =
-  "%s\n"
-  "--address IP address to bind.\n"
-  "--router Booststrap IP address for routers.\n"
-  "--service Path to service group definitions.\n"
-  "--debug Print debugging information.\n"
-  "--daemon Run as daemon.\n"
-  "--help Print usage and exit.\n"
-  ;
+static char const USAGE_TEXT[] = "%s\n"
+                                 "--address IP address to bind.\n"
+                                 "--router Booststrap IP address for routers.\n"
+                                 "--service Path to service group definitions.\n"
+                                 "--debug Print debugging information.\n"
+                                 "--daemon Run as daemon.\n"
+                                 "--help Print usage and exit.\n";
 
 static void
-PrintErrata(ts::Errata const& err) 
+PrintErrata(ts::Errata const &err)
 {
   size_t n;
   static size_t const SIZE = 4096;
   char buff[SIZE];
   if (err.size()) {
     ts::Errata::Code code = err.top().getCode();
-    if (do_debug || code >=  wccp::LVL_WARN) {
+    if (do_debug || code >= wccp::LVL_WARN) {
       n = err.write(buff, SIZE, 1, 0, 2, "> ");
       // strip trailing newlines.
-      while (n && (buff[n-1] == '\n' || buff[n-1] == '\r'))
+      while (n && (buff[n - 1] == '\n' || buff[n - 1] == '\r'))
         buff[--n] = 0;
       printf("%s\n", buff);
     }
@@ -76,7 +74,7 @@ PrintErrata(ts::Errata const& err)
 }
 
 static void
-Init_Errata_Logging() 
+Init_Errata_Logging()
 {
   ts::Errata::registerSink(&PrintErrata);
 }
@@ -112,35 +110,36 @@ check_lockfile()
 }
 
 int
-main(int argc, char** argv) {
+main(int argc, char **argv)
+{
   wccp::Cache wcp;
 
   // getopt return values. Selected to avoid collisions with
   // short arguments.
   static int const OPT_ADDRESS = 257; ///< Bind to IP address option.
-  static int const OPT_HELP = 258; ///< Print help message.
-  static int const OPT_ROUTER = 259; ///< Seeded router IP address.
+  static int const OPT_HELP = 258;    ///< Print help message.
+  static int const OPT_ROUTER = 259;  ///< Seeded router IP address.
   static int const OPT_SERVICE = 260; ///< Service group definition.
-  static int const OPT_DEBUG = 261; ///< Enable debug printing
-  static int const OPT_DAEMON = 262; ///< Disconnect and run as daemon
+  static int const OPT_DEBUG = 261;   ///< Enable debug printing
+  static int const OPT_DAEMON = 262;  ///< Disconnect and run as daemon
 
   static option OPTIONS[] = {
-    { "address", 1, 0, OPT_ADDRESS },
-    { "router", 1, 0, OPT_ROUTER },
-    { "service", 1, 0, OPT_SERVICE },
-    { "debug", 0, 0, OPT_DEBUG },
-    { "daemon", 0, 0, OPT_DAEMON },
-    { "help", 0, 0, OPT_HELP },
-    { 0, 0, 0, 0 } // required terminator.
+    {"address", 1, 0, OPT_ADDRESS},
+    {"router", 1, 0, OPT_ROUTER},
+    {"service", 1, 0, OPT_SERVICE},
+    {"debug", 0, 0, OPT_DEBUG},
+    {"daemon", 0, 0, OPT_DAEMON},
+    {"help", 0, 0, OPT_HELP},
+    {0, 0, 0, 0} // required terminator.
   };
 
-  in_addr ip_addr = { INADDR_ANY };
-  in_addr router_addr = { INADDR_ANY };
+  in_addr ip_addr = {INADDR_ANY};
+  in_addr router_addr = {INADDR_ANY};
 
   int zret; // getopt return.
   int zidx; // option index.
   bool fail = false;
-  char const* FAIL_MSG = "";
+  char const *FAIL_MSG = "";
 
   while (-1 != (zret = getopt_long_only(argc, argv, "", OPTIONS, &zidx))) {
     switch (zret) {
@@ -166,13 +165,14 @@ main(int argc, char** argv) {
       break;
     case OPT_SERVICE: {
       ts::Errata status = wcp.loadServicesFromFile(optarg);
-      if (!status) fail = true;
+      if (!status)
+        fail = true;
       break;
     }
-    case OPT_DEBUG: 
+    case OPT_DEBUG:
       do_debug = true;
       break;
-    case OPT_DAEMON: 
+    case OPT_DAEMON:
       do_daemon = true;
       break;
     }
@@ -182,7 +182,7 @@ main(int argc, char** argv) {
     printf(USAGE_TEXT, FAIL_MSG);
     return 1;
   }
- 
+
   if (0 > wcp.open(ip_addr.s_addr)) {
     fprintf(stderr, "Failed to open or bind socket.\n");
     return 2;
@@ -211,7 +211,7 @@ main(int argc, char** argv) {
   wcp.housekeeping();
 
   while (true) {
-    int n = poll(pfa, POLL_FD_COUNT,  1000);
+    int n = poll(pfa, POLL_FD_COUNT, 1000);
     if (n < 0) { // error
       perror("General polling failure");
       return 5;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/add-header/add-header.c
----------------------------------------------------------------------
diff --git a/example/add-header/add-header.c b/example/add-header/add-header.c
index 7bd1e15..7583028 100644
--- a/example/add-header/add-header.c
+++ b/example/add-header/add-header.c
@@ -65,7 +65,6 @@ add_header(TSHttpTxn txnp, TSCont contp ATS_UNUSED)
 
   /* Loop on our header containing fields to add */
   while (field_loc) {
-
     /* First create a new field in the client request header */
     if (TSMimeHdrFieldCreate(req_bufp, req_loc, &new_field_loc) != TS_SUCCESS) {
       TSError("[add_header] Error while creating new field");
@@ -108,7 +107,7 @@ done:
 static int
 add_header_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_REQUEST_HDR:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/append-transform/append-transform.c
----------------------------------------------------------------------
diff --git a/example/append-transform/append-transform.c b/example/append-transform/append-transform.c
index 77ba97f..7ff3848 100644
--- a/example/append-transform/append-transform.c
+++ b/example/append-transform/append-transform.c
@@ -43,10 +43,9 @@
 #include "ts/ts.h"
 #include "ink_defs.h"
 
-#define ASSERT_SUCCESS(_x) TSAssert ((_x) == TS_SUCCESS)
+#define ASSERT_SUCCESS(_x) TSAssert((_x) == TS_SUCCESS)
 
-typedef struct
-{
+typedef struct {
   TSVIO output_vio;
   TSIOBuffer output_buffer;
   TSIOBufferReader output_reader;
@@ -62,7 +61,7 @@ my_data_alloc()
 {
   MyData *data;
 
-  data = (MyData *) TSmalloc(sizeof(MyData));
+  data = (MyData *)TSmalloc(sizeof(MyData));
   TSReleaseAssert(data);
 
   data->output_vio = NULL;
@@ -74,7 +73,7 @@ my_data_alloc()
 }
 
 static void
-my_data_destroy(MyData * data)
+my_data_destroy(MyData *data)
 {
   if (data) {
     if (data->output_buffer)
@@ -208,20 +207,18 @@ append_transform(TSCont contp, TSEvent event, void *edata ATS_UNUSED)
     return 0;
   } else {
     switch (event) {
-    case TS_EVENT_ERROR:
-      {
-        TSVIO write_vio;
-
-        /* Get the write VIO for the write operation that was
-           performed on ourself. This VIO contains the continuation of
-           our parent transformation. */
-        write_vio = TSVConnWriteVIOGet(contp);
-
-        /* Call back the write VIO continuation to let it know that we
-           have completed the write operation. */
-        TSContCall(TSVIOContGet(write_vio), TS_EVENT_ERROR, write_vio);
-      }
-      break;
+    case TS_EVENT_ERROR: {
+      TSVIO write_vio;
+
+      /* Get the write VIO for the write operation that was
+         performed on ourself. This VIO contains the continuation of
+         our parent transformation. */
+      write_vio = TSVConnWriteVIOGet(contp);
+
+      /* Call back the write VIO continuation to let it know that we
+         have completed the write operation. */
+      TSContCall(TSVIOContGet(write_vio), TS_EVENT_ERROR, write_vio);
+    } break;
     case TS_EVENT_VCONN_WRITE_COMPLETE:
       /* When our output connection says that it has finished
          reading all the data we've written to it then we should
@@ -259,7 +256,6 @@ transformable(TSHttpTxn txnp)
    */
 
   if (TS_HTTP_STATUS_OK == (resp_status = TSHttpHdrStatusGet(bufp, hdr_loc))) {
-
     /* We only want to do the transformation on documents that have a
        content type of "text/html". */
     field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, "Content-Type", 12);
@@ -281,7 +277,7 @@ transformable(TSHttpTxn txnp)
     }
   }
 
-  return 0;                     /* not a 200 */
+  return 0; /* not a 200 */
 }
 
 static void
@@ -296,7 +292,7 @@ transform_add(TSHttpTxn txnp)
 static int
 transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_RESPONSE_HDR:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/basic-auth/basic-auth.c
----------------------------------------------------------------------
diff --git a/example/basic-auth/basic-auth.c b/example/basic-auth/basic-auth.c
index 963b78e..7baceec 100644
--- a/example/basic-auth/basic-auth.c
+++ b/example/basic-auth/basic-auth.c
@@ -37,15 +37,16 @@ static char base64_codes[256];
 static char *
 base64_decode(const char *input)
 {
-#define decode(A) ((unsigned int) base64_codes[(int) input[A]])
+#define decode(A) ((unsigned int)base64_codes[(int)input[A]])
 
   char *output;
   char *obuf;
   int len;
 
-  for (len = 0; (input[len] != '\0') && (input[len] != '='); len++);
+  for (len = 0; (input[len] != '\0') && (input[len] != '='); len++)
+    ;
 
-  output = obuf = (char *) TSmalloc((len * 6) / 8 + 3);
+  output = obuf = (char *)TSmalloc((len * 6) / 8 + 3);
 
   while (len > 0) {
     *output++ = decode(0) << 2 | decode(1) >> 4;
@@ -174,13 +175,12 @@ handle_response(TSHttpTxn txnp)
   }
 
   TSHttpHdrStatusSet(bufp, hdr_loc, TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED);
-  TSHttpHdrReasonSet(bufp, hdr_loc,
-                      TSHttpHdrReasonLookup(TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED),
-                      strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED)));
+  TSHttpHdrReasonSet(bufp, hdr_loc, TSHttpHdrReasonLookup(TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED),
+                     strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED)));
 
   TSMimeHdrFieldCreate(bufp, hdr_loc, &field_loc); // Probably should check for errors
   TSMimeHdrFieldNameSet(bufp, hdr_loc, field_loc, TS_MIME_FIELD_PROXY_AUTHENTICATE, TS_MIME_LEN_PROXY_AUTHENTICATE);
-  TSMimeHdrFieldValueStringInsert(bufp, hdr_loc, field_loc, -1,  insert, len);
+  TSMimeHdrFieldValueStringInsert(bufp, hdr_loc, field_loc, -1, insert, len);
   TSMimeHdrFieldAppend(bufp, hdr_loc, field_loc);
 
   TSHandleMLocRelease(bufp, hdr_loc, field_loc);
@@ -193,7 +193,7 @@ done:
 static int
 auth_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_OS_DNS:
@@ -241,4 +241,3 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 
   TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, TSContCreate(auth_plugin, NULL));
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/blacklist-0/blacklist-0.c
----------------------------------------------------------------------
diff --git a/example/blacklist-0/blacklist-0.c b/example/blacklist-0/blacklist-0.c
index 9038b8f..c48e735 100644
--- a/example/blacklist-0/blacklist-0.c
+++ b/example/blacklist-0/blacklist-0.c
@@ -98,9 +98,8 @@ handle_response(TSHttpTxn txnp)
   }
 
   TSHttpHdrStatusSet(bufp, hdr_loc, TS_HTTP_STATUS_FORBIDDEN);
-  TSHttpHdrReasonSet(bufp, hdr_loc,
-                      TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN),
-                      strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN)));
+  TSHttpHdrReasonSet(bufp, hdr_loc, TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN),
+                     strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN)));
 
   if (TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
     TSError("couldn't retrieve client request header\n");
@@ -131,7 +130,7 @@ done:
 static int
 blacklist_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_OS_DNS:
@@ -158,12 +157,11 @@ TSPluginInit(int argc, const char *argv[])
 
   if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
     TSError("Plugin registration failed.\n");
-
   }
 
   nsites = argc - 1;
   if (nsites > 0) {
-    sites = (char **) TSmalloc(sizeof(char *) * nsites);
+    sites = (char **)TSmalloc(sizeof(char *) * nsites);
 
     for (i = 0; i < nsites; i++) {
       sites[i] = TSstrdup(argv[i + 1]);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/blacklist-1/blacklist-1.c
----------------------------------------------------------------------
diff --git a/example/blacklist-1/blacklist-1.c b/example/blacklist-1/blacklist-1.c
index c7b0797..322df1c 100644
--- a/example/blacklist-1/blacklist-1.c
+++ b/example/blacklist-1/blacklist-1.c
@@ -38,14 +38,11 @@ static TSCont global_contp;
 
 static void handle_txn_start(TSCont contp, TSHttpTxn txnp);
 
-typedef struct contp_data
-{
-
-  enum calling_func
-  {
+typedef struct contp_data {
+  enum calling_func {
     HANDLE_DNS,
     HANDLE_RESPONSE,
-    READ_BLACKLIST
+    READ_BLACKLIST,
   } cf;
 
   TSHttpTxn txnp;
@@ -57,7 +54,7 @@ destroy_continuation(TSHttpTxn txnp, TSCont contp)
 {
   cdata *cd = NULL;
 
-  cd = (cdata *) TSContDataGet(contp);
+  cd = (cdata *)TSContDataGet(contp);
   if (cd != NULL) {
     TSfree(cd);
   }
@@ -146,9 +143,8 @@ handle_response(TSHttpTxn txnp, TSCont contp ATS_UNUSED)
   }
 
   TSHttpHdrStatusSet(bufp, hdr_loc, TS_HTTP_STATUS_FORBIDDEN);
-  TSHttpHdrReasonSet(bufp, hdr_loc,
-                      TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN),
-                      strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN)));
+  TSHttpHdrReasonSet(bufp, hdr_loc, TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN),
+                     strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_FORBIDDEN)));
 
   if (TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
     TSError("couldn't retrieve client request header\n");
@@ -162,7 +158,7 @@ handle_response(TSHttpTxn txnp, TSCont contp ATS_UNUSED)
     goto done;
   }
 
-  buf = (char *) TSmalloc(4096);
+  buf = (char *)TSmalloc(4096);
 
   url_str = TSUrlStringGet(bufp, url_loc, &url_length);
   sprintf(buf, "You are forbidden from accessing \"%s\"\n", url_str);
@@ -223,7 +219,6 @@ read_blacklist(TSCont contp)
   }
 
   TSMutexUnlock(sites_mutex);
-
 }
 
 static int
@@ -234,12 +229,12 @@ blacklist_plugin(TSCont contp, TSEvent event, void *edata)
 
   switch (event) {
   case TS_EVENT_HTTP_TXN_START:
-    txnp = (TSHttpTxn) edata;
+    txnp = (TSHttpTxn)edata;
     handle_txn_start(contp, txnp);
     return 0;
   case TS_EVENT_HTTP_OS_DNS:
     if (contp != global_contp) {
-      cd = (cdata *) TSContDataGet(contp);
+      cd = (cdata *)TSContDataGet(contp);
       cd->cf = HANDLE_DNS;
       handle_dns(cd->txnp, contp);
       return 0;
@@ -247,14 +242,14 @@ blacklist_plugin(TSCont contp, TSEvent event, void *edata)
       break;
     }
   case TS_EVENT_HTTP_TXN_CLOSE:
-    txnp = (TSHttpTxn) edata;
+    txnp = (TSHttpTxn)edata;
     if (contp != global_contp) {
       destroy_continuation(txnp, contp);
     }
     break;
   case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
     if (contp != global_contp) {
-      cd = (cdata *) TSContDataGet(contp);
+      cd = (cdata *)TSContDataGet(contp);
       cd->cf = HANDLE_RESPONSE;
       handle_response(cd->txnp, contp);
       return 0;
@@ -267,7 +262,7 @@ blacklist_plugin(TSCont contp, TSEvent event, void *edata)
        edata. We need to decide, in which function did the MutexLock
        failed and call that function again */
     if (contp != global_contp) {
-      cd = (cdata *) TSContDataGet(contp);
+      cd = (cdata *)TSContDataGet(contp);
       switch (cd->cf) {
       case HANDLE_DNS:
         handle_dns(cd->txnp, contp);
@@ -276,7 +271,7 @@ blacklist_plugin(TSCont contp, TSEvent event, void *edata)
         handle_response(cd->txnp, contp);
         return 0;
       default:
-	TSDebug("blacklist_plugin", "This event was unexpected: %d\n", event);
+        TSDebug("blacklist_plugin", "This event was unexpected: %d\n", event);
         break;
       }
     } else {
@@ -295,9 +290,9 @@ handle_txn_start(TSCont contp ATS_UNUSED, TSHttpTxn txnp)
   TSCont txn_contp;
   cdata *cd;
 
-  txn_contp = TSContCreate((TSEventFunc) blacklist_plugin, TSMutexCreate());
+  txn_contp = TSContCreate((TSEventFunc)blacklist_plugin, TSMutexCreate());
   /* create the data that'll be associated with the continuation */
-  cd = (cdata *) TSmalloc(sizeof(cdata));
+  cd = (cdata *)TSmalloc(sizeof(cdata));
   TSContDataSet(txn_contp, cd);
 
   cd->txnp = txnp;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/bnull-transform/bnull-transform.c
----------------------------------------------------------------------
diff --git a/example/bnull-transform/bnull-transform.c b/example/bnull-transform/bnull-transform.c
index 03acb26..40f4ae6 100644
--- a/example/bnull-transform/bnull-transform.c
+++ b/example/bnull-transform/bnull-transform.c
@@ -39,12 +39,11 @@
 #include "ts/ts.h"
 #include "ink_defs.h"
 
-#define TS_NULL_MUTEX      NULL
-#define STATE_BUFFER_DATA   0
-#define STATE_OUTPUT_DATA   1
+#define TS_NULL_MUTEX NULL
+#define STATE_BUFFER_DATA 0
+#define STATE_OUTPUT_DATA 1
 
-typedef struct
-{
+typedef struct {
   int state;
   TSVIO output_vio;
   TSIOBuffer output_buffer;
@@ -56,7 +55,7 @@ my_data_alloc()
 {
   MyData *data;
 
-  data = (MyData *) TSmalloc(sizeof(MyData));
+  data = (MyData *)TSmalloc(sizeof(MyData));
   data->state = STATE_BUFFER_DATA;
   data->output_vio = NULL;
   data->output_buffer = NULL;
@@ -66,7 +65,7 @@ my_data_alloc()
 }
 
 static void
-my_data_destroy(MyData * data)
+my_data_destroy(MyData *data)
 {
   if (data) {
     if (data->output_buffer) {
@@ -77,7 +76,7 @@ my_data_destroy(MyData * data)
 }
 
 static int
-handle_buffering(TSCont contp, MyData * data)
+handle_buffering(TSCont contp, MyData *data)
 {
   TSVIO write_vio;
   int towrite;
@@ -160,7 +159,7 @@ handle_buffering(TSCont contp, MyData * data)
 }
 
 static int
-handle_output(TSCont contp, MyData * data)
+handle_output(TSCont contp, MyData *data)
 {
   /* Check to see if we need to initiate the output operation. */
   if (!data->output_vio) {
@@ -169,8 +168,7 @@ handle_output(TSCont contp, MyData * data)
     /* Get the output connection where we'll write data to. */
     output_conn = TSTransformOutputVConnGet(contp);
 
-    data->output_vio =
-      TSVConnWrite(output_conn, contp, data->output_reader, TSIOBufferReaderAvail(data->output_reader));
+    data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, TSIOBufferReaderAvail(data->output_reader));
 
     TSAssert(data->output_vio);
   }
@@ -220,19 +218,19 @@ bnull_transform(TSCont contp, TSEvent event, void *edata ATS_UNUSED)
     TSContDestroy(contp);
   } else {
     switch (event) {
-    case TS_EVENT_ERROR:{
-        TSVIO write_vio;
+    case TS_EVENT_ERROR: {
+      TSVIO write_vio;
 
-        /* Get the write VIO for the write operation that was
-           performed on ourself. This VIO contains the continuation of
-           our parent transformation. */
-        write_vio = TSVConnWriteVIOGet(contp);
+      /* Get the write VIO for the write operation that was
+         performed on ourself. This VIO contains the continuation of
+         our parent transformation. */
+      write_vio = TSVConnWriteVIOGet(contp);
 
-        /* Call back the write VIO continuation to let it know that we
-           have completed the write operation. */
-        TSContCall(TSVIOContGet(write_vio), TS_EVENT_ERROR, write_vio);
-        break;
-      }
+      /* Call back the write VIO continuation to let it know that we
+         have completed the write operation. */
+      TSContCall(TSVIOContGet(write_vio), TS_EVENT_ERROR, write_vio);
+      break;
+    }
 
     case TS_EVENT_VCONN_WRITE_COMPLETE:
       /* When our output connection says that it has finished
@@ -271,7 +269,8 @@ transformable(TSHttpTxn txnp)
   retv = (resp_status == TS_HTTP_STATUS_OK);
 
   if (TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc) == TS_ERROR) {
-    TSError("[bnull-transform] Error releasing MLOC while checking " "header status\n");
+    TSError("[bnull-transform] Error releasing MLOC while checking "
+            "header status\n");
   }
 
   return retv;
@@ -290,7 +289,7 @@ transform_add(TSHttpTxn txnp)
 static int
 transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_RESPONSE_HDR:


[44/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CachePages.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CachePages.cc b/iocore/cache/CachePages.cc
index 5aa8bc5..13f2b2a 100644
--- a/iocore/cache/CachePages.cc
+++ b/iocore/cache/CachePages.cc
@@ -28,11 +28,11 @@
 #include "I_Tasks.h"
 #include "CacheControl.h"
 
-struct ShowCache: public ShowCont {
+struct ShowCache : public ShowCont {
   enum scan_type {
     scan_type_lookup,
     scan_type_delete,
-    scan_type_invalidate
+    scan_type_invalidate,
   };
 
   int vol_index;
@@ -65,9 +65,9 @@ struct ShowCache: public ShowCont {
   int handleCacheDeleteComplete(int event, Event *e);
   int handleCacheScanCallback(int event, Event *e);
 
-  ShowCache(Continuation *c, HTTPHdr *h):
-    ShowCont(c, h), vol_index(0), seg_index(0), scan_flag(scan_type_lookup),
-    cache_vc(0), buffer(0), buffer_reader(0), content_length(0), cvio(0)
+  ShowCache(Continuation *c, HTTPHdr *h)
+    : ShowCont(c, h), vol_index(0), seg_index(0), scan_flag(scan_type_lookup), cache_vc(0), buffer(0), buffer_reader(0),
+      content_length(0), cvio(0)
   {
     urlstrs_index = 0;
     linecount = 0;
@@ -93,7 +93,7 @@ struct ShowCache: public ShowCont {
       unsigned l, m;
       for (l = 0, m = 0; l < (unsigned)query_len; l++) {
         if (query[l] != '\015') {
-            query[m++] = query[l];
+          query[m++] = query[l];
         }
       }
       query[m] = '\0';
@@ -104,7 +104,7 @@ struct ShowCache: public ShowCont {
       if (p) {
         while ((p = strstr(p, "\n"))) {
           nstrings++;
-          if ((size_t) (p - query) >= strlen(query) - 1)
+          if ((size_t)(p - query) >= strlen(query) - 1)
             break;
           else
             p++;
@@ -112,22 +112,22 @@ struct ShowCache: public ShowCont {
       }
       // initialize url array
       show_cache_urlstrs = new char[nstrings + 1][500];
-      memset(show_cache_urlstrs, '\0', (nstrings + 1) * 500 * sizeof (char));
+      memset(show_cache_urlstrs, '\0', (nstrings + 1) * 500 * sizeof(char));
 
       char *q, *t;
       p = strstr(unescapedQuery, "url=");
       if (p) {
-        p += 4;                 // 4 ==> strlen("url=")
+        p += 4; // 4 ==> strlen("url=")
         t = strchr(p, '&');
         if (!t)
-          t = (char *) unescapedQuery + strlen(unescapedQuery);
+          t = (char *)unescapedQuery + strlen(unescapedQuery);
         for (int s = 0; p < t; s++) {
           show_cache_urlstrs[s][0] = '\0';
-          q = strstr(p, "%0D%0A" /* \r\n */);      // we used this in the JS to separate urls
+          q = strstr(p, "%0D%0A" /* \r\n */); // we used this in the JS to separate urls
           if (!q)
             q = t;
           ink_strlcpy(show_cache_urlstrs[s], p, sizeof(show_cache_urlstrs[s]));
-          p = q + 6;            // +6 ==> strlen(%0D%0A)
+          p = q + 6; // +6 ==> strlen(%0D%0A)
         }
       }
 
@@ -141,27 +141,27 @@ struct ShowCache: public ShowCont {
         unescapifyStr(show_cache_urlstrs[i]);
         Debug("cache_inspector", "URL %d: '%s'", i + 1, show_cache_urlstrs[i]);
       }
-
     }
 
     SET_HANDLER(&ShowCache::showMain);
   }
 
-  ~ShowCache() {
+  ~ShowCache()
+  {
     if (show_cache_urlstrs)
-      delete[]show_cache_urlstrs;
+      delete[] show_cache_urlstrs;
     url.destroy();
   }
-
 };
 
-#define STREQ_PREFIX(_x,_s) (!strncasecmp(_x,_s,sizeof(_s)-1))
-#define STREQ_LEN_PREFIX(_x,_l,_s) (path_len < sizeof(_s) && !strncasecmp(_x,_s,sizeof(_s)-1))
+#define STREQ_PREFIX(_x, _s) (!strncasecmp(_x, _s, sizeof(_s) - 1))
+#define STREQ_LEN_PREFIX(_x, _l, _s) (path_len < sizeof(_s) && !strncasecmp(_x, _s, sizeof(_s) - 1))
 
 
 Action *
-register_ShowCache(Continuation *c, HTTPHdr *h) {
-  ShowCache * theshowcache = new ShowCache(c, h);
+register_ShowCache(Continuation *c, HTTPHdr *h)
+{
+  ShowCache *theshowcache = new ShowCache(c, h);
   URL *u = h->url_get();
   int path_len;
   const char *path = u->path_get(&path_len);
@@ -201,7 +201,8 @@ register_ShowCache(Continuation *c, HTTPHdr *h) {
 }
 
 int
-ShowCache::showMain(int event, Event *e) {
+ShowCache::showMain(int event, Event *e)
+{
   CHECK_SHOW(begin("Cache"));
   CHECK_SHOW(show("<H3><A HREF=\"./lookup_url_form\">Lookup url</A></H3>\n"
                   "<H3><A HREF=\"./delete_url_form\">Delete url</A></H3>\n"
@@ -218,19 +219,24 @@ ShowCache::lookup_url_form(int event, Event *e)
   CHECK_SHOW(show("<FORM METHOD=\"GET\" ACTION=\"./lookup_url\">\n"
                   "<H3>Lookup</H3>\n"
                   "<INPUT TYPE=\"TEXT\" NAME=\"url\" value=\"http://\">\n"
-                  "<INPUT TYPE=\"SUBMIT\" value=\"Lookup\">\n" "</FORM>\n\n"));
+                  "<INPUT TYPE=\"SUBMIT\" value=\"Lookup\">\n"
+                  "</FORM>\n\n"));
   return complete(event, e);
 }
 
 int
-ShowCache::delete_url_form(int event, Event *e) {
+ShowCache::delete_url_form(int event, Event *e)
+{
   CHECK_SHOW(begin("Cache Delete"));
   CHECK_SHOW(show("<FORM METHOD=\"GET\" ACTION=\"./delete_url\">\n"
                   "<P><B>Type the list urls that you want to delete\n"
                   "in the box below. The urls MUST be separated by\n"
                   "new lines</B></P>\n\n"
                   "<TEXTAREA NAME=\"url\" rows=10 cols=50>"
-                  "http://" "</TEXTAREA>\n" "<INPUT TYPE=\"SUBMIT\" value=\"Delete\">\n" "</FORM>\n\n"));
+                  "http://"
+                  "</TEXTAREA>\n"
+                  "<INPUT TYPE=\"SUBMIT\" value=\"Delete\">\n"
+                  "</FORM>\n\n"));
   return complete(event, e);
 }
 
@@ -243,171 +249,187 @@ ShowCache::lookup_regex_form(int event, Event *e)
                   "in the box below. The regular expressions MUST be separated by\n"
                   "new lines</B></P>\n\n"
                   "<TEXTAREA NAME=\"url\" rows=10 cols=50>"
-                  "http://" "</TEXTAREA>\n" "<INPUT TYPE=\"SUBMIT\" value=\"Lookup\">\n" "</FORM>\n\n"));
+                  "http://"
+                  "</TEXTAREA>\n"
+                  "<INPUT TYPE=\"SUBMIT\" value=\"Lookup\">\n"
+                  "</FORM>\n\n"));
   return complete(event, e);
 }
 
 int
-ShowCache::delete_regex_form(int event, Event *e) {
+ShowCache::delete_regex_form(int event, Event *e)
+{
   CHECK_SHOW(begin("Cache Regex delete"));
   CHECK_SHOW(show("<FORM METHOD=\"GET\" ACTION=\"./delete_regex\">\n"
                   "<P><B>Type the list of regular expressions that you want to delete\n"
                   "in the box below. The regular expressions MUST be separated by\n"
                   "new lines</B></P>\n\n"
                   "<TEXTAREA NAME=\"url\" rows=10 cols=50>"
-                  "http://" "</TEXTAREA>\n" "<INPUT TYPE=\"SUBMIT\" value=\"Delete\">\n" "</FORM>\n\n"));
+                  "http://"
+                  "</TEXTAREA>\n"
+                  "<INPUT TYPE=\"SUBMIT\" value=\"Delete\">\n"
+                  "</FORM>\n\n"));
   return complete(event, e);
 }
 
 int
-ShowCache::invalidate_regex_form(int event, Event *e) {
+ShowCache::invalidate_regex_form(int event, Event *e)
+{
   CHECK_SHOW(begin("Cache Regex Invalidate"));
   CHECK_SHOW(show("<FORM METHOD=\"GET\" ACTION=\"./invalidate_regex\">\n"
                   "<P><B>Type the list of regular expressions that you want to invalidate\n"
                   "in the box below. The regular expressions MUST be separated by\n"
                   "new lines</B></P>\n\n"
                   "<TEXTAREA NAME=\"url\" rows=10 cols=50>"
-                  "http://" "</TEXTAREA>\n" "<INPUT TYPE=\"SUBMIT\" value=\"Invalidate\">\n" "</FORM>\n"));
+                  "http://"
+                  "</TEXTAREA>\n"
+                  "<INPUT TYPE=\"SUBMIT\" value=\"Invalidate\">\n"
+                  "</FORM>\n"));
   return complete(event, e);
 }
 
 
 int
-ShowCache::handleCacheEvent(int event, Event *e) {
+ShowCache::handleCacheEvent(int event, Event *e)
+{
   // we use VC_EVENT_xxx to finish the cluster read in cluster mode
   switch (event) {
-    case VC_EVENT_EOS:
-    case VC_EVENT_READ_COMPLETE: {
-      // cluster read done, we just print hit in cluster
+  case VC_EVENT_EOS:
+  case VC_EVENT_READ_COMPLETE: {
+    // cluster read done, we just print hit in cluster
+    CHECK_SHOW(show("<P><TABLE border=1 width=100%%>"));
+    CHECK_SHOW(show("<TR><TH bgcolor=\"#FFF0E0\" colspan=2>Doc Hit from Cluster</TH></TR>\n"));
+    CHECK_SHOW(show("<tr><td>Size</td><td>%" PRId64 "</td>\n", content_length));
+
+    // delete button
+    CHECK_SHOW(show("<tr><td>Action</td>\n"
+                    "<td><FORM action=\"./delete_url\" method=get>\n"
+                    "<Input type=HIDDEN name=url value=\"%s\">\n"
+                    "<input type=submit value=\"Delete URL\">\n"
+                    "</FORM></td></tr>\n",
+                    show_cache_urlstrs[0]));
+    CHECK_SHOW(show("</TABLE></P>"));
+
+    if (buffer_reader) {
+      buffer->dealloc_reader(buffer_reader);
+      buffer_reader = 0;
+    }
+    if (buffer) {
+      free_MIOBuffer(buffer);
+      buffer = 0;
+    }
+    cvio = 0;
+    cache_vc->do_io_close(-1);
+    cache_vc = 0;
+    return complete(event, e);
+  }
+  case CACHE_EVENT_OPEN_READ: {
+    // get the vector
+    cache_vc = (CacheVC *)e;
+    CacheHTTPInfoVector *vec = &(cache_vc->vector);
+    int alt_count = vec->count();
+    if (alt_count) {
+      Doc *d = (Doc *)(cache_vc->first_buf->data());
+      time_t t;
+      char tmpstr[4096];
+
+      // print the Doc
       CHECK_SHOW(show("<P><TABLE border=1 width=100%%>"));
-      CHECK_SHOW(show("<TR><TH bgcolor=\"#FFF0E0\" colspan=2>Doc Hit from Cluster</TH></TR>\n"));
-      CHECK_SHOW(show("<tr><td>Size</td><td>%" PRId64 "</td>\n", content_length));
+      CHECK_SHOW(show("<TR><TH bgcolor=\"#FFF0E0\" colspan=2>Doc</TH></TR>\n"));
+      CHECK_SHOW(
+        show("<TR><TD>Volume</td> <td>#%d - store='%s'</td></tr>\n", cache_vc->vol->cache_vol->vol_number, cache_vc->vol->path));
+      CHECK_SHOW(show("<TR><TD>first key</td> <td>%s</td></tr>\n", d->first_key.toHexStr(tmpstr)));
+      CHECK_SHOW(show("<TR><TD>key</td> <td>%s</td></tr>\n", d->key.toHexStr(tmpstr)));
+      CHECK_SHOW(show("<tr><td>sync_serial</td><td>%lu</tr>\n", d->sync_serial));
+      CHECK_SHOW(show("<tr><td>write_serial</td><td>%lu</tr>\n", d->write_serial));
+      CHECK_SHOW(show("<tr><td>header length</td><td>%lu</tr>\n", d->hlen));
+      CHECK_SHOW(show("<tr><td>fragment type</td><td>%lu</tr>\n", d->doc_type));
+      CHECK_SHOW(show("<tr><td>No of Alternates</td><td>%d</td></tr>\n", alt_count));
 
-      // delete button
       CHECK_SHOW(show("<tr><td>Action</td>\n"
                       "<td><FORM action=\"./delete_url\" method=get>\n"
                       "<Input type=HIDDEN name=url value=\"%s\">\n"
-                      "<input type=submit value=\"Delete URL\">\n" "</FORM></td></tr>\n",
+                      "<input type=submit value=\"Delete URL\">\n"
+                      "</FORM></td></tr>\n",
                       show_cache_urlstrs[0]));
       CHECK_SHOW(show("</TABLE></P>"));
 
-      if (buffer_reader) {
-        buffer->dealloc_reader(buffer_reader);
-        buffer_reader = 0;
-      }
-      if (buffer) {
-        free_MIOBuffer(buffer);
-        buffer = 0;
+      for (int i = 0; i < alt_count; i++) {
+        // unmarshal the alternate??
+        CHECK_SHOW(show("<p><table border=1>\n"));
+        CHECK_SHOW(show("<tr><th bgcolor=\"#FFF0E0\" colspan=2>Alternate %d</th></tr>\n", i + 1));
+        CacheHTTPInfo *obj = vec->get(i);
+        CacheKey obj_key = obj->object_key_get();
+        HTTPHdr *cached_request = obj->request_get();
+        HTTPHdr *cached_response = obj->response_get();
+        int64_t obj_size = obj->object_size_get();
+        int offset, tmp, used, done;
+        char b[4096];
+
+        // print request header
+        CHECK_SHOW(show("<tr><td>Request Header</td><td><PRE>"));
+        offset = 0;
+        do {
+          used = 0;
+          tmp = offset;
+          done = cached_request->print(b, 4095, &used, &tmp);
+          offset += used;
+          b[used] = '\0';
+          CHECK_SHOW(show("%s", b));
+        } while (!done);
+        CHECK_SHOW(show("</PRE></td><tr>\n"));
+
+        // print response header
+        CHECK_SHOW(show("<tr><td>Response Header</td><td><PRE>"));
+        offset = 0;
+        do {
+          used = 0;
+          tmp = offset;
+          done = cached_response->print(b, 4095, &used, &tmp);
+          offset += used;
+          b[used] = '\0';
+          CHECK_SHOW(show("%s", b));
+        } while (!done);
+        CHECK_SHOW(show("</PRE></td></tr>\n"));
+        CHECK_SHOW(show("<tr><td>Size</td><td>%" PRId64 "</td>\n", obj_size));
+        CHECK_SHOW(show("<tr><td>Key</td><td>%s</td>\n", obj_key.toHexStr(tmpstr)));
+        t = obj->request_sent_time_get();
+        ink_ctime_r(&t, tmpstr);
+        CHECK_SHOW(show("<tr><td>Request sent time</td><td>%s</td></tr>\n", tmpstr));
+        t = obj->response_received_time_get();
+        ink_ctime_r(&t, tmpstr);
+
+        CHECK_SHOW(show("<tr><td>Response received time</td><td>%s</td></tr>\n", tmpstr));
+        CHECK_SHOW(show("</TABLE></P>"));
       }
-      cvio = 0;
+
       cache_vc->do_io_close(-1);
-      cache_vc = 0;
       return complete(event, e);
     }
-    case CACHE_EVENT_OPEN_READ: {
-      // get the vector
-      cache_vc = (CacheVC *) e;
-      CacheHTTPInfoVector *vec = &(cache_vc->vector);
-      int alt_count = vec->count();
-      if (alt_count) {
-        Doc *d = (Doc *) (cache_vc->first_buf->data());
-        time_t t;
-        char tmpstr[4096];
-
-        // print the Doc
-        CHECK_SHOW(show("<P><TABLE border=1 width=100%%>"));
-        CHECK_SHOW(show("<TR><TH bgcolor=\"#FFF0E0\" colspan=2>Doc</TH></TR>\n"));
-        CHECK_SHOW(show("<TR><TD>Volume</td> <td>#%d - store='%s'</td></tr>\n", cache_vc->vol->cache_vol->vol_number, cache_vc->vol->path));
-        CHECK_SHOW(show("<TR><TD>first key</td> <td>%s</td></tr>\n", d->first_key.toHexStr(tmpstr)));
-        CHECK_SHOW(show("<TR><TD>key</td> <td>%s</td></tr>\n", d->key.toHexStr(tmpstr)));
-        CHECK_SHOW(show("<tr><td>sync_serial</td><td>%lu</tr>\n", d->sync_serial));
-        CHECK_SHOW(show("<tr><td>write_serial</td><td>%lu</tr>\n", d->write_serial));
-        CHECK_SHOW(show("<tr><td>header length</td><td>%lu</tr>\n", d->hlen));
-        CHECK_SHOW(show("<tr><td>fragment type</td><td>%lu</tr>\n", d->doc_type));
-        CHECK_SHOW(show("<tr><td>No of Alternates</td><td>%d</td></tr>\n", alt_count));
-
-        CHECK_SHOW(show("<tr><td>Action</td>\n"
-                        "<td><FORM action=\"./delete_url\" method=get>\n"
-                        "<Input type=HIDDEN name=url value=\"%s\">\n"
-                        "<input type=submit value=\"Delete URL\">\n" "</FORM></td></tr>\n",
-                        show_cache_urlstrs[0]));
-        CHECK_SHOW(show("</TABLE></P>"));
-
-        for (int i = 0; i < alt_count; i++) {
-          // unmarshal the alternate??
-          CHECK_SHOW(show("<p><table border=1>\n"));
-          CHECK_SHOW(show("<tr><th bgcolor=\"#FFF0E0\" colspan=2>Alternate %d</th></tr>\n", i + 1));
-          CacheHTTPInfo *obj = vec->get(i);
-          CacheKey obj_key = obj->object_key_get();
-          HTTPHdr *cached_request = obj->request_get();
-          HTTPHdr *cached_response = obj->response_get();
-          int64_t obj_size = obj->object_size_get();
-          int offset, tmp, used, done;
-          char b[4096];
-
-          // print request header
-          CHECK_SHOW(show("<tr><td>Request Header</td><td><PRE>"));
-          offset = 0;
-          do {
-            used = 0;
-            tmp = offset;
-            done = cached_request->print(b, 4095, &used, &tmp);
-            offset += used;
-            b[used] = '\0';
-            CHECK_SHOW(show("%s", b));
-          } while (!done);
-          CHECK_SHOW(show("</PRE></td><tr>\n"));
-
-          // print response header
-          CHECK_SHOW(show("<tr><td>Response Header</td><td><PRE>"));
-          offset = 0;
-          do {
-            used = 0;
-            tmp = offset;
-            done = cached_response->print(b, 4095, &used, &tmp);
-            offset += used;
-            b[used] = '\0';
-            CHECK_SHOW(show("%s", b));
-          } while (!done);
-          CHECK_SHOW(show("</PRE></td></tr>\n"));
-          CHECK_SHOW(show("<tr><td>Size</td><td>%" PRId64 "</td>\n", obj_size));
-          CHECK_SHOW(show("<tr><td>Key</td><td>%s</td>\n", obj_key.toHexStr(tmpstr)));
-          t = obj->request_sent_time_get();
-          ink_ctime_r(&t, tmpstr);
-          CHECK_SHOW(show("<tr><td>Request sent time</td><td>%s</td></tr>\n", tmpstr));
-          t = obj->response_received_time_get();
-          ink_ctime_r(&t, tmpstr);
-
-          CHECK_SHOW(show("<tr><td>Response received time</td><td>%s</td></tr>\n", tmpstr));
-          CHECK_SHOW(show("</TABLE></P>"));
-        }
-
-        cache_vc->do_io_close(-1);
-        return complete(event, e);
-      }
-      // open success but no vector, that is the Cluster open read, pass through
-    }
-    case VC_EVENT_READ_READY:
-      if (!cvio) {
-        buffer = new_empty_MIOBuffer();
-        buffer_reader = buffer->alloc_reader();
-        content_length = cache_vc->get_object_size();
-        cvio = cache_vc->do_io_read(this, content_length, buffer);
-      } else
-        buffer_reader->consume(buffer_reader->read_avail());
-      return EVENT_DONE;
-    case CACHE_EVENT_OPEN_READ_FAILED:
-      // something strange happen, or cache miss in cluster mode.
-      CHECK_SHOW(show("<H3>Cache Lookup Failed, or missing in cluster</H3>\n"));
-      return complete(event, e);
-    default:
-      CHECK_SHOW(show("<H3>Cache Miss</H3>\n"));
-      return complete(event, e);
+    // open success but no vector, that is the Cluster open read, pass through
+  }
+  case VC_EVENT_READ_READY:
+    if (!cvio) {
+      buffer = new_empty_MIOBuffer();
+      buffer_reader = buffer->alloc_reader();
+      content_length = cache_vc->get_object_size();
+      cvio = cache_vc->do_io_read(this, content_length, buffer);
+    } else
+      buffer_reader->consume(buffer_reader->read_avail());
+    return EVENT_DONE;
+  case CACHE_EVENT_OPEN_READ_FAILED:
+    // something strange happen, or cache miss in cluster mode.
+    CHECK_SHOW(show("<H3>Cache Lookup Failed, or missing in cluster</H3>\n"));
+    return complete(event, e);
+  default:
+    CHECK_SHOW(show("<H3>Cache Miss</H3>\n"));
+    return complete(event, e);
   }
 }
 
 int
-ShowCache::lookup_url(int event, Event *e) {
+ShowCache::lookup_url(int event, Event *e)
+{
   char header_str[300];
 
   snprintf(header_str, sizeof(header_str), "<font color=red>%s</font>", show_cache_urlstrs[0]);
@@ -421,16 +443,17 @@ ShowCache::lookup_url(int event, Event *e) {
   url.hash_get(&md5);
   const char *hostname = url.host_get(&len);
   SET_HANDLER(&ShowCache::handleCacheEvent);
-  Action *lookup_result = cacheProcessor.open_read(this, &md5, getClusterCacheLocal(&url, (char *)hostname), CACHE_FRAG_TYPE_HTTP, (char *) hostname, len);
+  Action *lookup_result =
+    cacheProcessor.open_read(this, &md5, getClusterCacheLocal(&url, (char *)hostname), CACHE_FRAG_TYPE_HTTP, (char *)hostname, len);
   if (!lookup_result)
     lookup_result = ACTION_IO_ERROR;
   if (lookup_result == ACTION_RESULT_DONE)
-    return EVENT_DONE;        // callback complete
+    return EVENT_DONE; // callback complete
   else if (lookup_result == ACTION_IO_ERROR) {
     handleEvent(CACHE_EVENT_OPEN_READ_FAILED, 0);
-    return EVENT_DONE;        // callback complete
+    return EVENT_DONE; // callback complete
   } else
-    return EVENT_CONT;        // callback pending, will be a cluster read.
+    return EVENT_CONT; // callback pending, will be a cluster read.
 }
 
 
@@ -468,14 +491,12 @@ ShowCache::delete_url(int event, Event *e)
 int
 ShowCache::handleCacheDeleteComplete(int event, Event *e)
 {
-
   if (event == CACHE_EVENT_REMOVE) {
     CHECK_SHOW(show("<td>Delete <font color=green>succeeded</font></td></tr>\n"));
   } else {
     CHECK_SHOW(show("<td>Delete <font color=red>failed</font></td></tr>\n"));
   }
   return delete_url(event, e);
-
 }
 
 
@@ -511,12 +532,16 @@ ShowCache::lookup_regex(int event, Event *e)
                   "       return true;\n"
                   "}\n"
                   "   srcfile=\"./delete_url?url=\" + form.elements[0].value;\n"
-                  "   document.location=srcfile;\n " "	return true;\n" "}\n" "</SCRIPT>\n"));
+                  "   document.location=srcfile;\n "
+                  "	return true;\n"
+                  "}\n"
+                  "</SCRIPT>\n"));
 
   CHECK_SHOW(show("<FORM NAME=\"f\" ACTION=\"./delete_url\" METHOD=GET> \n"
-                  "<INPUT TYPE=HIDDEN NAME=\"url\">\n" "<B><TABLE border=1>\n"));
+                  "<INPUT TYPE=HIDDEN NAME=\"url\">\n"
+                  "<B><TABLE border=1>\n"));
 
-  scan_flag = scan_type_lookup;                //lookup
+  scan_flag = scan_type_lookup; // lookup
   SET_HANDLER(&ShowCache::handleCacheScanCallback);
   cacheProcessor.scan(this);
   return EVENT_DONE;
@@ -527,11 +552,10 @@ ShowCache::delete_regex(int event, Event *e)
 {
   CHECK_SHOW(begin("Regex Delete"));
   CHECK_SHOW(show("<B><TABLE border=1>\n"));
-  scan_flag = scan_type_delete;                // delete
+  scan_flag = scan_type_delete; // delete
   SET_HANDLER(&ShowCache::handleCacheScanCallback);
   cacheProcessor.scan(this);
   return EVENT_DONE;
-
 }
 
 
@@ -540,93 +564,98 @@ ShowCache::invalidate_regex(int event, Event *e)
 {
   CHECK_SHOW(begin("Regex Invalidate"));
   CHECK_SHOW(show("<B><TABLE border=1>\n"));
-  scan_flag = scan_type_invalidate;                // invalidate
+  scan_flag = scan_type_invalidate; // invalidate
   SET_HANDLER(&ShowCache::handleCacheScanCallback);
   cacheProcessor.scan(this);
   return EVENT_DONE;
-
 }
 
 
-
 int
 ShowCache::handleCacheScanCallback(int event, Event *e)
 {
   switch (event) {
-  case CACHE_EVENT_SCAN:{
-      cache_vc = (CacheVC *) e;
-      return EVENT_CONT;
-    }
-  case CACHE_EVENT_SCAN_OBJECT:{
-      HTTPInfo *alt = (HTTPInfo *) e;
-      char xx[501], m[501];
-      int ib = 0, xd = 0, ml = 0;
-
-      alt->request_get()->url_print(xx, 500, &ib, &xd);
-      xx[ib] = '\0';
-
-      const char *mm = alt->request_get()->method_get(&ml);
-
-      memcpy(m, mm, ml);
-      m[ml] = 0;
-
-      int res = CACHE_SCAN_RESULT_CONTINUE;
-
-      for (unsigned s = 0; show_cache_urlstrs[s][0] != '\0'; s++) {
-        const char* error;
-        int erroffset;
-        pcre* preq =  pcre_compile(show_cache_urlstrs[s], 0, &error, &erroffset, NULL);
-
-        Debug("cache_inspector", "matching url '%s' '%s' with regex '%s'\n", m, xx, show_cache_urlstrs[s]);
-
-        if (preq) {
-          int r = pcre_exec(preq, NULL, xx, ib, 0, 0, NULL, 0);
-
-          pcre_free(preq);
-          if (r != -1) {
-            linecount++;
-            if ((linecount % 5) == 0) {
-              CHECK_SHOW(show("<TR bgcolor=\"#FFF0E0\">"));
-            } else {
-              CHECK_SHOW(show("<TR>"));
-            }
-
-            switch (scan_flag) {
-            case scan_type_lookup:
-              /*Y! Bug: 2249781: using onClick() because i need encodeURIComponent() and YTS doesn't have something like that */
-              CHECK_SHOW(show("<TD><INPUT TYPE=CHECKBOX NAME=\"%s\" "
-                              "onClick=\"addToUrlList(this)\"></TD>"
-                              "<TD><A onClick='window.location.href=\"./lookup_url?url=\"+ encodeURIComponent(\"%s\");' HREF=\"#\">"
-                              "<B>%s</B></A></br></TD></TR>\n", xx, xx, xx));
-              break;
-            case scan_type_delete:
-              CHECK_SHOW(show("<TD><B>%s</B></TD>" "<TD><font color=red>deleted</font></TD></TR>\n", xx));
-              res = CACHE_SCAN_RESULT_DELETE;
-              break;
-            case scan_type_invalidate:
-              HTTPInfo new_info;
-              res = CACHE_SCAN_RESULT_UPDATE;
-              new_info.copy(alt);
-              new_info.response_get()->set_cooked_cc_need_revalidate_once();
-              CHECK_SHOW(show("<TD><B>%s</B></TD>" "<TD><font color=red>Invalidate</font></TD>" "</TR>\n", xx));
-              cache_vc->set_http_info(&new_info);
-            }
+  case CACHE_EVENT_SCAN: {
+    cache_vc = (CacheVC *)e;
+    return EVENT_CONT;
+  }
+  case CACHE_EVENT_SCAN_OBJECT: {
+    HTTPInfo *alt = (HTTPInfo *)e;
+    char xx[501], m[501];
+    int ib = 0, xd = 0, ml = 0;
 
+    alt->request_get()->url_print(xx, 500, &ib, &xd);
+    xx[ib] = '\0';
+
+    const char *mm = alt->request_get()->method_get(&ml);
+
+    memcpy(m, mm, ml);
+    m[ml] = 0;
+
+    int res = CACHE_SCAN_RESULT_CONTINUE;
+
+    for (unsigned s = 0; show_cache_urlstrs[s][0] != '\0'; s++) {
+      const char *error;
+      int erroffset;
+      pcre *preq = pcre_compile(show_cache_urlstrs[s], 0, &error, &erroffset, NULL);
+
+      Debug("cache_inspector", "matching url '%s' '%s' with regex '%s'\n", m, xx, show_cache_urlstrs[s]);
+
+      if (preq) {
+        int r = pcre_exec(preq, NULL, xx, ib, 0, 0, NULL, 0);
+
+        pcre_free(preq);
+        if (r != -1) {
+          linecount++;
+          if ((linecount % 5) == 0) {
+            CHECK_SHOW(show("<TR bgcolor=\"#FFF0E0\">"));
+          } else {
+            CHECK_SHOW(show("<TR>"));
+          }
+
+          switch (scan_flag) {
+          case scan_type_lookup:
+            /*Y! Bug: 2249781: using onClick() because i need encodeURIComponent() and YTS doesn't have something like that */
+            CHECK_SHOW(show("<TD><INPUT TYPE=CHECKBOX NAME=\"%s\" "
+                            "onClick=\"addToUrlList(this)\"></TD>"
+                            "<TD><A onClick='window.location.href=\"./lookup_url?url=\"+ encodeURIComponent(\"%s\");' HREF=\"#\">"
+                            "<B>%s</B></A></br></TD></TR>\n",
+                            xx, xx, xx));
+            break;
+          case scan_type_delete:
+            CHECK_SHOW(show("<TD><B>%s</B></TD>"
+                            "<TD><font color=red>deleted</font></TD></TR>\n",
+                            xx));
+            res = CACHE_SCAN_RESULT_DELETE;
             break;
+          case scan_type_invalidate:
+            HTTPInfo new_info;
+            res = CACHE_SCAN_RESULT_UPDATE;
+            new_info.copy(alt);
+            new_info.response_get()->set_cooked_cc_need_revalidate_once();
+            CHECK_SHOW(show("<TD><B>%s</B></TD>"
+                            "<TD><font color=red>Invalidate</font></TD>"
+                            "</TR>\n",
+                            xx));
+            cache_vc->set_http_info(&new_info);
           }
-        } else {
-          // TODO: Regex didn't compile, show errors ?
-          Debug("cache_inspector", "regex '%s' didn't compile", show_cache_urlstrs[s]);
+
+          break;
         }
+      } else {
+        // TODO: Regex didn't compile, show errors ?
+        Debug("cache_inspector", "regex '%s' didn't compile", show_cache_urlstrs[s]);
       }
-      return res;
     }
+    return res;
+  }
   case CACHE_EVENT_SCAN_DONE:
     CHECK_SHOW(show("</TABLE></B>\n"));
     if (scan_flag == 0)
       if (linecount) {
         CHECK_SHOW(show("<P><INPUT TYPE=button value=\"Delete\" "
-                        "onClick=\"setUrls(window.document.f)\"></P>" "</FORM>\n"));
+                        "onClick=\"setUrls(window.document.f)\"></P>"
+                        "</FORM>\n"));
       }
     CHECK_SHOW(show("<H3>Done</H3>\n"));
     Debug("cache_inspector", "scan done");
@@ -638,4 +667,3 @@ ShowCache::handleCacheScanCallback(int event, Event *e)
     return EVENT_DONE;
   }
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CachePagesInternal.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CachePagesInternal.cc b/iocore/cache/CachePagesInternal.cc
index 0d7b191..080decc 100644
--- a/iocore/cache/CachePagesInternal.cc
+++ b/iocore/cache/CachePagesInternal.cc
@@ -26,40 +26,34 @@
 #include "Show.h"
 #include "I_Tasks.h"
 
-struct ShowCacheInternal: public ShowCont
-{
+struct ShowCacheInternal : public ShowCont {
   int vol_index;
   int seg_index;
   CacheKey show_cache_key;
   CacheVC *cache_vc;
 
 
-  int showMain(int event, Event * e);
-  int showEvacuations(int event, Event * e);
-  int showVolEvacuations(int event, Event * e);
-  int showVolumes(int event, Event * e);
-  int showVolVolumes(int event, Event * e);
-  int showSegments(int event, Event * e);
-  int showSegSegment(int event, Event * e);
+  int showMain(int event, Event *e);
+  int showEvacuations(int event, Event *e);
+  int showVolEvacuations(int event, Event *e);
+  int showVolumes(int event, Event *e);
+  int showVolVolumes(int event, Event *e);
+  int showSegments(int event, Event *e);
+  int showSegSegment(int event, Event *e);
 #ifdef CACHE_STAT_PAGES
-  int showConnections(int event, Event * e);
-  int showVolConnections(int event, Event * e);
+  int showConnections(int event, Event *e);
+  int showVolConnections(int event, Event *e);
 #endif
 
-  ShowCacheInternal(Continuation * c, HTTPHdr * h)
-    : ShowCont(c, h), vol_index(0), seg_index(0)
+  ShowCacheInternal(Continuation *c, HTTPHdr *h) : ShowCont(c, h), vol_index(0), seg_index(0)
   {
     SET_HANDLER(&ShowCacheInternal::showMain);
   }
 
-  ~ShowCacheInternal() {
-  }
-
+  ~ShowCacheInternal() {}
 };
 extern ShowCacheInternal *theshowcacheInternal;
-Action *register_ShowCacheInternal(Continuation * c, HTTPHdr * h);
-
-
+Action *register_ShowCacheInternal(Continuation *c, HTTPHdr *h);
 
 
 extern Vol **gvol;
@@ -70,12 +64,12 @@ extern volatile int gnvol;
 ShowCacheInternal *theshowcacheInternal = NULL;
 
 
-#define STREQ_PREFIX(_x,_s) (!strncasecmp(_x,_s,sizeof(_s)-1))
-#define STREQ_LEN_PREFIX(_x,_l,_s) (path_len < sizeof(_s) && !strncasecmp(_x,_s,sizeof(_s)-1))
+#define STREQ_PREFIX(_x, _s) (!strncasecmp(_x, _s, sizeof(_s) - 1))
+#define STREQ_LEN_PREFIX(_x, _l, _s) (path_len < sizeof(_s) && !strncasecmp(_x, _s, sizeof(_s) - 1))
 
 
 Action *
-register_ShowCacheInternal(Continuation * c, HTTPHdr * h)
+register_ShowCacheInternal(Continuation *c, HTTPHdr *h)
 {
   theshowcacheInternal = new ShowCacheInternal(c, h);
   URL *u = h->url_get();
@@ -105,7 +99,7 @@ register_ShowCacheInternal(Continuation * c, HTTPHdr * h)
 
 
 int
-ShowCacheInternal::showMain(int event, Event * e)
+ShowCacheInternal::showMain(int event, Event *e)
 {
   CHECK_SHOW(begin("Cache"));
 #ifdef CACHE_STAT_PAGES
@@ -121,14 +115,18 @@ ShowCacheInternal::showMain(int event, Event * e)
 
 #ifdef CACHE_STAT_PAGES
 int
-ShowCacheInternal::showConnections(int event, Event * e)
+ShowCacheInternal::showConnections(int event, Event *e)
 {
   CHECK_SHOW(begin("Cache VConnections"));
   CHECK_SHOW(show("<H3>Cache Connections</H3>\n"
                   "<table border=1><tr>"
                   "<th>Operation</th>"
                   "<th>Volume</th>"
-                  "<th>URL/Hash</th>" "<th>Bytes Done</th>" "<th>Total Bytes</th>" "<th>Bytes Todo</th>" "</tr>\n"));
+                  "<th>URL/Hash</th>"
+                  "<th>Bytes Done</th>"
+                  "<th>Total Bytes</th>"
+                  "<th>Bytes Todo</th>"
+                  "</tr>\n"));
 
   SET_HANDLER(&ShowCacheInternal::showVolConnections);
   CONT_SCHED_LOCK_RETRY_RET(this);
@@ -136,14 +134,13 @@ ShowCacheInternal::showConnections(int event, Event * e)
 
 
 int
-ShowCacheInternal::showVolConnections(int event, Event * e)
+ShowCacheInternal::showVolConnections(int event, Event *e)
 {
   CACHE_TRY_LOCK(lock, gvol[vol_index]->mutex, mutex->thread_holding);
   if (!lock) {
     CONT_SCHED_LOCK_RETRY_RET(this);
   }
-  for (CacheVC * vc = (CacheVC *) gvol[vol_index]->stat_cache_vcs.head; vc; vc = vc->stat_link.next) {
-
+  for (CacheVC *vc = (CacheVC *)gvol[vol_index]->stat_cache_vcs.head; vc; vc = vc->stat_link.next) {
     char nbytes[60], todo[60], url[81092];
     int ib = 0, xd = 0;
     URL uu;
@@ -165,17 +162,15 @@ ShowCacheInternal::showVolConnections(int event, Event * e)
       url[ib] = 0;
     } else
       vc->key.string(url);
-    CHECK_SHOW(show("<tr>" "<td>%s</td>"        // operation
-                    "<td>%s</td>"       // Vol
-                    "<td>%s</td>"       // URL/Hash
+    CHECK_SHOW(show("<tr>"
+                    "<td>%s</td>" // operation
+                    "<td>%s</td>" // Vol
+                    "<td>%s</td>" // URL/Hash
                     "<td>%d</td>"
                     "<td>%s</td>"
                     "<td>%s</td>"
                     "</tr>\n",
-                    ((vc->vio.op == VIO::READ) ? "Read" : "Write"),
-                    vc->vol->hash_id,
-                    url,
-                    vc->vio.ndone,
+                    ((vc->vio.op == VIO::READ) ? "Read" : "Write"), vc->vol->hash_id, url, vc->vio.ndone,
                     vc->vio.nbytes == INT64_MAX ? "all" : nbytes, vc->vio.nbytes == INT64_MAX ? "all" : todo));
   }
   vol_index++;
@@ -192,12 +187,16 @@ ShowCacheInternal::showVolConnections(int event, Event * e)
 
 
 int
-ShowCacheInternal::showEvacuations(int event, Event * e)
+ShowCacheInternal::showEvacuations(int event, Event *e)
 {
   CHECK_SHOW(begin("Cache Pending Evacuations"));
   CHECK_SHOW(show("<H3>Cache Evacuations</H3>\n"
                   "<table border=1><tr>"
-                  "<th>Offset</th>" "<th>Estimated Size</th>" "<th>Reader Count</th>" "<th>Done</th>" "</tr>\n"));
+                  "<th>Offset</th>"
+                  "<th>Estimated Size</th>"
+                  "<th>Reader Count</th>"
+                  "<th>Done</th>"
+                  "</tr>\n"));
 
   SET_HANDLER(&ShowCacheInternal::showVolEvacuations);
   CONT_SCHED_LOCK_RETRY_RET(this);
@@ -205,7 +204,7 @@ ShowCacheInternal::showEvacuations(int event, Event * e)
 
 
 int
-ShowCacheInternal::showVolEvacuations(int event, Event * e)
+ShowCacheInternal::showVolEvacuations(int event, Event *e)
 {
   Vol *p = gvol[vol_index];
   CACHE_TRY_LOCK(lock, p->mutex, mutex->thread_holding);
@@ -217,12 +216,14 @@ ShowCacheInternal::showVolEvacuations(int event, Event * e)
   for (int i = 0; i < last; i++) {
     for (b = p->evacuate[i].head; b; b = b->link.next) {
       char offset[60];
-      sprintf(offset, "%" PRIu64 "", (uint64_t) vol_offset(p, &b->dir));
-      CHECK_SHOW(show("<tr>" "<td>%s</td>"      // offset
-                      "<td>%d</td>"     // estimated size
-                      "<td>%d</td>"     // reader count
-                      "<td>%s</td>"     // done
-                      "</tr>\n", offset, (int) dir_approx_size(&b->dir), b->readers, b->f.done ? "yes" : "no"));
+      sprintf(offset, "%" PRIu64 "", (uint64_t)vol_offset(p, &b->dir));
+      CHECK_SHOW(show("<tr>"
+                      "<td>%s</td>" // offset
+                      "<td>%d</td>" // estimated size
+                      "<td>%d</td>" // reader count
+                      "<td>%s</td>" // done
+                      "</tr>\n",
+                      offset, (int)dir_approx_size(&b->dir), b->readers, b->f.done ? "yes" : "no"));
     }
   }
   vol_index++;
@@ -236,7 +237,7 @@ ShowCacheInternal::showVolEvacuations(int event, Event * e)
 }
 
 int
-ShowCacheInternal::showVolumes(int event, Event * e)
+ShowCacheInternal::showVolumes(int event, Event *e)
 {
   CHECK_SHOW(begin("Cache Volumes"));
   CHECK_SHOW(show("<H3>Cache Volumes</H3>\n"
@@ -248,7 +249,11 @@ ShowCacheInternal::showVolumes(int event, Event * e)
                   "<th>Write Agg Todo</th>"
                   "<th>Write Agg Todo Size</th>"
                   "<th>Write Agg Done</th>"
-                  "<th>Phase</th>" "<th>Create Time</th>" "<th>Sync Serial</th>" "<th>Write Serial</th>" "</tr>\n"));
+                  "<th>Phase</th>"
+                  "<th>Create Time</th>"
+                  "<th>Sync Serial</th>"
+                  "<th>Write Serial</th>"
+                  "</tr>\n"));
 
   SET_HANDLER(&ShowCacheInternal::showVolVolumes);
   CONT_SCHED_LOCK_RETRY_RET(this);
@@ -256,7 +261,7 @@ ShowCacheInternal::showVolumes(int event, Event * e)
 
 
 int
-ShowCacheInternal::showVolVolumes(int event, Event * e)
+ShowCacheInternal::showVolVolumes(int event, Event *e)
 {
   Vol *p = gvol[vol_index];
   CACHE_TRY_LOCK(lock, p->mutex, mutex->thread_holding);
@@ -269,40 +274,42 @@ ShowCacheInternal::showVolVolumes(int event, Event * e)
   int agg_todo = 0;
   int agg_done = p->agg_buf_pos;
   CacheVC *c = 0;
-  for (c = p->agg.head; c; c = (CacheVC *) c->link.next)
+  for (c = p->agg.head; c; c = (CacheVC *)c->link.next)
     agg_todo++;
-  CHECK_SHOW(show("<tr>" "<td>%s</td>"  // ID
+  CHECK_SHOW(show("<tr>"
+                  "<td>%s</td>"          // ID
                   "<td>%" PRId64 "</td>" // blocks
                   "<td>%" PRId64 "</td>" // directory entries
                   "<td>%" PRId64 "</td>" // write position
-                  "<td>%d</td>" // write agg to do
-                  "<td>%d</td>" // write agg to do size
-                  "<td>%d</td>" // write agg done
-                  "<td>%d</td>" // phase
-                  "<td>%s</td>" // create time
-                  "<td>%u</td>" // sync serial
-                  "<td>%u</td>" // write serial
+                  "<td>%d</td>"          // write agg to do
+                  "<td>%d</td>"          // write agg to do size
+                  "<td>%d</td>"          // write agg done
+                  "<td>%d</td>"          // phase
+                  "<td>%s</td>"          // create time
+                  "<td>%u</td>"          // sync serial
+                  "<td>%u</td>"          // write serial
                   "</tr>\n",
-                  p->hash_text.get(),
-                  (uint64_t)((p->len - (p->start - p->skip)) / CACHE_BLOCK_SIZE),
+                  p->hash_text.get(), (uint64_t)((p->len - (p->start - p->skip)) / CACHE_BLOCK_SIZE),
                   (uint64_t)(p->buckets * DIR_DEPTH * p->segments),
-                  (uint64_t)((p->header->write_pos - p->start) / CACHE_BLOCK_SIZE),
-                  agg_todo,
-                  p->agg_todo_size,
-                  agg_done, p->header->phase, ctime, p->header->sync_serial, p->header->write_serial));
+                  (uint64_t)((p->header->write_pos - p->start) / CACHE_BLOCK_SIZE), agg_todo, p->agg_todo_size, agg_done,
+                  p->header->phase, ctime, p->header->sync_serial, p->header->write_serial));
   CHECK_SHOW(show("</table>\n"));
   SET_HANDLER(&ShowCacheInternal::showSegments);
   return showSegments(event, e);
 }
 
 int
-ShowCacheInternal::showSegments(int event, Event * e)
+ShowCacheInternal::showSegments(int event, Event *e)
 {
   CHECK_SHOW(show("<H3>Cache Volume Segments</H3>\n"
                   "<table border=1><tr>"
                   "<th>Free</th>"
                   "<th>Used</th>"
-                  "<th>Empty</th>" "<th>Valid</th>" "<th>Agg Valid</th>" "<th>Avg Size</th>" "</tr>\n"));
+                  "<th>Empty</th>"
+                  "<th>Valid</th>"
+                  "<th>Agg Valid</th>"
+                  "<th>Avg Size</th>"
+                  "</tr>\n"));
 
   SET_HANDLER(&ShowCacheInternal::showSegSegment);
   seg_index = 0;
@@ -310,7 +317,7 @@ ShowCacheInternal::showSegments(int event, Event * e)
 }
 
 int
-ShowCacheInternal::showSegSegment(int event, Event * e)
+ShowCacheInternal::showSegSegment(int event, Event *e)
 {
   Vol *p = gvol[vol_index];
   CACHE_TRY_LOCK(lock, p->mutex, mutex->thread_holding);
@@ -322,7 +329,11 @@ ShowCacheInternal::showSegSegment(int event, Event * e)
                   "<td>%d</td>"
                   "<td>%d</td>"
                   "<td>%d</td>"
-                  "<td>%d</td>" "<td>%d</td>" "<td>%d</td>" "</tr>\n", free, used, empty, valid, agg_valid, avg_size));
+                  "<td>%d</td>"
+                  "<td>%d</td>"
+                  "<td>%d</td>"
+                  "</tr>\n",
+                  free, used, empty, valid, agg_valid, avg_size));
   seg_index++;
   if (seg_index < p->segments)
     CONT_SCHED_LOCK_RETRY(this);
@@ -337,4 +348,3 @@ ShowCacheInternal::showSegSegment(int event, Event * e)
   }
   return EVENT_CONT;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index a20737e..4ba02f4 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -24,17 +24,17 @@
 #include "P_Cache.h"
 
 #ifdef HTTP_CACHE
-#include "HttpCacheSM.h"      //Added to get the scope of HttpCacheSM object.
+#include "HttpCacheSM.h" //Added to get the scope of HttpCacheSM object.
 #endif
 
 #define READ_WHILE_WRITER 1
 extern int cache_config_compatibility_4_2_0_fixup;
 
 Action *
-Cache::open_read(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int host_len)
+Cache::open_read(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int host_len)
 {
   if (!CacheProcessor::IsCacheReady(type)) {
-    cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NOT_READY);
+    cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
   ink_assert(caches[type] == this);
@@ -67,15 +67,18 @@ Cache::open_read(Continuation * cont, CacheKey * key, CacheFragType type, char *
       goto Lwriter;
     c->dir = result;
     c->last_collision = last_collision;
-    switch(c->do_read_call(&c->key)) {
-      case EVENT_DONE: return ACTION_RESULT_DONE;
-      case EVENT_RETURN: goto Lcallreturn;
-      default: return &c->_action;
+    switch (c->do_read_call(&c->key)) {
+    case EVENT_DONE:
+      return ACTION_RESULT_DONE;
+    case EVENT_RETURN:
+      goto Lcallreturn;
+    default:
+      return &c->_action;
     }
   }
 Lmiss:
   CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
-  cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NO_DOC);
+  cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NO_DOC);
   return ACTION_RESULT_DONE;
 Lwriter:
   SET_CONTINUATION_HANDLER(c, &CacheVC::openReadFromWriter);
@@ -90,12 +93,11 @@ Lcallreturn:
 
 #ifdef HTTP_CACHE
 Action *
-Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
-                 CacheLookupHttpConfig * params, CacheFragType type, char *hostname, int host_len)
+Cache::open_read(Continuation *cont, CacheKey *key, CacheHTTPHdr *request, CacheLookupHttpConfig *params, CacheFragType type,
+                 char *hostname, int host_len)
 {
-
   if (!CacheProcessor::IsCacheReady(type)) {
-    cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NOT_READY);
+    cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
   ink_assert(caches[type] == this);
@@ -133,15 +135,18 @@ Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
     c->dir = c->first_dir = result;
     c->last_collision = last_collision;
     SET_CONTINUATION_HANDLER(c, &CacheVC::openReadStartHead);
-    switch(c->do_read_call(&c->key)) {
-      case EVENT_DONE: return ACTION_RESULT_DONE;
-      case EVENT_RETURN: goto Lcallreturn;
-      default: return &c->_action;
+    switch (c->do_read_call(&c->key)) {
+    case EVENT_DONE:
+      return ACTION_RESULT_DONE;
+    case EVENT_RETURN:
+      goto Lcallreturn;
+    default:
+      return &c->_action;
     }
   }
 Lmiss:
   CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
-  cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NO_DOC);
+  cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NO_DOC);
   return ACTION_RESULT_DONE;
 Lwriter:
   // this is a horrible violation of the interface and should be fixed (FIXME)
@@ -158,14 +163,13 @@ Lcallreturn:
 #endif
 
 uint32_t
-CacheVC::load_http_info(CacheHTTPInfoVector* info, Doc* doc, RefCountObj * block_ptr)
+CacheVC::load_http_info(CacheHTTPInfoVector *info, Doc *doc, RefCountObj *block_ptr)
 {
   uint32_t zret = info->get_handles(doc->hdr(), doc->hlen, block_ptr);
   if (cache_config_compatibility_4_2_0_fixup && // manual override not engaged
-      ! this->f.doc_from_ram_cache && // it's already been done for ram cache fragments
-      vol->header->version.ink_major == 23 && vol->header->version.ink_minor == 0
-    ) {
-    for ( int i = info->xcount - 1 ; i >= 0 ; --i ) {
+      !this->f.doc_from_ram_cache &&            // it's already been done for ram cache fragments
+      vol->header->version.ink_major == 23 && vol->header->version.ink_minor == 0) {
+    for (int i = info->xcount - 1; i >= 0; --i) {
       info->data(i).alternate.m_alt->m_response_hdr.m_mime->recompute_accelerators_and_presence_bits();
       info->data(i).alternate.m_alt->m_request_hdr.m_mime->recompute_accelerators_and_presence_bits();
     }
@@ -174,9 +178,8 @@ CacheVC::load_http_info(CacheHTTPInfoVector* info, Doc* doc, RefCountObj * block
 }
 
 int
-CacheVC::openReadFromWriterFailure(int event, Event * e)
+CacheVC::openReadFromWriterFailure(int event, Event *e)
 {
-
   od = NULL;
   vector.clear(false);
   CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
@@ -216,7 +219,7 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE
       vector.insert(write_vector->get(c));
     // check if all the writers who came before this reader have
     // set the http_info.
-    for (w = (CacheVC *) od->writers.head; w; w = (CacheVC *) w->opendir_link.next) {
+    for (w = (CacheVC *)od->writers.head; w; w = (CacheVC *)w->opendir_link.next) {
       if (w->start_time > start_time || w->closed < 0)
         continue;
       if (!w->closed && !cache_config_read_while_writer) {
@@ -250,7 +253,7 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE
 
     if (!vector.count()) {
       if (od->reading_vec) {
-       // the writer(s) are reading the vector, so there is probably
+        // the writer(s) are reading the vector, so there is probably
         // an old vector. Since this reader came before any of the
         // current writers, we should return the old data
         od = NULL;
@@ -265,7 +268,7 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE
     } else
       alternate_index = 0;
     CacheHTTPInfo *obj = vector.get(alternate_index);
-    for (w = (CacheVC *) od->writers.head; w; w = (CacheVC *) w->opendir_link.next) {
+    for (w = (CacheVC *)od->writers.head; w; w = (CacheVC *)w->opendir_link.next) {
       if (obj->m_alt == w->alternate.m_alt) {
         write_vc = w;
         break;
@@ -278,17 +281,15 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE
       return EVENT_RETURN;
     }
 
-    DDebug("cache_read_agg",
-          "%p: key: %X eKey: %d # alts: %d, ndx: %d, # writers: %d writer: %p",
-          this, first_key.slice32(1), write_vc->earliest_key.slice32(1),
-          vector.count(), alternate_index, od->num_writers, write_vc);
+    DDebug("cache_read_agg", "%p: key: %X eKey: %d # alts: %d, ndx: %d, # writers: %d writer: %p", this, first_key.slice32(1),
+           write_vc->earliest_key.slice32(1), vector.count(), alternate_index, od->num_writers, write_vc);
   }
-#endif //HTTP_CACHE
+#endif // HTTP_CACHE
   return EVENT_NONE;
 }
 
 int
-CacheVC::openReadFromWriter(int event, Event * e)
+CacheVC::openReadFromWriter(int event, Event *e)
 {
   if (!f.read_from_writer_called) {
     // The assignment to last_collision as NULL was
@@ -306,7 +307,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
   intptr_t err = ECACHE_DOC_BUSY;
   DDebug("cache_read_agg", "%p: key: %X In openReadFromWriter", this, first_key.slice32(1));
 #ifndef READ_WHILE_WRITER
-  return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *) -err);
+  return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *)-err);
 #else
   if (_action.cancelled) {
     od = NULL; // only open for read so no need to close
@@ -328,7 +329,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
     if (ret < 0) {
       MUTEX_RELEASE(lock);
       SET_HANDLER(&CacheVC::openReadFromWriterFailure);
-      return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, reinterpret_cast<Event *> (ret));
+      return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, reinterpret_cast<Event *>(ret));
     } else if (ret == EVENT_RETURN) {
       MUTEX_RELEASE(lock);
       SET_HANDLER(&CacheVC::openReadStartHead);
@@ -341,8 +342,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
   } else {
     if (writer_done()) {
       MUTEX_RELEASE(lock);
-      DDebug("cache_read_agg",
-            "%p: key: %X writer %p has left, continuing as normal read", this, first_key.slice32(1), write_vc);
+      DDebug("cache_read_agg", "%p: key: %X writer %p has left, continuing as normal read", this, first_key.slice32(1), write_vc);
       od = NULL;
       write_vc = NULL;
       SET_HANDLER(&CacheVC::openReadStartHead);
@@ -357,7 +357,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
   if (write_vc->closed < 0) {
     MUTEX_RELEASE(lock);
     write_vc = NULL;
-    //writer aborted, continue as if there is no writer
+    // writer aborted, continue as if there is no writer
     SET_HANDLER(&CacheVC::openReadStartHead);
     return openReadStartHead(EVENT_IMMEDIATE, 0);
   }
@@ -366,11 +366,10 @@ CacheVC::openReadFromWriter(int event, Event * e)
   if (!write_vc->closed && !write_vc->fragment) {
     if (!cache_config_read_while_writer || frag_type != CACHE_FRAG_TYPE_HTTP) {
       MUTEX_RELEASE(lock);
-      return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *) - err);
+      return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *)-err);
     }
-    DDebug("cache_read_agg",
-          "%p: key: %X writer: closed:%d, fragment:%d, retry: %d",
-          this, first_key.slice32(1), write_vc->closed, write_vc->fragment, writer_lock_retry);
+    DDebug("cache_read_agg", "%p: key: %X writer: closed:%d, fragment:%d, retry: %d", this, first_key.slice32(1), write_vc->closed,
+           write_vc->fragment, writer_lock_retry);
     VC_SCHED_WRITER_RETRY();
   }
 
@@ -382,14 +381,13 @@ CacheVC::openReadFromWriter(int event, Event * e)
   MUTEX_RELEASE(lock);
 
   if (!write_vc->io.ok())
-    return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *) - err);
+    return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *)-err);
 #ifdef HTTP_CACHE
   if (frag_type == CACHE_FRAG_TYPE_HTTP) {
-    DDebug("cache_read_agg",
-          "%p: key: %X http passed stage 1, closed: %d, frag: %d",
-          this, first_key.slice32(1), write_vc->closed, write_vc->fragment);
+    DDebug("cache_read_agg", "%p: key: %X http passed stage 1, closed: %d, frag: %d", this, first_key.slice32(1), write_vc->closed,
+           write_vc->fragment);
     if (!write_vc->alternate.valid())
-      return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *) - err);
+      return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *)-err);
     alternate.copy(&write_vc->alternate);
     vector.insert(&alternate);
     alternate.object_key_get(&key);
@@ -406,12 +404,12 @@ CacheVC::openReadFromWriter(int event, Event * e)
       DDebug("cache_read_agg", "%p: key: %X writer header update", this, first_key.slice32(1));
       // Update case (b) : grab doc_len from the writer's alternate
       doc_len = alternate.object_size_get();
-      if (write_vc->update_key == cod->single_doc_key &&
-          (cod->move_resident_alt || write_vc->f.rewrite_resident_alt) && write_vc->first_buf._ptr()) {
+      if (write_vc->update_key == cod->single_doc_key && (cod->move_resident_alt || write_vc->f.rewrite_resident_alt) &&
+          write_vc->first_buf._ptr()) {
         // the resident alternate is being updated and its a
         // header only update. The first_buf of the writer has the
         // document body.
-        Doc *doc = (Doc *) write_vc->first_buf->data();
+        Doc *doc = (Doc *)write_vc->first_buf->data();
         writer_buf = new_IOBufferBlock(write_vc->first_buf, doc->data_len(), doc->prefix_len());
         MUTEX_RELEASE(writer_lock);
         ink_assert(doc_len == doc->data_len());
@@ -433,7 +431,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
       return openReadStartEarliest(event, e);
     }
   } else {
-#endif //HTTP_CACHE
+#endif // HTTP_CACHE
     DDebug("cache_read_agg", "%p: key: %X non-http passed stage 1", this, first_key.slice32(1));
     key = write_vc->earliest_key;
 #ifdef HTTP_CACHE
@@ -442,9 +440,8 @@ CacheVC::openReadFromWriter(int event, Event * e)
   if (write_vc->fragment) {
     doc_len = write_vc->vio.nbytes;
     last_collision = NULL;
-    DDebug("cache_read_agg",
-          "%p: key: %X closed: %d, fragment: %d, len: %d starting first fragment",
-          this, first_key.slice32(1), write_vc->closed, write_vc->fragment, (int)doc_len);
+    DDebug("cache_read_agg", "%p: key: %X closed: %d, fragment: %d, len: %d starting first fragment", this, first_key.slice32(1),
+           write_vc->closed, write_vc->fragment, (int)doc_len);
     MUTEX_RELEASE(writer_lock);
     // either a header + body update or a new document
     SET_HANDLER(&CacheVC::openReadStartEarliest);
@@ -454,7 +451,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
   writer_offset = write_vc->offset;
   length = write_vc->length;
   // copy the vector
-  f.single_fragment = !write_vc->fragment;        // single fragment doc
+  f.single_fragment = !write_vc->fragment; // single fragment doc
   doc_pos = 0;
   earliest_key = write_vc->earliest_key;
   ink_assert(earliest_key == key);
@@ -466,7 +463,7 @@ CacheVC::openReadFromWriter(int event, Event * e)
   SET_HANDLER(&CacheVC::openReadFromWriterMain);
   CACHE_INCREMENT_DYN_STAT(cache_read_busy_success_stat);
   return callcont(CACHE_EVENT_OPEN_READ);
-#endif //READ_WHILE_WRITER
+#endif // READ_WHILE_WRITER
 }
 
 int
@@ -538,7 +535,7 @@ CacheVC::openReadClose(int event, Event * /* e ATS_UNUSED */)
 }
 
 int
-CacheVC::openReadReadDone(int event, Event * e)
+CacheVC::openReadReadDone(int event, Event *e)
 {
   Doc *doc = NULL;
 
@@ -554,10 +551,10 @@ CacheVC::openReadReadDone(int event, Event * e)
       dir_delete(&earliest_key, vol, &earliest_dir);
       goto Lerror;
     }
-    if (last_collision &&         // no missed lock
-        dir_valid(vol, &dir))    // object still valid
+    if (last_collision &&     // no missed lock
+        dir_valid(vol, &dir)) // object still valid
     {
-      doc = (Doc *) buf->data();
+      doc = (Doc *)buf->data();
       if (doc->magic != DOC_MAGIC) {
         char tmpstring[100];
         if (doc->magic == DOC_CORRUPT)
@@ -576,18 +573,18 @@ CacheVC::openReadReadDone(int event, Event * e)
         goto LreadMain;
 #if TS_USE_INTERIM_CACHE == 1
       else if (dir_ininterim(&dir)) {
-          dir_delete(&key, vol, &dir);
-          last_collision = NULL;
-        }
+        dir_delete(&key, vol, &dir);
+        last_collision = NULL;
+      }
 #endif
     }
 #if TS_USE_INTERIM_CACHE == 1
     if (last_collision && dir_get_offset(&dir) != dir_get_offset(last_collision))
       last_collision = 0;
-Lread:
+  Lread:
 #else
     if (last_collision && dir_offset(&dir) != dir_offset(last_collision))
-      last_collision = 0;       // object has been/is being overwritten
+      last_collision = 0; // object has been/is being overwritten
 #endif
     if (dir_probe(&key, vol, &dir, &last_collision)) {
       int ret = do_read_call(&key);
@@ -603,14 +600,12 @@ Lread:
 #else
           if (dir_offset(&dir) == dir_offset(&earliest_dir)) {
 #endif
-            DDebug("cache_read_agg", "%p: key: %X ReadRead complete: %d",
-                  this, first_key.slice32(1), (int)vio.ndone);
+            DDebug("cache_read_agg", "%p: key: %X ReadRead complete: %d", this, first_key.slice32(1), (int)vio.ndone);
             doc_len = vio.ndone;
             goto Ldone;
           }
         }
-        DDebug("cache_read_agg", "%p: key: %X ReadRead writer aborted: %d",
-              this, first_key.slice32(1), (int)vio.ndone);
+        DDebug("cache_read_agg", "%p: key: %X ReadRead writer aborted: %d", this, first_key.slice32(1), (int)vio.ndone);
         goto Lerror;
       }
       DDebug("cache_read_agg", "%p: key: %X ReadRead retrying: %d", this, first_key.slice32(1), (int)vio.ndone);
@@ -638,7 +633,7 @@ int
 CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
 {
   cancel_trigger();
-  Doc *doc = (Doc *) buf->data();
+  Doc *doc = (Doc *)buf->data();
   int64_t ntodo = vio.ntodo();
   int64_t bytes = doc->len - doc_pos;
   IOBufferBlock *b = NULL;
@@ -648,11 +643,11 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       return calluser(VC_EVENT_EOS);
     }
 #ifdef HTTP_CACHE
-    HTTPInfo::FragOffset* frags = alternate.get_frag_table();
+    HTTPInfo::FragOffset *frags = alternate.get_frag_table();
     if (is_debug_tag_set("cache_seek")) {
       char b[33], c[33];
-      Debug("cache_seek", "Seek @ %" PRId64" in %s from #%d @ %" PRId64"/%d:%s",
-            seek_to, first_key.toHexStr(b), fragment, doc_pos, doc->len, doc->key.toHexStr(c));
+      Debug("cache_seek", "Seek @ %" PRId64 " in %s from #%d @ %" PRId64 "/%d:%s", seek_to, first_key.toHexStr(b), fragment,
+            doc_pos, doc->len, doc->key.toHexStr(c));
     }
     /* Because single fragment objects can migrate to hang off an alt vector
        they can appear to the VC as multi-fragment when they are not really.
@@ -670,15 +665,13 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
          more than the fragment table length, the start of the last
          fragment being the last offset in the table.
       */
-      if (fragment == 0 ||
-          seek_to < frags[fragment-1] ||
-          (fragment <= lfi && frags[fragment] <= seek_to)
-        ) {
+      if (fragment == 0 || seek_to < frags[fragment - 1] || (fragment <= lfi && frags[fragment] <= seek_to)) {
         // search from frag 0 on to find the proper frag
         while (seek_to >= next_off && target < lfi) {
           next_off = frags[++target];
         }
-        if (target == lfi && seek_to >= next_off) ++target;
+        if (target == lfi && seek_to >= next_off)
+          ++target;
       } else { // shortcut if we are in the fragment already
         target = fragment;
       }
@@ -699,13 +692,14 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
         if (is_debug_tag_set("cache_seek")) {
           char target_key_str[33];
           key.toHexStr(target_key_str);
-          Debug("cache_seek", "Seek #%d @ %" PRId64" -> #%d @ %" PRId64":%s", cfi, doc_pos, target, seek_to, target_key_str);
+          Debug("cache_seek", "Seek #%d @ %" PRId64 " -> #%d @ %" PRId64 ":%s", cfi, doc_pos, target, seek_to, target_key_str);
         }
         goto Lread;
       }
     }
     doc_pos = doc->prefix_len() + seek_to;
-    if (fragment) doc_pos -= static_cast<int64_t>(frags[fragment-1]);
+    if (fragment)
+      doc_pos -= static_cast<int64_t>(frags[fragment - 1]);
     vio.ndone = 0;
     seek_to = 0;
     ntodo = vio.ntodo();
@@ -713,7 +707,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     if (is_debug_tag_set("cache_seek")) {
       char target_key_str[33];
       key.toHexStr(target_key_str);
-      Debug("cache_seek", "Read # %d @ %" PRId64"/%d for %" PRId64, fragment, doc_pos, doc->len, bytes);
+      Debug("cache_seek", "Read # %d @ %" PRId64 "/%d for %" PRId64, fragment, doc_pos, doc->len, bytes);
     }
 #endif
   }
@@ -741,53 +735,52 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
       goto Lread;
     return EVENT_CONT;
   }
-Lread: {
-    if (vio.ndone >= (int64_t)doc_len)
-      // reached the end of the document and the user still wants more
-      return calluser(VC_EVENT_EOS);
-    last_collision = 0;
-    writer_lock_retry = 0;
-    // if the state machine calls reenable on the callback from the cache,
-    // we set up a schedule_imm event. The openReadReadDone discards
-    // EVENT_IMMEDIATE events. So, we have to cancel that trigger and set
-    // a new EVENT_INTERVAL event.
-    cancel_trigger();
-    CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
-    if (!lock.is_locked()) {
-      SET_HANDLER(&CacheVC::openReadMain);
-      VC_SCHED_LOCK_RETRY();
-    }
-    if (dir_probe(&key, vol, &dir, &last_collision)) {
-      SET_HANDLER(&CacheVC::openReadReadDone);
-      int ret = do_read_call(&key);
-      if (ret == EVENT_RETURN)
-        goto Lcallreturn;
-      return EVENT_CONT;
-    } else if (write_vc) {
-      if (writer_done()) {
-        last_collision = NULL;
-        while (dir_probe(&earliest_key, vol, &dir, &last_collision)) {
-          if (dir_offset(&dir) == dir_offset(&earliest_dir)) {
-            DDebug("cache_read_agg", "%p: key: %X ReadMain complete: %d",
-                  this, first_key.slice32(1), (int)vio.ndone);
-            doc_len = vio.ndone;
-            goto Leos;
-          }
+Lread : {
+  if (vio.ndone >= (int64_t)doc_len)
+    // reached the end of the document and the user still wants more
+    return calluser(VC_EVENT_EOS);
+  last_collision = 0;
+  writer_lock_retry = 0;
+  // if the state machine calls reenable on the callback from the cache,
+  // we set up a schedule_imm event. The openReadReadDone discards
+  // EVENT_IMMEDIATE events. So, we have to cancel that trigger and set
+  // a new EVENT_INTERVAL event.
+  cancel_trigger();
+  CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
+  if (!lock.is_locked()) {
+    SET_HANDLER(&CacheVC::openReadMain);
+    VC_SCHED_LOCK_RETRY();
+  }
+  if (dir_probe(&key, vol, &dir, &last_collision)) {
+    SET_HANDLER(&CacheVC::openReadReadDone);
+    int ret = do_read_call(&key);
+    if (ret == EVENT_RETURN)
+      goto Lcallreturn;
+    return EVENT_CONT;
+  } else if (write_vc) {
+    if (writer_done()) {
+      last_collision = NULL;
+      while (dir_probe(&earliest_key, vol, &dir, &last_collision)) {
+        if (dir_offset(&dir) == dir_offset(&earliest_dir)) {
+          DDebug("cache_read_agg", "%p: key: %X ReadMain complete: %d", this, first_key.slice32(1), (int)vio.ndone);
+          doc_len = vio.ndone;
+          goto Leos;
         }
-        DDebug("cache_read_agg", "%p: key: %X ReadMain writer aborted: %d",
-              this, first_key.slice32(1), (int)vio.ndone);
-        goto Lerror;
       }
-      DDebug("cache_read_agg", "%p: key: %X ReadMain retrying: %d", this, first_key.slice32(1), (int)vio.ndone);
-      SET_HANDLER(&CacheVC::openReadMain);
-      VC_SCHED_WRITER_RETRY();
+      DDebug("cache_read_agg", "%p: key: %X ReadMain writer aborted: %d", this, first_key.slice32(1), (int)vio.ndone);
+      goto Lerror;
     }
-    if (is_action_tag_set("cache"))
-      ink_release_assert(false);
-    Warning("Document %X truncated at %d of %d, missing fragment %X", first_key.slice32(1), (int)vio.ndone, (int)doc_len, key.slice32(1));
-    // remove the directory entry
-    dir_delete(&earliest_key, vol, &earliest_dir);
+    DDebug("cache_read_agg", "%p: key: %X ReadMain retrying: %d", this, first_key.slice32(1), (int)vio.ndone);
+    SET_HANDLER(&CacheVC::openReadMain);
+    VC_SCHED_WRITER_RETRY();
   }
+  if (is_action_tag_set("cache"))
+    ink_release_assert(false);
+  Warning("Document %X truncated at %d of %d, missing fragment %X", first_key.slice32(1), (int)vio.ndone, (int)doc_len,
+          key.slice32(1));
+  // remove the directory entry
+  dir_delete(&earliest_key, vol, &earliest_dir);
+}
 Lerror:
   return calluser(VC_EVENT_ERROR);
 Leos:
@@ -825,7 +818,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
         last_collision = NULL;
       goto Lread;
     }
-    doc = (Doc *) buf->data();
+    doc = (Doc *)buf->data();
     if (doc->magic != DOC_MAGIC) {
       char tmpstring[100];
       if (is_action_tag_set("cache")) {
@@ -856,16 +849,14 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
 #if TS_USE_INTERIM_CACHE == 1
         && !dir_ininterim(&dir)
 #endif
-        ) {
-      DDebug("cache_hit_evac", "dir: %" PRId64", write: %" PRId64", phase: %d",
-            dir_offset(&earliest_dir), offset_to_vol_offset(vol, vol->header->write_pos), vol->header->phase);
+          ) {
+      DDebug("cache_hit_evac", "dir: %" PRId64 ", write: %" PRId64 ", phase: %d", dir_offset(&earliest_dir),
+             offset_to_vol_offset(vol, vol->header->write_pos), vol->header->phase);
       f.hit_evacuate = 1;
     }
     goto Lsuccess;
-Lread:
-    if (dir_probe(&key, vol, &earliest_dir, &last_collision) ||
-        dir_lookaside_probe(&key, vol, &earliest_dir, NULL))
-    {
+  Lread:
+    if (dir_probe(&key, vol, &earliest_dir, &last_collision) || dir_lookaside_probe(&key, vol, &earliest_dir, NULL)) {
       dir = earliest_dir;
 #if TS_USE_INTERIM_CACHE == 1
       if (dir_ininterim(&dir) && alternate.get_frag_offset_count() > 1) {
@@ -878,13 +869,13 @@ Lread:
         goto Lcallreturn;
       return ret;
     }
-    // read has detected that alternate does not exist in the cache.
-    // rewrite the vector.
+// read has detected that alternate does not exist in the cache.
+// rewrite the vector.
 #ifdef HTTP_CACHE
     if (!f.read_from_writer_called && frag_type == CACHE_FRAG_TYPE_HTTP) {
       // don't want any writers while we are evacuating the vector
       if (!vol->open_write(this, false, 1)) {
-        Doc *doc1 = (Doc *) first_buf->data();
+        Doc *doc1 = (Doc *)first_buf->data();
         uint32_t len = this->load_http_info(write_vector, doc1);
         ink_assert(len == doc1->hlen && write_vector->count() > 0);
         write_vector->remove(alternate_index, true);
@@ -938,13 +929,13 @@ Lread:
       }
     }
 #endif
-    // open write failure - another writer, so don't modify the vector
+  // open write failure - another writer, so don't modify the vector
   Ldone:
     if (od)
       vol->close_write(this);
   }
   CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
-  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NO_DOC);
+  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NO_DOC);
   return free_CacheVC(this);
 Lcallreturn:
   return handleEvent(AIO_EVENT_DONE, 0); // hopefully a tail call
@@ -998,7 +989,7 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */
   }
 
   CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
-  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_ALT_MISS);
+  _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_ALT_MISS);
   return free_CacheVC(this);
 Lrestart:
   SET_HANDLER(&CacheVC::openReadStartHead);
@@ -1011,7 +1002,7 @@ Lrestart:
   if you change this you might have to change that.
 */
 int
-CacheVC::openReadStartHead(int event, Event * e)
+CacheVC::openReadStartHead(int event, Event *e)
 {
   intptr_t err = ECACHE_NO_DOC;
   Doc *doc = NULL;
@@ -1041,7 +1032,7 @@ CacheVC::openReadStartHead(int event, Event * e)
 #endif
       goto Lread;
     }
-    doc = (Doc *) buf->data();
+    doc = (Doc *)buf->data();
     if (doc->magic != DOC_MAGIC) {
       char tmpstring[100];
       if (is_action_tag_set("cache")) {
@@ -1084,28 +1075,23 @@ CacheVC::openReadStartHead(int event, Event * e)
         goto Ldone;
       if ((uml = this->load_http_info(&vector, doc)) != doc->hlen) {
         if (buf) {
-          HTTPCacheAlt* alt = reinterpret_cast<HTTPCacheAlt*>(doc->hdr());
+          HTTPCacheAlt *alt = reinterpret_cast<HTTPCacheAlt *>(doc->hdr());
           int32_t alt_length = 0;
           // count should be reasonable, as vector is initialized and unlikly to be too corrupted
           // by bad disk data - count should be the number of successfully unmarshalled alts.
-          for ( int32_t i = 0 ; i < vector.count() ; ++i ) {
-            CacheHTTPInfo* info = vector.get(i);
-            if (info && info->m_alt) alt_length += info->m_alt->m_unmarshal_len;
+          for (int32_t i = 0; i < vector.count(); ++i) {
+            CacheHTTPInfo *info = vector.get(i);
+            if (info && info->m_alt)
+              alt_length += info->m_alt->m_unmarshal_len;
           }
           Note("OpenReadHead failed for cachekey %X : vector inconsistency - "
                "unmarshalled %d expecting %d in %d (base=%d, ver=%d:%d) "
                "- vector n=%d size=%d"
-               "first alt=%d[%s]"
-               , key.slice32(0)
-               , uml, doc->hlen, doc->len, sizeofDoc
-               , doc->v_major, doc->v_minor
-               , vector.count(), alt_length
-               , alt->m_magic
-               , (CACHE_ALT_MAGIC_ALIVE == alt->m_magic ? "alive"
-                  : CACHE_ALT_MAGIC_MARSHALED == alt->m_magic ? "serial"
-                  : CACHE_ALT_MAGIC_DEAD == alt->m_magic ? "dead"
-                  : "bogus")
-            );
+               "first alt=%d[%s]",
+               key.slice32(0), uml, doc->hlen, doc->len, sizeofDoc, doc->v_major, doc->v_minor, vector.count(), alt_length,
+               alt->m_magic, (CACHE_ALT_MAGIC_ALIVE == alt->m_magic ? "alive" : CACHE_ALT_MAGIC_MARSHALED == alt->m_magic ?
+                                                                      "serial" :
+                                                                      CACHE_ALT_MAGIC_DEAD == alt->m_magic ? "dead" : "bogus"));
           dir_delete(&key, vol, &dir);
         }
         err = ECACHE_BAD_META_DATA;
@@ -1131,9 +1117,9 @@ CacheVC::openReadStartHead(int event, Event * e)
       alternate.copy_shallow(alternate_tmp);
       alternate.object_key_get(&key);
       doc_len = alternate.object_size_get();
-      if (key == doc->key) {      // is this my data?
+      if (key == doc->key) { // is this my data?
         f.single_fragment = doc->single_fragment();
-        ink_assert(f.single_fragment);     // otherwise need to read earliest
+        ink_assert(f.single_fragment); // otherwise need to read earliest
         ink_assert(doc->hlen);
         doc_pos = doc->prefix_len();
         next_CacheKey(&key, &doc->key);
@@ -1150,17 +1136,15 @@ CacheVC::openReadStartHead(int event, Event * e)
     }
 
     if (is_debug_tag_set("cache_read")) { // amc debug
-      char xt[33],yt[33];
-      Debug("cache_read", "CacheReadStartHead - read %s target %s - %s %d of %" PRId64" bytes, %d fragments",
-            doc->key.toHexStr(xt), key.toHexStr(yt),
-            f.single_fragment ? "single" : "multi",
-            doc->len, doc->total_len,
+      char xt[33], yt[33];
+      Debug("cache_read", "CacheReadStartHead - read %s target %s - %s %d of %" PRId64 " bytes, %d fragments",
+            doc->key.toHexStr(xt), key.toHexStr(yt), f.single_fragment ? "single" : "multi", doc->len, doc->total_len,
 #ifdef HTTP_CACHE
             alternate.get_frag_offset_count()
 #else
             0
 #endif
-            );
+              );
     }
     // the first fragment might have been gc'ed. Make sure the first
     // fragment is there before returning CACHE_EVENT_OPEN_READ
@@ -1173,8 +1157,8 @@ CacheVC::openReadStartHead(int event, Event * e)
         && !f.read_from_interim
 #endif
         ) {
-      DDebug("cache_hit_evac", "dir: %" PRId64", write: %" PRId64", phase: %d",
-            dir_offset(&dir), offset_to_vol_offset(vol, vol->header->write_pos), vol->header->phase);
+      DDebug("cache_hit_evac", "dir: %" PRId64 ", write: %" PRId64 ", phase: %d", dir_offset(&dir),
+             offset_to_vol_offset(vol, vol->header->write_pos), vol->header->phase);
       f.hit_evacuate = 1;
     }
 
@@ -1211,10 +1195,10 @@ CacheVC::openReadStartHead(int event, Event * e)
 Ldone:
   if (!f.lookup) {
     CACHE_INCREMENT_DYN_STAT(cache_read_failure_stat);
-    _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -err);
+    _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-err);
   } else {
     CACHE_INCREMENT_DYN_STAT(cache_lookup_failure_stat);
-    _action.continuation->handleEvent(CACHE_EVENT_LOOKUP_FAILED, (void *) -err);
+    _action.continuation->handleEvent(CACHE_EVENT_LOOKUP_FAILED, (void *)-err);
   }
   return free_CacheVC(this);
 Lcallreturn:


[02/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpMeta.h
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpMeta.h b/lib/wccp/WccpMeta.h
index a30f1c9..a2cacc2 100644
--- a/lib/wccp/WccpMeta.h
+++ b/lib/wccp/WccpMeta.h
@@ -1,5 +1,5 @@
-# if !defined(TS_WCCP_META_HEADER)
-# define TS_WCCP_META_HEADER
+#if !defined(TS_WCCP_META_HEADER)
+#define TS_WCCP_META_HEADER
 
 /** @file
     Meta programming support for WCCP.
@@ -27,54 +27,66 @@
 
 // Various meta programming efforts. Experimental at present.
 
-namespace ts {
-
+namespace ts
+{
 // Some support templates so we can fail to compile if the
 // compile time check fails.
 
 // This creates the actual error, depending on whether X has a valid
 // nest type Result.
-template < typename X > struct TEST_RESULT { typedef typename X::Result type; };
+template <typename X> struct TEST_RESULT {
+  typedef typename X::Result type;
+};
 
 // Bool checking - a base template then specializations to succeed or
 // fail.
-template < bool VALUE > struct TEST_BOOL { };
+template <bool VALUE> struct TEST_BOOL {
+};
 // Successful test defines Result.
-template <> struct TEST_BOOL<true> { typedef int Result; };
+template <> struct TEST_BOOL<true> {
+  typedef int Result;
+};
 // Failing test does not define Result.
-template <> struct TEST_BOOL<false> { };
+template <> struct TEST_BOOL<false> {
+};
 
 // Fail to compile if VALUE is not true.
-template < bool VALUE > struct TEST_IF_TRUE
-  : public TEST_RESULT< TEST_BOOL< VALUE > > {
+template <bool VALUE> struct TEST_IF_TRUE : public TEST_RESULT<TEST_BOOL<VALUE> > {
 };
 
 // Helper for assigning a value to all instances in a container.
-template < typename T , typename R, typename A1 >
-struct TsAssignMember : public std::binary_function<T, A1, R> {
+template <typename T, typename R, typename A1> struct TsAssignMember : public std::binary_function<T, A1, R> {
   R T::*_m;
   A1 _arg1;
-  TsAssignMember(R T::*m, A1 const& arg1) : _m(m), _arg1(arg1) { }
-  R operator () (T& t) const { return t.*_m = _arg1; }
+  TsAssignMember(R T::*m, A1 const &arg1) : _m(m), _arg1(arg1) {}
+  R operator()(T &t) const { return t.*_m = _arg1; }
 };
 
 // Helper function to compute types for TsAssignMember.
-template < typename T, typename R, typename A1 > struct TsAssignMember<T,R,A1> assign_member(R T::*m, A1 const& arg1) { return TsAssignMember<T,R,A1>(m,arg1); }
+template <typename T, typename R, typename A1>
+struct TsAssignMember<T, R, A1>
+assign_member(R T::*m, A1 const &arg1) {
+  return TsAssignMember<T, R, A1>(m, arg1);
+}
 
 // Overload for_each to operate on a container.
-template < typename C, typename F > void for_each(C& c, F const& f) { std::for_each(c.begin(), c.end(), f); }
+template <typename C, typename F>
+void
+for_each(C &c, F const &f)
+{
+  std::for_each(c.begin(), c.end(), f);
+}
 
 /** Calc minimal value over a direct type container.
     This handles an accessor that takes a argument.
 */
-template < typename C, typename V, typename ARG1 > V
-minima(C const& c,  V (C::value_type::*ex)(ARG1) const, ARG1 const& arg1) {
+template <typename C, typename V, typename ARG1>
+V
+minima(C const &c, V (C::value_type::*ex)(ARG1) const, ARG1 const &arg1)
+{
   V v = std::numeric_limits<V>::max();
-  for ( typename C::const_iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) {
-    v = std::min(v, ((*spot).*ex)(arg1) );
+  for (typename C::const_iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot) {
+    v = std::min(v, ((*spot).*ex)(arg1));
   }
   return v;
 }
@@ -82,80 +94,73 @@ minima(C const& c,  V (C::value_type::*ex)(ARG1) const, ARG1 const& arg1) {
 /** Calc minimal value over a paired type container.
     This handles an accessor that takes a argument.
 */
-template < typename C, typename V, typename ARG1 > V
-minima(C const& c,  V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const& arg1) {
+template <typename C, typename V, typename ARG1>
+V
+minima(C const &c, V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const &arg1)
+{
   V v = std::numeric_limits<V>::max();
-  for ( typename C::const_iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) {
-    v = std::min(v, ((spot->second).*ex)(arg1) );
+  for (typename C::const_iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot) {
+    v = std::min(v, ((spot->second).*ex)(arg1));
   }
   return v;
 }
 
 /** Apply a unary method to every object in a direct container.
 */
-template < typename C, typename V, typename ARG1 > void
-for_each(C& c,  V (C::value_type::*ex)(ARG1), ARG1 const& arg1) {
-  for ( typename C::iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) ((*spot).*ex)(arg1);
+template <typename C, typename V, typename ARG1>
+void
+for_each(C &c, V (C::value_type::*ex)(ARG1), ARG1 const &arg1)
+{
+  for (typename C::iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot)
+    ((*spot).*ex)(arg1);
 }
 
 /** Apply a unary method to every object in a paired container.
 */
-template < typename C, typename V, typename ARG1 > void
-for_each(C& c,  V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const& arg1) {
-  for ( typename C::iterator spot = c.begin(), limit = c.end();
-        spot != limit;
-        ++spot
-  ) ((spot->second).*ex)(arg1);
+template <typename C, typename V, typename ARG1>
+void
+for_each(C &c, V (C::value_type::second_type::*ex)(ARG1) const, ARG1 const &arg1)
+{
+  for (typename C::iterator spot = c.begin(), limit = c.end(); spot != limit; ++spot)
+    ((spot->second).*ex)(arg1);
 }
 
-template <
-  typename Elt, ///< Element type.
-  typename Value ///< Member value type.
-> struct MemberPredicate {
-  Value const& m_value; ///< Value to test against.
-  Value Elt::*m_mptr; ///< Pointer to member to test.
-  MemberPredicate(Value Elt::*mptr, Value const& v)
-    : m_value(v)
-    , m_mptr(mptr) {
-  }
-  bool operator () (Elt const& elt) const {
-    return elt.*m_mptr == m_value;
-  }
+template <typename Elt,  ///< Element type.
+          typename Value ///< Member value type.
+          >
+struct MemberPredicate {
+  Value const &m_value; ///< Value to test against.
+  Value Elt::*m_mptr;   ///< Pointer to member to test.
+  MemberPredicate(Value Elt::*mptr, Value const &v) : m_value(v), m_mptr(mptr) {}
+  bool operator()(Elt const &elt) const { return elt.*m_mptr == m_value; }
 };
 
-template < typename T, typename V > MemberPredicate<T,V>
-predicate(V T::*m, V const& v) {
-  return MemberPredicate<T,V>(m, v);
+template <typename T, typename V>
+MemberPredicate<T, V>
+predicate(V T::*m, V const &v)
+{
+  return MemberPredicate<T, V>(m, v);
 }
 
-template <
-  typename Elt, ///< Element type.
-  typename Value ///< Member value type.
-> struct MethodPredicate {
+template <typename Elt,  ///< Element type.
+          typename Value ///< Member value type.
+          >
+struct MethodPredicate {
   typedef Value (Elt::*MethodPtr)() const;
-  Value const& m_value; ///< Value to test against.
-  MethodPtr m_mptr; ///< Pointer to method returning value.
-  MethodPredicate(MethodPtr mptr , Value const& v)
-    : m_value(v)
-    , m_mptr(mptr) {
-  }
-  bool operator () (Elt const& elt) const {
-    return (elt.*m_mptr)() == m_value;
-  }
+  Value const &m_value; ///< Value to test against.
+  MethodPtr m_mptr;     ///< Pointer to method returning value.
+  MethodPredicate(MethodPtr mptr, Value const &v) : m_value(v), m_mptr(mptr) {}
+  bool operator()(Elt const &elt) const { return (elt.*m_mptr)() == m_value; }
 };
 
-template < typename T, typename V > MethodPredicate<T,V>
-predicate(V (T::*m)() const, V const& v) {
-  return MethodPredicate<T,V>(m, v);
+template <typename T, typename V>
+MethodPredicate<T, V>
+predicate(V (T::*m)() const, V const &v)
+{
+  return MethodPredicate<T, V>(m, v);
 }
 
-# if 0
+#if 0
 
 /// Accumulate a minimum value when called repeated on different objects.
 template <
@@ -196,8 +201,8 @@ template <
   }
 };
 
-# endif
+#endif
 
 } // namespace ts
 
-# endif // TS_WCCP_META_HEADER
+#endif // TS_WCCP_META_HEADER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpMsg.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpMsg.cc b/lib/wccp/WccpMsg.cc
index 03d4191..c4ed4f9 100644
--- a/lib/wccp/WccpMsg.cc
+++ b/lib/wccp/WccpMsg.cc
@@ -20,29 +20,30 @@
     limitations under the License.
  */
 
-# include "WccpLocal.h"
-# include <errno.h>
-# include <openssl/md5.h>
-# include <TsException.h>
-# include "ink_memory.h"
-# include "ink_string.h"
-
-namespace wccp {
+#include "WccpLocal.h"
+#include <errno.h>
+#include <openssl/md5.h>
+#include <TsException.h>
+#include "ink_memory.h"
+#include "ink_string.h"
+
+namespace wccp
+{
 // ------------------------------------------------------
 // ------------------------------------------------------
-ServiceGroup&
-ServiceGroup::setSvcType(ServiceGroup::Type t) {
+ServiceGroup &
+ServiceGroup::setSvcType(ServiceGroup::Type t)
+{
   if (STANDARD == t) {
     // For standard service, everything past ID must be zero.
-    memset(&m_priority, 0,
-           sizeof(*this) - (reinterpret_cast<char*>(&m_priority) - reinterpret_cast<char*>(this)));
+    memset(&m_priority, 0, sizeof(*this) - (reinterpret_cast<char *>(&m_priority) - reinterpret_cast<char *>(this)));
   }
   m_svc_type = t; // store actual type.
   return *this;
 }
 
-bool
-ServiceGroup::operator == (self const& that) const {
+bool ServiceGroup::operator==(self const &that) const
+{
   if (m_svc_type == STANDARD) {
     // If type are different, fail, else if both are STANDARD
     // then we need only match on the ID.
@@ -53,46 +54,48 @@ ServiceGroup::operator == (self const& that) const {
     // Both services are DYNAMIC, check the properties.
     // Port check is technically too strict -- should ignore
     // ports beyond the terminating null port. Oh well.
-    return m_svc_id == that.m_svc_id
-      && m_protocol == that.m_protocol
-      && m_flags == that.m_flags
-      && m_priority == that.m_priority
-      && 0 == memcmp(m_ports, that.m_ports, sizeof(m_ports))
-      ;
+    return m_svc_id == that.m_svc_id && m_protocol == that.m_protocol && m_flags == that.m_flags && m_priority == that.m_priority &&
+           0 == memcmp(m_ports, that.m_ports, sizeof(m_ports));
   }
 }
 // ------------------------------------------------------
 // ------------------------------------------------------
-CacheHashIdElt&
-CacheHashIdElt::setBucket(int idx, bool state) {
-  uint8_t& bucket = m_buckets[idx>>3];
+CacheHashIdElt &
+CacheHashIdElt::setBucket(int idx, bool state)
+{
+  uint8_t &bucket = m_buckets[idx >> 3];
   uint8_t mask = 1 << (idx & 7);
-  if (state) bucket |= mask;
-  else bucket &= !mask;
+  if (state)
+    bucket |= mask;
+  else
+    bucket &= !mask;
   return *this;
 }
 
-CacheHashIdElt&
-CacheHashIdElt::setBuckets(bool state) {
+CacheHashIdElt &
+CacheHashIdElt::setBuckets(bool state)
+{
   memset(m_buckets, state ? 0xFF : 0, sizeof(m_buckets));
   return *this;
 }
 
-CacheIdBox::CacheIdBox()
-  : m_base(0)
-  , m_tail(0)
-  , m_size(0)
-  , m_cap(0) {
+CacheIdBox::CacheIdBox() : m_base(0), m_tail(0), m_size(0), m_cap(0)
+{
 }
 
-size_t CacheIdBox::getSize() const { return m_size; }
+size_t
+CacheIdBox::getSize() const
+{
+  return m_size;
+}
 
-CacheIdBox&
-CacheIdBox::require(size_t n) {
+CacheIdBox &
+CacheIdBox::require(size_t n)
+{
   if (m_cap < n) {
     if (m_base && m_cap)
       ats_free(m_base);
-    m_base = static_cast<CacheIdElt*>(ats_malloc(n));
+    m_base = static_cast<CacheIdElt *>(ats_malloc(n));
     m_cap = n;
   }
   memset(m_base, 0, m_cap);
@@ -100,24 +103,26 @@ CacheIdBox::require(size_t n) {
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::initDefaultHash(uint32_t addr) {
+CacheIdBox &
+CacheIdBox::initDefaultHash(uint32_t addr)
+{
   this->require(sizeof(CacheHashIdElt));
   m_size = sizeof(CacheHashIdElt);
   m_base->initHashRev().setUnassigned(true).setMask(false).setAddr(addr);
-  m_tail = static_cast<CacheHashIdElt*>(m_base)->getTailPtr();
+  m_tail = static_cast<CacheHashIdElt *>(m_base)->getTailPtr();
   m_tail->m_weight = htons(0);
   m_tail->m_status = htons(0);
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::initDefaultMask(uint32_t addr) {
+CacheIdBox &
+CacheIdBox::initDefaultMask(uint32_t addr)
+{
   // Base element plus set with 1 value plus tail.
   this->require(sizeof(CacheMaskIdElt) + MaskValueSetElt::calcSize(1) + sizeof(CacheIdElt::Tail));
-  CacheMaskIdElt* mid = static_cast<CacheMaskIdElt*>(m_base);
+  CacheMaskIdElt *mid = static_cast<CacheMaskIdElt *>(m_base);
   mid->initHashRev().setUnassigned(true).setMask(true).setAddr(addr);
-  mid->m_assign.init(0,0,0,0)->addValue(addr, 0, 0, 0, 0);
+  mid->m_assign.init(0, 0, 0, 0)->addValue(addr, 0, 0, 0, 0);
   m_size = mid->getSize();
   m_tail = mid->getTailPtr();
   m_tail->m_weight = htons(0);
@@ -125,44 +130,44 @@ CacheIdBox::initDefaultMask(uint32_t addr) {
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::fill(self const& src) {
+CacheIdBox &
+CacheIdBox::fill(self const &src)
+{
   size_t n = src.getSize();
   this->require(src.getSize());
   memcpy(m_base, src.m_base, n);
   m_size = src.m_size;
   // If tail is set in src, use the same offset here.
   if (src.m_tail)
-    m_tail = reinterpret_cast<CacheIdElt::Tail*>(
-      reinterpret_cast<char*>(m_base) + (
-        reinterpret_cast<char*>(src.m_tail)
-        - reinterpret_cast<char*>(src.m_base)
-    ));
-  else m_tail = 0;
+    m_tail = reinterpret_cast<CacheIdElt::Tail *>(reinterpret_cast<char *>(m_base) +
+                                                  (reinterpret_cast<char *>(src.m_tail) - reinterpret_cast<char *>(src.m_base)));
+  else
+    m_tail = 0;
   return *this;
 }
 
-CacheIdBox&
-CacheIdBox::fill(void* base, self const& src) {
+CacheIdBox &
+CacheIdBox::fill(void *base, self const &src)
+{
   m_size = src.getSize();
   m_cap = 0;
-  m_base = static_cast<CacheIdElt*>(base);
+  m_base = static_cast<CacheIdElt *>(base);
   memcpy(m_base, src.m_base, m_size);
   return *this;
 }
 
 int
-CacheIdBox::parse(MsgBuffer base) {
+CacheIdBox::parse(MsgBuffer base)
+{
   int zret = PARSE_SUCCESS;
-  CacheIdElt* ptr = reinterpret_cast<CacheIdElt*>(base.getTail());
+  CacheIdElt *ptr = reinterpret_cast<CacheIdElt *>(base.getTail());
   size_t n = base.getSpace();
   m_cap = 0;
   if (ptr->isMask()) {
-    CacheMaskIdElt* mptr = static_cast<CacheMaskIdElt*>(ptr);
+    CacheMaskIdElt *mptr = static_cast<CacheMaskIdElt *>(ptr);
     size_t size = sizeof(CacheMaskIdElt);
     // Sanity check - verify enough room for empty elements.
-    if (n < size
-      || n < size + MaskValueSetElt::calcSize(0) * mptr->getCount()) {
+    if (n < size || n < size + MaskValueSetElt::calcSize(0) * mptr->getCount()) {
       zret = PARSE_BUFFER_TOO_SMALL;
     } else {
       m_size = mptr->getSize();
@@ -179,107 +184,119 @@ CacheIdBox::parse(MsgBuffer base) {
       logf(LVL_DEBUG, "I_SEE_YOU Cache Hash ID too small: %lu < %lu", n, sizeof(CacheHashIdElt));
     } else {
       m_size = sizeof(CacheHashIdElt);
-      m_tail = static_cast<CacheHashIdElt*>(m_base)->getTailPtr();
+      m_tail = static_cast<CacheHashIdElt *>(m_base)->getTailPtr();
     }
   }
-  if (PARSE_SUCCESS == zret) m_base = ptr;
+  if (PARSE_SUCCESS == zret)
+    m_base = ptr;
   return zret;
 }
 // ------------------------------------------------------
 inline CapabilityElt::Type
-CapabilityElt::getCapType() const {
+CapabilityElt::getCapType() const
+{
   return static_cast<Type>(ntohs(m_cap_type));
 }
 
-inline CapabilityElt&
-CapabilityElt::setCapType(Type cap) {
+inline CapabilityElt &
+CapabilityElt::setCapType(Type cap)
+{
   m_cap_type = htons(cap);
   return *this;
 }
 
 inline uint32_t
-CapabilityElt::getCapData() const {
+CapabilityElt::getCapData() const
+{
   return ntohl(m_cap_data);
 }
 
-inline CapabilityElt&
-CapabilityElt::setCapData(uint32_t data) {
+inline CapabilityElt &
+CapabilityElt::setCapData(uint32_t data)
+{
   m_cap_data = htonl(data);
   return *this;
 }
 
-CapabilityElt::CapabilityElt() {
+CapabilityElt::CapabilityElt()
+{
 }
 
-CapabilityElt::CapabilityElt(Type cap, uint32_t data) {
+CapabilityElt::CapabilityElt(Type cap, uint32_t data)
+{
   this->setCapType(cap);
   this->setCapData(data);
   m_cap_length = htons(sizeof(uint32_t));
 }
 // ------------------------------------------------------
 inline uint32_t
-ValueElt::getf_src_addr() const {
+ValueElt::getf_src_addr() const
+{
   return ntohl(m_src_addr);
 }
 
-inline ValueElt&
-ValueElt::setf_src_addr(uint32_t addr) {
+inline ValueElt &
+ValueElt::setf_src_addr(uint32_t addr)
+{
   m_src_addr = htonl(addr);
   return *this;
 }
 
 inline uint32_t
-ValueElt::getDstAddr() const {
+ValueElt::getDstAddr() const
+{
   return ntohl(m_dst_addr);
 }
 
-inline ValueElt&
-ValueElt::setf_dst_addr(uint32_t addr) {
+inline ValueElt &
+ValueElt::setf_dst_addr(uint32_t addr)
+{
   m_dst_addr = htonl(addr);
   return *this;
 }
 
 inline uint16_t
-ValueElt::getf_src_port() const {
+ValueElt::getf_src_port() const
+{
   return ntohs(m_src_port);
 }
 
-inline ValueElt&
-ValueElt::setf_src_port(uint16_t port) {
+inline ValueElt &
+ValueElt::setf_src_port(uint16_t port)
+{
   m_src_port = htons(port);
   return *this;
 }
 
 inline uint16_t
-ValueElt::getDstPort() const {
+ValueElt::getDstPort() const
+{
   return ntohs(m_dst_port);
 }
 
-inline ValueElt&
-ValueElt::setf_dst_port(uint16_t port) {
+inline ValueElt &
+ValueElt::setf_dst_port(uint16_t port)
+{
   m_dst_port = htons(port);
   return *this;
 }
 
 inline uint32_t
-ValueElt::getCacheAddr() const {
+ValueElt::getCacheAddr() const
+{
   return ntohl(m_cache_addr);
 }
 
-inline ValueElt&
-ValueElt::setCacheAddr(uint32_t addr) {
+inline ValueElt &
+ValueElt::setCacheAddr(uint32_t addr)
+{
   m_cache_addr = htonl(addr);
   return *this;
 }
 // ------------------------------------------------------
-MaskValueSetElt&
-MaskValueSetElt::addValue(
-  uint32_t cacheAddr,
-  uint32_t srcAddr,
-  uint32_t dstAddr,
-  uint16_t srcPort,
-  uint16_t dstPort
-) {
+MaskValueSetElt &
+MaskValueSetElt::addValue(uint32_t cacheAddr, uint32_t srcAddr, uint32_t dstAddr, uint16_t srcPort, uint16_t dstPort)
+{
   uint32_t idx = ntohl(m_count);
   new (this->values() + idx) ValueElt(cacheAddr, srcAddr, dstAddr, srcPort, dstPort);
   m_count = htonl(idx + 1);
@@ -287,45 +304,44 @@ MaskValueSetElt::addValue(
 }
 
 size_t
-MaskAssignElt::getVarSize() const {
+MaskAssignElt::getVarSize() const
+{
   size_t zret = 0;
   int n = this->getCount();
 
-  MaskValueSetElt const* set = reinterpret_cast<MaskValueSetElt const*>(this+1);
+  MaskValueSetElt const *set = reinterpret_cast<MaskValueSetElt const *>(this + 1);
   while (n--) {
     size_t k = set->getSize();
     zret += k;
-    set = reinterpret_cast<MaskValueSetElt const*>(
-      reinterpret_cast<char const*>(set) + k
-    );
+    set = reinterpret_cast<MaskValueSetElt const *>(reinterpret_cast<char const *>(set) + k);
   }
   return zret;
 }
 
-HashAssignElt&
-HashAssignElt::round_robin_assign() {
+HashAssignElt &
+HashAssignElt::round_robin_assign()
+{
   uint32_t v_caches = this->getCount();
-  Bucket* buckets = this->getBucketBase();
-  if (1 == v_caches) memset(buckets, 0, sizeof(Bucket) * N_BUCKETS);
+  Bucket *buckets = this->getBucketBase();
+  if (1 == v_caches)
+    memset(buckets, 0, sizeof(Bucket) * N_BUCKETS);
   else { // Assign round robin.
     size_t x = 0;
-    for ( Bucket *spot = buckets, *limit = spot + N_BUCKETS;
-          spot < limit;
-          ++spot
-    ) {
+    for (Bucket *spot = buckets, *limit = spot + N_BUCKETS; spot < limit; ++spot) {
       spot->m_idx = x;
       spot->m_alt = 0;
-      x = ( x + 1 ) % v_caches;
+      x = (x + 1) % v_caches;
     }
   }
   return *this;
 }
 
-RouterAssignListElt&
-RouterAssignListElt::updateRouterId(uint32_t addr, uint32_t rcvid, uint32_t cno) {
+RouterAssignListElt &
+RouterAssignListElt::updateRouterId(uint32_t addr, uint32_t rcvid, uint32_t cno)
+{
   uint32_t n = this->getCount();
-  RouterAssignElt* elt = access_array<RouterAssignElt>(this+1);
-  for ( uint32_t i = 0 ; i < n ; ++i, ++elt ) {
+  RouterAssignElt *elt = access_array<RouterAssignElt>(this + 1);
+  for (uint32_t i = 0; i < n; ++i, ++elt) {
     if (addr == elt->getAddr()) {
       elt->setChangeNumber(cno).setRecvId(rcvid);
       break;
@@ -335,45 +351,53 @@ RouterAssignListElt::updateRouterId(uint32_t addr, uint32_t rcvid, uint32_t cno)
 }
 // ------------------------------------------------------
 message_type_t
-MsgHeaderComp::getType() {
+MsgHeaderComp::getType()
+{
   return static_cast<message_type_t>(get_field(&raw_t::m_type, m_base));
 }
 
 uint16_t
-MsgHeaderComp::getVersion() {
+MsgHeaderComp::getVersion()
+{
   return get_field(&raw_t::m_version, m_base);
 }
 
 uint16_t
-MsgHeaderComp::getLength() {
+MsgHeaderComp::getLength()
+{
   return get_field(&raw_t::m_length, m_base);
 }
 
-MsgHeaderComp&
-MsgHeaderComp::setType(message_type_t type) {
+MsgHeaderComp &
+MsgHeaderComp::setType(message_type_t type)
+{
   set_field(&raw_t::m_type, m_base, type);
   return *this;
 }
 
-MsgHeaderComp&
-MsgHeaderComp::setVersion(uint16_t version) {
+MsgHeaderComp &
+MsgHeaderComp::setVersion(uint16_t version)
+{
   set_field(&raw_t::m_version, m_base, version);
   return *this;
 }
 
-MsgHeaderComp&
-MsgHeaderComp::setLength(uint16_t length) {
+MsgHeaderComp &
+MsgHeaderComp::setLength(uint16_t length)
+{
   set_field(&raw_t::m_length, m_base, length);
   return *this;
 }
 
 size_t
-MsgHeaderComp::calcSize() {
+MsgHeaderComp::calcSize()
+{
   return sizeof(raw_t);
 }
 
-MsgHeaderComp&
-MsgHeaderComp::fill(MsgBuffer& buffer, message_type_t t) {
+MsgHeaderComp &
+MsgHeaderComp::fill(MsgBuffer &buffer, message_type_t t)
+{
   size_t comp_size = this->calcSize();
   if (buffer.getSpace() < comp_size)
     throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
@@ -384,7 +408,8 @@ MsgHeaderComp::fill(MsgBuffer& buffer, message_type_t t) {
 }
 
 int
-MsgHeaderComp::parse(MsgBuffer& base) {
+MsgHeaderComp::parse(MsgBuffer &base)
+{
   int zret = PARSE_SUCCESS;
   size_t comp_size = this->calcSize();
   if (base.getSpace() < comp_size) {
@@ -394,8 +419,7 @@ MsgHeaderComp::parse(MsgBuffer& base) {
     // Length field puts end of message past end of buffer.
     if (this->getLength() + comp_size > base.getSpace()) {
       zret = PARSE_MSG_TOO_BIG;
-    } else if (INVALID_MSG_TYPE == this->toMsgType(get_field(&raw_t::m_type, m_base))
-    ) {
+    } else if (INVALID_MSG_TYPE == this->toMsgType(get_field(&raw_t::m_type, m_base))) {
       zret = PARSE_COMP_TYPE_INVALID;
     } else {
       base.use(comp_size);
@@ -408,30 +432,35 @@ SecurityComp::Key SecurityComp::m_default_key;
 SecurityComp::Option SecurityComp::m_default_opt = SECURITY_NONE;
 
 SecurityComp::Option
-SecurityComp::getOption() const {
+SecurityComp::getOption() const
+{
   return static_cast<Option>(get_field(&RawNone::m_option, m_base));
 }
 
-SecurityComp&
-SecurityComp::setOption(Option opt) {
+SecurityComp &
+SecurityComp::setOption(Option opt)
+{
   set_field(&RawNone::m_option, m_base, static_cast<uint32_t>(opt));
   return *this;
 }
 
-SecurityComp&
-SecurityComp::setKey(char const* key) {
+SecurityComp &
+SecurityComp::setKey(char const *key)
+{
   m_local_key = true;
   strncpy(m_key, key, KEY_SIZE);
   return *this;
 }
 
 void
-SecurityComp::setDefaultKey(char const* key) {
+SecurityComp::setDefaultKey(char const *key)
+{
   strncpy(m_default_key, key, KEY_SIZE);
 }
 
-SecurityComp&
-SecurityComp::fill(MsgBuffer& buffer, Option opt) {
+SecurityComp &
+SecurityComp::fill(MsgBuffer &buffer, Option opt)
+{
   size_t comp_size = this->calcSize(opt);
 
   if (buffer.getSpace() < comp_size)
@@ -439,13 +468,10 @@ SecurityComp::fill(MsgBuffer& buffer, Option opt) {
 
   m_base = buffer.getTail();
 
-  this->setType(COMP_TYPE)
-    .setLength(comp_size - sizeof(super::raw_t))
-    .setOption(opt)
-    ;
+  this->setType(COMP_TYPE).setLength(comp_size - sizeof(super::raw_t)).setOption(opt);
 
   if (SECURITY_NONE != opt) {
-    RawMD5::HashData& data = access_field(&RawMD5::m_data, m_base);
+    RawMD5::HashData &data = access_field(&RawMD5::m_data, m_base);
     memset(data, 0, sizeof(data));
   }
 
@@ -453,11 +479,12 @@ SecurityComp::fill(MsgBuffer& buffer, Option opt) {
   return *this;
 }
 
-SecurityComp&
-SecurityComp::secure(MsgBuffer const& msg) {
+SecurityComp &
+SecurityComp::secure(MsgBuffer const &msg)
+{
   if (SECURITY_MD5 == this->getOption()) {
     MD5_CTX ctx;
-    char const* key = m_local_key ? m_key : m_default_key;
+    char const *key = m_local_key ? m_key : m_default_key;
     MD5_Init(&ctx);
     MD5_Update(&ctx, key, KEY_SIZE);
     MD5_Update(&ctx, msg.getBase(), msg.getCount());
@@ -467,13 +494,14 @@ SecurityComp::secure(MsgBuffer const& msg) {
 }
 
 bool
-SecurityComp::validate(MsgBuffer const& msg) const {
+SecurityComp::validate(MsgBuffer const &msg) const
+{
   bool zret = true;
   if (SECURITY_MD5 == this->getOption()) {
     RawMD5::HashData save;
-    RawMD5::HashData& org = const_cast<RawMD5::HashData&>(access_field(&RawMD5::m_data, m_base));
+    RawMD5::HashData &org = const_cast<RawMD5::HashData &>(access_field(&RawMD5::m_data, m_base));
     MD5_CTX ctx;
-    char const* key = m_local_key ? m_key : m_default_key;
+    char const *key = m_local_key ? m_key : m_default_key;
     // save the original hash aside.
     memcpy(save, org, sizeof(save));
     // zero out the component hash area to compute the hash.
@@ -492,14 +520,15 @@ SecurityComp::validate(MsgBuffer const& msg) const {
 }
 
 int
-SecurityComp::parse(MsgBuffer& buffer) {
+SecurityComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       Option opt = this->getOption();
       if (SECURITY_NONE != opt && SECURITY_MD5 != opt)
         zret = PARSE_COMP_INVALID;
@@ -516,29 +545,33 @@ SecurityComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 
-ServiceComp&
-ServiceComp::setPort(int idx, uint16_t port) {
+ServiceComp &
+ServiceComp::setPort(int idx, uint16_t port)
+{
   this->access()->setPort(idx, port);
   m_port_count = std::max(m_port_count, idx);
   return *this;
 }
 
-ServiceComp&
-ServiceComp::addPort(uint16_t port) {
+ServiceComp &
+ServiceComp::addPort(uint16_t port)
+{
   if (m_port_count < static_cast<int>(ServiceGroup::N_PORTS))
     this->access()->setPort(m_port_count++, port);
   return *this;
 }
 
-ServiceComp&
-ServiceComp::clearPorts() {
+ServiceComp &
+ServiceComp::clearPorts()
+{
   this->access()->clearPorts();
   m_port_count = 0;
   return *this;
 }
 
-ServiceComp&
-ServiceComp::fill(MsgBuffer& buffer, ServiceGroup const& svc) {
+ServiceComp &
+ServiceComp::fill(MsgBuffer &buffer, ServiceGroup const &svc)
+{
   size_t comp_size = this->calcSize();
 
   if (buffer.getSpace() < comp_size)
@@ -552,17 +585,15 @@ ServiceComp::fill(MsgBuffer& buffer, ServiceGroup const& svc) {
   // to get offset of that part of the serialization storage.
   memcpy(
     // This generates a gcc warning, but the next line doesn't. Yay.
-//    static_cast<ServiceGroup*>(reinterpret_cast<raw_t*>(m_base)),
-    &static_cast<ServiceGroup&>(*reinterpret_cast<raw_t*>(m_base)),
-    &svc,
-    sizeof(svc)
-  );
+    //    static_cast<ServiceGroup*>(reinterpret_cast<raw_t*>(m_base)),
+    &static_cast<ServiceGroup &>(*reinterpret_cast<raw_t *>(m_base)), &svc, sizeof(svc));
   buffer.use(comp_size);
   return *this;
 }
 
 int
-ServiceComp::parse(MsgBuffer& buffer) {
+ServiceComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   size_t comp_size = this->calcSize();
   if (buffer.getSpace() < comp_size)
@@ -570,8 +601,8 @@ ServiceComp::parse(MsgBuffer& buffer) {
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
-      ServiceGroup::Type svc  = this->getSvcType();
+    if (PARSE_SUCCESS == zret) {
+      ServiceGroup::Type svc = this->getSvcType();
       if (ServiceGroup::DYNAMIC != svc && ServiceGroup::STANDARD != svc)
         zret = PARSE_COMP_INVALID;
       else if (this->getLength() != comp_size - sizeof(super::raw_t))
@@ -583,75 +614,95 @@ ServiceComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-RouterIdElt&
-RouterIdComp::idElt() {
+RouterIdElt &
+RouterIdComp::idElt()
+{
   return access_field(&raw_t::m_id, m_base);
 }
 
-RouterIdElt const&
-RouterIdComp::idElt() const {
+RouterIdElt const &
+RouterIdComp::idElt() const
+{
   return access_field(&raw_t::m_id, m_base);
 }
 
-RouterIdComp&
-RouterIdComp::setIdElt(uint32_t addr, uint32_t recv_id) {
+RouterIdComp &
+RouterIdComp::setIdElt(uint32_t addr, uint32_t recv_id)
+{
   this->idElt().setAddr(addr).setRecvId(recv_id);
   return *this;
 }
 
-uint32_t RouterIdComp::getAddr() const { return this->idElt().getAddr(); }
+uint32_t
+RouterIdComp::getAddr() const
+{
+  return this->idElt().getAddr();
+}
 
-RouterIdComp&
-RouterIdComp::setAddr(uint32_t addr) {
+RouterIdComp &
+RouterIdComp::setAddr(uint32_t addr)
+{
   this->idElt().setAddr(addr);
   return *this;
 }
 
-uint32_t RouterIdComp::getRecvId() const { return this->idElt().getRecvId();}
-inline RouterIdComp&
-RouterIdComp::setRecvId(uint32_t id) {
+uint32_t
+RouterIdComp::getRecvId() const
+{
+  return this->idElt().getRecvId();
+}
+inline RouterIdComp &
+RouterIdComp::setRecvId(uint32_t id)
+{
   this->idElt().setRecvId(id);
   return *this;
 }
 
 uint32_t
-RouterIdComp::getToAddr() const {
+RouterIdComp::getToAddr() const
+{
   return access_field(&raw_t::m_to_addr, m_base);
 }
 
-RouterIdComp&
-RouterIdComp::setToAddr(uint32_t addr) {
+RouterIdComp &
+RouterIdComp::setToAddr(uint32_t addr)
+{
   access_field(&raw_t::m_to_addr, m_base) = addr;
   return *this;
 }
 
 uint32_t
-RouterIdComp::getFromCount() const {
+RouterIdComp::getFromCount() const
+{
   return get_field(&raw_t::m_from_count, m_base);
 }
 
 uint32_t
-RouterIdComp::getFromAddr(int idx) const {
+RouterIdComp::getFromAddr(int idx) const
+{
   return access_array<uint32_t>(m_base + sizeof(raw_t))[idx];
 }
 
-RouterIdComp&
-RouterIdComp::setFromAddr(int idx, uint32_t addr) {
-  access_array<uint32_t>(m_base + sizeof(raw_t))[idx] =  addr;
+RouterIdComp &
+RouterIdComp::setFromAddr(int idx, uint32_t addr)
+{
+  access_array<uint32_t>(m_base + sizeof(raw_t))[idx] = addr;
   return *this;
 }
 
 int
-RouterIdComp::findFromAddr(uint32_t addr) {
+RouterIdComp::findFromAddr(uint32_t addr)
+{
   int n = this->getFromCount();
-  uint32_t* addrs = access_array<uint32_t>(m_base + sizeof(raw_t)) + n;
+  uint32_t *addrs = access_array<uint32_t>(m_base + sizeof(raw_t)) + n;
   while (n-- != 0 && *--addrs != addr)
     ;
   return n;
 }
 
-RouterIdComp&
-RouterIdComp::fill(MsgBuffer& buffer, size_t n_caches) {
+RouterIdComp &
+RouterIdComp::fill(MsgBuffer &buffer, size_t n_caches)
+{
   size_t comp_size = this->calcSize(n_caches);
   if (buffer.getSpace() < comp_size)
     throw ts::Exception(BUFFER_TOO_SMALL_FOR_COMP_TEXT);
@@ -666,14 +717,9 @@ RouterIdComp::fill(MsgBuffer& buffer, size_t n_caches) {
   return *this;
 }
 
-RouterIdComp&
-RouterIdComp::fillSingleton(
-  MsgBuffer& buffer,
-  uint32_t addr,
-  uint32_t recv_count,
-  uint32_t to_addr,
-  uint32_t from_addr
-) {
+RouterIdComp &
+RouterIdComp::fillSingleton(MsgBuffer &buffer, uint32_t addr, uint32_t recv_count, uint32_t to_addr, uint32_t from_addr)
+{
   size_t comp_size = this->calcSize(1);
 
   if (buffer.getSpace() < comp_size)
@@ -681,11 +727,7 @@ RouterIdComp::fillSingleton(
 
   m_base = buffer.getTail();
 
-  this->setType(COMP_TYPE)
-    .setIdElt(addr, recv_count)
-    .setToAddr(to_addr)
-    .setFromAddr(0, from_addr)
-    ;
+  this->setType(COMP_TYPE).setIdElt(addr, recv_count).setToAddr(to_addr).setFromAddr(0, from_addr);
 
   set_field(&raw_t::m_from_count, m_base, 1);
 
@@ -696,7 +738,8 @@ RouterIdComp::fillSingleton(
 }
 
 int
-RouterIdComp::parse(MsgBuffer& buffer) {
+RouterIdComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
@@ -714,67 +757,71 @@ RouterIdComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-AssignmentKeyElt&
-RouterViewComp::keyElt() {
+AssignmentKeyElt &
+RouterViewComp::keyElt()
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-AssignmentKeyElt const&
-RouterViewComp::keyElt() const {
+AssignmentKeyElt const &
+RouterViewComp::keyElt() const
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
 uint32_t
-RouterViewComp::getChangeNumber() const {
+RouterViewComp::getChangeNumber() const
+{
   return get_field(&raw_t::m_change_number, m_base);
 }
 
-RouterViewComp&
-RouterViewComp::setChangeNumber(uint32_t n) {
+RouterViewComp &
+RouterViewComp::setChangeNumber(uint32_t n)
+{
   set_field(&raw_t::m_change_number, m_base, n);
   return *this;
 }
 
 uint32_t
-RouterViewComp::getCacheCount() const {
+RouterViewComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 uint32_t
-RouterViewComp::getRouterCount() const {
+RouterViewComp::getRouterCount() const
+{
   return get_field(&raw_t::m_router_count, m_base);
 }
 
-CacheIdBox&
-RouterViewComp::cacheId(int idx) {
+CacheIdBox &
+RouterViewComp::cacheId(int idx)
+{
   return m_cache_ids[idx];
 }
 
 uint32_t
-RouterViewComp::getRouterAddr(int idx) const {
+RouterViewComp::getRouterAddr(int idx) const
+{
   return access_array<uint32_t>(m_base + sizeof(raw_t))[idx];
 }
 
-RouterViewComp&
-RouterViewComp::setRouterAddr(int idx, uint32_t addr) {
+RouterViewComp &
+RouterViewComp::setRouterAddr(int idx, uint32_t addr)
+{
   access_array<uint32_t>(m_base + sizeof(raw_t))[idx] = addr;
   return *this;
 }
 
-uint32_t*
-RouterViewComp::calc_cache_count_ptr() {
-  return reinterpret_cast<uint32_t*>(
-    m_base + sizeof(raw_t)
-    + this->getRouterCount() * sizeof(uint32_t)
-  );
+uint32_t *
+RouterViewComp::calc_cache_count_ptr()
+{
+  return reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + this->getRouterCount() * sizeof(uint32_t));
 }
 
-RouterViewComp&
-RouterViewComp::fill(
-  MsgBuffer& buffer,
-  int n_routers,
-  int n_caches
-) {
+RouterViewComp &
+RouterViewComp::fill(MsgBuffer &buffer, int n_routers, int n_caches)
+{
   // TBD: This isn't right since the upgrade to mask support
   // because the size isn't a static function of the router and
   // cache count anymore.
@@ -801,46 +848,49 @@ RouterViewComp::fill(
 }
 
 int
-RouterViewComp::parse(MsgBuffer& buffer) {
+RouterViewComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       uint32_t ncaches; // # of caches.
-      if (this->getRouterCount() > MAX_ROUTERS) zret = PARSE_MSG_INVALID;
+      if (this->getRouterCount() > MAX_ROUTERS)
+        zret = PARSE_MSG_INVALID;
       // check if cache count is past end of buffer
-      else if (static_cast<void*>(m_cache_count = this->calc_cache_count_ptr())
-        >= static_cast<void*>(buffer.getBase() + buffer.getSize())
-      )
+      else if (static_cast<void *>(m_cache_count = this->calc_cache_count_ptr()) >=
+               static_cast<void *>(buffer.getBase() + buffer.getSize()))
         zret = PARSE_COMP_WRONG_SIZE, log(LVL_DEBUG, "I_SEE_YOU: cache counter past end of buffer");
       else if ((ncaches = this->getCacheCount()) > MAX_CACHES)
         zret = PARSE_MSG_INVALID;
       else {
-        size_t comp_size = reinterpret_cast<char*>(m_cache_count+1) - m_base;
+        size_t comp_size = reinterpret_cast<char *>(m_cache_count + 1) - m_base;
         // Walk the cache ID elements.
         MsgBuffer spot(buffer);
-        CacheIdBox* box = m_cache_ids;
+        CacheIdBox *box = m_cache_ids;
         uint32_t idx = 0;
         spot.use(comp_size);
-        while ( idx < ncaches && PARSE_SUCCESS == (zret = box->parse(spot))) {
+        while (idx < ncaches && PARSE_SUCCESS == (zret = box->parse(spot))) {
           size_t k = box->getSize();
           spot.use(k);
           comp_size += k;
           ++box;
           ++idx;
         }
-        if (PARSE_SUCCESS == zret) buffer.use(comp_size);
+        if (PARSE_SUCCESS == zret)
+          buffer.use(comp_size);
       }
     }
   }
   return zret;
 }
 // ------------------------------------------------------
-CacheIdComp&
-CacheIdComp::fill(MsgBuffer& base, CacheIdBox const& src) {
+CacheIdComp &
+CacheIdComp::fill(MsgBuffer &base, CacheIdBox const &src)
+{
   size_t comp_size = src.getSize() + HEADER_SIZE;
 
   if (base.getSpace() < comp_size)
@@ -854,16 +904,17 @@ CacheIdComp::fill(MsgBuffer& base, CacheIdBox const& src) {
 }
 
 int
-CacheIdComp::parse(MsgBuffer& buffer) {
+CacheIdComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       MsgBuffer tmp(buffer);
-      tmp.use(reinterpret_cast<char*>(&(access_field(&raw_t::m_id, m_base))) - m_base);
+      tmp.use(reinterpret_cast<char *>(&(access_field(&raw_t::m_id, m_base))) - m_base);
       zret = m_box.parse(tmp);
       if (PARSE_SUCCESS == zret) {
         size_t comp_size = HEADER_SIZE + m_box.getSize();
@@ -878,72 +929,74 @@ CacheIdComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 uint32_t
-CacheViewComp::getChangeNumber() const {
+CacheViewComp::getChangeNumber() const
+{
   return get_field(&raw_t::m_change_number, m_base);
 }
 
-CacheViewComp&
-CacheViewComp::setChangeNumber(uint32_t n) {
+CacheViewComp &
+CacheViewComp::setChangeNumber(uint32_t n)
+{
   set_field(&raw_t::m_change_number, m_base, n);
   return *this;
 }
 
 uint32_t
-CacheViewComp::getRouterCount() const {
+CacheViewComp::getRouterCount() const
+{
   return get_field(&raw_t::m_router_count, m_base);
 }
 
 uint32_t
-CacheViewComp::getCacheCount() const {
+CacheViewComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 uint32_t
-CacheViewComp::getCacheAddr(int idx) const {
-  return ntohl(m_cache_count[idx+1]);
+CacheViewComp::getCacheAddr(int idx) const
+{
+  return ntohl(m_cache_count[idx + 1]);
 }
 
-CacheViewComp&
-CacheViewComp::setCacheAddr(int idx, uint32_t addr) {
-  m_cache_count[idx+1] = addr;
+CacheViewComp &
+CacheViewComp::setCacheAddr(int idx, uint32_t addr)
+{
+  m_cache_count[idx + 1] = addr;
   return *this;
 }
 
-RouterIdElt*
-CacheViewComp::atf_router_array() {
-  return reinterpret_cast<RouterIdElt*>(m_base + sizeof(raw_t));
+RouterIdElt *
+CacheViewComp::atf_router_array()
+{
+  return reinterpret_cast<RouterIdElt *>(m_base + sizeof(raw_t));
 }
 
-RouterIdElt&
-CacheViewComp::routerElt(int idx) {
+RouterIdElt &
+CacheViewComp::routerElt(int idx)
+{
   return this->atf_router_array()[idx];
 }
 
-RouterIdElt*
-CacheViewComp::findf_router_elt(uint32_t addr) {
-  for ( RouterIdElt *rtr = this->atf_router_array(),
-          *limit = rtr + this->getRouterCount() ;
-        rtr < limit;
-        ++rtr
-  ) {
-    if (rtr->getAddr() == addr) return rtr;
+RouterIdElt *
+CacheViewComp::findf_router_elt(uint32_t addr)
+{
+  for (RouterIdElt *rtr = this->atf_router_array(), *limit = rtr + this->getRouterCount(); rtr < limit; ++rtr) {
+    if (rtr->getAddr() == addr)
+      return rtr;
   }
   return 0;
 }
 
 size_t
-CacheViewComp::calcSize(int n_routers, int n_caches) {
-  return sizeof(raw_t)
-    + n_routers * sizeof(RouterIdElt)
-    + sizeof(uint32_t) + n_caches * sizeof(uint32_t)
-    ;
+CacheViewComp::calcSize(int n_routers, int n_caches)
+{
+  return sizeof(raw_t) + n_routers * sizeof(RouterIdElt) + sizeof(uint32_t) + n_caches * sizeof(uint32_t);
 }
 
-CacheViewComp&
-CacheViewComp::fill(
-  MsgBuffer& buffer,
-  detail::cache::GroupData const& group
-) {
+CacheViewComp &
+CacheViewComp::fill(MsgBuffer &buffer, detail::cache::GroupData const &group)
+{
   int i;
   size_t n_routers = group.m_routers.size();
   size_t n_caches = group.m_caches.size();
@@ -958,31 +1011,20 @@ CacheViewComp::fill(
 
   set_field(&raw_t::m_router_count, m_base, n_routers);
   // Set the pointer to the count of caches.
-  m_cache_count = reinterpret_cast<uint32_t*>(
-    m_base + sizeof(raw_t) + n_routers * sizeof(RouterIdElt)
-  );
+  m_cache_count = reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + n_routers * sizeof(RouterIdElt));
   *m_cache_count = htonl(n_caches); // set the actual count.
 
   // Fill routers.
   i = 0;
-  for ( detail::cache::RouterBag::const_iterator spot = group.m_routers.begin(),
-          limit = group.m_routers.end();
-        spot != limit;
-        ++spot, ++i
-  ) {
-    this->routerElt(i)
-      .setAddr(spot->m_addr)
-      .setRecvId(spot->m_recv.m_sn)
-      ;
+  for (detail::cache::RouterBag::const_iterator spot = group.m_routers.begin(), limit = group.m_routers.end(); spot != limit;
+       ++spot, ++i) {
+    this->routerElt(i).setAddr(spot->m_addr).setRecvId(spot->m_recv.m_sn);
   }
 
   // fill caches.
   i = 0;
-  for ( detail::cache::CacheBag::const_iterator spot = group.m_caches.begin(),
-          limit = group.m_caches.end();
-        spot != limit;
-        ++spot, ++i
-  ) {
+  for (detail::cache::CacheBag::const_iterator spot = group.m_caches.begin(), limit = group.m_caches.end(); spot != limit;
+       ++spot, ++i) {
     this->setCacheAddr(i, spot->idAddr());
   }
 
@@ -992,18 +1034,16 @@ CacheViewComp::fill(
 }
 
 int
-CacheViewComp::parse(MsgBuffer& buffer) {
+CacheViewComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
-      m_cache_count = reinterpret_cast<uint32_t*>(
-        m_base + sizeof(raw_t)
-        + this->getRouterCount() * sizeof(RouterIdElt)
-      );
+    if (PARSE_SUCCESS == zret) {
+      m_cache_count = reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + this->getRouterCount() * sizeof(RouterIdElt));
       size_t comp_size = this->calcSize(this->getRouterCount(), this->getCacheCount());
       if (this->getLength() != comp_size - sizeof(super::raw_t))
         zret = PARSE_COMP_WRONG_SIZE;
@@ -1014,92 +1054,98 @@ CacheViewComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-AssignmentKeyElt&
-AssignInfoComp::keyElt() {
+AssignmentKeyElt &
+AssignInfoComp::keyElt()
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-AssignmentKeyElt const&
-AssignInfoComp::keyElt() const {
+AssignmentKeyElt const &
+AssignInfoComp::keyElt() const
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
 uint32_t
-AssignInfoComp::getKeyChangeNumber() const {
+AssignInfoComp::getKeyChangeNumber() const
+{
   return access_field(&raw_t::m_key, m_base).getChangeNumber();
 }
 
-AssignInfoComp&
-AssignInfoComp::setKeyChangeNumber(uint32_t n) {
+AssignInfoComp &
+AssignInfoComp::setKeyChangeNumber(uint32_t n)
+{
   access_field(&raw_t::m_key, m_base).setChangeNumber(n);
   return *this;
 }
 
 uint32_t
-AssignInfoComp::getKeyAddr() const {
+AssignInfoComp::getKeyAddr() const
+{
   return access_field(&raw_t::m_key, m_base).getAddr();
 }
 
-AssignInfoComp&
-AssignInfoComp::setKeyAddr(uint32_t addr) {
+AssignInfoComp &
+AssignInfoComp::setKeyAddr(uint32_t addr)
+{
   access_field(&raw_t::m_key, m_base).setAddr(addr);
   return *this;
 }
 
 uint32_t
-AssignInfoComp::getRouterCount() const {
+AssignInfoComp::getRouterCount() const
+{
   return access_field(&raw_t::m_routers, m_base).getCount();
 }
 
-RouterAssignElt&
-AssignInfoComp::routerElt(int idx) {
+RouterAssignElt &
+AssignInfoComp::routerElt(int idx)
+{
   return access_field(&raw_t::m_routers, m_base).elt(idx);
 }
 
 uint32_t
-AssignInfoComp::getCacheCount() const {
+AssignInfoComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 uint32_t
-AssignInfoComp::getCacheAddr(int idx) const {
-  return m_cache_count[idx+1];
+AssignInfoComp::getCacheAddr(int idx) const
+{
+  return m_cache_count[idx + 1];
 }
 
-AssignInfoComp&
-AssignInfoComp::setCacheAddr(int idx, uint32_t addr) {
-  m_cache_count[idx+1] = addr;
+AssignInfoComp &
+AssignInfoComp::setCacheAddr(int idx, uint32_t addr)
+{
+  m_cache_count[idx + 1] = addr;
   return *this;
 }
 
 size_t
-AssignInfoComp::calcSize(int n_routers, int n_caches) {
-  return sizeof(raw_t)
-    + RouterAssignListElt::calcVarSize(n_routers)
-    + HashAssignElt::calcSize(n_caches)
-    ;
+AssignInfoComp::calcSize(int n_routers, int n_caches)
+{
+  return sizeof(raw_t) + RouterAssignListElt::calcVarSize(n_routers) + HashAssignElt::calcSize(n_caches);
 }
 
-uint32_t*
-AssignInfoComp::calcCacheCountPtr() {
-  return reinterpret_cast<uint32_t*>(
-    m_base + sizeof(raw_t)
-    + access_field(&raw_t::m_routers, m_base).getVarSize()
-  );
+uint32_t *
+AssignInfoComp::calcCacheCountPtr()
+{
+  return reinterpret_cast<uint32_t *>(m_base + sizeof(raw_t) + access_field(&raw_t::m_routers, m_base).getVarSize());
 }
 
-AssignInfoComp::Bucket*
-AssignInfoComp::calcBucketPtr() {
-  return reinterpret_cast<Bucket*>(reinterpret_cast<char*>(m_cache_count) + sizeof(uint32_t) * (1 + this->getCacheCount()));
+AssignInfoComp::Bucket *
+AssignInfoComp::calcBucketPtr()
+{
+  return reinterpret_cast<Bucket *>(reinterpret_cast<char *>(m_cache_count) + sizeof(uint32_t) * (1 + this->getCacheCount()));
 }
 
-AssignInfoComp&
-AssignInfoComp::fill(
-  MsgBuffer& buffer,
-  detail::Assignment const& assign
-) {
-  RouterAssignListElt const& ralist = assign.getRouterList();
-  HashAssignElt const& ha = assign.getHash();
+AssignInfoComp &
+AssignInfoComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
+  RouterAssignListElt const &ralist = assign.getRouterList();
+  HashAssignElt const &ha = assign.getHash();
   size_t n_routers = ralist.getCount();
   size_t n_caches = ha.getCount();
   size_t comp_size = this->calcSize(n_routers, n_caches);
@@ -1123,14 +1169,15 @@ AssignInfoComp::fill(
 }
 
 int
-AssignInfoComp::parse(MsgBuffer& buffer) {
+AssignInfoComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < HEADER_SIZE)
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       int n_routers = this->getRouterCount();
       int n_caches;
       m_cache_count = this->calcCacheCountPtr();
@@ -1143,54 +1190,53 @@ AssignInfoComp::parse(MsgBuffer& buffer) {
         buffer.use(comp_size);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 
-AssignmentKeyElt&
-AltAssignComp::keyElt() {
+AssignmentKeyElt &
+AltAssignComp::keyElt()
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-AssignmentKeyElt const&
-AltAssignComp::keyElt() const {
+AssignmentKeyElt const &
+AltAssignComp::keyElt() const
+{
   return access_field(&raw_t::m_key, m_base);
 }
 
-void*
-AltAssignComp::calcVarPtr() {
-  return reinterpret_cast<void*>(
-    m_base + sizeof(raw_t)
-    + access_field(&raw_t::m_routers, m_base).getVarSize()
-  );
+void *
+AltAssignComp::calcVarPtr()
+{
+  return reinterpret_cast<void *>(m_base + sizeof(raw_t) + access_field(&raw_t::m_routers, m_base).getVarSize());
 }
 
 uint32_t
-AltAssignComp::getRouterCount() const {
+AltAssignComp::getRouterCount() const
+{
   return access_field(&raw_t::m_routers, m_base).getCount();
 }
 
 uint32_t
-AltHashAssignComp::getCacheCount() const {
+AltHashAssignComp::getCacheCount() const
+{
   return ntohl(*m_cache_count);
 }
 
 
 size_t
-AltHashAssignComp::calcSize(int n_routers, int n_caches) {
-  return sizeof(raw_t)
-    + RouterAssignListElt::calcVarSize(n_routers)
-    + HashAssignElt::calcSize(n_caches)
-    ;
+AltHashAssignComp::calcSize(int n_routers, int n_caches)
+{
+  return sizeof(raw_t) + RouterAssignListElt::calcVarSize(n_routers) + HashAssignElt::calcSize(n_caches);
 }
 
-AltHashAssignComp&
-AltHashAssignComp::fill(
-  MsgBuffer& buffer,
-  detail::Assignment const& assign
-) {
-  RouterAssignListElt const& ralist = assign.getRouterList();
-  HashAssignElt const& ha = assign.getHash();
+AltHashAssignComp &
+AltHashAssignComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
+  RouterAssignListElt const &ralist = assign.getRouterList();
+  HashAssignElt const &ha = assign.getHash();
   size_t n_routers = ralist.getCount();
   size_t n_caches = ha.getCount();
   size_t comp_size = this->calcSize(n_routers, n_caches);
@@ -1203,12 +1249,11 @@ AltHashAssignComp::fill(
   this->setType(COMP_TYPE)
     .setLength(comp_size - HEADER_SIZE)
     .setAssignType(ALT_HASH_ASSIGNMENT)
-    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t))
-    ;
+    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t));
   this->keyElt() = assign.getKey();
   memcpy(&(access_field(&raw_t::m_routers, m_base)), &ralist, ralist.getSize());
   // Set the pointer to the count of caches and write the count.
-  m_cache_count = static_cast<uint32_t*>(this->calcVarPtr());
+  m_cache_count = static_cast<uint32_t *>(this->calcVarPtr());
   memcpy(m_cache_count, &ha, ha.getSize());
 
   buffer.use(comp_size);
@@ -1217,17 +1262,18 @@ AltHashAssignComp::fill(
 }
 
 int
-AltHashAssignComp::parse(MsgBuffer& buffer) {
+AltHashAssignComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       int n_routers = this->getRouterCount();
       int n_caches;
-      m_cache_count = static_cast<uint32_t*>(this->calcVarPtr());
+      m_cache_count = static_cast<uint32_t *>(this->calcVarPtr());
       n_caches = this->getCacheCount();
       size_t comp_size = this->calcSize(n_routers, n_caches);
       if (this->getLength() != comp_size - HEADER_SIZE)
@@ -1236,17 +1282,16 @@ AltHashAssignComp::parse(MsgBuffer& buffer) {
         buffer.use(comp_size);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 
-AltMaskAssignComp&
-AltMaskAssignComp::fill(
-  MsgBuffer& buffer,
-  detail::Assignment const& assign
-) {
-  RouterAssignListElt const& ralist = assign.getRouterList();
-  MaskAssignElt const& ma = assign.getMask();
+AltMaskAssignComp &
+AltMaskAssignComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
+  RouterAssignListElt const &ralist = assign.getRouterList();
+  MaskAssignElt const &ma = assign.getMask();
   size_t comp_size = sizeof(raw_t) + ralist.getVarSize() + ma.getSize();
 
   if (buffer.getSpace() < comp_size)
@@ -1257,12 +1302,11 @@ AltMaskAssignComp::fill(
   this->setType(COMP_TYPE)
     .setLength(comp_size - HEADER_SIZE)
     .setAssignType(ALT_MASK_ASSIGNMENT)
-    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t))
-    ;
+    .setAssignLength(comp_size - HEADER_SIZE - sizeof(local_header_t));
   this->keyElt() = assign.getKey();
 
   memcpy(&(access_field(&raw_t::m_routers, m_base)), &ralist, ralist.getSize());
-  m_mask_elt = static_cast<MaskAssignElt*>(this->calcVarPtr());
+  m_mask_elt = static_cast<MaskAssignElt *>(this->calcVarPtr());
   memcpy(m_mask_elt, &ma, ma.getSize());
 
   buffer.use(comp_size);
@@ -1271,16 +1315,17 @@ AltMaskAssignComp::fill(
 }
 
 int
-AltMaskAssignComp::parse(MsgBuffer& buffer) {
+AltMaskAssignComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
-      RouterAssignListElt* ralist = &(access_field(&raw_t::m_routers, m_base));
-      m_mask_elt = static_cast<MaskAssignElt*>(this->calcVarPtr());
+    if (PARSE_SUCCESS == zret) {
+      RouterAssignListElt *ralist = &(access_field(&raw_t::m_routers, m_base));
+      m_mask_elt = static_cast<MaskAssignElt *>(this->calcVarPtr());
       size_t comp_size = sizeof(raw_t) + ralist->getVarSize() + m_mask_elt->getSize();
       if (this->getLength() != comp_size - HEADER_SIZE)
         zret = PARSE_COMP_WRONG_SIZE;
@@ -1288,40 +1333,47 @@ AltMaskAssignComp::parse(MsgBuffer& buffer) {
         buffer.use(comp_size);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 
 // ------------------------------------------------------
 CmdComp::cmd_t
-CmdComp::getCmd() const {
+CmdComp::getCmd() const
+{
   return static_cast<cmd_t>(get_field(&raw_t::m_cmd, m_base));
 }
 
-CmdComp&
-CmdComp::setCmd(cmd_t cmd) {
+CmdComp &
+CmdComp::setCmd(cmd_t cmd)
+{
   set_field(&raw_t::m_cmd, m_base, cmd);
   return *this;
 }
 
 uint32_t
-CmdComp::getCmdData() const {
+CmdComp::getCmdData() const
+{
   return get_field(&raw_t::m_cmd_data, m_base);
 }
 
-CmdComp&
-CmdComp::setCmdData(uint32_t data) {
+CmdComp &
+CmdComp::setCmdData(uint32_t data)
+{
   set_field(&raw_t::m_cmd_data, m_base, data);
   return *this;
 }
 
 inline size_t
-CmdComp::calcSize() {
+CmdComp::calcSize()
+{
   return sizeof(raw_t);
 }
 
-CmdComp&
-CmdComp::fill(MsgBuffer& buffer, cmd_t cmd, uint32_t data) {
+CmdComp &
+CmdComp::fill(MsgBuffer &buffer, cmd_t cmd, uint32_t data)
+{
   size_t comp_size = this->calcSize();
 
   if (buffer.getSpace() < comp_size)
@@ -1329,26 +1381,23 @@ CmdComp::fill(MsgBuffer& buffer, cmd_t cmd, uint32_t data) {
 
   m_base = buffer.getTail();
 
-  this->setType(COMP_TYPE)
-    .setCmd(cmd)
-    .setCmdData(data)
-    .setLength(sizeof(raw_t) - sizeof(super::raw_t))
-    ;
+  this->setType(COMP_TYPE).setCmd(cmd).setCmdData(data).setLength(sizeof(raw_t) - sizeof(super::raw_t));
   // Command length is always the same.
   set_field(&raw_t::m_length, m_base, sizeof(uint32_t));
-//  reinterpret_cast<raw_t*>(m_base)->m_length = htons(sizeof(uint32_t));
+  //  reinterpret_cast<raw_t*>(m_base)->m_length = htons(sizeof(uint32_t));
   return *this;
 }
 
 int
-CmdComp::parse(MsgBuffer& buffer) {
+CmdComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       if (this->getLength() + sizeof(super::raw_t) != this->calcSize())
         zret = PARSE_COMP_WRONG_SIZE;
     }
@@ -1356,27 +1405,31 @@ CmdComp::parse(MsgBuffer& buffer) {
   return zret;
 }
 // ------------------------------------------------------
-CapabilityElt&
-CapComp::elt(int idx) {
+CapabilityElt &
+CapComp::elt(int idx)
+{
   return access_array<CapabilityElt>(m_base + sizeof(super::raw_t))[idx];
 }
 
-CapabilityElt const&
-CapComp::elt(int idx) const {
+CapabilityElt const &
+CapComp::elt(int idx) const
+{
   return access_array<CapabilityElt>(m_base + sizeof(super::raw_t))[idx];
 }
 
 void
-CapComp::cache() const {
+CapComp::cache() const
+{
   uint32_t x; // scratch for bounds checking.
   // Reset all values.
   m_packet_forward = ServiceGroup::NO_PACKET_STYLE;
   m_packet_return = ServiceGroup::NO_PACKET_STYLE;
   m_cache_assign = ServiceGroup::NO_CACHE_ASSIGN_STYLE;
-  if (!m_base) return; // No data, everything is default.
+  if (!m_base)
+    return; // No data, everything is default.
   // Load from data.
-  for ( uint32_t i = 0, n = this->getEltCount() ; i < n ; ++i ) {
-    CapabilityElt const& elt = this->elt(i);
+  for (uint32_t i = 0, n = this->getEltCount(); i < n; ++i) {
+    CapabilityElt const &elt = this->elt(i);
     switch (elt.getCapType()) {
     case CapabilityElt::PACKET_FORWARD_METHOD:
       x = elt.getCapData();
@@ -1401,8 +1454,9 @@ CapComp::cache() const {
   m_cached = true;
 }
 
-CapComp&
-CapComp::fill(MsgBuffer& buffer, int n) {
+CapComp &
+CapComp::fill(MsgBuffer &buffer, int n)
+{
   size_t comp_size = this->calcSize(n);
   m_cached = false;
 
@@ -1418,15 +1472,16 @@ CapComp::fill(MsgBuffer& buffer, int n) {
 }
 
 int
-CapComp::parse(MsgBuffer& buffer) {
+CapComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   m_cached = false;
-  if (buffer.getSpace()< sizeof(raw_t))
+  if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       // No explicit count, compute it from length.
       m_count = this->getLength() / sizeof(CapabilityElt);
       buffer.use(this->getLength() + sizeof(super::raw_t));
@@ -1436,9 +1491,10 @@ CapComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 int
-QueryComp::parse(MsgBuffer& buffer) {
+QueryComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
-  if (buffer.getSpace()< sizeof(raw_t))
+  if (buffer.getSpace() < sizeof(raw_t))
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
@@ -1450,14 +1506,16 @@ QueryComp::parse(MsgBuffer& buffer) {
 }
 // ------------------------------------------------------
 uint32_t
-AssignMapComp::getCount() const {
+AssignMapComp::getCount() const
+{
   return access_field(&raw_t::m_assign, m_base).getCount();
 }
 
-AssignMapComp&
-AssignMapComp::fill(MsgBuffer& buffer, detail::Assignment const& assign) {
+AssignMapComp &
+AssignMapComp::fill(MsgBuffer &buffer, detail::Assignment const &assign)
+{
   size_t comp_size = sizeof(raw_t);
-  MaskAssignElt const& ma = assign.getMask();
+  MaskAssignElt const &ma = assign.getMask();
   size_t ma_size = ma.getSize(); // Not constant time.
 
   // Can't be precise, but we need at least one mask/value set with
@@ -1469,41 +1527,38 @@ AssignMapComp::fill(MsgBuffer& buffer, detail::Assignment const& assign) {
   memcpy(&(access_field(&raw_t::m_assign, m_base)), &ma, ma_size);
   comp_size += ma_size - sizeof(ma);
 
-  this->setType(COMP_TYPE)
-    .setLength(comp_size - HEADER_SIZE)
-    ;
+  this->setType(COMP_TYPE).setLength(comp_size - HEADER_SIZE);
   buffer.use(comp_size);
 
   return *this;
 }
 
 int
-AssignMapComp::parse(MsgBuffer& buffer) {
+AssignMapComp::parse(MsgBuffer &buffer)
+{
   int zret = PARSE_SUCCESS;
   if (buffer.getSpace() < HEADER_SIZE)
     zret = PARSE_BUFFER_TOO_SMALL;
   else {
     m_base = buffer.getTail();
     zret = this->checkHeader(buffer, COMP_TYPE);
-    if (PARSE_SUCCESS == zret ) {
+    if (PARSE_SUCCESS == zret) {
       // TBD - Actually check the mask/value set data !!
       buffer.use(this->getLength() + HEADER_SIZE);
     }
   }
-  if (PARSE_SUCCESS != zret) m_base = 0;
+  if (PARSE_SUCCESS != zret)
+    m_base = 0;
   return zret;
 }
 // ------------------------------------------------------
-detail::Assignment::Assignment()
-  : m_key(0,0)
-  , m_active(false)
-  , m_router_list(0)
-  , m_hash_assign(0)
-  , m_mask_assign(0) {
+detail::Assignment::Assignment() : m_key(0, 0), m_active(false), m_router_list(0), m_hash_assign(0), m_mask_assign(0)
+{
 }
 
 bool
-detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
+detail::Assignment::fill(cache::GroupData &group, uint32_t addr)
+{
   // Compute the last packet received times for the routers.  For each
   // cache, compute how many routers mentioned it in their last
   // packet. Prepare an assignment from those caches.  If there are no
@@ -1511,21 +1566,18 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   // mentioned by at least one router are purged.
 
   size_t n_routers = group.m_routers.size(); // routers in group
-  size_t n_caches = group.m_caches.size(); // caches in group
+  size_t n_caches = group.m_caches.size();   // caches in group
 
   // We need both routers and caches to do something useful.
-  if (! (n_routers && n_caches)) return false;
+  if (!(n_routers && n_caches))
+    return false;
 
   // Iteration vars.
   size_t cdx, rdx;
-  cache::RouterBag::iterator rspot,
-    rbegin = group.m_routers.begin(),
-    rend = group.m_routers.end();
-  cache::CacheBag::iterator cspot,
-    cbegin = group.m_caches.begin(),
-    cend = group.m_caches.end();
-
-  size_t nr[n_caches]; // validity check counts.
+  cache::RouterBag::iterator rspot, rbegin = group.m_routers.begin(), rend = group.m_routers.end();
+  cache::CacheBag::iterator cspot, cbegin = group.m_caches.begin(), cend = group.m_caches.end();
+
+  size_t nr[n_caches];       // validity check counts.
   memset(nr, 0, sizeof(nr)); // Set counts to zero.
 
   // Guess at size of serialization buffer. For the router list and
@@ -1544,7 +1596,7 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   // Set assignment key
   m_key.setAddr(addr).setChangeNumber(group.m_generation);
 
-  m_router_list = reinterpret_cast<RouterAssignListElt*>(m_buffer.getBase());
+  m_router_list = reinterpret_cast<RouterAssignListElt *>(m_buffer.getBase());
   new (m_router_list) RouterAssignListElt(n_routers);
 
   // For each router, update the assignment and run over the caches
@@ -1552,15 +1604,11 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   // recent packet. Note that the router data gets updated from
   // ISeeYou message processing as well, this is more of an initial
   // setup.
-  for ( rdx = 0, rspot = rbegin ; rspot != rend ; ++rspot, ++rdx ) {
+  for (rdx = 0, rspot = rbegin; rspot != rend; ++rspot, ++rdx) {
     // Update router assignment.
-    m_router_list->elt(rdx)
-      .setChangeNumber(rspot->m_generation)
-      .setAddr(rspot->m_addr)
-      .setRecvId(rspot->m_recv.m_sn)
-      ;
+    m_router_list->elt(rdx).setChangeNumber(rspot->m_generation).setAddr(rspot->m_addr).setRecvId(rspot->m_recv.m_sn);
     // Check cache validity.
-    for ( cdx = 0, cspot = cbegin ; cspot != cend ; ++cspot, ++cdx ) {
+    for (cdx = 0, cspot = cbegin; cspot != cend; ++cspot, ++cdx) {
       if (cspot->m_src[rdx].m_time == rspot->m_recv.m_time)
         ++(nr[cdx]);
     }
@@ -1568,19 +1616,19 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
 
   size_t k = m_router_list->getSize();
   m_buffer.use(k);
-  m_hash_assign = reinterpret_cast<HashAssignElt*>(m_buffer.getTail());
+  m_hash_assign = reinterpret_cast<HashAssignElt *>(m_buffer.getTail());
 
   // If the nr value is 0, then the cache was not included in any
   // last packet, so it should be discarded. A cache is valid if
   // nr is n_routers, indicating that every router mentioned it.
   int v_caches = 0; // valid caches
-  for ( cdx = 0, cspot = cbegin ; cspot != cend ; ++cspot, ++cdx )
+  for (cdx = 0, cspot = cbegin; cspot != cend; ++cspot, ++cdx)
     if (nr[cdx] == n_routers) {
       m_hash_assign->setAddr(cdx, cspot->idAddr());
       ++v_caches;
     }
 
-  if (! v_caches) { // no valid caches.
+  if (!v_caches) { // no valid caches.
     log(LVL_INFO, "Attempted to generate cache assignment but no valid caches were found.");
     return false;
   }
@@ -1589,41 +1637,42 @@ detail::Assignment::fill(cache::GroupData& group, uint32_t addr) {
   m_hash_assign->round_robin_assign();
   m_buffer.use(m_hash_assign->getSize());
 
-  m_mask_assign = reinterpret_cast<MaskAssignElt*>(m_buffer.getTail());
+  m_mask_assign = reinterpret_cast<MaskAssignElt *>(m_buffer.getTail());
   new (m_mask_assign) MaskAssignElt;
 
   // For now, hardwire everything to first cache.
   // We have plenty of space, but will need to check if we do something
   // more complex here.
-  m_mask_assign->init(0,0,0,0)->addValue(m_hash_assign->getAddr(0),0,0,0,0);
+  m_mask_assign->init(0, 0, 0, 0)->addValue(m_hash_assign->getAddr(0), 0, 0, 0, 0);
 
-  logf(LVL_INFO, "Generated assignment for group %d with %d routers, %d valid caches.", group.m_svc.getSvcId(), n_routers, v_caches);
+  logf(LVL_INFO, "Generated assignment for group %d with %d routers, %d valid caches.", group.m_svc.getSvcId(), n_routers,
+       v_caches);
 
   return true;
 }
 // ------------------------------------------------------
 void
-BaseMsg::setBuffer(MsgBuffer const& buffer) {
+BaseMsg::setBuffer(MsgBuffer const &buffer)
+{
   m_buffer = buffer;
 }
 
 void
-BaseMsg::finalize() {
+BaseMsg::finalize()
+{
   m_header.setLength(m_buffer.getCount() - m_header.calcSize());
   m_security.secure(m_buffer);
 }
 
 bool
-BaseMsg::validateSecurity() const {
+BaseMsg::validateSecurity() const
+{
   return m_security.validate(m_buffer);
 }
 // ------------------------------------------------------
 void
-HereIAmMsg::fill(
-    detail::cache::GroupData const& group,
-    CacheIdBox const& cache_id,
-    SecurityOption sec_opt
-) {
+HereIAmMsg::fill(detail::cache::GroupData const &group, CacheIdBox const &cache_id, SecurityOption sec_opt)
+{
   m_header.fill(m_buffer, HERE_I_AM);
   m_security.fill(m_buffer, sec_opt);
   m_service.fill(m_buffer, group.m_svc);
@@ -1632,54 +1681,58 @@ HereIAmMsg::fill(
 }
 
 void
-HereIAmMsg::fill_caps(
-    detail::cache::RouterData const& router
-) {
+HereIAmMsg::fill_caps(detail::cache::RouterData const &router)
+{
   if (router.m_send_caps) {
     m_capabilities.fill(m_buffer, 3);
-    m_capabilities.elt(0) =
-      CapabilityElt(CapabilityElt::PACKET_FORWARD_METHOD, router.m_packet_forward);
-    m_capabilities.elt(1) =
-      CapabilityElt(CapabilityElt::CACHE_ASSIGNMENT_METHOD, router.m_cache_assign);
-    m_capabilities.elt(2) =
-      CapabilityElt(CapabilityElt::PACKET_RETURN_METHOD, router.m_packet_return);
+    m_capabilities.elt(0) = CapabilityElt(CapabilityElt::PACKET_FORWARD_METHOD, router.m_packet_forward);
+    m_capabilities.elt(1) = CapabilityElt(CapabilityElt::CACHE_ASSIGNMENT_METHOD, router.m_cache_assign);
+    m_capabilities.elt(2) = CapabilityElt(CapabilityElt::PACKET_RETURN_METHOD, router.m_packet_return);
   }
 }
 
 int
-HereIAmMsg::parse(ts::Buffer const& buffer) {
+HereIAmMsg::parse(ts::Buffer const &buffer)
+{
   int zret;
   this->setBuffer(buffer);
-  if (!m_buffer.getBase()) return -EINVAL;
+  if (!m_buffer.getBase())
+    return -EINVAL;
   zret = m_header.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
-  if (HERE_I_AM != m_header.getType()) return PARSE_MSG_WRONG_TYPE;
+  if (PARSE_SUCCESS != zret)
+    return zret;
+  if (HERE_I_AM != m_header.getType())
+    return PARSE_MSG_WRONG_TYPE;
 
   // Time to look for components.
   zret = m_security.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_service.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_cache_id.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_cache_view.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   // These are optional so failures can be ignored.
-  if (m_buffer.getSpace()) m_capabilities.parse(m_buffer);
-  if (m_buffer.getSpace()) m_command.parse(m_buffer);
+  if (m_buffer.getSpace())
+    m_capabilities.parse(m_buffer);
+  if (m_buffer.getSpace())
+    m_command.parse(m_buffer);
 
   return m_buffer.getSpace() ? PARSE_DATA_OVERRUN : PARSE_SUCCESS;
 }
 // ------------------------------------------------------
 void
-RedirectAssignMsg::fill(
-  detail::cache::GroupData const& group,
-  SecurityOption sec_opt
-) {
+RedirectAssignMsg::fill(detail::cache::GroupData const &group, SecurityOption sec_opt)
+{
   m_header.fill(m_buffer, REDIRECT_ASSIGN);
   m_security.fill(m_buffer, sec_opt);
   m_service.fill(m_buffer, group.m_svc);
@@ -1697,15 +1750,10 @@ RedirectAssignMsg::fill(
 }
 // ------------------------------------------------------
 void
-ISeeYouMsg::fill(
-  detail::router::GroupData const& group,
-  SecurityOption sec_opt,
-  detail::Assignment& /* assign ATS_UNUSED */,
-  size_t to_caches,
-  size_t n_routers,
-  size_t n_caches,
-  bool /* send_capabilities ATS_UNUSED */
-) {
+ISeeYouMsg::fill(detail::router::GroupData const &group, SecurityOption sec_opt, detail::Assignment & /* assign ATS_UNUSED */,
+                 size_t to_caches, size_t n_routers, size_t n_caches, bool /* send_capabilities ATS_UNUSED */
+                 )
+{
   m_header.fill(m_buffer, I_SEE_YOU);
   m_security.fill(m_buffer, sec_opt);
   m_service.fill(m_buffer, group.m_svc);
@@ -1714,26 +1762,38 @@ ISeeYouMsg::fill(
 }
 
 int
-ISeeYouMsg::parse(ts::Buffer const& buffer) {
+ISeeYouMsg::parse(ts::Buffer const &buffer)
+{
   int zret;
   this->setBuffer(buffer);
-  if (!m_buffer.getBase()) return -EINVAL;
+  if (!m_buffer.getBase())
+    return -EINVAL;
   zret = m_header.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
-  if (I_SEE_YOU != m_header.getType()) return PARSE_MSG_WRONG_TYPE;
+  if (PARSE_SUCCESS != zret)
+    return zret;
+  if (I_SEE_YOU != m_header.getType())
+    return PARSE_MSG_WRONG_TYPE;
 
   // Time to look for components.
   zret = m_security.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_service.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_router_id.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) { logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router id", zret); return zret; }
+  if (PARSE_SUCCESS != zret) {
+    logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router id", zret);
+    return zret;
+  }
 
   zret = m_router_view.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) { logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router view", zret); return zret; }
+  if (PARSE_SUCCESS != zret) {
+    logf(LVL_DEBUG, "I_SEE_YOU: Invalid %d router view", zret);
+    return zret;
+  }
 
   // Optional components.
 
@@ -1756,23 +1816,30 @@ ISeeYouMsg::parse(ts::Buffer const& buffer) {
 }
 // ------------------------------------------------------
 int
-RemovalQueryMsg::parse(ts::Buffer const& buffer) {
+RemovalQueryMsg::parse(ts::Buffer const &buffer)
+{
   int zret;
   this->setBuffer(buffer);
-  if (!m_buffer.getBase()) return -EINVAL;
+  if (!m_buffer.getBase())
+    return -EINVAL;
   zret = m_header.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
-  if (REMOVAL_QUERY != m_header.getType()) return PARSE_MSG_WRONG_TYPE;
+  if (PARSE_SUCCESS != zret)
+    return zret;
+  if (REMOVAL_QUERY != m_header.getType())
+    return PARSE_MSG_WRONG_TYPE;
 
   // Get the components.
   zret = m_security.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_service.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   zret = m_query.parse(m_buffer);
-  if (PARSE_SUCCESS != zret) return zret;
+  if (PARSE_SUCCESS != zret)
+    return zret;
 
   return m_buffer.getSpace() ? PARSE_DATA_OVERRUN : PARSE_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpStatic.cc
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpStatic.cc b/lib/wccp/WccpStatic.cc
index db26418..d0fd91e 100644
--- a/lib/wccp/WccpStatic.cc
+++ b/lib/wccp/WccpStatic.cc
@@ -20,25 +20,26 @@
     limitations under the License.
  */
 
-# include "WccpLocal.h"
-# include "WccpMeta.h"
-# include "ink_error.h"
-# include "ink_defs.h"
+#include "WccpLocal.h"
+#include "WccpMeta.h"
+#include "ink_error.h"
+#include "ink_defs.h"
 
 /* Solaris considers SIOCGIFCONF obsolete and only defines it if
  * BSD compatibility activated. */
-# if defined(solaris)
-# define BSD_COMP
-# endif
-# include <sys/ioctl.h>
-# include <sys/socket.h>
-# include <net/if.h>
-# include <stdarg.h>
-# include <string.h>
-# include <errno.h>
-# include <stdio.h>
-
-namespace wccp {
+#if defined(solaris)
+#define BSD_COMP
+#endif
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+namespace wccp
+{
 // ------------------------------------------------------
 // Compile time checks for internal consistency.
 
@@ -47,18 +48,19 @@ struct CompileTimeChecks {
   static unsigned int const UINT8_SIZE = sizeof(uint8_t);
   // A compiler error for the following line means that the size of
   // an assignment bucket is incorrect. It must be exactly 1 byte.
-  ts::TEST_IF_TRUE< BUCKET_SIZE == UINT8_SIZE > m_check_bucket_size;
+  ts::TEST_IF_TRUE<BUCKET_SIZE == UINT8_SIZE> m_check_bucket_size;
 };
 
-ts::Errata::Code LVL_TMP = 1; ///< Temporary message.
+ts::Errata::Code LVL_TMP = 1;   ///< Temporary message.
 ts::Errata::Code LVL_FATAL = 3; ///< Fatal, cannot continue.
-ts::Errata::Code LVL_WARN = 2; ///< Significant, should be fixed.
-ts::Errata::Code LVL_INFO = 1; /// Interesting, not necessarily a problem.
+ts::Errata::Code LVL_WARN = 2;  ///< Significant, should be fixed.
+ts::Errata::Code LVL_INFO = 1;  /// Interesting, not necessarily a problem.
 ts::Errata::Code LVL_DEBUG = 0; /// Debugging information.
 
 // Find a valid local IP address given an open socket.
 uint32_t
-Get_Local_Address(int s) {
+Get_Local_Address(int s)
+{
   // If we can't find a good address in the first 255, just give up
   // and make the user specify an address.
   static int const N_REQ = 255;
@@ -70,52 +72,53 @@ Get_Local_Address(int s) {
   conf.ifc_req = req;
   if (0 == ioctl(s, SIOCGIFCONF, &conf)) {
     int idx = 0;
-    ifreq* ptr = req;
-    ifreq* limit = req + (conf.ifc_len / sizeof(*req));
-    for ( ; idx < N_REQ && ptr < limit ; ++idx, ++ptr ) {
-      zret = reinterpret_cast<sockaddr_in&>(ptr->ifr_addr).sin_addr.s_addr;
-      if ((zret & 0xFF) != 0x7F) return zret;
+    ifreq *ptr = req;
+    ifreq *limit = req + (conf.ifc_len / sizeof(*req));
+    for (; idx < N_REQ && ptr < limit; ++idx, ++ptr) {
+      zret = reinterpret_cast<sockaddr_in &>(ptr->ifr_addr).sin_addr.s_addr;
+      if ((zret & 0xFF) != 0x7F)
+        return zret;
     }
   }
   return INADDR_ANY; // fail
 }
 
 // Cheap, can't even be used twice in the same argument list.
-char const* ip_addr_to_str(uint32_t addr) {
+char const *
+ip_addr_to_str(uint32_t addr)
+{
   static char buff[4 * 3 + 3 + 1];
-  unsigned char* octet = reinterpret_cast<unsigned char*>(&addr);
+  unsigned char *octet = reinterpret_cast<unsigned char *>(&addr);
   sprintf(buff, "%d.%d.%d.%d", octet[0], octet[1], octet[2], octet[3]);
   return buff;
 }
 
 // ------------------------------------------------------
-ts::Errata&
-log(ts::Errata& err, ts::Errata::Id id, ts::Errata::Code code, char const* text) {
+ts::Errata &
+log(ts::Errata &err, ts::Errata::Id id, ts::Errata::Code code, char const *text)
+{
   err.push(id, code, text);
   return err;
 }
 
-ts::Errata&
-log(ts::Errata& err, ts::Errata::Code code, char const* text) {
+ts::Errata &
+log(ts::Errata &err, ts::Errata::Code code, char const *text)
+{
   err.push(0, code, text);
   return err;
 }
 
 ts::Errata
-log(ts::Errata::Code code, char const* text) {
+log(ts::Errata::Code code, char const *text)
+{
   ts::Errata err;
   err.push(0, code, text);
   return err;
 }
 
-ts::Errata&
-vlogf(
-  ts::Errata& err,
-  ts::Errata::Id id,
-  ts::Errata::Code code,
-  char const* format,
-  va_list& rest
-) {
+ts::Errata &
+vlogf(ts::Errata &err, ts::Errata::Id id, ts::Errata::Code code, char const *format, va_list &rest)
+{
   static size_t const SIZE = 8192;
   char buffer[SIZE];
 
@@ -124,36 +127,34 @@ vlogf(
   return err;
 }
 
-ts::Errata&
-logf(
-  ts::Errata& err,
-  ts::Errata::Id id,
-  ts::Errata::Code code,
-  char const* format,
-  ...
-) {
+ts::Errata &
+logf(ts::Errata &err, ts::Errata::Id id, ts::Errata::Code code, char const *format, ...)
+{
   va_list rest;
   va_start(rest, format);
   return vlogf(err, id, code, format, rest);
 }
 
 ts::Errata
-logf(ts::Errata::Code code, char const* format, ...) {
+logf(ts::Errata::Code code, char const *format, ...)
+{
   ts::Errata err;
   va_list rest;
   va_start(rest, format);
   return vlogf(err, ts::Errata::Id(0), code, format, rest);
 }
 
-ts::Errata&
-logf(ts::Errata& err, ts::Errata::Code code, char const* format, ...) {
+ts::Errata &
+logf(ts::Errata &err, ts::Errata::Code code, char const *format, ...)
+{
   va_list rest;
   va_start(rest, format);
   return vlogf(err, ts::Errata::Id(0), code, format, rest);
 }
 
 ts::Errata
-log_errno(ts::Errata::Code code, char const* text) {
+log_errno(ts::Errata::Code code, char const *text)
+{
   static size_t const SIZE = 1024;
   char buffer[SIZE];
   ATS_UNUSED_RETURN(strerror_r(errno, buffer, SIZE));
@@ -161,7 +162,8 @@ log_errno(ts::Errata::Code code, char const* text) {
 }
 
 ts::Errata
-vlogf_errno(ts::Errata::Code code, char const* format, va_list& rest) {
+vlogf_errno(ts::Errata::Code code, char const *format, va_list &rest)
+{
   int e = errno; // Preserve value before making system calls.
   ts::Errata err;
   int n;
@@ -180,7 +182,8 @@ vlogf_errno(ts::Errata::Code code, char const* format, va_list& rest) {
 }
 
 ts::Errata
-logf_errno(ts::Errata::Code code, char const* format, ...) {
+logf_errno(ts::Errata::Code code, char const *format, ...)
+{
   va_list rest;
   va_start(rest, format);
   return vlogf_errno(code, format, rest);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpUtil.h
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpUtil.h b/lib/wccp/WccpUtil.h
index 25bae9b..9e3d22c 100644
--- a/lib/wccp/WccpUtil.h
+++ b/lib/wccp/WccpUtil.h
@@ -20,22 +20,22 @@
     limitations under the License.
  */
 
-# if !defined(ATS_WCCP_UTIL_HEADER)
-# define ATS_WCCP_UTIL_HEADER
+#if !defined(ATS_WCCP_UTIL_HEADER)
+#define ATS_WCCP_UTIL_HEADER
 
-# include <vector>
-
-namespace wccp {
+#include <vector>
 
+namespace wccp
+{
 /// @name Message severity levels.
 //@{
 extern ts::Errata::Code LVL_FATAL; ///< Fatal, cannot continue.
-extern ts::Errata::Code LVL_WARN; ///< Significant, function degraded.
-extern ts::Errata::Code LVL_INFO; ///< Interesting, not necessarily a problem.
+extern ts::Errata::Code LVL_WARN;  ///< Significant, function degraded.
+extern ts::Errata::Code LVL_INFO;  ///< Interesting, not necessarily a problem.
 extern ts::Errata::Code LVL_DEBUG; ///< Debugging information.
-extern ts::Errata::Code LVL_TMP; ///< For temporary debugging only.
-// Handy so that temporary debugging messages can be located by grep.
-//@}
+extern ts::Errata::Code LVL_TMP;   ///< For temporary debugging only.
+                                   // Handy so that temporary debugging messages can be located by grep.
+                                   //@}
 
 /** Logging / reporting support.
     We build on top of @c Errata but we want to be able to prevent
@@ -48,72 +48,62 @@ extern ts::Errata::Code LVL_TMP; ///< For temporary debugging only.
 //@{
 /// Report literal string to an Errata.
 /// @return @a err.
-ts::Errata& log(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Id id, ///< Message ID.
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata &log(ts::Errata &err,       ///< Target errata.
+                ts::Errata::Id id,     ///< Message ID.
+                ts::Errata::Code code, ///< Severity level.
+                char const *text       ///< Message text.
+                );
 /// Report literal string to an Errata.
 /// Use message ID 0.
 /// @return @a err.
-ts::Errata& log(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata &log(ts::Errata &err,       ///< Target errata.
+                ts::Errata::Code code, ///< Severity level.
+                char const *text       ///< Message text.
+                );
 /// printf style log to Errata.
 /// @return @a err.
-ts::Errata& logf(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Id id, ///< Message ID.
-  ts::Errata::Code code, ///< Severity level.
-  char const* format, ///< Format string.
-  ... ///< Format string parameters.
-);
+ts::Errata &logf(ts::Errata &err,       ///< Target errata.
+                 ts::Errata::Id id,     ///< Message ID.
+                 ts::Errata::Code code, ///< Severity level.
+                 char const *format,    ///< Format string.
+                 ...                    ///< Format string parameters.
+                 );
 /// printf style log to Errata.
 /// The message id is set to zero.
 /// @return @a err.
-ts::Errata& logf(
-  ts::Errata& err,///< Target errata.
-  ts::Errata::Code code, ///< Severity level.
-  char const* format, ///< Format string.
-  ... ///< Format string parameters.
-);
+ts::Errata &logf(ts::Errata &err,       ///< Target errata.
+                 ts::Errata::Code code, ///< Severity level.
+                 char const *format,    ///< Format string.
+                 ...                    ///< Format string parameters.
+                 );
 /// Return an Errata populated with a literal string.
 /// Use message ID 0.
 /// @return @a err.
-ts::Errata log(
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata log(ts::Errata::Code code, ///< Severity level.
+               char const *text       ///< Message text.
+               );
 /// Return an Errata populated with a printf styleformatted string.
 /// Use message ID 0.
 /// @return @a err.
-ts::Errata logf(
-  ts::Errata::Code code, ///< Severity level.
-  char const* format, ///< Message text.
-  ...
-);
+ts::Errata logf(ts::Errata::Code code, ///< Severity level.
+                char const *format,    ///< Message text.
+                ...);
 /** Return an Errata based on @c errno.
     The literal string is combined with the system text for the current
     value of @c errno. This is modeled on @c perror. Message ID 0 is used.
     @return @a err.
  */
-ts::Errata log_errno(
-  ts::Errata::Code code, ///< Severity level.
-  char const* text ///< Message text.
-);
+ts::Errata log_errno(ts::Errata::Code code, ///< Severity level.
+                     char const *text       ///< Message text.
+                     );
 /** Return an @c Errata based on @c errno.
     @c errno and the corresponding system error string are appended to
     the results from the @a format and following arguments.
  */
-ts::Errata
-logf_errno(
-  ts::Errata::Code code,  ///< Severity code.
-  char const* format, ///< Format string.
-  ... ///< Arguments for @a format.
-);
+ts::Errata logf_errno(ts::Errata::Code code, ///< Severity code.
+                      char const *format,    ///< Format string.
+                      ...                    ///< Arguments for @a format.
+                      );
 //@}
 
 // ------------------------------------------------------
@@ -130,61 +120,77 @@ logf_errno(
     See access_field for completely unmediated access.
 */
 
-template < typename R>
-uint8_t get_field(uint8_t R::*M, char* buffer) {
-  return reinterpret_cast<R*>(buffer)->*M;
+template <typename R>
+uint8_t
+get_field(uint8_t R::*M, char *buffer)
+{
+  return reinterpret_cast<R *>(buffer)->*M;
 }
 
-template < typename R>
-uint16_t get_field(uint16_t R::*M, char* buffer) {
-  return ntohs(reinterpret_cast<R*>(buffer)->*M);
+template <typename R>
+uint16_t
+get_field(uint16_t R::*M, char *buffer)
+{
+  return ntohs(reinterpret_cast<R *>(buffer)->*M);
 }
 
-template < typename R>
-uint32_t get_field(uint32_t R::*M, char* buffer) {
-  return ntohl(reinterpret_cast<R*>(buffer)->*M);
+template <typename R>
+uint32_t
+get_field(uint32_t R::*M, char *buffer)
+{
+  return ntohl(reinterpret_cast<R *>(buffer)->*M);
 }
 
-template < typename R>
-void set_field(uint16_t R::*M, char* buffer, uint16_t value) {
-  reinterpret_cast<R*>(buffer)->*M = htons(value);
+template <typename R>
+void
+set_field(uint16_t R::*M, char *buffer, uint16_t value)
+{
+  reinterpret_cast<R *>(buffer)->*M = htons(value);
 }
 
-template < typename R>
-void set_field(uint32_t R::*M, char* buffer, uint32_t value) {
-  reinterpret_cast<R*>(buffer)->*M = htonl(value);
+template <typename R>
+void
+set_field(uint32_t R::*M, char *buffer, uint32_t value)
+{
+  reinterpret_cast<R *>(buffer)->*M = htonl(value);
 }
 
 // IP address fields are kept locally in network order so
 // we need variants without re-ordering.
 // Also required for member structures.
-template < typename R, typename T >
-T& access_field(T R::*M, void* buffer) {
-  return reinterpret_cast<R*>(buffer)->*M;
+template <typename R, typename T>
+T &
+access_field(T R::*M, void *buffer)
+{
+  return reinterpret_cast<R *>(buffer)->*M;
 }
 
 // Access an array @a T starting at @a buffer.
-template < typename T>
-T* access_array(void* buffer) {
-  return reinterpret_cast<T*>(buffer);
+template <typename T>
+T *
+access_array(void *buffer)
+{
+  return reinterpret_cast<T *>(buffer);
 }
 // Access an array of @a T starting at @a buffer.
-template < typename T >
-T const* access_array(void const* buffer) {
-  return reinterpret_cast<T const*>(buffer);
+template <typename T>
+T const *
+access_array(void const *buffer)
+{
+  return reinterpret_cast<T const *>(buffer);
 }
 
 /// Find an element in a vector by the value of a member.
 /// @return An iterator for the element, or equal to @c end if not found.
-template <
-  typename T, ///< Vector element type.
-  typename V ///< Member type.
-> typename std::vector<T>::iterator
-find_by_member(
-  std::vector<T>& container, ///< Vector with elements.
-  V T::*member, ///< Pointer to member to compare.
-  V const& value ///< Value to match.
-) {
+template <typename T, ///< Vector element type.
+          typename V  ///< Member type.
+          >
+typename std::vector<T>::iterator
+find_by_member(std::vector<T> &container, ///< Vector with elements.
+               V T::*member,              ///< Pointer to member to compare.
+               V const &value             ///< Value to match.
+               )
+{
   typename std::vector<T>::iterator spot = container.begin();
   typename std::vector<T>::iterator limit = container.end();
   while (spot != limit && (*spot).*member != value)
@@ -193,16 +199,14 @@ find_by_member(
 }
 // ------------------------------------------------------
 /// Find a non-loop back IP address from an open socket.
-uint32_t Get_Local_Address(
-  int s ///< Open socket.
-);
+uint32_t Get_Local_Address(int s ///< Open socket.
+                           );
 // ------------------------------------------------------
 /// Cheap and dirty conversion to string for debugging.
 /// @note Uses a static buffer so won't work across threads or
 /// twice in the same argument list.
-char const* ip_addr_to_str(
-  uint32_t addr ///< Address to convert.
-);
+char const *ip_addr_to_str(uint32_t addr ///< Address to convert.
+                           );
 
 /** Used for printing IP address.
     @code
@@ -210,14 +214,12 @@ char const* ip_addr_to_str(
     printf("IP address = " ATS_IP_PRINTF_CODE,ATS_IP_OCTETS(addr));
     @endcode
  */
-# define ATS_IP_PRINTF_CODE "%d.%d.%d.%d"
-# define ATS_IP_OCTETS(x) \
-  reinterpret_cast<unsigned char const*>(&(x))[0],   \
-    reinterpret_cast<unsigned char const*>(&(x))[1], \
-    reinterpret_cast<unsigned char const*>(&(x))[2], \
-    reinterpret_cast<unsigned char const*>(&(x))[3]
+#define ATS_IP_PRINTF_CODE "%d.%d.%d.%d"
+#define ATS_IP_OCTETS(x)                                                                              \
+  reinterpret_cast<unsigned char const *>(&(x))[0], reinterpret_cast<unsigned char const *>(&(x))[1], \
+    reinterpret_cast<unsigned char const *>(&(x))[2], reinterpret_cast<unsigned char const *>(&(x))[3]
 // ------------------------------------------------------
 
 } // namespace Wccp
 
-# endif // define ATS_WCCP_UTIL_HEADER
+#endif // define ATS_WCCP_UTIL_HEADER


[39/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterCache.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index d6315d9..198d8e1 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -29,7 +29,7 @@
 #include "P_Cluster.h"
 
 #ifdef DEBUG
-#define CLUSTER_TEST_DEBUG	1
+#define CLUSTER_TEST_DEBUG 1
 #endif
 
 #ifdef ENABLE_TIME_TRACE
@@ -62,7 +62,7 @@ static Queue<CacheContinuation> remoteCacheContQueue[REMOTE_CONNECT_HASH];
 static Ptr<ProxyMutex> remoteCacheContQueueMutex[REMOTE_CONNECT_HASH];
 
 // 0 is an illegal sequence number
-#define CACHE_NO_RESPONSE            0
+#define CACHE_NO_RESPONSE 0
 static int cluster_sequence_number = 1;
 
 #ifdef CLUSTER_TEST_DEBUG
@@ -78,12 +78,11 @@ static CacheContinuation *find_cache_continuation(unsigned int, unsigned int);
 
 static unsigned int new_cache_sequence_number();
 
-#define DOT_SEPARATED(_x)                             \
-((unsigned char*)&(_x))[0], ((unsigned char*)&(_x))[1],   \
-  ((unsigned char*)&(_x))[2], ((unsigned char*)&(_x))[3]
+#define DOT_SEPARATED(_x) \
+  ((unsigned char *)&(_x))[0], ((unsigned char *)&(_x))[1], ((unsigned char *)&(_x))[2], ((unsigned char *)&(_x))[3]
 
-#define ET_CACHE_CONT_SM	ET_NET
-#define ALLOW_THREAD_STEAL	true
+#define ET_CACHE_CONT_SM ET_NET
+#define ALLOW_THREAD_STEAL true
 
 /**********************************************************************/
 #ifdef CACHE_MSG_TRACE
@@ -93,9 +92,8 @@ static unsigned int new_cache_sequence_number();
 // Debug trace support for cache RPC messages
 /**********************************************************************/
 
-#define MAX_TENTRIES	4096
-struct traceEntry
-{
+#define MAX_TENTRIES 4096
+struct traceEntry {
   unsigned int seqno;
   int op;
   char *type;
@@ -132,8 +130,8 @@ dump_recvtrace_table()
   int n;
   printf("\n");
   for (n = 0; n < MAX_TENTRIES; ++n)
-    printf("[%d] seqno=%d, op=%d type=%s\n", n, recvTraceTable[n].seqno,
-           recvTraceTable[n].op, recvTraceTable[n].type ? recvTraceTable[n].type : "");
+    printf("[%d] seqno=%d, op=%d type=%s\n", n, recvTraceTable[n].seqno, recvTraceTable[n].op,
+           recvTraceTable[n].type ? recvTraceTable[n].type : "");
 }
 
 void
@@ -142,8 +140,8 @@ dump_sndtrace_table()
   int n;
   printf("\n");
   for (n = 0; n < MAX_TENTRIES; ++n)
-    printf("[%d] seqno=%d, op=%d type=%s\n", n, sndTraceTable[n].seqno,
-           sndTraceTable[n].op, sndTraceTable[n].type ? sndTraceTable[n].type : "");
+    printf("[%d] seqno=%d, op=%d type=%s\n", n, sndTraceTable[n].seqno, sndTraceTable[n].op,
+           sndTraceTable[n].type ? sndTraceTable[n].type : "");
 }
 
 /**********************************************************************/
@@ -165,61 +163,50 @@ dump_sndtrace_table()
 class ClusterVConnectionCache
 {
 public:
-  ClusterVConnectionCache()
-  {
-    memset(hash_event, 0, sizeof(hash_event));
-  }
+  ClusterVConnectionCache() { memset(hash_event, 0, sizeof(hash_event)); }
   void init();
-  int MD5ToIndex(INK_MD5 * p);
+  int MD5ToIndex(INK_MD5 *p);
   int insert(INK_MD5 *, ClusterVConnection *);
   ClusterVConnection *lookup(INK_MD5 *);
 
 public:
-  struct Entry
-  {
+  struct Entry {
     LINK(Entry, link);
     bool mark_for_delete;
     INK_MD5 key;
     ClusterVConnection *vc;
 
-      Entry():mark_for_delete(0), vc(0)
-    {
-    }
-     ~Entry()
-    {
-    }
+    Entry() : mark_for_delete(0), vc(0) {}
+    ~Entry() {}
   };
 
-  enum
-  { MAX_TABLE_ENTRIES = 256,    // must be power of 2
-    SCAN_INTERVAL = 10          // seconds
+  enum {
+    MAX_TABLE_ENTRIES = 256, // must be power of 2
+    SCAN_INTERVAL = 10       // seconds
   };
   Queue<Entry> hash_table[MAX_TABLE_ENTRIES];
   Ptr<ProxyMutex> hash_lock[MAX_TABLE_ENTRIES];
   Event *hash_event[MAX_TABLE_ENTRIES];
 };
 
-static ClassAllocator <
-  ClusterVConnectionCache::Entry >
-ClusterVCCacheEntryAlloc("ClusterVConnectionCache::Entry");
+static ClassAllocator<ClusterVConnectionCache::Entry> ClusterVCCacheEntryAlloc("ClusterVConnectionCache::Entry");
 
 ClusterVConnectionCache *GlobalOpenWriteVCcache = 0;
 
 /////////////////////////////////////////////////////////////////
 // Perform periodic purges of ClusterVConnectionCache entries
 /////////////////////////////////////////////////////////////////
-class ClusterVConnectionCacheEvent:public Continuation
+class ClusterVConnectionCacheEvent : public Continuation
 {
 public:
-  ClusterVConnectionCacheEvent(ClusterVConnectionCache * c, int n)
-  : Continuation(new_ProxyMutex()), cache(c), hash_index(n)
+  ClusterVConnectionCacheEvent(ClusterVConnectionCache *c, int n) : Continuation(new_ProxyMutex()), cache(c), hash_index(n)
   {
     SET_HANDLER(&ClusterVConnectionCacheEvent::eventHandler);
   }
   int eventHandler(int, Event *);
 
 private:
-  ClusterVConnectionCache * cache;
+  ClusterVConnectionCache *cache;
   int hash_index;
 };
 
@@ -236,12 +223,11 @@ ClusterVConnectionCache::init()
     // Setup up periodic purge events on each hash list
 
     eh = new ClusterVConnectionCacheEvent(this, n);
-    hash_event[n] =
-      eventProcessor.schedule_in(eh, HRTIME_SECONDS(ClusterVConnectionCache::SCAN_INTERVAL), ET_CACHE_CONT_SM);
+    hash_event[n] = eventProcessor.schedule_in(eh, HRTIME_SECONDS(ClusterVConnectionCache::SCAN_INTERVAL), ET_CACHE_CONT_SM);
   }
 }
 inline int
-ClusterVConnectionCache::MD5ToIndex(INK_MD5 * p)
+ClusterVConnectionCache::MD5ToIndex(INK_MD5 *p)
 {
   uint64_t i = p->fold();
   int32_t h, l;
@@ -252,7 +238,7 @@ ClusterVConnectionCache::MD5ToIndex(INK_MD5 * p)
 }
 
 int
-ClusterVConnectionCache::insert(INK_MD5 * key, ClusterVConnection * vc)
+ClusterVConnectionCache::insert(INK_MD5 *key, ClusterVConnection *vc)
 {
   int index = MD5ToIndex(key);
   Entry *e;
@@ -262,7 +248,7 @@ ClusterVConnectionCache::insert(INK_MD5 * key, ClusterVConnection * vc)
   MUTEX_TRY_LOCK(lock, hash_lock[index], thread);
   if (!lock.is_locked()) {
     CLUSTER_INCREMENT_DYN_STAT(CLUSTER_VC_CACHE_INSERT_LOCK_MISSES_STAT);
-    return 0;                   // lock miss, retry later
+    return 0; // lock miss, retry later
 
   } else {
     // Add entry to list
@@ -273,11 +259,11 @@ ClusterVConnectionCache::insert(INK_MD5 * key, ClusterVConnection * vc)
     hash_table[index].enqueue(e);
     CLUSTER_INCREMENT_DYN_STAT(CLUSTER_VC_CACHE_INSERTS_STAT);
   }
-  return 1;                     // Success
+  return 1; // Success
 }
 
 ClusterVConnection *
-ClusterVConnectionCache::lookup(INK_MD5 * key)
+ClusterVConnectionCache::lookup(INK_MD5 *key)
 {
   int index = MD5ToIndex(key);
   Entry *e;
@@ -288,12 +274,12 @@ ClusterVConnectionCache::lookup(INK_MD5 * key)
   MUTEX_TRY_LOCK(lock, hash_lock[index], thread);
   if (!lock.is_locked()) {
     CLUSTER_INCREMENT_DYN_STAT(CLUSTER_VC_CACHE_LOOKUP_LOCK_MISSES_STAT);
-    return vc;                  // lock miss, retry later
+    return vc; // lock miss, retry later
 
   } else {
     e = hash_table[index].head;
     while (e) {
-      if (*key == e->key) {     // Hit
+      if (*key == e->key) { // Hit
         vc = e->vc;
         hash_table[index].remove(e);
         ClusterVCCacheEntryAlloc.free(e);
@@ -306,11 +292,11 @@ ClusterVConnectionCache::lookup(INK_MD5 * key)
     }
   }
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_VC_CACHE_LOOKUP_MISSES_STAT);
-  return (ClusterVConnection *) - 1;    // Miss
+  return (ClusterVConnection *)-1; // Miss
 }
 
 int
-ClusterVConnectionCacheEvent::eventHandler(int /* event ATS_UNUSED */, Event * e)
+ClusterVConnectionCacheEvent::eventHandler(int /* event ATS_UNUSED */, Event *e)
 {
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_VC_CACHE_SCANS_STAT);
   MUTEX_TRY_LOCK(lock, cache->hash_lock[hash_index], this_ethread());
@@ -321,8 +307,8 @@ ClusterVConnectionCacheEvent::eventHandler(int /* event ATS_UNUSED */, Event * e
   }
   // Perform purge action on unreferenced VC(s).
 
-  ClusterVConnectionCache::Entry * entry;
-  ClusterVConnectionCache::Entry * next_entry;
+  ClusterVConnectionCache::Entry *entry;
+  ClusterVConnectionCache::Entry *next_entry;
   entry = cache->hash_table[hash_index].head;
 
   while (entry) {
@@ -372,8 +358,8 @@ CacheContinuation::init()
 //   Main function to do a cluster cache operation
 ///////////////////////////////////////////////////////////////////////
 Action *
-CacheContinuation::do_op(Continuation * c, ClusterMachine * mp, void *args,
-                         int user_opcode, char *data, int data_len, int nbytes, MIOBuffer * b)
+CacheContinuation::do_op(Continuation *c, ClusterMachine *mp, void *args, int user_opcode, char *data, int data_len, int nbytes,
+                         MIOBuffer *b)
 {
   CacheContinuation *cc = 0;
   Action *act = 0;
@@ -410,8 +396,7 @@ CacheContinuation::do_op(Continuation * c, ClusterMachine * mp, void *args,
     cc->start_time = ink_get_hrtime();
     cc->from = mp;
     cc->result = op_failure(opcode);
-    SET_CONTINUATION_HANDLER(cc, (CacheContHandler)
-                             & CacheContinuation::remoteOpEvent);
+    SET_CONTINUATION_HANDLER(cc, (CacheContHandler)&CacheContinuation::remoteOpEvent);
     act = &cc->action;
 
     // set up sequence number so we can find this continuation
@@ -424,7 +409,6 @@ CacheContinuation::do_op(Continuation * c, ClusterMachine * mp, void *args,
     unsigned int hash = FOLDHASH(cc->target_ip, cc->seq_number);
     MUTEX_TRY_LOCK(queuelock, remoteCacheContQueueMutex[hash], this_ethread());
     if (!queuelock.is_locked()) {
-
       // failed to acquire lock: no problem, retry later
       cc->timeout = eventProcessor.schedule_in(cc, CACHE_RETRY_PERIOD, ET_CACHE_CONT_SM);
     } else {
@@ -437,176 +421,169 @@ CacheContinuation::do_op(Continuation * c, ClusterMachine * mp, void *args,
   // Determine the type of the "Over The Wire" (OTW) message header and
   //   initialize it.
   //
-  Debug("cache_msg",
-        "do_op opcode=%d seqno=%d Machine=%p data=%p datalen=%d mio=%p",
-        opcode, (c ? cc->seq_number : CACHE_NO_RESPONSE), mp, data, data_len, b);
+  Debug("cache_msg", "do_op opcode=%d seqno=%d Machine=%p data=%p datalen=%d mio=%p", opcode,
+        (c ? cc->seq_number : CACHE_NO_RESPONSE), mp, data, data_len, b);
 
   switch (opcode) {
   case CACHE_OPEN_WRITE_BUFFER:
-  case CACHE_OPEN_WRITE_BUFFER_LONG:
-    {
-      ink_release_assert(!"write buffer not supported");
-      break;
-    }
+  case CACHE_OPEN_WRITE_BUFFER_LONG: {
+    ink_release_assert(!"write buffer not supported");
+    break;
+  }
   case CACHE_OPEN_READ_BUFFER:
-  case CACHE_OPEN_READ_BUFFER_LONG:
-    {
-      ink_release_assert(!"read buffer not supported");
-      break;
-    }
+  case CACHE_OPEN_READ_BUFFER_LONG: {
+    ink_release_assert(!"read buffer not supported");
+    break;
+  }
   case CACHE_OPEN_WRITE:
-  case CACHE_OPEN_READ:
-    {
-      ink_release_assert(c > 0);
-      //////////////////////
-      // Use short format //
-      //////////////////////
-      if (!data) {
-        data_len = op_to_sizeof_fixedlen_msg(opcode);
-        data = (char *) ALLOCA_DOUBLE(data_len);
-      }
-      msg = (char *) data;
-      CacheOpMsg_short *m = (CacheOpMsg_short *) msg;
-      m->init();
-      m->opcode = opcode;
-      m->cfl_flags = ((CacheOpArgs_General *) args)->cfl_flags;
-      m->md5 = *((CacheOpArgs_General *) args)->url_md5;
-      cc->url_md5 = m->md5;
-      m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
-      m->frag_type = ((CacheOpArgs_General *) args)->frag_type;
-      if (opcode == CACHE_OPEN_WRITE) {
-        m->nbytes = nbytes;
-        m->data = (uint32_t) ((CacheOpArgs_General *) args)->pin_in_cache;
-      } else {
-        m->nbytes = 0;
-        m->data = 0;
-      }
-
-      if (opcode == CACHE_OPEN_READ) {
-        //
-        // Set upper limit on initial data received with response
-        // for open read response
-        //
-        m->buffer_size = DEFAULT_MAX_BUFFER_SIZE;
-      } else {
-        m->buffer_size = 0;
-      }
+  case CACHE_OPEN_READ: {
+    ink_release_assert(c > 0);
+    //////////////////////
+    // Use short format //
+    //////////////////////
+    if (!data) {
+      data_len = op_to_sizeof_fixedlen_msg(opcode);
+      data = (char *)ALLOCA_DOUBLE(data_len);
+    }
+    msg = (char *)data;
+    CacheOpMsg_short *m = (CacheOpMsg_short *)msg;
+    m->init();
+    m->opcode = opcode;
+    m->cfl_flags = ((CacheOpArgs_General *)args)->cfl_flags;
+    m->md5 = *((CacheOpArgs_General *)args)->url_md5;
+    cc->url_md5 = m->md5;
+    m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
+    m->frag_type = ((CacheOpArgs_General *)args)->frag_type;
+    if (opcode == CACHE_OPEN_WRITE) {
+      m->nbytes = nbytes;
+      m->data = (uint32_t)((CacheOpArgs_General *)args)->pin_in_cache;
+    } else {
+      m->nbytes = 0;
+      m->data = 0;
+    }
 
+    if (opcode == CACHE_OPEN_READ) {
       //
-      // Establish the local VC
+      // Set upper limit on initial data received with response
+      // for open read response
       //
-      int res = setup_local_vc(msg, data_len, cc, mp, &act);
-      if (!res) {
-        /////////////////////////////////////////////////////
-        // Unable to setup local VC, request aborted.
-        // Remove request from pending list and deallocate.
-        /////////////////////////////////////////////////////
-        cc->remove_and_delete(0, (Event *) 0);
-        return act;
-
-      } else if (res != -1) {
-        ///////////////////////////////////////
-        // VC established, send request
-        ///////////////////////////////////////
-        break;
+      m->buffer_size = DEFAULT_MAX_BUFFER_SIZE;
+    } else {
+      m->buffer_size = 0;
+    }
 
-      } else {
-        //////////////////////////////////////////////////////
-        // Unable to setup VC, delay required, await callback
-        //////////////////////////////////////////////////////
-        goto no_send_exit;
-      }
+    //
+    // Establish the local VC
+    //
+    int res = setup_local_vc(msg, data_len, cc, mp, &act);
+    if (!res) {
+      /////////////////////////////////////////////////////
+      // Unable to setup local VC, request aborted.
+      // Remove request from pending list and deallocate.
+      /////////////////////////////////////////////////////
+      cc->remove_and_delete(0, (Event *)0);
+      return act;
+
+    } else if (res != -1) {
+      ///////////////////////////////////////
+      // VC established, send request
+      ///////////////////////////////////////
+      break;
+
+    } else {
+      //////////////////////////////////////////////////////
+      // Unable to setup VC, delay required, await callback
+      //////////////////////////////////////////////////////
+      goto no_send_exit;
     }
+  }
 
   case CACHE_OPEN_READ_LONG:
-  case CACHE_OPEN_WRITE_LONG:
-    {
-      ink_release_assert(c > 0);
-      //////////////////////
-      // Use long format  //
-      //////////////////////
-      msg = data;
-      CacheOpMsg_long *m = (CacheOpMsg_long *) msg;
-      m->init();
-      m->opcode = opcode;
-      m->cfl_flags = ((CacheOpArgs_General *) args)->cfl_flags;
-      m->url_md5 = *((CacheOpArgs_General *) args)->url_md5;
-      cc->url_md5 = m->url_md5;
-      m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
-      m->nbytes = nbytes;
-      m->data = (uint32_t) ((CacheOpArgs_General *) args)->pin_in_cache;
-      m->frag_type = (uint32_t) ((CacheOpArgs_General *) args)->frag_type;
-
-      if (opcode == CACHE_OPEN_READ_LONG) {
-        //
-        // Set upper limit on initial data received with response
-        // for open read response
-        //
-        m->buffer_size = DEFAULT_MAX_BUFFER_SIZE;
-      } else {
-        m->buffer_size = 0;
-      }
+  case CACHE_OPEN_WRITE_LONG: {
+    ink_release_assert(c > 0);
+    //////////////////////
+    // Use long format  //
+    //////////////////////
+    msg = data;
+    CacheOpMsg_long *m = (CacheOpMsg_long *)msg;
+    m->init();
+    m->opcode = opcode;
+    m->cfl_flags = ((CacheOpArgs_General *)args)->cfl_flags;
+    m->url_md5 = *((CacheOpArgs_General *)args)->url_md5;
+    cc->url_md5 = m->url_md5;
+    m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
+    m->nbytes = nbytes;
+    m->data = (uint32_t)((CacheOpArgs_General *)args)->pin_in_cache;
+    m->frag_type = (uint32_t)((CacheOpArgs_General *)args)->frag_type;
+
+    if (opcode == CACHE_OPEN_READ_LONG) {
       //
-      // Establish the local VC
+      // Set upper limit on initial data received with response
+      // for open read response
       //
-      int res = setup_local_vc(msg, data_len, cc, mp, &act);
-      if (!res) {
-        /////////////////////////////////////////////////////
-        // Unable to setup local VC, request aborted.
-        // Remove request from pending list and deallocate.
-        /////////////////////////////////////////////////////
-        cc->remove_and_delete(0, (Event *) 0);
-        return act;
-
-      } else if (res != -1) {
-        ///////////////////////////////////////
-        // VC established, send request
-        ///////////////////////////////////////
-        break;
+      m->buffer_size = DEFAULT_MAX_BUFFER_SIZE;
+    } else {
+      m->buffer_size = 0;
+    }
+    //
+    // Establish the local VC
+    //
+    int res = setup_local_vc(msg, data_len, cc, mp, &act);
+    if (!res) {
+      /////////////////////////////////////////////////////
+      // Unable to setup local VC, request aborted.
+      // Remove request from pending list and deallocate.
+      /////////////////////////////////////////////////////
+      cc->remove_and_delete(0, (Event *)0);
+      return act;
 
-      } else {
-        //////////////////////////////////////////////////////
-        // Unable to setup VC, delay required, await callback
-        //////////////////////////////////////////////////////
-        goto no_send_exit;
-      }
+    } else if (res != -1) {
+      ///////////////////////////////////////
+      // VC established, send request
+      ///////////////////////////////////////
+      break;
+
+    } else {
+      //////////////////////////////////////////////////////
+      // Unable to setup VC, delay required, await callback
+      //////////////////////////////////////////////////////
+      goto no_send_exit;
     }
+  }
   case CACHE_UPDATE:
   case CACHE_REMOVE:
-  case CACHE_DEREF:
-    {
-      //////////////////////
-      // Use short format //
-      //////////////////////
-      msg = data;
-      CacheOpMsg_short *m = (CacheOpMsg_short *) msg;
-      m->init();
-      m->opcode = opcode;
-      m->frag_type = ((CacheOpArgs_Deref *) args)->frag_type;
-      m->cfl_flags = ((CacheOpArgs_Deref *) args)->cfl_flags;
-      if (opcode == CACHE_DEREF)
-        m->md5 = *((CacheOpArgs_Deref *) args)->md5;
-      else
-        m->md5 = *((CacheOpArgs_General *) args)->url_md5;
-      m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
-      break;
-    }
-  case CACHE_LINK:
-    {
-      ////////////////////////
-      // Use short_2 format //
-      ////////////////////////
-      msg = data;
-      CacheOpMsg_short_2 *m = (CacheOpMsg_short_2 *) msg;
-      m->init();
-      m->opcode = opcode;
-      m->cfl_flags = ((CacheOpArgs_Link *) args)->cfl_flags;
-      m->md5_1 = *((CacheOpArgs_Link *) args)->from;
-      m->md5_2 = *((CacheOpArgs_Link *) args)->to;
-      m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
-      m->frag_type = ((CacheOpArgs_Link *) args)->frag_type;
-      break;
-    }
+  case CACHE_DEREF: {
+    //////////////////////
+    // Use short format //
+    //////////////////////
+    msg = data;
+    CacheOpMsg_short *m = (CacheOpMsg_short *)msg;
+    m->init();
+    m->opcode = opcode;
+    m->frag_type = ((CacheOpArgs_Deref *)args)->frag_type;
+    m->cfl_flags = ((CacheOpArgs_Deref *)args)->cfl_flags;
+    if (opcode == CACHE_DEREF)
+      m->md5 = *((CacheOpArgs_Deref *)args)->md5;
+    else
+      m->md5 = *((CacheOpArgs_General *)args)->url_md5;
+    m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
+    break;
+  }
+  case CACHE_LINK: {
+    ////////////////////////
+    // Use short_2 format //
+    ////////////////////////
+    msg = data;
+    CacheOpMsg_short_2 *m = (CacheOpMsg_short_2 *)msg;
+    m->init();
+    m->opcode = opcode;
+    m->cfl_flags = ((CacheOpArgs_Link *)args)->cfl_flags;
+    m->md5_1 = *((CacheOpArgs_Link *)args)->from;
+    m->md5_2 = *((CacheOpArgs_Link *)args)->to;
+    m->seq_number = (c ? cc->seq_number : CACHE_NO_RESPONSE);
+    m->frag_type = ((CacheOpArgs_Link *)args)->frag_type;
+    break;
+  }
   default:
     msg = 0;
     break;
@@ -614,20 +591,19 @@ CacheContinuation::do_op(Continuation * c, ClusterMachine * mp, void *args,
 #ifdef CACHE_MSG_TRACE
   log_cache_op_sndmsg((c ? cc->seq_number : CACHE_NO_RESPONSE), 0, "do_op");
 #endif
-  clusterProcessor.invoke_remote(ch,
-                                 op_needs_marshalled_coi(opcode) ? CACHE_OP_MALLOCED_CLUSTER_FUNCTION
-                                 : CACHE_OP_CLUSTER_FUNCTION, (char *) msg, data_len);
+  clusterProcessor.invoke_remote(
+    ch, op_needs_marshalled_coi(opcode) ? CACHE_OP_MALLOCED_CLUSTER_FUNCTION : CACHE_OP_CLUSTER_FUNCTION, (char *)msg, data_len);
 
 no_send_exit:
   if (c) {
     return act;
   } else {
-    return (Action *) 0;
+    return (Action *)0;
   }
 }
 
 int
-CacheContinuation::setup_local_vc(char *data, int data_len, CacheContinuation * cc, ClusterMachine * mp, Action ** act)
+CacheContinuation::setup_local_vc(char *data, int data_len, CacheContinuation *cc, ClusterMachine *mp, Action **act)
 {
   bool read_op = op_is_read(cc->request_opcode);
   bool short_msg = op_is_shortform(cc->request_opcode);
@@ -637,13 +613,12 @@ CacheContinuation::setup_local_vc(char *data, int data_len, CacheContinuation *
   cc->allocMsgBuffer();
   memcpy(cc->getMsgBuffer(), data, data_len);
 
-  SET_CONTINUATION_HANDLER(cc, (CacheContHandler)
-                           & CacheContinuation::localVCsetupEvent);
+  SET_CONTINUATION_HANDLER(cc, (CacheContHandler)&CacheContinuation::localVCsetupEvent);
 
   if (short_msg) {
-    Debug("cache_proto", "open_local-s (%s) seqno=%d", (read_op ? "R" : "W"), ((CacheOpMsg_short *) data)->seq_number);
+    Debug("cache_proto", "open_local-s (%s) seqno=%d", (read_op ? "R" : "W"), ((CacheOpMsg_short *)data)->seq_number);
   } else {
-    Debug("cache_proto", "open_local-l (%s) seqno=%d", (read_op ? "R" : "W"), ((CacheOpMsg_long *) data)->seq_number);
+    Debug("cache_proto", "open_local-l (%s) seqno=%d", (read_op ? "R" : "W"), ((CacheOpMsg_long *)data)->seq_number);
   }
 
   // Create local VC
@@ -655,17 +630,14 @@ CacheContinuation::setup_local_vc(char *data, int data_len, CacheContinuation *
 
   } else {
     vc = clusterProcessor.open_local(cc, mp, cc->open_local_token,
-                                     (CLUSTER_OPT_ALLOW_IMMEDIATE |
-                                      (read_op ? CLUSTER_OPT_CONN_READ : CLUSTER_OPT_CONN_WRITE)));
+                                     (CLUSTER_OPT_ALLOW_IMMEDIATE | (read_op ? CLUSTER_OPT_CONN_READ : CLUSTER_OPT_CONN_WRITE)));
   }
   if (!vc) {
     // Error, abort request
     if (short_msg) {
-      Debug("cache_proto", "0open_local-s (%s) failed, seqno=%d",
-            (read_op ? "R" : "W"), ((CacheOpMsg_short *) data)->seq_number);
+      Debug("cache_proto", "0open_local-s (%s) failed, seqno=%d", (read_op ? "R" : "W"), ((CacheOpMsg_short *)data)->seq_number);
     } else {
-      Debug("cache_proto", "1open_local-l (%s) failed, seqno=%d",
-            (read_op ? "R" : "W"), ((CacheOpMsg_long *) data)->seq_number);
+      Debug("cache_proto", "1open_local-l (%s) failed, seqno=%d", (read_op ? "R" : "W"), ((CacheOpMsg_long *)data)->seq_number);
     }
     cc->freeMsgBuffer();
     if (cc->timeout)
@@ -687,23 +659,20 @@ CacheContinuation::setup_local_vc(char *data, int data_len, CacheContinuation *
     vc->current_cont = cc;
 
     if (short_msg) {
-      CacheOpMsg_short *ms = (CacheOpMsg_short *) data;
+      CacheOpMsg_short *ms = (CacheOpMsg_short *)data;
       ms->channel = vc->channel;
       ms->token = cc->open_local_token;
-      Debug("cache_proto",
-            "0open_local-s (%s) success, seqno=%d chan=%d token=%d,%d VC=%p",
-            (read_op ? "R" : "W"), ms->seq_number, vc->channel, ms->token.ip_created, ms->token.sequence_number, vc);
+      Debug("cache_proto", "0open_local-s (%s) success, seqno=%d chan=%d token=%d,%d VC=%p", (read_op ? "R" : "W"), ms->seq_number,
+            vc->channel, ms->token.ip_created, ms->token.sequence_number, vc);
     } else {
-      CacheOpMsg_long *ml = (CacheOpMsg_long *) data;
+      CacheOpMsg_long *ml = (CacheOpMsg_long *)data;
       ml->channel = vc->channel;
       ml->token = cc->open_local_token;
-      Debug("cache_proto",
-            "1open_local-l (%s) success, seqno=%d chan=%d token=%d,%d VC=%p",
-            (read_op ? "R" : "W"), ml->seq_number, vc->channel, ml->token.ip_created, ml->token.sequence_number, vc);
+      Debug("cache_proto", "1open_local-l (%s) success, seqno=%d chan=%d token=%d,%d VC=%p", (read_op ? "R" : "W"), ml->seq_number,
+            vc->channel, ml->token.ip_created, ml->token.sequence_number, vc);
     }
     cc->freeMsgBuffer();
-    SET_CONTINUATION_HANDLER(cc, (CacheContHandler)
-                             & CacheContinuation::remoteOpEvent);
+    SET_CONTINUATION_HANDLER(cc, (CacheContHandler)&CacheContinuation::remoteOpEvent);
     return 1;
 
   } else {
@@ -723,14 +692,13 @@ CacheContinuation::lookupOpenWriteVC()
   // failed.
   ///////////////////////////////////////////////////////////////
   ClusterVConnection *vc;
-  CacheOpMsg_long *ml = (CacheOpMsg_long *) getMsgBuffer();
+  CacheOpMsg_long *ml = (CacheOpMsg_long *)getMsgBuffer();
 
   vc = GlobalOpenWriteVCcache->lookup(&ml->url_md5);
 
-  if (vc == ((ClusterVConnection *) 0)) {
+  if (vc == ((ClusterVConnection *)0)) {
     // Retry lookup
-    SET_CONTINUATION_HANDLER(this, (CacheContHandler)
-                             & CacheContinuation::lookupOpenWriteVCEvent);
+    SET_CONTINUATION_HANDLER(this, (CacheContHandler)&CacheContinuation::lookupOpenWriteVCEvent);
     //
     // Note: In the lookupOpenWriteVCEvent handler, we use EVENT_IMMEDIATE
     //       to distinguish the lookup retry from a request timeout
@@ -738,15 +706,14 @@ CacheContinuation::lookupOpenWriteVC()
     //
     lookup_open_write_vc_event = eventProcessor.schedule_imm(this, ET_CACHE_CONT_SM);
 
-  } else if (vc != ((ClusterVConnection *) - 1)) {
+  } else if (vc != ((ClusterVConnection *)-1)) {
     // Hit, found open_write VC in cache.
     // Post open_write completion by simulating a
     // remote cache op result message.
 
-    vc->action_ = action;       // establish new continuation
+    vc->action_ = action; // establish new continuation
 
-    SET_CONTINUATION_HANDLER(this, (CacheContHandler)
-                             & CacheContinuation::localVCsetupEvent);
+    SET_CONTINUATION_HANDLER(this, (CacheContHandler)&CacheContinuation::localVCsetupEvent);
     this->handleEvent(CLUSTER_EVENT_OPEN_EXISTS, vc);
 
     CacheOpReplyMsg msg;
@@ -757,15 +724,13 @@ CacheContinuation::lookupOpenWriteVC()
     msg.seq_number = seq_number;
     msg.token = vc->token;
 
-    cache_op_result_ClusterFunction(ch, (void *) &msg, msglen);
+    cache_op_result_ClusterFunction(ch, (void *)&msg, msglen);
 
   } else {
     // Miss, establish local VC and send remote open_write request
 
-    SET_CONTINUATION_HANDLER(this, (CacheContHandler)
-                             & CacheContinuation::localVCsetupEvent);
-    vc = clusterProcessor.open_local(this, from, open_local_token,
-                                     (CLUSTER_OPT_ALLOW_IMMEDIATE | CLUSTER_OPT_CONN_WRITE));
+    SET_CONTINUATION_HANDLER(this, (CacheContHandler)&CacheContinuation::localVCsetupEvent);
+    vc = clusterProcessor.open_local(this, from, open_local_token, (CLUSTER_OPT_ALLOW_IMMEDIATE | CLUSTER_OPT_CONN_WRITE));
     if (!vc) {
       this->handleEvent(CLUSTER_EVENT_OPEN_FAILED, 0);
 
@@ -773,11 +738,11 @@ CacheContinuation::lookupOpenWriteVC()
       this->handleEvent(CLUSTER_EVENT_OPEN, vc);
     }
   }
-  return CLUSTER_DELAYED_OPEN;  // force completion in callback
+  return CLUSTER_DELAYED_OPEN; // force completion in callback
 }
 
 int
-CacheContinuation::lookupOpenWriteVCEvent(int event, Event * e)
+CacheContinuation::lookupOpenWriteVCEvent(int event, Event *e)
 {
   if (event == EVENT_IMMEDIATE) {
     // Retry open_write VC lookup
@@ -785,15 +750,14 @@ CacheContinuation::lookupOpenWriteVCEvent(int event, Event * e)
 
   } else {
     lookup_open_write_vc_event->cancel();
-    SET_CONTINUATION_HANDLER(this, (CacheContHandler)
-                             & CacheContinuation::localVCsetupEvent);
+    SET_CONTINUATION_HANDLER(this, (CacheContHandler)&CacheContinuation::localVCsetupEvent);
     this->handleEvent(event, e);
   }
   return EVENT_DONE;
 }
 
 int
-CacheContinuation::remove_and_delete(int /* event ATS_UNUSED */, Event * e)
+CacheContinuation::remove_and_delete(int /* event ATS_UNUSED */, Event *e)
 {
   unsigned int hash = FOLDHASH(target_ip, seq_number);
   MUTEX_TRY_LOCK(queuelock, remoteCacheContQueueMutex[hash], this_ethread());
@@ -808,7 +772,7 @@ CacheContinuation::remove_and_delete(int /* event ATS_UNUSED */, Event * e)
       cacheContAllocator_free(this);
 
   } else {
-    SET_HANDLER((CacheContHandler) & CacheContinuation::remove_and_delete);
+    SET_HANDLER((CacheContHandler)&CacheContinuation::remove_and_delete);
     if (!e) {
       timeout = eventProcessor.schedule_in(this, cache_cluster_timeout, ET_CACHE_CONT_SM);
     } else {
@@ -819,15 +783,15 @@ CacheContinuation::remove_and_delete(int /* event ATS_UNUSED */, Event * e)
 }
 
 int
-CacheContinuation::localVCsetupEvent(int event, ClusterVConnection * vc)
+CacheContinuation::localVCsetupEvent(int event, ClusterVConnection *vc)
 {
-  ink_assert(magicno == (int) MagicNo);
+  ink_assert(magicno == (int)MagicNo);
   ink_assert(getMsgBuffer());
   bool short_msg = op_is_shortform(request_opcode);
   bool read_op = op_is_read(request_opcode);
 
   if (event == EVENT_INTERVAL) {
-    Event *e = (Event *) vc;
+    Event *e = (Event *)vc;
     unsigned int hash = FOLDHASH(target_ip, seq_number);
 
     MUTEX_TRY_LOCK(queuelock, remoteCacheContQueueMutex[hash], e->ethread);
@@ -854,7 +818,7 @@ CacheContinuation::localVCsetupEvent(int event, ClusterVConnection * vc)
       MUTEX_RELEASE(queuelock);
       Debug("cluster_timeout", "0cluster op timeout %d", seq_number);
       CLUSTER_INCREMENT_DYN_STAT(CLUSTER_REMOTE_OP_TIMEOUTS_STAT);
-      timeout = (Event *) 1;    // Note timeout
+      timeout = (Event *)1; // Note timeout
       /////////////////////////////////////////////////////////////////
       // Note: Failure callback is sent now, but the deallocation of
       //       the CacheContinuation is deferred until we receive the
@@ -865,8 +829,8 @@ CacheContinuation::localVCsetupEvent(int event, ClusterVConnection * vc)
       return EVENT_DONE;
     }
 
-  } else if (((event == CLUSTER_EVENT_OPEN) || (event == CLUSTER_EVENT_OPEN_EXISTS))
-             && (((ptrdiff_t) timeout & (ptrdiff_t) 1) == 0)) {
+  } else if (((event == CLUSTER_EVENT_OPEN) || (event == CLUSTER_EVENT_OPEN_EXISTS)) &&
+             (((ptrdiff_t)timeout & (ptrdiff_t)1) == 0)) {
     ink_hrtime now;
     now = ink_get_hrtime();
     CLUSTER_SUM_DYN_STAT(CLUSTER_OPEN_DELAY_TIME_STAT, now - start_time);
@@ -880,43 +844,40 @@ CacheContinuation::localVCsetupEvent(int event, ClusterVConnection * vc)
     vc->current_cont = this;
 
     if (short_msg) {
-      CacheOpMsg_short *ms = (CacheOpMsg_short *) getMsgBuffer();
+      CacheOpMsg_short *ms = (CacheOpMsg_short *)getMsgBuffer();
       ms->channel = vc->channel;
       ms->token = open_local_token;
 
-      Debug("cache_proto",
-            "2open_local-s (%s) success, seqno=%d chan=%d token=%d,%d VC=%p",
-            (read_op ? "R" : "W"), ms->seq_number, vc->channel, ms->token.ip_created, ms->token.sequence_number, vc);
+      Debug("cache_proto", "2open_local-s (%s) success, seqno=%d chan=%d token=%d,%d VC=%p", (read_op ? "R" : "W"), ms->seq_number,
+            vc->channel, ms->token.ip_created, ms->token.sequence_number, vc);
 
     } else {
-      CacheOpMsg_long *ml = (CacheOpMsg_long *) getMsgBuffer();
+      CacheOpMsg_long *ml = (CacheOpMsg_long *)getMsgBuffer();
       ml->channel = vc->channel;
       ml->token = open_local_token;
 
-      Debug("cache_proto",
-            "3open_local-l (%s) success, seqno=%d chan=%d token=%d,%d VC=%p",
-            (read_op ? "R" : "W"), ml->seq_number, vc->channel, ml->token.ip_created, ml->token.sequence_number, vc);
+      Debug("cache_proto", "3open_local-l (%s) success, seqno=%d chan=%d token=%d,%d VC=%p", (read_op ? "R" : "W"), ml->seq_number,
+            vc->channel, ml->token.ip_created, ml->token.sequence_number, vc);
     }
-    SET_HANDLER((CacheContHandler) & CacheContinuation::remoteOpEvent);
+    SET_HANDLER((CacheContHandler)&CacheContinuation::remoteOpEvent);
 
     if (event != CLUSTER_EVENT_OPEN_EXISTS) {
       // Send request message
-      clusterProcessor.invoke_remote(ch,
-                                     (op_needs_marshalled_coi(request_opcode) ?
-                                      CACHE_OP_MALLOCED_CLUSTER_FUNCTION :
-                                      CACHE_OP_CLUSTER_FUNCTION), (char *) getMsgBuffer(), getMsgBufferLen());
+      clusterProcessor.invoke_remote(
+        ch, (op_needs_marshalled_coi(request_opcode) ? CACHE_OP_MALLOCED_CLUSTER_FUNCTION : CACHE_OP_CLUSTER_FUNCTION),
+        (char *)getMsgBuffer(), getMsgBufferLen());
     }
 
   } else {
     int send_failure_callback = 1;
 
-    if (((ptrdiff_t) timeout & (ptrdiff_t) 1) == 0) {
+    if (((ptrdiff_t)timeout & (ptrdiff_t)1) == 0) {
       if (short_msg) {
-        Debug("cache_proto", "2open_local-s (%s) failed, seqno=%d",
-              (read_op ? "R" : "W"), ((CacheOpMsg_short *) getMsgBuffer())->seq_number);
+        Debug("cache_proto", "2open_local-s (%s) failed, seqno=%d", (read_op ? "R" : "W"),
+              ((CacheOpMsg_short *)getMsgBuffer())->seq_number);
       } else {
-        Debug("cache_proto", "3open_local-l (%s) failed, seqno=%d",
-              (read_op ? "R" : "W"), ((CacheOpMsg_long *) getMsgBuffer())->seq_number);
+        Debug("cache_proto", "3open_local-l (%s) failed, seqno=%d", (read_op ? "R" : "W"),
+              ((CacheOpMsg_long *)getMsgBuffer())->seq_number);
       }
 
     } else {
@@ -927,10 +888,10 @@ CacheContinuation::localVCsetupEvent(int event, ClusterVConnection * vc)
 
       if (event == CLUSTER_EVENT_OPEN) {
         vc->pending_remote_fill = 0;
-        vc->remote_closed = 1;  // avoid remote close msg
+        vc->remote_closed = 1; // avoid remote close msg
         vc->do_io(VIO::CLOSE);
       }
-      send_failure_callback = 0;        // already sent.
+      send_failure_callback = 0; // already sent.
     }
 
     if (this->timeout)
@@ -947,7 +908,7 @@ CacheContinuation::localVCsetupEvent(int event, ClusterVConnection * vc)
       this->use_deferred_callback = true;
       this->result = (read_op ? CACHE_EVENT_OPEN_READ_FAILED : CACHE_EVENT_OPEN_WRITE_FAILED);
       this->result_error = 0;
-      remove_and_delete(0, (Event *) 0);
+      remove_and_delete(0, (Event *)0);
 
     } else {
       cacheContAllocator_free(this);
@@ -973,29 +934,29 @@ inline CacheOpMsg_long *
 unmarshal_CacheOpMsg_long(void *data, int NeedByteSwap)
 {
   if (NeedByteSwap)
-    ((CacheOpMsg_long *) data)->SwapBytes();
-  return (CacheOpMsg_long *) data;
+    ((CacheOpMsg_long *)data)->SwapBytes();
+  return (CacheOpMsg_long *)data;
 }
 
 inline CacheOpMsg_short *
 unmarshal_CacheOpMsg_short(void *data, int NeedByteSwap)
 {
   if (NeedByteSwap)
-    ((CacheOpMsg_short *) data)->SwapBytes();
-  return (CacheOpMsg_short *) data;
+    ((CacheOpMsg_short *)data)->SwapBytes();
+  return (CacheOpMsg_short *)data;
 }
 
 inline CacheOpMsg_short_2 *
 unmarshal_CacheOpMsg_short_2(void *data, int NeedByteSwap)
 {
   if (NeedByteSwap)
-    ((CacheOpMsg_short_2 *) data)->SwapBytes();
-  return (CacheOpMsg_short_2 *) data;
+    ((CacheOpMsg_short_2 *)data)->SwapBytes();
+  return (CacheOpMsg_short_2 *)data;
 }
 
 // init_from_long() support routine for cache_op_ClusterFunction()
 inline void
-init_from_long(CacheContinuation * cont, CacheOpMsg_long * msg, ClusterMachine * m)
+init_from_long(CacheContinuation *cont, CacheOpMsg_long *msg, ClusterMachine *m)
 {
   cont->no_reply_message = (msg->seq_number == CACHE_NO_RESPONSE);
   cont->seq_number = msg->seq_number;
@@ -1003,15 +964,14 @@ init_from_long(CacheContinuation * cont, CacheOpMsg_long * msg, ClusterMachine *
   cont->from = m;
   cont->url_md5 = msg->url_md5;
   cont->cluster_vc_channel = msg->channel;
-  cont->frag_type = (CacheFragType) msg->frag_type;
-  if ((cont->request_opcode == CACHE_OPEN_WRITE_LONG)
-      || (cont->request_opcode == CACHE_OPEN_READ_LONG)) {
-    cont->pin_in_cache = (time_t) msg->data;
+  cont->frag_type = (CacheFragType)msg->frag_type;
+  if ((cont->request_opcode == CACHE_OPEN_WRITE_LONG) || (cont->request_opcode == CACHE_OPEN_READ_LONG)) {
+    cont->pin_in_cache = (time_t)msg->data;
   } else {
     cont->pin_in_cache = 0;
   }
   cont->token = msg->token;
-  cont->nbytes = (((int) msg->nbytes < 0) ? 0 : msg->nbytes);
+  cont->nbytes = (((int)msg->nbytes < 0) ? 0 : msg->nbytes);
 
   if (cont->request_opcode == CACHE_OPEN_READ_LONG) {
     cont->caller_buf_freebytes = msg->buffer_size;
@@ -1022,7 +982,7 @@ init_from_long(CacheContinuation * cont, CacheOpMsg_long * msg, ClusterMachine *
 
 // init_from_short() support routine for cache_op_ClusterFunction()
 inline void
-init_from_short(CacheContinuation * cont, CacheOpMsg_short * msg, ClusterMachine * m)
+init_from_short(CacheContinuation *cont, CacheOpMsg_short *msg, ClusterMachine *m)
 {
   cont->no_reply_message = (msg->seq_number == CACHE_NO_RESPONSE);
   cont->seq_number = msg->seq_number;
@@ -1031,11 +991,11 @@ init_from_short(CacheContinuation * cont, CacheOpMsg_short * msg, ClusterMachine
   cont->url_md5 = msg->md5;
   cont->cluster_vc_channel = msg->channel;
   cont->token = msg->token;
-  cont->nbytes = (((int) msg->nbytes < 0) ? 0 : msg->nbytes);
-  cont->frag_type = (CacheFragType) msg->frag_type;
+  cont->nbytes = (((int)msg->nbytes < 0) ? 0 : msg->nbytes);
+  cont->frag_type = (CacheFragType)msg->frag_type;
 
   if (cont->request_opcode == CACHE_OPEN_WRITE) {
-    cont->pin_in_cache = (time_t) msg->data;
+    cont->pin_in_cache = (time_t)msg->data;
   } else {
     cont->pin_in_cache = 0;
   }
@@ -1049,18 +1009,18 @@ init_from_short(CacheContinuation * cont, CacheOpMsg_short * msg, ClusterMachine
 
 // init_from_short_2() support routine for cache_op_ClusterFunction()
 inline void
-init_from_short_2(CacheContinuation * cont, CacheOpMsg_short_2 * msg, ClusterMachine * m)
+init_from_short_2(CacheContinuation *cont, CacheOpMsg_short_2 *msg, ClusterMachine *m)
 {
   cont->no_reply_message = (msg->seq_number == CACHE_NO_RESPONSE);
   cont->seq_number = msg->seq_number;
   cont->cfl_flags = msg->cfl_flags;
   cont->from = m;
   cont->url_md5 = msg->md5_1;
-  cont->frag_type = (CacheFragType) msg->frag_type;
+  cont->frag_type = (CacheFragType)msg->frag_type;
 }
 
 void
-cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
+cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
 {
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
@@ -1070,14 +1030,14 @@ cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CACHE_OUTSTANDING_STAT);
 
   int opcode;
-  ClusterMessageHeader *mh = (ClusterMessageHeader *) data;
+  ClusterMessageHeader *mh = (ClusterMessageHeader *)data;
 
-  if (mh->GetMsgVersion() != CacheOpMsg_long::CACHE_OP_LONG_MESSAGE_VERSION) {  ////////////////////////////////////////////////
+  if (mh->GetMsgVersion() != CacheOpMsg_long::CACHE_OP_LONG_MESSAGE_VERSION) { ////////////////////////////////////////////////
     // Convert from old to current message format
     ////////////////////////////////////////////////
     ink_release_assert(!"cache_op_ClusterFunction() bad msg version");
   }
-  opcode = ((CacheOpMsg_long *) data)->opcode;
+  opcode = ((CacheOpMsg_long *)data)->opcode;
 
   // If necessary, create a continuation to reflect the response back
 
@@ -1088,8 +1048,7 @@ cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
   c->token.clear();
   c->start_time = ink_get_hrtime();
   c->ch = ch;
-  SET_CONTINUATION_HANDLER(c, (CacheContHandler)
-                           & CacheContinuation::replyOpEvent);
+  SET_CONTINUATION_HANDLER(c, (CacheContHandler)&CacheContinuation::replyOpEvent);
 
   switch (opcode) {
   case CACHE_OPEN_WRITE_BUFFER:
@@ -1102,362 +1061,320 @@ cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
     ink_release_assert(!"cache_op_ClusterFunction READ_BUFFER not supported");
     break;
 
-  case CACHE_OPEN_READ:
-    {
-      CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
-      init_from_short(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op-s op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
-      //
-      // Establish the remote side of the ClusterVConnection
-      //
-      c->write_cluster_vc = clusterProcessor.connect_local((Continuation *) 0,
-                                                           &c->token,
-                                                           c->cluster_vc_channel,
-                                                           (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_READ));
-      if (!c->write_cluster_vc) {
-        // Unable to setup channel, abort processing.
-        CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
-        Debug("chan_inuse",
-              "1Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d",
-              c->cluster_vc_channel, DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
-
-        // Send cluster op failed reply
-        c->replyOpEvent(CACHE_EVENT_OPEN_READ_FAILED, (VConnection *) - ECLUSTER_CHANNEL_INUSE);
-        break;
+  case CACHE_OPEN_READ: {
+    CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
+    init_from_short(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op-s op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+    //
+    // Establish the remote side of the ClusterVConnection
+    //
+    c->write_cluster_vc = clusterProcessor.connect_local((Continuation *)0, &c->token, c->cluster_vc_channel,
+                                                         (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_READ));
+    if (!c->write_cluster_vc) {
+      // Unable to setup channel, abort processing.
+      CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
+      Debug("chan_inuse", "1Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d", c->cluster_vc_channel,
+            DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
+
+      // Send cluster op failed reply
+      c->replyOpEvent(CACHE_EVENT_OPEN_READ_FAILED, (VConnection *)-ECLUSTER_CHANNEL_INUSE);
+      break;
 
-      } else {
-        c->write_cluster_vc->current_cont = c;
-      }
-      ink_release_assert(c->write_cluster_vc != CLUSTER_DELAYED_OPEN);
-      ink_release_assert((opcode == CACHE_OPEN_READ)
-                         || c->write_cluster_vc->pending_remote_fill);
-
-      SET_CONTINUATION_HANDLER(c, (CacheContHandler)
-                               & CacheContinuation::setupVCdataRead);
-      Debug("cache_proto",
-            "0read op, seqno=%d chan=%d bufsize=%d token=%d,%d",
-            msg->seq_number, msg->channel, msg->buffer_size, msg->token.ip_created, msg->token.sequence_number);
+    } else {
+      c->write_cluster_vc->current_cont = c;
+    }
+    ink_release_assert(c->write_cluster_vc != CLUSTER_DELAYED_OPEN);
+    ink_release_assert((opcode == CACHE_OPEN_READ) || c->write_cluster_vc->pending_remote_fill);
+
+    SET_CONTINUATION_HANDLER(c, (CacheContHandler)&CacheContinuation::setupVCdataRead);
+    Debug("cache_proto", "0read op, seqno=%d chan=%d bufsize=%d token=%d,%d", msg->seq_number, msg->channel, msg->buffer_size,
+          msg->token.ip_created, msg->token.sequence_number);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_open_read");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_open_read");
 #endif
-      CacheKey key(msg->md5);
+    CacheKey key(msg->md5);
 
-      char *hostname = NULL;
-      int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
-      if (host_len) {
-        hostname = (char *) msg->moi.byte;
-      }
-      Cache *call_cache = caches[c->frag_type];
-      c->cache_action = call_cache->open_read(c, &key, c->frag_type, hostname, host_len);
-      break;
+    char *hostname = NULL;
+    int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
+    if (host_len) {
+      hostname = (char *)msg->moi.byte;
     }
-  case CACHE_OPEN_READ_LONG:
-    {
-      // Cache needs message data, copy it.
-      c->setMsgBufferLen(len);
-      c->allocMsgBuffer();
-      memcpy(c->getMsgBuffer(), (char *) data, len);
-
-      int flen = CacheOpMsg_long::sizeof_fixedlen_msg();
-      CacheOpMsg_long *msg = unmarshal_CacheOpMsg_long(c->getMsgBuffer(), mh->NeedByteSwap());
-      init_from_long(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op-l op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+    Cache *call_cache = caches[c->frag_type];
+    c->cache_action = call_cache->open_read(c, &key, c->frag_type, hostname, host_len);
+    break;
+  }
+  case CACHE_OPEN_READ_LONG: {
+    // Cache needs message data, copy it.
+    c->setMsgBufferLen(len);
+    c->allocMsgBuffer();
+    memcpy(c->getMsgBuffer(), (char *)data, len);
+
+    int flen = CacheOpMsg_long::sizeof_fixedlen_msg();
+    CacheOpMsg_long *msg = unmarshal_CacheOpMsg_long(c->getMsgBuffer(), mh->NeedByteSwap());
+    init_from_long(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op-l op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_open_read_long");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_open_read_long");
 #endif
-      //
-      // Establish the remote side of the ClusterVConnection
-      //
-      c->write_cluster_vc = clusterProcessor.connect_local((Continuation *) 0,
-                                                           &c->token,
-                                                           c->cluster_vc_channel,
-                                                           (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_READ));
-      if (!c->write_cluster_vc) {
-        // Unable to setup channel, abort processing.
-        CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
-        Debug("chan_inuse",
-              "2Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d",
-              c->cluster_vc_channel, DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
-
-        // Send cluster op failed reply
-        c->replyOpEvent(CACHE_EVENT_OPEN_READ_FAILED, (VConnection *) - ECLUSTER_CHANNEL_INUSE);
-        break;
+    //
+    // Establish the remote side of the ClusterVConnection
+    //
+    c->write_cluster_vc = clusterProcessor.connect_local((Continuation *)0, &c->token, c->cluster_vc_channel,
+                                                         (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_READ));
+    if (!c->write_cluster_vc) {
+      // Unable to setup channel, abort processing.
+      CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
+      Debug("chan_inuse", "2Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d", c->cluster_vc_channel,
+            DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
+
+      // Send cluster op failed reply
+      c->replyOpEvent(CACHE_EVENT_OPEN_READ_FAILED, (VConnection *)-ECLUSTER_CHANNEL_INUSE);
+      break;
 
-      } else {
-        c->write_cluster_vc->current_cont = c;
-      }
-      ink_release_assert(c->write_cluster_vc != CLUSTER_DELAYED_OPEN);
-      ink_release_assert((opcode == CACHE_OPEN_READ_LONG)
-                         || c->write_cluster_vc->pending_remote_fill);
-
-      SET_CONTINUATION_HANDLER(c, (CacheContHandler)
-                               & CacheContinuation::setupReadWriteVC);
-      Debug("cache_proto",
-            "1read op, seqno=%d chan=%d bufsize=%d token=%d,%d",
-            msg->seq_number, msg->channel, msg->buffer_size, msg->token.ip_created, msg->token.sequence_number);
-
-      const char *p = (const char *) msg + flen;
-      int moi_len = len - flen;
-      int res;
+    } else {
+      c->write_cluster_vc->current_cont = c;
+    }
+    ink_release_assert(c->write_cluster_vc != CLUSTER_DELAYED_OPEN);
+    ink_release_assert((opcode == CACHE_OPEN_READ_LONG) || c->write_cluster_vc->pending_remote_fill);
 
-      ink_assert(moi_len > 0);
+    SET_CONTINUATION_HANDLER(c, (CacheContHandler)&CacheContinuation::setupReadWriteVC);
+    Debug("cache_proto", "1read op, seqno=%d chan=%d bufsize=%d token=%d,%d", msg->seq_number, msg->channel, msg->buffer_size,
+          msg->token.ip_created, msg->token.sequence_number);
 
-      // Unmarshal CacheHTTPHdr
-      res = c->ic_request.unmarshal((char *) p, moi_len, NULL);
-      ink_assert(res > 0);
-      ink_assert(c->ic_request.valid());
-      c->request_purge = c->ic_request.method_get_wksidx() == HTTP_WKSIDX_PURGE || c->ic_request.method_get_wksidx() == HTTP_WKSIDX_DELETE;
-      moi_len -= res;
-      p += res;
-      ink_assert(moi_len > 0);
-      // Unmarshal CacheLookupHttpConfig
-      c->ic_params = new(CacheLookupHttpConfigAllocator.alloc())
-        CacheLookupHttpConfig();
-      res = c->ic_params->unmarshal(&c->ic_arena, (const char *) p, moi_len);
-      ink_assert(res > 0);
+    const char *p = (const char *)msg + flen;
+    int moi_len = len - flen;
+    int res;
 
-      moi_len -= res;
-      p += res;
+    ink_assert(moi_len > 0);
 
-      CacheKey key(msg->url_md5);
+    // Unmarshal CacheHTTPHdr
+    res = c->ic_request.unmarshal((char *)p, moi_len, NULL);
+    ink_assert(res > 0);
+    ink_assert(c->ic_request.valid());
+    c->request_purge =
+      c->ic_request.method_get_wksidx() == HTTP_WKSIDX_PURGE || c->ic_request.method_get_wksidx() == HTTP_WKSIDX_DELETE;
+    moi_len -= res;
+    p += res;
+    ink_assert(moi_len > 0);
+    // Unmarshal CacheLookupHttpConfig
+    c->ic_params = new (CacheLookupHttpConfigAllocator.alloc()) CacheLookupHttpConfig();
+    res = c->ic_params->unmarshal(&c->ic_arena, (const char *)p, moi_len);
+    ink_assert(res > 0);
 
-      char *hostname = NULL;
-      int host_len = 0;
+    moi_len -= res;
+    p += res;
 
-      if (moi_len) {
-        hostname = (char *) p;
-        host_len = moi_len;
+    CacheKey key(msg->url_md5);
 
-        // Save hostname and attach it to the continuation since we may
-        //  need it if we convert this to an open_write.
+    char *hostname = NULL;
+    int host_len = 0;
 
-        c->ic_hostname = new_IOBufferData(iobuffer_size_to_index(host_len));
-        c->ic_hostname_len = host_len;
+    if (moi_len) {
+      hostname = (char *)p;
+      host_len = moi_len;
 
-        memcpy(c->ic_hostname->data(), hostname, host_len);
-      }
+      // Save hostname and attach it to the continuation since we may
+      //  need it if we convert this to an open_write.
 
-      Cache *call_cache = caches[c->frag_type];
-      Action *a = call_cache->open_read(c, &key, &c->ic_request,
-                                        c->ic_params,
-                                        c->frag_type, hostname, host_len);
-      // Get rid of purify warnings since 'c' can be freed by open_read.
-      if (a != ACTION_RESULT_DONE) {
-        c->cache_action = a;
-      }
-      break;
+      c->ic_hostname = new_IOBufferData(iobuffer_size_to_index(host_len));
+      c->ic_hostname_len = host_len;
+
+      memcpy(c->ic_hostname->data(), hostname, host_len);
     }
-  case CACHE_OPEN_WRITE:
-    {
-      CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
-      init_from_short(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op-s op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+
+    Cache *call_cache = caches[c->frag_type];
+    Action *a = call_cache->open_read(c, &key, &c->ic_request, c->ic_params, c->frag_type, hostname, host_len);
+    // Get rid of purify warnings since 'c' can be freed by open_read.
+    if (a != ACTION_RESULT_DONE) {
+      c->cache_action = a;
+    }
+    break;
+  }
+  case CACHE_OPEN_WRITE: {
+    CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
+    init_from_short(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op-s op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_open_write");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_open_write");
 #endif
-      //
-      // Establish the remote side of the ClusterVConnection
-      //
-      c->read_cluster_vc = clusterProcessor.connect_local((Continuation *) 0,
-                                                          &c->token,
-                                                          c->cluster_vc_channel,
-                                                          (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_WRITE));
-      if (!c->read_cluster_vc) {
-        // Unable to setup channel, abort processing.
-        CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
-        Debug("chan_inuse",
-              "3Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d",
-              c->cluster_vc_channel, DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
-
-        // Send cluster op failed reply
-        c->replyOpEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (VConnection *) - ECLUSTER_CHANNEL_INUSE);
-        break;
+    //
+    // Establish the remote side of the ClusterVConnection
+    //
+    c->read_cluster_vc = clusterProcessor.connect_local((Continuation *)0, &c->token, c->cluster_vc_channel,
+                                                        (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_WRITE));
+    if (!c->read_cluster_vc) {
+      // Unable to setup channel, abort processing.
+      CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
+      Debug("chan_inuse", "3Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d", c->cluster_vc_channel,
+            DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
+
+      // Send cluster op failed reply
+      c->replyOpEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (VConnection *)-ECLUSTER_CHANNEL_INUSE);
+      break;
 
-      } else {
-        c->read_cluster_vc->current_cont = c;
-      }
-      ink_release_assert(c->read_cluster_vc != CLUSTER_DELAYED_OPEN);
+    } else {
+      c->read_cluster_vc->current_cont = c;
+    }
+    ink_release_assert(c->read_cluster_vc != CLUSTER_DELAYED_OPEN);
 
-      CacheKey key(msg->md5);
+    CacheKey key(msg->md5);
 
-      char *hostname = NULL;
-      int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
-      if (host_len) {
-        hostname = (char *) msg->moi.byte;
-      }
+    char *hostname = NULL;
+    int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
+    if (host_len) {
+      hostname = (char *)msg->moi.byte;
+    }
 
-      Cache *call_cache = caches[c->frag_type];
-      Action *a = call_cache->open_write(c, &key, c->frag_type,
-                                         !!(c->cfl_flags & CFL_OVERWRITE_ON_WRITE),
-                                         c->pin_in_cache, hostname, host_len);
-      if (a != ACTION_RESULT_DONE) {
-        c->cache_action = a;
-      }
-      break;
+    Cache *call_cache = caches[c->frag_type];
+    Action *a =
+      call_cache->open_write(c, &key, c->frag_type, !!(c->cfl_flags & CFL_OVERWRITE_ON_WRITE), c->pin_in_cache, hostname, host_len);
+    if (a != ACTION_RESULT_DONE) {
+      c->cache_action = a;
     }
-  case CACHE_OPEN_WRITE_LONG:
-    {
-      // Cache needs message data, copy it.
-      c->setMsgBufferLen(len);
-      c->allocMsgBuffer();
-      memcpy(c->getMsgBuffer(), (char *) data, len);
-
-      int flen = CacheOpMsg_long::sizeof_fixedlen_msg();
-      CacheOpMsg_long *msg = unmarshal_CacheOpMsg_long(c->getMsgBuffer(), mh->NeedByteSwap());
-      init_from_long(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op-l op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+    break;
+  }
+  case CACHE_OPEN_WRITE_LONG: {
+    // Cache needs message data, copy it.
+    c->setMsgBufferLen(len);
+    c->allocMsgBuffer();
+    memcpy(c->getMsgBuffer(), (char *)data, len);
+
+    int flen = CacheOpMsg_long::sizeof_fixedlen_msg();
+    CacheOpMsg_long *msg = unmarshal_CacheOpMsg_long(c->getMsgBuffer(), mh->NeedByteSwap());
+    init_from_long(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op-l op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_open_write_long");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_open_write_long");
 #endif
-      //
-      // Establish the remote side of the ClusterVConnection
-      //
-      c->read_cluster_vc = clusterProcessor.connect_local((Continuation *) 0,
-                                                          &c->token,
-                                                          c->cluster_vc_channel,
-                                                          (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_WRITE));
-      if (!c->read_cluster_vc) {
-        // Unable to setup channel, abort processing.
-        CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
-        Debug("chan_inuse",
-              "4Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d",
-              c->cluster_vc_channel, DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
-
-        // Send cluster op failed reply
-        c->replyOpEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (VConnection *) - ECLUSTER_CHANNEL_INUSE);
-        break;
-
-      } else {
-        c->read_cluster_vc->current_cont = c;
-      }
-      ink_release_assert(c->read_cluster_vc != CLUSTER_DELAYED_OPEN);
+    //
+    // Establish the remote side of the ClusterVConnection
+    //
+    c->read_cluster_vc = clusterProcessor.connect_local((Continuation *)0, &c->token, c->cluster_vc_channel,
+                                                        (CLUSTER_OPT_IMMEDIATE | CLUSTER_OPT_CONN_WRITE));
+    if (!c->read_cluster_vc) {
+      // Unable to setup channel, abort processing.
+      CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
+      Debug("chan_inuse", "4Remote chan=%d inuse tok.ip=%u.%u.%u.%u tok.seqno=%d seqno=%d", c->cluster_vc_channel,
+            DOT_SEPARATED(c->token.ip_created), c->token.sequence_number, c->seq_number);
+
+      // Send cluster op failed reply
+      c->replyOpEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (VConnection *)-ECLUSTER_CHANNEL_INUSE);
+      break;
 
-      CacheHTTPInfo *ci = 0;
-      const char *p = (const char *) msg + flen;
-      int res = 0;
-      int moi_len = len - flen;
+    } else {
+      c->read_cluster_vc->current_cont = c;
+    }
+    ink_release_assert(c->read_cluster_vc != CLUSTER_DELAYED_OPEN);
 
-      if (moi_len && c->cfl_flags & CFL_LOPENWRITE_HAVE_OLDINFO) {
+    CacheHTTPInfo *ci = 0;
+    const char *p = (const char *)msg + flen;
+    int res = 0;
+    int moi_len = len - flen;
 
-        // Unmarshal old CacheHTTPInfo
-        res = HTTPInfo::unmarshal((char *) p, moi_len, NULL);
-        ink_assert(res > 0);
-        c->ic_old_info.get_handle((char *) p, moi_len);
-        ink_assert(c->ic_old_info.valid());
-        ci = &c->ic_old_info;
-      }
-      if (c->cfl_flags & CFL_ALLOW_MULTIPLE_WRITES) {
-        ink_assert(!ci);
-        ci = (CacheHTTPInfo *) CACHE_ALLOW_MULTIPLE_WRITES;
-      }
-      moi_len -= res;
-      p += res;
+    if (moi_len && c->cfl_flags & CFL_LOPENWRITE_HAVE_OLDINFO) {
+      // Unmarshal old CacheHTTPInfo
+      res = HTTPInfo::unmarshal((char *)p, moi_len, NULL);
+      ink_assert(res > 0);
+      c->ic_old_info.get_handle((char *)p, moi_len);
+      ink_assert(c->ic_old_info.valid());
+      ci = &c->ic_old_info;
+    }
+    if (c->cfl_flags & CFL_ALLOW_MULTIPLE_WRITES) {
+      ink_assert(!ci);
+      ci = (CacheHTTPInfo *)CACHE_ALLOW_MULTIPLE_WRITES;
+    }
+    moi_len -= res;
+    p += res;
 
-      CacheKey key(msg->url_md5);
-      char *hostname = NULL;
+    CacheKey key(msg->url_md5);
+    char *hostname = NULL;
 
-      if (moi_len) {
-        hostname = (char *) p;
-      }
+    if (moi_len) {
+      hostname = (char *)p;
+    }
 
-      Cache *call_cache = caches[c->frag_type];
-      Action *a = call_cache->open_write(c, &key, ci, c->pin_in_cache,
-                                         NULL, c->frag_type, hostname, moi_len);
-      if (a != ACTION_RESULT_DONE) {
-        c->cache_action = a;
-      }
-      break;
+    Cache *call_cache = caches[c->frag_type];
+    Action *a = call_cache->open_write(c, &key, ci, c->pin_in_cache, NULL, c->frag_type, hostname, moi_len);
+    if (a != ACTION_RESULT_DONE) {
+      c->cache_action = a;
     }
-  case CACHE_REMOVE:
-    {
-      CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
-      init_from_short(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+    break;
+  }
+  case CACHE_REMOVE: {
+    CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
+    init_from_short(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_remove");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_remove");
 #endif
-      CacheKey key(msg->md5);
+    CacheKey key(msg->md5);
 
-      char *hostname = NULL;
-      int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
-      if (host_len) {
-        hostname = (char *) msg->moi.byte;
-      }
+    char *hostname = NULL;
+    int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
+    if (host_len) {
+      hostname = (char *)msg->moi.byte;
+    }
 
-      Cache *call_cache = caches[c->frag_type];
-      Action *a = call_cache->remove(c, &key, c->frag_type,
-                                     !!(c->cfl_flags & CFL_REMOVE_USER_AGENTS),
-                                     !!(c->cfl_flags & CFL_REMOVE_LINK),
-                                     hostname, host_len);
-      if (a != ACTION_RESULT_DONE) {
-        c->cache_action = a;
-      }
-      break;
+    Cache *call_cache = caches[c->frag_type];
+    Action *a = call_cache->remove(c, &key, c->frag_type, !!(c->cfl_flags & CFL_REMOVE_USER_AGENTS),
+                                   !!(c->cfl_flags & CFL_REMOVE_LINK), hostname, host_len);
+    if (a != ACTION_RESULT_DONE) {
+      c->cache_action = a;
     }
-  case CACHE_LINK:
-    {
-      CacheOpMsg_short_2 *msg = unmarshal_CacheOpMsg_short_2(data, mh->NeedByteSwap());
-      init_from_short_2(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+    break;
+  }
+  case CACHE_LINK: {
+    CacheOpMsg_short_2 *msg = unmarshal_CacheOpMsg_short_2(data, mh->NeedByteSwap());
+    init_from_short_2(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_link");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_link");
 #endif
 
-      CacheKey key1(msg->md5_1);
-      CacheKey key2(msg->md5_2);
+    CacheKey key1(msg->md5_1);
+    CacheKey key2(msg->md5_2);
 
-      char *hostname = NULL;
-      int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
-      if (host_len) {
-        hostname = (char *) msg->moi.byte;
-      }
+    char *hostname = NULL;
+    int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
+    if (host_len) {
+      hostname = (char *)msg->moi.byte;
+    }
 
-      Cache *call_cache = caches[c->frag_type];
-      Action *a = call_cache->link(c, &key1, &key2, c->frag_type,
-                                   hostname, host_len);
-      if (a != ACTION_RESULT_DONE) {
-        c->cache_action = a;
-      }
-      break;
+    Cache *call_cache = caches[c->frag_type];
+    Action *a = call_cache->link(c, &key1, &key2, c->frag_type, hostname, host_len);
+    if (a != ACTION_RESULT_DONE) {
+      c->cache_action = a;
     }
-  case CACHE_DEREF:
-    {
-      CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
-      init_from_short(c, msg, ch->machine);
-      Debug("cache_msg",
-            "cache_op op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
+    break;
+  }
+  case CACHE_DEREF: {
+    CacheOpMsg_short *msg = unmarshal_CacheOpMsg_short(data, mh->NeedByteSwap());
+    init_from_short(c, msg, ch->machine);
+    Debug("cache_msg", "cache_op op=%d seqno=%d data=%p len=%d machine=%p", opcode, c->seq_number, data, len, ch->machine);
 #ifdef CACHE_MSG_TRACE
-      log_cache_op_msg(msg->seq_number, len, "cache_op_deref");
+    log_cache_op_msg(msg->seq_number, len, "cache_op_deref");
 #endif
 
-      CacheKey key(msg->md5);
+    CacheKey key(msg->md5);
 
-      char *hostname = NULL;
-      int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
-      if (host_len) {
-        hostname = (char *) msg->moi.byte;
-      }
-
-      Cache *call_cache = caches[c->frag_type];
-      Action *a = call_cache->deref(c, &key, c->frag_type,
-                                    hostname, host_len);
-      if (a != ACTION_RESULT_DONE) {
-        c->cache_action = a;
-      }
-      break;
+    char *hostname = NULL;
+    int host_len = len - op_to_sizeof_fixedlen_msg(opcode);
+    if (host_len) {
+      hostname = (char *)msg->moi.byte;
     }
 
-  default:
-    {
-      ink_release_assert(0);
+    Cache *call_cache = caches[c->frag_type];
+    Action *a = call_cache->deref(c, &key, c->frag_type, hostname, host_len);
+    if (a != ACTION_RESULT_DONE) {
+      c->cache_action = a;
     }
-  }                             // End of switch
+    break;
+  }
+
+  default: {
+    ink_release_assert(0);
+  }
+  } // End of switch
 }
 
 void
@@ -1465,13 +1382,13 @@ cache_op_malloc_ClusterFunction(ClusterHandler *ch, void *data, int len)
 {
   cache_op_ClusterFunction(ch, data, len);
   // We own the message data, free it back to the Cluster subsystem
-  clusterProcessor.free_remote_data((char *) data, len);
+  clusterProcessor.free_remote_data((char *)data, len);
 }
 
 int
-CacheContinuation::setupVCdataRead(int event, VConnection * vc)
+CacheContinuation::setupVCdataRead(int event, VConnection *vc)
 {
-  ink_assert(magicno == (int) MagicNo);
+  ink_assert(magicno == (int)MagicNo);
   //
   // Setup the initial data read for the given Cache VC.
   // This data is sent back in the response message.
@@ -1482,27 +1399,27 @@ CacheContinuation::setupVCdataRead(int event, VConnection * vc)
     //////////////////////////////////////////
     Debug("cache_proto", "setupVCdataRead CACHE_EVENT_OPEN_READ seqno=%d", seq_number);
     ink_release_assert(caller_buf_freebytes);
-    SET_HANDLER((CacheContHandler) & CacheContinuation::VCdataRead);
+    SET_HANDLER((CacheContHandler)&CacheContinuation::VCdataRead);
 
     int64_t size_index = iobuffer_size_to_index(caller_buf_freebytes);
     MIOBuffer *buf = new_MIOBuffer(size_index);
     readahead_reader = buf->alloc_reader();
 
-    MUTEX_TRY_LOCK(lock, mutex, this_ethread());        // prevent immediate callback
+    MUTEX_TRY_LOCK(lock, mutex, this_ethread()); // prevent immediate callback
     readahead_vio = vc->do_io_read(this, caller_buf_freebytes, buf);
     return EVENT_DONE;
 
   } else {
     // Error case, deflect processing to replyOpEvent.
-    SET_HANDLER((CacheContHandler) & CacheContinuation::replyOpEvent);
+    SET_HANDLER((CacheContHandler)&CacheContinuation::replyOpEvent);
     return handleEvent(event, vc);
   }
 }
 
 int
-CacheContinuation::VCdataRead(int event, VIO * target_vio)
+CacheContinuation::VCdataRead(int event, VIO *target_vio)
 {
-  ink_release_assert(magicno == (int) MagicNo);
+  ink_release_assert(magicno == (int)MagicNo);
   ink_release_assert(readahead_vio == target_vio);
 
   VConnection *vc = target_vio->vc_server;
@@ -1510,129 +1427,121 @@ CacheContinuation::VCdataRead(int event, VIO * target_vio)
   int32_t object_size;
 
   switch (event) {
-  case VC_EVENT_EOS:
-    {
-      if (!target_vio->ndone) {
-        // Doc with zero byte body, handle as read failure
-        goto read_failed;
-      }
-      // Fall through
+  case VC_EVENT_EOS: {
+    if (!target_vio->ndone) {
+      // Doc with zero byte body, handle as read failure
+      goto read_failed;
     }
+    // Fall through
+  }
   case VC_EVENT_READ_READY:
-  case VC_EVENT_READ_COMPLETE:
-    {
-      int clone_bytes;
-      int current_ndone = target_vio->ndone;
+  case VC_EVENT_READ_COMPLETE: {
+    int clone_bytes;
+    int current_ndone = target_vio->ndone;
 
-      ink_assert(current_ndone);
-      ink_assert(current_ndone <= readahead_reader->read_avail());
+    ink_assert(current_ndone);
+    ink_assert(current_ndone <= readahead_reader->read_avail());
 
-      object_size = getObjectSize(vc, request_opcode, &cache_vc_info);
-      have_all_data = ((object_size <= caller_buf_freebytes) && (object_size == current_ndone));
+    object_size = getObjectSize(vc, request_opcode, &cache_vc_info);
+    have_all_data = ((object_size <= caller_buf_freebytes) && (object_size == current_ndone));
 
-      // Use no more than the caller's max buffer limit
+    // Use no more than the caller's max buffer limit
 
-      clone_bytes = current_ndone;
-      if (!have_all_data) {
-        if (current_ndone > caller_buf_freebytes) {
-          clone_bytes = caller_buf_freebytes;
-        }
+    clone_bytes = current_ndone;
+    if (!have_all_data) {
+      if (current_ndone > caller_buf_freebytes) {
+        clone_bytes = caller_buf_freebytes;
       }
-      // Clone data
-
-      IOBufferBlock *tail;
-      readahead_data = clone_IOBufferBlockList(readahead_reader->get_current_block(),
-                                               readahead_reader->start_offset, clone_bytes, &tail);
+    }
+    // Clone data
 
-      if (have_all_data) {
-        // Close VC, since no more data and also to avoid VC_EVENT_EOS
+    IOBufferBlock *tail;
+    readahead_data =
+      clone_IOBufferBlockList(readahead_reader->get_current_block(), readahead_reader->start_offset, clone_bytes, &tail);
 
-        MIOBuffer *mbuf = target_vio->buffer.writer();
-        vc->do_io(VIO::CLOSE);
-        free_MIOBuffer(mbuf);
-        readahead_vio = 0;
-      }
-      SET_HANDLER((CacheContHandler) & CacheContinuation::replyOpEvent);
-      handleEvent(reply, vc);
-      return EVENT_CONT;
-    }
-  case VC_EVENT_ERROR:
-  case VC_EVENT_INACTIVITY_TIMEOUT:
-  case VC_EVENT_ACTIVE_TIMEOUT:
-  default:
-    {
-    read_failed:
-      // Read failed, deflect to replyOpEvent.
+    if (have_all_data) {
+      // Close VC, since no more data and also to avoid VC_EVENT_EOS
 
-      MIOBuffer * mbuf = target_vio->buffer.writer();
+      MIOBuffer *mbuf = target_vio->buffer.writer();
       vc->do_io(VIO::CLOSE);
       free_MIOBuffer(mbuf);
       readahead_vio = 0;
-      reply = CACHE_EVENT_OPEN_READ_FAILED;
-
-      SET_HANDLER((CacheContHandler) & CacheContinuation::replyOpEvent);
-      handleEvent(reply, (VConnection *) - ECLUSTER_ORB_DATA_READ);
-      return EVENT_DONE;
     }
-  }                             // End of switch
+    SET_HANDLER((CacheContHandler)&CacheContinuation::replyOpEvent);
+    handleEvent(reply, vc);
+    return EVENT_CONT;
+  }
+  case VC_EVENT_ERROR:
+  case VC_EVENT_INACTIVITY_TIMEOUT:
+  case VC_EVENT_ACTIVE_TIMEOUT:
+  default: {
+  read_failed:
+    // Read failed, deflect to replyOpEvent.
+
+    MIOBuffer *mbuf = target_vio->buffer.writer();
+    vc->do_io(VIO::CLOSE);
+    free_MIOBuffer(mbuf);
+    readahead_vio = 0;
+    reply = CACHE_EVENT_OPEN_READ_FAILED;
+
+    SET_HANDLER((CacheContHandler)&CacheContinuation::replyOpEvent);
+    handleEvent(reply, (VConnection *)-ECLUSTER_ORB_DATA_READ);
+    return EVENT_DONE;
+  }
+  } // End of switch
 }
 
 int
-CacheContinuation::setupReadWriteVC(int event, VConnection * vc)
+CacheContinuation::setupReadWriteVC(int event, VConnection *vc)
 {
   // Only handles OPEN_READ_LONG processing.
 
   switch (event) {
-  case CACHE_EVENT_OPEN_READ:
-    {
-      // setup readahead
+  case CACHE_EVENT_OPEN_READ: {
+    // setup readahead
 
-      SET_HANDLER((CacheContHandler) & CacheContinuation::setupVCdataRead);
-      return handleEvent(event, vc);
-      break;
-    }
-  case CACHE_EVENT_OPEN_READ_FAILED:
-    {
-      if (frag_type == CACHE_FRAG_TYPE_HTTP && !request_purge) {
-        // HTTP open read failed, attempt open write now to avoid an additional
-        //  message round trip
-
-        CacheKey key(url_md5);
-
-        Cache *call_cache = caches[frag_type];
-        Action *a = call_cache->open_write(this, &key, 0, pin_in_cache,
-                                           NULL, frag_type, ic_hostname ? ic_hostname->data() : NULL,
-                                           ic_hostname_len);
-        if (a != ACTION_RESULT_DONE) {
-          cache_action = a;
-        }
-      } else {
-        SET_HANDLER((CacheContHandler) & CacheContinuation::replyOpEvent);
-        return handleEvent(CACHE_EVENT_OPEN_READ_FAILED, 0);
+    SET_HANDLER((CacheContHandler)&CacheContinuation::setupVCdataRead);
+    return handleEvent(event, vc);
+    break;
+  }
+  case CACHE_EVENT_OPEN_READ_FAILED: {
+    if (frag_type == CACHE_FRAG_TYPE_HTTP && !request_purge) {
+      // HTTP open read failed, attempt open write now to avoid an additional
+      //  message round trip
+
+      CacheKey key(url_md5);
+
+      Cache *call_cache = caches[frag_type];
+      Action *a = call_cache->open_write(this, &key, 0, pin_in_cache, NULL, frag_type, ic_hostname ? ic_hostname->data() : NULL,
+                                         ic_hostname_len);
+      if (a != ACTION_RESULT_DONE) {
+        cache_action = a;
       }
-      break;
+    } else {
+      SET_HANDLER((CacheContHandler)&CacheContinuation::replyOpEvent);
+      return handleEvent(CACHE_EVENT_OPEN_READ_FAILED, 0);
     }
-  case CACHE_EVENT_OPEN_WRITE:
-    {
-      // Convert from read to write connection
+    break;
+  }
+  case CACHE_EVENT_OPEN_WRITE: {
+    // Convert from read to write connection
 
-      ink_assert(!read_cluster_vc && write_cluster_vc);
-      read_cluster_vc = write_cluster_vc;
-      read_cluster_vc->set_type(CLUSTER_OPT_CONN_WRITE);
-      write_cluster_vc = 0;
+    ink_assert(!read_cluster_vc && write_cluster_vc);
+    read_cluster_vc = write_cluster_vc;
+    read_cluster_vc->set_type(CLUSTER_OPT_CONN_WRITE);
+    write_cluster_vc = 0;
 
-      SET_HANDLER((CacheContHandler) & CacheContinuation::replyOpEvent);
-      return handleEvent(event, vc);
-      break;
-    }
+    SET_HANDLER((CacheContHandler)&CacheContinuation::replyOpEvent);
+    return handleEvent(event, vc);
+    break;
+  }
   case CACHE_EVENT_OPEN_WRITE_FAILED:
-  default:
-    {
-      SET_HANDLER((CacheContHandler) & CacheContinuation::replyOpEvent);
-      return handleEvent(CACHE_EVENT_OPEN_READ_FAILED, 0);
-      break;
-    }
-  }                             // end of switch
+  default: {
+    SET_HANDLER((CacheContHandler)&CacheContinuation::replyOpEvent);
+    return handleEvent(CACHE_EVENT_OPEN_READ_FAILED, 0);
+    break;
+  }
+  } // end of switch
 
   return EVENT_DONE;
 }
@@ -1642,16 +1551,16 @@ CacheContinuation::setupReadWriteVC(int event, VConnection * vc)
 //   Reflect the (local) reply back to the (remote) requesting node.
 /////////////////////////////////////////////////////////////////////////
 int
-CacheContinuation::replyOpEvent(int event, VConnection * cvc)
+CacheContinuation::replyOpEvent(int event, VConnection *cvc)
 {
-  ink_assert(magicno == (int) MagicNo);
+  ink_assert(magicno == (int)MagicNo);
   Debug("cache_proto", "replyOpEvent(this=%p,event=%d,VC=%p)", this, event, cvc);
   ink_hrtime now;
   now = ink_get_hrtime();
   CLUSTER_SUM_DYN_STAT(CLUSTER_CACHE_CALLBACK_TIME_STAT, now - start_time);
   LOG_EVENT_TIME(start_time, callback_time_dist, cache_callbacks);
   ink_release_assert(expect_cache_callback);
-  expect_cache_callback = false;        // make sure we are called back exactly once
+  expect_cache_callback = false; // make sure we are called back exactly once
 
 
   result = event;
@@ -1664,8 +1573,7 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
   CacheOpReplyMsg *msg = &rmsg;
   msg->result = event;
 
-  if ((request_opcode == CACHE_OPEN_READ_LONG)
-      && cvc && (event == CACHE_EVENT_OPEN_WRITE)) {
+  if ((request_opcode == CACHE_OPEN_READ_LONG) && cvc && (event == CACHE_EVENT_OPEN_WRITE)) {
     //////////////////////////////////////////////////////////////////////////
     // open read failed, but open write succeeded, set result to
     // CACHE_EVENT_OPEN_READ_FAILED and make result token non zero to
@@ -1676,17 +1584,16 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
   }
 
   msg->seq_number = seq_number;
-  int flen = CacheOpReplyMsg::sizeof_fixedlen_msg();    // include token
+  int flen = CacheOpReplyMsg::sizeof_fixedlen_msg(); // include token
   int len = 0;
   int vers = 0;
 
   int results_expected = 1;
 
-  if (no_reply_message)         // CACHE_NO_RESPONSE request
+  if (no_reply_message) // CACHE_NO_RESPONSE request
     goto free_exit;
 
   if (open) {
-
     // prepare for CACHE_OPEN_EVENT
 
     results_expected = 2;
@@ -1695,20 +1602,20 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
 
     if (read_op && !open_read_now_open_write) {
       ink_release_assert(write_cluster_vc->pending_remote_fill);
-      ink_assert(have_all_data || (readahead_vio == &((CacheVC *) cache_vc)->vio));
+      ink_assert(have_all_data || (readahead_vio == &((CacheVC *)cache_vc)->vio));
       Debug("cache_proto", "connect_local success seqno=%d have_all_data=%d", seq_number, (have_all_data ? 1 : 0));
 
       if (have_all_data) {
-        msg->token.clear();     // Tell sender no conn established
+        msg->token.clear(); // Tell sender no conn established
         write_cluster_vc->type = VC_CLUSTER_WRITE;
       } else {
-        msg->token = token;     // Tell sender conn established
+        msg->token = token; // Tell sender conn established
         setupReadBufTunnel(cache_vc, write_cluster_vc);
       }
 
     } else {
       Debug("cache_proto", "cache_open [%s] success seqno=%d", (cache_read ? "R" : "W"), seq_number);
-      msg->token = token;       // Tell sender conn established
+      msg->token = token; // Tell sender conn established
 
       OneWayTunnel *pOWT = OneWayTunnel::OneWayTunnel_alloc();
       pOWT->init(read_cluster_vc, cache_vc, NULL, nbytes ? nbytes : DEFAULT_MAX_BUFFER_SIZE, this->mutex);
@@ -1723,17 +1630,17 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
       msg->is_ram_cache_hit = ((CacheVC *)cache_vc)->is_ram_cache_hit();
 
       if (!cache_vc_info.valid()) {
-        (void) getObjectSize(cache_vc, request_opcode, &cache_vc_info);
+        (void)getObjectSize(cache_vc, request_opcode, &cache_vc_info);
       }
       // Determine data length and allocate
       len = cache_vc_info.marshal_length();
-      CacheOpReplyMsg *reply = (CacheOpReplyMsg *) ALLOCA_DOUBLE(flen + len);
+      CacheOpReplyMsg *reply = (CacheOpReplyMsg *)ALLOCA_DOUBLE(flen + len);
 
       // Initialize reply message header
       *reply = *msg;
 
       // Marshal response data into reply message
-      res = cache_vc_info.marshal((char *) reply + flen, len);
+      res = cache_vc_info.marshal((char *)reply + flen, len);
       ink_assert(res >= 0 && res <= len);
 
       // Make reply message the current message
@@ -1742,11 +1649,11 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
 
   } else {
     Debug("cache_proto", "cache operation failed result=%d seqno=%d (this=%p)", event, seq_number, this);
-    msg->token.clear();         // Tell sender no conn established
+    msg->token.clear(); // Tell sender no conn established
 
     // Reallocate reply message, allowing for marshalled data
     len += sizeof(int32_t);
-    CacheOpReplyMsg *reply = (CacheOpReplyMsg *) ALLOCA_DOUBLE(flen + len);
+    CacheOpReplyMsg *reply = (CacheOpReplyMsg *)ALLOCA_DOUBLE(flen + len);
 
     // Initialize reply message header
     *reply = *msg;
@@ -1756,24 +1663,24 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
       // open read/write failed, close preallocated VC
       //
       if (read_cluster_vc) {
-        read_cluster_vc->remote_closed = 1;     // avoid remote close msg
+        read_cluster_vc->remote_closed = 1; // avoid remote close msg
         read_cluster_vc->do_io(VIO::CLOSE);
       }
       if (write_cluster_vc) {
         write_cluster_vc->pending_remote_fill = 0;
-        write_cluster_vc->remote_closed = 1;    // avoid remote close msg
+        write_cluster_vc->remote_closed = 1; // avoid remote close msg
         write_cluster_vc->do_io(VIO::CLOSE);
       }
-      reply->moi.u32 = (int32_t) ((uintptr_t) cvc & 0xffffffff);    // code describing failure
+      reply->moi.u32 = (int32_t)((uintptr_t)cvc & 0xffffffff); // code describing failure
     }
     // Make reply message the current message
     msg = reply;
   }
   CLUSTER_DECREMENT_DYN_STAT(CLUSTER_CACHE_OUTSTANDING_STAT);
 
-  //
-  // Send reply message
-  //
+//
+// Send reply message
+//
 #ifdef CACHE_MSG_TRACE
   log_cache_op_sndmsg(msg->seq_number, 0, "replyOpEvent");
 #endif
@@ -1781,18 +1688,14 @@ CacheContinuation::replyOpEvent(int event, VConnection * cvc)
   if (vers == CacheOpReplyMsg::CACHE_OP_REPLY_MESSAGE_VERSION) {
     if (read_op) {
       // Transmit reply message and object data in same cluster message
-      Debug("cache_proto", "Sending reply/data seqno=%d buflen=%" PRId64,
-            seq_number, readahead_data ? bytes_IOBufferBlockList(readahead_data, 1) : 0);
-      clusterProcessor.invoke_remote_data(ch,
-                                          CACHE_OP_RESULT_CLUSTER_FUNCTION,
-                                          (void *) msg, (flen + len),
-                                          readahead_data,
-                                          cluster_vc_channel, &token,
-                                          &CacheContinuation::disposeOfDataBuffer, (void *) this, CLUSTER_OPT_STEAL);
+      Debug("cache_proto", "Sending reply/data seqno=%d buflen=%" PRId64, seq_number,
+            readahead_data ? bytes_IOBufferBlockList(readahead_data, 1) : 0);
+      clusterProcessor.invoke_remote_data(ch, CACHE_OP_RESULT_CLUSTER_FUNCTION, (void *)msg, (flen + len), readahead_data,
+                                          cluster_vc_channel, &token, &CacheContinuation::disposeOfDataBuffer, (void *)this,
+                                          CLUSTER_OPT_STEAL);
     } else {
       Debug("cache_proto", "Sending reply seqno=%d, (this=%p)", seq_number, this);
-      clusterProcessor.invoke_remote(ch, CACHE_OP_RESULT_CLUSTER_FUNCTION,
-                                     (void *) msg, (flen + len), CLUSTER_OPT_STEAL);
+      clusterProcessor.invoke_remote(ch, CACHE_OP_RESULT_CLUSTER_FUNCTION, (void *)msg, (flen + len), CLUSTER_OPT_STEAL);
     }
 
   } else {
@@ -1812,7 +1715,7 @@ free_exit:
 }
 
 void
-CacheContinuation::setupReadBufTunnel(VConnection * cache_read_vc, VConnection * cluster_write_vc)
+CacheContinuation::setupReadBufTunnel(VConnection *cache_read_vc, VConnection *cluster_write_vc)
 {
   ////////////////////////////////////////////////////////////
   // Setup OneWayTunnel and tunnel close event handler.
@@ -1820,22 +1723,21 @@ CacheContinuation::setupReadBufTunnel(VConnection * cache_read_vc, VConnection *
   ////////////////////////////////////////////////////////////
   tunnel_cont = cacheContAllocator_alloc();
   tunnel_cont->mutex = this->mutex;
-  SET_CONTINUATION_HANDLER(tunnel_cont, (CacheContHandler)
-                           & CacheContinuation::tunnelClosedEvent);
+  SET_CONTINUATION_HANDLER(tunnel_cont, (CacheContHandler)&CacheContinuation::tunnelClosedEvent);
   int64_t ravail = bytes_IOBufferBlockList(readahead_data, 1);
 
   tunnel_mutex = tunnel_cont->mutex;
   tunnel_closed = false;
 
   tunnel = OneWayTunnel::OneWayTunnel_alloc();
-  readahead_reader->consume(ravail);    // allow for bytes sent in initial reply
+  readahead_reader->consume(ravail); // allow for bytes sent in initial reply
   tunnel->init(cache_read_vc, cluster_write_vc, tunnel_cont, readahead_vio, readahead_reader);
   tunnel_cont->action = this;
   tunnel_cont->tunnel = tunnel;
   tunnel_cont->tunnel_cont = tunnel_cont;
 
   // Disable cluster_write_vc
-  ((ClusterVConnection *) cluster_write_vc)->write.enabled = 0;
+  ((ClusterVConnection *)cluster_write_vc)->write.enabled = 0;
 
   // Disable cache read VC
   readahead_vio->nbytes = readahead_vio->ndone;
@@ -1853,11 +1755,11 @@ CacheContinuation::setupReadBufTunnel(VConnection * cache_read_vc, VConnection *
 int
 CacheContinuation::tunnelClosedEvent(int /* event ATS_UNUSED */, void *c)
 {
-  ink_assert(magicno == (int) MagicNo);
+  ink_assert(magicno == (int)MagicNo);
   // Note: We are called with the tunnel_mutex held.
-  CacheContinuation *tc = (CacheContinuation *) c;
+  CacheContinuation *tc = (CacheContinuation *)c;
   ink_release_assert(tc->tunnel_cont == tc);
-  CacheContinuation *real_cc = (CacheContinuation *) tc->action.continuation;
+  CacheContinuation *real_cc = (CacheContinuation *)tc->action.continuation;
 
   if (real_cc) {
     // Notify the real continuation of the tunnel closed event
@@ -1875,26 +1777,24 @@ CacheContinuation::tunnelClosedEvent(int /* event ATS_UNUSED */, void *c)
 // Retry DisposeOfDataBuffer continuation
 ////////////////////////////////////////////////////////////
 struct retryDisposeOfDataBuffer;
-typedef int (retryDisposeOfDataBuffer::*rtryDisOfDBufHandler) (int, void *);
-struct retryDisposeOfDataBuffer:public Continuation
-{
+typedef int (retryDisposeOfDataBuffer::*rtryDisOfDBufHandler)(int, void *);
+struct retryDisposeOfDataBuffer : public Continuation {
   CacheContinuation *c;
 
-  int handleRetryEvent(int event, Event * e)
+  int
+  handleRetryEvent(int event, Event *e)
   {
     if (CacheContinuation::handleDisposeEvent(event, c) == EVENT_DONE) {
       delete this;
-        return EVENT_DONE;
-    } else
-    {
+      return EVENT_DONE;
+    } else {
       e->schedule_in(HRTIME_MSECONDS(10));
       return EVENT_CONT;
     }
   }
-  retryDisposeOfDataBuffer(CacheContinuation * cont)
-:  Continuation(new_ProxyMutex()), c(cont) {
-    SET_HANDLER((rtryDisOfDBufHandler)
-                & retryDisposeOfDataBuffer::handleRetryEvent);
+  retryDisposeOfDataBuffer(CacheContinuation *cont) : Continuation(new_ProxyMutex()), c(cont)
+  {
+    SET_HANDLER((rtryDisOfDBufHandler)&retryDisposeOfDataBuffer::handleRetryEvent);
   }
 };
 
@@ -1906,9 +1806,9 @@ void
 CacheContinuation::disposeOfDataBuffer(void *d)
 {
   ink_assert(d);
-  CacheContinuation *cc = (CacheContinuation *) d;
+  CacheContinuation *cc = (CacheContinuation *)d;
   ink_assert(cc->have_all_data || cc->readahead_vio);
-  ink_assert(cc->have_all_data || (cc->readahead_vio == &((CacheVC *) cc->cache_vc)->vio));
+  ink_assert(cc->have_all_data || (cc->readahead_vio == &((CacheVC *)cc->cache_vc)->vio));
 
   if (cc->have_all_data) {
     //
@@ -1936,9 +1836,9 @@ CacheContinuation::disposeOfDataBuffer(void *d)
 }
 
 int
-CacheContinuation::handleDisposeEvent(int /* event ATS_UNUSED */, CacheContinuation * cc)
+CacheContinuation::handleDisposeEvent(int /* event ATS_UNUSED */, CacheContinuation *cc)
 {
-  ink_assert(cc->magicno == (int) MagicNo);
+  ink_assert(cc->magicno == (int)MagicNo);
   MUTEX_TRY_LOCK(lock, cc->tunnel_mutex, this_ethread());
   if (lock.is_locked()) {
     // Write of initial object data is complete.
@@ -1981,13 +1881,13 @@ cache_op_result_ClusterFunct

<TRUNCATED>

[16/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ConsistentHash.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ConsistentHash.cc b/lib/ts/ConsistentHash.cc
index e39edbd..c983ccb 100644
--- a/lib/ts/ConsistentHash.cc
+++ b/lib/ts/ConsistentHash.cc
@@ -27,8 +27,7 @@
 #include <climits>
 #include <cstdio>
 
-std::ostream &
-operator << (std::ostream & os, ATSConsistentHashNode & thing)
+std::ostream &operator<<(std::ostream &os, ATSConsistentHashNode &thing)
 {
   return os << thing.name;
 }
@@ -38,7 +37,7 @@ ATSConsistentHash::ATSConsistentHash(int r, ATSHash64 *h) : replicas(r), hash(h)
 }
 
 void
-ATSConsistentHash::insert(ATSConsistentHashNode * node, float weight, ATSHash64 *h)
+ATSConsistentHash::insert(ATSConsistentHashNode *node, float weight, ATSHash64 *h)
 {
   int i;
   char numstr[256];
@@ -57,7 +56,7 @@ ATSConsistentHash::insert(ATSConsistentHashNode * node, float weight, ATSHash64
   string_stream << *node;
   std_string = string_stream.str();
 
-  for (i = 0; i < (int) roundf(replicas * weight); i++) {
+  for (i = 0; i < (int)roundf(replicas * weight); i++) {
     snprintf(numstr, 256, "%d-", i);
     thash->update(numstr, strlen(numstr));
     thash->update(std_string.c_str(), strlen(std_string.c_str()));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ConsistentHash.h
----------------------------------------------------------------------
diff --git a/lib/ts/ConsistentHash.h b/lib/ts/ConsistentHash.h
index 7704c7a..6406a6c 100644
--- a/lib/ts/ConsistentHash.h
+++ b/lib/ts/ConsistentHash.h
@@ -31,14 +31,12 @@
   Helper class to be extended to make ring nodes.
  */
 
-struct ATSConsistentHashNode
-{
+struct ATSConsistentHashNode {
   bool available;
   char *name;
 };
 
-std::ostream &
-operator<< (std::ostream & os, ATSConsistentHashNode & thing);
+std::ostream &operator<<(std::ostream &os, ATSConsistentHashNode &thing);
 
 typedef std::map<uint64_t, ATSConsistentHashNode *>::iterator ATSConsistentHashIter;
 
@@ -48,12 +46,12 @@ typedef std::map<uint64_t, ATSConsistentHashNode *>::iterator ATSConsistentHashI
   Caller is responsible for freeing ring node memory.
  */
 
-struct ATSConsistentHash
-{
+struct ATSConsistentHash {
   ATSConsistentHash(int r = 1024, ATSHash64 *h = NULL);
   void insert(ATSConsistentHashNode *node, float weight = 1.0, ATSHash64 *h = NULL);
   ATSConsistentHashNode *lookup(const char *url = NULL, ATSConsistentHashIter *i = NULL, bool *w = NULL, ATSHash64 *h = NULL);
-  ATSConsistentHashNode *lookup_available(const char *url = NULL, ATSConsistentHashIter *i = NULL, bool *w = NULL, ATSHash64 *h = NULL);
+  ATSConsistentHashNode *lookup_available(const char *url = NULL, ATSConsistentHashIter *i = NULL, bool *w = NULL,
+                                          ATSHash64 *h = NULL);
   ~ATSConsistentHash();
 
 private:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/CryptoHash.h
----------------------------------------------------------------------
diff --git a/lib/ts/CryptoHash.h b/lib/ts/CryptoHash.h
index 9dcec91..28b6296 100644
--- a/lib/ts/CryptoHash.h
+++ b/lib/ts/CryptoHash.h
@@ -1,5 +1,5 @@
-# if ! defined CRYPTO_HASH_HEADER
-# define CRYPTO_HASH_HEADER
+#if !defined CRYPTO_HASH_HEADER
+#define CRYPTO_HASH_HEADER
 
 /** @file
     Protocol class for crypto hashes.
@@ -24,95 +24,106 @@
  */
 
 /// Apache Traffic Server commons.
-namespace ats {
-  /// Crypto hash output.
-  union CryptoHash {
-    uint64_t b[2];   // Legacy placeholder
-    uint64_t u64[2];
-    uint32_t u32[4];
-    uint8_t  u8[16];
-
-    /// Default constructor - init to zero.
-    CryptoHash() {
-      u64[0] = 0;
-      u64[1] = 0;
-    }
-
-    /// Assignment - bitwise copy.
-    CryptoHash& operator = (CryptoHash const& that) {
-      u64[0] = that.u64[0];
-      u64[1] = that.u64[1];
-      return *this;
-    }
-
-    /// Equality - bitwise identical.
-    bool operator == (CryptoHash const& that) const {
-      return u64[0] == that.u64[0] && u64[1] == that.u64[1];
-    }
-
-    /// Equality - bitwise identical.
-    bool operator != (CryptoHash const& that) const {
-      return !(*this == that);
-    }
-
-    /// Reduce to 64 bit value.
-    uint64_t fold() const {
-      return u64[0] ^ u64[1];
-    }
-
-    /// Access 64 bit slice.
-    uint64_t operator [] (int i) const {
-      return u64[i];
-    }
-
-    /// Access 64 bit slice.
-    /// @note Identical to @ operator[] but included for symmetry.
-    uint64_t slice64(int i) const {
-      return u64[i];
-    }
-
-    /// Access 32 bit slice.
-    uint32_t slice32(int i) const {
-      return u32[i];
-    }
-
-    /// Fast conversion to hex in fixed sized string.
-    char *toHexStr(char buffer[33]) {
-      return ink_code_to_hex_str(buffer, u8);
-    }
-  };
-
-  extern CryptoHash const CRYPTO_HASH_ZERO;
-
-  /** Protocol class for a crypto hash context.
-
-      A hash of this type is used for strong hashing, such as for URLs.
-  */
-  class CryptoContext {
-    typedef CryptoContext self; ///< Self reference type.
-  public:
-
-    /// Destructor (force virtual)
-    virtual ~CryptoContext() { }
-
-    /// Update the hash with @a data of @a length bytes.
-    virtual bool update(void const* data, int length) = 0;
-    /// Finalize and extract the @a hash.
-    virtual bool finalize(CryptoHash& hash) = 0;
-
-    /// Convenience overload.
-    bool finalize(CryptoHash* hash);
-
-    /// Convenience - compute final @a hash for @a data.
-    /// @note This is just as fast as the previous style, as a new context must be initialized
-    /// everytime this is done.
-    virtual bool hash_immediate(CryptoHash& hash, void const* data, int length);
-  };
-
-  inline bool CryptoContext::hash_immediate(CryptoHash& hash, void const* data, int length) {
-    return this->update(data, length) && this->finalize(hash);
+namespace ats
+{
+/// Crypto hash output.
+union CryptoHash {
+  uint64_t b[2]; // Legacy placeholder
+  uint64_t u64[2];
+  uint32_t u32[4];
+  uint8_t u8[16];
+
+  /// Default constructor - init to zero.
+  CryptoHash()
+  {
+    u64[0] = 0;
+    u64[1] = 0;
   }
-  inline bool CryptoContext::finalize(CryptoHash* hash) { return this->finalize(*hash); }
+
+  /// Assignment - bitwise copy.
+  CryptoHash &operator=(CryptoHash const &that)
+  {
+    u64[0] = that.u64[0];
+    u64[1] = that.u64[1];
+    return *this;
+  }
+
+  /// Equality - bitwise identical.
+  bool operator==(CryptoHash const &that) const { return u64[0] == that.u64[0] && u64[1] == that.u64[1]; }
+
+  /// Equality - bitwise identical.
+  bool operator!=(CryptoHash const &that) const { return !(*this == that); }
+
+  /// Reduce to 64 bit value.
+  uint64_t
+  fold() const
+  {
+    return u64[0] ^ u64[1];
+  }
+
+  /// Access 64 bit slice.
+  uint64_t operator[](int i) const { return u64[i]; }
+
+  /// Access 64 bit slice.
+  /// @note Identical to @ operator[] but included for symmetry.
+  uint64_t
+  slice64(int i) const
+  {
+    return u64[i];
+  }
+
+  /// Access 32 bit slice.
+  uint32_t
+  slice32(int i) const
+  {
+    return u32[i];
+  }
+
+  /// Fast conversion to hex in fixed sized string.
+  char *
+  toHexStr(char buffer[33])
+  {
+    return ink_code_to_hex_str(buffer, u8);
+  }
+};
+
+extern CryptoHash const CRYPTO_HASH_ZERO;
+
+/** Protocol class for a crypto hash context.
+
+    A hash of this type is used for strong hashing, such as for URLs.
+*/
+class CryptoContext
+{
+  typedef CryptoContext self; ///< Self reference type.
+public:
+  /// Destructor (force virtual)
+  virtual ~CryptoContext() {}
+
+  /// Update the hash with @a data of @a length bytes.
+  virtual bool update(void const *data, int length) = 0;
+  /// Finalize and extract the @a hash.
+  virtual bool finalize(CryptoHash &hash) = 0;
+
+  /// Convenience overload.
+  bool finalize(CryptoHash *hash);
+
+  /// Convenience - compute final @a hash for @a data.
+  /// @note This is just as fast as the previous style, as a new context must be initialized
+  /// everytime this is done.
+  virtual bool hash_immediate(CryptoHash &hash, void const *data, int length);
+};
+
+inline bool
+CryptoContext::hash_immediate(CryptoHash &hash, void const *data, int length)
+{
+  return this->update(data, length) && this->finalize(hash);
+}
+inline bool
+CryptoContext::finalize(CryptoHash *hash)
+{
+  return this->finalize(*hash);
+}
 
 } // end namespace
 
@@ -121,4 +132,4 @@ using ats::CryptoHash;
 using ats::CryptoContext;
 using ats::CRYPTO_HASH_ZERO;
 
-# endif // CRYPTO_HASH_HEADER
+#endif // CRYPTO_HASH_HEADER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Diags.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Diags.cc b/lib/ts/Diags.cc
index a7ce61d..97c4911 100644
--- a/lib/ts/Diags.cc
+++ b/lib/ts/Diags.cc
@@ -44,7 +44,7 @@
 #include "Diags.h"
 
 int diags_on_for_plugins = 0;
-bool DiagsConfigState::enabled[2] = { false, false };
+bool DiagsConfigState::enabled[2] = {false, false};
 
 // Global, used for all diagnostics
 inkcoreapi Diags *diags = NULL;
@@ -65,7 +65,7 @@ inkcoreapi Diags *diags = NULL;
 char *
 SrcLoc::str(char *buf, int buflen) const
 {
-  const char * shortname;
+  const char *shortname;
 
   if (!this->valid() || buflen < 1)
     return (NULL);
@@ -83,8 +83,6 @@ SrcLoc::str(char *buf, int buflen) const
 }
 
 
-
-
 //////////////////////////////////////////////////////////////////////////////
 //
 //      Diags::Diags(char *bdt, char *bat)
@@ -103,9 +101,8 @@ SrcLoc::str(char *buf, int buflen) const
 //
 //////////////////////////////////////////////////////////////////////////////
 
-Diags::Diags(const char *bdt, const char *bat, FILE * _diags_log_fp)
-  : diags_log_fp(_diags_log_fp), magic(DIAGS_MAGIC), show_location(0),
-    base_debug_tags(NULL), base_action_tags(NULL)
+Diags::Diags(const char *bdt, const char *bat, FILE *_diags_log_fp)
+  : diags_log_fp(_diags_log_fp), magic(DIAGS_MAGIC), show_location(0), base_debug_tags(NULL), base_action_tags(NULL)
 {
   int i;
 
@@ -141,7 +138,6 @@ Diags::Diags(const char *bdt, const char *bat, FILE * _diags_log_fp)
   activated_tags[DiagsTagType_Debug] = NULL;
   activated_tags[DiagsTagType_Action] = NULL;
   prefix_str = "";
-
 }
 
 Diags::~Diags()
@@ -184,8 +180,7 @@ Diags::~Diags()
 //////////////////////////////////////////////////////////////////////////////
 
 void
-Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc,
-                const char *format_string, va_list ap) const
+Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc, const char *format_string, va_list ap) const
 {
   struct timeval tp;
   const char *s;
@@ -213,13 +208,14 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc
 
   // add the thread id
   pthread_t id = pthread_self();
-  end_of_format += snprintf(end_of_format, sizeof(format_buf), "{0x%" PRIx64 "} ", (uint64_t) id);
+  end_of_format += snprintf(end_of_format, sizeof(format_buf), "{0x%" PRIx64 "} ", (uint64_t)id);
 
   //////////////////////////////////////
   // start with the diag level prefix //
   //////////////////////////////////////
 
-  for (s = level_name(diags_level); *s; *end_of_format++ = *s++);
+  for (s = level_name(diags_level); *s; *end_of_format++ = *s++)
+    ;
   *end_of_format++ = ':';
   *end_of_format++ = ' ';
 
@@ -232,7 +228,8 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc
     lp = loc->str(buf, sizeof(buf));
     if (lp) {
       *end_of_format++ = '<';
-      for (s = lp; *s; *end_of_format++ = *s++);
+      for (s = lp; *s; *end_of_format++ = *s++)
+        ;
       *end_of_format++ = '>';
       *end_of_format++ = ' ';
     }
@@ -243,7 +240,8 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc
 
   if (debug_tag) {
     *end_of_format++ = '(';
-    for (s = debug_tag; *s; *end_of_format++ = *s++);
+    for (s = debug_tag; *s; *end_of_format++ = *s++)
+      ;
     *end_of_format++ = ')';
     *end_of_format++ = ' ';
   }
@@ -251,7 +249,8 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc
   // append original format string, and NUL terminate //
   //////////////////////////////////////////////////////
 
-  for (s = format_string; *s; *end_of_format++ = *s++);
+  for (s = format_string; *s; *end_of_format++ = *s++)
+    ;
   *end_of_format++ = NUL;
 
 
@@ -260,9 +259,9 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc
   //////////////////////////////////////////////////////////////////
 
   ink_gethrtimeofday(&tp, NULL);
-  time_t cur_clock = (time_t) tp.tv_sec;
+  time_t cur_clock = (time_t)tp.tv_sec;
   buffer = ink_ctime_r(&cur_clock, timestamp_buf);
-  snprintf(&(timestamp_buf[19]), (sizeof(timestamp_buf) - 20), ".%03d", (int) (tp.tv_usec / 1000));
+  snprintf(&(timestamp_buf[19]), (sizeof(timestamp_buf) - 20), ".%03d", (int)(tp.tv_usec / 1000));
 
   d = format_buf_w_ts;
   *d++ = '[';
@@ -273,7 +272,8 @@ Diags::print_va(const char *debug_tag, DiagsLevel diags_level, const SrcLoc *loc
 
   for (int k = 0; prefix_str[k]; k++)
     *d++ = prefix_str[k];
-  for (s = format_buf; *s; *d++ = *s++);
+  for (s = format_buf; *s; *d++ = *s++)
+    ;
   *d++ = NUL;
 
   //////////////////////////////////////
@@ -490,7 +490,7 @@ Diags::level_name(DiagsLevel dl) const
 //////////////////////////////////////////////////////////////////////////////
 
 void
-Diags::dump(FILE * fp) const
+Diags::dump(FILE *fp) const
 {
   int i;
 
@@ -501,19 +501,16 @@ Diags::dump(FILE * fp) const
   fprintf(fp, "  action default tags: '%s'\n", (base_action_tags ? base_action_tags : "NULL"));
   fprintf(fp, "  outputs:\n");
   for (i = 0; i < DiagsLevel_Count; i++) {
-    fprintf(fp, "    %10s [stdout=%d, stderr=%d, syslog=%d, diagslog=%d]\n",
-            level_name((DiagsLevel) i),
-            config.outputs[i].to_stdout,
+    fprintf(fp, "    %10s [stdout=%d, stderr=%d, syslog=%d, diagslog=%d]\n", level_name((DiagsLevel)i), config.outputs[i].to_stdout,
             config.outputs[i].to_stderr, config.outputs[i].to_syslog, config.outputs[i].to_diagslog);
   }
 }
 
 void
-Diags::log(const char *tag, DiagsLevel level,
-           const char *file, const char *func, const int line,
-           const char *format_string ...) const
+Diags::log(const char *tag, DiagsLevel level, const char *file, const char *func, const int line,
+           const char *format_string...) const
 {
-  if (! on(tag))
+  if (!on(tag))
     return;
 
   va_list ap;
@@ -528,9 +525,7 @@ Diags::log(const char *tag, DiagsLevel level,
 }
 
 void
-Diags::error_va(DiagsLevel level,
-             const char *file, const char *func, const int line,
-             const char *format_string, va_list ap) const
+Diags::error_va(DiagsLevel level, const char *file, const char *func, const int line, const char *format_string, va_list ap) const
 {
   va_list ap2;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Diags.h
----------------------------------------------------------------------
diff --git a/lib/ts/Diags.h b/lib/ts/Diags.h
index 7a228c5..fe3248f 100644
--- a/lib/ts/Diags.h
+++ b/lib/ts/Diags.h
@@ -46,32 +46,29 @@
 class Diags;
 
 // extern int diags_on_for_plugins;
-typedef enum
-{
-  DiagsTagType_Debug = 0,       // do not renumber --- used as array index
+typedef enum {
+  DiagsTagType_Debug = 0, // do not renumber --- used as array index
   DiagsTagType_Action = 1
 } DiagsTagType;
 
-struct DiagsModeOutput
-{
+struct DiagsModeOutput {
   bool to_stdout;
   bool to_stderr;
   bool to_syslog;
   bool to_diagslog;
 };
 
-typedef enum
-{                               // do not renumber --- used as array index
-  DL_Diag = 0,                  // process does not die
-  DL_Debug,                     // process does not die
-  DL_Status,                    // process does not die
-  DL_Note,                      // process does not die
-  DL_Warning,                   // process does not die
-  DL_Error,                     // process does not die
-  DL_Fatal,                     // causes process termination
-  DL_Alert,                     // causes process termination
-  DL_Emergency,                 // causes process termination
-  DL_Undefined                  // must be last, used for size!
+typedef enum {  // do not renumber --- used as array index
+  DL_Diag = 0,  // process does not die
+  DL_Debug,     // process does not die
+  DL_Status,    // process does not die
+  DL_Note,      // process does not die
+  DL_Warning,   // process does not die
+  DL_Error,     // process does not die
+  DL_Fatal,     // causes process termination
+  DL_Alert,     // causes process termination
+  DL_Emergency, // causes process termination
+  DL_Undefined  // must be last, used for size!
 } DiagsLevel;
 
 #define DiagsLevel_Count DL_Undefined
@@ -80,13 +77,12 @@ typedef enum
 
 // Cleanup Function Prototype - Called before ink_fatal to
 //   cleanup process state
-typedef void (*DiagsCleanupFunc) ();
+typedef void (*DiagsCleanupFunc)();
 
-struct DiagsConfigState
-{
+struct DiagsConfigState {
   // this is static to eliminate many loads from the critical path
-  static bool enabled[2];                       // one debug, one action
-  DiagsModeOutput outputs[DiagsLevel_Count];    // where each level prints
+  static bool enabled[2];                    // one debug, one action
+  DiagsModeOutput outputs[DiagsLevel_Count]; // where each level prints
 };
 
 
@@ -109,25 +105,25 @@ public:
   const char *func;
   int line;
 
-  bool valid() const {
+  bool
+  valid() const
+  {
     return file && line;
   }
 
-  SrcLoc(const SrcLoc& rhs) : file(rhs.file), func(rhs.func), line(rhs.line) {
-  }
+  SrcLoc(const SrcLoc &rhs) : file(rhs.file), func(rhs.func), line(rhs.line) {}
 
-  SrcLoc(const char *_file, const char *_func, int _line)
-    : file(_file), func(_func), line(_line) {
-  }
+  SrcLoc(const char *_file, const char *_func, int _line) : file(_file), func(_func), line(_line) {}
 
-  SrcLoc& operator=(const SrcLoc& rhs) {
+  SrcLoc &operator=(const SrcLoc &rhs)
+  {
     this->file = rhs.file;
     this->func = rhs.func;
     this->line = rhs.line;
     return *this;
   }
 
-  char * str(char *buf, int buflen) const;
+  char *str(char *buf, int buflen) const;
 };
 
 
@@ -149,8 +145,8 @@ public:
 class Diags
 {
 public:
-  Diags(const char *base_debug_tags, const char *base_action_tags, FILE * _diags_log_fp = NULL);
-   ~Diags();
+  Diags(const char *base_debug_tags, const char *base_action_tags, FILE *_diags_log_fp = NULL);
+  ~Diags();
 
   FILE *diags_log_fp;
   const unsigned int magic;
@@ -163,11 +159,15 @@ public:
   // conditional debugging //
   ///////////////////////////
 
-  bool on(DiagsTagType mode = DiagsTagType_Debug) const {
+  bool
+  on(DiagsTagType mode = DiagsTagType_Debug) const
+  {
     return (config.enabled[mode]);
   }
 
-  bool on(const char *tag, DiagsTagType mode = DiagsTagType_Debug) const {
+  bool
+  on(const char *tag, DiagsTagType mode = DiagsTagType_Debug) const
+  {
     return (config.enabled[mode] && tag_activated(tag, mode));
   }
 
@@ -183,16 +183,16 @@ public:
 
   const char *level_name(DiagsLevel dl) const;
 
-  inkcoreapi void print_va(const char *tag, DiagsLevel dl,
-                           const SrcLoc *loc, const char *format_string, va_list ap) const;
+  inkcoreapi void print_va(const char *tag, DiagsLevel dl, const SrcLoc *loc, const char *format_string, va_list ap) const;
 
 
   //////////////////////////////
   // user printing interfaces //
   //////////////////////////////
 
-  void print(const char *tag, DiagsLevel dl, const char *file, const char *func,
-             const int line, const char *format_string, ...) const TS_PRINTFLIKE(7, 8)
+  void
+  print(const char *tag, DiagsLevel dl, const char *file, const char *func, const int line, const char *format_string, ...) const
+    TS_PRINTFLIKE(7, 8)
   {
     va_list ap;
     va_start(ap, format_string);
@@ -210,25 +210,22 @@ public:
   // on the value of the enable flag, and the state of the debug tags. //
   ///////////////////////////////////////////////////////////////////////
 
-  void log_va(const char *tag, DiagsLevel dl, const SrcLoc * loc, const char *format_string, va_list ap)
+  void
+  log_va(const char *tag, DiagsLevel dl, const SrcLoc *loc, const char *format_string, va_list ap)
   {
     if (!on(tag))
       return;
     print_va(tag, dl, loc, format_string, ap);
   }
 
-  void log(const char *tag, DiagsLevel dl,
-           const char *file, const char *func, const int line,
-           const char *format_string, ...) const TS_PRINTFLIKE(7, 8);
+  void log(const char *tag, DiagsLevel dl, const char *file, const char *func, const int line, const char *format_string, ...) const
+    TS_PRINTFLIKE(7, 8);
 
-  void error_va(DiagsLevel dl,
-             const char *file, const char *func, const int line,
-             const char *format_string, va_list ap) const;
+  void error_va(DiagsLevel dl, const char *file, const char *func, const int line, const char *format_string, va_list ap) const;
 
   void
-  error(DiagsLevel level,
-               const char *file, const char *func, const int line,
-               const char *format_string, ...) const TS_PRINTFLIKE(6, 7)
+  error(DiagsLevel level, const char *file, const char *func, const int line, const char *format_string, ...) const
+    TS_PRINTFLIKE(6, 7)
   {
     va_list ap;
     va_start(ap, format_string);
@@ -236,24 +233,26 @@ public:
     va_end(ap);
   }
 
-  void dump(FILE * fp = stdout) const;
+  void dump(FILE *fp = stdout) const;
 
   void activate_taglist(const char *taglist, DiagsTagType mode = DiagsTagType_Debug);
 
   void deactivate_all(DiagsTagType mode = DiagsTagType_Debug);
 
-  const char *base_debug_tags;        // internal copy of default debug tags
-  const char *base_action_tags;       // internal copy of default action tags
+  const char *base_debug_tags;  // internal copy of default debug tags
+  const char *base_action_tags; // internal copy of default action tags
 
 private:
-  mutable ink_mutex tag_table_lock;   // prevents reconfig/read races
-  DFA *activated_tags[2];             // 1 table for debug, 1 for action
+  mutable ink_mutex tag_table_lock; // prevents reconfig/read races
+  DFA *activated_tags[2];           // 1 table for debug, 1 for action
 
-  void lock() const
+  void
+  lock() const
   {
     ink_mutex_acquire(&tag_table_lock);
   }
-  void unlock() const
+  void
+  unlock() const
   {
     ink_mutex_release(&tag_table_lock);
   }
@@ -272,7 +271,7 @@ private:
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
 
-#if !defined (__GNUC__)
+#if !defined(__GNUC__)
 #ifndef __FUNCTION__
 #define __FUNCTION__ NULL
 #endif
@@ -280,8 +279,8 @@ private:
 
 extern inkcoreapi Diags *diags;
 
-#define DTA(l)    l,__FILE__,__FUNCTION__,__LINE__
-void dummy_debug(const char * tag, const char *fmt, ...) TS_PRINTFLIKE(2, 3);
+#define DTA(l) l, __FILE__, __FUNCTION__, __LINE__
+void dummy_debug(const char *tag, const char *fmt, ...) TS_PRINTFLIKE(2, 3);
 inline void
 dummy_debug(const char *tag, const char *fmt, ...)
 {
@@ -289,49 +288,63 @@ dummy_debug(const char *tag, const char *fmt, ...)
   (void)fmt;
 }
 
-#define Status(...)    diags->error(DTA(DL_Status), __VA_ARGS__)
-#define Note(...)      diags->error(DTA(DL_Note), __VA_ARGS__)
-#define Warning(...)   diags->error(DTA(DL_Warning), __VA_ARGS__)
-#define Error(...)     diags->error(DTA(DL_Error), __VA_ARGS__)
-#define Fatal(...)     diags->error(DTA(DL_Fatal), __VA_ARGS__)
-#define Alert(...)     diags->error(DTA(DL_Alert), __VA_ARGS__)
+#define Status(...) diags->error(DTA(DL_Status), __VA_ARGS__)
+#define Note(...) diags->error(DTA(DL_Note), __VA_ARGS__)
+#define Warning(...) diags->error(DTA(DL_Warning), __VA_ARGS__)
+#define Error(...) diags->error(DTA(DL_Error), __VA_ARGS__)
+#define Fatal(...) diags->error(DTA(DL_Fatal), __VA_ARGS__)
+#define Alert(...) diags->error(DTA(DL_Alert), __VA_ARGS__)
 #define Emergency(...) diags->error(DTA(DL_Emergency), __VA_ARGS__)
 
-#define StatusV(fmt, ap)    diags->error_va(DTA(DL_Status), fmt, ap)
-#define NoteV(fmt, ap)      diags->error_va(DTA(DL_Note), fmt, ap)
-#define WarningV(fmt, ap)   diags->error_va(DTA(DL_Warning), fmt, ap)
-#define ErrorV(fmt, ap)     diags->error_va(DTA(DL_Error), fmt, ap)
-#define FatalV(fmt, ap)     diags->error_va(DTA(DL_Fatal), fmt, ap)
-#define AlertV(fmt, ap)     diags->error_va(DTA(DL_Alert), fmt, ap)
+#define StatusV(fmt, ap) diags->error_va(DTA(DL_Status), fmt, ap)
+#define NoteV(fmt, ap) diags->error_va(DTA(DL_Note), fmt, ap)
+#define WarningV(fmt, ap) diags->error_va(DTA(DL_Warning), fmt, ap)
+#define ErrorV(fmt, ap) diags->error_va(DTA(DL_Error), fmt, ap)
+#define FatalV(fmt, ap) diags->error_va(DTA(DL_Fatal), fmt, ap)
+#define AlertV(fmt, ap) diags->error_va(DTA(DL_Alert), fmt, ap)
 #define EmergencyV(fmt, ap) diags->error_va(DTA(DL_Emergency), fmt, ap)
 
 #ifdef TS_USE_DIAGS
-#define Diag(tag, ...)      if (unlikely(diags->on())) diags->log(tag, DTA(DL_Diag), __VA_ARGS__)
-#define Debug(tag, ...)     if (unlikely(diags->on())) diags->log(tag, DTA(DL_Debug), __VA_ARGS__)
-#define DiagSpecific(flag, tag, ...)  if (unlikely(diags->on())) flag ? diags->print(tag, DTA(DL_Diag), __VA_ARGS__) : \
-                                                                   diags->log(tag, DTA(DL_Diag), __VA_ARGS__)
-#define DebugSpecific(flag, tag, ...)  if (unlikely(diags->on())) flag ? diags->print(tag, DTA(DL_Debug), __VA_ARGS__) : \
-                                                                    diags->log(tag, DTA(DL_Debug), __VA_ARGS__)
-
-#define is_debug_tag_set(_t)     unlikely(diags->on(_t,DiagsTagType_Debug))
-#define is_action_tag_set(_t)    unlikely(diags->on(_t,DiagsTagType_Action))
-#define debug_tag_assert(_t,_a)  (is_debug_tag_set(_t) ? (ink_release_assert(_a), 0) : 0)
-#define action_tag_assert(_t,_a) (is_action_tag_set(_t) ? (ink_release_assert(_a), 0) : 0)
-#define is_diags_on(_t)          unlikely(diags->on(_t))
+#define Diag(tag, ...)       \
+  if (unlikely(diags->on())) \
+  diags->log(tag, DTA(DL_Diag), __VA_ARGS__)
+#define Debug(tag, ...)      \
+  if (unlikely(diags->on())) \
+  diags->log(tag, DTA(DL_Debug), __VA_ARGS__)
+#define DiagSpecific(flag, tag, ...) \
+  if (unlikely(diags->on()))         \
+  flag ? diags->print(tag, DTA(DL_Diag), __VA_ARGS__) : diags->log(tag, DTA(DL_Diag), __VA_ARGS__)
+#define DebugSpecific(flag, tag, ...) \
+  if (unlikely(diags->on()))          \
+  flag ? diags->print(tag, DTA(DL_Debug), __VA_ARGS__) : diags->log(tag, DTA(DL_Debug), __VA_ARGS__)
+
+#define is_debug_tag_set(_t) unlikely(diags->on(_t, DiagsTagType_Debug))
+#define is_action_tag_set(_t) unlikely(diags->on(_t, DiagsTagType_Action))
+#define debug_tag_assert(_t, _a) (is_debug_tag_set(_t) ? (ink_release_assert(_a), 0) : 0)
+#define action_tag_assert(_t, _a) (is_action_tag_set(_t) ? (ink_release_assert(_a), 0) : 0)
+#define is_diags_on(_t) unlikely(diags->on(_t))
 
 #else // TS_USE_DIAGS
 
-#define Diag(tag, fmt, ...)      if (0) dummy_debug(tag, __VA_ARGS__)
-#define Debug(tag, fmt, ...)     if (0) dummy_debug(tag, __VA_ARGS__)
-#define DiagSpecific(flag, tag, ...)  if (0 && tag) dummy_debug(tag, __VA_ARGS__);
-#define DebugSpecific(flag, tag, ...)  if (0 && tag) dummy_debug(tag, __VA_ARGS__);
-
-
-#define is_debug_tag_set(_t)     0
-#define is_action_tag_set(_t)    0
-#define debug_tag_assert(_t,_a) /**/
-#define action_tag_assert(_t,_a) /**/
-#define is_diags_on(_t)          0
+#define Diag(tag, fmt, ...) \
+  if (0)                    \
+  dummy_debug(tag, __VA_ARGS__)
+#define Debug(tag, fmt, ...) \
+  if (0)                     \
+  dummy_debug(tag, __VA_ARGS__)
+#define DiagSpecific(flag, tag, ...) \
+  if (0 && tag)                      \
+    dummy_debug(tag, __VA_ARGS__);
+#define DebugSpecific(flag, tag, ...) \
+  if (0 && tag)                       \
+    dummy_debug(tag, __VA_ARGS__);
+
+
+#define is_debug_tag_set(_t) 0
+#define is_action_tag_set(_t) 0
+#define debug_tag_assert(_t, _a)  /**/
+#define action_tag_assert(_t, _a) /**/
+#define is_diags_on(_t) 0
 
 #endif // TS_USE_DIAGS
-#endif  /*_Diags_h_*/
+#endif /*_Diags_h_*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/DynArray.h
----------------------------------------------------------------------
diff --git a/lib/ts/DynArray.h b/lib/ts/DynArray.h
index aa7a599..bd18cc5 100644
--- a/lib/ts/DynArray.h
+++ b/lib/ts/DynArray.h
@@ -24,17 +24,18 @@
 #ifndef __DYN_ARRAY_H__
 #define __DYN_ARRAY_H__
 
-template<class T> class DynArray {
+template <class T> class DynArray
+{
 public:
-  DynArray(const T * val = 0, intptr_t initial_size = 0);
+  DynArray(const T *val = 0, intptr_t initial_size = 0);
   ~DynArray();
 
 #ifndef __GNUC__
-  operator  const T *() const;
+  operator const T *() const;
 #endif
-  operator  T *();
-  T & operator[](intptr_t idx);
-  T & operator()(intptr_t idx);
+  operator T *();
+  T &operator[](intptr_t idx);
+  T &operator()(intptr_t idx);
   T *detach();
   T defvalue() const;
   intptr_t length();
@@ -45,19 +46,16 @@ private:
   void resize(intptr_t new_size);
 
 private:
-  T * data;
+  T *data;
   const T *default_val;
   int size;
   int pos;
 };
 
 
-template<class T> inline DynArray<T>::DynArray(const T * val, intptr_t initial_size)
-  :
-data(NULL),
-default_val(val),
-size(0),
-pos(-1)
+template <class T>
+inline DynArray<T>::DynArray(const T *val, intptr_t initial_size)
+  : data(NULL), default_val(val), size(0), pos(-1)
 {
   if (initial_size > 0) {
     int i = 1;
@@ -67,41 +65,34 @@ pos(-1)
 
     resize(i);
   }
-
 }
 
-template<class T> inline DynArray<T>::~DynArray()
+template <class T> inline DynArray<T>::~DynArray()
 {
   if (data) {
-    delete[]data;
+    delete[] data;
   }
 }
 
 #ifndef __GNUC__
-template<class T> inline DynArray<T>::operator  const T *()
-const
+template <class T> inline DynArray<T>::operator const T *() const
 {
-  return
-    data;
+  return data;
 }
 #endif
 
-template <
-  class
-  T >
-  inline
-  DynArray <
-  T >::operator
-T * ()
+template <class T> inline DynArray<T>::operator T *()
 {
   return data;
 }
 
-template<class T> inline T & DynArray<T>::operator [](intptr_t idx) {
+template <class T> inline T &DynArray<T>::operator[](intptr_t idx)
+{
   return data[idx];
 }
 
-template<class T> inline T & DynArray<T>::operator ()(intptr_t idx) {
+template <class T> inline T &DynArray<T>::operator()(intptr_t idx)
+{
   if (idx >= size) {
     intptr_t new_size;
 
@@ -125,7 +116,9 @@ template<class T> inline T & DynArray<T>::operator ()(intptr_t idx) {
   return data[idx];
 }
 
-template<class T> inline T * DynArray<T>::detach()
+template <class T>
+inline T *
+DynArray<T>::detach()
 {
   T *d;
 
@@ -135,20 +128,26 @@ template<class T> inline T * DynArray<T>::detach()
   return d;
 }
 
-template<class T> inline T DynArray<T>::defvalue() const
+template <class T>
+inline T
+DynArray<T>::defvalue() const
 {
   return *default_val;
 }
 
-template<class T> inline intptr_t DynArray<T>::length()
+template <class T>
+inline intptr_t
+DynArray<T>::length()
 {
   return pos + 1;
 }
 
-template<class T> inline void DynArray<T>::clear()
+template <class T>
+inline void
+DynArray<T>::clear()
 {
   if (data) {
-    delete[]data;
+    delete[] data;
     data = NULL;
   }
 
@@ -156,12 +155,16 @@ template<class T> inline void DynArray<T>::clear()
   pos = -1;
 }
 
-template<class T> inline void DynArray<T>::set_length(intptr_t i)
+template <class T>
+inline void
+DynArray<T>::set_length(intptr_t i)
 {
   pos = i - 1;
 }
 
-template<class T> inline void DynArray<T>::resize(intptr_t new_size)
+template <class T>
+inline void
+DynArray<T>::resize(intptr_t new_size)
 {
   if (new_size > size) {
     T *new_data;
@@ -175,11 +178,11 @@ template<class T> inline void DynArray<T>::resize(intptr_t new_size)
 
     for (; i < new_size; i++) {
       if (default_val)
-        new_data[i] = (T) * default_val;
+        new_data[i] = (T)*default_val;
     }
 
     if (data) {
-      delete[]data;
+      delete[] data;
     }
     data = new_data;
     size = new_size;
@@ -188,4 +191,3 @@ template<class T> inline void DynArray<T>::resize(intptr_t new_size)
 
 
 #endif /* __DYN_ARRAY_H__ */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/EventNotify.cc
----------------------------------------------------------------------
diff --git a/lib/ts/EventNotify.cc b/lib/ts/EventNotify.cc
index 296e220..dce9d81 100644
--- a/lib/ts/EventNotify.cc
+++ b/lib/ts/EventNotify.cc
@@ -109,8 +109,7 @@ EventNotify::wait(void)
 #endif
 }
 
-int
-EventNotify::timedwait(int timeout) // milliseconds
+int EventNotify::timedwait(int timeout) // milliseconds
 {
 #ifdef HAVE_EVENTFD
   ssize_t nr, nr_fd = 0;
@@ -151,7 +150,7 @@ void
 EventNotify::lock(void)
 {
 #ifdef HAVE_EVENTFD
-  // do nothing
+// do nothing
 #else
   ink_mutex_acquire(&m_mutex);
 #endif
@@ -171,7 +170,7 @@ void
 EventNotify::unlock(void)
 {
 #ifdef HAVE_EVENTFD
-  // do nothing
+// do nothing
 #else
   ink_mutex_release(&m_mutex);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Hash.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Hash.cc b/lib/ts/Hash.cc
index d36c96a..31a74b7 100644
--- a/lib/ts/Hash.cc
+++ b/lib/ts/Hash.cc
@@ -26,11 +26,9 @@ ATSHashBase::~ATSHashBase()
 {
 }
 
-bool
-ATSHash::operator==(const ATSHash & other) const
+bool ATSHash::operator==(const ATSHash &other) const
 {
-  if (this->size() != other.size())
-  {
+  if (this->size() != other.size()) {
     return false;
   }
   if (memcmp(this->get(), other.get(), this->size()) == 0) {
@@ -40,14 +38,12 @@ ATSHash::operator==(const ATSHash & other) const
   }
 }
 
-bool
-ATSHash32::operator==(const ATSHash32 & other) const
+bool ATSHash32::operator==(const ATSHash32 &other) const
 {
   return this->get() == other.get();
 }
 
-bool
-ATSHash64::operator==(const ATSHash64 & other) const
+bool ATSHash64::operator==(const ATSHash64 &other) const
 {
   return this->get() == other.get();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Hash.h
----------------------------------------------------------------------
diff --git a/lib/ts/Hash.h b/lib/ts/Hash.h
index 2306389..19ed7bb 100644
--- a/lib/ts/Hash.h
+++ b/lib/ts/Hash.h
@@ -26,22 +26,20 @@
 #include <stdint.h>
 #include <ctype.h>
 
-struct ATSHashBase
-{
+struct ATSHashBase {
   virtual void update(const void *, size_t) = 0;
   virtual void final(void) = 0;
   virtual void clear(void) = 0;
   virtual ~ATSHashBase();
 };
 
-struct ATSHash:ATSHashBase
-{
+struct ATSHash : ATSHashBase {
   struct nullxfrm {
-    uint8_t operator() (uint8_t byte) const { return byte; }
+    uint8_t operator()(uint8_t byte) const { return byte; }
   };
 
   struct nocase {
-    uint8_t operator() (uint8_t byte) const { return toupper(byte); }
+    uint8_t operator()(uint8_t byte) const { return toupper(byte); }
   };
 
   virtual const void *get(void) const = 0;
@@ -49,14 +47,12 @@ struct ATSHash:ATSHashBase
   virtual bool operator==(const ATSHash &) const;
 };
 
-struct ATSHash32:ATSHashBase
-{
+struct ATSHash32 : ATSHashBase {
   virtual uint32_t get(void) const = 0;
   virtual bool operator==(const ATSHash32 &) const;
 };
 
-struct ATSHash64:ATSHashBase
-{
+struct ATSHash64 : ATSHashBase {
   virtual uint64_t get(void) const = 0;
   virtual bool operator==(const ATSHash64 &) const;
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HashFNV.h
----------------------------------------------------------------------
diff --git a/lib/ts/HashFNV.h b/lib/ts/HashFNV.h
index 4467b7a..97a2bd5 100644
--- a/lib/ts/HashFNV.h
+++ b/lib/ts/HashFNV.h
@@ -31,57 +31,65 @@
 #include "Hash.h"
 #include <stdint.h>
 
-struct ATSHash32FNV1a:ATSHash32
-{
+struct ATSHash32FNV1a : ATSHash32 {
   ATSHash32FNV1a(void);
 
   template <typename Transform> void update(const void *data, size_t len, Transform xfrm);
-  void update(const void *data, size_t len) { update(data, len, ATSHash::nullxfrm()); }
+  void
+  update(const void *data, size_t len)
+  {
+    update(data, len, ATSHash::nullxfrm());
+  }
 
   void final(void);
   uint32_t get(void) const;
   void clear(void);
 
 private:
-    uint32_t hval;
+  uint32_t hval;
 };
 
-template <typename Transform> void
+template <typename Transform>
+void
 ATSHash32FNV1a::update(const void *data, size_t len, Transform xfrm)
 {
-  uint8_t *bp = (uint8_t *) data;
+  uint8_t *bp = (uint8_t *)data;
   uint8_t *be = bp + len;
 
   for (; bp < be; ++bp) {
-    hval ^= (uint32_t) xfrm(*bp);
+    hval ^= (uint32_t)xfrm(*bp);
     hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
   }
 }
 
-struct ATSHash64FNV1a:ATSHash64
-{
+struct ATSHash64FNV1a : ATSHash64 {
   ATSHash64FNV1a(void);
 
   template <typename Transform> void update(const void *data, size_t len, Transform xfrm);
-  void update(const void *data, size_t len) { update(data, len, ATSHash::nullxfrm()); }
+  void
+  update(const void *data, size_t len)
+  {
+    update(data, len, ATSHash::nullxfrm());
+  }
 
   void final(void);
   uint64_t get(void) const;
   void clear(void);
 
 private:
-    uint64_t hval;
+  uint64_t hval;
 };
 
 
-template <typename Transform> void
+template <typename Transform>
+void
 ATSHash64FNV1a::update(const void *data, size_t len, Transform xfrm)
 {
-  uint8_t *bp = (uint8_t *) data;
+  uint8_t *bp = (uint8_t *)data;
   uint8_t *be = bp + len;
 
   for (; bp < be; ++bp) {
-    hval ^= (uint64_t) xfrm(*bp);
+    hval ^= (uint64_t)xfrm(*bp);
     hval += (hval << 1) + (hval << 4) + (hval << 5) + (hval << 7) + (hval << 8) + (hval << 40);
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HashMD5.cc
----------------------------------------------------------------------
diff --git a/lib/ts/HashMD5.cc b/lib/ts/HashMD5.cc
index c2607ad..93fb787 100644
--- a/lib/ts/HashMD5.cc
+++ b/lib/ts/HashMD5.cc
@@ -21,49 +21,56 @@
 
 #include "HashMD5.h"
 
-ATSHashMD5::ATSHashMD5(void) {
-    EVP_DigestInit(&ctx, EVP_md5());
-    md_len = 0;
-    finalized = false;
+ATSHashMD5::ATSHashMD5(void)
+{
+  EVP_DigestInit(&ctx, EVP_md5());
+  md_len = 0;
+  finalized = false;
 }
 
 void
-ATSHashMD5::update(const void *data, size_t len) {
-    if (!finalized) {
-        EVP_DigestUpdate(&ctx, data, len);
-    }
+ATSHashMD5::update(const void *data, size_t len)
+{
+  if (!finalized) {
+    EVP_DigestUpdate(&ctx, data, len);
+  }
 }
 
 void
-ATSHashMD5::final(void) {
-    if (!finalized) {
-        EVP_DigestFinal_ex(&ctx, md_value, &md_len);
-        finalized = true;
-    }
+ATSHashMD5::final(void)
+{
+  if (!finalized) {
+    EVP_DigestFinal_ex(&ctx, md_value, &md_len);
+    finalized = true;
+  }
 }
 
 const void *
-ATSHashMD5::get(void) const {
-    if (finalized) {
-        return (void *) md_value;
-    } else {
-        return NULL;
-    }
+ATSHashMD5::get(void) const
+{
+  if (finalized) {
+    return (void *)md_value;
+  } else {
+    return NULL;
+  }
 }
 
 size_t
-ATSHashMD5::size(void) const {
-    return EVP_MD_CTX_size(&ctx);
+ATSHashMD5::size(void) const
+{
+  return EVP_MD_CTX_size(&ctx);
 }
 
 void
-ATSHashMD5::clear(void) {
-    EVP_MD_CTX_cleanup(&ctx);
-    EVP_DigestInit(&ctx, EVP_md5());
-    md_len = 0;
-    finalized = false;
+ATSHashMD5::clear(void)
+{
+  EVP_MD_CTX_cleanup(&ctx);
+  EVP_DigestInit(&ctx, EVP_md5());
+  md_len = 0;
+  finalized = false;
 }
 
-ATSHashMD5::~ATSHashMD5() {
-    EVP_MD_CTX_cleanup(&ctx);
+ATSHashMD5::~ATSHashMD5()
+{
+  EVP_MD_CTX_cleanup(&ctx);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HashMD5.h
----------------------------------------------------------------------
diff --git a/lib/ts/HashMD5.h b/lib/ts/HashMD5.h
index bcf2d0b..0a4b566 100644
--- a/lib/ts/HashMD5.h
+++ b/lib/ts/HashMD5.h
@@ -26,19 +26,19 @@
 #include <openssl/evp.h>
 
 struct ATSHashMD5 : ATSHash {
-    ATSHashMD5(void);
-    void update(const void *data, size_t len);
-    void final(void);
-    const void *get(void) const;
-    size_t size(void) const;
-    void clear(void);
-    ~ATSHashMD5();
+  ATSHashMD5(void);
+  void update(const void *data, size_t len);
+  void final(void);
+  const void *get(void) const;
+  size_t size(void) const;
+  void clear(void);
+  ~ATSHashMD5();
 
 private:
-    EVP_MD_CTX ctx;
-    unsigned char md_value[EVP_MAX_MD_SIZE];
-    unsigned int md_len;
-    bool finalized;
+  EVP_MD_CTX ctx;
+  unsigned char md_value[EVP_MAX_MD_SIZE];
+  unsigned int md_len;
+  bool finalized;
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HashSip.cc
----------------------------------------------------------------------
diff --git a/lib/ts/HashSip.cc b/lib/ts/HashSip.cc
index 6ccb6d6..80a2c00 100644
--- a/lib/ts/HashSip.cc
+++ b/lib/ts/HashSip.cc
@@ -13,25 +13,25 @@ https://github.com/floodyberry/siphash
 
 #define SIP_BLOCK_SIZE 8
 
-#define ROTL64(a,b) (((a)<<(b))|((a)>>(64-b)))
+#define ROTL64(a, b) (((a) << (b)) | ((a) >> (64 - b)))
 
 #define U8TO64_LE(p) *(const uint64_t *)(p)
 
-#define SIPCOMPRESS(x0,x1,x2,x3) \
-    x0 += x1; \
-    x2 += x3; \
-    x1 = ROTL64(x1,13); \
-    x3 = ROTL64(x3,16); \
-    x1 ^= x0; \
-    x3 ^= x2; \
-    x0 = ROTL64(x0,32); \
-    x2 += x1; \
-    x0 += x3; \
-    x1 = ROTL64(x1,17); \
-    x3 = ROTL64(x3,21); \
-    x1 ^= x2; \
-    x3 ^= x0; \
-    x2 = ROTL64(x2,32);
+#define SIPCOMPRESS(x0, x1, x2, x3) \
+  x0 += x1;                         \
+  x2 += x3;                         \
+  x1 = ROTL64(x1, 13);              \
+  x3 = ROTL64(x3, 16);              \
+  x1 ^= x0;                         \
+  x3 ^= x2;                         \
+  x0 = ROTL64(x0, 32);              \
+  x2 += x1;                         \
+  x0 += x3;                         \
+  x1 = ROTL64(x1, 17);              \
+  x3 = ROTL64(x3, 21);              \
+  x1 ^= x2;                         \
+  x3 ^= x0;                         \
+  x2 = ROTL64(x2, 32);
 
 ATSHash64Sip24::ATSHash64Sip24(void)
 {
@@ -63,7 +63,7 @@ ATSHash64Sip24::update(const void *data, size_t len)
   uint8_t block_off = 0;
 
   if (!finalized) {
-    m = (unsigned char *) data;
+    m = (unsigned char *)data;
     total_len += len;
 
     if (len + block_buffer_len < SIP_BLOCK_SIZE) {
@@ -102,10 +102,10 @@ ATSHash64Sip24::final(void)
   int i;
 
   if (!finalized) {
-    last7 = (uint64_t) (total_len & 0xff) << 56;
+    last7 = (uint64_t)(total_len & 0xff) << 56;
 
     for (i = block_buffer_len - 1; i >= 0; i--) {
-      last7 |= (uint64_t) block_buffer[i] << (i * 8);
+      last7 |= (uint64_t)block_buffer[i] << (i * 8);
     }
 
     v3 ^= last7;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HashSip.h
----------------------------------------------------------------------
diff --git a/lib/ts/HashSip.h b/lib/ts/HashSip.h
index 30b99c7..fe8a740 100644
--- a/lib/ts/HashSip.h
+++ b/lib/ts/HashSip.h
@@ -32,11 +32,10 @@
   a zero key for you.
  */
 
-struct ATSHash64Sip24:ATSHash64
-{
+struct ATSHash64Sip24 : ATSHash64 {
   ATSHash64Sip24(void);
-    ATSHash64Sip24(const unsigned char key[16]);
-    ATSHash64Sip24(uint64_t key0, uint64_t key1);
+  ATSHash64Sip24(const unsigned char key[16]);
+  ATSHash64Sip24(uint64_t key0, uint64_t key1);
   void update(const void *data, size_t len);
   void final(void);
   uint64_t get(void) const;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HostLookup.cc
----------------------------------------------------------------------
diff --git a/lib/ts/HostLookup.cc b/lib/ts/HostLookup.cc
index 863d124..c0d88e0 100644
--- a/lib/ts/HostLookup.cc
+++ b/lib/ts/HostLookup.cc
@@ -64,7 +64,6 @@ domaincmp(const char *hostname, const char *domain)
   }
   // Walk through both strings backward
   while (domain_cur >= domain && host_cur >= hostname) {
-
     // If we still have characters left on both strings and
     //   they do not match, matching fails
     //
@@ -170,39 +169,27 @@ hostcmp(const char *c1, const char *c2)
 //   Illegal characters map to 255
 //
 static const unsigned char asciiToTable[256] = {
-  255, 255, 255, 255, 255, 255, 255, 255,       // 0 - 7
-  255, 255, 255, 255, 255, 255, 255, 255,       // 8 - 15
-  255, 255, 255, 255, 255, 255, 255, 255,       // 16 - 23
-  255, 255, 255, 255, 255, 255, 255, 255,       // 24 - 31
-  255, 255, 255, 255, 255, 255, 255, 255,       // 32 - 39
-  255, 255, 255, 255, 255, 0, 255, 255, // 40 - 47 ('-')
-  1, 2, 3, 4, 5, 6, 7, 8,       // 48 - 55 (0-7)
-  9, 10, 255, 255, 255, 255, 255, 255,  // 56 - 63 (8-9)
-  255, 11, 12, 13, 14, 15, 16, 17,      // 64 - 71 (A-G)
-  18, 19, 20, 21, 22, 23, 24, 25,       // 72 - 79 (H-O)
-  26, 27, 28, 29, 30, 31, 32, 33,       // 80 - 87 (P-W)
-  34, 35, 36, 255, 255, 255, 255, 37,   // 88 - 95 (X-Z, '_')
-  255, 11, 12, 13, 14, 15, 16, 17,      // 96 - 103 (a-g)
-  18, 19, 20, 21, 22, 23, 24, 25,       // 104 - 111 (h-0)
-  26, 27, 28, 29, 30, 31, 32, 33,       // 112 - 119 (p-w)
-  34, 35, 36, 255, 255, 255, 255, 255,  // 120 - 127 (x-z)
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255,
-  255, 255, 255, 255, 255, 255, 255, 255
-};
+  255, 255, 255, 255, 255, 255, 255, 255, // 0 - 7
+  255, 255, 255, 255, 255, 255, 255, 255, // 8 - 15
+  255, 255, 255, 255, 255, 255, 255, 255, // 16 - 23
+  255, 255, 255, 255, 255, 255, 255, 255, // 24 - 31
+  255, 255, 255, 255, 255, 255, 255, 255, // 32 - 39
+  255, 255, 255, 255, 255, 0,   255, 255, // 40 - 47 ('-')
+  1,   2,   3,   4,   5,   6,   7,   8,   // 48 - 55 (0-7)
+  9,   10,  255, 255, 255, 255, 255, 255, // 56 - 63 (8-9)
+  255, 11,  12,  13,  14,  15,  16,  17,  // 64 - 71 (A-G)
+  18,  19,  20,  21,  22,  23,  24,  25,  // 72 - 79 (H-O)
+  26,  27,  28,  29,  30,  31,  32,  33,  // 80 - 87 (P-W)
+  34,  35,  36,  255, 255, 255, 255, 37,  // 88 - 95 (X-Z, '_')
+  255, 11,  12,  13,  14,  15,  16,  17,  // 96 - 103 (a-g)
+  18,  19,  20,  21,  22,  23,  24,  25,  // 104 - 111 (h-0)
+  26,  27,  28,  29,  30,  31,  32,  33,  // 112 - 119 (p-w)
+  34,  35,  36,  255, 255, 255, 255, 255, // 120 - 127 (x-z)
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255};
 
 // Number of legal characters in the acssiToTable array
 static const int numLegalChars = 38;
@@ -212,8 +199,7 @@ static const int numLegalChars = 38;
 //   Used by class charIndex.  Forms a single level
 //    in charIndex tree
 //
-struct charIndex_el
-{
+struct charIndex_el {
   charIndex_el();
   ~charIndex_el();
   HostBranch *branch_array[numLegalChars];
@@ -245,23 +231,21 @@ charIndex_el::~charIndex_el()
 //    Stores the location of an element in
 //    class charIndex
 //
-struct charIndexIterInternal
-{
+struct charIndexIterInternal {
   charIndex_el *ptr;
   int index;
 };
 
 // Used as a default return element for DynArray in
 //   struct charIndexIterState
-static charIndexIterInternal default_iter = { NULL, -1 };
+static charIndexIterInternal default_iter = {NULL, -1};
 
 // struct charIndexIterState
 //
 //    struct for the callee to keep interation state
 //      for class charIndex
 //
-struct charIndexIterState
-{
+struct charIndexIterState {
   charIndexIterState();
 
   // Where that level we are in interation
@@ -272,10 +256,10 @@ struct charIndexIterState
   charIndex_el *cur_el;
 
   //  Queue of the above levels
-    DynArray<charIndexIterInternal> q;
+  DynArray<charIndexIterInternal> q;
 };
 
-charIndexIterState::charIndexIterState():cur_level(-1), cur_index(-1), cur_el(NULL), q(&default_iter, 6)
+charIndexIterState::charIndexIterState() : cur_level(-1), cur_index(-1), cur_el(NULL), q(&default_iter, 6)
 {
 }
 
@@ -316,29 +300,22 @@ charIndexIterState::charIndexIterState():cur_level(-1), cur_index(-1), cur_el(NU
 //
 //
 //
-class
-  charIndex
+class charIndex
 {
 public:
   charIndex();
-  ~
-  charIndex();
-  void
-  Insert(const char *match_data, HostBranch * toInsert);
-  HostBranch *
-  Lookup(const char *match_data);
-  HostBranch *
-  iter_first(charIndexIterState * s);
-  HostBranch *
-  iter_next(charIndexIterState * s);
+  ~charIndex();
+  void Insert(const char *match_data, HostBranch *toInsert);
+  HostBranch *Lookup(const char *match_data);
+  HostBranch *iter_first(charIndexIterState *s);
+  HostBranch *iter_next(charIndexIterState *s);
+
 private:
-  charIndex_el *
-    root;
-  InkHashTable *
-    illegalKey;
+  charIndex_el *root;
+  InkHashTable *illegalKey;
 };
 
-charIndex::charIndex():illegalKey(NULL)
+charIndex::charIndex() : illegalKey(NULL)
 {
   root = new charIndex_el;
 }
@@ -357,7 +334,7 @@ charIndex::~charIndex()
     ht_entry = ink_hash_table_iterator_first(illegalKey, &ht_iter);
 
     while (ht_entry != NULL) {
-      tmp = (HostBranch *) ink_hash_table_entry_value(illegalKey, ht_entry);
+      tmp = (HostBranch *)ink_hash_table_entry_value(illegalKey, ht_entry);
       ink_assert(tmp != NULL);
       delete tmp;
       ht_entry = ink_hash_table_iterator_next(illegalKey, &ht_iter);
@@ -371,7 +348,7 @@ charIndex::~charIndex()
 //   Places a binding for match_data to toInsert into the index
 //
 void
-charIndex::Insert(const char *match_data, HostBranch * toInsert)
+charIndex::Insert(const char *match_data, HostBranch *toInsert)
 {
   unsigned char index;
   const char *match_start = match_data;
@@ -385,7 +362,7 @@ charIndex::Insert(const char *match_data, HostBranch * toInsert)
   }
 
   while (1) {
-    index = asciiToTable[(unsigned char) (*match_data)];
+    index = asciiToTable[(unsigned char)(*match_data)];
 
     // Check to see if our index into table is for an
     //  'illegal' DNS character
@@ -394,7 +371,7 @@ charIndex::Insert(const char *match_data, HostBranch * toInsert)
       if (illegalKey == NULL) {
         illegalKey = ink_hash_table_create(InkHashTableKeyType_String);
       }
-      ink_hash_table_insert(illegalKey, (char *) match_start, toInsert);
+      ink_hash_table_insert(illegalKey, (char *)match_start, toInsert);
       break;
     }
 
@@ -441,8 +418,7 @@ charIndex::Lookup(const char *match_data)
   }
 
   while (1) {
-
-    index = asciiToTable[(unsigned char) (*match_data)];
+    index = asciiToTable[(unsigned char)(*match_data)];
 
     // Check to see if our index into table is for an
     //  'illegal' DNS character
@@ -450,8 +426,8 @@ charIndex::Lookup(const char *match_data)
       if (illegalKey == NULL) {
         return NULL;
       } else {
-        if (ink_hash_table_lookup(illegalKey, (char *) match_start, &hash_lookup)) {
-          return (HostBranch *) hash_lookup;
+        if (ink_hash_table_lookup(illegalKey, (char *)match_start, &hash_lookup)) {
+          return (HostBranch *)hash_lookup;
         } else {
           return NULL;
         }
@@ -481,7 +457,7 @@ charIndex::Lookup(const char *match_data)
 //     is returned
 //
 HostBranch *
-charIndex::iter_first(charIndexIterState * s)
+charIndex::iter_first(charIndexIterState *s)
 {
   s->cur_level = 0;
   s->cur_index = -1;
@@ -498,7 +474,7 @@ charIndex::iter_first(charIndexIterState * s)
 //      is returned
 //
 HostBranch *
-charIndex::iter_next(charIndexIterState * s)
+charIndex::iter_next(charIndexIterState *s)
 {
   int index;
   charIndex_el *current_el = s->cur_el;
@@ -519,7 +495,6 @@ charIndex::iter_next(charIndexIterState * s)
   }
 
   while (1) {
-
     // Check to see if we need to go back up a level
     if (index >= numLegalChars) {
       if (level <= 0) {
@@ -582,17 +557,18 @@ class hostArray
 public:
   hostArray();
   ~hostArray();
-  bool Insert(const char *match_data_in, HostBranch * toInsert);
+  bool Insert(const char *match_data_in, HostBranch *toInsert);
   HostBranch *Lookup(const char *match_data_in, bool bNotProcess);
-  HostBranch *iter_first(hostArrayIterState * s, char **key = NULL);
-  HostBranch *iter_next(hostArrayIterState * s, char **key = NULL);
+  HostBranch *iter_first(hostArrayIterState *s, char **key = NULL);
+  HostBranch *iter_next(hostArrayIterState *s, char **key = NULL);
+
 private:
-  int num_el;                   // number of elements currently in the array
+  int num_el; // number of elements currently in the array
   HostBranch *branch_array[HOST_ARRAY_MAX];
   char *match_data[HOST_ARRAY_MAX];
 };
 
-hostArray::hostArray():num_el(0)
+hostArray::hostArray() : num_el(0)
 {
   memset(branch_array, 0, sizeof(branch_array));
   memset(match_data, 0, sizeof(match_data));
@@ -614,7 +590,7 @@ hostArray::~hostArray()
 //    If space is inadequate, false is returned and nothing is inserted
 //
 bool
-hostArray::Insert(const char *match_data_in, HostBranch * toInsert)
+hostArray::Insert(const char *match_data_in, HostBranch *toInsert)
 {
   if (num_el >= HOST_ARRAY_MAX) {
     return false;
@@ -642,7 +618,6 @@ hostArray::Lookup(const char *match_data_in, bool bNotProcess)
     pMD = match_data[i];
 
     if (bNotProcess && '!' == *pMD) {
-
       char *cp = ++pMD;
       if ('\0' == *cp)
         continue;
@@ -668,7 +643,7 @@ hostArray::Lookup(const char *match_data_in, bool bNotProcess)
 //     NULL if no elements exist
 //
 HostBranch *
-hostArray::iter_first(hostArrayIterState * s, char **key)
+hostArray::iter_first(hostArrayIterState *s, char **key)
 {
   *s = -1;
   return iter_next(s, key);
@@ -680,7 +655,7 @@ hostArray::iter_first(hostArrayIterState * s, char **key)
 //      NULL if none exist
 //
 HostBranch *
-hostArray::iter_next(hostArrayIterState * s, char **key)
+hostArray::iter_next(hostArrayIterState *s, char **key)
 {
   (*s)++;
 
@@ -695,17 +670,11 @@ hostArray::iter_next(hostArrayIterState * s, char **key)
 }
 
 // maps enum LeafType to strings
-const char *LeafTypeStr[] = {
-  "Leaf Invalid",
-  "Host (Partial)",
-  "Host (Full)",
-  "Domain (Full)",
-  "Domain (Partial)"
-};
+const char *LeafTypeStr[] = {"Leaf Invalid", "Host (Partial)", "Host (Full)", "Domain (Full)", "Domain (Partial)"};
 
 static int negative_one = -1;
 
-HostBranch::HostBranch():level(0), type(HOST_TERMINAL), next_level(NULL), leaf_indexs(&negative_one, 1)
+HostBranch::HostBranch() : level(0), type(HOST_TERMINAL), next_level(NULL), leaf_indexs(&negative_one, 1)
 {
 }
 
@@ -715,7 +684,6 @@ HostBranch::HostBranch():level(0), type(HOST_TERMINAL), next_level(NULL), leaf_i
 //
 HostBranch::~HostBranch()
 {
-
   // Hash Iteration
   InkHashTable *ht;
   InkHashTableIteratorState ht_iter;
@@ -737,11 +705,11 @@ HostBranch::~HostBranch()
     break;
   case HOST_HASH:
     ink_assert(next_level != NULL);
-    ht = (InkHashTable *) next_level;
+    ht = (InkHashTable *)next_level;
     ht_entry = ink_hash_table_iterator_first(ht, &ht_iter);
 
     while (ht_entry != NULL) {
-      lower_branch = (HostBranch *) ink_hash_table_entry_value(ht, ht_entry);
+      lower_branch = (HostBranch *)ink_hash_table_entry_value(ht, ht_entry);
       delete lower_branch;
       ht_entry = ink_hash_table_iterator_next(ht, &ht_iter);
     }
@@ -749,7 +717,7 @@ HostBranch::~HostBranch()
     break;
   case HOST_INDEX:
     ink_assert(next_level != NULL);
-    ci = (charIndex *) next_level;
+    ci = (charIndex *)next_level;
     lower_branch = ci->iter_first(&ci_iter);
     while (lower_branch != NULL) {
       delete lower_branch;
@@ -759,7 +727,7 @@ HostBranch::~HostBranch()
     break;
   case HOST_ARRAY:
     ink_assert(next_level != NULL);
-    ha = (hostArray *) next_level;
+    ha = (hostArray *)next_level;
     lower_branch = ha->iter_first(&ha_iter);
     while (lower_branch != NULL) {
       delete lower_branch;
@@ -770,13 +738,8 @@ HostBranch::~HostBranch()
   }
 }
 
-HostLookup::HostLookup(const char *name):
-leaf_array(NULL),
-array_len(-1),
-num_el(-1),
-matcher_name(name)
+HostLookup::HostLookup(const char *name) : leaf_array(NULL), array_len(-1), num_el(-1), matcher_name(name)
 {
-
   root = new HostBranch;
   root->level = 0;
   root->type = HOST_TERMINAL;
@@ -785,20 +748,19 @@ matcher_name(name)
 
 HostLookup::~HostLookup()
 {
-
   if (leaf_array != NULL) {
     // Free up the match strings
     for (int i = 0; i < num_el; i++) {
       ats_free(leaf_array[i].match);
     }
-    delete[]leaf_array;
+    delete[] leaf_array;
   }
 
   delete root;
 }
 
 static void
-empty_print_fn(void */* opaque_data ATS_UNUSED */)
+empty_print_fn(void * /* opaque_data ATS_UNUSED */)
 {
 }
 
@@ -821,9 +783,8 @@ HostLookup::Print(HostLookupPrintFunc f)
 //     and print out each element
 //
 void
-HostLookup::PrintHostBranch(HostBranch * hb, HostLookupPrintFunc f)
+HostLookup::PrintHostBranch(HostBranch *hb, HostLookupPrintFunc f)
 {
-
   // Hash iteration
   InkHashTable *ht;
   InkHashTableIteratorState ht_iter;
@@ -839,7 +800,7 @@ HostLookup::PrintHostBranch(HostBranch * hb, HostLookupPrintFunc f)
 
   HostBranch *lower_branch;
   intptr_t curIndex;
-  intptr_t i;                        // Loop var
+  intptr_t i; // Loop var
 
   for (i = 0; i < hb->leaf_indexs.length(); i++) {
     curIndex = hb->leaf_indexs[i];
@@ -853,18 +814,18 @@ HostLookup::PrintHostBranch(HostBranch * hb, HostLookupPrintFunc f)
     break;
   case HOST_HASH:
     ink_assert(hb->next_level != NULL);
-    ht = (InkHashTable *) hb->next_level;
+    ht = (InkHashTable *)hb->next_level;
     ht_entry = ink_hash_table_iterator_first(ht, &ht_iter);
 
     while (ht_entry != NULL) {
-      lower_branch = (HostBranch *) ink_hash_table_entry_value(ht, ht_entry);
+      lower_branch = (HostBranch *)ink_hash_table_entry_value(ht, ht_entry);
       PrintHostBranch(lower_branch, f);
       ht_entry = ink_hash_table_iterator_next(ht, &ht_iter);
     }
     break;
   case HOST_INDEX:
     ink_assert(hb->next_level != NULL);
-    ci = (charIndex *) hb->next_level;
+    ci = (charIndex *)hb->next_level;
     lower_branch = ci->iter_first(&ci_iter);
     while (lower_branch != NULL) {
       PrintHostBranch(lower_branch, f);
@@ -873,7 +834,7 @@ HostLookup::PrintHostBranch(HostBranch * hb, HostLookupPrintFunc f)
     break;
   case HOST_ARRAY:
     ink_assert(hb->next_level != NULL);
-    h_array = (hostArray *) hb->next_level;
+    h_array = (hostArray *)hb->next_level;
     lower_branch = h_array->iter_first(&ha_iter);
     while (lower_branch != NULL) {
       PrintHostBranch(lower_branch, f);
@@ -892,7 +853,7 @@ HostLookup::PrintHostBranch(HostBranch * hb, HostLookupPrintFunc f)
 //         HostBranch
 //
 HostBranch *
-HostLookup::TableNewLevel(HostBranch * from, const char *level_data)
+HostLookup::TableNewLevel(HostBranch *from, const char *level_data)
 {
   hostArray *new_ha_table;
   charIndex *new_ci_table;
@@ -924,9 +885,8 @@ HostLookup::TableNewLevel(HostBranch * from, const char *level_data)
 //      by class HostMatcher
 //
 HostBranch *
-HostLookup::InsertBranch(HostBranch * insert_in, const char *level_data)
+HostLookup::InsertBranch(HostBranch *insert_in, const char *level_data)
 {
-
   // Variables for moving an array into a hash table after it
   //   gets too big
   //
@@ -948,18 +908,17 @@ HostLookup::InsertBranch(HostBranch * insert_in, const char *level_data)
     ink_release_assert(0);
     break;
   case HOST_HASH:
-    ink_hash_table_insert((InkHashTable *) insert_in->next_level, (char *) level_data, new_branch);
+    ink_hash_table_insert((InkHashTable *)insert_in->next_level, (char *)level_data, new_branch);
     break;
   case HOST_INDEX:
-    ((charIndex *) insert_in->next_level)->Insert(level_data, new_branch);
+    ((charIndex *)insert_in->next_level)->Insert(level_data, new_branch);
     break;
   case HOST_ARRAY:
-    if (((hostArray *) insert_in->next_level)->Insert(level_data, new_branch) == false) {
-
+    if (((hostArray *)insert_in->next_level)->Insert(level_data, new_branch) == false) {
       // The array is out of space, time to move to a hash table
-      ha = (hostArray *) insert_in->next_level;
+      ha = (hostArray *)insert_in->next_level;
       new_ht = ink_hash_table_create(InkHashTableKeyType_String);
-      ink_hash_table_insert(new_ht, (char *) level_data, new_branch);
+      ink_hash_table_insert(new_ht, (char *)level_data, new_branch);
 
       // Iterate through the existing elements in the array and
       //  stuff them into the hash table
@@ -977,7 +936,6 @@ HostLookup::InsertBranch(HostBranch * insert_in, const char *level_data)
       insert_in->type = HOST_HASH;
     }
     break;
-
   }
 
   return new_branch;
@@ -992,9 +950,8 @@ HostLookup::InsertBranch(HostBranch * insert_in, const char *level_data)
 //    otherwise returns NULL
 //
 HostBranch *
-HostLookup::FindNextLevel(HostBranch * from, const char *level_data, bool bNotProcess)
+HostLookup::FindNextLevel(HostBranch *from, const char *level_data, bool bNotProcess)
 {
-
   HostBranch *r = NULL;
   InkHashTable *hash;
   charIndex *ci_table;
@@ -1007,21 +964,21 @@ HostLookup::FindNextLevel(HostBranch * from, const char *level_data, bool bNotPr
     ink_assert(0);
     return NULL;
   case HOST_HASH:
-    hash = (InkHashTable *) from->next_level;
+    hash = (InkHashTable *)from->next_level;
     ink_assert(hash != NULL);
-    if (ink_hash_table_lookup(hash, (char *) level_data, &lookup)) {
-      r = (HostBranch *) lookup;
+    if (ink_hash_table_lookup(hash, (char *)level_data, &lookup)) {
+      r = (HostBranch *)lookup;
     } else {
       r = NULL;
     }
     break;
   case HOST_INDEX:
-    ci_table = (charIndex *) from->next_level;
+    ci_table = (charIndex *)from->next_level;
     ink_assert(ci_table != NULL);
     r = ci_table->Lookup(level_data);
     break;
   case HOST_ARRAY:
-    ha_table = (hostArray *) from->next_level;
+    ha_table = (hostArray *)from->next_level;
     ink_assert(ha_table != NULL);
     r = ha_table->Lookup(level_data, bNotProcess);
     break;
@@ -1054,7 +1011,6 @@ HostLookup::TableInsert(const char *match_data, int index, bool domain_record)
   //  OR   We reach the level where the match stops
   //
   for (i = 0; i < HOST_TABLE_DEPTH; i++) {
-
     // Check to see we need to stop at the current level
     if (numTok == cur->level) {
       break;
@@ -1122,7 +1078,7 @@ HostLookup::TableInsert(const char *match_data, int index, bool domain_record)
 //
 
 bool
-HostLookup::MatchArray(HostLookupState * s, void **opaque_ptr, DynArray<int>&array, bool host_done)
+HostLookup::MatchArray(HostLookupState *s, void **opaque_ptr, DynArray<int> &array, bool host_done)
 {
   intptr_t index;
   intptr_t i;
@@ -1153,7 +1109,7 @@ HostLookup::MatchArray(HostLookupState * s, void **opaque_ptr, DynArray<int>&arr
       if (domaincmp(s->hostname, leaf_array[index].match) == false) {
         break;
       }
-      // FALL THROUGH
+    // FALL THROUGH
     case DOMAIN_COMPLETE:
       *opaque_ptr = leaf_array[index].opaque_data;
       s->array_index = i;
@@ -1174,7 +1130,7 @@ HostLookup::MatchArray(HostLookupState * s, void **opaque_ptr, DynArray<int>&arr
 //
 //
 bool
-HostLookup::MatchFirst(const char *host, HostLookupState * s, void **opaque_ptr)
+HostLookup::MatchFirst(const char *host, HostLookupState *s, void **opaque_ptr)
 {
   char *last_dot = NULL;
 
@@ -1210,7 +1166,7 @@ HostLookup::MatchFirst(const char *host, HostLookupState * s, void **opaque_ptr)
 //    arg hostname
 //
 bool
-HostLookup::MatchNext(HostLookupState * s, void **opaque_ptr)
+HostLookup::MatchNext(HostLookupState *s, void **opaque_ptr)
 {
   HostBranch *cur = s->cur;
 
@@ -1220,7 +1176,6 @@ HostLookup::MatchNext(HostLookupState * s, void **opaque_ptr)
   }
 
   while (s->table_level <= HOST_TABLE_DEPTH) {
-
     if (MatchArray(s, opaque_ptr, cur->leaf_indexs, (s->host_copy_next == NULL))) {
       return true;
     }
@@ -1247,7 +1202,6 @@ HostLookup::MatchNext(HostLookupState * s, void **opaque_ptr)
         // Nothing left
         s->host_copy_next = NULL;
       } else {
-
         // Back up to period ahead of us and axe it
         s->host_copy_next--;
         ink_assert(*s->host_copy_next == '.');
@@ -1256,7 +1210,6 @@ HostLookup::MatchNext(HostLookupState * s, void **opaque_ptr)
         s->host_copy_next--;
 
         while (1) {
-
           if (s->host_copy_next <= s->host_copy) {
             s->host_copy_next = s->host_copy;
             break;
@@ -1302,7 +1255,6 @@ HostLookup::AllocateSpace(int num_entries)
 void
 HostLookup::NewEntry(const char *match_data, bool domain_record, void *opaque_data_in)
 {
-
   // Make sure space has been allocated
   ink_assert(num_el >= 0);
   ink_assert(array_len >= 0);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/HostLookup.h
----------------------------------------------------------------------
diff --git a/lib/ts/HostLookup.h b/lib/ts/HostLookup.h
index d5f091f..5e8bd7b 100644
--- a/lib/ts/HostLookup.h
+++ b/lib/ts/HostLookup.h
@@ -37,11 +37,18 @@ const int HOST_ARRAY_MAX = 8;   // Sets the fixed array size
 //
 //  Begin Host Lookup Helper types
 //
-enum HostNodeType
-{ HOST_TERMINAL, HOST_HASH, HOST_INDEX, HOST_ARRAY };
-enum LeafType
-{ LEAF_INVALID, HOST_PARTIAL, HOST_COMPLETE,
-  DOMAIN_COMPLETE, DOMAIN_PARTIAL
+enum HostNodeType {
+  HOST_TERMINAL,
+  HOST_HASH,
+  HOST_INDEX,
+  HOST_ARRAY,
+};
+enum LeafType {
+  LEAF_INVALID,
+  HOST_PARTIAL,
+  HOST_COMPLETE,
+  DOMAIN_COMPLETE,
+  DOMAIN_PARTIAL,
 };
 
 // The data in the HostMatcher tree is pointers to HostBranches.
@@ -53,77 +60,72 @@ enum LeafType
 // There is HostLeaf struct for each data item put into the
 //   table
 //
-struct HostLeaf
-{
+struct HostLeaf {
   LeafType type;
-  char *match;                  // Contains a copy of the match data
-  int len;                      // length of the data
-  bool isNot;                   // used by any fasssst path ...
-  void *opaque_data;            // Data associated with this leaf
+  char *match;       // Contains a copy of the match data
+  int len;           // length of the data
+  bool isNot;        // used by any fasssst path ...
+  void *opaque_data; // Data associated with this leaf
 };
 
-struct HostBranch
-{
+struct HostBranch {
   HostBranch();
   ~HostBranch();
-  int level;                    // what level in the tree.  the root is level 0
-  HostNodeType type;            // tells what kind of data structure is next_level is
-  void *next_level;             // opaque pointer to lookup structure
-    DynArray<int>leaf_indexs;        // pointers HostLeaf(s)
+  int level;                 // what level in the tree.  the root is level 0
+  HostNodeType type;         // tells what kind of data structure is next_level is
+  void *next_level;          // opaque pointer to lookup structure
+  DynArray<int> leaf_indexs; // pointers HostLeaf(s)
 };
 
-typedef void (*HostLookupPrintFunc) (void *opaque_data);
+typedef void (*HostLookupPrintFunc)(void *opaque_data);
 //
 //  End Host Lookup Helper types
 //
 
-struct HostLookupState
-{
-  HostLookupState()
-    : cur(NULL), table_level(0), array_index(0), hostname(NULL), host_copy(NULL), host_copy_next(NULL)
-  { }
+struct HostLookupState {
+  HostLookupState() : cur(NULL), table_level(0), array_index(0), hostname(NULL), host_copy(NULL), host_copy_next(NULL) {}
 
-  ~HostLookupState() {
-    ats_free(host_copy);
-  }
+  ~HostLookupState() { ats_free(host_copy); }
 
   HostBranch *cur;
   int table_level;
   int array_index;
   const char *hostname;
-  char *host_copy;              // request lower-cased host name copy
-  char *host_copy_next;         // ptr to part of host_copy for next use
+  char *host_copy;      // request lower-cased host name copy
+  char *host_copy_next; // ptr to part of host_copy for next use
 };
 
 class HostLookup
 {
 public:
   HostLookup(const char *name);
-   ~HostLookup();
+  ~HostLookup();
   void NewEntry(const char *match_data, bool domain_record, void *opaque_data_in);
   void AllocateSpace(int num_entries);
   bool Match(const char *host);
   bool Match(const char *host, void **opaque_ptr);
-  bool MatchFirst(const char *host, HostLookupState * s, void **opaque_ptr);
-  bool MatchNext(HostLookupState * s, void **opaque_ptr);
+  bool MatchFirst(const char *host, HostLookupState *s, void **opaque_ptr);
+  bool MatchNext(HostLookupState *s, void **opaque_ptr);
   void Print(HostLookupPrintFunc f);
   void Print();
-  HostLeaf *getLArray()
+  HostLeaf *
+  getLArray()
   {
     return leaf_array;
   };
+
 private:
   void TableInsert(const char *match_data, int index, bool domain_record);
-  HostBranch *TableNewLevel(HostBranch * from, const char *level_data);
-  HostBranch *InsertBranch(HostBranch * insert_in, const char *level_data);
-  HostBranch *FindNextLevel(HostBranch * from, const char *level_data, bool bNotProcess = false);
-  bool MatchArray(HostLookupState * s, void **opaque_ptr, DynArray<int>&array, bool host_done);
-  void PrintHostBranch(HostBranch * hb, HostLookupPrintFunc f);
-  HostBranch *root;             // The top of the search tree
-  HostLeaf *leaf_array;         // array of all leaves in tree
-  int array_len;                // the length of the arrays
-  int num_el;                   // the numbe of itmems in the tree
-  const char *matcher_name;     // Used for Debug/Warning/Error messages
+  HostBranch *TableNewLevel(HostBranch *from, const char *level_data);
+  HostBranch *InsertBranch(HostBranch *insert_in, const char *level_data);
+  HostBranch *FindNextLevel(HostBranch *from, const char *level_data, bool bNotProcess = false);
+  bool MatchArray(HostLookupState *s, void **opaque_ptr, DynArray<int> &array, bool host_done);
+  void PrintHostBranch(HostBranch *hb, HostLookupPrintFunc f);
+  HostBranch *root;         // The top of the search tree
+  HostLeaf *leaf_array;     // array of all leaves in tree
+  int array_len;            // the length of the arrays
+  int num_el;               // the numbe of itmems in the tree
+  const char *matcher_name; // Used for Debug/Warning/Error messages
 };
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/INK_MD5.h
----------------------------------------------------------------------
diff --git a/lib/ts/INK_MD5.h b/lib/ts/INK_MD5.h
index d5d4e91..218ad99 100644
--- a/lib/ts/INK_MD5.h
+++ b/lib/ts/INK_MD5.h
@@ -22,21 +22,23 @@
  */
 
 #ifndef _INK_MD5_h_
-#define	_INK_MD5_h_
+#define _INK_MD5_h_
 
 #include "ink_code.h"
 #include "ink_defs.h"
 #include "CryptoHash.h"
 
-class MD5Context : public CryptoContext {
+class MD5Context : public CryptoContext
+{
 protected:
   MD5_CTX _ctx;
+
 public:
   MD5Context();
   /// Update the hash with @a data of @a length bytes.
-  virtual bool update(void const* data, int length);
+  virtual bool update(void const *data, int length);
   /// Finalize and extract the @a hash.
-  virtual bool finalize(CryptoHash& hash);
+  virtual bool finalize(CryptoHash &hash);
 };
 
 typedef CryptoHash INK_MD5;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/I_Layout.h
----------------------------------------------------------------------
diff --git a/lib/ts/I_Layout.h b/lib/ts/I_Layout.h
index 432ed91..2be9b19 100644
--- a/lib/ts/I_Layout.h
+++ b/lib/ts/I_Layout.h
@@ -35,8 +35,7 @@
   The Layout is a simple place holder for the distribution layout.
 
  */
-struct Layout
-{
+struct Layout {
   char *prefix;
   char *exec_prefix;
   char *bindir;
@@ -55,7 +54,7 @@ struct Layout
   char *cachedir;
 
   Layout(const char *prefix = 0);
-   ~Layout();
+  ~Layout();
 
   /**
    Return file path relative to Layout->prefix

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/I_Version.h
----------------------------------------------------------------------
diff --git a/lib/ts/I_Version.h b/lib/ts/I_Version.h
index 668c2e7..c51e1bd 100644
--- a/lib/ts/I_Version.h
+++ b/lib/ts/I_Version.h
@@ -31,42 +31,41 @@
 #ifndef _Version_h
 #define _Version_h
 
-struct VersionNumber
-{
-  short int ink_major;          // incompatible change
-  short int ink_minor;          // minor change, not incompatible
+struct VersionNumber {
+  short int ink_major; // incompatible change
+  short int ink_minor; // minor change, not incompatible
 
   VersionNumber() {}
   VersionNumber(short int major, short int minor) : ink_major(major), ink_minor(minor) {}
 };
 
-inline bool operator < (VersionNumber const& lhs, VersionNumber const& rhs) {
-  return lhs.ink_major < rhs.ink_major ||
-    (lhs.ink_major == rhs.ink_major && lhs.ink_minor < rhs.ink_minor)
-    ;
+inline bool operator<(VersionNumber const &lhs, VersionNumber const &rhs)
+{
+  return lhs.ink_major < rhs.ink_major || (lhs.ink_major == rhs.ink_major && lhs.ink_minor < rhs.ink_minor);
 }
 
-struct Version
-{
+struct Version {
   VersionNumber cacheDB;
   VersionNumber cacheDir;
   VersionNumber clustering;
   VersionNumber clustering_min;
 };
 
-enum ModuleVersion
-{ MODULE_VERSION_MIN = 0, MODULE_VERSION_MAX = 2147483647 };
-enum ModuleHeaderType
-{ PUBLIC_MODULE_HEADER, PRIVATE_MODULE_HEADER };
+enum ModuleVersion {
+  MODULE_VERSION_MIN = 0,
+  MODULE_VERSION_MAX = 2147483647,
+};
+enum ModuleHeaderType {
+  PUBLIC_MODULE_HEADER,
+  PRIVATE_MODULE_HEADER,
+};
 
 #define makeModuleVersion(_major_version, _minor_version, _module_type) \
-((ModuleVersion)((((int)_module_type) << 24)   + \
-                 (((int)_major_version) << 16) + \
-                 (((int)_minor_version) << 8)))
+  ((ModuleVersion)((((int)_module_type) << 24) + (((int)_major_version) << 16) + (((int)_minor_version) << 8)))
 
 #define majorModuleVersion(_v) ((((int)_v) >> 16) & 255)
 #define minorModuleVersion(_v) ((((int)_v) >> 8) & 255)
-#define moduleVersionType(_v)  ((((int)_v) >> 24) & 127)
+#define moduleVersionType(_v) ((((int)_v) >> 24) & 127)
 
 static inline int
 checkModuleVersion(ModuleVersion userVersion, ModuleVersion libVersion)
@@ -101,9 +100,8 @@ public:
   char FullVersionInfoStr[256];
 
   AppVersionInfo();
-  void setup(const char *pkg_name, const char *app_name, const char *app_version,
-             const char *build_date, const char *build_time, const char *build_machine,
-             const char *build_person, const char *build_cflags);
+  void setup(const char *pkg_name, const char *app_name, const char *app_version, const char *build_date, const char *build_time,
+             const char *build_machine, const char *build_person, const char *build_cflags);
 };
 
 #endif /*_Version_h*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/InkErrno.h
----------------------------------------------------------------------
diff --git a/lib/ts/InkErrno.h b/lib/ts/InkErrno.h
index 7f8676e..f3f796a 100644
--- a/lib/ts/InkErrno.h
+++ b/lib/ts/InkErrno.h
@@ -27,46 +27,46 @@
 
 */
 
-#if !defined (_Errno_h_)
+#if !defined(_Errno_h_)
 #define _Errno_h_
 #include <errno.h>
 
 #define INK_START_ERRNO 20000
 
-#define SOCK_ERRNO                        INK_START_ERRNO
-#define NET_ERRNO                         INK_START_ERRNO+100
-#define CLUSTER_ERRNO                     INK_START_ERRNO+200
-#define CACHE_ERRNO                       INK_START_ERRNO+400
-#define HTTP_ERRNO                        INK_START_ERRNO+600
+#define SOCK_ERRNO INK_START_ERRNO
+#define NET_ERRNO INK_START_ERRNO + 100
+#define CLUSTER_ERRNO INK_START_ERRNO + 200
+#define CACHE_ERRNO INK_START_ERRNO + 400
+#define HTTP_ERRNO INK_START_ERRNO + 600
 
-#define ENET_THROTTLING                   (NET_ERRNO+1)
-#define ENET_CONNECT_TIMEOUT              (NET_ERRNO+2)
-#define ENET_CONNECT_FAILED               (NET_ERRNO+3)
+#define ENET_THROTTLING (NET_ERRNO + 1)
+#define ENET_CONNECT_TIMEOUT (NET_ERRNO + 2)
+#define ENET_CONNECT_FAILED (NET_ERRNO + 3)
 
-#define ESOCK_DENIED                      (SOCK_ERRNO+0)
-#define ESOCK_TIMEOUT                     (SOCK_ERRNO+1)
-#define ESOCK_NO_SOCK_SERVER_CONN         (SOCK_ERRNO+2)
+#define ESOCK_DENIED (SOCK_ERRNO + 0)
+#define ESOCK_TIMEOUT (SOCK_ERRNO + 1)
+#define ESOCK_NO_SOCK_SERVER_CONN (SOCK_ERRNO + 2)
 
 // Error codes for CLUSTER_EVENT_OPEN_FAILED
-#define ECLUSTER_NO_VC                    (CLUSTER_ERRNO+0)
-#define ECLUSTER_NO_MACHINE               (CLUSTER_ERRNO+1)
-#define ECLUSTER_OP_TIMEOUT               (CLUSTER_ERRNO+2)
-#define ECLUSTER_ORB_DATA_READ            (CLUSTER_ERRNO+3)
-#define ECLUSTER_ORB_EIO            	  (CLUSTER_ERRNO+4)
-#define ECLUSTER_CHANNEL_INUSE       	  (CLUSTER_ERRNO+5)
-#define ECLUSTER_NOMORE_CHANNELS       	  (CLUSTER_ERRNO+6)
-
-#define ECACHE_NO_DOC                     (CACHE_ERRNO+0)
-#define ECACHE_DOC_BUSY                   (CACHE_ERRNO+1)
-#define ECACHE_DIR_BAD                    (CACHE_ERRNO+2)
-#define ECACHE_BAD_META_DATA              (CACHE_ERRNO+3)
-#define ECACHE_READ_FAIL                  (CACHE_ERRNO+4)
-#define ECACHE_WRITE_FAIL                 (CACHE_ERRNO+5)
-#define ECACHE_MAX_ALT_EXCEEDED           (CACHE_ERRNO+6)
-#define ECACHE_NOT_READY                  (CACHE_ERRNO+7)
-#define ECACHE_ALT_MISS                   (CACHE_ERRNO+8)
-#define ECACHE_BAD_READ_REQUEST           (CACHE_ERRNO+9)
-
-#define EHTTP_ERROR                       (HTTP_ERRNO+0)
+#define ECLUSTER_NO_VC (CLUSTER_ERRNO + 0)
+#define ECLUSTER_NO_MACHINE (CLUSTER_ERRNO + 1)
+#define ECLUSTER_OP_TIMEOUT (CLUSTER_ERRNO + 2)
+#define ECLUSTER_ORB_DATA_READ (CLUSTER_ERRNO + 3)
+#define ECLUSTER_ORB_EIO (CLUSTER_ERRNO + 4)
+#define ECLUSTER_CHANNEL_INUSE (CLUSTER_ERRNO + 5)
+#define ECLUSTER_NOMORE_CHANNELS (CLUSTER_ERRNO + 6)
+
+#define ECACHE_NO_DOC (CACHE_ERRNO + 0)
+#define ECACHE_DOC_BUSY (CACHE_ERRNO + 1)
+#define ECACHE_DIR_BAD (CACHE_ERRNO + 2)
+#define ECACHE_BAD_META_DATA (CACHE_ERRNO + 3)
+#define ECACHE_READ_FAIL (CACHE_ERRNO + 4)
+#define ECACHE_WRITE_FAIL (CACHE_ERRNO + 5)
+#define ECACHE_MAX_ALT_EXCEEDED (CACHE_ERRNO + 6)
+#define ECACHE_NOT_READY (CACHE_ERRNO + 7)
+#define ECACHE_ALT_MISS (CACHE_ERRNO + 8)
+#define ECACHE_BAD_READ_REQUEST (CACHE_ERRNO + 9)
+
+#define EHTTP_ERROR (HTTP_ERRNO + 0)
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/InkPool.h
----------------------------------------------------------------------
diff --git a/lib/ts/InkPool.h b/lib/ts/InkPool.h
index a26ad51..51a9d5e 100644
--- a/lib/ts/InkPool.h
+++ b/lib/ts/InkPool.h
@@ -28,22 +28,21 @@
 // Template of a static size pool of objects.
 //
 //
-template<class C> class InkStaticPool {
+template <class C> class InkStaticPool
+{
 public:
+  InkStaticPool(int size) : sz1(size + 1), head(0), tail(0) { pool = new C *[sz1]; }
 
-  InkStaticPool(int size):sz1(size + 1), head(0), tail(0)
+  virtual ~InkStaticPool()
   {
-    pool = new C *[sz1];
-  }
-
-  virtual ~ InkStaticPool() {
     cleanUp();
-    delete[]pool;
+    delete[] pool;
   }
 
   C *get();
-  bool put(C * newObj);
-  void put_or_delete(C * newObj)
+  bool put(C *newObj);
+  void
+  put_or_delete(C *newObj)
   {
     if (!put(newObj))
       delete newObj;
@@ -59,7 +58,9 @@ private:
   C **pool;
 };
 
-template<class C> inline C * InkStaticPool<C>::get()
+template <class C>
+inline C *
+InkStaticPool<C>::get()
 {
   if (head != tail) {
     C *res = pool[head++];
@@ -69,10 +70,12 @@ template<class C> inline C * InkStaticPool<C>::get()
   return (NULL);
 }
 
-template<class C> inline bool InkStaticPool<C>::put(C * newObj)
+template <class C>
+inline bool
+InkStaticPool<C>::put(C *newObj)
 {
   if (newObj == NULL)
-    return (false);             // cannot put NULL pointer
+    return (false); // cannot put NULL pointer
 
   int newTail = (tail + 1) % sz1;
   bool res = (newTail != head);
@@ -83,7 +86,9 @@ template<class C> inline bool InkStaticPool<C>::put(C * newObj)
   return (res);
 }
 
-template<class C> inline void InkStaticPool<C>::cleanUp(void)
+template <class C>
+inline void
+InkStaticPool<C>::cleanUp(void)
 {
   while (true) {
     C *tp = get();


[48/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/cache-scan/cache-scan.cc
----------------------------------------------------------------------
diff --git a/example/cache-scan/cache-scan.cc b/example/cache-scan/cache-scan.cc
index 4a5e500..ee1f04d 100644
--- a/example/cache-scan/cache-scan.cc
+++ b/example/cache-scan/cache-scan.cc
@@ -36,8 +36,7 @@
 
 static TSCont global_contp;
 
-struct cache_scan_state_t
-{
+struct cache_scan_state_t {
   TSVConn net_vc;
   TSVConn cache_vc;
   TSVIO read_vio;
@@ -66,12 +65,12 @@ static int
 handle_scan(TSCont contp, TSEvent event, void *edata)
 {
   TSCacheHttpInfo cache_infop;
-  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
+  cache_scan_state *cstate = (cache_scan_state *)TSContDataGet(contp);
 
   if (event == TS_EVENT_CACHE_REMOVE) {
     cstate->done = 1;
     const char error[] = "Cache remove operation succeeded";
-    cstate->cache_vc = (TSVConn) edata;
+    cstate->cache_vc = (TSVConn)edata;
     cstate->write_vio = TSVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT64_MAX);
     cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
     TSVIONBytesSet(cstate->write_vio, cstate->total_bytes);
@@ -84,7 +83,7 @@ handle_scan(TSCont contp, TSEvent event, void *edata)
     const char error[] = "Cache remove operation failed error=";
     char rc[12];
     snprintf(rc, 12, "%p", edata);
-    cstate->cache_vc = (TSVConn) edata;
+    cstate->cache_vc = (TSVConn)edata;
     cstate->write_vio = TSVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT64_MAX);
     cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
     cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, rc, strlen(rc));
@@ -94,15 +93,15 @@ handle_scan(TSCont contp, TSEvent event, void *edata)
     return 0;
   }
 
-  //first scan event, save vc and start write
+  // first scan event, save vc and start write
   if (event == TS_EVENT_CACHE_SCAN) {
-    cstate->cache_vc = (TSVConn) edata;
+    cstate->cache_vc = (TSVConn)edata;
     cstate->write_vio = TSVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT64_MAX);
     return TS_EVENT_CONTINUE;
   }
-  //just stop scanning if blocked or failed
-  if (event == TS_EVENT_CACHE_SCAN_FAILED ||
-      event == TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED || event == TS_EVENT_CACHE_SCAN_OPERATION_FAILED) {
+  // just stop scanning if blocked or failed
+  if (event == TS_EVENT_CACHE_SCAN_FAILED || event == TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED ||
+      event == TS_EVENT_CACHE_SCAN_OPERATION_FAILED) {
     cstate->done = 1;
     if (cstate->resp_buffer) {
       const char error[] = "Cache scan operation blocked or failed";
@@ -115,12 +114,12 @@ handle_scan(TSCont contp, TSEvent event, void *edata)
     return TS_CACHE_SCAN_RESULT_DONE;
   }
 
-  //grab header and print url to outgoing vio
+  // grab header and print url to outgoing vio
   if (event == TS_EVENT_CACHE_SCAN_OBJECT) {
     if (cstate->done) {
       return TS_CACHE_SCAN_RESULT_DONE;
     }
-    cache_infop = (TSCacheHttpInfo) edata;
+    cache_infop = (TSCacheHttpInfo)edata;
 
     TSMBuffer req_bufp, resp_bufp;
     TSMLoc req_hdr_loc, resp_hdr_loc;
@@ -142,7 +141,7 @@ handle_scan(TSCont contp, TSEvent event, void *edata)
     TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_hdr_loc);
 
 
-    //print the response headers
+    // print the response headers
     TSCacheHttpInfoRespGet(cache_infop, &resp_bufp, &resp_hdr_loc);
     cstate->total_bytes += TSMimeHdrLengthGet(resp_bufp, resp_hdr_loc);
     TSMimeHdrPrint(resp_bufp, resp_hdr_loc, cstate->resp_buffer);
@@ -158,15 +157,14 @@ handle_scan(TSCont contp, TSEvent event, void *edata)
     cstate->total_items++;
     return TS_CACHE_SCAN_RESULT_CONTINUE;
   }
-  //CACHE_SCAN_DONE: ready to close the vc on the next write reenable
+  // CACHE_SCAN_DONE: ready to close the vc on the next write reenable
   if (event == TS_EVENT_CACHE_SCAN_DONE) {
     cstate->done = 1;
     char s[512];
-    int s_len = snprintf(s, sizeof(s),
-                         "</pre></p>\n<p>%d total objects in cache</p>\n"
-                         "<form method=\"GET\" action=\"/show-cache\">"
-                         "Enter URL to delete: <input type=\"text\" size=\"40\" name=\"remove_url\">"
-                         "<input type=\"submit\"  value=\"Delete URL\">",
+    int s_len = snprintf(s, sizeof(s), "</pre></p>\n<p>%d total objects in cache</p>\n"
+                                       "<form method=\"GET\" action=\"/show-cache\">"
+                                       "Enter URL to delete: <input type=\"text\" size=\"40\" name=\"remove_url\">"
+                                       "<input type=\"submit\"  value=\"Delete URL\">",
                          cstate->total_items);
     cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, s, s_len);
     TSVIONBytesSet(cstate->write_vio, cstate->total_bytes);
@@ -185,11 +183,11 @@ handle_scan(TSCont contp, TSEvent event, void *edata)
 static int
 handle_accept(TSCont contp, TSEvent event, TSVConn vc)
 {
-  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
+  cache_scan_state *cstate = (cache_scan_state *)TSContDataGet(contp);
 
   if (event == TS_EVENT_NET_ACCEPT) {
     if (cstate) {
-      //setup vc, buffers
+      // setup vc, buffers
       cstate->net_vc = vc;
 
       cstate->req_buffer = TSIOBufferCreate();
@@ -202,7 +200,7 @@ handle_accept(TSCont contp, TSEvent event, TSVConn vc)
       TSContDestroy(contp);
     }
   } else {
-    //net_accept failed
+    // net_accept failed
     if (cstate) {
       TSfree(cstate);
     }
@@ -216,9 +214,8 @@ handle_accept(TSCont contp, TSEvent event, TSVConn vc)
 static void
 cleanup(TSCont contp)
 {
-
-  //shutdown vc and free memory
-  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
+  // shutdown vc and free memory
+  cache_scan_state *cstate = (cache_scan_state *)TSContDataGet(contp);
 
   if (cstate) {
     // cancel any pending cache scan actions, since we will be destroying the
@@ -256,44 +253,42 @@ cleanup(TSCont contp)
 static int
 handle_io(TSCont contp, TSEvent event, void * /* edata ATS_UNUSED */)
 {
-  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
+  cache_scan_state *cstate = (cache_scan_state *)TSContDataGet(contp);
 
   switch (event) {
   case TS_EVENT_VCONN_READ_READY:
-  case TS_EVENT_VCONN_READ_COMPLETE:
-    {
-      //we don't care about the request, so just shut down the read vc
-      TSVConnShutdown(cstate->net_vc, 1, 0);
-      //setup the response headers so we are ready to write body
-      char hdrs[] = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n";
-      cstate->total_bytes = TSIOBufferWrite(cstate->resp_buffer, hdrs, sizeof(hdrs) - 1);
-
-      if (cstate->key_to_delete) {
-        TSAction actionp = TSCacheRemove(contp, cstate->key_to_delete);
-        if (!TSActionDone(actionp)) {
-          cstate->pending_action = actionp;
-        }
-      } else {
-        char head[] = "<h3>Cache Contents:</h3>\n<p><pre>\n";
-        cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, head, sizeof(head) - 1);
-        //start scan
-        TSAction actionp = TSCacheScan(contp, 0, 512000);
-        if (!TSActionDone(actionp)) {
-          cstate->pending_action = actionp;
-        }
-      }
+  case TS_EVENT_VCONN_READ_COMPLETE: {
+    // we don't care about the request, so just shut down the read vc
+    TSVConnShutdown(cstate->net_vc, 1, 0);
+    // setup the response headers so we are ready to write body
+    char hdrs[] = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n";
+    cstate->total_bytes = TSIOBufferWrite(cstate->resp_buffer, hdrs, sizeof(hdrs) - 1);
 
-      return 0;
-    }
-  case TS_EVENT_VCONN_WRITE_READY:
-    {
-      TSDebug("cache_iter", "ndone: %" PRId64 " total_bytes: % " PRId64, TSVIONDoneGet(cstate->write_vio), cstate->total_bytes);
-      cstate->write_pending = 0;
-      // the cache scan handler should call vio reenable when there is
-      // available data
-      //TSVIOReenable(cstate->write_vio);
-      return 0;
+    if (cstate->key_to_delete) {
+      TSAction actionp = TSCacheRemove(contp, cstate->key_to_delete);
+      if (!TSActionDone(actionp)) {
+        cstate->pending_action = actionp;
+      }
+    } else {
+      char head[] = "<h3>Cache Contents:</h3>\n<p><pre>\n";
+      cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, head, sizeof(head) - 1);
+      // start scan
+      TSAction actionp = TSCacheScan(contp, 0, 512000);
+      if (!TSActionDone(actionp)) {
+        cstate->pending_action = actionp;
+      }
     }
+
+    return 0;
+  }
+  case TS_EVENT_VCONN_WRITE_READY: {
+    TSDebug("cache_iter", "ndone: %" PRId64 " total_bytes: % " PRId64, TSVIONDoneGet(cstate->write_vio), cstate->total_bytes);
+    cstate->write_pending = 0;
+    // the cache scan handler should call vio reenable when there is
+    // available data
+    // TSVIOReenable(cstate->write_vio);
+    return 0;
+  }
   case TS_EVENT_VCONN_WRITE_COMPLETE:
     TSDebug("cache_iter", "write complete");
   case TS_EVENT_VCONN_EOS:
@@ -316,7 +311,7 @@ cache_intercept(TSCont contp, TSEvent event, void *edata)
   switch (event) {
   case TS_EVENT_NET_ACCEPT:
   case TS_EVENT_NET_ACCEPT_FAILED:
-    return handle_accept(contp, event, (TSVConn) edata);
+    return handle_accept(contp, event, (TSVConn)edata);
   case TS_EVENT_VCONN_READ_READY:
   case TS_EVENT_VCONN_READ_COMPLETE:
   case TS_EVENT_VCONN_WRITE_READY:
@@ -359,7 +354,7 @@ unescapifyStr(char *buffer)
     if (*read == '%' && *(read + 1) != '\0' && *(read + 2) != '\0') {
       subStr[0] = *(++read);
       subStr[1] = *(++read);
-      *write = (char)strtol(subStr, (char **) NULL, 16);
+      *write = (char)strtol(subStr, (char **)NULL, 16);
       read++;
       write++;
     } else if (*read == '+') {
@@ -381,7 +376,6 @@ unescapifyStr(char *buffer)
 static int
 setup_request(TSCont contp, TSHttpTxn txnp)
 {
-
   TSMBuffer bufp;
   TSMLoc hdr_loc;
   TSMLoc url_loc;
@@ -419,14 +413,13 @@ setup_request(TSCont contp, TSHttpTxn txnp)
   if (path_len == 10 && !strncmp(path, "show-cache", 10)) {
     scan_contp = TSContCreate(cache_intercept, TSMutexCreate());
     TSHttpTxnIntercept(scan_contp, txnp);
-    cstate = (cache_scan_state *) TSmalloc(sizeof(cache_scan_state));
+    cstate = (cache_scan_state *)TSmalloc(sizeof(cache_scan_state));
     memset(cstate, 0, sizeof(cache_scan_state));
     cstate->http_txnp = txnp;
 
     if (query && query_len > 11) {
-
       char querybuf[2048];
-      query_len = (unsigned) query_len > sizeof(querybuf) - 1 ? sizeof(querybuf) - 1 : query_len;
+      query_len = (unsigned)query_len > sizeof(querybuf) - 1 ? sizeof(querybuf) - 1 : query_len;
       char *start = querybuf, *end = querybuf + query_len;
       size_t del_url_len;
       memcpy(querybuf, query, query_len);
@@ -446,7 +439,7 @@ setup_request(TSCont contp, TSHttpTxn txnp)
         TSMLoc urlLoc;
 
         TSUrlCreate(urlBuf, &urlLoc);
-        if (TSUrlParse(urlBuf, urlLoc, (const char **) &start, end) != TS_PARSE_DONE ||
+        if (TSUrlParse(urlBuf, urlLoc, (const char **)&start, end) != TS_PARSE_DONE ||
             TSCacheKeyDigestFromUrlSet(cstate->key_to_delete, urlLoc) != TS_SUCCESS) {
           TSError("CacheKeyDigestFromUrlSet failed");
           TSCacheKeyDestroy(cstate->key_to_delete);
@@ -478,17 +471,17 @@ cache_print_plugin(TSCont contp, TSEvent event, void *edata)
 {
   switch (event) {
   case TS_EVENT_HTTP_READ_REQUEST_HDR:
-    return setup_request(contp, (TSHttpTxn) edata);
+    return setup_request(contp, (TSHttpTxn)edata);
   default:
     break;
   }
-  TSHttpTxnReenable((TSHttpTxn) edata, TS_EVENT_HTTP_CONTINUE);
+  TSHttpTxnReenable((TSHttpTxn)edata, TS_EVENT_HTTP_CONTINUE);
   return TS_SUCCESS;
 }
 
 //----------------------------------------------------------------------------
 void
-TSPluginInit(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
 {
   global_contp = TSContCreate(cache_print_plugin, TSMutexCreate());
   TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, global_contp);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/file-1/file-1.c
----------------------------------------------------------------------
diff --git a/example/file-1/file-1.c b/example/file-1/file-1.c
index 23d67d7..f61df8b 100644
--- a/example/file-1/file-1.c
+++ b/example/file-1/file-1.c
@@ -65,4 +65,3 @@ TSPluginInit(int argc, const char *argv[])
     TSfclose(filep);
   }
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/intercept/intercept.cc
----------------------------------------------------------------------
diff --git a/example/intercept/intercept.cc b/example/intercept/intercept.cc
index c56a01d..6248957 100644
--- a/example/intercept/intercept.cc
+++ b/example/intercept/intercept.cc
@@ -54,30 +54,30 @@
 #define VERROR(fmt, ...) TSError("[%s] %s: " fmt, PLUGIN, __FUNCTION__, ##__VA_ARGS__)
 #endif
 
-#define VIODEBUG(vio, fmt, ...) VDEBUG("vio=%p vio.cont=%p, vio.cont.data=%p, vio.vc=%p " fmt, \
-    (vio), TSVIOContGet(vio), TSContDataGet(TSVIOContGet(vio)), TSVIOVConnGet(vio), ##__VA_ARGS__)
+#define VIODEBUG(vio, fmt, ...)                                                                                              \
+  VDEBUG("vio=%p vio.cont=%p, vio.cont.data=%p, vio.vc=%p " fmt, (vio), TSVIOContGet(vio), TSContDataGet(TSVIOContGet(vio)), \
+         TSVIOVConnGet(vio), ##__VA_ARGS__)
 
 static TSCont TxnHook;
 static TSCont InterceptHook;
 
-static int InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata);
-static int InterceptTxnHook(TSCont contp, TSEvent event, void * edata);
+static int InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata);
+static int InterceptTxnHook(TSCont contp, TSEvent event, void *edata);
 
 // We are going to stream data between Traffic Server and an
 // external server. This structure represents the state of a
 // streaming I/O request. Is is directional (ie. either a read or
 // a write). We need two of these for each TSVConn; one to push
 // data into the TSVConn and one to pull data out.
-struct InterceptIOChannel
-{
-  TSVIO             vio;
-  TSIOBuffer        iobuf;
-  TSIOBufferReader  reader;
+struct InterceptIOChannel {
+  TSVIO vio;
+  TSIOBuffer iobuf;
+  TSIOBufferReader reader;
 
-  InterceptIOChannel() : vio(NULL), iobuf(NULL), reader(NULL) {
-  }
+  InterceptIOChannel() : vio(NULL), iobuf(NULL), reader(NULL) {}
 
-  ~InterceptIOChannel() {
+  ~InterceptIOChannel()
+  {
     if (this->reader) {
       TSIOBufferReaderFree(this->reader);
     }
@@ -87,7 +87,9 @@ struct InterceptIOChannel
     }
   }
 
-  void read(TSVConn vc, TSCont contp) {
+  void
+  read(TSVConn vc, TSCont contp)
+  {
     TSReleaseAssert(this->vio == NULL);
     TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
     TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
@@ -95,25 +97,27 @@ struct InterceptIOChannel
     this->vio = TSVConnRead(vc, contp, this->iobuf, INT64_MAX);
   }
 
-  void write(TSVConn vc, TSCont contp) {
+  void
+  write(TSVConn vc, TSCont contp)
+  {
     TSReleaseAssert(this->vio == NULL);
     TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
     TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
 
     this->vio = TSVConnWrite(vc, contp, this->reader, INT64_MAX);
   }
-
 };
 
 // A simple encapsulation of the IO state of a TSVConn. We need the TSVConn itself, and the
 // IO metadata for the read side and the write side.
-struct InterceptIO
-{
-  TSVConn             vc;
-  InterceptIOChannel  readio;
-  InterceptIOChannel  writeio;
-
-  void close() {
+struct InterceptIO {
+  TSVConn vc;
+  InterceptIOChannel readio;
+  InterceptIOChannel writeio;
+
+  void
+  close()
+  {
     if (this->vc) {
       TSVConnClose(this->vc);
     }
@@ -126,30 +130,27 @@ struct InterceptIO
 // Server is the client, and the origin server on whose behalf we
 // are intercepting is the server. Hence the "client" and
 // "server" nomenclature here.
-struct InterceptState
-{
-  TSHttpTxn   txn;          // The transaction on whose behalf we are intercepting.
+struct InterceptState {
+  TSHttpTxn txn; // The transaction on whose behalf we are intercepting.
 
-  InterceptIO client;       // Server intercept VC state.
-  InterceptIO server;       // Intercept origin VC state.
+  InterceptIO client; // Server intercept VC state.
+  InterceptIO server; // Intercept origin VC state.
 
-  InterceptState() : txn(NULL) {
-  }
+  InterceptState() : txn(NULL) {}
 
-  ~InterceptState() {
-  }
+  ~InterceptState() {}
 };
 
 // Return the InterceptIO control block that owns the given VC.
 static InterceptIO *
-InterceptGetThisSide(InterceptState * istate, TSVConn vc)
+InterceptGetThisSide(InterceptState *istate, TSVConn vc)
 {
   return (istate->client.vc == vc) ? &istate->client : &istate->server;
 }
 
 // Return the InterceptIO control block that doesn't own the given VC.
 static InterceptIO *
-InterceptGetOtherSide(InterceptState * istate, TSVConn vc)
+InterceptGetOtherSide(InterceptState *istate, TSVConn vc)
 {
   return (istate->client.vc == vc) ? &istate->server : &istate->client;
 }
@@ -157,27 +158,24 @@ InterceptGetOtherSide(InterceptState * istate, TSVConn vc)
 // Evaluates to a human-readable name for a TSVConn in the
 // intercept proxy state.
 static const char *
-InterceptProxySide(const InterceptState * istate, const InterceptIO * io)
+InterceptProxySide(const InterceptState *istate, const InterceptIO *io)
 {
-  return (io == &istate->client) ? "<client>"
-    : (io == &istate->server) ? "<server>"
-    : "<unknown>";
+  return (io == &istate->client) ? "<client>" : (io == &istate->server) ? "<server>" : "<unknown>";
 }
 
 static const char *
-InterceptProxySideVC(const InterceptState * istate, TSVConn vc)
+InterceptProxySideVC(const InterceptState *istate, TSVConn vc)
 {
-  return (istate->client.vc && vc == istate->client.vc) ? "<client>"
-    : (istate->server.vc && vc == istate->server.vc) ? "<server>"
-    : "<unknown>";
+  return (istate->client.vc && vc == istate->client.vc) ? "<client>" : (istate->server.vc && vc == istate->server.vc) ? "<server>" :
+                                                                                                                        "<unknown>";
 }
 
 static bool
-InterceptAttemptDestroy(InterceptState * istate, TSCont contp)
+InterceptAttemptDestroy(InterceptState *istate, TSCont contp)
 {
   if (istate->server.vc == NULL && istate->client.vc == NULL) {
     VDEBUG("destroying server intercept state istate=%p contp=%p", istate, contp);
-    TSContDataSet(contp, NULL);  // Force a crash if we get additional events.
+    TSContDataSet(contp, NULL); // Force a crash if we get additional events.
     TSContDestroy(contp);
     delete istate;
     return true;
@@ -188,24 +186,24 @@ InterceptAttemptDestroy(InterceptState * istate, TSCont contp)
 
 union socket_type {
   struct sockaddr_storage storage;
-  struct sockaddr         sa;
-  struct sockaddr_in      sin;
-  struct sockaddr_in6     sin6;
+  struct sockaddr sa;
+  struct sockaddr_in sin;
+  struct sockaddr_in6 sin6;
 };
 
 union argument_type {
-  void *            ptr;
-  intptr_t          ecode;
-  TSVConn           vc;
-  TSVIO             vio;
-  TSHttpTxn         txn;
-  InterceptState *  istate;
-
-  argument_type(void * _p) : ptr(_p) {}
+  void *ptr;
+  intptr_t ecode;
+  TSVConn vc;
+  TSVIO vio;
+  TSHttpTxn txn;
+  InterceptState *istate;
+
+  argument_type(void *_p) : ptr(_p) {}
 };
 
 static TSCont
-InterceptContCreate(TSEventFunc hook, TSMutex mutexp, void * data)
+InterceptContCreate(TSEventFunc hook, TSMutex mutexp, void *data)
 {
   TSCont contp;
 
@@ -231,17 +229,17 @@ InterceptShouldInterceptRequest(TSHttpTxn txn)
 // should transfer any data we find from one side of the transfer
 // to the other.
 static int64_t
-InterceptTransferData(InterceptIO * from, InterceptIO * to)
+InterceptTransferData(InterceptIO *from, InterceptIO *to)
 {
-  TSIOBufferBlock   block;
-  int64_t           consumed = 0;
+  TSIOBufferBlock block;
+  int64_t consumed = 0;
 
   // Walk the list of buffer blocks in from the read VIO.
   for (block = TSIOBufferReaderStart(from->readio.reader); block; block = TSIOBufferBlockNext(block)) {
     int64_t remain = 0;
-    const char * ptr;
+    const char *ptr;
 
-    VDEBUG("attempting to transfer %" PRId64 " available bytes",  TSIOBufferBlockReadAvail(block, from->readio.reader));
+    VDEBUG("attempting to transfer %" PRId64 " available bytes", TSIOBufferBlockReadAvail(block, from->readio.reader));
 
     // Take the data from each buffer block, and write it into
     // the buffer of the write VIO.
@@ -271,7 +269,7 @@ InterceptTransferData(InterceptIO * from, InterceptIO * to)
 // starts with TS_EVENT_NET_ACCEPT, and then continues with
 // TSVConn events.
 static int
-InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
+InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata)
 {
   argument_type arg(edata);
 
@@ -282,10 +280,10 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
     // Set up the server intercept. We have the original
     // TSHttpTxn from the continuation. We need to connect to the
     // real origin and get ready to shuffle data around.
-    char        buf[INET_ADDRSTRLEN];
+    char buf[INET_ADDRSTRLEN];
     socket_type addr;
-    argument_type     cdata(TSContDataGet(contp));
-    InterceptState *  istate = new InterceptState();
+    argument_type cdata(TSContDataGet(contp));
+    InterceptState *istate = new InterceptState();
     int fd = -1;
 
     // This event is delivered by the continuation that we
@@ -297,8 +295,8 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
     // 127.0.0.1:$PORT.
     memset(&addr, 0, sizeof(addr));
     addr.sin.sin_family = AF_INET;
-    addr.sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);  // XXX config option
-    addr.sin.sin_port = htons(PORT);                    // XXX config option
+    addr.sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); // XXX config option
+    addr.sin.sin_port = htons(PORT);                   // XXX config option
 
     // Normally, we would use TSNetConnect to connect to a secondary service, but to demonstrate
     // the use of TSVConnFdCreate, we do a blocking connect inline. This it not recommended for
@@ -319,8 +317,8 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
       return TS_EVENT_NONE;
     }
 
-    VDEBUG("binding client vc=%p to %s:%u",
-        istate->client.vc, inet_ntop(AF_INET, &addr.sin.sin_addr, buf, sizeof(buf)), (unsigned)ntohs(addr.sin.sin_port));
+    VDEBUG("binding client vc=%p to %s:%u", istate->client.vc, inet_ntop(AF_INET, &addr.sin.sin_addr, buf, sizeof(buf)),
+           (unsigned)ntohs(addr.sin.sin_port));
 
     istate->txn = cdata.txn;
     istate->client.vc = arg.vc;
@@ -373,14 +371,15 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
 
   case TS_EVENT_VCONN_READ_READY: {
     argument_type cdata = TSContDataGet(contp);
-    TSVConn       vc    = TSVIOVConnGet(arg.vio);
-    InterceptIO * from  = InterceptGetThisSide(cdata.istate, vc);
-    InterceptIO * to    = InterceptGetOtherSide(cdata.istate, vc);;
-    int64_t       nbytes;
+    TSVConn vc = TSVIOVConnGet(arg.vio);
+    InterceptIO *from = InterceptGetThisSide(cdata.istate, vc);
+    InterceptIO *to = InterceptGetOtherSide(cdata.istate, vc);
+    ;
+    int64_t nbytes;
 
     VIODEBUG(arg.vio, "ndone=%" PRId64 " ntodo=%" PRId64, TSVIONDoneGet(arg.vio), TSVIONTodoGet(arg.vio));
-    VDEBUG("reading vio=%p vc=%p, istate=%p is bound to client vc=%p and server vc=%p",
-        arg.vio, TSVIOVConnGet(arg.vio), cdata.istate, cdata.istate->client.vc, cdata.istate->server.vc);
+    VDEBUG("reading vio=%p vc=%p, istate=%p is bound to client vc=%p and server vc=%p", arg.vio, TSVIOVConnGet(arg.vio),
+           cdata.istate, cdata.istate->client.vc, cdata.istate->server.vc);
 
     if (to->vc == NULL) {
       VDEBUG("closing %s vc=%p", InterceptProxySide(cdata.istate, from), from->vc);
@@ -396,8 +395,8 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
       return TS_EVENT_NONE;
     }
 
-    VDEBUG("reading from %s (vc=%p), writing to %s (vc=%p)",
-        InterceptProxySide(cdata.istate, from), from->vc, InterceptProxySide(cdata.istate, to), to->vc);
+    VDEBUG("reading from %s (vc=%p), writing to %s (vc=%p)", InterceptProxySide(cdata.istate, from), from->vc,
+           InterceptProxySide(cdata.istate, to), to->vc);
 
     nbytes = InterceptTransferData(from, to);
 
@@ -406,7 +405,7 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
       TSVIO writeio = to->writeio.vio;
       VIODEBUG(writeio, "WRITE VIO ndone=%" PRId64 " ntodo=%" PRId64, TSVIONDoneGet(writeio), TSVIONTodoGet(writeio));
       TSVIOReenable(from->readio.vio); // Re-enable the read side.
-      TSVIOReenable(to->writeio.vio); // Reenable the write side.
+      TSVIOReenable(to->writeio.vio);  // Reenable the write side.
     }
 
     return TS_EVENT_NONE;
@@ -419,15 +418,16 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
     // The exception is where one side of the proxied connection
     // has been closed. Then we want to close the other side.
     argument_type cdata = TSContDataGet(contp);
-    TSVConn       vc    = TSVIOVConnGet(arg.vio);
-    InterceptIO * to    = InterceptGetThisSide(cdata.istate, vc);
-    InterceptIO * from  = InterceptGetOtherSide(cdata.istate, vc);;
+    TSVConn vc = TSVIOVConnGet(arg.vio);
+    InterceptIO *to = InterceptGetThisSide(cdata.istate, vc);
+    InterceptIO *from = InterceptGetOtherSide(cdata.istate, vc);
+    ;
 
     // If the other side is closed, close this side too, but only if there
     // we have drained the write buffer.
     if (from->vc == NULL) {
-      VDEBUG("closing %s vc=%p with %" PRId64 " bytes to left",
-          InterceptProxySide(cdata.istate, to), to->vc, TSIOBufferReaderAvail(to->writeio.reader));
+      VDEBUG("closing %s vc=%p with %" PRId64 " bytes to left", InterceptProxySide(cdata.istate, to), to->vc,
+             TSIOBufferReaderAvail(to->writeio.reader));
       if (TSIOBufferReaderAvail(to->writeio.reader) == 0) {
         to->close();
       }
@@ -447,26 +447,27 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
     // to receiving EOS from the intercepted origin server, and
     // when handling errors.
 
-    TSVConn       vc    = TSVIOVConnGet(arg.vio);
+    TSVConn vc = TSVIOVConnGet(arg.vio);
     argument_type cdata = TSContDataGet(contp);
 
-    InterceptIO * from  = InterceptGetThisSide(cdata.istate, vc);
-    InterceptIO * to    = InterceptGetOtherSide(cdata.istate, vc);;
+    InterceptIO *from = InterceptGetThisSide(cdata.istate, vc);
+    InterceptIO *to = InterceptGetOtherSide(cdata.istate, vc);
+    ;
 
     VIODEBUG(arg.vio, "received EOS or ERROR from %s side", InterceptProxySideVC(cdata.istate, vc));
 
     // Close the side that we received the EOS event from.
     if (from) {
-      VDEBUG("%s writeio has %" PRId64 " bytes left",
-          InterceptProxySide(cdata.istate, from), TSIOBufferReaderAvail(from->writeio.reader));
+      VDEBUG("%s writeio has %" PRId64 " bytes left", InterceptProxySide(cdata.istate, from),
+             TSIOBufferReaderAvail(from->writeio.reader));
       from->close();
     }
 
     // Should we also close the other side? Well, that depends on whether the reader
     // has drained the data. If we close too early they will see a truncated read.
     if (to) {
-      VDEBUG("%s writeio has %" PRId64 " bytes left",
-          InterceptProxySide(cdata.istate, to), TSIOBufferReaderAvail(to->writeio.reader));
+      VDEBUG("%s writeio has %" PRId64 " bytes left", InterceptProxySide(cdata.istate, to),
+             TSIOBufferReaderAvail(to->writeio.reader));
       if (TSIOBufferReaderAvail(to->writeio.reader) == 0) {
         to->close();
       }
@@ -500,14 +501,14 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void * edata)
 
 // Handle events that occur on the TSHttpTxn.
 static int
-InterceptTxnHook(TSCont contp, TSEvent event, void * edata)
+InterceptTxnHook(TSCont contp, TSEvent event, void *edata)
 {
   argument_type arg(edata);
 
   VDEBUG("contp=%p, event=%s (%d), edata=%p", contp, TSHttpEventNameLookup(event), event, arg.ptr);
 
   switch (event) {
-    case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE: {
+  case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE: {
     if (InterceptShouldInterceptRequest(arg.txn)) {
       TSCont c = InterceptContCreate(InterceptInterceptionHook, TSMutexCreate(), arg.txn);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/lifecycle-plugin/lifecycle-plugin.c
----------------------------------------------------------------------
diff --git a/example/lifecycle-plugin/lifecycle-plugin.c b/example/lifecycle-plugin/lifecycle-plugin.c
index 1b16a1c..5f1ed3e 100644
--- a/example/lifecycle-plugin/lifecycle-plugin.c
+++ b/example/lifecycle-plugin/lifecycle-plugin.c
@@ -30,9 +30,10 @@
 #include <ts/ts.h>
 
 int
-CallbackHandler(TSCont this, TSEvent id, void* no_data) {
-  (void) this;
-  (void) no_data;
+CallbackHandler(TSCont this, TSEvent id, void *no_data)
+{
+  (void)this;
+  (void)no_data;
   switch (id) {
   case TS_EVENT_LIFECYCLE_PORTS_INITIALIZED:
     TSDebug("lifecycle-plugin", "Proxy ports initialized");
@@ -67,9 +68,7 @@ CheckVersion()
 
     /* Need at least TS 3.3.5 */
     if (major_ts_version > 3 ||
-	(major_ts_version == 3 &&
-	 (minor_ts_version > 3 ||
-	  (minor_ts_version == 3 && patch_ts_version >= 5)))) {
+        (major_ts_version == 3 && (minor_ts_version > 3 || (minor_ts_version == 3 && patch_ts_version >= 5)))) {
       result = 1;
     }
   }
@@ -95,7 +94,8 @@ TSPluginInit(int argc, const char *argv[])
   }
 
   if (!CheckVersion()) {
-    TSError("[lifecycle-plugin] Plugin requires Traffic Server 3.3.5 " "or later\n");
+    TSError("[lifecycle-plugin] Plugin requires Traffic Server 3.3.5 "
+            "or later\n");
     goto Lerror;
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/null-transform/null-transform.c
----------------------------------------------------------------------
diff --git a/example/null-transform/null-transform.c b/example/null-transform/null-transform.c
index 2c23dea..d5b94d4 100644
--- a/example/null-transform/null-transform.c
+++ b/example/null-transform/null-transform.c
@@ -38,8 +38,7 @@
 #include "ts/ts.h"
 #include "ink_defs.h"
 
-typedef struct
-{
+typedef struct {
   TSVIO output_vio;
   TSIOBuffer output_buffer;
   TSIOBufferReader output_reader;
@@ -50,7 +49,7 @@ my_data_alloc()
 {
   MyData *data;
 
-  data = (MyData *) TSmalloc(sizeof(MyData));
+  data = (MyData *)TSmalloc(sizeof(MyData));
   data->output_vio = NULL;
   data->output_buffer = NULL;
   data->output_reader = NULL;
@@ -59,7 +58,7 @@ my_data_alloc()
 }
 
 static void
-my_data_destroy(MyData * data)
+my_data_destroy(MyData *data)
 {
   if (data) {
     if (data->output_buffer)
@@ -102,7 +101,7 @@ handle_transform(TSCont contp)
     data->output_buffer = TSIOBufferCreate();
     data->output_reader = TSIOBufferReaderAlloc(data->output_buffer);
     TSDebug("null-transform", "\tWriting %" PRId64 " bytes on VConn", TSVIONBytesGet(input_vio));
-    //data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, INT32_MAX);
+    // data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, INT32_MAX);
     data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, INT64_MAX);
     // data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, TSVIONBytesGet(input_vio));
     TSContDataSet(contp, data);
@@ -206,23 +205,21 @@ null_transform(TSCont contp, TSEvent event, void *edata ATS_UNUSED)
     return 0;
   } else {
     switch (event) {
-    case TS_EVENT_ERROR:
-      {
-        TSVIO input_vio;
-
-        TSDebug("null-transform", "\tEvent is TS_EVENT_ERROR");
-        /* Get the write VIO for the write operation that was
-         * performed on ourself. This VIO contains the continuation of
-         * our parent transformation. This is the input VIO.
-         */
-        input_vio = TSVConnWriteVIOGet(contp);
-
-        /* Call back the write VIO continuation to let it know that we
-         * have completed the write operation.
-         */
-        TSContCall(TSVIOContGet(input_vio), TS_EVENT_ERROR, input_vio);
-      }
-      break;
+    case TS_EVENT_ERROR: {
+      TSVIO input_vio;
+
+      TSDebug("null-transform", "\tEvent is TS_EVENT_ERROR");
+      /* Get the write VIO for the write operation that was
+       * performed on ourself. This VIO contains the continuation of
+       * our parent transformation. This is the input VIO.
+       */
+      input_vio = TSVConnWriteVIOGet(contp);
+
+      /* Call back the write VIO continuation to let it know that we
+       * have completed the write operation.
+       */
+      TSContCall(TSVIOContGet(input_vio), TS_EVENT_ERROR, input_vio);
+    } break;
     case TS_EVENT_VCONN_WRITE_COMPLETE:
       TSDebug("null-transform", "\tEvent is TS_EVENT_VCONN_WRITE_COMPLETE");
       /* When our output connection says that it has finished
@@ -267,7 +264,8 @@ transformable(TSHttpTxn txnp)
   retv = (resp_status == TS_HTTP_STATUS_OK);
 
   if (TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc) == TS_ERROR) {
-    TSError("[null-transform] Error releasing MLOC while checking " "header status\n");
+    TSError("[null-transform] Error releasing MLOC while checking "
+            "header status\n");
   }
 
   TSDebug("null-transform", "Exiting transformable with return %d", retv);
@@ -287,7 +285,7 @@ transform_add(TSHttpTxn txnp)
 static int
 transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   TSDebug("null-transform", "Entering transform_plugin()");
   switch (event) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/output-header/output-header.c
----------------------------------------------------------------------
diff --git a/example/output-header/output-header.c b/example/output-header/output-header.c
index 34a7b81..56ca24e 100644
--- a/example/output-header/output-header.c
+++ b/example/output-header/output-header.c
@@ -84,7 +84,7 @@ handle_dns(TSHttpTxn txnp, TSCont contp ATS_UNUSED)
 
   /* Allocate the string with an extra byte for the string
      terminator */
-  output_string = (char *) TSmalloc(total_avail + 1);
+  output_string = (char *)TSmalloc(total_avail + 1);
   output_len = 0;
 
   /* We need to loop over all the buffer blocks to make
@@ -135,7 +135,7 @@ done:
 static int
 hdr_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_OS_DNS:
@@ -167,4 +167,3 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 error:
   TSError("[PluginInit] Plugin not initialized");
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/prefetch/prefetch-plugin-eg1.c
----------------------------------------------------------------------
diff --git a/example/prefetch/prefetch-plugin-eg1.c b/example/prefetch/prefetch-plugin-eg1.c
index 72013dc..61d7a21 100644
--- a/example/prefetch/prefetch-plugin-eg1.c
+++ b/example/prefetch/prefetch-plugin-eg1.c
@@ -33,9 +33,9 @@
 #include <ts/experimental.h>
 
 TSPrefetchReturnCode
-my_preparse_hook(TSPrefetchHookID hook, TSPrefetchInfo * info)
+my_preparse_hook(TSPrefetchHookID hook, TSPrefetchInfo *info)
 {
-  unsigned char *ip = (unsigned char *) &info->client_ip;
+  unsigned char *ip = (unsigned char *)&info->client_ip;
 
   printf("preparse hook (%d): request from child %u.%u.%u.%u\n", hook, ip[0], ip[1], ip[2], ip[3]);
 
@@ -45,13 +45,12 @@ my_preparse_hook(TSPrefetchHookID hook, TSPrefetchInfo * info)
 }
 
 TSPrefetchReturnCode
-my_embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo * info)
+my_embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo *info)
 {
+  unsigned char *ip = (unsigned char *)&info->client_ip;
 
-  unsigned char *ip = (unsigned char *) &info->client_ip;
-
-  printf("url hook (%d): url: %s %s child: %u.%u.%u.%u\n",
-         hook, info->embedded_url, (info->present_in_cache) ? "(present in cache)" : "", ip[0], ip[1], ip[2], ip[3]);
+  printf("url hook (%d): url: %s %s child: %u.%u.%u.%u\n", hook, info->embedded_url,
+         (info->present_in_cache) ? "(present in cache)" : "", ip[0], ip[1], ip[2], ip[3]);
 
   /*
      We will select UDP for sending url and TCP for sending object

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/prefetch/test-hns-plugin.c
----------------------------------------------------------------------
diff --git a/example/prefetch/test-hns-plugin.c b/example/prefetch/test-hns-plugin.c
index e1da4c9..7d33b44 100644
--- a/example/prefetch/test-hns-plugin.c
+++ b/example/prefetch/test-hns-plugin.c
@@ -78,7 +78,7 @@ static TSMutex file_write_mutex;
 
 
 TSPrefetchReturnCode
-embedded_object_hook(TSPrefetchHookID hook, TSPrefetchInfo * info)
+embedded_object_hook(TSPrefetchHookID hook, TSPrefetchInfo *info)
 {
   TSIOBufferBlock block;
   const char *block_start;
@@ -88,8 +88,8 @@ embedded_object_hook(TSPrefetchHookID hook, TSPrefetchInfo * info)
 
   printf("(%s) >>> TS_PREFETCH_EMBEDDED_OBJECT_HOOK (%d)\n", TAG, hook);
 
-  printf("(%s) \tobject size for: %s is %lld\n",
-         TAG, info->embedded_url, (long long)TSIOBufferReaderAvail(info->object_buf_reader));
+  printf("(%s) \tobject size for: %s is %lld\n", TAG, info->embedded_url,
+         (long long)TSIOBufferReaderAvail(info->object_buf_reader));
 
   /* Get the embedded objects here */
   total_avail = TSIOBufferReaderAvail(info->object_buf_reader);
@@ -120,20 +120,18 @@ embedded_object_hook(TSPrefetchHookID hook, TSPrefetchInfo * info)
 }
 
 TSPrefetchReturnCode
-embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo* info)
+embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo *info)
 {
-
-  unsigned char *ip = (unsigned char *) &info->client_ip;
+  unsigned char *ip = (unsigned char *)&info->client_ip;
 
   printf("(%s) >>> TS_PREFETCH_EMBEDDED_URL_HOOK (%d)\n", TAG, hook);
 
-  printf("(%s) \tURL: %s %s Child IP: %u.%u.%u.%u\n",
-         TAG, info->embedded_url, (info->present_in_cache) ? "(present in cache)" : "", ip[0], ip[1], ip[2], ip[3]);
+  printf("(%s) \tURL: %s %s Child IP: %u.%u.%u.%u\n", TAG, info->embedded_url, (info->present_in_cache) ? "(present in cache)" : "",
+         ip[0], ip[1], ip[2], ip[3]);
 
   /* We will select UDP for sending url and TCP for sending object */
   if (embedded_object)
-    info->object_buf_status = (embedded_object == 1)
-      ? TS_PREFETCH_OBJ_BUF_NEEDED : TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED;
+    info->object_buf_status = (embedded_object == 1) ? TS_PREFETCH_OBJ_BUF_NEEDED : TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED;
   if (url_proto)
     info->url_response_proto = TS_PREFETCH_PROTO_TCP;
   else
@@ -156,9 +154,9 @@ embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo* info)
 
 
 TSPrefetchReturnCode
-pre_parse_hook(TSPrefetchHookID hook, TSPrefetchInfo* info)
+pre_parse_hook(TSPrefetchHookID hook, TSPrefetchInfo *info)
 {
-  unsigned char *ip = (unsigned char *) &info->client_ip;
+  unsigned char *ip = (unsigned char *)&info->client_ip;
 
   printf("(%s) >>> TS_PREFETCH_PRE_PARSE_HOOK (%d)\n", TAG, hook);
 
@@ -177,14 +175,13 @@ pre_parse_hook(TSPrefetchHookID hook, TSPrefetchInfo* info)
 }
 
 
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
   int c, arg;
   extern char *optarg;
   TSPluginRegistrationInfo plugin_info;
-  char file_name[512] = { 0 };
+  char file_name[512] = {0};
   plugin_info.plugin_name = "test-prefetch";
   plugin_info.vendor_name = "MyCompany";
   plugin_info.support_email = "ts-api-support@MyCompany.com";
@@ -194,7 +191,7 @@ TSPluginInit(int argc, const char *argv[])
     return;
   }
 
-  while ((c = getopt(argc, (char *const *) argv, "p:u:i:o:d:")) != EOF) {
+  while ((c = getopt(argc, (char *const *)argv, "p:u:i:o:d:")) != EOF) {
     switch (c) {
     case 'p':
     case 'u':

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/protocol/Protocol.c
----------------------------------------------------------------------
diff --git a/example/protocol/Protocol.c b/example/protocol/Protocol.c
index d065c9d..0151c68 100644
--- a/example/protocol/Protocol.c
+++ b/example/protocol/Protocol.c
@@ -50,8 +50,8 @@ accept_handler(TSCont contp, TSEvent event, void *edata)
   case TS_EVENT_NET_ACCEPT:
     /* Create a new mutex for the TxnSM, which is going
        to handle the incoming request. */
-    pmutex = (TSMutex) TSMutexCreate();
-    txn_sm = (TSCont) TxnSMCreate(pmutex, (TSVConn) edata, server_port);
+    pmutex = (TSMutex)TSMutexCreate();
+    txn_sm = (TSCont)TxnSMCreate(pmutex, (TSVConn)edata, server_port);
 
     /* This is no reason for not grabbing the lock.
        So skip the routine which handle LockTry failure case. */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/protocol/Protocol.h
----------------------------------------------------------------------
diff --git a/example/protocol/Protocol.h b/example/protocol/Protocol.h
index aeddd0d..d45efbc 100644
--- a/example/protocol/Protocol.h
+++ b/example/protocol/Protocol.h
@@ -41,7 +41,10 @@
 /* MAX_SERVER_NAME_LENGTH + MAX_FILE_NAME_LENGTH + strlen("\n\n") */
 #define MAX_REQUEST_LENGTH 2050
 
-#define set_handler(_d, _s) {_d = _s;}
+#define set_handler(_d, _s) \
+  {                         \
+    _d = _s;                \
+  }
 
 
 #endif /* PROTOCOL_H */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/protocol/TxnSM.c
----------------------------------------------------------------------
diff --git a/example/protocol/TxnSM.c b/example/protocol/TxnSM.c
index 98eafaf..d9c2b29 100644
--- a/example/protocol/TxnSM.c
+++ b/example/protocol/TxnSM.c
@@ -72,7 +72,7 @@ TSCacheKey CacheKeyCreate(char *file_name);
 int
 main_handler(TSCont contp, TSEvent event, void *data)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
   TxnSMHandler q_current_handler = txn_sm->q_current_handler;
 
   TSDebug("protocol", "main_handler (contp %p event %d)", contp, event);
@@ -90,7 +90,7 @@ main_handler(TSCont contp, TSEvent event, void *data)
 
   TSDebug("protocol", "current_handler (%p)", q_current_handler);
 
-  return (*q_current_handler) (contp, event, data);
+  return (*q_current_handler)(contp, event, data);
 }
 
 /* Create the Txn data structure and the continuation for the Txn. */
@@ -100,7 +100,7 @@ TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port)
   TSCont contp;
   TxnSM *txn_sm;
 
-  txn_sm = (TxnSM *) TSmalloc(sizeof(TxnSM));
+  txn_sm = (TxnSM *)TSmalloc(sizeof(TxnSM));
 
   txn_sm->q_mutex = pmutex;
   txn_sm->q_pending_action = NULL;
@@ -126,7 +126,7 @@ TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port)
   txn_sm->q_server_request_buffer_reader = NULL;
 
   /* Char buffers to store client request and server response. */
-  txn_sm->q_client_request = (char *) TSmalloc(sizeof(char) * (MAX_REQUEST_LENGTH + 1));
+  txn_sm->q_client_request = (char *)TSmalloc(sizeof(char) * (MAX_REQUEST_LENGTH + 1));
   memset(txn_sm->q_client_request, '\0', (sizeof(char) * (MAX_REQUEST_LENGTH + 1)));
   txn_sm->q_server_response = NULL;
   txn_sm->q_server_response_length = 0;
@@ -136,8 +136,8 @@ TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port)
   txn_sm->q_cache_read_buffer = NULL;
   txn_sm->q_cache_read_buffer_reader = NULL;
 
-  txn_sm->q_server_name = (char *) TSmalloc(sizeof(char) * (MAX_SERVER_NAME_LENGTH + 1));
-  txn_sm->q_file_name = (char *) TSmalloc(sizeof(char) * (MAX_FILE_NAME_LENGTH + 1));
+  txn_sm->q_server_name = (char *)TSmalloc(sizeof(char) * (MAX_SERVER_NAME_LENGTH + 1));
+  txn_sm->q_file_name = (char *)TSmalloc(sizeof(char) * (MAX_FILE_NAME_LENGTH + 1));
 
   txn_sm->q_key = NULL;
   txn_sm->q_magic = TXN_SM_ALIVE;
@@ -154,7 +154,7 @@ TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port)
 int
 state_start(TSCont contp, TSEvent event ATS_UNUSED, void *data ATS_UNUSED)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   if (!txn_sm->q_client_vc) {
     return prepare_to_die(contp);
@@ -173,7 +173,7 @@ state_start(TSCont contp, TSEvent event ATS_UNUSED, void *data ATS_UNUSED)
      INT64_MAX, so that we will always get TS_EVENT_VCONN_READ_READY
      event, but never TS_EVENT_VCONN_READ_COMPLETE event. */
   set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_interface_with_client);
-  txn_sm->q_client_read_vio = TSVConnRead(txn_sm->q_client_vc, (TSCont) contp, txn_sm->q_client_request_buffer, INT64_MAX);
+  txn_sm->q_client_read_vio = TSVConnRead(txn_sm->q_client_vc, (TSCont)contp, txn_sm->q_client_request_buffer, INT64_MAX);
 
   return TS_SUCCESS;
 }
@@ -188,7 +188,7 @@ state_start(TSCont contp, TSEvent event ATS_UNUSED, void *data ATS_UNUSED)
 int
 state_interface_with_client(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_interface_with_client");
 
@@ -209,7 +209,7 @@ state_read_request_from_client(TSCont contp, TSEvent event, TSVIO vio ATS_UNUSED
   int bytes_read, parse_result;
   char *temp_buf;
 
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_read_request_from_client");
 
@@ -218,13 +218,13 @@ state_read_request_from_client(TSCont contp, TSEvent event, TSVIO vio ATS_UNUSED
     bytes_read = TSIOBufferReaderAvail(txn_sm->q_client_request_buffer_reader);
 
     if (bytes_read > 0) {
-      temp_buf = (char *) get_info_from_buffer(txn_sm->q_client_request_buffer_reader);
+      temp_buf = (char *)get_info_from_buffer(txn_sm->q_client_request_buffer_reader);
       TSstrlcat(txn_sm->q_client_request, temp_buf, MAX_REQUEST_LENGTH + 1);
       TSfree(temp_buf);
 
       /* Check if the request is fully read, if so, do cache lookup. */
       if (strstr(txn_sm->q_client_request, "\r\n\r\n") != NULL) {
-        temp_buf = (char *) TSmalloc(sizeof(char) * (strlen(txn_sm->q_client_request) + 1));
+        temp_buf = (char *)TSmalloc(sizeof(char) * (strlen(txn_sm->q_client_request) + 1));
         memcpy(temp_buf, txn_sm->q_client_request, strlen(txn_sm->q_client_request));
         temp_buf[strlen(txn_sm->q_client_request)] = '\0';
         parse_result = parse_request(temp_buf, txn_sm->q_server_name, txn_sm->q_file_name);
@@ -248,9 +248,8 @@ state_read_request_from_client(TSCont contp, TSEvent event, TSVIO vio ATS_UNUSED
     TSVIOReenable(txn_sm->q_client_read_vio);
     break;
 
-  default:                     /* Shouldn't get here, prepare to die. */
+  default: /* Shouldn't get here, prepare to die. */
     return prepare_to_die(contp);
-
   }
   return TS_SUCCESS;
 }
@@ -261,7 +260,7 @@ state_read_request_from_client(TSCont contp, TSEvent event, TSVIO vio ATS_UNUSED
 int
 state_handle_cache_lookup(TSCont contp, TSEvent event, TSVConn vc)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
   int64_t response_size;
   int ret_val;
 
@@ -289,9 +288,8 @@ state_handle_cache_lookup(TSCont contp, TSEvent event, TSVConn vc)
     txn_sm->q_cache_read_buffer = TSIOBufferCreate();
     txn_sm->q_cache_read_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_cache_read_buffer);
 
-    if (!txn_sm->q_client_response_buffer ||
-        !txn_sm->q_client_response_buffer_reader ||
-        !txn_sm->q_cache_read_buffer || !txn_sm->q_cache_read_buffer_reader) {
+    if (!txn_sm->q_client_response_buffer || !txn_sm->q_client_response_buffer_reader || !txn_sm->q_cache_read_buffer ||
+        !txn_sm->q_cache_read_buffer_reader) {
       return prepare_to_die(contp);
     }
 
@@ -323,7 +321,7 @@ state_handle_cache_lookup(TSCont contp, TSEvent event, TSVConn vc)
 }
 
 static void
-load_buffer_cache_data(TxnSM * txn_sm)
+load_buffer_cache_data(TxnSM *txn_sm)
 {
   /* transfer the data from the cache buffer (which must
      fully be consumed on a VCONN_READY event, to the
@@ -335,9 +333,9 @@ load_buffer_cache_data(TxnSM * txn_sm)
 
   TSAssert(rdr_avail > 0);
 
-  TSIOBufferCopy(txn_sm->q_client_response_buffer,     /* (cache response buffer) */
-                  txn_sm->q_cache_read_buffer_reader,   /* (transient buffer)      */
-                  rdr_avail, 0);
+  TSIOBufferCopy(txn_sm->q_client_response_buffer,   /* (cache response buffer) */
+                 txn_sm->q_cache_read_buffer_reader, /* (transient buffer)      */
+                 rdr_avail, 0);
 
   TSIOBufferReaderConsume(txn_sm->q_cache_read_buffer_reader, rdr_avail);
 }
@@ -350,7 +348,7 @@ load_buffer_cache_data(TxnSM * txn_sm)
 int
 state_handle_cache_read_response(TSCont contp, TSEvent event, TSVIO vio ATS_UNUSED)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_handle_cache_read_response");
 
@@ -390,7 +388,6 @@ state_handle_cache_read_response(TSCont contp, TSEvent event, TSVIO vio ATS_UNUS
     TSAssert(txn_sm->q_pending_action == NULL);
     txn_sm->q_pending_action = TSCacheWrite(contp, txn_sm->q_key);
     break;
-
   }
   return TS_SUCCESS;
 }
@@ -401,7 +398,7 @@ state_handle_cache_read_response(TSCont contp, TSEvent event, TSVIO vio ATS_UNUS
 int
 state_handle_cache_prepare_for_write(TSCont contp, TSEvent event, TSVConn vc)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_handle_cache_prepare_for_write");
 
@@ -425,7 +422,7 @@ state_handle_cache_prepare_for_write(TSCont contp, TSEvent event, TSVConn vc)
 int
 state_build_and_send_request(TSCont contp, TSEvent event ATS_UNUSED, void *data ATS_UNUSED)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_build_and_send_request");
 
@@ -437,9 +434,8 @@ state_build_and_send_request(TSCont contp, TSEvent event ATS_UNUSED, void *data
   txn_sm->q_server_response_buffer = TSIOBufferCreate();
   txn_sm->q_cache_response_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_server_response_buffer);
 
-  if (!txn_sm->q_server_request_buffer ||
-      !txn_sm->q_server_request_buffer_reader ||
-      !txn_sm->q_server_response_buffer || !txn_sm->q_cache_response_buffer_reader) {
+  if (!txn_sm->q_server_request_buffer || !txn_sm->q_server_request_buffer_reader || !txn_sm->q_server_response_buffer ||
+      !txn_sm->q_cache_response_buffer_reader) {
     return prepare_to_die(contp);
   }
 
@@ -461,8 +457,8 @@ state_build_and_send_request(TSCont contp, TSEvent event ATS_UNUSED, void *data
 int
 state_dns_lookup(TSCont contp, TSEvent event, TSHostLookupResult host_info)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
-  struct sockaddr const* q_server_addr;
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
+  struct sockaddr const *q_server_addr;
   struct sockaddr_in ip_addr;
 
   TSDebug("protocol", "enter state_dns_lookup");
@@ -483,7 +479,7 @@ state_dns_lookup(TSCont contp, TSEvent event, TSHostLookupResult host_info)
 
   memcpy(&ip_addr, q_server_addr, sizeof(ip_addr));
   ip_addr.sin_port = txn_sm->q_server_port;
-  txn_sm->q_pending_action = TSNetConnect(contp, (struct sockaddr const*)&ip_addr);
+  txn_sm->q_pending_action = TSNetConnect(contp, (struct sockaddr const *)&ip_addr);
 
   return TS_SUCCESS;
 }
@@ -496,7 +492,7 @@ state_dns_lookup(TSCont contp, TSEvent event, TSHostLookupResult host_info)
 int
 state_connect_to_server(TSCont contp, TSEvent event, TSVConn vc)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_connect_to_server");
 
@@ -512,8 +508,8 @@ state_connect_to_server(TSCont contp, TSEvent event, TSVConn vc)
   set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_send_request_to_server);
 
   /* Actively write the request to the net_vc. */
-  txn_sm->q_server_write_vio = TSVConnWrite(txn_sm->q_server_vc, contp,
-                                             txn_sm->q_server_request_buffer_reader, strlen(txn_sm->q_client_request));
+  txn_sm->q_server_write_vio =
+    TSVConnWrite(txn_sm->q_server_vc, contp, txn_sm->q_server_request_buffer_reader, strlen(txn_sm->q_client_request));
   return TS_SUCCESS;
 }
 
@@ -522,7 +518,7 @@ state_connect_to_server(TSCont contp, TSEvent event, TSVConn vc)
 int
 state_send_request_to_server(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_send_request_to_server");
 
@@ -538,7 +534,7 @@ state_send_request_to_server(TSCont contp, TSEvent event, TSVIO vio)
     txn_sm->q_server_read_vio = TSVConnRead(txn_sm->q_server_vc, contp, txn_sm->q_server_response_buffer, INT64_MAX);
     break;
 
-    /* it could be failure of TSNetConnect */
+  /* it could be failure of TSNetConnect */
   default:
     return prepare_to_die(contp);
   }
@@ -549,25 +545,25 @@ state_send_request_to_server(TSCont contp, TSEvent event, TSVIO vio)
 int
 state_interface_with_server(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_interface_with_server");
 
   txn_sm->q_pending_action = NULL;
 
   switch (event) {
-    /* This is returned from cache_vc. */
+  /* This is returned from cache_vc. */
   case TS_EVENT_VCONN_WRITE_READY:
   case TS_EVENT_VCONN_WRITE_COMPLETE:
     return state_write_to_cache(contp, event, vio);
-    /* Otherwise, handle events from server. */
+  /* Otherwise, handle events from server. */
   case TS_EVENT_VCONN_READ_READY:
-    /* Actually, we shouldn't get READ_COMPLETE because we set bytes
-       count to be INT64_MAX. */
+  /* Actually, we shouldn't get READ_COMPLETE because we set bytes
+     count to be INT64_MAX. */
   case TS_EVENT_VCONN_READ_COMPLETE:
     return state_read_response_from_server(contp, event, vio);
 
-    /* all data of the response come in. */
+  /* all data of the response come in. */
   case TS_EVENT_VCONN_EOS:
     TSDebug("protocol", "get server eos");
     /* There is no more use of server_vc, close it. */
@@ -607,10 +603,10 @@ state_interface_with_server(TSCont contp, TSEvent event, TSVIO vio)
       /* Open cache_vc to read data and send to client. */
       set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_lookup);
       txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
-    } else {                    /* not done with writing into cache */
+    } else { /* not done with writing into cache */
 
       TSDebug("protocol", "cache_response_length is %d, server response length is %d", txn_sm->q_cache_response_length,
-               txn_sm->q_server_response_length);
+              txn_sm->q_server_response_length);
       TSVIOReenable(txn_sm->q_cache_write_vio);
     }
 
@@ -630,7 +626,7 @@ state_interface_with_server(TSCont contp, TSEvent event, TSVIO vio)
 int
 state_read_response_from_server(TSCont contp, TSEvent event ATS_UNUSED, TSVIO vio ATS_UNUSED)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
   int bytes_read = 0;
 
   TSDebug("protocol", "enter state_read_response_from_server");
@@ -641,18 +637,17 @@ state_read_response_from_server(TSCont contp, TSEvent event ATS_UNUSED, TSVIO vi
     /* If this is the first write, do TSVConnWrite, otherwise, simply
        reenable q_cache_write_vio. */
     if (txn_sm->q_server_response_length == 0) {
-      txn_sm->q_cache_write_vio = TSVConnWrite(txn_sm->q_cache_vc,
-                                                contp, txn_sm->q_cache_response_buffer_reader, bytes_read);
+      txn_sm->q_cache_write_vio = TSVConnWrite(txn_sm->q_cache_vc, contp, txn_sm->q_cache_response_buffer_reader, bytes_read);
     } else {
       TSAssert(txn_sm->q_server_response_length > 0);
       TSVIOReenable(txn_sm->q_cache_write_vio);
       txn_sm->q_block_bytes_read = bytes_read;
-/*
-	    txn_sm->q_cache_write_vio = TSVConnWrite (txn_sm->q_cache_vc,
-						       contp,
-						       txn_sm->q_cache_response_buffer_reader,
-						       bytes_read);
-						       */
+      /*
+                  txn_sm->q_cache_write_vio = TSVConnWrite (txn_sm->q_cache_vc,
+                                                             contp,
+                                                             txn_sm->q_cache_response_buffer_reader,
+                                                             bytes_read);
+                                                             */
     }
   }
 
@@ -667,7 +662,7 @@ state_read_response_from_server(TSCont contp, TSEvent event ATS_UNUSED, TSVIO vi
 int
 state_write_to_cache(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_write_to_cache");
 
@@ -695,7 +690,7 @@ state_write_to_cache(TSCont contp, TSEvent event, TSVIO vio)
     if (txn_sm->q_cache_response_length >= txn_sm->q_server_response_length) {
       /* Write is complete, close the cache_vc. */
       TSDebug("protocol", "close cache_vc, cache_response_length is %d, server_response_lenght is %d",
-               txn_sm->q_cache_response_length, txn_sm->q_server_response_length);
+              txn_sm->q_cache_response_length, txn_sm->q_server_response_length);
       TSVConnClose(txn_sm->q_cache_vc);
       txn_sm->q_cache_vc = NULL;
       txn_sm->q_cache_write_vio = NULL;
@@ -704,7 +699,7 @@ state_write_to_cache(TSCont contp, TSEvent event, TSVIO vio)
       /* Open cache_vc to read data and send to client. */
       set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_lookup);
       txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
-    } else {                    /* not done with writing into cache */
+    } else { /* not done with writing into cache */
 
       TSDebug("protocol", "re-enable cache_write_vio");
       TSVIOReenable(txn_sm->q_cache_write_vio);
@@ -724,14 +719,14 @@ state_write_to_cache(TSCont contp, TSEvent event, TSVIO vio)
 int
 state_send_response_to_client(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_send_response_to_client");
 
   switch (event) {
   case TS_EVENT_VCONN_WRITE_READY:
     TSDebug("protocol", " . wr ready");
-    TSDebug("protocol", "write_ready: nbytes %" PRId64", ndone %" PRId64, TSVIONBytesGet(vio), TSVIONDoneGet(vio));
+    TSDebug("protocol", "write_ready: nbytes %" PRId64 ", ndone %" PRId64, TSVIONBytesGet(vio), TSVIONDoneGet(vio));
     TSVIOReenable(txn_sm->q_client_write_vio);
     break;
 
@@ -751,7 +746,6 @@ state_send_response_to_client(TSCont contp, TSEvent event, TSVIO vio)
   default:
     TSDebug("protocol", " . default handler");
     return prepare_to_die(contp);
-
   }
 
   TSDebug("protocol", "leaving send_response_to_client");
@@ -765,7 +759,7 @@ state_send_response_to_client(TSCont contp, TSEvent event, TSVIO vio)
 int
 prepare_to_die(TSCont contp)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter prepare_to_die");
   if (txn_sm->q_client_vc) {
@@ -795,7 +789,7 @@ prepare_to_die(TSCont contp)
 int
 state_done(TSCont contp, TSEvent event ATS_UNUSED, TSVIO vio ATS_UNUSED)
 {
-  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *)TSContDataGet(contp);
 
   TSDebug("protocol", "enter state_done");
 
@@ -887,14 +881,14 @@ send_response_to_client(TSCont contp)
 
   TSDebug("protocol", "enter send_response_to_client");
 
-  txn_sm = (TxnSM *) TSContDataGet(contp);
+  txn_sm = (TxnSM *)TSContDataGet(contp);
   response_len = TSIOBufferReaderAvail(txn_sm->q_client_response_buffer_reader);
 
   TSDebug("protocol", " . resp_len is %d", response_len);
 
   set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_interface_with_client);
-  txn_sm->q_client_write_vio = TSVConnWrite(txn_sm->q_client_vc, (TSCont) contp,
-                                             txn_sm->q_client_response_buffer_reader, response_len);
+  txn_sm->q_client_write_vio =
+    TSVConnWrite(txn_sm->q_client_vc, (TSCont)contp, txn_sm->q_client_response_buffer_reader, response_len);
   return TS_SUCCESS;
 }
 
@@ -914,7 +908,7 @@ get_info_from_buffer(TSIOBufferReader the_reader)
 
   read_avail = TSIOBufferReaderAvail(the_reader);
 
-  info = (char *) TSmalloc(sizeof(char) * read_avail);
+  info = (char *)TSmalloc(sizeof(char) * read_avail);
   if (info == NULL)
     return NULL;
   info_start = info;
@@ -922,7 +916,7 @@ get_info_from_buffer(TSIOBufferReader the_reader)
   /* Read the data out of the reader */
   while (read_avail > 0) {
     blk = TSIOBufferReaderStart(the_reader);
-    buf = (char *) TSIOBufferBlockReadStart(blk, the_reader, &read_done);
+    buf = (char *)TSIOBufferBlockReadStart(blk, the_reader, &read_done);
     memcpy(info, buf, read_done);
     if (read_done > 0) {
       TSIOBufferReaderConsume(the_reader, read_done);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/protocol/TxnSM.h
----------------------------------------------------------------------
diff --git a/example/protocol/TxnSM.h b/example/protocol/TxnSM.h
index 2876f5a..cf6d657 100644
--- a/example/protocol/TxnSM.h
+++ b/example/protocol/TxnSM.h
@@ -26,17 +26,16 @@
 
 #include "Protocol.h"
 
-typedef int (*TxnSMHandler) (TSCont contp, TSEvent event, void *data);
+typedef int (*TxnSMHandler)(TSCont contp, TSEvent event, void *data);
 
 TSCont TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port);
 
 #define TXN_SM_ALIVE 0xAAAA0123
-#define TXN_SM_DEAD  0xFEE1DEAD
-#define TXN_SM_ZERO  0x00001111
+#define TXN_SM_DEAD 0xFEE1DEAD
+#define TXN_SM_ZERO 0x00001111
 
 /* The Txn State Machine */
-typedef struct _TxnSM
-{
+typedef struct _TxnSM {
   unsigned int q_magic;
 
   TSMutex q_mutex;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/query-remap/query-remap.c
----------------------------------------------------------------------
diff --git a/example/query-remap/query-remap.c b/example/query-remap/query-remap.c
index 8eabd3f..6f5b0c8 100644
--- a/example/query-remap/query-remap.c
+++ b/example/query-remap/query-remap.c
@@ -43,11 +43,10 @@ typedef struct _query_remap_info {
 
 
 int
-TSRemapInit(TSRemapInterface *api_info ATS_UNUSED, char *errbuf ATS_UNUSED,
-              int errbuf_size ATS_UNUSED)
+TSRemapInit(TSRemapInterface *api_info ATS_UNUSED, char *errbuf ATS_UNUSED, int errbuf_size ATS_UNUSED)
 {
   /* Called at TS startup. Nothing needed for this plugin */
-  TSDebug(PLUGIN_NAME , "remap plugin initialized");
+  TSDebug(PLUGIN_NAME, "remap plugin initialized");
   return 0;
 }
 
@@ -71,39 +70,38 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf ATS_UNUSED, i
        2: query param to hash
        3,4,... : server hostnames
   */
-  query_remap_info *qri = (query_remap_info*) TSmalloc(sizeof(query_remap_info));
+  query_remap_info *qri = (query_remap_info *)TSmalloc(sizeof(query_remap_info));
 
   qri->param_name = TSstrdup(argv[2]);
   qri->param_len = strlen(qri->param_name);
   qri->num_hosts = argc - 3;
-  qri->hosts = (char**) TSmalloc(qri->num_hosts*sizeof(char*));
+  qri->hosts = (char **)TSmalloc(qri->num_hosts * sizeof(char *));
 
-  TSDebug(PLUGIN_NAME, " - Hash using query parameter [%s] with %d hosts",
-           qri->param_name, qri->num_hosts);
+  TSDebug(PLUGIN_NAME, " - Hash using query parameter [%s] with %d hosts", qri->param_name, qri->num_hosts);
 
-  for (i=0; i < qri->num_hosts; ++i) {
-    qri->hosts[i] = TSstrdup(argv[i+3]);
+  for (i = 0; i < qri->num_hosts; ++i) {
+    qri->hosts[i] = TSstrdup(argv[i + 3]);
     TSDebug(PLUGIN_NAME, " - Host %d: %s", i, qri->hosts[i]);
   }
 
-  *ih = (void*)qri;
+  *ih = (void *)qri;
   TSDebug(PLUGIN_NAME, "created instance %p", *ih);
   return 0;
 }
 
 void
-TSRemapDeleteInstance(void* ih)
+TSRemapDeleteInstance(void *ih)
 {
   /* Release instance memory allocated in TSRemapNewInstance */
   int i;
   TSDebug(PLUGIN_NAME, "deleting instance %p", ih);
 
   if (ih) {
-    query_remap_info *qri = (query_remap_info*)ih;
+    query_remap_info *qri = (query_remap_info *)ih;
     if (qri->param_name)
       TSfree(qri->param_name);
     if (qri->hosts) {
-      for (i=0; i < qri->num_hosts; ++i) {
+      for (i = 0; i < qri->num_hosts; ++i) {
         TSfree(qri->hosts[i]);
       }
       TSfree(qri->hosts);
@@ -114,10 +112,10 @@ TSRemapDeleteInstance(void* ih)
 
 
 TSRemapStatus
-TSRemapDoRemap(void* ih, TSHttpTxn rh ATS_UNUSED, TSRemapRequestInfo *rri)
+TSRemapDoRemap(void *ih, TSHttpTxn rh ATS_UNUSED, TSRemapRequestInfo *rri)
 {
   int hostidx = -1;
-  query_remap_info *qri = (query_remap_info*)ih;
+  query_remap_info *qri = (query_remap_info *)ih;
 
   if (!qri || !rri) {
     TSError(PLUGIN_NAME "NULL private data or RRI");
@@ -125,20 +123,19 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh ATS_UNUSED, TSRemapRequestInfo *rri)
   }
 
   int req_query_len;
-  const char* req_query = TSUrlHttpQueryGet(rri->requestBufp, rri->requestUrl, &req_query_len);
+  const char *req_query = TSUrlHttpQueryGet(rri->requestBufp, rri->requestUrl, &req_query_len);
 
   if (req_query && req_query_len > 0) {
     char *q, *key;
     char *s = NULL;
 
     /* make a copy of the query, as it is read only */
-    q = (char*) TSstrndup(req_query, req_query_len+1);
+    q = (char *)TSstrndup(req_query, req_query_len + 1);
 
     /* parse query parameters */
     for (key = strtok_r(q, "&", &s); key != NULL;) {
       char *val = strchr(key, '=');
-      if (val && (size_t)(val-key) == qri->param_len &&
-          !strncmp(key, qri->param_name, qri->param_len)) {
+      if (val && (size_t)(val - key) == qri->param_len && !strncmp(key, qri->param_name, qri->param_len)) {
         ++val;
         /* the param key matched the configured param_name
            hash the param value to pick a host */
@@ -154,7 +151,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh ATS_UNUSED, TSRemapRequestInfo *rri)
     if (hostidx >= 0) {
       int req_host_len;
       /* TODO: Perhaps use TSIsDebugTagSet() before calling TSUrlHostGet()... */
-      const char* req_host = TSUrlHostGet(rri->requestBufp, rri->requestUrl, &req_host_len);
+      const char *req_host = TSUrlHostGet(rri->requestBufp, rri->requestUrl, &req_host_len);
 
       if (TSUrlHostSet(rri->requestBufp, rri->requestUrl, qri->hosts[hostidx], strlen(qri->hosts[hostidx])) != TS_SUCCESS) {
         TSDebug(PLUGIN_NAME, "Failed to modify the Host in request URL");
@@ -179,10 +176,9 @@ hash_fnv32(char *buf, size_t len)
   uint32_t hval = (uint32_t)0x811c9dc5; /* FNV1_32_INIT */
 
   for (; len > 0; --len) {
-    hval *= (uint32_t)0x01000193;  /* FNV_32_PRIME */
+    hval *= (uint32_t)0x01000193; /* FNV_32_PRIME */
     hval ^= (uint32_t)*buf++;
   }
 
   return hval;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/redirect-1/redirect-1.c
----------------------------------------------------------------------
diff --git a/example/redirect-1/redirect-1.c b/example/redirect-1/redirect-1.c
index 613235a..06865f2 100644
--- a/example/redirect-1/redirect-1.c
+++ b/example/redirect-1/redirect-1.c
@@ -35,9 +35,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#  include <unistd.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include <ts/ts.h>
 
@@ -107,10 +107,8 @@ handle_client_lookup(TSHttpTxn txnp, TSCont contp)
    * Create the local copies of the global coupled stats:
    */
   local_requests_all = INKStatCoupledLocalAdd(local_request_outcomes, "requests.all.local", INKSTAT_TYPE_FLOAT);
-  local_requests_redirects = INKStatCoupledLocalAdd(local_request_outcomes,
-                                                    "requests.redirects.local", INKSTAT_TYPE_INT64);
-  local_requests_unchanged = INKStatCoupledLocalAdd(local_request_outcomes,
-                                                    "requests.unchanged.local", INKSTAT_TYPE_INT64);
+  local_requests_redirects = INKStatCoupledLocalAdd(local_request_outcomes, "requests.redirects.local", INKSTAT_TYPE_INT64);
+  local_requests_unchanged = INKStatCoupledLocalAdd(local_request_outcomes, "requests.unchanged.local", INKSTAT_TYPE_INT64);
 
 
   /*
@@ -122,7 +120,7 @@ handle_client_lookup(TSHttpTxn txnp, TSCont contp)
   INKStatFloatAddTo(local_requests_all, 1.0);
 
   if (TSIsDebugTagSet("redirect")) {
-    struct sockaddr const* addr = TSHttpTxnClientAddrGet(txnp);
+    struct sockaddr const *addr = TSHttpTxnClientAddrGet(txnp);
 
     if (addr) {
       socklen_t addr_size = 0;
@@ -200,7 +198,6 @@ done:
 }
 
 
-
 static void
 handle_response(TSHttpTxn txnp)
 {
@@ -215,9 +212,8 @@ handle_response(TSHttpTxn txnp)
   }
 
   TSHttpHdrStatusSet(bufp, hdr_loc, TS_HTTP_STATUS_MOVED_PERMANENTLY);
-  TSHttpHdrReasonSet(bufp, hdr_loc,
-                      TSHttpHdrReasonLookup(TS_HTTP_STATUS_MOVED_PERMANENTLY),
-                      strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_MOVED_PERMANENTLY)));
+  TSHttpHdrReasonSet(bufp, hdr_loc, TSHttpHdrReasonLookup(TS_HTTP_STATUS_MOVED_PERMANENTLY),
+                     strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_MOVED_PERMANENTLY)));
 
   TSMimeHdrFieldCreate(bufp, hdr_loc, &newfield_loc); /* Probably should check for errors ... */
   TSMimeHdrFieldNameSet(bufp, hdr_loc, newfield_loc, TS_MIME_FIELD_LOCATION, TS_MIME_LEN_LOCATION);
@@ -239,12 +235,10 @@ done:
 }
 
 
-
 static int
 redirect_plugin(TSCont contp, TSEvent event, void *edata)
 {
-
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_REQUEST_HDR:
@@ -265,7 +259,6 @@ redirect_plugin(TSCont contp, TSEvent event, void *edata)
 }
 
 
-
 /*
  *  Global statistics functions:
  */
@@ -291,7 +284,6 @@ init_stats(void)
   requests_all = INKStatCoupledGlobalAdd(request_outcomes, "requests.all", INKSTAT_TYPE_FLOAT);
   requests_redirects = INKStatCoupledGlobalAdd(request_outcomes, "requests.redirects", INKSTAT_TYPE_INT64);
   requests_unchanged = INKStatCoupledGlobalAdd(request_outcomes, "requests.unchanged", INKSTAT_TYPE_INT64);
-
 }
 
 /*
@@ -371,7 +363,8 @@ TSPluginInit(int argc, const char *argv[])
     TSstrlcat(uri_redirect, url_redirect, uri_len);
 
   } else {
-    TSError("Incorrect syntax in plugin.conf:  correct usage is" "redirect-1.so ip_deny url_redirect");
+    TSError("Incorrect syntax in plugin.conf:  correct usage is"
+            "redirect-1.so ip_deny url_redirect");
     return;
   }
 
@@ -381,8 +374,7 @@ TSPluginInit(int argc, const char *argv[])
   init_stats();
   TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(redirect_plugin, NULL));
 
-  TSDebug("redirect_init", "block_ip is %s, url_redirect is %s, and uri_redirect is %s",
-           block_ip, url_redirect, uri_redirect);
+  TSDebug("redirect_init", "block_ip is %s, url_redirect is %s, and uri_redirect is %s", block_ip, url_redirect, uri_redirect);
   // ToDo: Should figure out how to print IPs which are IPv4 / v6.
   // TSDebug("redirect_init", "ip_deny is %ld\n", ip_deny);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/remap/remap.cc
----------------------------------------------------------------------
diff --git a/example/remap/remap.cc b/example/remap/remap.cc
index 2dbe82a..f8311d7 100644
--- a/example/remap/remap.cc
+++ b/example/remap/remap.cc
@@ -57,22 +57,19 @@ public:
   remap_entry *next;
   int argc;
   char **argv;
-    remap_entry(int _argc, char *_argv[]);
-   ~remap_entry();
+  remap_entry(int _argc, char *_argv[]);
+  ~remap_entry();
   static void add_to_list(remap_entry *re);
   static void remove_from_list(remap_entry *re);
 };
 
-static int plugin_init_counter = 0;     /* remap plugin initialization counter */
-static pthread_mutex_t remap_plugin_global_mutex;       /* remap plugin global mutex */
-remap_entry *
-  remap_entry::active_list = 0;
-pthread_mutex_t
-  remap_entry::mutex;           /* remap_entry class mutex */
+static int plugin_init_counter = 0;               /* remap plugin initialization counter */
+static pthread_mutex_t remap_plugin_global_mutex; /* remap plugin global mutex */
+remap_entry *remap_entry::active_list = 0;
+pthread_mutex_t remap_entry::mutex; /* remap_entry class mutex */
 
 /* ----------------------- remap_entry::remap_entry ------------------------ */
-remap_entry::remap_entry(int _argc, char *_argv[]):
-  next(NULL), argc(0), argv(NULL)
+remap_entry::remap_entry(int _argc, char *_argv[]) : next(NULL), argc(0), argv(NULL)
 {
   int i;
 
@@ -133,20 +130,20 @@ store_my_error_message(TSReturnCode retcode, char *err_msg_buf, int buf_size, co
     va_list ap;
     va_start(ap, fmt);
     err_msg_buf[0] = 0;
-    (void) vsnprintf(err_msg_buf, buf_size - 1, fmt, ap);
+    (void)vsnprintf(err_msg_buf, buf_size - 1, fmt, ap);
     err_msg_buf[buf_size - 1] = 0;
     va_end(ap);
   }
-  return retcode;               /* error code here */
+  return retcode; /* error code here */
 }
 
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
   TSPluginRegistrationInfo info;
-  info.plugin_name = (char*)"remap_plugin";
-  info.vendor_name = (char*)"Apache";
-  info.support_email = (char*)"";
+  info.plugin_name = (char *)"remap_plugin";
+  info.vendor_name = (char *)"Apache";
+  info.support_email = (char *)"";
 
   if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
     TSError("Plugin registration failed. \n");
@@ -169,20 +166,20 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
     if (unlikely(api_info->size < sizeof(TSRemapInterface))) {
       return store_my_error_message(TS_ERROR, errbuf, errbuf_size,
                                     "[TSRemapInit] - Incorrect size of TSRemapInterface structure %d. Should be at least %d bytes",
-                                    (int) api_info->size, (int) sizeof(TSRemapInterface));
+                                    (int)api_info->size, (int)sizeof(TSRemapInterface));
     }
     if (unlikely(api_info->tsremap_version < TSREMAP_VERSION)) {
-      return store_my_error_message(TS_ERROR, errbuf, errbuf_size,
-                                    "[TSRemapInit] - Incorrect API version %d.%d",
+      return store_my_error_message(TS_ERROR, errbuf, errbuf_size, "[TSRemapInit] - Incorrect API version %d.%d",
                                     (api_info->tsremap_version >> 16), (api_info->tsremap_version & 0xffff));
     }
 
-    if (pthread_mutex_init(&remap_plugin_global_mutex, 0) || pthread_mutex_init(&remap_entry::mutex, 0)) {      /* pthread_mutex_init - always returns 0. :) - impossible error */
+    if (pthread_mutex_init(&remap_plugin_global_mutex, 0) ||
+        pthread_mutex_init(&remap_entry::mutex, 0)) { /* pthread_mutex_init - always returns 0. :) - impossible error */
       return store_my_error_message(TS_ERROR, errbuf, errbuf_size, "[TSRemapInit] - Mutex initialization error");
     }
     plugin_init_counter++;
   }
-  return TS_SUCCESS;                     /* success */
+  return TS_SUCCESS; /* success */
 }
 
 // Plugin shutdown
@@ -208,8 +205,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
   fprintf(stderr, "Remap Plugin: TSRemapNewInstance()\n");
 
   if (argc < 2) {
-    return store_my_error_message(TS_ERROR, errbuf, errbuf_size,
-                                  "[TSRemapNewInstance] - Incorrect number of arguments - %d", argc);
+    return store_my_error_message(TS_ERROR, errbuf, errbuf_size, "[TSRemapNewInstance] - Incorrect number of arguments - %d", argc);
   }
   if (!argv || !ih) {
     return store_my_error_message(TS_ERROR, errbuf, errbuf_size, "[TSRemapNewInstance] - Invalid argument(s)");
@@ -227,16 +223,16 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
 
   remap_entry::add_to_list(ri);
 
-  *ih = (void*) ri;
+  *ih = (void *)ri;
 
   return TS_SUCCESS;
 }
 
 /* ---------------------- TSRemapDeleteInstance -------------------------- */
 void
-TSRemapDeleteInstance(void* ih)
+TSRemapDeleteInstance(void *ih)
 {
-  remap_entry *ri = (remap_entry *) ih;
+  remap_entry *ri = (remap_entry *)ih;
 
   fprintf(stderr, "Remap Plugin: TSRemapDeleteInstance()\n");
 
@@ -245,24 +241,25 @@ TSRemapDeleteInstance(void* ih)
   delete ri;
 }
 
-static volatile unsigned long processing_counter = 0;   // sequential counter
+static volatile unsigned long processing_counter = 0; // sequential counter
 static int arg_index = 0;
 
 /* -------------------------- TSRemapDoRemap -------------------------------- */
 TSRemapStatus
-TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
+TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
 {
-  const char* temp;
-  const char* temp2;
+  const char *temp;
+  const char *temp2;
   int len, len2, port;
   TSMLoc cfield;
-  unsigned long _processing_counter = ++processing_counter;     // one more function call (in real life use mutex to protect this counter)
+  unsigned long _processing_counter =
+    ++processing_counter; // one more function call (in real life use mutex to protect this counter)
 
-  remap_entry *ri = (remap_entry *) ih;
+  remap_entry *ri = (remap_entry *)ih;
   fprintf(stderr, "Remap Plugin: TSRemapDoRemap()\n");
 
   if (!ri || !rri)
-    return TSREMAP_NO_REMAP;                   /* TS must remap this request */
+    return TSREMAP_NO_REMAP; /* TS must remap this request */
 
   fprintf(stderr, "[TSRemapDoRemap] From: \"%s\"  To: \"%s\"\n", ri->argv[0], ri->argv[1]);
 
@@ -305,19 +302,18 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
   // How to store plugin private arguments inside Traffic Server request processing block.
   if (TSHttpArgIndexReserve("remap_example", "Example remap plugin", &arg_index) == TS_SUCCESS) {
     fprintf(stderr, "[TSRemapDoRemap] Save processing counter %lu inside request processing block\n", _processing_counter);
-    TSHttpTxnArgSet((TSHttpTxn) rh, arg_index, (void *) _processing_counter); // save counter
+    TSHttpTxnArgSet((TSHttpTxn)rh, arg_index, (void *)_processing_counter); // save counter
   }
   // How to cancel request processing and return error message to the client
   // We wiil do it each other request
   if (_processing_counter & 1) {
-    char* tmp = (char*)TSmalloc(256);
+    char *tmp = (char *)TSmalloc(256);
     static int my_local_counter = 0;
 
-    size_t len = snprintf(tmp, 255,
-                          "This is very small example of TS API usage!\nIteration %d!\nHTTP return code %d\n",
+    size_t len = snprintf(tmp, 255, "This is very small example of TS API usage!\nIteration %d!\nHTTP return code %d\n",
                           my_local_counter, TS_HTTP_STATUS_CONTINUE + my_local_counter);
-    TSHttpTxnSetHttpRetStatus((TSHttpTxn) rh, (TSHttpStatus) ((int) TS_HTTP_STATUS_CONTINUE + my_local_counter));
-    TSHttpTxnErrorBodySet((TSHttpTxn) rh, tmp, len, NULL); // Defaults to text/html
+    TSHttpTxnSetHttpRetStatus((TSHttpTxn)rh, (TSHttpStatus)((int)TS_HTTP_STATUS_CONTINUE + my_local_counter));
+    TSHttpTxnErrorBodySet((TSHttpTxn)rh, tmp, len, NULL); // Defaults to text/html
     my_local_counter++;
   }
   // hardcoded case for remapping
@@ -352,13 +348,13 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
 
 /* ----------------------- TSRemapOSResponse ----------------------------- */
 void
-TSRemapOSResponse(void* ih ATS_UNUSED, TSHttpTxn rh, int os_response_type)
+TSRemapOSResponse(void *ih ATS_UNUSED, TSHttpTxn rh, int os_response_type)
 {
   int request_id = -1;
-  void *data = TSHttpTxnArgGet((TSHttpTxn) rh, arg_index);  // read counter (we store it in TSRemapDoRemap function call)
+  void *data = TSHttpTxnArgGet((TSHttpTxn)rh, arg_index); // read counter (we store it in TSRemapDoRemap function call)
 
   if (data)
-    request_id = *((int*)data);
+    request_id = *((int *)data);
   fprintf(stderr, "[TSRemapOSResponse] Read processing counter %d from request processing block\n", request_id);
   fprintf(stderr, "[TSRemapOSResponse] OS response status: %d\n", os_response_type);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/remap_header_add/remap_header_add.cc
----------------------------------------------------------------------
diff --git a/example/remap_header_add/remap_header_add.cc b/example/remap_header_add/remap_header_add.cc
index 324fd3f..503089e 100644
--- a/example/remap_header_add/remap_header_add.cc
+++ b/example/remap_header_add/remap_header_add.cc
@@ -34,18 +34,17 @@
 #include "ts/ts.h"
 #include "ts/remap.h"
 
-struct remap_line
-{
+struct remap_line {
   int argc;
   char **argv; // store the originals
 
-  int nvc; // the number of name value pairs, should be argc - 2.
+  int nvc;     // the number of name value pairs, should be argc - 2.
   char **name; // at load we will parse out the name and values.
   char **val;
 };
 
 #define TAG "headeradd_remap"
-#define NOWARN_UNUSED __attribute__ ((unused))
+#define NOWARN_UNUSED __attribute__((unused))
 #define EXTERN extern "C"
 
 
@@ -62,7 +61,7 @@ ParseArgIntoNv(const char *arg, char **n, char **v)
   }
 
   size_t name_len = colon_pos - arg;
-  *n = (char *) TSmalloc(name_len + 1);
+  *n = (char *)TSmalloc(name_len + 1);
   memcpy(*n, arg, colon_pos - arg);
   (*n)[name_len] = '\0';
 
@@ -70,11 +69,11 @@ ParseArgIntoNv(const char *arg, char **n, char **v)
 
   // check to see if the value is quoted.
   if (val_len > 1 && colon_pos[1] == '"' && colon_pos[val_len] == '"') {
-    colon_pos++; // advance past the first quote
+    colon_pos++;  // advance past the first quote
     val_len -= 2; // don't include the trailing quote
   }
 
-  *v = (char *) TSmalloc(val_len + 1);
+  *v = (char *)TSmalloc(val_len + 1);
   memcpy(*v, colon_pos + 1, val_len);
   (*v)[val_len] = '\0';
 
@@ -90,7 +89,7 @@ TSRemapInit(NOWARN_UNUSED TSRemapInterface *api_info, NOWARN_UNUSED char *errbuf
 
 
 TSReturnCode
-TSRemapNewInstance(int argc, char* argv[], void** ih, NOWARN_UNUSED char* errbuf, NOWARN_UNUSED int errbuf_size)
+TSRemapNewInstance(int argc, char *argv[], void **ih, NOWARN_UNUSED char *errbuf, NOWARN_UNUSED int errbuf_size)
 {
   remap_line *rl = NULL;
 
@@ -103,35 +102,34 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, NOWARN_UNUSED char* errbuf
 
   // print all arguments for this particular remapping
 
-  rl = (remap_line*) TSmalloc(sizeof(remap_line));
+  rl = (remap_line *)TSmalloc(sizeof(remap_line));
   rl->argc = argc;
   rl->argv = argv;
   rl->nvc = argc - 2; // the first two are the remap from and to
   if (rl->nvc) {
-    rl->name = (char**) TSmalloc(sizeof(char *) * rl->nvc);
-    rl->val = (char**) TSmalloc(sizeof(char *) * rl->nvc);
+    rl->name = (char **)TSmalloc(sizeof(char *) * rl->nvc);
+    rl->val = (char **)TSmalloc(sizeof(char *) * rl->nvc);
   }
 
   TSDebug(TAG, "NewInstance:");
   for (int i = 2; i < argc; i++) {
-    ParseArgIntoNv(argv[i], &rl->name[i-2], &rl->val[i-2]);
+    ParseArgIntoNv(argv[i], &rl->name[i - 2], &rl->val[i - 2]);
   }
 
-  *ih = (void *) rl;
+  *ih = (void *)rl;
 
   return TS_SUCCESS;
 }
 
 
 void
-TSRemapDeleteInstance(void* ih)
+TSRemapDeleteInstance(void *ih)
 {
   TSDebug(TAG, "deleting instance %p", ih);
 
   if (ih) {
-    remap_line *rl = (remap_line*)ih;
-    for (int i = 0; i < rl->nvc; ++i)
-    {
+    remap_line *rl = (remap_line *)ih;
+    for (int i = 0; i < rl->nvc; ++i) {
       TSfree(rl->name[i]);
       TSfree(rl->val[i]);
     }
@@ -144,9 +142,9 @@ TSRemapDeleteInstance(void* ih)
 
 
 TSRemapStatus
-TSRemapDoRemap(void* ih, NOWARN_UNUSED TSHttpTxn txn, NOWARN_UNUSED TSRemapRequestInfo *rri)
+TSRemapDoRemap(void *ih, NOWARN_UNUSED TSHttpTxn txn, NOWARN_UNUSED TSRemapRequestInfo *rri)
 {
-  remap_line *rl = (remap_line *) ih;
+  remap_line *rl = (remap_line *)ih;
 
   if (!rl || !rri) {
     TSError(TAG ": rl or rri is null.");
@@ -167,9 +165,9 @@ TSRemapDoRemap(void* ih, NOWARN_UNUSED TSHttpTxn txn, NOWARN_UNUSED TSRemapReque
 
     TSMLoc field_loc;
     if (TSMimeHdrFieldCreate(req_bufp, req_loc, &field_loc) == TS_SUCCESS) {
-        TSMimeHdrFieldNameSet(req_bufp, req_loc, field_loc, rl->name[i], strlen(rl->name[i]));
-        TSMimeHdrFieldAppend(req_bufp, req_loc, field_loc);
-        TSMimeHdrFieldValueStringInsert(req_bufp, req_loc, field_loc, 0,  rl->val[i], strlen(rl->val[i]));
+      TSMimeHdrFieldNameSet(req_bufp, req_loc, field_loc, rl->name[i], strlen(rl->name[i]));
+      TSMimeHdrFieldAppend(req_bufp, req_loc, field_loc);
+      TSMimeHdrFieldValueStringInsert(req_bufp, req_loc, field_loc, 0, rl->val[i], strlen(rl->val[i]));
     } else {
       TSError(TAG ": Failure on TSMimeHdrFieldCreate");
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/example/replace-header/replace-header.c
----------------------------------------------------------------------
diff --git a/example/replace-header/replace-header.c b/example/replace-header/replace-header.c
index d4bc31b..75ca390 100644
--- a/example/replace-header/replace-header.c
+++ b/example/replace-header/replace-header.c
@@ -81,7 +81,7 @@ done:
 static int
 replace_header_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 {
-  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn)edata;
 
   switch (event) {
   case TS_EVENT_HTTP_READ_RESPONSE_HDR:


[19/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Logger.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Logger.h b/lib/atscppapi/src/include/atscppapi/Logger.h
index f5227d0..9b1265f 100644
--- a/lib/atscppapi/src/include/atscppapi/Logger.h
+++ b/lib/atscppapi/src/include/atscppapi/Logger.h
@@ -57,27 +57,27 @@
  *  // Outputs [file.cc:125, function()] [DEBUG] This is a test DEBUG message: hello.
  * \endcode
  */
-#define LOG_DEBUG(log, fmt, ...) \
-  do { \
-    (log).logDebug("[%s:%d, %s()] " fmt, __FILE__, __LINE__, __FUNCTION__, ## __VA_ARGS__); \
+#define LOG_DEBUG(log, fmt, ...)                                                           \
+  do {                                                                                     \
+    (log).logDebug("[%s:%d, %s()] " fmt, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
   } while (false)
 
 /**
  * A helper macro for Logger objects that allows you to easily add a info level message
  * which will include file, line, and function name with the message. See example in LOG_DEBUG
  */
-#define LOG_INFO(log, fmt, ...) \
-  do { \
-    (log).logInfo("[%s:%d, %s()] " fmt, __FILE__, __LINE__, __FUNCTION__, ## __VA_ARGS__); \
+#define LOG_INFO(log, fmt, ...)                                                           \
+  do {                                                                                    \
+    (log).logInfo("[%s:%d, %s()] " fmt, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
   } while (false)
 
 /**
  * A helper macro for Logger objects that allows you to easily add a error level message
  * which will include file, line, and function name with the message.  See example in LOG_DEBUG
  */
-#define LOG_ERROR(log, fmt, ...) \
-  do { \
-    (log).logError("[%s:%d, %s()] " fmt, __FILE__, __LINE__, __FUNCTION__, ## __VA_ARGS__); \
+#define LOG_ERROR(log, fmt, ...)                                                           \
+  do {                                                                                     \
+    (log).logError("[%s:%d, %s()] " fmt, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
   } while (false)
 
 /**
@@ -87,7 +87,7 @@
  *
  * @private
  */
-extern "C" void TSDebug(const char *tag, const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2,3);
+extern "C" void TSDebug(const char *tag, const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2, 3);
 
 /**
  * We forward declare this because if we didn't we end up writing our
@@ -96,7 +96,7 @@ extern "C" void TSDebug(const char *tag, const char *fmt, ...) ATSCPPAPI_PRINTFL
  *
  * @private
  */
-extern "C" void TSError(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(1,2);
+extern "C" void TSError(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(1, 2);
 
 // This is weird, but see the following:
 //   http://stackoverflow.com/questions/5641427/how-to-make-preprocessor-generate-a-string-for-line-keyword
@@ -109,9 +109,9 @@ extern "C" void TSError(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(1,2);
  * via traffic_server -T "tag.*" or since this macro includes the file can you further refine to an
  * individual file or even a particular line! This can also be enabled via records.config.
  */
-#define TS_DEBUG(tag, fmt, ...) \
-  do { \
-    TSDebug(tag "." __FILE__ ":" LINE_NO , "[%s()] " fmt, __FUNCTION__, ## __VA_ARGS__); \
+#define TS_DEBUG(tag, fmt, ...)                                                        \
+  do {                                                                                 \
+    TSDebug(tag "." __FILE__ ":" LINE_NO, "[%s()] " fmt, __FUNCTION__, ##__VA_ARGS__); \
   } while (false)
 
 /**
@@ -119,14 +119,14 @@ extern "C" void TSError(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(1,2);
  * will also output a DEBUG message visible via traffic_server -T "tag.*", or by enabling the
  * tag in records.config.
  */
-#define TS_ERROR(tag, fmt, ...) \
-  do { \
-    TS_DEBUG(tag, "[ERROR] " fmt, ## __VA_ARGS__); \
-    TSError("[%s] [%s:%d, %s()] " fmt, tag, __FILE__, __LINE__, __FUNCTION__, ## __VA_ARGS__); \
+#define TS_ERROR(tag, fmt, ...)                                                               \
+  do {                                                                                        \
+    TS_DEBUG(tag, "[ERROR] " fmt, ##__VA_ARGS__);                                             \
+    TSError("[%s] [%s:%d, %s()] " fmt, tag, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
   } while (false)
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 struct LoggerState;
 
 /**
@@ -155,17 +155,17 @@ struct LoggerState;
  *   Apply the patch in TS-1813 to correct log rolling in 3.2.x
  *
  */
-class Logger : noncopyable {
+class Logger : noncopyable
+{
 public:
-
   /**
    * The available log levels
    */
   enum LogLevel {
     LOG_LEVEL_NO_LOG = 128, /**< This log level is used to disable all logging */
-    LOG_LEVEL_DEBUG = 1, /**< This log level is used for DEBUG level logging (DEBUG + INFO + ERROR) */
-    LOG_LEVEL_INFO = 2, /**< This log level is used for INFO level logging (INFO + ERROR) */
-    LOG_LEVEL_ERROR = 4 /**< This log level is used for ERROR level logging (ERROR ONLY) */
+    LOG_LEVEL_DEBUG = 1,    /**< This log level is used for DEBUG level logging (DEBUG + INFO + ERROR) */
+    LOG_LEVEL_INFO = 2,     /**< This log level is used for INFO level logging (INFO + ERROR) */
+    LOG_LEVEL_ERROR = 4     /**< This log level is used for ERROR level logging (ERROR ONLY) */
   };
 
   Logger();
@@ -177,7 +177,8 @@ public:
    *
    * @param file The name of the file to create in the logging directory, if you do not specify an extension .log will be used.
    * @param add_timestamp Prepend a timestamp to the log lines, the default value is true.
-   * @param rename_file If a file already exists by the same name it will attempt to rename using a scheme that appends .1, .2, and so on,
+   * @param rename_file If a file already exists by the same name it will attempt to rename using a scheme that appends .1, .2, and
+   *so on,
    *   the default value for this argument is true.
    * @param level the default log level to use when creating the logger, this is set to LOG_LEVEL_INFO by default.
    * @param rolling_enabled if set to true this will enable log rolling on a periodic basis, this is enabled by default.
@@ -185,8 +186,8 @@ public:
    * @return returns true if the logger was successfully created and initialized.
    * @see LogLevel
    */
-  bool init(const std::string &file, bool add_timestamp = true, bool rename_file = true,
-      LogLevel level = LOG_LEVEL_INFO, bool rolling_enabled = true, int rolling_interval_seconds = 3600);
+  bool init(const std::string &file, bool add_timestamp = true, bool rename_file = true, LogLevel level = LOG_LEVEL_INFO,
+            bool rolling_enabled = true, int rolling_interval_seconds = 3600);
 
   /**
    * Allows you to change the rolling interval in seconds
@@ -241,21 +242,22 @@ public:
    * log.logDebug("Hello you are %d years old", 27);
    * \endcode
    */
-  void logDebug(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2,3);
+  void logDebug(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2, 3);
 
   /**
    * This method writes an INFO level message to the log file, the LOG_INFO
    * macro in Logger.h should be used in favor of these when possible because it
    * will produce a much more rich info message.
    */
-  void logInfo(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2,3);
+  void logInfo(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2, 3);
 
   /**
    * This method writes an ERROR level message to the log file, the LOG_ERROR
    * macro in Logger.h should be used in favor of these when possible because it
    * will produce a much more rich error message.
    */
-  void logError(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2,3);
+  void logError(const char *fmt, ...) ATSCPPAPI_PRINTFLIKE(2, 3);
+
 private:
   LoggerState *state_; /**< Internal state for the Logger */
 };
@@ -263,6 +265,4 @@ private:
 } /* atscppapi */
 
 
-
-
 #endif /* ATSCPPAPI_LOGGER_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Mutex.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Mutex.h b/lib/atscppapi/src/include/atscppapi/Mutex.h
index 6044477..5e5f941 100644
--- a/lib/atscppapi/src/include/atscppapi/Mutex.h
+++ b/lib/atscppapi/src/include/atscppapi/Mutex.h
@@ -29,8 +29,8 @@
 #include <atscppapi/noncopyable.h>
 #include <atscppapi/shared_ptr.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @brief A mutex is mutual exclusion: a blocking lock.
  *
@@ -41,16 +41,18 @@ namespace atscppapi {
  * @see ScopedSharedMutexLock
  * @see ScopedSharedMutexTryLock
  */
-class Mutex: noncopyable {
+class Mutex : noncopyable
+{
 public:
-
   /**
    * The available types of Mutexes.
    */
   enum Type {
     TYPE_NORMAL = 0, /**< This type of Mutex will deadlock if locked by a thread already holding the lock */
-    TYPE_RECURSIVE, /**< This type of Mutex will allow a thread holding the lock to lock it again; however, it must be unlocked the same number of times */
-    TYPE_ERROR_CHECK /**< This type of Mutex will return errno = EDEADLCK if a thread would deadlock by taking the lock after it already holds it */
+    TYPE_RECURSIVE,  /**< This type of Mutex will allow a thread holding the lock to lock it again; however, it must be unlocked the
+                        same number of times */
+    TYPE_ERROR_CHECK /**< This type of Mutex will return errno = EDEADLCK if a thread would deadlock by taking the lock after it
+                        already holds it */
   };
 
   /**
@@ -59,51 +61,57 @@ public:
    * @param type The Type of Mutex to create, the default is TYPE_NORMAL.
    * @see Type
    */
-  Mutex(Type type = TYPE_NORMAL) {
+  Mutex(Type type = TYPE_NORMAL)
+  {
     pthread_mutexattr_t attr;
     pthread_mutexattr_init(&attr);
 
-    switch(type) {
+    switch (type) {
     case TYPE_RECURSIVE:
-     pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-     break;
+      pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+      break;
     case TYPE_ERROR_CHECK:
-     pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
-     break;
+      pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
+      break;
     case TYPE_NORMAL:
     default:
-     pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
-     break;
+      pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+      break;
     }
 
     pthread_mutex_init(&mutex, &attr);
   }
 
-  ~Mutex() {
-    pthread_mutex_destroy(&mutex);
-  }
+  ~Mutex() { pthread_mutex_destroy(&mutex); }
 
   /**
    * Try to take the lock, this call will NOT block if the mutex cannot be taken.
    * @return Returns true if the lock was taken, false if it was not. This call obviously will not block.
    */
-  bool tryLock() {
+  bool
+  tryLock()
+  {
     return !pthread_mutex_trylock(&mutex);
   }
 
   /**
    * Block until the lock is taken, when this call returns the thread will be holding the lock.
    */
-  void lock() {
+  void
+  lock()
+  {
     pthread_mutex_lock(&mutex);
   }
 
   /**
    * Unlock the lock, this call is nonblocking.
    */
-  void unlock() {
+  void
+  unlock()
+  {
     pthread_mutex_unlock(&mutex);
   }
+
 private:
   pthread_mutex_t mutex; /**< Internal mutex identifier */
 };
@@ -116,23 +124,20 @@ private:
  *
  * @see Mutex
  */
-class ScopedMutexLock: noncopyable {
+class ScopedMutexLock : noncopyable
+{
 public:
   /**
    * Create the scoped mutex lock, once this object is constructed the lock will be held by the thread.
    * @param mutex a reference to a Mutex.
    */
-  explicit ScopedMutexLock(Mutex &mutex) :
-      mutex_(mutex) {
-    mutex_.lock();
-  }
+  explicit ScopedMutexLock(Mutex &mutex) : mutex_(mutex) { mutex_.lock(); }
 
   /**
    * Unlock the mutex.
    */
-  ~ScopedMutexLock() {
-    mutex_.unlock();
-  }
+  ~ScopedMutexLock() { mutex_.unlock(); }
+
 private:
   Mutex &mutex_;
 };
@@ -145,23 +150,20 @@ private:
  *
  * @see Mutex
  */
-class ScopedSharedMutexLock: noncopyable {
+class ScopedSharedMutexLock : noncopyable
+{
 public:
   /**
    * Create the scoped mutex lock, once this object is constructed the lock will be held by the thread.
    * @param mutex a shared pointer to a Mutex.
    */
-  explicit ScopedSharedMutexLock(shared_ptr<Mutex> mutex) :
-      mutex_(mutex) {
-    mutex_->lock();
-  }
+  explicit ScopedSharedMutexLock(shared_ptr<Mutex> mutex) : mutex_(mutex) { mutex_->lock(); }
 
   /**
    * Unlock the mutex.
    */
-  ~ScopedSharedMutexLock() {
-    mutex_->unlock();
-  }
+  ~ScopedSharedMutexLock() { mutex_->unlock(); }
+
 private:
   shared_ptr<Mutex> mutex_;
 };
@@ -174,21 +176,21 @@ private:
  *
  * @see Mutex
  */
-class ScopedMutexTryLock: noncopyable {
+class ScopedMutexTryLock : noncopyable
+{
 public:
   /**
-   * Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take the lock.
+   * Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take
+   * the lock.
    * @param mutex a shared pointer to a Mutex.
    */
-  explicit ScopedMutexTryLock(Mutex &mutex) :
-      mutex_(mutex), has_lock_(false) {
-    has_lock_ = mutex_.tryLock();
-  }
+  explicit ScopedMutexTryLock(Mutex &mutex) : mutex_(mutex), has_lock_(false) { has_lock_ = mutex_.tryLock(); }
 
   /**
    * Unlock the mutex (if we hold the lock)
    */
-  ~ScopedMutexTryLock() {
+  ~ScopedMutexTryLock()
+  {
     if (has_lock_) {
       mutex_.unlock();
     }
@@ -197,9 +199,12 @@ public:
   /**
    * @return True if the lock was taken, False if it was not taken.
    */
-  bool hasLock() {
+  bool
+  hasLock()
+  {
     return has_lock_;
   }
+
 private:
   Mutex &mutex_;
   bool has_lock_;
@@ -213,21 +218,21 @@ private:
  *
  * @see Mutex
  */
-class ScopedSharedMutexTryLock: noncopyable {
+class ScopedSharedMutexTryLock : noncopyable
+{
 public:
   /**
-   * Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take the lock.
+   * Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take
+   * the lock.
    * @param mutex a shared pointer to a Mutex.
    */
-  explicit ScopedSharedMutexTryLock(shared_ptr<Mutex> mutex) :
-      mutex_(mutex), has_lock_(false) {
-    has_lock_ = mutex_->tryLock();
-  }
+  explicit ScopedSharedMutexTryLock(shared_ptr<Mutex> mutex) : mutex_(mutex), has_lock_(false) { has_lock_ = mutex_->tryLock(); }
 
   /**
    * Unlock the mutex (if we hold the lock)
    */
-  ~ScopedSharedMutexTryLock() {
+  ~ScopedSharedMutexTryLock()
+  {
     if (has_lock_) {
       mutex_->unlock();
     }
@@ -236,9 +241,12 @@ public:
   /**
    * @return True if the lock was taken, False if it was not taken.
    */
-  bool hasLock() {
+  bool
+  hasLock()
+  {
     return has_lock_;
   }
+
 private:
   shared_ptr<Mutex> mutex_;
   bool has_lock_;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Plugin.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Plugin.h b/lib/atscppapi/src/include/atscppapi/Plugin.h
index ce1d943..1800ea5 100644
--- a/lib/atscppapi/src/include/atscppapi/Plugin.h
+++ b/lib/atscppapi/src/include/atscppapi/Plugin.h
@@ -30,8 +30,8 @@
 #include <atscppapi/Transaction.h>
 #include <atscppapi/noncopyable.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @brief The base interface used when creating a Plugin.
  *
@@ -42,7 +42,8 @@ namespace atscppapi {
  * @see GlobalPlugin
  * @see TransformationPlugin
  */
-class Plugin: noncopyable {
+class Plugin : noncopyable
+{
 public:
   /**
    * A enumeration of the available types of Hooks. These are used with GlobalPlugin::registerHook()
@@ -50,68 +51,109 @@ public:
    */
   enum HookType {
     HOOK_READ_REQUEST_HEADERS_PRE_REMAP = 0, /**< This hook will be fired before remap has occured. */
-    HOOK_READ_REQUEST_HEADERS_POST_REMAP, /**< This hook will be fired directly after remap has occured. */
-    HOOK_SEND_REQUEST_HEADERS, /**< This hook will be fired right before request headers are sent to the origin */
+    HOOK_READ_REQUEST_HEADERS_POST_REMAP,    /**< This hook will be fired directly after remap has occured. */
+    HOOK_SEND_REQUEST_HEADERS,               /**< This hook will be fired right before request headers are sent to the origin */
     HOOK_READ_RESPONSE_HEADERS, /**< This hook will be fired right after response headers have been read from the origin */
     HOOK_SEND_RESPONSE_HEADERS, /**< This hook will be fired right before the response headers are sent to the client */
-    HOOK_OS_DNS, /**< This hook will be fired right after the OS DNS lookup */
-    HOOK_READ_REQUEST_HEADERS, /**< This hook will be fired after the request is read. */
-    HOOK_READ_CACHE_HEADERS, /**< This hook will be fired after the CACHE hdrs. */
+    HOOK_OS_DNS,                /**< This hook will be fired right after the OS DNS lookup */
+    HOOK_READ_REQUEST_HEADERS,  /**< This hook will be fired after the request is read. */
+    HOOK_READ_CACHE_HEADERS,    /**< This hook will be fired after the CACHE hdrs. */
     HOOK_CACHE_LOOKUP_COMPLETE, /**< This hook will be fired after caceh lookup complete. */
-    HOOK_SELECT_ALT /**< This hook will be fired after select alt. */
+    HOOK_SELECT_ALT             /**< This hook will be fired after select alt. */
   };
 
   /**
    * This method must be implemented when you hook HOOK_READ_REQUEST_HEADERS_PRE_REMAP
    */
-  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleReadRequestHeadersPreRemap(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_READ_REQUEST_HEADERS_POST_REMAP
    */
-  virtual void handleReadRequestHeadersPostRemap(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleReadRequestHeadersPostRemap(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_SEND_REQUEST_HEADERS
    */
-  virtual void handleSendRequestHeaders(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleSendRequestHeaders(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_READ_RESPONSE_HEADERS
    */
-  virtual void handleReadResponseHeaders(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleReadResponseHeaders(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_SEND_RESPONSE_HEADERS
    */
-  virtual void handleSendResponseHeaders(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleSendResponseHeaders(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_OS_DNS
    */
-  virtual void handleOsDns(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleOsDns(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_READ_REQUEST_HEADERS
    */
-  virtual void handleReadRequestHeaders(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleReadRequestHeaders(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_READ_CACHE_HEADERS
    */
-  virtual void handleReadCacheHeaders(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleReadCacheHeaders(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_CACHE_LOOKUP_COMPLETE
    */
-  virtual void handleReadCacheLookupComplete(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleReadCacheLookupComplete(Transaction &transaction)
+  {
+    transaction.resume();
+  };
 
   /**
    * This method must be implemented when you hook HOOK_SELECT_ALT
    */
-  virtual void handleSelectAlt(Transaction &transaction) { transaction.resume(); };
+  virtual void
+  handleSelectAlt(Transaction &transaction)
+  {
+    transaction.resume();
+  };
+
+  virtual ~Plugin(){};
 
-  virtual ~Plugin() { };
 protected:
   /**
   * \note This interface can never be implemented directly, it should be implemented
@@ -119,7 +161,7 @@ protected:
   *
   * @private
   */
-  Plugin() { };
+  Plugin(){};
 };
 
 /**< Human readable strings for each HookType, you can access them as HOOK_TYPE_STRINGS[HOOK_OS_DNS] for example. */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/PluginInit.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/PluginInit.h b/lib/atscppapi/src/include/atscppapi/PluginInit.h
index 5a4ffb3..a1249b8 100644
--- a/lib/atscppapi/src/include/atscppapi/PluginInit.h
+++ b/lib/atscppapi/src/include/atscppapi/PluginInit.h
@@ -37,7 +37,10 @@ extern "C" {
  */
 void TSPluginInit(int argc, const char *argv[]);
 
-enum TsReturnCode { TS_ERROR = -1, TS_SUCCESS = 0 };
+enum TsReturnCode {
+  TS_ERROR = -1,
+  TS_SUCCESS = 0,
+};
 
 /**
  * Invoked for remap plugins - listed in remap.config. The arguments provided as @pparam
@@ -50,7 +53,6 @@ enum TsReturnCode { TS_ERROR = -1, TS_SUCCESS = 0 };
  * @param errbuf_size Not used
  */
 TsReturnCode TSRemapNewInstance(int argc, char *argv[], void **instance_handle, char *errbuf, int errbuf_size);
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/RemapPlugin.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/RemapPlugin.h b/lib/atscppapi/src/include/atscppapi/RemapPlugin.h
index 3f44f78..5edf8ab 100644
--- a/lib/atscppapi/src/include/atscppapi/RemapPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/RemapPlugin.h
@@ -28,12 +28,13 @@
 #include "atscppapi/Url.h"
 #include "atscppapi/utils.h"
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @brief Base class that remap plugins should extend.
  */
-class RemapPlugin {
+class RemapPlugin
+{
 public:
   /**
    * Constructor
@@ -42,8 +43,13 @@ public:
    */
   RemapPlugin(void **instance_handle);
 
-  enum Result { RESULT_ERROR = 0, RESULT_NO_REMAP, RESULT_DID_REMAP, RESULT_NO_REMAP_STOP,
-                RESULT_DID_REMAP_STOP };
+  enum Result {
+    RESULT_ERROR = 0,
+    RESULT_NO_REMAP,
+    RESULT_DID_REMAP,
+    RESULT_NO_REMAP_STOP,
+    RESULT_DID_REMAP_STOP,
+  };
 
   /**
    * Invoked when a request matches the remap.config line - implementation should perform the
@@ -57,14 +63,15 @@ public:
    *
    * @return Result of the remap - will dictate futher processing by the system.
    */
-  virtual Result doRemap(const Url &map_from_url ATSCPPAPI_UNUSED, const Url &map_to_url ATSCPPAPI_UNUSED, Transaction &transaction ATSCPPAPI_UNUSED,
-                         bool &redirect ATSCPPAPI_UNUSED) {
+  virtual Result
+  doRemap(const Url &map_from_url ATSCPPAPI_UNUSED, const Url &map_to_url ATSCPPAPI_UNUSED,
+          Transaction &transaction ATSCPPAPI_UNUSED, bool &redirect ATSCPPAPI_UNUSED)
+  {
     return RESULT_NO_REMAP;
   }
 
-  virtual ~RemapPlugin() { }
+  virtual ~RemapPlugin() {}
 };
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Request.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Request.h b/lib/atscppapi/src/include/atscppapi/Request.h
index f2aa1bb..bfe1b0a 100644
--- a/lib/atscppapi/src/include/atscppapi/Request.h
+++ b/lib/atscppapi/src/include/atscppapi/Request.h
@@ -29,15 +29,16 @@
 #include <atscppapi/Url.h>
 #include <atscppapi/noncopyable.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 class Transaction;
 struct RequestState;
 
 /**
  * @brief Encapsulates a request.
  */
-class Request: noncopyable {
+class Request : noncopyable
+{
 public:
   Request();
 
@@ -59,6 +60,7 @@ public:
   Headers &getHeaders() const;
 
   ~Request();
+
 private:
   Request(void *hdr_buf, void *hdr_loc);
   RequestState *state_;
@@ -66,7 +68,6 @@ private:
   friend class Transaction;
   friend class ClientRequest;
 };
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Response.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Response.h b/lib/atscppapi/src/include/atscppapi/Response.h
index c6c68f8..5b8582d 100644
--- a/lib/atscppapi/src/include/atscppapi/Response.h
+++ b/lib/atscppapi/src/include/atscppapi/Response.h
@@ -27,16 +27,20 @@
 #include <atscppapi/HttpVersion.h>
 #include <atscppapi/HttpStatus.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 // forward declarations
 struct ResponseState;
-namespace utils { class internal; }
+namespace utils
+{
+  class internal;
+}
 
 /**
  * @brief Encapsulates a response.
  */
-class Response: noncopyable {
+class Response : noncopyable
+{
 public:
   Response();
 
@@ -59,13 +63,13 @@ public:
   Headers &getHeaders() const;
 
   ~Response();
+
 private:
   ResponseState *state_;
   void init(void *hdr_buf, void *hdr_loc);
   friend class Transaction;
   friend class utils::internal;
 };
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Stat.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Stat.h b/lib/atscppapi/src/include/atscppapi/Stat.h
index d665d1a..9789173 100644
--- a/lib/atscppapi/src/include/atscppapi/Stat.h
+++ b/lib/atscppapi/src/include/atscppapi/Stat.h
@@ -27,8 +27,8 @@
 #include <stdint.h>
 #include <string>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @brief A Stat is an atomic variable that can be used to store counters, averages, time averages, or summations.
  *
@@ -46,16 +46,17 @@ namespace atscppapi {
  *
  * A full example is available in examples/stat_example/.
  */
-class Stat : noncopyable {
+class Stat : noncopyable
+{
 public:
   /**
    * The available Stat types.
    */
   enum SyncType {
     SYNC_SUM = 0, /**< The stat will sum all values from a stat.inc(VAL) */
-    SYNC_COUNT, /**< The stat will count all calls to stat.inc(VAL) */
-    SYNC_AVG, /**< The stat will keep an average after call calls to stat.inc(VAL) */
-    SYNC_TIMEAVG /**< The stat will keep a time average of all calls to stat.inc(VAL) */
+    SYNC_COUNT,   /**< The stat will count all calls to stat.inc(VAL) */
+    SYNC_AVG,     /**< The stat will keep an average after call calls to stat.inc(VAL) */
+    SYNC_TIMEAVG  /**< The stat will keep a time average of all calls to stat.inc(VAL) */
   };
 
   Stat();
@@ -96,6 +97,7 @@ public:
    * @param value the value to set the stat to.
    */
   void set(int64_t value);
+
 private:
   int stat_id_; /**< The internal stat ID */
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Transaction.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h
index dbf18b8..a0d7bf7 100644
--- a/lib/atscppapi/src/include/atscppapi/Transaction.h
+++ b/lib/atscppapi/src/include/atscppapi/Transaction.h
@@ -31,12 +31,15 @@
 #include "atscppapi/ClientRequest.h"
 #include "atscppapi/Response.h"
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 // forward declarations
 class TransactionPlugin;
 struct TransactionState;
-namespace utils { class internal; }
+namespace utils
+{
+  class internal;
+}
 
 /**
  * @brief Transactions are the object containing all the state related to a HTTP Transaction
@@ -45,7 +48,8 @@ namespace utils { class internal; }
  * created and destroyed as they are needed. Transactions should never be saved beyond the
  * scope of the function in which they are delivered otherwise undefined behaviour will result.
  */
-class Transaction: noncopyable {
+class Transaction : noncopyable
+{
 public:
   /**
    * @brief ContextValues are a mechanism to share data between plugins using the atscppapi.
@@ -71,9 +75,10 @@ public:
    * take shared pointers you dont have to worry about the cleanup as that will happen automatically so long
    * as you dont have shared_ptrs that cannot go out of scope.
    */
-  class ContextValue {
+  class ContextValue
+  {
   public:
-    virtual ~ContextValue() { }
+    virtual ~ContextValue() {}
   };
 
   ~Transaction();
@@ -234,10 +239,10 @@ public:
    * The available types of timeouts you can set on a Transaction.
    */
   enum TimeoutType {
-    TIMEOUT_DNS = 0, /**< Timeout on DNS */
-    TIMEOUT_CONNECT, /**< Timeout on Connect */
+    TIMEOUT_DNS = 0,     /**< Timeout on DNS */
+    TIMEOUT_CONNECT,     /**< Timeout on Connect */
     TIMEOUT_NO_ACTIVITY, /**< Timeout on No Activity */
-    TIMEOUT_ACTIVE /**< Timeout with Activity */
+    TIMEOUT_ACTIVE       /**< Timeout with Activity */
   };
 
   /**
@@ -301,11 +306,11 @@ public:
   /**
    * Redirect the transaction a different @a url.
    */
-  void redirectTo(std::string const& url);
+  void redirectTo(std::string const &url);
 
 private:
-  TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction
-  friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can call addPlugin()
+  TransactionState *state_;          //!< The internal TransactionState object tied to the current Transaction
+  friend class TransactionPlugin;    //!< TransactionPlugin is a friend so it can call addPlugin()
   friend class TransformationPlugin; //!< TransformationPlugin is a friend so it can call addPlugin()
 
   /**

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h b/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
index 3987927..e2ee048 100644
--- a/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
@@ -29,10 +29,11 @@
 #include <atscppapi/shared_ptr.h>
 #include <atscppapi/Mutex.h>
 
-namespace atscppapi {
-
-namespace utils {
- class internal;
+namespace atscppapi
+{
+namespace utils
+{
+  class internal;
 } /* utils */
 
 /**
@@ -76,7 +77,8 @@ struct TransactionPluginState;
  * @see Plugin
  * @see HookType
  */
-class TransactionPlugin : public Plugin {
+class TransactionPlugin : public Plugin
+{
 public:
   /**
    * registerHook is the mechanism used to attach a transaction hook.
@@ -91,6 +93,7 @@ public:
    */
   void registerHook(Plugin::HookType hook_type);
   virtual ~TransactionPlugin();
+
 protected:
   TransactionPlugin(Transaction &transaction);
 
@@ -102,6 +105,7 @@ protected:
    * TransactionPlugin.
    */
   shared_ptr<Mutex> getMutex();
+
 private:
   TransactionPluginState *state_; /**< The internal state for a TransactionPlugin */
   friend class utils::internal;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/TransformationPlugin.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/TransformationPlugin.h b/lib/atscppapi/src/include/atscppapi/TransformationPlugin.h
index 4c617f7..9295053 100644
--- a/lib/atscppapi/src/include/atscppapi/TransformationPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/TransformationPlugin.h
@@ -28,8 +28,8 @@
 #include <atscppapi/Transaction.h>
 #include <atscppapi/TransactionPlugin.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 struct TransformationPluginState;
 
 /**
@@ -78,14 +78,15 @@ struct TransformationPluginState;
  * @see Type
  * @see HookType
  */
-class TransformationPlugin : public TransactionPlugin {
+class TransformationPlugin : public TransactionPlugin
+{
 public:
   /**
    * The available types of Transformations.
    */
   enum Type {
     REQUEST_TRANSFORMATION = 0, /**< Transform the Request body content */
-    RESPONSE_TRANSFORMATION /**< Transform the Response body content */
+    RESPONSE_TRANSFORMATION     /**< Transform the Response body content */
   };
 
   /**
@@ -102,7 +103,6 @@ public:
 
   virtual ~TransformationPlugin(); /**< Destructor for a TransformationPlugin */
 protected:
-
   /**
    * This method is how a TransformationPlugin will produce output for the downstream
    * transformation plugin, if you need to produce binary data this can still be
@@ -119,6 +119,7 @@ protected:
 
   /** a TransformationPlugin must implement this interface, it cannot be constructed directly */
   TransformationPlugin(Transaction &transaction, Type type);
+
 private:
   TransformationPluginState *state_; /** Internal state for a TransformationPlugin */
   size_t doProduce(const std::string &);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Url.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Url.h b/lib/atscppapi/src/include/atscppapi/Url.h
index 1feadf8..502b80d 100644
--- a/lib/atscppapi/src/include/atscppapi/Url.h
+++ b/lib/atscppapi/src/include/atscppapi/Url.h
@@ -27,8 +27,8 @@
 #include <stdint.h>
 #include <atscppapi/noncopyable.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 struct UrlState;
 
 /**
@@ -42,7 +42,8 @@ struct UrlState;
  * and it can be retrieved via Request::getUrl(). A full example of this
  * is available in examples/detachedrequest/.
  */
-class Url: noncopyable {
+class Url : noncopyable
+{
 public:
   /**
    * @warning Url objects should never be constructed by the user.
@@ -135,6 +136,7 @@ public:
    * \note This method should rarely be used.
    */
   void reset();
+
 private:
   bool isInitialized() const;
   void init(void *hdr_buf, void *url_loc);
@@ -143,7 +145,6 @@ private:
   friend class ClientRequest;
   friend class RemapPlugin;
 };
-
 }
 
 #endif /* ATSCPPAPI_URL_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/noncopyable.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/noncopyable.h b/lib/atscppapi/src/include/atscppapi/noncopyable.h
index 6c1c5f4..620bd25 100644
--- a/lib/atscppapi/src/include/atscppapi/noncopyable.h
+++ b/lib/atscppapi/src/include/atscppapi/noncopyable.h
@@ -26,8 +26,8 @@
 #ifndef ATSCPPAPI_NONCOPYABLE_H_
 #define ATSCPPAPI_NONCOPYABLE_H_
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @brief noncopyable is a base class that will prevent derived classes from being copied.
  *
@@ -53,9 +53,10 @@ class noncopyable
 protected:
   noncopyable() {}
   ~noncopyable() {}
+
 private:
-  noncopyable(const noncopyable&);
-  const noncopyable& operator=(const noncopyable&);
+  noncopyable(const noncopyable &);
+  const noncopyable &operator=(const noncopyable &);
 };
 
 } /* atscppapi */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/shared_ptr.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/shared_ptr.h b/lib/atscppapi/src/include/atscppapi/shared_ptr.h
index 6fa9571..9d17a87 100644
--- a/lib/atscppapi/src/include/atscppapi/shared_ptr.h
+++ b/lib/atscppapi/src/include/atscppapi/shared_ptr.h
@@ -28,22 +28,22 @@
 #include "ink_autoconf.h"
 
 #if HAVE_STD_SHARED_PTR
-#  include <memory>
+#include <memory>
 #else
-#  include <tr1/memory>
+#include <tr1/memory>
 #endif
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * Force the use of std::tr1::shared_ptr
  * \todo Consider adding a simple macro to check if c++0x/11 is enabled
  * and if so change it to std::shared_ptr and #include <memory>s
  */
 #if HAVE_STD_SHARED_PTR
-  using std::shared_ptr;
+using std::shared_ptr;
 #else
-  using std::tr1::shared_ptr;
+using std::tr1::shared_ptr;
 #endif
 
 } /* atscppapi */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/utils.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/utils.h b/lib/atscppapi/src/include/atscppapi/utils.h
index 8c91c1d..b1e44f3 100644
--- a/lib/atscppapi/src/include/atscppapi/utils.h
+++ b/lib/atscppapi/src/include/atscppapi/utils.h
@@ -33,39 +33,39 @@
 
 #ifndef ATSCPPAPI_UNUSED
 #ifdef __GNUC__
-#define ATSCPPAPI_UNUSED __attribute__ ((unused))
+#define ATSCPPAPI_UNUSED __attribute__((unused))
 #else
 #define ATSCPPAPI_UNUSED
 #endif
 #endif
 
-namespace atscppapi {
-namespace utils {
+namespace atscppapi
+{
+namespace utils
+{
+  /**
+   * @brief Returns a pretty printed string of a sockaddr *
+   *
+   * @param sockaddr* A pointer to a sockaddr *
+   * @return a string which is the pretty printed address
+   */
+  std::string getIpString(const sockaddr *);
 
-/**
- * @brief Returns a pretty printed string of a sockaddr *
- *
- * @param sockaddr* A pointer to a sockaddr *
- * @return a string which is the pretty printed address
- */
-std::string getIpString(const sockaddr *);
-
-/**
- * @brief Returns just the port portion of the sockaddr *
- *
- * @param sockaddr* A pointer to a sockaddr *
- * @return a uint16_t which is the port from the sockaddr *
- */
-uint16_t getPort(const sockaddr *);
-
-/**
- * @brief Returns a pretty printed string of a sockaddr * including port
- *
- * @param sockaddr* A pointer to a sockaddr *
- * @return a string which is the pretty printed address including port
- */
-std::string getIpPortString(const sockaddr *);
+  /**
+   * @brief Returns just the port portion of the sockaddr *
+   *
+   * @param sockaddr* A pointer to a sockaddr *
+   * @return a uint16_t which is the port from the sockaddr *
+   */
+  uint16_t getPort(const sockaddr *);
 
+  /**
+   * @brief Returns a pretty printed string of a sockaddr * including port
+   *
+   * @param sockaddr* A pointer to a sockaddr *
+   * @return a string which is the pretty printed address including port
+   */
+  std::string getIpPortString(const sockaddr *);
 }
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/logging_internal.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/logging_internal.h b/lib/atscppapi/src/include/logging_internal.h
index 7a6ac27..3b1dd72 100644
--- a/lib/atscppapi/src/include/logging_internal.h
+++ b/lib/atscppapi/src/include/logging_internal.h
@@ -38,7 +38,7 @@
 #undef LOG_ERROR
 #endif
 
-#define LOG_DEBUG(fmt, ...) TS_DEBUG("atscppapi", fmt, ## __VA_ARGS__)
-#define LOG_ERROR(fmt, ...) TS_ERROR("atscppapi", fmt, ## __VA_ARGS__)
+#define LOG_DEBUG(fmt, ...) TS_DEBUG("atscppapi", fmt, ##__VA_ARGS__)
+#define LOG_ERROR(fmt, ...) TS_ERROR("atscppapi", fmt, ##__VA_ARGS__)
 
 #endif /* ATSCPPAPI_LOGGING_INTERNAL_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/utils_internal.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/utils_internal.h b/lib/atscppapi/src/include/utils_internal.h
index 7cef956..c08636e 100644
--- a/lib/atscppapi/src/include/utils_internal.h
+++ b/lib/atscppapi/src/include/utils_internal.h
@@ -39,61 +39,77 @@
 #include "atscppapi/Transaction.h"
 #include "atscppapi/InterceptPlugin.h"
 
-namespace atscppapi {
-
-namespace utils {
-
-/**
- * @private
- */
-class internal {
-public:
-  static TSHttpHookID convertInternalHookToTsHook(Plugin::HookType);
-  static TSHttpHookID convertInternalTransformationTypeToTsHook(TransformationPlugin::Type type);
-  static void invokePluginForEvent(TransactionPlugin *, TSHttpTxn, TSEvent);
-  static void invokePluginForEvent(GlobalPlugin *, TSHttpTxn, TSEvent);
-  static HttpVersion getHttpVersion(TSMBuffer hdr_buf, TSMLoc hdr_loc);
-  static void initTransactionManagement();
-  static std::string consumeFromTSIOBufferReader(TSIOBufferReader);
-  static shared_ptr<Mutex> getTransactionPluginMutex(TransactionPlugin &);
-  static Transaction &getTransaction(TSHttpTxn);
-
-  static AsyncHttpFetchState *getAsyncHttpFetchState(AsyncHttpFetch &async_http_fetch) {
-    return async_http_fetch.state_;
-  }
-
-  static void initResponse(Response &response, TSMBuffer hdr_buf, TSMLoc hdr_loc) {
-    response.init(hdr_buf, hdr_loc);
-  }
-
-  static void initTransactionServerRequest(Transaction &transaction) {
-    transaction.initServerRequest();
-  }
-
-  static void initTransactionServerResponse(Transaction &transaction) {
-    transaction.initServerResponse();
-  }
-
-  static void initTransactionClientResponse(Transaction &transaction) {
-    transaction.initClientResponse();
-  }
-
-  static const std::list<TransactionPlugin *> &getTransactionPlugins(const Transaction &transaction) {
-    return transaction.getPlugins();
-  }
-
-  static void dispatchInterceptEvent(InterceptPlugin *plugin, TSEvent event, void *edata) {
-    plugin->handleEvent(static_cast<int>(event), edata);
-  }
-
-  static void deleteAsyncHttpFetch(AsyncHttpFetch *fetch) {
-    delete fetch;
-  }
-
-}; /* internal */
+namespace atscppapi
+{
+namespace utils
+{
+  /**
+   * @private
+   */
+  class internal
+  {
+  public:
+    static TSHttpHookID convertInternalHookToTsHook(Plugin::HookType);
+    static TSHttpHookID convertInternalTransformationTypeToTsHook(TransformationPlugin::Type type);
+    static void invokePluginForEvent(TransactionPlugin *, TSHttpTxn, TSEvent);
+    static void invokePluginForEvent(GlobalPlugin *, TSHttpTxn, TSEvent);
+    static HttpVersion getHttpVersion(TSMBuffer hdr_buf, TSMLoc hdr_loc);
+    static void initTransactionManagement();
+    static std::string consumeFromTSIOBufferReader(TSIOBufferReader);
+    static shared_ptr<Mutex> getTransactionPluginMutex(TransactionPlugin &);
+    static Transaction &getTransaction(TSHttpTxn);
+
+    static AsyncHttpFetchState *
+    getAsyncHttpFetchState(AsyncHttpFetch &async_http_fetch)
+    {
+      return async_http_fetch.state_;
+    }
+
+    static void
+    initResponse(Response &response, TSMBuffer hdr_buf, TSMLoc hdr_loc)
+    {
+      response.init(hdr_buf, hdr_loc);
+    }
+
+    static void
+    initTransactionServerRequest(Transaction &transaction)
+    {
+      transaction.initServerRequest();
+    }
+
+    static void
+    initTransactionServerResponse(Transaction &transaction)
+    {
+      transaction.initServerResponse();
+    }
+
+    static void
+    initTransactionClientResponse(Transaction &transaction)
+    {
+      transaction.initClientResponse();
+    }
+
+    static const std::list<TransactionPlugin *> &
+    getTransactionPlugins(const Transaction &transaction)
+    {
+      return transaction.getPlugins();
+    }
+
+    static void
+    dispatchInterceptEvent(InterceptPlugin *plugin, TSEvent event, void *edata)
+    {
+      plugin->handleEvent(static_cast<int>(event), edata);
+    }
+
+    static void
+    deleteAsyncHttpFetch(AsyncHttpFetch *fetch)
+    {
+      delete fetch;
+    }
+
+  }; /* internal */
 
 } /* utils */
-
 }
 
 #endif /* ATSCPPAPI_ATSUTILS_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/utils.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/utils.cc b/lib/atscppapi/src/utils.cc
index 7608281..8ccd5ec 100644
--- a/lib/atscppapi/src/utils.cc
+++ b/lib/atscppapi/src/utils.cc
@@ -26,20 +26,22 @@
 #include <ts/ts.h>
 #include "logging_internal.h"
 
-std::string atscppapi::utils::getIpString(const sockaddr *sockaddress) {
+std::string
+atscppapi::utils::getIpString(const sockaddr *sockaddress)
+{
   if (sockaddress == NULL) {
     LOG_ERROR("Cannot work on NULL sockaddress");
-   return std::string();
+    return std::string();
   }
 
   char buf[INET6_ADDRSTRLEN];
 
   switch (sockaddress->sa_family) {
   case AF_INET:
-    inet_ntop(AF_INET, &(((struct sockaddr_in *) sockaddress)->sin_addr), buf, INET_ADDRSTRLEN);
+    inet_ntop(AF_INET, &(((struct sockaddr_in *)sockaddress)->sin_addr), buf, INET_ADDRSTRLEN);
     return std::string(buf);
   case AF_INET6:
-    inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) sockaddress)->sin6_addr), buf, INET6_ADDRSTRLEN);
+    inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)sockaddress)->sin6_addr), buf, INET6_ADDRSTRLEN);
     return std::string(buf);
   default:
     LOG_ERROR("Unknown Address Family %d", static_cast<int>(sockaddress->sa_family));
@@ -47,23 +49,27 @@ std::string atscppapi::utils::getIpString(const sockaddr *sockaddress) {
   }
 }
 
-uint16_t atscppapi::utils::getPort(const sockaddr *sockaddress) {
+uint16_t
+atscppapi::utils::getPort(const sockaddr *sockaddress)
+{
   if (sockaddress == NULL) {
     LOG_ERROR("Cannot work on NULL sockaddress");
     return 0;
   }
 
   if (sockaddress->sa_family == AF_INET) {
-    return ntohs((((struct sockaddr_in*) sockaddress)->sin_port));
+    return ntohs((((struct sockaddr_in *)sockaddress)->sin_port));
   } else if (sockaddress->sa_family == AF_INET6) {
-    return ntohs((((struct sockaddr_in6*) sockaddress)->sin6_port));
+    return ntohs((((struct sockaddr_in6 *)sockaddress)->sin6_port));
   } else {
     LOG_ERROR("Unknown Address Family %d", static_cast<int>(sockaddress->sa_family));
     return 0;
   }
 }
 
-std::string atscppapi::utils::getIpPortString(const sockaddr *sockaddress) {
+std::string
+atscppapi::utils::getIpPortString(const sockaddr *sockaddress)
+{
   if (sockaddress == NULL) {
     LOG_ERROR("Cannot work on NULL sockaddress");
     return std::string();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/utils_internal.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/utils_internal.cc b/lib/atscppapi/src/utils_internal.cc
index 12538c7..a62e1b8 100644
--- a/lib/atscppapi/src/utils_internal.cc
+++ b/lib/atscppapi/src/utils_internal.cc
@@ -36,19 +36,21 @@
 
 using namespace atscppapi;
 
-namespace {
-
+namespace
+{
 // This is the highest txn arg that can be used, we choose this
 // value to minimize the likelihood of it causing any problems.
 const int MAX_TXN_ARG = 15;
 const int TRANSACTION_STORAGE_INDEX = MAX_TXN_ARG;
 
-int handleTransactionEvents(TSCont cont, TSEvent event, void *edata) {
+int
+handleTransactionEvents(TSCont cont, TSEvent event, void *edata)
+{
   // This function is only here to clean up Transaction objects
   TSHttpTxn ats_txn_handle = static_cast<TSHttpTxn>(edata);
   Transaction &transaction = utils::internal::getTransaction(ats_txn_handle);
-  LOG_DEBUG("Got event %d on continuation %p for transaction (ats pointer %p, object %p)", event, cont,
-            ats_txn_handle, &transaction);
+  LOG_DEBUG("Got event %d on continuation %p for transaction (ats pointer %p, object %p)", event, cont, ats_txn_handle,
+            &transaction);
 
   switch (event) {
   case TS_EVENT_HTTP_POST_REMAP:
@@ -56,7 +58,7 @@ int handleTransactionEvents(TSCont cont, TSEvent event, void *edata) {
     // This is here to force a refresh of the cached client request url
     TSMBuffer hdr_buf;
     TSMLoc hdr_loc;
-    (void) TSHttpTxnClientReqGet(static_cast<TSHttpTxn>(transaction.getAtsHandle()), &hdr_buf, &hdr_loc);
+    (void)TSHttpTxnClientReqGet(static_cast<TSHttpTxn>(transaction.getAtsHandle()), &hdr_buf, &hdr_loc);
     break;
   case TS_EVENT_HTTP_SEND_REQUEST_HDR:
     utils::internal::initTransactionServerRequest(transaction);
@@ -67,21 +69,18 @@ int handleTransactionEvents(TSCont cont, TSEvent event, void *edata) {
   case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
     utils::internal::initTransactionClientResponse(transaction);
     break;
-  case TS_EVENT_HTTP_TXN_CLOSE:
-    { // opening scope to declare plugins variable below
-      const std::list<TransactionPlugin *> &plugins = utils::internal::getTransactionPlugins(transaction);
-      for (std::list<TransactionPlugin *>::const_iterator iter = plugins.begin(), end = plugins.end();
-           iter != end; ++iter) {
-        shared_ptr<Mutex> trans_mutex = utils::internal::getTransactionPluginMutex(**iter);
-        LOG_DEBUG("Locking TransacitonPlugin mutex to delete transaction plugin at %p", *iter);
-        trans_mutex->lock();
-        LOG_DEBUG("Locked Mutex...Deleting transaction plugin at %p", *iter);
-        delete *iter;
-        trans_mutex->unlock();
-      }
-      delete &transaction;
+  case TS_EVENT_HTTP_TXN_CLOSE: { // opening scope to declare plugins variable below
+    const std::list<TransactionPlugin *> &plugins = utils::internal::getTransactionPlugins(transaction);
+    for (std::list<TransactionPlugin *>::const_iterator iter = plugins.begin(), end = plugins.end(); iter != end; ++iter) {
+      shared_ptr<Mutex> trans_mutex = utils::internal::getTransactionPluginMutex(**iter);
+      LOG_DEBUG("Locking TransacitonPlugin mutex to delete transaction plugin at %p", *iter);
+      trans_mutex->lock();
+      LOG_DEBUG("Locked Mutex...Deleting transaction plugin at %p", *iter);
+      delete *iter;
+      trans_mutex->unlock();
     }
-    break;
+    delete &transaction;
+  } break;
   default:
     assert(false); /* we should never get here */
     break;
@@ -90,7 +89,9 @@ int handleTransactionEvents(TSCont cont, TSEvent event, void *edata) {
   return 0;
 }
 
-void setupTransactionManagement() {
+void
+setupTransactionManagement()
+{
   // We must always have a cleanup handler available
   TSMutex mutex = NULL;
   TSCont cont = TSContCreate(handleTransactionEvents, mutex);
@@ -101,7 +102,8 @@ void setupTransactionManagement() {
   TSHttpHookAdd(TS_HTTP_TXN_CLOSE_HOOK, cont);
 }
 
-void inline invokePluginForEvent(Plugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event) {
+void inline invokePluginForEvent(Plugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event)
+{
   Transaction &transaction = utils::internal::getTransaction(ats_txn_handle);
   switch (event) {
   case TS_EVENT_HTTP_PRE_REMAP:
@@ -143,7 +145,9 @@ void inline invokePluginForEvent(Plugin *plugin, TSHttpTxn ats_txn_handle, TSEve
 
 } /* anonymous namespace */
 
-Transaction &utils::internal::getTransaction(TSHttpTxn ats_txn_handle) {
+Transaction &
+utils::internal::getTransaction(TSHttpTxn ats_txn_handle)
+{
   Transaction *transaction = static_cast<Transaction *>(TSHttpTxnArgGet(ats_txn_handle, TRANSACTION_STORAGE_INDEX));
   if (!transaction) {
     transaction = new Transaction(static_cast<void *>(ats_txn_handle));
@@ -153,11 +157,15 @@ Transaction &utils::internal::getTransaction(TSHttpTxn ats_txn_handle) {
   return *transaction;
 }
 
-shared_ptr<Mutex> utils::internal::getTransactionPluginMutex(TransactionPlugin &transaction_plugin) {
+shared_ptr<Mutex>
+utils::internal::getTransactionPluginMutex(TransactionPlugin &transaction_plugin)
+{
   return transaction_plugin.getMutex();
 }
 
-TSHttpHookID utils::internal::convertInternalHookToTsHook(Plugin::HookType hooktype) {
+TSHttpHookID
+utils::internal::convertInternalHookToTsHook(Plugin::HookType hooktype)
+{
   switch (hooktype) {
   case Plugin::HOOK_READ_REQUEST_HEADERS_POST_REMAP:
     return TS_HTTP_POST_REMAP_HOOK;
@@ -186,29 +194,37 @@ TSHttpHookID utils::internal::convertInternalHookToTsHook(Plugin::HookType hookt
   return static_cast<TSHttpHookID>(-1);
 }
 
-TSHttpHookID utils::internal::convertInternalTransformationTypeToTsHook(TransformationPlugin::Type type) {
+TSHttpHookID
+utils::internal::convertInternalTransformationTypeToTsHook(TransformationPlugin::Type type)
+{
   switch (type) {
-    case TransformationPlugin::RESPONSE_TRANSFORMATION:
-      return TS_HTTP_RESPONSE_TRANSFORM_HOOK;
-    case TransformationPlugin::REQUEST_TRANSFORMATION:
-      return TS_HTTP_REQUEST_TRANSFORM_HOOK;
-    default:
-      assert(false); // shouldn't happen, let's catch it early
-      break;
+  case TransformationPlugin::RESPONSE_TRANSFORMATION:
+    return TS_HTTP_RESPONSE_TRANSFORM_HOOK;
+  case TransformationPlugin::REQUEST_TRANSFORMATION:
+    return TS_HTTP_REQUEST_TRANSFORM_HOOK;
+  default:
+    assert(false); // shouldn't happen, let's catch it early
+    break;
   }
   return static_cast<TSHttpHookID>(-1);
 }
 
-void utils::internal::invokePluginForEvent(TransactionPlugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event) {
+void
+utils::internal::invokePluginForEvent(TransactionPlugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event)
+{
   ScopedSharedMutexLock scopedLock(plugin->getMutex());
   ::invokePluginForEvent(static_cast<Plugin *>(plugin), ats_txn_handle, event);
 }
 
-void utils::internal::invokePluginForEvent(GlobalPlugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event) {
+void
+utils::internal::invokePluginForEvent(GlobalPlugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event)
+{
   ::invokePluginForEvent(static_cast<Plugin *>(plugin), ats_txn_handle, event);
 }
 
-std::string utils::internal::consumeFromTSIOBufferReader(TSIOBufferReader reader) {
+std::string
+utils::internal::consumeFromTSIOBufferReader(TSIOBufferReader reader)
+{
   std::string str;
   int avail = TSIOBufferReaderAvail(reader);
 
@@ -236,7 +252,9 @@ std::string utils::internal::consumeFromTSIOBufferReader(TSIOBufferReader reader
 }
 
 
-HttpVersion utils::internal::getHttpVersion(TSMBuffer hdr_buf, TSMLoc hdr_loc) {
+HttpVersion
+utils::internal::getHttpVersion(TSMBuffer hdr_buf, TSMLoc hdr_loc)
+{
   int version = TSHttpHdrVersionGet(hdr_buf, hdr_loc);
   if (version != TS_ERROR) {
     if ((TS_HTTP_MAJOR(version) == 0) && (TS_HTTP_MINOR(version) == 0)) {
@@ -256,7 +274,9 @@ HttpVersion utils::internal::getHttpVersion(TSMBuffer hdr_buf, TSMLoc hdr_loc) {
   return HTTP_VERSION_UNKNOWN;
 }
 
-void utils::internal::initTransactionManagement() {
+void
+utils::internal::initTransactionManagement()
+{
   static pthread_once_t setup_pthread_once_control = PTHREAD_ONCE_INIT;
   pthread_once(&setup_pthread_once_control, setupTransactionManagement);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecAlarms.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecAlarms.h b/lib/records/I_RecAlarms.h
index 25bebb9..21713c4 100644
--- a/lib/records/I_RecAlarms.h
+++ b/lib/records/I_RecAlarms.h
@@ -25,26 +25,26 @@
 #define _I_REC_ALARMS_H_
 
 // copy from mgmt/Alarms.h
-#define REC_ALARM_PROXY_PROCESS_DIED            1
-#define REC_ALARM_PROXY_PROCESS_BORN            2
-#define REC_ALARM_PROXY_PEER_BORN               3
-#define REC_ALARM_PROXY_PEER_DIED               4
-#define REC_ALARM_PROXY_CONFIG_ERROR            5
-#define REC_ALARM_PROXY_SYSTEM_ERROR            6
-#define REC_ALARM_PROXY_LOG_SPACE_CRISIS        7
-#define REC_ALARM_PROXY_CACHE_ERROR             8
-#define REC_ALARM_PROXY_CACHE_WARNING           9
-#define REC_ALARM_PROXY_LOGGING_ERROR           10
-#define REC_ALARM_PROXY_LOGGING_WARNING         11
+#define REC_ALARM_PROXY_PROCESS_DIED 1
+#define REC_ALARM_PROXY_PROCESS_BORN 2
+#define REC_ALARM_PROXY_PEER_BORN 3
+#define REC_ALARM_PROXY_PEER_DIED 4
+#define REC_ALARM_PROXY_CONFIG_ERROR 5
+#define REC_ALARM_PROXY_SYSTEM_ERROR 6
+#define REC_ALARM_PROXY_LOG_SPACE_CRISIS 7
+#define REC_ALARM_PROXY_CACHE_ERROR 8
+#define REC_ALARM_PROXY_CACHE_WARNING 9
+#define REC_ALARM_PROXY_LOGGING_ERROR 10
+#define REC_ALARM_PROXY_LOGGING_WARNING 11
 // Currently unused: 12
-#define REC_ALARM_REC_TEST                      13
-#define REC_ALARM_CONFIG_UPDATE_FAILED          14
-#define REC_ALARM_WEB_ERROR                     15
-#define REC_ALARM_PING_FAILURE	                16
-#define REC_ALARM_REC_CONFIG_ERROR              17
-#define REC_ALARM_ADD_ALARM                     18
-#define REC_ALARM_PROXY_LOG_SPACE_ROLLED        19
-#define REC_ALARM_PROXY_HTTP_CONGESTED_SERVER   20
-#define REC_ALARM_PROXY_HTTP_ALLEVIATED_SERVER  21
+#define REC_ALARM_REC_TEST 13
+#define REC_ALARM_CONFIG_UPDATE_FAILED 14
+#define REC_ALARM_WEB_ERROR 15
+#define REC_ALARM_PING_FAILURE 16
+#define REC_ALARM_REC_CONFIG_ERROR 17
+#define REC_ALARM_ADD_ALARM 18
+#define REC_ALARM_PROXY_LOG_SPACE_ROLLED 19
+#define REC_ALARM_PROXY_HTTP_CONGESTED_SERVER 20
+#define REC_ALARM_PROXY_HTTP_ALLEVIATED_SERVER 21
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index 5b5ffe0..9945cc0 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -36,102 +36,102 @@ struct RecRecord;
 //-------------------------------------------------------------------------
 // Diagnostic Output
 //-------------------------------------------------------------------------
-int RecSetDiags(Diags * diags);
+int RecSetDiags(Diags *diags);
 
 //-------------------------------------------------------------------------
 // Config File Parsing
 //-------------------------------------------------------------------------
-typedef void (*RecConfigEntryCallback)(RecT rec_type, RecDataT data_type, const char * name, const char * value, bool inc_version);
+typedef void (*RecConfigEntryCallback)(RecT rec_type, RecDataT data_type, const char *name, const char *value, bool inc_version);
 
 void RecConfigFileInit(void);
-int RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_version);
+int RecConfigFileParse(const char *path, RecConfigEntryCallback handler, bool inc_version);
 
 // Return a copy of the system's configuration directory, taking proxy.config.config_dir into account. The
 // caller MUST release the result with ats_free().
-char * RecConfigReadConfigDir();
+char *RecConfigReadConfigDir();
 
 // Return a copy of the system's local state directory, taking proxy.config.local_state_dir into account. The
 // caller MUST release the result with ats_free().
-char * RecConfigReadRuntimeDir();
+char *RecConfigReadRuntimeDir();
 
 // Return a copy of the system's snapshot directory, taking proxy.config.snapshot_dir into account. The caller
 // MUST release the result with ats_free().
-char * RecConfigReadSnapshotDir();
+char *RecConfigReadSnapshotDir();
 
 // Return a copy of the system's log directory, taking proxy.config.log.logfile_dir into account. The caller
 // MUST release the result with ats_free().
-char * RecConfigReadLogDir();
+char *RecConfigReadLogDir();
 
 // Return a copy of the system's bin directory, taking proxy.config.bin_path into account. The caller MUST
 // release the result with ats_free().
-char * RecConfigReadBinDir();
+char *RecConfigReadBinDir();
 
 // Return a copy of a configuration file that is relative to sysconfdir. The relative path to the configuration
 // file is specified in the configuration variable named by "file_variable". If the configuration variable has no
 // value, NULL is returned. The caller MUST release the result with ats_free().
-char * RecConfigReadConfigPath(const char * file_variable, const char * default_value = NULL);
+char *RecConfigReadConfigPath(const char *file_variable, const char *default_value = NULL);
 
 // This is the same as RecConfigReadConfigPath, except it makes the paths relative to $PREFIX.
-char * RecConfigReadPrefixPath(const char * file_variable, const char * default_value = NULL);
+char *RecConfigReadPrefixPath(const char *file_variable, const char *default_value = NULL);
 
 // Return a copy of the persistent stats file. This is $RUNTIMEDIR/records.snap.
 // The caller MUST release the result with ats_free().
-char * RecConfigReadPersistentStatsPath();
+char *RecConfigReadPersistentStatsPath();
 
 // Test whether the named configuration value is overridden by an environment variable. Return either
 // the overridden value, or the original value. Caller MUST NOT free the result.
-const char * RecConfigOverrideFromEnvironment(const char * name, const char * value);
+const char *RecConfigOverrideFromEnvironment(const char *name, const char *value);
 
 //-------------------------------------------------------------------------
 // Stat Registration
 //-------------------------------------------------------------------------
 int _RecRegisterStatInt(RecT rec_type, const char *name, RecInt data_default, RecPersistT persist_type);
-#define RecRegisterStatInt(rec_type, name, data_default, persist_type) _RecRegisterStatInt((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
+#define RecRegisterStatInt(rec_type, name, data_default, persist_type) \
+  _RecRegisterStatInt((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
 
 int _RecRegisterStatFloat(RecT rec_type, const char *name, RecFloat data_default, RecPersistT persist_type);
-#define RecRegisterStatFloat(rec_type, name, data_default, persist_type) _RecRegisterStatFloat((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
+#define RecRegisterStatFloat(rec_type, name, data_default, persist_type) \
+  _RecRegisterStatFloat((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
 
 int _RecRegisterStatString(RecT rec_type, const char *name, RecString data_default, RecPersistT persist_type);
-#define RecRegisterStatString(rec_type, name, data_default, persist_type) _RecRegisterStatString((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
+#define RecRegisterStatString(rec_type, name, data_default, persist_type) \
+  _RecRegisterStatString((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
 
 int _RecRegisterStatCounter(RecT rec_type, const char *name, RecCounter data_default, RecPersistT persist_type);
-#define RecRegisterStatCounter(rec_type, name, data_default, persist_type) _RecRegisterStatCounter((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
+#define RecRegisterStatCounter(rec_type, name, data_default, persist_type) \
+  _RecRegisterStatCounter((rec_type), (name), (data_default), REC_PERSISTENCE_TYPE(persist_type))
 
 //-------------------------------------------------------------------------
 // Config Registration
 //-------------------------------------------------------------------------
 
-int RecRegisterConfigInt(RecT rec_type, const char *name,
-                         RecInt data_default, RecUpdateT update_type,
-                         RecCheckT check_type, const char *ccheck_regex, RecAccessT access_type = RECA_NULL);
+int RecRegisterConfigInt(RecT rec_type, const char *name, RecInt data_default, RecUpdateT update_type, RecCheckT check_type,
+                         const char *ccheck_regex, RecAccessT access_type = RECA_NULL);
 
-int RecRegisterConfigFloat(RecT rec_type, const char *name,
-                           RecFloat data_default, RecUpdateT update_type,
-                           RecCheckT check_type, const char *check_regex, RecAccessT access_type = RECA_NULL);
+int RecRegisterConfigFloat(RecT rec_type, const char *name, RecFloat data_default, RecUpdateT update_type, RecCheckT check_type,
+                           const char *check_regex, RecAccessT access_type = RECA_NULL);
 
-int RecRegisterConfigString(RecT rec_type, const char *name,
-                            const char *data_default, RecUpdateT update_type,
-                            RecCheckT check_type, const char *check_regex, RecAccessT access_type = RECA_NULL);
+int RecRegisterConfigString(RecT rec_type, const char *name, const char *data_default, RecUpdateT update_type, RecCheckT check_type,
+                            const char *check_regex, RecAccessT access_type = RECA_NULL);
 
-int RecRegisterConfigCounter(RecT rec_type, const char *name,
-                             RecCounter data_default, RecUpdateT update_type,
-                             RecCheckT check_type, const char *check_regex, RecAccessT access_type = RECA_NULL);
+int RecRegisterConfigCounter(RecT rec_type, const char *name, RecCounter data_default, RecUpdateT update_type, RecCheckT check_type,
+                             const char *check_regex, RecAccessT access_type = RECA_NULL);
 
 //-------------------------------------------------------------------------
 // Config Change Notification
 //-------------------------------------------------------------------------
 
-int RecLinkConfigInt(const char *name, RecInt * rec_int);
-int RecLinkConfigInt32(const char *name, int32_t * p_int32);
-int RecLinkConfigUInt32(const char *name, uint32_t * p_uint32);
-int RecLinkConfigFloat(const char *name, RecFloat * rec_float);
-int RecLinkConfigCounter(const char *name, RecCounter * rec_counter);
-int RecLinkConfigString(const char *name, RecString * rec_string);
-int RecLinkConfigByte(const char *name, RecByte * rec_byte);
-int RecLinkConfigBool(const char *name, RecBool * rec_byte);
+int RecLinkConfigInt(const char *name, RecInt *rec_int);
+int RecLinkConfigInt32(const char *name, int32_t *p_int32);
+int RecLinkConfigUInt32(const char *name, uint32_t *p_uint32);
+int RecLinkConfigFloat(const char *name, RecFloat *rec_float);
+int RecLinkConfigCounter(const char *name, RecCounter *rec_counter);
+int RecLinkConfigString(const char *name, RecString *rec_string);
+int RecLinkConfigByte(const char *name, RecByte *rec_byte);
+int RecLinkConfigBool(const char *name, RecBool *rec_byte);
 
 int RecRegisterConfigUpdateCb(const char *name, RecConfigUpdateCb update_cb, void *cookie);
-int RecRegisterRawStatUpdateFunc(const char *name, RecRawStatBlock * rsb, int id, RecStatUpdateFunc update_func, void *cookie);
+int RecRegisterRawStatUpdateFunc(const char *name, RecRawStatBlock *rsb, int id, RecStatUpdateFunc update_func, void *cookie);
 
 
 //-------------------------------------------------------------------------
@@ -151,33 +151,33 @@ int RecSetRecordFloat(const char *name, RecFloat rec_float, bool lock = true, bo
 int RecSetRecordString(const char *name, const RecString rec_string, bool lock = true, bool inc_version = true);
 int RecSetRecordCounter(const char *name, RecCounter rec_counter, bool lock = true, bool inc_version = true);
 
-int RecGetRecordInt(const char *name, RecInt * rec_int, bool lock = true);
-int RecGetRecordFloat(const char *name, RecFloat * rec_float, bool lock = true);
+int RecGetRecordInt(const char *name, RecInt *rec_int, bool lock = true);
+int RecGetRecordFloat(const char *name, RecFloat *rec_float, bool lock = true);
 int RecGetRecordString(const char *name, char *buf, int buf_len, bool lock = true);
-int RecGetRecordString_Xmalloc(const char *name, RecString * rec_string, bool lock = true);
-int RecGetRecordCounter(const char *name, RecCounter * rec_counter, bool lock = true);
+int RecGetRecordString_Xmalloc(const char *name, RecString *rec_string, bool lock = true);
+int RecGetRecordCounter(const char *name, RecCounter *rec_counter, bool lock = true);
 // Convenience to allow us to treat the RecInt as a single byte internally
-int RecGetRecordByte(const char *name, RecByte * rec_byte, bool lock = true);
+int RecGetRecordByte(const char *name, RecByte *rec_byte, bool lock = true);
 // Convenience to allow us to treat the RecInt as a bool internally
-int RecGetRecordBool(const char *name, RecBool * rec_byte, bool lock = true);
+int RecGetRecordBool(const char *name, RecBool *rec_byte, bool lock = true);
 
 //------------------------------------------------------------------------
 // Record Attributes Reading
 //------------------------------------------------------------------------
 
-int RecLookupRecord(const char *name, void (*callback)(const RecRecord *, void *), void * data, bool lock = true);
+int RecLookupRecord(const char *name, void (*callback)(const RecRecord *, void *), void *data, bool lock = true);
 
-int RecGetRecordType(const char *name, RecT * rec_type, bool lock = true);
-int RecGetRecordDataType(const char *name, RecDataT * data_type, bool lock = true);
-int RecGetRecordPersistenceType(const char *name, RecPersistT * persist_type, bool lock = true);
+int RecGetRecordType(const char *name, RecT *rec_type, bool lock = true);
+int RecGetRecordDataType(const char *name, RecDataT *data_type, bool lock = true);
+int RecGetRecordPersistenceType(const char *name, RecPersistT *persist_type, bool lock = true);
 int RecGetRecordOrderAndId(const char *name, int *order, int *id, bool lock = true);
 
-int RecGetRecordUpdateType(const char *name, RecUpdateT * update_type, bool lock = true);
-int RecGetRecordCheckType(const char *name, RecCheckT * check_type, bool lock = true);
+int RecGetRecordUpdateType(const char *name, RecUpdateT *update_type, bool lock = true);
+int RecGetRecordCheckType(const char *name, RecCheckT *check_type, bool lock = true);
 int RecGetRecordCheckExpr(const char *name, char **check_expr, bool lock = true);
 int RecGetRecordDefaultDataString_Xmalloc(char *name, char **buf, bool lock = true);
 
-int RecGetRecordAccessType(const char *name, RecAccessT * secure, bool lock = true);
+int RecGetRecordAccessType(const char *name, RecAccessT *secure, bool lock = true);
 int RecSetRecordAccessType(const char *name, RecAccessT secure, bool lock = true);
 
 int RecGetRecordPrefix_Xmalloc(char *prefix, char **result, int *result_len);
@@ -188,61 +188,64 @@ int RecGetRecordPrefix_Xmalloc(char *prefix, char **result, int *result_len);
 //------------------------------------------------------------------------
 
 // RecSignalManager always sends a management signal up to traffic_manager.
-void RecSignalManager(int id, const char * , size_t);
+void RecSignalManager(int id, const char *, size_t);
 
 static inline void
-RecSignalManager(int id, const char * str) {
+RecSignalManager(int id, const char *str)
+{
   RecSignalManager(id, str, strlen(str + 1));
 }
 
 // Format a message, and send it to the manager and to the Warning diagnostic.
-void RecSignalWarning(int sig, const char * fmt, ...)
-  TS_PRINTFLIKE(2, 3);
+void RecSignalWarning(int sig, const char *fmt, ...) TS_PRINTFLIKE(2, 3);
 
 //-------------------------------------------------------------------------
 // Backwards Compatibility Items (REC_ prefix)
 //-------------------------------------------------------------------------
-#define REC_ReadConfigInt32(_var,_config_var_name) do { \
-  RecInt tmp = 0; \
-  RecGetRecordInt(_config_var_name, (RecInt*) &tmp); \
-  _var = (int32_t)tmp; \
-} while (0)
-
-#define REC_ReadConfigInteger(_var,_config_var_name) do { \
-  RecInt tmp = 0; \
-  RecGetRecordInt(_config_var_name, &tmp); \
-  _var = tmp; \
-} while (0)
-
-#define REC_ReadConfigFloat(_var,_config_var_name) do { \
-  RecFloat tmp = 0; \
-  RecGetRecordFloat(_config_var_name, &tmp); \
-  _var = tmp; \
-} while (0)
-
-#define REC_ReadConfigStringAlloc(_var,_config_var_name) \
-  RecGetRecordString_Xmalloc(_config_var_name, (RecString*)&_var)
-
-#define REC_ReadConfigString(_var, _config_var_name, _len) \
-  RecGetRecordString(_config_var_name, _var, _len)
-
-#define REC_RegisterConfigUpdateFunc(_config_var_name, func, flag) \
-  RecRegisterConfigUpdateCb(_config_var_name, func, flag)
-
-#define REC_EstablishStaticConfigInteger(_var, _config_var_name) do { \
-  RecLinkConfigInt(_config_var_name, &_var); \
-  _var = (int64_t)REC_ConfigReadInteger(_config_var_name); \
-} while (0)
-
-#define REC_EstablishStaticConfigInt32(_var, _config_var_name) do { \
-  RecLinkConfigInt32(_config_var_name, &_var); \
-  _var = (int32_t)REC_ConfigReadInteger(_config_var_name); \
-} while (0)
-
-#define REC_EstablishStaticConfigInt32U(_var, _config_var_name) do { \
-  RecLinkConfigUInt32(_config_var_name, &_var); \
-  _var = (int32_t)REC_ConfigReadInteger(_config_var_name); \
-} while (0)
+#define REC_ReadConfigInt32(_var, _config_var_name)    \
+  do {                                                 \
+    RecInt tmp = 0;                                    \
+    RecGetRecordInt(_config_var_name, (RecInt *)&tmp); \
+    _var = (int32_t)tmp;                               \
+  } while (0)
+
+#define REC_ReadConfigInteger(_var, _config_var_name) \
+  do {                                                \
+    RecInt tmp = 0;                                   \
+    RecGetRecordInt(_config_var_name, &tmp);          \
+    _var = tmp;                                       \
+  } while (0)
+
+#define REC_ReadConfigFloat(_var, _config_var_name) \
+  do {                                              \
+    RecFloat tmp = 0;                               \
+    RecGetRecordFloat(_config_var_name, &tmp);      \
+    _var = tmp;                                     \
+  } while (0)
+
+#define REC_ReadConfigStringAlloc(_var, _config_var_name) RecGetRecordString_Xmalloc(_config_var_name, (RecString *)&_var)
+
+#define REC_ReadConfigString(_var, _config_var_name, _len) RecGetRecordString(_config_var_name, _var, _len)
+
+#define REC_RegisterConfigUpdateFunc(_config_var_name, func, flag) RecRegisterConfigUpdateCb(_config_var_name, func, flag)
+
+#define REC_EstablishStaticConfigInteger(_var, _config_var_name) \
+  do {                                                           \
+    RecLinkConfigInt(_config_var_name, &_var);                   \
+    _var = (int64_t)REC_ConfigReadInteger(_config_var_name);     \
+  } while (0)
+
+#define REC_EstablishStaticConfigInt32(_var, _config_var_name) \
+  do {                                                         \
+    RecLinkConfigInt32(_config_var_name, &_var);               \
+    _var = (int32_t)REC_ConfigReadInteger(_config_var_name);   \
+  } while (0)
+
+#define REC_EstablishStaticConfigInt32U(_var, _config_var_name) \
+  do {                                                          \
+    RecLinkConfigUInt32(_config_var_name, &_var);               \
+    _var = (int32_t)REC_ConfigReadInteger(_config_var_name);    \
+  } while (0)
 
 /*
  * RecLinkConfigString allocates the RecString and stores the ptr to it (&var).
@@ -251,29 +254,33 @@ void RecSignalWarning(int sig, const char * fmt, ...)
  * For now, we're using the return value to indicate this, even though it's
  * not always the case.  If we're wrong, we'll leak the RecString.
  */
-#define REC_EstablishStaticConfigStringAlloc(_var, _config_var_name) do { \
-  if (RecLinkConfigString(_config_var_name, &_var) == REC_ERR_OKAY) \
-    ats_free(_var);                                                    \
-  _var = (RecString)REC_ConfigReadString(_config_var_name); \
-} while (0)
+#define REC_EstablishStaticConfigStringAlloc(_var, _config_var_name)  \
+  do {                                                                \
+    if (RecLinkConfigString(_config_var_name, &_var) == REC_ERR_OKAY) \
+      ats_free(_var);                                                 \
+    _var = (RecString)REC_ConfigReadString(_config_var_name);         \
+  } while (0)
 
-#define REC_EstablishStaticConfigFloat(_var, _config_var_name) do { \
-  RecLinkConfigFloat(_config_var_name, &_var); \
-  _var = (RecFloat)REC_ConfigReadFloat(_config_var_name); \
-} while (0)
+#define REC_EstablishStaticConfigFloat(_var, _config_var_name) \
+  do {                                                         \
+    RecLinkConfigFloat(_config_var_name, &_var);               \
+    _var = (RecFloat)REC_ConfigReadFloat(_config_var_name);    \
+  } while (0)
 
 // Allow to treat our "INT" configs as a byte type internally. Note
 // that the byte type is just a wrapper around RECD_INT.
-#define REC_EstablishStaticConfigByte(_var, _config_var_name) do { \
-    RecLinkConfigByte(_config_var_name, &_var); \
-    _var = (RecByte)REC_ConfigReadInteger(_config_var_name);    \
+#define REC_EstablishStaticConfigByte(_var, _config_var_name) \
+  do {                                                        \
+    RecLinkConfigByte(_config_var_name, &_var);               \
+    _var = (RecByte)REC_ConfigReadInteger(_config_var_name);  \
   } while (0)
 
 // Allow to treat our "INT" configs as a bool type internally. Note
 // that the bool type is just a wrapper around RECD_INT.
-#define REC_EstablishStaticConfigBool(_var, _config_var_name) do { \
-    RecLinkConfigBool(_config_var_name, &_var); \
-    _var = 0 != REC_ConfigReadInteger(_config_var_name);    \
+#define REC_EstablishStaticConfigBool(_var, _config_var_name) \
+  do {                                                        \
+    RecLinkConfigBool(_config_var_name, &_var);               \
+    _var = 0 != REC_ConfigReadInteger(_config_var_name);      \
   } while (0)
 
 RecInt REC_ConfigReadInteger(const char *name);
@@ -282,10 +289,10 @@ RecFloat REC_ConfigReadFloat(const char *name);
 RecCounter REC_ConfigReadCounter(const char *name);
 
 // MGMT2 Marco's -- converting lmgmt->record_data->readXXX
-RecInt REC_readInteger(const char *name, bool * found, bool lock = true);
-RecFloat REC_readFloat(char *name, bool * found, bool lock = true);
-RecCounter REC_readCounter(char *name, bool * found, bool lock = true);
-RecString REC_readString(const char *name, bool * found, bool lock = true);
+RecInt REC_readInteger(const char *name, bool *found, bool lock = true);
+RecFloat REC_readFloat(char *name, bool *found, bool lock = true);
+RecCounter REC_readCounter(char *name, bool *found, bool lock = true);
+RecString REC_readString(const char *name, bool *found, bool lock = true);
 
 //------------------------------------------------------------------------
 // Clear Statistics
@@ -302,7 +309,7 @@ int RecSetSyncRequired(char *name, bool lock = true);
 //------------------------------------------------------------------------
 // Manager Callback
 //------------------------------------------------------------------------
-typedef void *(*RecManagerCb) (void *opaque_cb_data, char *data_raw, int data_len);
+typedef void *(*RecManagerCb)(void *opaque_cb_data, char *data_raw, int data_len);
 int RecRegisterManagerCb(int _signal, RecManagerCb _fn, void *_data = NULL);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index fedf88f..114153e 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -34,10 +34,9 @@
 //-------------------------------------------------------------------------
 // Error Values
 //-------------------------------------------------------------------------
-enum RecErrT
-{
+enum RecErrT {
   REC_ERR_FAIL = -1,
-  REC_ERR_OKAY = 0
+  REC_ERR_OKAY = 0,
 };
 
 
@@ -54,20 +53,18 @@ typedef int64_t RecCounter;
 typedef int8_t RecByte;
 typedef bool RecBool;
 
-enum RecT
-{
-  RECT_NULL     = 0x00,
-  RECT_CONFIG   = 0x01,
-  RECT_PROCESS  = 0x02,
-  RECT_NODE     = 0x04,
-  RECT_CLUSTER  = 0x08,
-  RECT_LOCAL    = 0x10,
-  RECT_PLUGIN   = 0x20,
-  RECT_ALL      = 0x3F
+enum RecT {
+  RECT_NULL = 0x00,
+  RECT_CONFIG = 0x01,
+  RECT_PROCESS = 0x02,
+  RECT_NODE = 0x04,
+  RECT_CLUSTER = 0x08,
+  RECT_LOCAL = 0x10,
+  RECT_PLUGIN = 0x20,
+  RECT_ALL = 0x3F
 };
 
-enum RecDataT
-{
+enum RecDataT {
   RECD_NULL = 0,
   RECD_INT,
   RECD_FLOAT,
@@ -75,82 +72,73 @@ enum RecDataT
   RECD_COUNTER,
 
 #if defined(STAT_PROCESSOR)
-  RECD_CONST,               // Added for the StatProcessor, store as RECD_FLOAT
-  RECD_FX,                  // Added for the StatProcessor, store as RECD_INT
+  RECD_CONST, // Added for the StatProcessor, store as RECD_FLOAT
+  RECD_FX,    // Added for the StatProcessor, store as RECD_INT
 #endif
   RECD_MAX
 };
 
-enum RecPersistT
-{
+enum RecPersistT {
   RECP_NULL,
   RECP_PERSISTENT,
-  RECP_NON_PERSISTENT
+  RECP_NON_PERSISTENT,
 };
 
 // RECP_NULL should never be used by callers of RecRegisterStat*(). You have to decide
 // whether to persist stats or not. The template goop below make sure that passing RECP_NULL
 // is a very ugle compile-time error.
 
-namespace rec {
-namespace detail {
-template <RecPersistT>
-struct is_valid_persistence;
-
-template<>
-struct is_valid_persistence<RECP_PERSISTENT>
+namespace rec
 {
-  static const RecPersistT value = RECP_PERSISTENT;
-};
-
-template<>
-struct is_valid_persistence<RECP_NON_PERSISTENT>
+namespace detail
 {
-  static const RecPersistT value = RECP_NON_PERSISTENT;
-};
+  template <RecPersistT> struct is_valid_persistence;
 
-}}
+  template <> struct is_valid_persistence<RECP_PERSISTENT> {
+    static const RecPersistT value = RECP_PERSISTENT;
+  };
+
+  template <> struct is_valid_persistence<RECP_NON_PERSISTENT> {
+    static const RecPersistT value = RECP_NON_PERSISTENT;
+  };
+}
+}
 
 #define REC_PERSISTENCE_TYPE(P) rec::detail::is_valid_persistence<P>::value
 
-enum RecUpdateT
-{
-  RECU_NULL,                    // default: don't know the behavior
-  RECU_DYNAMIC,                 // config can be updated dynamically w/ traffic_line -x
-  RECU_RESTART_TS,              // config requires TS to be restarted to take effect
-  RECU_RESTART_TM,              // config requires TM/TS to be restarted to take effect
-  RECU_RESTART_TC               // config requires TC/TM/TS to be restarted to take effect
+enum RecUpdateT {
+  RECU_NULL,       // default: don't know the behavior
+  RECU_DYNAMIC,    // config can be updated dynamically w/ traffic_line -x
+  RECU_RESTART_TS, // config requires TS to be restarted to take effect
+  RECU_RESTART_TM, // config requires TM/TS to be restarted to take effect
+  RECU_RESTART_TC  // config requires TC/TM/TS to be restarted to take effect
 };
 
-enum RecCheckT
-{
-  RECC_NULL,                    // default: no check type defined
-  RECC_STR,                     // config is a string
-  RECC_INT,                     // config is an integer with a range
-  RECC_IP                       // config is an ip address
+enum RecCheckT {
+  RECC_NULL, // default: no check type defined
+  RECC_STR,  // config is a string
+  RECC_INT,  // config is an integer with a range
+  RECC_IP    // config is an ip address
 };
 
-enum RecModeT
-{
+enum RecModeT {
   RECM_NULL,
   RECM_CLIENT,
   RECM_SERVER,
-  RECM_STAND_ALONE
+  RECM_STAND_ALONE,
 };
 
-enum RecAccessT
-{
+enum RecAccessT {
   RECA_NULL,
   RECA_NO_ACCESS,
-  RECA_READ_ONLY
+  RECA_READ_ONLY,
 };
 
 
 //-------------------------------------------------------------------------
 // Data Union
 //-------------------------------------------------------------------------
-union RecData
-{
+union RecData {
   RecInt rec_int;
   RecFloat rec_float;
   RecString rec_string;
@@ -161,14 +149,13 @@ union RecData
 //-------------------------------------------------------------------------
 // RawStat Structures
 //-------------------------------------------------------------------------
-struct RecRawStat
-{
+struct RecRawStat {
   int64_t sum;
   int64_t count;
   // XXX - these will waist some space because they are only needed for the globals
   // this is a fix for bug TS-162, so I am trying to do as few code changes as
   // possible, this should be revisted -bcall
-  int64_t last_sum; // value from the last global sync
+  int64_t last_sum;   // value from the last global sync
   int64_t last_count; // value from the last global sync
   uint32_t version;
 };
@@ -176,12 +163,11 @@ struct RecRawStat
 
 // WARNING!  It's advised that developers do not modify the contents of
 // the RecRawStatBlock.  ^_^
-struct RecRawStatBlock
-{
-  off_t ethr_stat_offset;   // thread local raw-stat storage
-  RecRawStat **global;      // global raw-stat storage (ptr to RecRecord)
-  int num_stats;            // number of stats in this block
-  int max_stats;            // maximum number of stats for this block
+struct RecRawStatBlock {
+  off_t ethr_stat_offset; // thread local raw-stat storage
+  RecRawStat **global;    // global raw-stat storage (ptr to RecRecord)
+  int num_stats;          // number of stats in this block
+  int max_stats;          // maximum number of stats for this block
   ink_mutex mutex;
 };
 
@@ -189,8 +175,8 @@ struct RecRawStatBlock
 //-------------------------------------------------------------------------
 // RecCore Callback Types
 //-------------------------------------------------------------------------
-typedef int (*RecConfigUpdateCb) (const char *name, RecDataT data_type, RecData data, void *cookie);
-typedef int (*RecStatUpdateFunc) (const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id, void *cookie);
-typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData * data, RecRawStatBlock * rsb, int id);
+typedef int (*RecConfigUpdateCb)(const char *name, RecDataT data_type, RecData data, void *cookie);
+typedef int (*RecStatUpdateFunc)(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id, void *cookie);
+typedef int (*RecRawStatSyncCb)(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/I_RecEvents.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecEvents.h b/lib/records/I_RecEvents.h
index 7454b48..1dedd8b 100644
--- a/lib/records/I_RecEvents.h
+++ b/lib/records/I_RecEvents.h
@@ -25,18 +25,18 @@
 #define _I_REC_EVENTS_H_
 
 // copy from mgmt/BaseManager.h
-#define REC_EVENT_SYNC_KEY              10000
-#define REC_EVENT_SHUTDOWN              10001
-#define REC_EVENT_RESTART               10002
-#define REC_EVENT_BOUNCE                10003
-#define REC_EVENT_CLEAR_STATS           10004
-#define REC_EVENT_CONFIG_FILE_UPDATE    10005
-#define REC_EVENT_PLUGIN_CONFIG_UPDATE  10006
-#define REC_EVENT_HTTP_CLUSTER_DELTA    10007
-#define REC_EVENT_ROLL_LOG_FILES        10008
-#define REC_EVENT_LIBRECORDS            10009
-#define REC_EVENT_CONFIG_FILE_UPDATE_NO_INC_VERSION   10010
-
-#define REC_EVENT_CACHE_DISK_CONTROL     10011
+#define REC_EVENT_SYNC_KEY 10000
+#define REC_EVENT_SHUTDOWN 10001
+#define REC_EVENT_RESTART 10002
+#define REC_EVENT_BOUNCE 10003
+#define REC_EVENT_CLEAR_STATS 10004
+#define REC_EVENT_CONFIG_FILE_UPDATE 10005
+#define REC_EVENT_PLUGIN_CONFIG_UPDATE 10006
+#define REC_EVENT_HTTP_CLUSTER_DELTA 10007
+#define REC_EVENT_ROLL_LOG_FILES 10008
+#define REC_EVENT_LIBRECORDS 10009
+#define REC_EVENT_CONFIG_FILE_UPDATE_NO_INC_VERSION 10010
+
+#define REC_EVENT_CACHE_DISK_CONTROL 10011
 
 #endif


[40/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/RamCacheLRU.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/RamCacheLRU.cc b/iocore/cache/RamCacheLRU.cc
index fc3c949..249e193 100644
--- a/iocore/cache/RamCacheLRU.cc
+++ b/iocore/cache/RamCacheLRU.cc
@@ -34,7 +34,7 @@ struct RamCacheLRUEntry {
 
 #define ENTRY_OVERHEAD 128 // per-entry overhead to consider when computing sizes
 
-struct RamCacheLRU: public RamCache {
+struct RamCacheLRU : public RamCache {
   int64_t max_bytes;
   int64_t bytes;
   int64_t objects;
@@ -49,7 +49,7 @@ struct RamCacheLRU: public RamCache {
   // private
   uint16_t *seen;
   Que(RamCacheLRUEntry, lru_link) lru;
-  DList(RamCacheLRUEntry, hash_link) *bucket;
+  DList(RamCacheLRUEntry, hash_link) * bucket;
   int nbuckets;
   int ibuckets;
   Vol *vol;
@@ -57,18 +57,18 @@ struct RamCacheLRU: public RamCache {
   void resize_hashtable();
   RamCacheLRUEntry *remove(RamCacheLRUEntry *e);
 
-  RamCacheLRU():bytes(0), objects(0), seen(0), bucket(0), nbuckets(0), ibuckets(0), vol(NULL) {}
+  RamCacheLRU() : bytes(0), objects(0), seen(0), bucket(0), nbuckets(0), ibuckets(0), vol(NULL) {}
 };
 
 ClassAllocator<RamCacheLRUEntry> ramCacheLRUEntryAllocator("RamCacheLRUEntry");
 
-static const int bucket_sizes[] = {
-  127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139,
-  524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
-  134217689, 268435399, 536870909
-};
+static const int bucket_sizes[] = {127,     251,      509,      1021,     2039,      4093,      8191,     16381,
+                                   32749,   65521,    131071,   262139,   524287,    1048573,   2097143,  4194301,
+                                   8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909};
 
-void RamCacheLRU::resize_hashtable() {
+void
+RamCacheLRU::resize_hashtable()
+{
   int anbuckets = bucket_sizes[ibuckets];
   DDebug("ram_cache", "resize hashtable %d", anbuckets);
   int64_t s = anbuckets * sizeof(DList(RamCacheLRUEntry, hash_link));
@@ -87,13 +87,14 @@ void RamCacheLRU::resize_hashtable() {
   ats_free(seen);
   int size = bucket_sizes[ibuckets] * sizeof(uint16_t);
   if (cache_config_ram_cache_use_seen_filter) {
-    seen = (uint16_t*)ats_malloc(size);
+    seen = (uint16_t *)ats_malloc(size);
     memset(seen, 0, size);
   }
 }
 
 void
-RamCacheLRU::init(int64_t abytes, Vol *avol) {
+RamCacheLRU::init(int64_t abytes, Vol *avol)
+{
   vol = avol;
   max_bytes = abytes;
   DDebug("ram_cache", "initializing ram_cache %" PRId64 " bytes", abytes);
@@ -103,7 +104,8 @@ RamCacheLRU::init(int64_t abytes, Vol *avol) {
 }
 
 int
-RamCacheLRU::get(INK_MD5 * key, Ptr<IOBufferData> *ret_data, uint32_t auxkey1, uint32_t auxkey2) {
+RamCacheLRU::get(INK_MD5 *key, Ptr<IOBufferData> *ret_data, uint32_t auxkey1, uint32_t auxkey2)
+{
   if (!max_bytes)
     return 0;
   uint32_t i = key->slice32(3) % nbuckets;
@@ -124,7 +126,9 @@ RamCacheLRU::get(INK_MD5 * key, Ptr<IOBufferData> *ret_data, uint32_t auxkey1, u
   return 0;
 }
 
-RamCacheLRUEntry * RamCacheLRU::remove(RamCacheLRUEntry *e) {
+RamCacheLRUEntry *
+RamCacheLRU::remove(RamCacheLRUEntry *e)
+{
   RamCacheLRUEntry *ret = e->hash_link.next;
   uint32_t b = e->key.slice32(3) % nbuckets;
   bucket[b].remove(e);
@@ -139,7 +143,9 @@ RamCacheLRUEntry * RamCacheLRU::remove(RamCacheLRUEntry *e) {
 }
 
 // ignore 'copy' since we don't touch the data
-int RamCacheLRU::put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool, uint32_t auxkey1, uint32_t auxkey2) {
+int
+RamCacheLRU::put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool, uint32_t auxkey1, uint32_t auxkey2)
+{
   if (!max_bytes)
     return 0;
   uint32_t i = key->slice32(3) % nbuckets;
@@ -191,7 +197,9 @@ int RamCacheLRU::put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool, uint3
   return 1;
 }
 
-int RamCacheLRU::fixup(INK_MD5 * key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1, uint32_t new_auxkey2) {
+int
+RamCacheLRU::fixup(INK_MD5 *key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1, uint32_t new_auxkey2)
+{
   if (!max_bytes)
     return 0;
   uint32_t i = key->slice32(3) % nbuckets;
@@ -207,6 +215,8 @@ int RamCacheLRU::fixup(INK_MD5 * key, uint32_t old_auxkey1, uint32_t old_auxkey2
   return 0;
 }
 
-RamCache *new_RamCacheLRU() {
+RamCache *
+new_RamCacheLRU()
+{
   return new RamCacheLRU;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/Store.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc
index debe16c..2fac7b4 100644
--- a/iocore/cache/Store.cc
+++ b/iocore/cache/Store.cc
@@ -40,10 +40,13 @@ static span_error_t
 make_span_error(int error)
 {
   switch (error) {
-  case ENOENT: return SPAN_ERROR_NOT_FOUND;
+  case ENOENT:
+    return SPAN_ERROR_NOT_FOUND;
   case EPERM: /* fallthru */
-  case EACCES: return SPAN_ERROR_NO_ACCESS;
-  default: return SPAN_ERROR_UNKNOWN;
+  case EACCES:
+    return SPAN_ERROR_NO_ACCESS;
+  default:
+    return SPAN_ERROR_UNKNOWN;
   }
 }
 
@@ -51,31 +54,38 @@ static const char *
 span_file_typename(mode_t st_mode)
 {
   switch (st_mode & S_IFMT) {
-  case S_IFBLK: return "block device";
-  case S_IFCHR: return "character device";
-  case S_IFDIR: return "directory";
-  case S_IFREG: return "file";
-  default: return "<unsupported>";
+  case S_IFBLK:
+    return "block device";
+  case S_IFCHR:
+    return "character device";
+  case S_IFDIR:
+    return "directory";
+  case S_IFREG:
+    return "file";
+  default:
+    return "<unsupported>";
   }
 }
 
 Ptr<ProxyMutex> tmp_p;
-Store::Store():n_disks(0), disk(NULL)
+Store::Store()
+  : n_disks(0), disk(NULL)
 #if TS_USE_INTERIM_CACHE == 1
-              ,n_interim_disks(0), interim_disk(NULL)
+    ,
+    n_interim_disks(0), interim_disk(NULL)
 #endif
 {
 }
 
 void
-Store::add(Span * ds)
+Store::add(Span *ds)
 {
   extend(n_disks + 1);
   disk[n_disks - 1] = ds;
 }
 
 void
-Store::add(Store & s)
+Store::add(Store &s)
 {
   // assume on different disks
   for (unsigned i = 0; i < s.n_disks; i++) {
@@ -86,17 +96,16 @@ Store::add(Store & s)
 }
 
 
-
 // should be changed to handle offset in more general
 // case (where this is not a free of a "just" allocated
 // store
 void
-Store::free(Store & s)
+Store::free(Store &s)
 {
   for (unsigned i = 0; i < s.n_disks; i++) {
-    for (Span * sd = s.disk[i]; sd; sd = sd->link.next) {
+    for (Span *sd = s.disk[i]; sd; sd = sd->link.next) {
       for (unsigned j = 0; j < n_disks; j++)
-        for (Span * d = disk[j]; d; d = d->link.next)
+        for (Span *d = disk[j]; d; d = d->link.next)
           if (!strcmp(sd->pathname, d->pathname)) {
             if (sd->offset < d->offset)
               d->offset = sd->offset;
@@ -104,7 +113,8 @@ Store::free(Store & s)
             goto Lfound;
           }
       ink_release_assert(!"Store::free failed");
-    Lfound:;
+    Lfound:
+      ;
     }
   }
 }
@@ -112,7 +122,7 @@ Store::free(Store & s)
 void
 Store::sort()
 {
-  Span **vec = (Span **) alloca(sizeof(Span *) * n_disks);
+  Span **vec = (Span **)alloca(sizeof(Span *) * n_disks);
   memset(vec, 0, sizeof(Span *) * n_disks);
   for (unsigned i = 0; i < n_disks; i++) {
     vec[i] = disk[i];
@@ -123,7 +133,7 @@ Store::sort()
 
   unsigned n = 0;
   for (unsigned i = 0; i < n_disks; i++) {
-    for (Span * sd = vec[i]; sd; sd = vec[i]) {
+    for (Span *sd = vec[i]; sd; sd = vec[i]) {
       vec[i] = vec[i]->link.next;
       for (unsigned d = 0; d < n; d++) {
         if (sd->disk_id == disk[d]->disk_id) {
@@ -133,7 +143,8 @@ Store::sort()
         }
       }
       disk[n++] = sd;
-    Ldone:;
+    Ldone:
+      ;
     }
   }
   n_disks = n;
@@ -142,12 +153,11 @@ Store::sort()
 
   for (unsigned i = 0; i < n_disks; i++) {
   Lagain:
-    Span * prev = 0;
-    for (Span * sd = disk[i]; sd;) {
+    Span *prev = 0;
+    for (Span *sd = disk[i]; sd;) {
       Span *next = sd->link.next;
       if (next &&
-          ((strcmp(sd->pathname, next->pathname) < 0) ||
-           (!strcmp(sd->pathname, next->pathname) && sd->offset > next->offset))) {
+          ((strcmp(sd->pathname, next->pathname) < 0) || (!strcmp(sd->pathname, next->pathname) && sd->offset > next->offset))) {
         if (!prev) {
           disk[i] = next;
           sd->link.next = next->link.next;
@@ -167,7 +177,7 @@ Store::sort()
   // merge adjacent spans
 
   for (unsigned i = 0; i < n_disks; i++) {
-    for (Span * sd = disk[i]; sd;) {
+    for (Span *sd = disk[i]; sd;) {
       Span *next = sd->link.next;
       if (next && !strcmp(sd->pathname, next->pathname)) {
         if (!sd->file_pathname) {
@@ -211,7 +221,7 @@ Span::errorstr(span_error_t serr)
 }
 
 int
-Span::path(char *filename, int64_t * aoffset, char *buf, int buflen)
+Span::path(char *filename, int64_t *aoffset, char *buf, int buflen)
 {
   ink_assert(!aoffset);
   Span *ds = this;
@@ -228,7 +238,7 @@ Span::path(char *filename, int64_t * aoffset, char *buf, int buflen)
 }
 
 void
-Span::hash_base_string_set(char const* s)
+Span::hash_base_string_set(char const *s)
 {
   hash_base_string = s ? ats_strdup(s) : NULL;
 }
@@ -263,7 +273,7 @@ Span::~Span()
 }
 
 static int
-get_int64(int fd, int64_t & data)
+get_int64(int fd, int64_t &data)
 {
   char buf[PATH_NAME_MAX + 1];
   if (ink_file_fd_readline(fd, PATH_NAME_MAX, buf) <= 0)
@@ -284,7 +294,7 @@ Store::remove(char *n)
 Lagain:
   for (unsigned i = 0; i < n_disks; i++) {
     Span *p = NULL;
-    for (Span * sd = disk[i]; sd; sd = sd->link.next) {
+    for (Span *sd = disk[i]; sd; sd = sd->link.next) {
       if (!strcmp(n, sd->pathname)) {
         found = true;
         if (p)
@@ -325,15 +335,16 @@ Store::read_config()
   char line[1024];
   int len;
   while ((len = ink_file_fd_readline(fd, sizeof(line), line)) > 0) {
-    char const* path;
-    char const* seed = 0;
+    char const *path;
+    char const *seed = 0;
     // update lines
 
     ++ln;
 
     // Because the SimpleTokenizer is a bit too simple, we have to normalize whitespace.
-    for ( char *spot = line, *limit = line+len ; spot < limit ; ++spot )
-      if (ParseRules::is_space(*spot)) *spot = ' '; // force whitespace to literal space.
+    for (char *spot = line, *limit = line + len; spot < limit; ++spot)
+      if (ParseRules::is_space(*spot))
+        *spot = ' '; // force whitespace to literal space.
 
     SimpleTokenizer tokens(line, ' ', SimpleTokenizer::OVERWRITE_INPUT_STRING);
 
@@ -347,21 +358,23 @@ Store::read_config()
 
     int64_t size = -1;
     int volume_num = -1;
-    char const* e;
+    char const *e;
     while (0 != (e = tokens.getNext())) {
       if (ParseRules::is_digit(*e)) {
         if ((size = ink_atoi64(e)) <= 0) {
           err = "error parsing size";
           goto Lfail;
         }
-      } else if (0 == strncasecmp(HASH_BASE_STRING_KEY, e, sizeof(HASH_BASE_STRING_KEY)-1)) {
+      } else if (0 == strncasecmp(HASH_BASE_STRING_KEY, e, sizeof(HASH_BASE_STRING_KEY) - 1)) {
         e += sizeof(HASH_BASE_STRING_KEY) - 1;
-        if ('=' == *e) ++e;
+        if ('=' == *e)
+          ++e;
         if (*e && !ParseRules::is_space(*e))
           seed = e;
-      } else if (0 == strncasecmp(VOLUME_KEY, e, sizeof(VOLUME_KEY)-1)) {
+      } else if (0 == strncasecmp(VOLUME_KEY, e, sizeof(VOLUME_KEY) - 1)) {
         e += sizeof(VOLUME_KEY) - 1;
-        if ('=' == *e) ++e;
+        if ('=' == *e)
+          ++e;
         if (!*e || !ParseRules::is_digit(*e) || 0 >= (volume_num = ink_atoi(e))) {
           err = "error parsing volume number";
           goto Lfail;
@@ -371,8 +384,8 @@ Store::read_config()
 
     char *pp = Layout::get()->relative(path);
     ns = new Span;
-    Debug("cache_init", "Store::read_config - ns = new Span; ns->init(\"%s\",%" PRId64 "), forced volume=%d%s%s",
-          pp, size, volume_num, seed ? " id=" : "", seed ? seed : "");
+    Debug("cache_init", "Store::read_config - ns = new Span; ns->init(\"%s\",%" PRId64 "), forced volume=%d%s%s", pp, size,
+          volume_num, seed ? " id=" : "", seed ? seed : "");
     if ((err = ns->init(pp, size))) {
       RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "could not initialize storage \"%s\" [%s]", pp, err);
       Debug("cache_init", "Store::read_config - could not initialize storage \"%s\" [%s]", pp, err);
@@ -384,8 +397,10 @@ Store::read_config()
     n_dsstore++;
 
     // Set side values if present.
-    if (seed) ns->hash_base_string_set(seed);
-    if (volume_num > 0) ns->volume_number_set(volume_num);
+    if (seed)
+      ns->hash_base_string_set(seed);
+    if (volume_num > 0)
+      ns->volume_number_set(volume_num);
 
     // new Span
     {
@@ -402,7 +417,7 @@ Store::read_config()
   extend(n_dsstore);
   cur = sd;
   while (cur) {
-    Span* next = cur->link.next;
+    Span *next = cur->link.next;
     cur->link.next = NULL;
     disk[i++] = cur;
     cur = next;
@@ -421,7 +436,8 @@ Lfail:
 
 #if TS_USE_INTERIM_CACHE == 1
 const char *
-Store::read_interim_config() {
+Store::read_interim_config()
+{
   char p[PATH_NAME_MAX + 1];
   Span *sd = NULL;
   Span *ns;
@@ -449,7 +465,7 @@ Store::read_interim_config() {
   }
 
   n_interim_disks = interim_store;
-  interim_disk = (Span **) ats_malloc(interim_store * sizeof(Span *));
+  interim_disk = (Span **)ats_malloc(interim_store * sizeof(Span *));
   {
     int i = 0;
     while (sd) {
@@ -467,9 +483,9 @@ int
 Store::write_config_data(int fd) const
 {
   for (unsigned i = 0; i < n_disks; i++)
-    for (Span * sd = disk[i]; sd; sd = sd->link.next) {
+    for (Span *sd = disk[i]; sd; sd = sd->link.next) {
       char buf[PATH_NAME_MAX + 64];
-      snprintf(buf, sizeof(buf), "%s %" PRId64 "\n", sd->pathname.get(), (int64_t) sd->blocks * (int64_t) STORE_BLOCK_SIZE);
+      snprintf(buf, sizeof(buf), "%s %" PRId64 "\n", sd->pathname.get(), (int64_t)sd->blocks * (int64_t)STORE_BLOCK_SIZE);
       if (ink_file_fd_writestring(fd, buf) == -1)
         return (-1);
     }
@@ -477,11 +493,11 @@ Store::write_config_data(int fd) const
 }
 
 const char *
-Span::init(const char * path, int64_t size)
+Span::init(const char *path, int64_t size)
 {
-  struct stat     sbuf;
-  struct statvfs  vbuf;
-  span_error_t    serr;
+  struct stat sbuf;
+  struct statvfs vbuf;
+  span_error_t serr;
   ink_device_geometry geometry;
 
   ats_scoped_fd fd(socketManager.open(path, O_RDONLY));
@@ -596,7 +612,7 @@ Span::init(const char * path, int64_t size)
     int64_t newsz = MIN(size, this->size());
 
     Note("cache %s '%s' is %" PRId64 " bytes, but the configured size is %" PRId64 " bytes, using the minimum",
-      span_file_typename(sbuf.st_mode), path, this->size(), size);
+         span_file_typename(sbuf.st_mode), path, this->size(), size);
 
     this->blocks = newsz / STORE_BLOCK_SIZE;
   }
@@ -607,7 +623,7 @@ Span::init(const char * path, int64_t size)
 
   Debug("cache_init", "initialized span '%s'", this->pathname.get());
   Debug("cache_init", "hw_sector_size=%d, size=%" PRId64 ", blocks=%" PRId64 ", disk_id=%" PRId64 "/%" PRId64 ", file_pathname=%d",
-    this->hw_sector_size, this->size(), this->blocks, this->disk_id[0], this->disk_id[1], this->file_pathname);
+        this->hw_sector_size, this->size(), this->blocks, this->disk_id[0], this->disk_id[1], this->file_pathname);
 
   return NULL;
 
@@ -628,13 +644,13 @@ Store::normalize()
 }
 
 static unsigned int
-try_alloc(Store & target, Span * source, unsigned int start_blocks, bool one_only = false)
+try_alloc(Store &target, Span *source, unsigned int start_blocks, bool one_only = false)
 {
   unsigned int blocks = start_blocks;
   Span *ds = NULL;
   while (source && blocks) {
     if (source->blocks) {
-      unsigned int a;           // allocated
+      unsigned int a; // allocated
       if (blocks > source->blocks)
         a = source->blocks;
       else
@@ -660,7 +676,7 @@ try_alloc(Store & target, Span * source, unsigned int start_blocks, bool one_onl
 }
 
 void
-Store::spread_alloc(Store & s, unsigned int blocks, bool mmapable)
+Store::spread_alloc(Store &s, unsigned int blocks, bool mmapable)
 {
   //
   // Count the eligable disks..
@@ -695,13 +711,13 @@ Store::spread_alloc(Store & s, unsigned int blocks, bool mmapable)
 }
 
 void
-Store::try_realloc(Store & s, Store & diff)
+Store::try_realloc(Store &s, Store &diff)
 {
   for (unsigned i = 0; i < s.n_disks; i++) {
     Span *prev = 0;
-    for (Span * sd = s.disk[i]; sd;) {
+    for (Span *sd = s.disk[i]; sd;) {
       for (unsigned j = 0; j < n_disks; j++)
-        for (Span * d = disk[j]; d; d = d->link.next)
+        for (Span *d = disk[j]; d; d = d->link.next)
           if (!strcmp(sd->pathname, d->pathname)) {
             if (sd->offset >= d->offset && (sd->end() <= d->end())) {
               if (!sd->file_pathname || (sd->end() == d->end())) {
@@ -734,7 +750,8 @@ Store::try_realloc(Store & s, Store & diff)
         sd = prev ? prev->link.next : s.disk[i];
         continue;
       }
-    Lfound:;
+    Lfound:
+      ;
       prev = sd;
       sd = sd->link.next;
     }
@@ -748,7 +765,7 @@ Store::try_realloc(Store & s, Store & diff)
 // Stupid grab first availabled space allocator
 //
 void
-Store::alloc(Store & s, unsigned int blocks, bool one_only, bool mmapable)
+Store::alloc(Store &s, unsigned int blocks, bool one_only, bool mmapable)
 {
   unsigned int oblocks = blocks;
   for (unsigned i = 0; blocks && i < n_disks; i++) {
@@ -782,7 +799,7 @@ Span::write(int fd) const
   if (ink_file_fd_writestring(fd, buf) == -1)
     return (-1);
 
-  snprintf(buf, sizeof(buf), "%d\n", (int) is_mmapable());
+  snprintf(buf, sizeof(buf), "%d\n", (int)is_mmapable());
   if (ink_file_fd_writestring(fd, buf) == -1)
     return (-1);
 
@@ -939,7 +956,7 @@ Span::dup()
 }
 
 void
-Store::dup(Store & s)
+Store::dup(Store &s)
 {
   s.n_disks = n_disks;
   s.disk = (Span **)ats_malloc(sizeof(Span *) * n_disks);
@@ -963,7 +980,7 @@ Store::clear(char *filename, bool clear_dirs)
       int r = d->path(filename, NULL, path, PATH_NAME_MAX);
       if (r < 0)
         return -1;
-      int fd =::open(path, O_RDWR | O_CREAT, 0644);
+      int fd = ::open(path, O_RDWR | O_CREAT, 0644);
       if (fd < 0)
         return -1;
       for (int b = 0; d->blocks; b++)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterAPI.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterAPI.cc b/iocore/cluster/ClusterAPI.cc
index 3345713..7c08330 100644
--- a/iocore/cluster/ClusterAPI.cc
+++ b/iocore/cluster/ClusterAPI.cc
@@ -26,7 +26,7 @@
 
   ClusterAPI.cc
 
-	Support for Cluster RPC API.
+        Support for Cluster RPC API.
 ****************************************************************************/
 #include "P_Cluster.h"
 
@@ -35,17 +35,16 @@
 class ClusterAPIPeriodicSM;
 static void send_machine_online_list(TSClusterStatusHandle_t *);
 
-typedef struct node_callout_entry
-{
+typedef struct node_callout_entry {
   Ptr<ProxyMutex> mutex;
   TSClusterStatusFunction func;
-  int state;                    // See NE_STATE_XXX defines
+  int state; // See NE_STATE_XXX defines
 } node_callout_entry_t;
 
-#define NE_STATE_FREE			0
-#define NE_STATE_INITIALIZED		1
+#define NE_STATE_FREE 0
+#define NE_STATE_INITIALIZED 1
 
-#define MAX_CLUSTERSTATUS_CALLOUTS 	32
+#define MAX_CLUSTERSTATUS_CALLOUTS 32
 
 static ProxyMutex *ClusterAPI_mutex;
 static ClusterAPIPeriodicSM *periodicSM;
@@ -54,21 +53,17 @@ static node_callout_entry_t status_callouts[MAX_CLUSTERSTATUS_CALLOUTS];
 static TSClusterRPCFunction RPC_Functions[API_END_CLUSTER_FUNCTION];
 
 #define INDEX_TO_CLUSTER_STATUS_HANDLE(i) ((TSClusterStatusHandle_t)((i)))
-#define CLUSTER_STATUS_HANDLE_TO_INDEX(h) ((int) ((h)))
-#define NODE_HANDLE_TO_IP(h) (*((struct in_addr *) &((h))))
+#define CLUSTER_STATUS_HANDLE_TO_INDEX(h) ((int)((h)))
+#define NODE_HANDLE_TO_IP(h) (*((struct in_addr *)&((h))))
 #define RPC_FUNCTION_KEY_TO_CLUSTER_NUMBER(k) ((int)((k)))
 #define IP_TO_NODE_HANDLE(ip) ((TSNodeHandle_t)((ip)))
-#define SIZEOF_RPC_MSG_LESS_DATA (sizeof(TSClusterRPCMsg_t) - \
-	 (sizeof(TSClusterRPCMsg_t) - sizeof(TSClusterRPCHandle_t)))
+#define SIZEOF_RPC_MSG_LESS_DATA (sizeof(TSClusterRPCMsg_t) - (sizeof(TSClusterRPCMsg_t) - sizeof(TSClusterRPCHandle_t)))
 
-typedef struct RPCHandle
-{
-  union
-  {                             // Note: All union elements are assumed to be the same size
+typedef struct RPCHandle {
+  union { // Note: All union elements are assumed to be the same size
     //       sizeof(u.internal) == sizeof(u.external)
     TSClusterRPCHandle_t external;
-    struct real_format
-    {
+    struct real_format {
       int cluster_function;
       int magic;
     } internal;
@@ -78,39 +73,35 @@ typedef struct RPCHandle
 #define RPC_HANDLE_MAGIC 0x12345678
 
 class MachineStatusSM;
-typedef int (MachineStatusSM::*MachineStatusSMHandler) (int, void *);
-class MachineStatusSM:public Continuation
+typedef int (MachineStatusSM::*MachineStatusSMHandler)(int, void *);
+class MachineStatusSM : public Continuation
 {
 public:
   // Broadcast constructor
-  MachineStatusSM(TSNodeHandle_t h, TSNodeStatus_t s):_node_handle(h), _node_status(s), _status_handle(0),
-    _broadcast(1), _restart(0), _next_n(0)
+  MachineStatusSM(TSNodeHandle_t h, TSNodeStatus_t s)
+    : _node_handle(h), _node_status(s), _status_handle(0), _broadcast(1), _restart(0), _next_n(0)
   {
-    SET_HANDLER((MachineStatusSMHandler)
-                & MachineStatusSM::MachineStatusSMEvent);
+    SET_HANDLER((MachineStatusSMHandler)&MachineStatusSM::MachineStatusSMEvent);
   }
   // Unicast constructor
-  MachineStatusSM(TSNodeHandle_t h, TSNodeStatus_t s,
-                  TSClusterStatusHandle_t sh):_node_handle(h), _node_status(s), _status_handle(sh),
-    _broadcast(0), _restart(0), _next_n(0)
+  MachineStatusSM(TSNodeHandle_t h, TSNodeStatus_t s, TSClusterStatusHandle_t sh)
+    : _node_handle(h), _node_status(s), _status_handle(sh), _broadcast(0), _restart(0), _next_n(0)
   {
-    SET_HANDLER((MachineStatusSMHandler)
-                & MachineStatusSM::MachineStatusSMEvent);
+    SET_HANDLER((MachineStatusSMHandler)&MachineStatusSM::MachineStatusSMEvent);
   }
   // Send machine online list constructor
-MachineStatusSM(TSClusterStatusHandle_t sh):
-  _node_handle(0), _node_status(NODE_ONLINE), _status_handle(sh), _broadcast(0), _restart(0), _next_n(0) {
-    SET_HANDLER((MachineStatusSMHandler)
-                & MachineStatusSM::MachineStatusSMEvent);
-  }
-  ~MachineStatusSM() {
+  MachineStatusSM(TSClusterStatusHandle_t sh)
+    : _node_handle(0), _node_status(NODE_ONLINE), _status_handle(sh), _broadcast(0), _restart(0), _next_n(0)
+  {
+    SET_HANDLER((MachineStatusSMHandler)&MachineStatusSM::MachineStatusSMEvent);
   }
-  int MachineStatusSMEvent(Event * e, void *d);
+  ~MachineStatusSM() {}
+  int MachineStatusSMEvent(Event *e, void *d);
 
 private:
   TSNodeHandle_t _node_handle;
   TSNodeStatus_t _node_status;
-  TSClusterStatusHandle_t _status_handle;      // Valid only if !_broadcast
+  TSClusterStatusHandle_t _status_handle; // Valid only if !_broadcast
   int _broadcast;
   int _restart;
   int _next_n;
@@ -129,7 +120,6 @@ MachineStatusSM::MachineStatusSMEvent(Event * /* e ATS_UNUSED */, void * /* d AT
     n = _restart ? _next_n : 0;
     for (; n < MAX_CLUSTERSTATUS_CALLOUTS; ++n) {
       if (status_callouts[n].func && (status_callouts[n].state == NE_STATE_INITIALIZED)) {
-
         MUTEX_TRY_LOCK(lock, status_callouts[n].mutex, et);
         if (lock.is_locked()) {
           status_callouts[n].func(&_node_handle, _node_status);
@@ -163,8 +153,8 @@ MachineStatusSM::MachineStatusSMEvent(Event * /* e ATS_UNUSED */, void * /* d AT
                 nh = IP_TO_NODE_HANDLE(cc->machines[mi]->ip);
                 status_callouts[n].func(&nh, NODE_ONLINE);
 
-                Debug("cluster_api",
-                      "initial callout: n %d ([%u.%u.%u.%u], %d)", n, DOT_SEPARATED(cc->machines[mi]->ip), NODE_ONLINE);
+                Debug("cluster_api", "initial callout: n %d ([%u.%u.%u.%u], %d)", n, DOT_SEPARATED(cc->machines[mi]->ip),
+                      NODE_ONLINE);
               }
             }
           }
@@ -186,8 +176,7 @@ MachineStatusSM::MachineStatusSMEvent(Event * /* e ATS_UNUSED */, void * /* d AT
         if (lock.is_locked()) {
           status_callouts[n].func(&_node_handle, _node_status);
 
-          Debug("cluster_api",
-                "directed callout: n %d ([%u.%u.%u.%u], %d)", n, DOT_SEPARATED(_node_handle), _node_status);
+          Debug("cluster_api", "directed callout: n %d ([%u.%u.%u.%u], %d)", n, DOT_SEPARATED(_node_handle), _node_status);
         } else {
           _restart = 1;
           _next_n = n;
@@ -201,23 +190,20 @@ MachineStatusSM::MachineStatusSMEvent(Event * /* e ATS_UNUSED */, void * /* d AT
 }
 
 class ClusterAPIPeriodicSM;
-typedef int (ClusterAPIPeriodicSM::*ClusterAPIPeriodicSMHandler) (int, void *);
-class ClusterAPIPeriodicSM:public Continuation
+typedef int (ClusterAPIPeriodicSM::*ClusterAPIPeriodicSMHandler)(int, void *);
+class ClusterAPIPeriodicSM : public Continuation
 {
 public:
-  ClusterAPIPeriodicSM(ProxyMutex * m):Continuation(m), _active_msmp(0)
-  {
-    SET_HANDLER((ClusterAPIPeriodicSMHandler)
-                & ClusterAPIPeriodicSM::ClusterAPIPeriodicSMEvent);
-  }
-   ~ClusterAPIPeriodicSM()
+  ClusterAPIPeriodicSM(ProxyMutex *m) : Continuation(m), _active_msmp(0)
   {
+    SET_HANDLER((ClusterAPIPeriodicSMHandler)&ClusterAPIPeriodicSM::ClusterAPIPeriodicSMEvent);
   }
+  ~ClusterAPIPeriodicSM() {}
   int ClusterAPIPeriodicSMEvent(int, void *);
   MachineStatusSM *GetNextSM();
 
 private:
-  MachineStatusSM * _active_msmp;
+  MachineStatusSM *_active_msmp;
 };
 
 static InkAtomicList status_callout_atomic_q;
@@ -232,11 +218,10 @@ ClusterAPIPeriodicSM::GetNextSM()
   while (1) {
     msmp = status_callout_q.pop();
     if (!msmp) {
-      msmp = (MachineStatusSM *)
-        ink_atomiclist_popall(&status_callout_atomic_q);
+      msmp = (MachineStatusSM *)ink_atomiclist_popall(&status_callout_atomic_q);
       if (msmp) {
         while (msmp) {
-          msmp_next = (MachineStatusSM *) msmp->link.next;
+          msmp_next = (MachineStatusSM *)msmp->link.next;
           msmp->link.next = 0;
           status_callout_q.push(msmp);
           msmp = msmp_next;
@@ -277,11 +262,10 @@ void
 clusterAPI_init()
 {
   MachineStatusSM *mssmp = 0;
-  ink_atomiclist_init(&status_callout_atomic_q,
-                      "cluster API status_callout_q", (char *) &mssmp->link.next - (char *) mssmp);
+  ink_atomiclist_init(&status_callout_atomic_q, "cluster API status_callout_q", (char *)&mssmp->link.next - (char *)mssmp);
   ClusterAPI_mutex = new_ProxyMutex();
   MUTEX_TRY_LOCK(lock, ClusterAPI_mutex, this_ethread());
-  ink_release_assert(lock.is_locked());     // Should never fail
+  ink_release_assert(lock.is_locked()); // Should never fail
   periodicSM = new ClusterAPIPeriodicSM(ClusterAPI_mutex);
 
   // TODO: Should we do something with this return value?
@@ -296,7 +280,7 @@ clusterAPI_init()
  *	  called at plugin load time.
  */
 int
-TSAddClusterStatusFunction(TSClusterStatusFunction Status_Function, TSMutex m, TSClusterStatusHandle_t * h)
+TSAddClusterStatusFunction(TSClusterStatusFunction Status_Function, TSMutex m, TSClusterStatusHandle_t *h)
 {
   Debug("cluster_api", "TSAddClusterStatusFunction func %p", Status_Function);
   int n;
@@ -306,7 +290,7 @@ TSAddClusterStatusFunction(TSClusterStatusFunction Status_Function, TSMutex m, T
   MUTEX_TAKE_LOCK(ClusterAPI_mutex, e);
   for (n = 0; n < MAX_CLUSTERSTATUS_CALLOUTS; ++n) {
     if (!status_callouts[n].func) {
-      status_callouts[n].mutex = (ProxyMutex *) m;
+      status_callouts[n].mutex = (ProxyMutex *)m;
       status_callouts[n].func = Status_Function;
       MUTEX_UNTAKE_LOCK(ClusterAPI_mutex, e);
       *h = INDEX_TO_CLUSTER_STATUS_HANDLE(n);
@@ -327,7 +311,7 @@ TSAddClusterStatusFunction(TSClusterStatusFunction Status_Function, TSMutex m, T
  *	  called at plugin unload time (unload currently not supported).
  */
 int
-TSDeleteClusterStatusFunction(TSClusterStatusHandle_t * h)
+TSDeleteClusterStatusFunction(TSClusterStatusHandle_t *h)
 {
   int n = CLUSTER_STATUS_HANDLE_TO_INDEX(*h);
   EThread *e = this_ethread();
@@ -337,7 +321,7 @@ TSDeleteClusterStatusFunction(TSClusterStatusHandle_t * h)
 
   MUTEX_TAKE_LOCK(ClusterAPI_mutex, e);
   status_callouts[n].mutex = 0;
-  status_callouts[n].func = (TSClusterStatusFunction) 0;
+  status_callouts[n].func = (TSClusterStatusFunction)0;
   status_callouts[n].state = NE_STATE_FREE;
   MUTEX_UNTAKE_LOCK(ClusterAPI_mutex, e);
 
@@ -345,14 +329,14 @@ TSDeleteClusterStatusFunction(TSClusterStatusHandle_t * h)
 }
 
 int
-TSNodeHandleToIPAddr(TSNodeHandle_t * h, struct in_addr *in)
+TSNodeHandleToIPAddr(TSNodeHandle_t *h, struct in_addr *in)
 {
   *in = NODE_HANDLE_TO_IP(*h);
   return 0;
 }
 
 void
-TSGetMyNodeHandle(TSNodeHandle_t * h)
+TSGetMyNodeHandle(TSNodeHandle_t *h)
 {
   *h = IP_TO_NODE_HANDLE((this_cluster_machine())->ip);
 }
@@ -364,7 +348,7 @@ TSGetMyNodeHandle(TSNodeHandle_t * h)
  *  callouts are updates to the state obtained at this point.
  */
 void
-TSEnableClusterStatusCallout(TSClusterStatusHandle_t * h)
+TSEnableClusterStatusCallout(TSClusterStatusHandle_t *h)
 {
   int ci = CLUSTER_STATUS_HANDLE_TO_INDEX(*h);
   // This isn't used.
@@ -380,11 +364,11 @@ TSEnableClusterStatusCallout(TSClusterStatusHandle_t * h)
 }
 
 static void
-send_machine_online_list(TSClusterStatusHandle_t * h)
+send_machine_online_list(TSClusterStatusHandle_t *h)
 {
   MachineStatusSM *msm = new MachineStatusSM(*h);
 
-  ink_atomiclist_push(&status_callout_atomic_q, (void *) msm);
+  ink_atomiclist_push(&status_callout_atomic_q, (void *)msm);
 }
 
 /*
@@ -393,11 +377,11 @@ send_machine_online_list(TSClusterStatusHandle_t * h)
 // This doesn't seem to be used...
 #ifdef NOT_USED_HERE
 static void
-directed_machine_online(int Ipaddr, TSClusterStatusHandle_t * h)
+directed_machine_online(int Ipaddr, TSClusterStatusHandle_t *h)
 {
   MachineStatusSM *msm = new MachineStatusSM(IP_TO_NODE_HANDLE(Ipaddr), NODE_ONLINE, *h);
 
-  ink_atomiclist_push(&status_callout_atomic_q, (void *) msm);
+  ink_atomiclist_push(&status_callout_atomic_q, (void *)msm);
 }
 #endif
 
@@ -409,7 +393,7 @@ machine_online_APIcallout(int Ipaddr)
 {
   MachineStatusSM *msm = new MachineStatusSM(IP_TO_NODE_HANDLE(Ipaddr), NODE_ONLINE);
 
-  ink_atomiclist_push(&status_callout_atomic_q, (void *) msm);
+  ink_atomiclist_push(&status_callout_atomic_q, (void *)msm);
 }
 
 /*
@@ -420,7 +404,7 @@ machine_offline_APIcallout(int Ipaddr)
 {
   MachineStatusSM *msm = new MachineStatusSM(IP_TO_NODE_HANDLE(Ipaddr), NODE_OFFLINE);
 
-  ink_atomiclist_push(&status_callout_atomic_q, (void *) msm);
+  ink_atomiclist_push(&status_callout_atomic_q, (void *)msm);
 }
 
 /*
@@ -430,15 +414,14 @@ machine_offline_APIcallout(int Ipaddr)
  *	  called at plugin load time.
  */
 int
-TSAddClusterRPCFunction(TSClusterRPCKey_t k, TSClusterRPCFunction func, TSClusterRPCHandle_t * h)
+TSAddClusterRPCFunction(TSClusterRPCKey_t k, TSClusterRPCFunction func, TSClusterRPCHandle_t *h)
 {
   RPCHandle_t handle;
   int n = RPC_FUNCTION_KEY_TO_CLUSTER_NUMBER(k);
   EThread *e = this_ethread();
 
   ink_release_assert(func);
-  ink_release_assert((n >= API_STARECT_CLUSTER_FUNCTION)
-                     && (n <= API_END_CLUSTER_FUNCTION));
+  ink_release_assert((n >= API_STARECT_CLUSTER_FUNCTION) && (n <= API_END_CLUSTER_FUNCTION));
   Debug("cluster_api", "TSAddClusterRPCFunction: key %d func %p", k, func);
 
   handle.u.internal.cluster_function = n;
@@ -460,13 +443,13 @@ TSAddClusterRPCFunction(TSClusterRPCKey_t k, TSClusterRPCFunction func, TSCluste
  *	  called at plugin unload time (unload currently not supported).
  */
 int
-TSDeleteClusterRPCFunction(TSClusterRPCHandle_t * rpch)
+TSDeleteClusterRPCFunction(TSClusterRPCHandle_t *rpch)
 {
-  RPCHandle_t *h = (RPCHandle_t *) rpch;
+  RPCHandle_t *h = (RPCHandle_t *)rpch;
   EThread *e = this_ethread();
 
-  ink_release_assert(((h->u.internal.cluster_function >= API_STARECT_CLUSTER_FUNCTION)
-                      && (h->u.internal.cluster_function <= API_END_CLUSTER_FUNCTION)));
+  ink_release_assert(((h->u.internal.cluster_function >= API_STARECT_CLUSTER_FUNCTION) &&
+                      (h->u.internal.cluster_function <= API_END_CLUSTER_FUNCTION)));
   Debug("cluster_api", "TSDeleteClusterRPCFunction: n %d", h->u.internal.cluster_function);
 
   MUTEX_TAKE_LOCK(ClusterAPI_mutex, e);
@@ -483,20 +466,19 @@ default_api_ClusterFunction(ClusterHandler *ch, void *data, int len)
 {
   Debug("cluster_api", "default_api_ClusterFunction: [%u.%u.%u.%u] data %p len %d", DOT_SEPARATED(ch->machine->ip), data, len);
 
-  TSClusterRPCMsg_t *msg = (TSClusterRPCMsg_t *) data;
-  RPCHandle_t *rpch = (RPCHandle_t *) & msg->m_handle;
+  TSClusterRPCMsg_t *msg = (TSClusterRPCMsg_t *)data;
+  RPCHandle_t *rpch = (RPCHandle_t *)&msg->m_handle;
   int cluster_function = rpch->u.internal.cluster_function;
 
-  ink_release_assert((size_t) len >= sizeof(TSClusterRPCMsg_t));
-  ink_release_assert(((cluster_function >= API_STARECT_CLUSTER_FUNCTION)
-                      && (cluster_function <= API_END_CLUSTER_FUNCTION)));
+  ink_release_assert((size_t)len >= sizeof(TSClusterRPCMsg_t));
+  ink_release_assert(((cluster_function >= API_STARECT_CLUSTER_FUNCTION) && (cluster_function <= API_END_CLUSTER_FUNCTION)));
 
   if (cluster_function < API_END_CLUSTER_FUNCTION && RPC_Functions[cluster_function]) {
     int msg_data_len = len - SIZEOF_RPC_MSG_LESS_DATA;
     TSNodeHandle_t nh = IP_TO_NODE_HANDLE(ch->machine->ip);
-    (*RPC_Functions[cluster_function]) (&nh, msg, msg_data_len);
+    (*RPC_Functions[cluster_function])(&nh, msg, msg_data_len);
   } else {
-    clusterProcessor.free_remote_data((char *) data, len);
+    clusterProcessor.free_remote_data((char *)data, len);
   }
 }
 
@@ -504,25 +486,25 @@ default_api_ClusterFunction(ClusterHandler *ch, void *data, int len)
  *  Free TSClusterRPCMsg_t received via the RPC function.
  */
 void
-TSFreeRPCMsg(TSClusterRPCMsg_t * msg, int msg_data_len)
+TSFreeRPCMsg(TSClusterRPCMsg_t *msg, int msg_data_len)
 {
-  RPCHandle_t *rpch = (RPCHandle_t *) & msg->m_handle;
+  RPCHandle_t *rpch = (RPCHandle_t *)&msg->m_handle;
   ink_release_assert(rpch->u.internal.magic == RPC_HANDLE_MAGIC);
   Debug("cluster_api", "TSFreeRPCMsg: msg %p msg_data_len %d", msg, msg_data_len);
 
-  clusterProcessor.free_remote_data((char *) msg, msg_data_len + SIZEOF_RPC_MSG_LESS_DATA);
+  clusterProcessor.free_remote_data((char *)msg, msg_data_len + SIZEOF_RPC_MSG_LESS_DATA);
 }
 
 /*
  *  Allocate a message structure for use in the call to TSSendClusterRPC().
  */
 TSClusterRPCMsg_t *
-TSAllocClusterRPCMsg(TSClusterRPCHandle_t * h, int data_size)
+TSAllocClusterRPCMsg(TSClusterRPCHandle_t *h, int data_size)
 {
   ink_assert(data_size >= 4);
   if (data_size < 4) {
     /* Message must be at least 4 bytes in length */
-    return (TSClusterRPCMsg_t *) 0;
+    return (TSClusterRPCMsg_t *)0;
   }
 
   TSClusterRPCMsg_t *rpcm;
@@ -530,9 +512,9 @@ TSAllocClusterRPCMsg(TSClusterRPCHandle_t * h, int data_size)
 
   c->len = sizeof(OutgoingControl *) + SIZEOF_RPC_MSG_LESS_DATA + data_size;
   c->alloc_data();
-  *((OutgoingControl **) c->data) = c;
+  *((OutgoingControl **)c->data) = c;
 
-  rpcm = (TSClusterRPCMsg_t *) (c->data + sizeof(OutgoingControl *));
+  rpcm = (TSClusterRPCMsg_t *)(c->data + sizeof(OutgoingControl *));
   rpcm->m_handle = *h;
 
   /*
@@ -548,25 +530,24 @@ TSAllocClusterRPCMsg(TSClusterRPCHandle_t * h, int data_size)
  *  Send the given message to the specified node.
  */
 int
-TSSendClusterRPC(TSNodeHandle_t * nh, TSClusterRPCMsg_t * msg)
+TSSendClusterRPC(TSNodeHandle_t *nh, TSClusterRPCMsg_t *msg)
 {
   struct in_addr ipaddr = NODE_HANDLE_TO_IP(*nh);
-  RPCHandle_t *rpch = (RPCHandle_t *) & msg->m_handle;
+  RPCHandle_t *rpch = (RPCHandle_t *)&msg->m_handle;
 
-  OutgoingControl *c = *((OutgoingControl **)
-                         ((char *) msg - sizeof(OutgoingControl *)));
-  ClusterConfiguration * cc = this_cluster()->current_configuration();
+  OutgoingControl *c = *((OutgoingControl **)((char *)msg - sizeof(OutgoingControl *)));
+  ClusterConfiguration *cc = this_cluster()->current_configuration();
   ClusterMachine *m;
 
   ink_release_assert(rpch->u.internal.magic == RPC_HANDLE_MAGIC);
 
   if ((m = cc->find(ipaddr.s_addr))) {
     int len = c->len - sizeof(OutgoingControl *);
-    ink_release_assert((size_t) len >= sizeof(TSClusterRPCMsg_t));
+    ink_release_assert((size_t)len >= sizeof(TSClusterRPCMsg_t));
 
     Debug("cluster_api", "TSSendClusterRPC: msg %p dlen %d [%u.%u.%u.%u] sent", msg, len, DOT_SEPARATED(ipaddr.s_addr));
-    clusterProcessor.invoke_remote(m->pop_ClusterHandler(), rpch->u.internal.cluster_function,
-                                   msg, len, (CLUSTER_OPT_STEAL | CLUSTER_OPT_DATA_IS_OCONTROL));
+    clusterProcessor.invoke_remote(m->pop_ClusterHandler(), rpch->u.internal.cluster_function, msg, len,
+                                   (CLUSTER_OPT_STEAL | CLUSTER_OPT_DATA_IS_OCONTROL));
   } else {
     Debug("cluster_api", "TSSendClusterRPC: msg %p to [%u.%u.%u.%u] dropped", msg, DOT_SEPARATED(ipaddr.s_addr));
     c->freeall();


[12/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ParseRules.h
----------------------------------------------------------------------
diff --git a/lib/ts/ParseRules.h b/lib/ts/ParseRules.h
index 6bc7483..ce5c676 100644
--- a/lib/ts/ParseRules.h
+++ b/lib/ts/ParseRules.h
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 
-#if !defined (_ParseRules_h_)
+#if !defined(_ParseRules_h_)
 #define _ParseRules_h_
 
 #include <string.h>
@@ -34,39 +34,39 @@ typedef unsigned int CTypeResult;
 
 // Set this to 0 to disable SI
 // decimal multipliers
-#define USE_SI_MULTILIERS    1
-
-#define is_char_BIT         (1 << 0)
-#define is_upalpha_BIT      (1 << 1)
-#define is_loalpha_BIT      (1 << 2)
-#define is_alpha_BIT        (1 << 3)
-#define is_digit_BIT        (1 << 4)
-#define is_ctl_BIT          (1 << 5)
-#define is_ws_BIT           (1 << 6)
-#define is_hex_BIT          (1 << 7)
-#define is_pchar_BIT        (1 << 8)
-#define is_extra_BIT        (1 << 9)
-#define is_safe_BIT         (1 << 10)
-#define is_unsafe_BIT       (1 << 11)
-#define is_national_BIT     (1 << 12)
-#define is_reserved_BIT     (1 << 13)
-#define is_unreserved_BIT   (1 << 14)
-#define is_punct_BIT        (1 << 15)
-#define is_end_of_url_BIT   (1 << 16)
-#define is_tspecials_BIT    (1 << 17)
-#define is_spcr_BIT         (1 << 18)
-#define is_splf_BIT         (1 << 19)
-#define is_wslfcr_BIT       (1 << 20)
-#define is_eow_BIT          (1 << 21)
-#define is_token_BIT        (1 << 22)
-#define is_wildmat_BIT      (1 << 23)
-#define is_sep_BIT          (1 << 24)
-#define is_empty_BIT        (1 << 25)
-#define is_alnum_BIT        (1 << 26)
-#define is_space_BIT        (1 << 27)
-#define is_control_BIT      (1 << 28)
-#define is_mime_sep_BIT     (1 << 29)
-#define is_http_field_name_BIT  (1 << 30)
+#define USE_SI_MULTILIERS 1
+
+#define is_char_BIT (1 << 0)
+#define is_upalpha_BIT (1 << 1)
+#define is_loalpha_BIT (1 << 2)
+#define is_alpha_BIT (1 << 3)
+#define is_digit_BIT (1 << 4)
+#define is_ctl_BIT (1 << 5)
+#define is_ws_BIT (1 << 6)
+#define is_hex_BIT (1 << 7)
+#define is_pchar_BIT (1 << 8)
+#define is_extra_BIT (1 << 9)
+#define is_safe_BIT (1 << 10)
+#define is_unsafe_BIT (1 << 11)
+#define is_national_BIT (1 << 12)
+#define is_reserved_BIT (1 << 13)
+#define is_unreserved_BIT (1 << 14)
+#define is_punct_BIT (1 << 15)
+#define is_end_of_url_BIT (1 << 16)
+#define is_tspecials_BIT (1 << 17)
+#define is_spcr_BIT (1 << 18)
+#define is_splf_BIT (1 << 19)
+#define is_wslfcr_BIT (1 << 20)
+#define is_eow_BIT (1 << 21)
+#define is_token_BIT (1 << 22)
+#define is_wildmat_BIT (1 << 23)
+#define is_sep_BIT (1 << 24)
+#define is_empty_BIT (1 << 25)
+#define is_alnum_BIT (1 << 26)
+#define is_space_BIT (1 << 27)
+#define is_control_BIT (1 << 28)
+#define is_mime_sep_BIT (1 << 29)
+#define is_http_field_name_BIT (1 << 30)
 /* shut up the DEC compiler */
 #define is_http_field_value_BIT (((CTypeResult)1) << 31)
 
@@ -83,14 +83,13 @@ public:
   // whitespace definitions //
   ////////////////////////////
 
-  enum
-  {
-    CHAR_SP = 32,               /* space           */
-    CHAR_HT = 9,                /* horizontal tab  */
-    CHAR_LF = 10,               /* line feed       */
-    CHAR_VT = 11,               /* vertical tab    */
-    CHAR_NP = 12,               /* new page        */
-    CHAR_CR = 13                /* carriage return */
+  enum {
+    CHAR_SP = 32, /* space           */
+    CHAR_HT = 9,  /* horizontal tab  */
+    CHAR_LF = 10, /* line feed       */
+    CHAR_VT = 11, /* vertical tab    */
+    CHAR_NP = 12, /* new page        */
+    CHAR_CR = 13  /* carriage return */
   };
 
   /////////////////////
@@ -99,54 +98,54 @@ public:
 
   static CTypeResult is_type(char c, uint32_t bit);
 
-  static CTypeResult is_char(char c);   // ASCII 0-127
-  static CTypeResult is_upalpha(char c);        // A-Z
-  static CTypeResult is_loalpha(char c);        // a-z
-  static CTypeResult is_alpha(char c);  // A-Z,a-z
-  static CTypeResult is_digit(char c);  // 0-9
-  static CTypeResult is_ctl(char c);    // ASCII 0-31,127 (includes ws)
-  static CTypeResult is_hex(char c);    // 0-9,A-F,a-f
-  static CTypeResult is_ws(char c);     // SP,HT
-  static CTypeResult is_cr(char c);     // CR
-  static CTypeResult is_lf(char c);     // LF
-  static CTypeResult is_spcr(char c);   // SP,CR
-  static CTypeResult is_splf(char c);   // SP,LF
-  static CTypeResult is_wslfcr(char c); // SP,HT,LF,CR
-  static CTypeResult is_tspecials(char c);      // HTTP chars that need quoting
-  static CTypeResult is_token(char c);  // token (not CTL or specials)
-  static CTypeResult is_extra(char c);  // !,*,QUOT,(,),COMMA
-  static CTypeResult is_safe(char c);   // [$-_.+]
-  static CTypeResult is_unsafe(char c); // SP,DBLQUOT,#,%,<,>
-  static CTypeResult is_national(char c);       // {,},|,BACKSLASH,^,~,[,],`
-  static CTypeResult is_reserved(char c);       // :,/,?,:,@,&,=
-  static CTypeResult is_unreserved(char c);     // alpha,digit,safe,extra,nat.
-  static CTypeResult is_punct(char c);  // !"#$%&'()*+,-./:;<>=?@_{}|~
-  static CTypeResult is_end_of_url(char c);     // NUL,CR,SP
-  static CTypeResult is_eow(char c);    // NUL,CR,LF
-  static CTypeResult is_wildmat(char c);        // \,*,?,[
-  static CTypeResult is_sep(char c);    // NULL,COMMA,':','!',wslfcr
-  static CTypeResult is_empty(char c);  // wslfcr,#
-  static CTypeResult is_alnum(char c);  // 0-9,A-Z,a-z
-  static CTypeResult is_space(char c);  // ' ' HT,VT,NP,CR,LF
-  static CTypeResult is_control(char c);        // 0-31 127
-  static CTypeResult is_mime_sep(char c);       // ()<>,;\"/[]?{} \t
-  static CTypeResult is_http_field_name(char c);        // not : or mime_sep except for @
-  static CTypeResult is_http_field_value(char c);       // not CR, LF, comma, or "
+  static CTypeResult is_char(char c);             // ASCII 0-127
+  static CTypeResult is_upalpha(char c);          // A-Z
+  static CTypeResult is_loalpha(char c);          // a-z
+  static CTypeResult is_alpha(char c);            // A-Z,a-z
+  static CTypeResult is_digit(char c);            // 0-9
+  static CTypeResult is_ctl(char c);              // ASCII 0-31,127 (includes ws)
+  static CTypeResult is_hex(char c);              // 0-9,A-F,a-f
+  static CTypeResult is_ws(char c);               // SP,HT
+  static CTypeResult is_cr(char c);               // CR
+  static CTypeResult is_lf(char c);               // LF
+  static CTypeResult is_spcr(char c);             // SP,CR
+  static CTypeResult is_splf(char c);             // SP,LF
+  static CTypeResult is_wslfcr(char c);           // SP,HT,LF,CR
+  static CTypeResult is_tspecials(char c);        // HTTP chars that need quoting
+  static CTypeResult is_token(char c);            // token (not CTL or specials)
+  static CTypeResult is_extra(char c);            // !,*,QUOT,(,),COMMA
+  static CTypeResult is_safe(char c);             // [$-_.+]
+  static CTypeResult is_unsafe(char c);           // SP,DBLQUOT,#,%,<,>
+  static CTypeResult is_national(char c);         // {,},|,BACKSLASH,^,~,[,],`
+  static CTypeResult is_reserved(char c);         // :,/,?,:,@,&,=
+  static CTypeResult is_unreserved(char c);       // alpha,digit,safe,extra,nat.
+  static CTypeResult is_punct(char c);            // !"#$%&'()*+,-./:;<>=?@_{}|~
+  static CTypeResult is_end_of_url(char c);       // NUL,CR,SP
+  static CTypeResult is_eow(char c);              // NUL,CR,LF
+  static CTypeResult is_wildmat(char c);          // \,*,?,[
+  static CTypeResult is_sep(char c);              // NULL,COMMA,':','!',wslfcr
+  static CTypeResult is_empty(char c);            // wslfcr,#
+  static CTypeResult is_alnum(char c);            // 0-9,A-Z,a-z
+  static CTypeResult is_space(char c);            // ' ' HT,VT,NP,CR,LF
+  static CTypeResult is_control(char c);          // 0-31 127
+  static CTypeResult is_mime_sep(char c);         // ()<>,;\"/[]?{} \t
+  static CTypeResult is_http_field_name(char c);  // not : or mime_sep except for @
+  static CTypeResult is_http_field_value(char c); // not CR, LF, comma, or "
 
   //////////////////
   // string tests //
   //////////////////
 
-  static CTypeResult is_escape(const char *seq);        // %<hex><hex>
-  static CTypeResult is_uchar(const char *seq); // starts unresrvd or is escape
-  static CTypeResult is_pchar(const char *seq); // uchar,:,@,&,=,+ (see code)
+  static CTypeResult is_escape(const char *seq); // %<hex><hex>
+  static CTypeResult is_uchar(const char *seq);  // starts unresrvd or is escape
+  static CTypeResult is_pchar(const char *seq);  // uchar,:,@,&,=,+ (see code)
 
   ///////////////////
   // unimplemented //
   ///////////////////
 
-  //static CTypeResult   is_comment(const char * str);
-  //static CTypeResult   is_ctext(const char * str);
+  // static CTypeResult   is_comment(const char * str);
+  // static CTypeResult   is_ctext(const char * str);
 
   ////////////////
   // operations //
@@ -166,8 +165,8 @@ public:
   static unsigned char *scan_while(unsigned char *ptr, unsigned int n, uint32_t bitmask);
 
 private:
-    ParseRules(const ParseRules &);
-    ParseRules & operator =(const ParseRules &);
+  ParseRules(const ParseRules &);
+  ParseRules &operator=(const ParseRules &);
 };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -177,14 +176,14 @@ private:
 inline CTypeResult
 ParseRules::is_type(char c, uint32_t bitmask)
 {
-  return (parseRulesCType[(unsigned char) c] & bitmask);
+  return (parseRulesCType[(unsigned char)c] & bitmask);
 }
 
 inline CTypeResult
 ParseRules::is_char(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_char_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_char_BIT);
 #else
   return ((c & 0x80) == 0);
 #endif
@@ -194,7 +193,7 @@ inline CTypeResult
 ParseRules::is_upalpha(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_upalpha_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_upalpha_BIT);
 #else
   return (c >= 'A' && c <= 'Z');
 #endif
@@ -204,7 +203,7 @@ inline CTypeResult
 ParseRules::is_loalpha(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_loalpha_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_loalpha_BIT);
 #else
   return (c >= 'a' && c <= 'z');
 #endif
@@ -214,7 +213,7 @@ inline CTypeResult
 ParseRules::is_alpha(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_alpha_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_alpha_BIT);
 #else
   return (is_upalpha(c) || is_loalpha(c));
 #endif
@@ -224,7 +223,7 @@ inline CTypeResult
 ParseRules::is_digit(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_digit_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_digit_BIT);
 #else
   return (c >= '0' && c <= '9');
 #endif
@@ -234,7 +233,7 @@ inline CTypeResult
 ParseRules::is_alnum(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_alnum_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_alnum_BIT);
 #else
   return (is_alpha(c) || is_digit(c));
 #endif
@@ -244,7 +243,7 @@ inline CTypeResult
 ParseRules::is_ctl(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_ctl_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_ctl_BIT);
 #else
   return ((!(c & 0x80) && c <= 31) || c == 127);
 #endif
@@ -254,7 +253,7 @@ inline CTypeResult
 ParseRules::is_ws(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_ws_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_ws_BIT);
 #else
   return (c == CHAR_SP || c == CHAR_HT);
 #endif
@@ -264,7 +263,7 @@ inline CTypeResult
 ParseRules::is_hex(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_hex_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_hex_BIT);
 #else
   return ((c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9'));
 #endif
@@ -286,7 +285,7 @@ inline CTypeResult
 ParseRules::is_splf(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_splf_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_splf_BIT);
 #else
   return (c == CHAR_SP || c == CHAR_LF);
 #endif
@@ -296,7 +295,7 @@ inline CTypeResult
 ParseRules::is_spcr(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_spcr_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_spcr_BIT);
 #else
   return (c == CHAR_SP || c == CHAR_CR);
 #endif
@@ -306,7 +305,7 @@ inline CTypeResult
 ParseRules::is_wslfcr(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_wslfcr_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_wslfcr_BIT);
 #else
   return ParseRules::is_ws(c) || ParseRules::is_splf(c) || ParseRules::is_spcr(c);
 #endif
@@ -316,7 +315,7 @@ inline CTypeResult
 ParseRules::is_extra(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_extra_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_extra_BIT);
 #else
   switch (c) {
   case '!':
@@ -335,7 +334,7 @@ inline CTypeResult
 ParseRules::is_safe(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_safe_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_safe_BIT);
 #else
   return (c == '$' || c == '-' || c == '_' || c == '.' || c == '+');
 #endif
@@ -345,7 +344,7 @@ inline CTypeResult
 ParseRules::is_unsafe(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_unsafe_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_unsafe_BIT);
 #else
   if (is_ctl(c))
     return (true);
@@ -367,7 +366,7 @@ inline CTypeResult
 ParseRules::is_reserved(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_reserved_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_reserved_BIT);
 #else
   switch (c) {
   case ';':
@@ -387,7 +386,7 @@ inline CTypeResult
 ParseRules::is_national(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_national_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_national_BIT);
 #else
   switch (c) {
   case '{':
@@ -409,7 +408,7 @@ inline CTypeResult
 ParseRules::is_unreserved(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_unreserved_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_unreserved_BIT);
 #else
   return (is_alpha(c) || is_digit(c) || is_safe(c) || is_extra(c) || is_national(c));
 #endif
@@ -419,7 +418,7 @@ inline CTypeResult
 ParseRules::is_punct(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_punct_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_punct_BIT);
 #else
   switch (c) {
   case '!':
@@ -463,10 +462,9 @@ inline CTypeResult
 ParseRules::is_end_of_url(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_end_of_url_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_end_of_url_BIT);
 #else
-  return (c == '\0' || c == '\n' || c == ' ' || ParseRules::is_ctl(c)
-    );
+  return (c == '\0' || c == '\n' || c == ' ' || ParseRules::is_ctl(c));
 #endif
 }
 
@@ -513,7 +511,7 @@ inline CTypeResult
 ParseRules::is_tspecials(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_tspecials_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_tspecials_BIT);
 #else
   switch (c) {
   case '(':
@@ -545,7 +543,7 @@ inline CTypeResult
 ParseRules::is_token(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_token_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_token_BIT);
 #else
   return (is_char(c) && !(is_ctl(c) || is_tspecials(c)));
 #endif
@@ -555,7 +553,7 @@ inline char
 ParseRules::ink_toupper(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return parseRulesCTypeToUpper[(unsigned char) c];
+  return parseRulesCTypeToUpper[(unsigned char)c];
 #else
   int up_case = c;
   const int up_case_diff = 'a' - 'A';
@@ -571,7 +569,7 @@ inline char
 ParseRules::ink_tolower(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return parseRulesCTypeToLower[(unsigned char) c];
+  return parseRulesCTypeToLower[(unsigned char)c];
 #else
   int lo_case = c;
   const int lo_case_diff = 'a' - 'A';
@@ -587,7 +585,7 @@ inline CTypeResult
 ParseRules::is_eow(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_eow_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_eow_BIT);
 #else
   return (c == '\0' || c == '\r' || c == '\n');
 #endif
@@ -597,7 +595,7 @@ inline CTypeResult
 ParseRules::is_wildmat(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_wildmat_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_wildmat_BIT);
 #else
   return (c == '*' || c == '?' || c == '[' || c == '\\');
 #endif
@@ -607,7 +605,7 @@ inline CTypeResult
 ParseRules::is_sep(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_sep_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_sep_BIT);
 #else
   return (!c || c == ',' || c == ':' || c == '!' || is_wslfcr(c));
 #endif
@@ -617,7 +615,7 @@ inline CTypeResult
 ParseRules::is_empty(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_empty_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_empty_BIT);
 #else
   return (c == '#' || is_wslfcr(c));
 #endif
@@ -627,7 +625,7 @@ inline CTypeResult
 ParseRules::is_space(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_space_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_space_BIT);
 #else
   switch (c) {
   case CHAR_SP:
@@ -646,9 +644,9 @@ inline CTypeResult
 ParseRules::is_control(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_control_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_control_BIT);
 #else
-  if (((unsigned char) c) < 32 || ((unsigned char) c) == 127)
+  if (((unsigned char)c) < 32 || ((unsigned char)c) == 127)
     return true;
   return false;
 #endif
@@ -658,11 +656,10 @@ inline CTypeResult
 ParseRules::is_mime_sep(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_mime_sep_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_mime_sep_BIT);
 #else
-  if ((c == '(') || (c == ')') || (c == '<') || (c == '>') || (c == '@') ||
-      (c == ',') || (c == ';') || (c == '\\') || (c == '\"') ||
-      (c == '/') || (c == '[') || (c == ']') || (c == '?') || (c == '{') || (c == '}') || (c == ' ') || (c == '\t'))
+  if ((c == '(') || (c == ')') || (c == '<') || (c == '>') || (c == '@') || (c == ',') || (c == ';') || (c == '\\') ||
+      (c == '\"') || (c == '/') || (c == '[') || (c == ']') || (c == '?') || (c == '{') || (c == '}') || (c == ' ') || (c == '\t'))
     return true;
   return false;
 #endif
@@ -672,7 +669,7 @@ inline CTypeResult
 ParseRules::is_http_field_name(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char) c] & is_http_field_name_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_http_field_name_BIT);
 #else
   if ((c == ':') || (is_mime_sep(c) && (c != '@')))
     return false;
@@ -684,7 +681,7 @@ inline CTypeResult
 ParseRules::is_http_field_value(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (CTypeResult) (parseRulesCType[(unsigned char) c] & is_http_field_value_BIT);
+  return (CTypeResult)(parseRulesCType[(unsigned char)c] & is_http_field_value_BIT);
 #else
   switch (c) {
   case CHAR_CR:
@@ -770,7 +767,7 @@ ParseRules::strcasestr(const char *s1, const char *s2)
 
   for (i1 = 0; s1[i1] != '\0'; i1++)
     if (ink_tolower(s1[i1]) == ink_tolower(s2[0]))
-      if (strncasecmp_eow(&s1[i1], &s2[0], (int) s2_len))
+      if (strncasecmp_eow(&s1[i1], &s2[0], (int)s2_len))
         return (&s1[i1]);
 
   return (0);
@@ -798,9 +795,9 @@ static inline int
 ink_get_hex(char c)
 {
   if (ParseRules::is_digit(c))
-    return (int) (c - '0');
+    return (int)(c - '0');
   c = ParseRules::ink_tolower(c);
-  return (int) ((c - 'a') + 10);
+  return (int)((c - 'a') + 10);
 }
 
 int64_t ink_atoi64(const char *);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Ptr.h
----------------------------------------------------------------------
diff --git a/lib/ts/Ptr.h b/lib/ts/Ptr.h
index 7cea36c..9c5fa0d 100644
--- a/lib/ts/Ptr.h
+++ b/lib/ts/Ptr.h
@@ -32,7 +32,7 @@
 
 
  ****************************************************************************/
-#if !defined (_Ptr_h_)
+#if !defined(_Ptr_h_)
 #define _Ptr_h_
 
 #include "ink_atomic.h"
@@ -46,20 +46,16 @@
 class NonAtomicRefCountObj
 {
 public:
-  NonAtomicRefCountObj():m_refcount(0)
+  NonAtomicRefCountObj() : m_refcount(0) { return; }
+  NonAtomicRefCountObj(const NonAtomicRefCountObj &s) : m_refcount(0)
   {
+    (void)s;
     return;
   }
-  NonAtomicRefCountObj(const NonAtomicRefCountObj & s):m_refcount(0)
+  virtual ~NonAtomicRefCountObj() { return; }
+  NonAtomicRefCountObj &operator=(const NonAtomicRefCountObj &s)
   {
-    (void) s;
-    return;
-  }
-  virtual ~ NonAtomicRefCountObj() {
-    return;
-  }
-  NonAtomicRefCountObj & operator =(const NonAtomicRefCountObj & s) {
-    (void) s;
+    (void)s;
     return (*this);
   }
 
@@ -67,7 +63,8 @@ public:
   int refcount_dec();
   int refcount() const;
 
-  virtual void free()
+  virtual void
+  free()
   {
     delete this;
   }
@@ -98,63 +95,45 @@ NonAtomicRefCountObj::refcount() const
 }
 
 
-
 ////////////////////////////////////////////////////////////////////////
 //
 // class NonAtomicPtr
 //
 ////////////////////////////////////////////////////////////////////////
-template<class T> class NonAtomicPtr {
+template <class T> class NonAtomicPtr
+{
 public:
-  explicit NonAtomicPtr(T * ptr = 0);
+  explicit NonAtomicPtr(T *ptr = 0);
   NonAtomicPtr(const NonAtomicPtr<T> &);
   ~NonAtomicPtr();
 
-  NonAtomicPtr<T> &operator =(const NonAtomicPtr<T> &);
-  NonAtomicPtr<T> &operator =(T *);
+  NonAtomicPtr<T> &operator=(const NonAtomicPtr<T> &);
+  NonAtomicPtr<T> &operator=(T *);
 
   void clear();
 
-  operator  T *() const
-  {
-    return (m_ptr);
-  }
-  T *operator ->() const
-  {
-    return (m_ptr);
-  }
-  T & operator *() const
-  {
-    return (*m_ptr);
-  }
+  operator T *() const { return (m_ptr); }
+  T *operator->() const { return (m_ptr); }
+  T &operator*() const { return (*m_ptr); }
 
-  int operator ==(const T * p)
-  {
-    return (m_ptr == p);
-  }
-  int operator ==(const NonAtomicPtr<T> &p)
-  {
-    return (m_ptr == p.m_ptr);
-  }
-  int operator !=(const T * p)
-  {
-    return (m_ptr != p);
-  }
-  int operator !=(const NonAtomicPtr<T> &p)
-  {
-    return (m_ptr != p.m_ptr);
-  }
+  int operator==(const T *p) { return (m_ptr == p); }
+  int operator==(const NonAtomicPtr<T> &p) { return (m_ptr == p.m_ptr); }
+  int operator!=(const T *p) { return (m_ptr != p); }
+  int operator!=(const NonAtomicPtr<T> &p) { return (m_ptr != p.m_ptr); }
 
-  NonAtomicRefCountObj *_ptr()
+  NonAtomicRefCountObj *
+  _ptr()
   {
-    return (NonAtomicRefCountObj *) m_ptr;
+    return (NonAtomicRefCountObj *)m_ptr;
   }
 
   T *m_ptr;
 };
 
 template <typename T>
-NonAtomicPtr<T> make_nonatomic_ptr(T * p) {
+NonAtomicPtr<T>
+make_nonatomic_ptr(T *p)
+{
   return NonAtomicPtr<T>(p);
 }
 
@@ -163,25 +142,21 @@ NonAtomicPtr<T> make_nonatomic_ptr(T * p) {
 // inline functions definitions
 //
 ////////////////////////////////////////////////////////////////////////
-template<class T> inline NonAtomicPtr<T>::NonAtomicPtr(T * ptr /* = 0 */ )
-:
-m_ptr(ptr)
+template <class T> inline NonAtomicPtr<T>::NonAtomicPtr(T *ptr /* = 0 */) : m_ptr(ptr)
 {
   if (m_ptr)
     _ptr()->refcount_inc();
   return;
 }
 
-template<class T> inline NonAtomicPtr<T>::NonAtomicPtr(const NonAtomicPtr<T> &src)
-:
-m_ptr(src.m_ptr)
+template <class T> inline NonAtomicPtr<T>::NonAtomicPtr(const NonAtomicPtr<T> &src) : m_ptr(src.m_ptr)
 {
   if (m_ptr)
     _ptr()->refcount_inc();
   return;
 }
 
-template<class T> inline NonAtomicPtr<T>::~NonAtomicPtr()
+template <class T> inline NonAtomicPtr<T>::~NonAtomicPtr()
 {
   if ((m_ptr) && _ptr()->refcount_dec() == 0) {
     _ptr()->free();
@@ -189,7 +164,7 @@ template<class T> inline NonAtomicPtr<T>::~NonAtomicPtr()
   return;
 }
 
-template<class T> inline NonAtomicPtr<T> &NonAtomicPtr<T>::operator =(T * p)
+template <class T> inline NonAtomicPtr<T> &NonAtomicPtr<T>::operator=(T *p)
 {
   T *temp_ptr = m_ptr;
 
@@ -202,23 +177,25 @@ template<class T> inline NonAtomicPtr<T> &NonAtomicPtr<T>::operator =(T * p)
     _ptr()->refcount_inc();
   }
 
-  if ((temp_ptr) && ((NonAtomicRefCountObj *) temp_ptr)->refcount_dec() == 0) {
-    ((NonAtomicRefCountObj *) temp_ptr)->free();
+  if ((temp_ptr) && ((NonAtomicRefCountObj *)temp_ptr)->refcount_dec() == 0) {
+    ((NonAtomicRefCountObj *)temp_ptr)->free();
   }
 
   return (*this);
 }
-template<class T> inline void NonAtomicPtr<T>::clear()
+template <class T>
+inline void
+NonAtomicPtr<T>::clear()
 {
   if (m_ptr) {
-    if (!((NonAtomicRefCountObj *) m_ptr)->refcount_dec())
-      ((NonAtomicRefCountObj *) m_ptr)->free();
+    if (!((NonAtomicRefCountObj *)m_ptr)->refcount_dec())
+      ((NonAtomicRefCountObj *)m_ptr)->free();
     m_ptr = NULL;
   }
 }
-template<class T> inline NonAtomicPtr<T> &NonAtomicPtr<T>::operator =(const NonAtomicPtr<T> &src)
+template <class T> inline NonAtomicPtr<T> &NonAtomicPtr<T>::operator=(const NonAtomicPtr<T> &src)
 {
-  return (operator =(src.m_ptr));
+  return (operator=(src.m_ptr));
 }
 
 
@@ -228,11 +205,8 @@ template<class T> inline NonAtomicPtr<T> &NonAtomicPtr<T>::operator =(const NonA
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
-struct ForceVFPTToTop
-{
-  virtual ~ ForceVFPTToTop()
-  {
-  }
+struct ForceVFPTToTop {
+  virtual ~ForceVFPTToTop() {}
 };
 
 
@@ -242,21 +216,19 @@ struct ForceVFPTToTop
 // prototypical class for reference counting
 //
 ////////////////////////////////////////////////////////////////////////
-class RefCountObj: public ForceVFPTToTop
+class RefCountObj : public ForceVFPTToTop
 {
 public:
-  RefCountObj():m_refcount(0)
-  {
-  }
-  RefCountObj(const RefCountObj & s):m_refcount(0)
+  RefCountObj() : m_refcount(0) {}
+  RefCountObj(const RefCountObj &s) : m_refcount(0)
   {
-    (void) s;
+    (void)s;
     return;
   }
-  virtual ~ RefCountObj() {
-  }
-  RefCountObj & operator =(const RefCountObj & s) {
-    (void) s;
+  virtual ~RefCountObj() {}
+  RefCountObj &operator=(const RefCountObj &s)
+  {
+    (void)s;
     return (*this);
   }
 
@@ -264,7 +236,8 @@ public:
   int refcount_dec();
   int refcount() const;
 
-  virtual void free()
+  virtual void
+  free()
   {
     delete this;
   }
@@ -276,7 +249,7 @@ public:
 inline int
 RefCountObj::refcount_inc()
 {
-  return ink_atomic_increment((int *) &m_refcount, 1) + 1;
+  return ink_atomic_increment((int *)&m_refcount, 1) + 1;
 }
 
 #define REF_COUNT_OBJ_REFCOUNT_INC(_x) (_x)->refcount_inc()
@@ -285,7 +258,7 @@ RefCountObj::refcount_inc()
 inline int
 RefCountObj::refcount_dec()
 {
-  return ink_atomic_increment((int *) &m_refcount, -1) - 1;
+  return ink_atomic_increment((int *)&m_refcount, -1) - 1;
 }
 
 #define REF_COUNT_OBJ_REFCOUNT_DEC(_x) (_x)->refcount_dec()
@@ -302,65 +275,50 @@ RefCountObj::refcount() const
 // class Ptr
 //
 ////////////////////////////////////////////////////////////////////////
-template<class T> class Ptr {
+template <class T> class Ptr
+{
 public:
-  explicit Ptr(T * p = 0);
+  explicit Ptr(T *p = 0);
   Ptr(const Ptr<T> &);
   ~Ptr();
 
   void clear();
-  Ptr<T> &operator =(const Ptr<T> &);
-  Ptr<T> &operator =(T *);
+  Ptr<T> &operator=(const Ptr<T> &);
+  Ptr<T> &operator=(T *);
 
-  T * to_ptr() {
+  T *
+  to_ptr()
+  {
     if (m_ptr && m_ptr->m_refcount == 1) {
-      T * ptr = m_ptr;
+      T *ptr = m_ptr;
       m_ptr = 0;
       ptr->m_refcount = 0;
       return ptr;
     }
     return 0;
   }
-  operator  T *() const
-  {
-    return (m_ptr);
-  }
-  T *operator ->() const
-  {
-    return (m_ptr);
-  }
-  T & operator *() const
-  {
-    return (*m_ptr);
-  }
+  operator T *() const { return (m_ptr); }
+  T *operator->() const { return (m_ptr); }
+  T &operator*() const { return (*m_ptr); }
 
-  int operator ==(const T * p)
-  {
-    return (m_ptr == p);
-  }
-  int operator ==(const Ptr<T> &p)
-  {
-    return (m_ptr == p.m_ptr);
-  }
-  int operator !=(const T * p)
-  {
-    return (m_ptr != p);
-  }
-  int operator !=(const Ptr<T> &p)
-  {
-    return (m_ptr != p.m_ptr);
-  }
+  int operator==(const T *p) { return (m_ptr == p); }
+  int operator==(const Ptr<T> &p) { return (m_ptr == p.m_ptr); }
+  int operator!=(const T *p) { return (m_ptr != p); }
+  int operator!=(const Ptr<T> &p) { return (m_ptr != p.m_ptr); }
 
-  RefCountObj *_ptr()
+  RefCountObj *
+  _ptr()
   {
-    return (RefCountObj *) m_ptr;
+    return (RefCountObj *)m_ptr;
   }
 
   T *m_ptr;
 };
 
 template <typename T>
-Ptr<T> make_ptr(T * p) {
+Ptr<T>
+make_ptr(T *p)
+{
   return Ptr<T>(p);
 }
 
@@ -369,25 +327,21 @@ Ptr<T> make_ptr(T * p) {
 // inline functions definitions
 //
 ////////////////////////////////////////////////////////////////////////
-template<class T> inline Ptr<T>::Ptr(T * ptr /* = 0 */ )
-:
-m_ptr(ptr)
+template <class T> inline Ptr<T>::Ptr(T *ptr /* = 0 */) : m_ptr(ptr)
 {
   if (m_ptr)
     _ptr()->refcount_inc();
   return;
 }
 
-template<class T> inline Ptr<T>::Ptr(const Ptr<T> &src)
-:
-m_ptr(src.m_ptr)
+template <class T> inline Ptr<T>::Ptr(const Ptr<T> &src) : m_ptr(src.m_ptr)
 {
   if (m_ptr)
     _ptr()->refcount_inc();
   return;
 }
 
-template<class T> inline Ptr<T>::~Ptr()
+template <class T> inline Ptr<T>::~Ptr()
 {
   if ((m_ptr) && _ptr()->refcount_dec() == 0) {
     _ptr()->free();
@@ -395,7 +349,7 @@ template<class T> inline Ptr<T>::~Ptr()
   return;
 }
 
-template<class T> inline Ptr<T> &Ptr<T>::operator =(T * p)
+template <class T> inline Ptr<T> &Ptr<T>::operator=(T *p)
 {
   T *temp_ptr = m_ptr;
 
@@ -408,23 +362,25 @@ template<class T> inline Ptr<T> &Ptr<T>::operator =(T * p)
     _ptr()->refcount_inc();
   }
 
-  if ((temp_ptr) && ((RefCountObj *) temp_ptr)->refcount_dec() == 0) {
-    ((RefCountObj *) temp_ptr)->free();
+  if ((temp_ptr) && ((RefCountObj *)temp_ptr)->refcount_dec() == 0) {
+    ((RefCountObj *)temp_ptr)->free();
   }
 
   return (*this);
 }
-template<class T> inline void Ptr<T>::clear()
+template <class T>
+inline void
+Ptr<T>::clear()
 {
   if (m_ptr) {
-    if (!((RefCountObj *) m_ptr)->refcount_dec())
-      ((RefCountObj *) m_ptr)->free();
+    if (!((RefCountObj *)m_ptr)->refcount_dec())
+      ((RefCountObj *)m_ptr)->free();
     m_ptr = NULL;
   }
 }
-template<class T> inline Ptr<T> &Ptr<T>::operator =(const Ptr<T> &src)
+template <class T> inline Ptr<T> &Ptr<T>::operator=(const Ptr<T> &src)
 {
-  return (operator =(src.m_ptr));
+  return (operator=(src.m_ptr));
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/RawHashTable.cc
----------------------------------------------------------------------
diff --git a/lib/ts/RawHashTable.cc b/lib/ts/RawHashTable.cc
index 8c86e79..192a4fa 100644
--- a/lib/ts/RawHashTable.cc
+++ b/lib/ts/RawHashTable.cc
@@ -29,4 +29,3 @@
 */
 
 #include "RawHashTable.h"
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/RawHashTable.h
----------------------------------------------------------------------
diff --git a/lib/ts/RawHashTable.h b/lib/ts/RawHashTable.h
index 529f724..7d19701 100644
--- a/lib/ts/RawHashTable.h
+++ b/lib/ts/RawHashTable.h
@@ -29,7 +29,7 @@
 */
 
 #ifndef _RawHashTable_h_
-#define	_RawHashTable_h_
+#define _RawHashTable_h_
 
 #include "libts.h"
 
@@ -41,8 +41,7 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-typedef enum
-{
+typedef enum {
   RawHashTable_KeyType_String = InkHashTableKeyType_String,
   RawHashTable_KeyType_Word = InkHashTableKeyType_Word
 } RawHashTable_KeyType;
@@ -61,19 +60,19 @@ typedef InkHashTableIteratorState RawHashTable_IteratorState;
 class RawHashTable
 {
 private:
-  InkHashTable * ht;
+  InkHashTable *ht;
   RawHashTable_KeyType key_type;
   bool deallocate_values_on_destruct;
 
 public:
-    inkcoreapi RawHashTable(RawHashTable_KeyType key_type, bool deallocate_values_on_destruct = false);
-    virtual ~ RawHashTable();
+  inkcoreapi RawHashTable(RawHashTable_KeyType key_type, bool deallocate_values_on_destruct = false);
+  virtual ~RawHashTable();
 
   //
   // these are the simplest accessor functions
   //
 
-  bool getValue(RawHashTable_Key key, RawHashTable_Value * value_ptr);
+  bool getValue(RawHashTable_Key key, RawHashTable_Value *value_ptr);
   void setValue(RawHashTable_Key key, RawHashTable_Value value_ptr);
   bool isBound(RawHashTable_Key key);
   bool unbindKey(RawHashTable_Key key);
@@ -84,18 +83,18 @@ public:
   //
 
   RawHashTable_Binding *getCurrentBinding(RawHashTable_Key key);
-  RawHashTable_Binding *getOrCreateBinding(RawHashTable_Key key, bool * was_new = NULL);
+  RawHashTable_Binding *getOrCreateBinding(RawHashTable_Key key, bool *was_new = NULL);
 
-  void setBindingValue(RawHashTable_Binding * binding, RawHashTable_Value value);
-  RawHashTable_Key getKeyFromBinding(RawHashTable_Binding * binding);
-  RawHashTable_Value getValueFromBinding(RawHashTable_Binding * binding);
+  void setBindingValue(RawHashTable_Binding *binding, RawHashTable_Value value);
+  RawHashTable_Key getKeyFromBinding(RawHashTable_Binding *binding);
+  RawHashTable_Value getValueFromBinding(RawHashTable_Binding *binding);
 
   //
   // these functions allow you to iterate through RawHashTable bindings
   //
 
-  RawHashTable_Binding *firstBinding(RawHashTable_IteratorState * state_ptr);
-  RawHashTable_Binding *nextBinding(RawHashTable_IteratorState * state_ptr);
+  RawHashTable_Binding *firstBinding(RawHashTable_IteratorState *state_ptr);
+  RawHashTable_Binding *nextBinding(RawHashTable_IteratorState *state_ptr);
 };
 
 //////////////////////////////////////////////////////////////////////////////
@@ -111,11 +110,11 @@ public:
 
 */
 inline bool
-RawHashTable::getValue(RawHashTable_Key key, RawHashTable_Value * value_ptr)
+RawHashTable::getValue(RawHashTable_Key key, RawHashTable_Value *value_ptr)
 {
   int is_bound;
 
-  is_bound = ink_hash_table_lookup(ht, (InkHashTableKey) key, (InkHashTableValue *) value_ptr);
+  is_bound = ink_hash_table_lookup(ht, (InkHashTableKey)key, (InkHashTableValue *)value_ptr);
   return (is_bound ? true : false);
 }
 
@@ -132,7 +131,7 @@ RawHashTable::getValue(RawHashTable_Key key, RawHashTable_Value * value_ptr)
 inline void
 RawHashTable::setValue(RawHashTable_Key key, RawHashTable_Value value)
 {
-  ink_hash_table_insert(ht, (InkHashTableKey) key, (InkHashTableValue) value);
+  ink_hash_table_insert(ht, (InkHashTableKey)key, (InkHashTableValue)value);
 }
 
 /**
@@ -148,7 +147,7 @@ RawHashTable::setValue(RawHashTable_Key key, RawHashTable_Value value)
 inline bool
 RawHashTable::isBound(RawHashTable_Key key)
 {
-  int status = ink_hash_table_isbound(ht, (InkHashTableKey) key);
+  int status = ink_hash_table_isbound(ht, (InkHashTableKey)key);
   return (status ? true : false);
 }
 
@@ -166,7 +165,7 @@ RawHashTable::unbindKey(RawHashTable_Key key)
 {
   int status;
 
-  status = ink_hash_table_delete(ht, (InkHashTableKey) key);
+  status = ink_hash_table_delete(ht, (InkHashTableKey)key);
   return (status ? true : false);
 }
 
@@ -180,10 +179,10 @@ RawHashTable::unbindKey(RawHashTable_Key key)
 inline void
 RawHashTable::replaceString(char *key, char *string)
 {
-//    if (key_type != RawHashTable_KeyType_String)
-//    {
-//      throw BadKeyType();
-//    }
+  //    if (key_type != RawHashTable_KeyType_String)
+  //    {
+  //      throw BadKeyType();
+  //    }
 
   ink_hash_table_replace_string(ht, key, string);
 }
@@ -199,8 +198,8 @@ RawHashTable::getCurrentBinding(RawHashTable_Key key)
 {
   InkHashTableEntry *he_ptr;
 
-  he_ptr = ink_hash_table_lookup_entry(ht, (InkHashTableKey) key);
-  return ((RawHashTable_Binding *) he_ptr);
+  he_ptr = ink_hash_table_lookup_entry(ht, (InkHashTableKey)key);
+  return ((RawHashTable_Binding *)he_ptr);
 }
 
 /**
@@ -214,14 +213,14 @@ RawHashTable::getCurrentBinding(RawHashTable_Key key)
 
 */
 inline RawHashTable_Binding *
-RawHashTable::getOrCreateBinding(RawHashTable_Key key, bool * was_new)
+RawHashTable::getOrCreateBinding(RawHashTable_Key key, bool *was_new)
 {
   int _was_new;
   InkHashTableEntry *he_ptr;
 
-  he_ptr = ink_hash_table_get_entry(ht, (InkHashTableKey) key, &_was_new);
+  he_ptr = ink_hash_table_get_entry(ht, (InkHashTableKey)key, &_was_new);
   *was_new = (_was_new ? true : false);
-  return ((RawHashTable_Binding *) he_ptr);
+  return ((RawHashTable_Binding *)he_ptr);
 }
 
 /**
@@ -235,9 +234,9 @@ RawHashTable::getOrCreateBinding(RawHashTable_Key key, bool * was_new)
 
 */
 inline void
-RawHashTable::setBindingValue(RawHashTable_Binding * binding, RawHashTable_Value value)
+RawHashTable::setBindingValue(RawHashTable_Binding *binding, RawHashTable_Value value)
 {
-  ink_hash_table_set_entry(ht, (InkHashTableEntry *) binding, (InkHashTableValue) value);
+  ink_hash_table_set_entry(ht, (InkHashTableEntry *)binding, (InkHashTableValue)value);
 }
 
 /**
@@ -245,12 +244,12 @@ RawHashTable::setBindingValue(RawHashTable_Binding * binding, RawHashTable_Value
 
 */
 inline RawHashTable_Key
-RawHashTable::getKeyFromBinding(RawHashTable_Binding * binding)
+RawHashTable::getKeyFromBinding(RawHashTable_Binding *binding)
 {
   InkHashTableKey ht_key;
 
-  ht_key = ink_hash_table_entry_key(ht, (InkHashTableEntry *) binding);
-  return ((RawHashTable_Key) ht_key);
+  ht_key = ink_hash_table_entry_key(ht, (InkHashTableEntry *)binding);
+  return ((RawHashTable_Key)ht_key);
 }
 
 /**
@@ -258,12 +257,12 @@ RawHashTable::getKeyFromBinding(RawHashTable_Binding * binding)
 
 */
 inline RawHashTable_Value
-RawHashTable::getValueFromBinding(RawHashTable_Binding * binding)
+RawHashTable::getValueFromBinding(RawHashTable_Binding *binding)
 {
   InkHashTableValue ht_value;
 
-  ht_value = ink_hash_table_entry_value(ht, (InkHashTableEntry *) binding);
-  return ((RawHashTable_Value) ht_value);
+  ht_value = ink_hash_table_entry_value(ht, (InkHashTableEntry *)binding);
+  return ((RawHashTable_Value)ht_value);
 }
 
 /**
@@ -273,25 +272,22 @@ RawHashTable::getValueFromBinding(RawHashTable_Binding * binding)
 
 */
 inline RawHashTable_Binding *
-RawHashTable::firstBinding(RawHashTable_IteratorState * state_ptr)
+RawHashTable::firstBinding(RawHashTable_IteratorState *state_ptr)
 {
   InkHashTableEntry *he_ptr;
 
-  he_ptr = ink_hash_table_iterator_first(ht, (InkHashTableIteratorState *) state_ptr);
-  return ((RawHashTable_Binding *) he_ptr);
+  he_ptr = ink_hash_table_iterator_first(ht, (InkHashTableIteratorState *)state_ptr);
+  return ((RawHashTable_Binding *)he_ptr);
 }
 
-inline
-RawHashTable::RawHashTable(RawHashTable_KeyType akey_type, bool adeallocate_values_on_destruct)
+inline RawHashTable::RawHashTable(RawHashTable_KeyType akey_type, bool adeallocate_values_on_destruct)
 {
   RawHashTable::key_type = akey_type;
   RawHashTable::deallocate_values_on_destruct = adeallocate_values_on_destruct;
-  ht = ink_hash_table_create((InkHashTableKeyType) key_type);
+  ht = ink_hash_table_create((InkHashTableKeyType)key_type);
 }
 
-inline
-RawHashTable::~
-RawHashTable()
+inline RawHashTable::~RawHashTable()
 {
   if (deallocate_values_on_destruct)
     ink_hash_table_destroy_and_free_values(ht);
@@ -306,12 +302,12 @@ RawHashTable()
 
 */
 inline RawHashTable_Binding *
-RawHashTable::nextBinding(RawHashTable_IteratorState * state_ptr)
+RawHashTable::nextBinding(RawHashTable_IteratorState *state_ptr)
 {
   InkHashTableEntry *he_ptr;
 
-  he_ptr = ink_hash_table_iterator_next(ht, (InkHashTableIteratorState *) state_ptr);
-  return ((RawHashTable_Binding *) he_ptr);
+  he_ptr = ink_hash_table_iterator_next(ht, (InkHashTableIteratorState *)state_ptr);
+  return ((RawHashTable_Binding *)he_ptr);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -323,19 +319,19 @@ RawHashTable::nextBinding(RawHashTable_IteratorState * state_ptr)
 class RawHashTableIter
 {
 public:
-  RawHashTableIter(RawHashTable & ht);
+  RawHashTableIter(RawHashTable &ht);
   ~RawHashTableIter();
 
-  RawHashTable_Value & operator ++();   // get next
-  RawHashTable_Value & operator () () const;    // get current
-  operator  const void *() const;       // is valid
+  RawHashTable_Value &operator++();       // get next
+  RawHashTable_Value &operator()() const; // get current
+  operator const void *() const;          // is valid
 
-    RawHashTable_Value & value() const; // get current value
-  const char *key() const;      // get current key
+  RawHashTable_Value &value() const; // get current value
+  const char *key() const;           // get current key
 
 
 private:
-    RawHashTable & m_ht;
+  RawHashTable &m_ht;
   RawHashTable_Binding *m_currentBinding;
   RawHashTable_IteratorState m_hashIterState;
 };
@@ -346,29 +342,23 @@ private:
 //
 //////////////////////////////////////////////////////////////////////////////
 
-inline RawHashTable_Value &
-RawHashTableIter::operator () ()
-const
+inline RawHashTable_Value &RawHashTableIter::operator()() const
 {
   return (m_currentBinding->clientData);
 }
 
-inline RawHashTable_Value &
-RawHashTableIter::operator ++()
+inline RawHashTable_Value &RawHashTableIter::operator++()
 {
   m_currentBinding = m_ht.nextBinding(&m_hashIterState);
   return (m_currentBinding->clientData);
 }
 
-inline
-RawHashTableIter::operator  const void *()
-const
+inline RawHashTableIter::operator const void *() const
 {
   return ((m_currentBinding != 0) ? this : 0);
 }
 
-inline
-  RawHashTable_Value &
+inline RawHashTable_Value &
 RawHashTableIter::value() const
 {
   return (m_currentBinding->clientData);
@@ -380,19 +370,13 @@ RawHashTableIter::key() const
   return (m_currentBinding->key.string);
 }
 
-inline
-RawHashTableIter::RawHashTableIter(RawHashTable & ht)
-  :
-m_ht(ht),
-m_currentBinding(0)
+inline RawHashTableIter::RawHashTableIter(RawHashTable &ht) : m_ht(ht), m_currentBinding(0)
 {
   m_currentBinding = m_ht.firstBinding(&m_hashIterState);
   return;
 }
 
-inline
-RawHashTableIter::~
-RawHashTableIter()
+inline RawHashTableIter::~RawHashTableIter()
 {
   return;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/RbTree.cc
----------------------------------------------------------------------
diff --git a/lib/ts/RbTree.cc b/lib/ts/RbTree.cc
index ba7d2a0..64b80fa 100644
--- a/lib/ts/RbTree.cc
+++ b/lib/ts/RbTree.cc
@@ -21,296 +21,300 @@
 
 #include "RbTree.h"
 
-namespace ts { namespace detail {
-
-/// Equality.
-/// @note If @a n is @c NULL it is treated as having the color @c BLACK.
-/// @return @c true if @a c and the color of @a n are the same.
-inline bool operator == ( RBNode* n, RBNode::Color c ) {
-  return c == ( n ? n->getColor() : RBNode::BLACK);
-}
-/// Equality.
-/// @note If @a n is @c NULL it is treated as having the color @c BLACK.
-/// @return @c true if @a c and the color of @a n are the same.
-inline bool operator == ( RBNode::Color c, RBNode* n ) {
-  return n == c;
-}
-
-RBNode*
-RBNode::getChild(Direction d) const {
-  return d == RIGHT ? _right
-    : d == LEFT ? _left
-    : 0
-    ;
-}
+namespace ts
+{
+namespace detail
+{
+  /// Equality.
+  /// @note If @a n is @c NULL it is treated as having the color @c BLACK.
+  /// @return @c true if @a c and the color of @a n are the same.
+  inline bool operator==(RBNode *n, RBNode::Color c) { return c == (n ? n->getColor() : RBNode::BLACK); }
+  /// Equality.
+  /// @note If @a n is @c NULL it is treated as having the color @c BLACK.
+  /// @return @c true if @a c and the color of @a n are the same.
+  inline bool operator==(RBNode::Color c, RBNode *n) { return n == c; }
+
+  RBNode *
+  RBNode::getChild(Direction d) const
+  {
+    return d == RIGHT ? _right : d == LEFT ? _left : 0;
+  }
 
-RBNode*
-RBNode::rotate(Direction d) {
-  self* parent = _parent; // Cache because it can change before we use it.
-  Direction child_dir = _parent ? _parent->getChildDirection(this) : NONE;
-  Direction other_dir = this->flip(d);
-  self* child = this;
-
-  if (d != NONE && this->getChild(other_dir)) {
-    child = this->getChild(other_dir);
-    this->clearChild(other_dir);
-    this->setChild(child->getChild(d), other_dir);
-    child->clearChild(d);
-    child->setChild(this, d);
-    child->structureFixup();
-    this->structureFixup();
-    if (parent) {
-      parent->clearChild(child_dir);
-      parent->setChild(child, child_dir);
-    } else {
-      child->_parent = 0;
+  RBNode *
+  RBNode::rotate(Direction d)
+  {
+    self *parent = _parent; // Cache because it can change before we use it.
+    Direction child_dir = _parent ? _parent->getChildDirection(this) : NONE;
+    Direction other_dir = this->flip(d);
+    self *child = this;
+
+    if (d != NONE && this->getChild(other_dir)) {
+      child = this->getChild(other_dir);
+      this->clearChild(other_dir);
+      this->setChild(child->getChild(d), other_dir);
+      child->clearChild(d);
+      child->setChild(this, d);
+      child->structureFixup();
+      this->structureFixup();
+      if (parent) {
+        parent->clearChild(child_dir);
+        parent->setChild(child, child_dir);
+      } else {
+        child->_parent = 0;
+      }
     }
+    return child;
   }
-  return child;
-}
-
-RBNode*
-RBNode::setChild(self* n, Direction d) {
-  if (n) n->_parent = this;
-  if (d == RIGHT) _right = n;
-  else if (d == LEFT) _left = n;
-  return n;
-}
 
-// Returns the root node
-RBNode*
-RBNode::rippleStructureFixup() {
-  self* root = this; // last node seen, root node at the end
-  self* p = this;
-  while (p) {
-    p->structureFixup();
-    root = p;
-    p = root->_parent;
+  RBNode *
+  RBNode::setChild(self *n, Direction d)
+  {
+    if (n)
+      n->_parent = this;
+    if (d == RIGHT)
+      _right = n;
+    else if (d == LEFT)
+      _left = n;
+    return n;
   }
-  return root;
-}
 
-void
-RBNode::replaceWith(self* n) {
-  n->_color = _color;
-  if (_parent) {
-    Direction d = _parent->getChildDirection(this);
-    _parent->setChild(0, d);
-    if (_parent != n) _parent->setChild(n, d);
-  } else {
-    n->_parent = 0;
+  // Returns the root node
+  RBNode *
+  RBNode::rippleStructureFixup()
+  {
+    self *root = this; // last node seen, root node at the end
+    self *p = this;
+    while (p) {
+      p->structureFixup();
+      root = p;
+      p = root->_parent;
+    }
+    return root;
   }
-  n->_left = n->_right = 0;
-  if (_left && _left != n) n->setChild(_left, LEFT);
-  if (_right && _right != n) n->setChild(_right, RIGHT);
-  _left = _right = 0;
-}
 
-/* Rebalance the tree. This node is the unbalanced node. */
-RBNode*
-RBNode::rebalanceAfterInsert() {
-  self* x(this); // the node with the imbalance
-
-  while (x && x->_parent == RED) {
-    Direction child_dir = NONE;
-
-    if (x->_parent->_parent)
-      child_dir = x->_parent->_parent->getChildDirection(x->_parent);
-    else
-      break;
-    Direction other_dir(flip(child_dir));
-
-    self* y = x->_parent->_parent->getChild(other_dir);
-    if (y == RED) {
-      x->_parent->_color = BLACK;
-      y->_color = BLACK;
-      x = x->_parent->_parent;
-      x->_color = RED;
+  void
+  RBNode::replaceWith(self *n)
+  {
+    n->_color = _color;
+    if (_parent) {
+      Direction d = _parent->getChildDirection(this);
+      _parent->setChild(0, d);
+      if (_parent != n)
+        _parent->setChild(n, d);
     } else {
-      if (x->_parent->getChild(other_dir) == x) {
-        x = x->_parent;
-        x->rotate(child_dir);
-      }
-      // Note setting the parent color to BLACK causes the loop to exit.
-      x->_parent->_color = BLACK;
-      x->_parent->_parent->_color = RED;
-      x->_parent->_parent->rotate(other_dir);
+      n->_parent = 0;
     }
+    n->_left = n->_right = 0;
+    if (_left && _left != n)
+      n->setChild(_left, LEFT);
+    if (_right && _right != n)
+      n->setChild(_right, RIGHT);
+    _left = _right = 0;
   }
 
-  // every node above this one has a subtree structure change,
-  // so notify it. serendipitously, this makes it easy to return
-  // the new root node.
-  self* root = this->rippleStructureFixup();
-  root->_color = BLACK;
+  /* Rebalance the tree. This node is the unbalanced node. */
+  RBNode *
+  RBNode::rebalanceAfterInsert()
+  {
+    self *x(this); // the node with the imbalance
 
-  return root;
-}
+    while (x && x->_parent == RED) {
+      Direction child_dir = NONE;
 
+      if (x->_parent->_parent)
+        child_dir = x->_parent->_parent->getChildDirection(x->_parent);
+      else
+        break;
+      Direction other_dir(flip(child_dir));
+
+      self *y = x->_parent->_parent->getChild(other_dir);
+      if (y == RED) {
+        x->_parent->_color = BLACK;
+        y->_color = BLACK;
+        x = x->_parent->_parent;
+        x->_color = RED;
+      } else {
+        if (x->_parent->getChild(other_dir) == x) {
+          x = x->_parent;
+          x->rotate(child_dir);
+        }
+        // Note setting the parent color to BLACK causes the loop to exit.
+        x->_parent->_color = BLACK;
+        x->_parent->_parent->_color = RED;
+        x->_parent->_parent->rotate(other_dir);
+      }
+    }
+
+    // every node above this one has a subtree structure change,
+    // so notify it. serendipitously, this makes it easy to return
+    // the new root node.
+    self *root = this->rippleStructureFixup();
+    root->_color = BLACK;
 
-// Returns new root node
-RBNode*
-RBNode::remove() {
-  self* root = 0; // new root node, returned to caller
-
-  /*  Handle two special cases first.
-      - This is the only node in the tree, return a new root of NIL
-      - This is the root node with only one child, return that child as new root
-  */
-  if (!_parent && !(_left && _right)) {
-    if (_left) {
-      _left->_parent = 0;
-      root = _left;
-      root->_color = BLACK;
-    } else if (_right) {
-      _right->_parent = 0;
-      root = _right;
-      root->_color = BLACK;
-    } // else that was the only node, so leave @a root @c NULL.
     return root;
   }
 
-  /*  The node to be removed from the tree.
-      If @c this (the target node) has both children, we remove
-      its successor, which cannot have a left child and
-      put that node in place of the target node. Otherwise this
-      node has at most one child, so we can remove it.
-      Note that the successor of a node with a right child is always
-      a right descendant of the node. Therefore, remove_node
-      is an element of the tree rooted at this node.
-      Because of the initial special case checks, we know
-      that remove_node is @b not the root node.
-  */
-  self* remove_node(_left && _right ? _right->leftmostDescendant() : this);
-
-  // This is the color of the node physically removed from the tree.
-  // Normally this is the color of @a remove_node
-  Color remove_color = remove_node->_color;
-  // Need to remember the direction from @a remove_node to @a splice_node
-  Direction d(NONE);
-
-  // The child node that will be promoted to replace the removed node.
-  // The choice of left or right is irrelevant, as remove_node has at
-  // most one child (and splice_node may be NIL if remove_node has no
-  // children).
-  self* splice_node(remove_node->_left
-    ? remove_node->_left
-    : remove_node->_right
-  );
-
-  if (splice_node) {
-    // @c replace_with copies color so in this case the actual color
-    // lost is that of the splice_node.
-    remove_color = splice_node->_color;
-    remove_node->replaceWith(splice_node);
-  } else {
-    // No children on remove node so we can just clip it off the tree
-    // We update splice_node to maintain the invariant that it is
-    // the node where the physical removal occurred.
-    splice_node = remove_node->_parent;
-    // Keep @a d up to date.
-    d = splice_node->getChildDirection(remove_node);
-    splice_node->setChild(0, d);
-  }
 
-  // If the node to pull out of the tree isn't this one,
-  // then replace this node in the tree with that removed
-  // node in liu of copying the data over.
-  if (remove_node != this) {
-    // Don't leave @a splice_node referring to a removed node
-    if (splice_node == this) splice_node = remove_node;
-    this->replaceWith(remove_node);
-  }
+  // Returns new root node
+  RBNode *
+  RBNode::remove()
+  {
+    self *root = 0; // new root node, returned to caller
 
-  root = splice_node->rebalanceAfterRemove(remove_color, d);
-  root->_color = BLACK;
-  return root;
-}
+    /*  Handle two special cases first.
+        - This is the only node in the tree, return a new root of NIL
+        - This is the root node with only one child, return that child as new root
+    */
+    if (!_parent && !(_left && _right)) {
+      if (_left) {
+        _left->_parent = 0;
+        root = _left;
+        root->_color = BLACK;
+      } else if (_right) {
+        _right->_parent = 0;
+        root = _right;
+        root->_color = BLACK;
+      } // else that was the only node, so leave @a root @c NULL.
+      return root;
+    }
 
-/**
- * Rebalance tree after a deletion
- * Called on the spliced in node or its parent, whichever is not NIL.
- * This modifies the tree structure only if @a c is @c BLACK.
- */
-RBNode*
-RBNode::rebalanceAfterRemove(
-  Color c, //!< The color of the removed node
-  Direction d //!< Direction of removed node from its parent
-) {
-  self* root;
-
-  if (BLACK == c) { // only rebalance if too much black
-    self* n = this;
-    self* parent = n->_parent;
-
-    // If @a direction is set, then we need to start at a leaf psuedo-node.
-    // This is why we need @a parent, otherwise we could just use @a n.
-    if (NONE != d) {
-      parent = n;
-      n = 0;
+    /*  The node to be removed from the tree.
+        If @c this (the target node) has both children, we remove
+        its successor, which cannot have a left child and
+        put that node in place of the target node. Otherwise this
+        node has at most one child, so we can remove it.
+        Note that the successor of a node with a right child is always
+        a right descendant of the node. Therefore, remove_node
+        is an element of the tree rooted at this node.
+        Because of the initial special case checks, we know
+        that remove_node is @b not the root node.
+    */
+    self *remove_node(_left && _right ? _right->leftmostDescendant() : this);
+
+    // This is the color of the node physically removed from the tree.
+    // Normally this is the color of @a remove_node
+    Color remove_color = remove_node->_color;
+    // Need to remember the direction from @a remove_node to @a splice_node
+    Direction d(NONE);
+
+    // The child node that will be promoted to replace the removed node.
+    // The choice of left or right is irrelevant, as remove_node has at
+    // most one child (and splice_node may be NIL if remove_node has no
+    // children).
+    self *splice_node(remove_node->_left ? remove_node->_left : remove_node->_right);
+
+    if (splice_node) {
+      // @c replace_with copies color so in this case the actual color
+      // lost is that of the splice_node.
+      remove_color = splice_node->_color;
+      remove_node->replaceWith(splice_node);
+    } else {
+      // No children on remove node so we can just clip it off the tree
+      // We update splice_node to maintain the invariant that it is
+      // the node where the physical removal occurred.
+      splice_node = remove_node->_parent;
+      // Keep @a d up to date.
+      d = splice_node->getChildDirection(remove_node);
+      splice_node->setChild(0, d);
     }
 
-    while (parent) { // @a n is not the root
-      // If the current node is RED, we can just recolor and be done
-      if (n == RED) {
-        n->_color = BLACK;
-        break;
-      } else {
-        // Parameterizing the rebalance logic on the directions. We
-        // write for the left child case and flip directions for the
-        // right child case
-        Direction near(LEFT), far(RIGHT);
-        if (
-          (NONE == d && parent->getChildDirection(n) == RIGHT)
-          || RIGHT == d
-        ) {
-          near = RIGHT;
-          far = LEFT;
-        }
+    // If the node to pull out of the tree isn't this one,
+    // then replace this node in the tree with that removed
+    // node in liu of copying the data over.
+    if (remove_node != this) {
+      // Don't leave @a splice_node referring to a removed node
+      if (splice_node == this)
+        splice_node = remove_node;
+      this->replaceWith(remove_node);
+    }
 
-        self* w = parent->getChild(far); // sibling(n)
+    root = splice_node->rebalanceAfterRemove(remove_color, d);
+    root->_color = BLACK;
+    return root;
+  }
 
-        if (w->_color == RED) {
-          w->_color = BLACK;
-          parent->_color = RED;
-          parent->rotate(near);
-          w = parent->getChild(far);
-        }
+  /**
+   * Rebalance tree after a deletion
+   * Called on the spliced in node or its parent, whichever is not NIL.
+   * This modifies the tree structure only if @a c is @c BLACK.
+   */
+  RBNode *
+  RBNode::rebalanceAfterRemove(Color c,    //!< The color of the removed node
+                               Direction d //!< Direction of removed node from its parent
+                               )
+  {
+    self *root;
+
+    if (BLACK == c) { // only rebalance if too much black
+      self *n = this;
+      self *parent = n->_parent;
+
+      // If @a direction is set, then we need to start at a leaf psuedo-node.
+      // This is why we need @a parent, otherwise we could just use @a n.
+      if (NONE != d) {
+        parent = n;
+        n = 0;
+      }
 
-        self* wfc = w->getChild(far);
-        if (w->getChild(near) == BLACK && wfc == BLACK) {
-          w->_color = RED;
-          n = parent;
-          parent = n->_parent;
-          d = NONE; // Cancel any leaf node logic
+      while (parent) { // @a n is not the root
+        // If the current node is RED, we can just recolor and be done
+        if (n == RED) {
+          n->_color = BLACK;
+          break;
         } else {
-          if (wfc->_color == BLACK) {
-            w->getChild(near)->_color = BLACK;
-            w->_color = RED;
-            w->rotate(far);
+          // Parameterizing the rebalance logic on the directions. We
+          // write for the left child case and flip directions for the
+          // right child case
+          Direction near(LEFT), far(RIGHT);
+          if ((NONE == d && parent->getChildDirection(n) == RIGHT) || RIGHT == d) {
+            near = RIGHT;
+            far = LEFT;
+          }
+
+          self *w = parent->getChild(far); // sibling(n)
+
+          if (w->_color == RED) {
+            w->_color = BLACK;
+            parent->_color = RED;
+            parent->rotate(near);
             w = parent->getChild(far);
-            wfc = w->getChild(far); // w changed, update far child cache.
           }
-          w->_color = parent->_color;
-          parent->_color = BLACK;
-          wfc->_color = BLACK;
-          parent->rotate(near);
-          break;
+
+          self *wfc = w->getChild(far);
+          if (w->getChild(near) == BLACK && wfc == BLACK) {
+            w->_color = RED;
+            n = parent;
+            parent = n->_parent;
+            d = NONE; // Cancel any leaf node logic
+          } else {
+            if (wfc->_color == BLACK) {
+              w->getChild(near)->_color = BLACK;
+              w->_color = RED;
+              w->rotate(far);
+              w = parent->getChild(far);
+              wfc = w->getChild(far); // w changed, update far child cache.
+            }
+            w->_color = parent->_color;
+            parent->_color = BLACK;
+            wfc->_color = BLACK;
+            parent->rotate(near);
+            break;
+          }
         }
       }
     }
+    root = this->rippleStructureFixup();
+    return root;
   }
-  root = this->rippleStructureFixup();
-  return root;
-}
 
-/** Ensure that the local information associated with each node is
-    correct globally This should only be called on debug builds as it
-    breaks any efficiencies we have gained from our tree structure.
-    */
-int
-RBNode::validate() {
-# if 0
+  /** Ensure that the local information associated with each node is
+      correct globally This should only be called on debug builds as it
+      breaks any efficiencies we have gained from our tree structure.
+      */
+  int
+  RBNode::validate()
+  {
+#if 0
   int black_ht = 0;
   int black_ht1, black_ht2;
 
@@ -344,12 +348,9 @@ RBNode::validate() {
     black_ht = 0;
 
   return black_ht;
-# else
-  return 0;
-# endif
+#else
+    return 0;
+#endif
+  }
+}
 }
-
-}}
-
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/RbTree.h
----------------------------------------------------------------------
diff --git a/lib/ts/RbTree.h b/lib/ts/RbTree.h
index 5c8ac43..03635e7 100644
--- a/lib/ts/RbTree.h
+++ b/lib/ts/RbTree.h
@@ -22,179 +22,200 @@
 #ifndef RBTREE_H_
 #define RBTREE_H_
 
-namespace ts { namespace detail {
-
-/** A node in a red/black tree.
-
-    This class provides only the basic tree operations. The client
-    must provide the search and decision logic. This enables this
-    class to be a base class for templated nodes with much less code
-    duplication.
-*/
-struct RBNode {
-  typedef RBNode self; ///< self reference type
-
-  /// Node colors
-  typedef enum { RED, BLACK } Color;
-
-  /// Directional constants
-  typedef enum { NONE, LEFT, RIGHT } Direction;
-
-  /// Get a child by direction.
-  /// @return The child in the direction @a d if it exists,
-  /// @c NULL if not.
-  self* getChild(
-    Direction d //!< The direction of the desired child
-  ) const;
-
-  /** Determine which child a node is
-      @return @c LEFT if @a n is the left child,
-      @c RIGHT if @a n is the right child,
-      @c NONE if @a n is not a child
+namespace ts
+{
+namespace detail
+{
+  /** A node in a red/black tree.
+
+      This class provides only the basic tree operations. The client
+      must provide the search and decision logic. This enables this
+      class to be a base class for templated nodes with much less code
+      duplication.
   */
-  Direction getChildDirection(
-    self* const& n //!< The presumed child node
-  ) const {
-    return (n == _left) ? LEFT : (n == _right) ? RIGHT : NONE;
-  }
-
-  /** Get the parent node.
-      @return A Node* to the parent node or a @c nil Node* if no parent.
-  */
-  self* getParent() const { return const_cast<self*>(_parent); }
-
-  /// @return The color of the node.
-  Color getColor() const { return _color; }
-
-  self* leftmostDescendant() const {
-      const self* n = this;
+  struct RBNode {
+    typedef RBNode self; ///< self reference type
+
+    /// Node colors
+    typedef enum {
+      RED,
+      BLACK,
+    } Color;
+
+    /// Directional constants
+    typedef enum {
+      NONE,
+      LEFT,
+      RIGHT,
+    } Direction;
+
+    /// Get a child by direction.
+    /// @return The child in the direction @a d if it exists,
+    /// @c NULL if not.
+    self *getChild(Direction d //!< The direction of the desired child
+                   ) const;
+
+    /** Determine which child a node is
+        @return @c LEFT if @a n is the left child,
+        @c RIGHT if @a n is the right child,
+        @c NONE if @a n is not a child
+    */
+    Direction
+    getChildDirection(self *const &n //!< The presumed child node
+                      ) const
+    {
+      return (n == _left) ? LEFT : (n == _right) ? RIGHT : NONE;
+    }
+
+    /** Get the parent node.
+        @return A Node* to the parent node or a @c nil Node* if no parent.
+    */
+    self *
+    getParent() const
+    {
+      return const_cast<self *>(_parent);
+    }
+
+    /// @return The color of the node.
+    Color
+    getColor() const
+    {
+      return _color;
+    }
+
+    self *
+    leftmostDescendant() const
+    {
+      const self *n = this;
       while (n->_left)
-          n = n->_left;
-
-      return const_cast<self*>(n);
-  }
-
-  /** Reverse a direction
-      @return @c LEFT if @a d is @c RIGHT, @c RIGHT if @a d is @c LEFT,
-      @c NONE otherwise.
-  */
-  Direction flip(Direction d) {
-    return LEFT == d ? RIGHT : RIGHT == d ? LEFT : NONE;
-  }
-
-  /** Perform internal validation checks.
-      @return 0 on failure, black height of the tree on success.
-  */
-  int validate();
-
-  /// Default constructor.
-  RBNode()
-    : _color(RED)
-    , _parent(0)
-    , _left(0)
-    , _right(0)
-    , _next(0)
-    , _prev(0) {
-  }
-
-  /// Destructor (force virtual).
-  virtual ~RBNode() { }
-
-  /** Rotate the subtree rooted at this node.
-      The node is rotated in to the position of one of its children.
-      Which child is determined by the direction parameter @a d. The
-      child in the other direction becomes the new root of the subtree.
-
-      If the parent pointer is set, then the child pointer of the original
-      parent is updated so that the tree is left in a consistent state.
-
-      @note If there is no child in the other direction, the rotation
-      fails and the original node is returned. It is @b not required
-      that a child exist in the direction specified by @a d.
-
-      @return The new root node for the subtree.
-  */
-  self* rotate(
-    Direction d //!< The direction to rotate
-  );
-
-  /** Set the child node in direction @a d to @a n.
-      The @a d child is set to the node @a n. The pointers in this
-      node and @a n are set correctly. This can only be called if
-      there is no child node already present.
-
-      @return @a n.
-  */
-  self* setChild(
-    self* n, //!< The node to set as the child
-    Direction d //!< The direction of the child
-  );
-
-  /** Remove this node from the tree.
-      The tree is rebalanced after removal.
-      @return The new root node.
-  */
-  self* remove();
-
-  void clearChild(Direction dir) {
-    if (LEFT == dir) _left = 0;
-    else if (RIGHT == dir) _right = 0;
-  }
-
-  /** @name Subclass hook methods */
-  //@{
-  /** Structural change notification.
-      This method is called if the structure of the subtree rooted at
-      this node was changed.
-
-      This is intended a hook. The base method is empty so that subclasses
-      are not required to override.
-  */
-  virtual void structureFixup() {}
-
-  /** Called from @c validate to perform any additional validation checks.
-      Clients should chain this if they wish to perform additional checks.
-      @return @c true if the validation is successful, @c false otherwise.
-      @note The base method simply returns @c true.
-  */
-  virtual bool structureValidate() { return true; }
-  //@}
-
-  /** Replace this node with another node.
-      This is presumed to be non-order modifying so the next reference
-      is @b not updated.
-  */
-  void replaceWith(
-    self* n //!< Node to put in place of this node.
-  );
-
-  //! Rebalance the tree starting at this node
-  /** The tree is rebalanced so that all of the invariants are
-      true. The (potentially new) root of the tree is returned.
-
-      @return The root node of the tree after the rebalance.
-  */
-  self* rebalanceAfterInsert();
-
-  /** Rebalance the tree after a deletion.
-      Called on the lowest modified node.
-      @return The new root of the tree.
-  */
-  self* rebalanceAfterRemove(
-    Color c, //!< The color of the removed node.
-    Direction d //!< Direction of removed node from parent
-  );
-
-  //! Invoke @c structure_fixup() on this node and all of its ancestors.
-  self* rippleStructureFixup();
-
-  Color _color;  ///< node color
-  self* _parent; ///< parent node (needed for rotations)
-  self* _left;   ///< left child
-  self* _right;  ///< right child
-  self* _next; ///< Next node.
-  self* _prev; ///< Previous node.
-};
+        n = n->_left;
+
+      return const_cast<self *>(n);
+    }
+
+    /** Reverse a direction
+        @return @c LEFT if @a d is @c RIGHT, @c RIGHT if @a d is @c LEFT,
+        @c NONE otherwise.
+    */
+    Direction
+    flip(Direction d)
+    {
+      return LEFT == d ? RIGHT : RIGHT == d ? LEFT : NONE;
+    }
+
+    /** Perform internal validation checks.
+        @return 0 on failure, black height of the tree on success.
+    */
+    int validate();
+
+    /// Default constructor.
+    RBNode() : _color(RED), _parent(0), _left(0), _right(0), _next(0), _prev(0) {}
+
+    /// Destructor (force virtual).
+    virtual ~RBNode() {}
+
+    /** Rotate the subtree rooted at this node.
+        The node is rotated in to the position of one of its children.
+        Which child is determined by the direction parameter @a d. The
+        child in the other direction becomes the new root of the subtree.
+
+        If the parent pointer is set, then the child pointer of the original
+        parent is updated so that the tree is left in a consistent state.
+
+        @note If there is no child in the other direction, the rotation
+        fails and the original node is returned. It is @b not required
+        that a child exist in the direction specified by @a d.
+
+        @return The new root node for the subtree.
+    */
+    self *rotate(Direction d //!< The direction to rotate
+                 );
+
+    /** Set the child node in direction @a d to @a n.
+        The @a d child is set to the node @a n. The pointers in this
+        node and @a n are set correctly. This can only be called if
+        there is no child node already present.
+
+        @return @a n.
+    */
+    self *setChild(self *n,    //!< The node to set as the child
+                   Direction d //!< The direction of the child
+                   );
+
+    /** Remove this node from the tree.
+        The tree is rebalanced after removal.
+        @return The new root node.
+    */
+    self *remove();
+
+    void
+    clearChild(Direction dir)
+    {
+      if (LEFT == dir)
+        _left = 0;
+      else if (RIGHT == dir)
+        _right = 0;
+    }
+
+    /** @name Subclass hook methods */
+    //@{
+    /** Structural change notification.
+        This method is called if the structure of the subtree rooted at
+        this node was changed.
+
+        This is intended a hook. The base method is empty so that subclasses
+        are not required to override.
+    */
+    virtual void
+    structureFixup()
+    {
+    }
+
+    /** Called from @c validate to perform any additional validation checks.
+        Clients should chain this if they wish to perform additional checks.
+        @return @c true if the validation is successful, @c false otherwise.
+        @note The base method simply returns @c true.
+    */
+    virtual bool
+    structureValidate()
+    {
+      return true;
+    }
+    //@}
+
+    /** Replace this node with another node.
+        This is presumed to be non-order modifying so the next reference
+        is @b not updated.
+    */
+    void replaceWith(self *n //!< Node to put in place of this node.
+                     );
+
+    //! Rebalance the tree starting at this node
+    /** The tree is rebalanced so that all of the invariants are
+        true. The (potentially new) root of the tree is returned.
+
+        @return The root node of the tree after the rebalance.
+    */
+    self *rebalanceAfterInsert();
+
+    /** Rebalance the tree after a deletion.
+        Called on the lowest modified node.
+        @return The new root of the tree.
+    */
+    self *rebalanceAfterRemove(Color c,    //!< The color of the removed node.
+                               Direction d //!< Direction of removed node from parent
+                               );
+
+    //! Invoke @c structure_fixup() on this node and all of its ancestors.
+    self *rippleStructureFixup();
+
+    Color _color;  ///< node color
+    self *_parent; ///< parent node (needed for rotations)
+    self *_left;   ///< left child
+    self *_right;  ///< right child
+    self *_next;   ///< Next node.
+    self *_prev;   ///< Previous node.
+  };
 
 } /* namespace detail */
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Regex.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Regex.cc b/lib/ts/Regex.cc
index ba98608..ecccb86 100644
--- a/lib/ts/Regex.cc
+++ b/lib/ts/Regex.cc
@@ -25,11 +25,8 @@
 #include "Regex.h"
 
 #ifdef PCRE_CONFIG_JIT
-struct RegexThreadKey
-{
-  RegexThreadKey() {
-    ink_thread_key_create(&this->key, (void (*)(void *)) &pcre_jit_stack_free);
-  }
+struct RegexThreadKey {
+  RegexThreadKey() { ink_thread_key_create(&this->key, (void (*)(void *)) & pcre_jit_stack_free); }
 
   ink_thread_key key;
 };
@@ -41,7 +38,7 @@ get_jit_stack(void *data ATS_UNUSED)
 {
   pcre_jit_stack *jit_stack;
 
-  if ((jit_stack = (pcre_jit_stack *) ink_thread_getspecific(k.key)) == NULL) {
+  if ((jit_stack = (pcre_jit_stack *)ink_thread_getspecific(k.key)) == NULL) {
     jit_stack = pcre_jit_stack_alloc(ats_pagesize(), 1024 * 1024); // 1 page min and 1MB max
     ink_thread_setspecific(k.key, (void *)jit_stack);
   }
@@ -82,8 +79,8 @@ Regex::compile(const char *pattern, unsigned flags)
   regex_extra = pcre_study(regex, study_opts, &error);
 
 #ifdef PCRE_CONFIG_JIT
-    if (regex_extra)
-      pcre_assign_jit_stack(regex_extra, &get_jit_stack, NULL);
+  if (regex_extra)
+    pcre_assign_jit_stack(regex_extra, &get_jit_stack, NULL);
 #endif
 
   return true;
@@ -100,7 +97,7 @@ Regex::exec(const char *str, int length)
 {
   int ovector[30], rv;
 
-  rv = pcre_exec(regex, regex_extra, str, length , 0, 0, ovector, countof(ovector));
+  rv = pcre_exec(regex, regex_extra, str, length, 0, 0, ovector, countof(ovector));
   return rv > 0 ? true : false;
 }
 
@@ -118,13 +115,13 @@ Regex::~Regex()
 
 DFA::~DFA()
 {
-  dfa_pattern * p = _my_patterns;
-  dfa_pattern * t;
+  dfa_pattern *p = _my_patterns;
+  dfa_pattern *t;
 
-  while(p) {
+  while (p) {
     if (p->_re)
       delete p->_re;
-    if(p->_p)
+    if (p->_p)
       ats_free(p->_p);
     t = p->_next;
     ats_free(p);
@@ -135,14 +132,14 @@ DFA::~DFA()
 dfa_pattern *
 DFA::build(const char *pattern, unsigned flags)
 {
-  dfa_pattern* ret;
+  dfa_pattern *ret;
   int rv;
 
   if (!(flags & RE_UNANCHORED)) {
     flags |= RE_ANCHORED;
   }
 
-  ret = (dfa_pattern*)ats_malloc(sizeof(dfa_pattern));
+  ret = (dfa_pattern *)ats_malloc(sizeof(dfa_pattern));
   ret->_p = NULL;
 
   ret->_re = new Regex();
@@ -159,9 +156,11 @@ DFA::build(const char *pattern, unsigned flags)
   return ret;
 }
 
-int DFA::compile(const char *pattern, unsigned flags) {
+int
+DFA::compile(const char *pattern, unsigned flags)
+{
   ink_assert(_my_patterns == NULL);
-  _my_patterns = build(pattern,flags);
+  _my_patterns = build(pattern, flags);
   if (_my_patterns)
     return 0;
   else
@@ -178,7 +177,7 @@ DFA::compile(const char **patterns, int npatterns, unsigned flags)
 
   for (i = 0; i < npatterns; i++) {
     pattern = patterns[i];
-    ret = build(pattern,flags);
+    ret = build(pattern, flags);
     if (!ret) {
       continue;
     }
@@ -187,16 +186,14 @@ DFA::compile(const char **patterns, int npatterns, unsigned flags)
       _my_patterns = ret;
       _my_patterns->_next = NULL;
       _my_patterns->_idx = i;
-    }
-    else {
+    } else {
       end = _my_patterns;
-      while( end->_next ) {
+      while (end->_next) {
         end = end->_next;
       }
-      end->_next = ret; //add to end
+      end->_next = ret; // add to end
       ret->_idx = i;
     }
-
   }
 
   return 0;
@@ -205,16 +202,16 @@ DFA::compile(const char **patterns, int npatterns, unsigned flags)
 int
 DFA::match(const char *str) const
 {
-  return match(str,strlen(str));
+  return match(str, strlen(str));
 }
 
 int
 DFA::match(const char *str, int length) const
 {
   int rc;
-  dfa_pattern * p = _my_patterns;
+  dfa_pattern *p = _my_patterns;
 
-  while(p) {
+  while (p) {
     rc = p->_re->exec(str, length);
     if (rc > 0) {
       return p->_idx;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Regex.h
----------------------------------------------------------------------
diff --git a/lib/ts/Regex.h b/lib/ts/Regex.h
index ac45958..f56e855 100644
--- a/lib/ts/Regex.h
+++ b/lib/ts/Regex.h
@@ -32,8 +32,7 @@
 #include <pcre.h>
 #endif
 
-enum REFlags
-{
+enum REFlags {
   RE_CASE_INSENSITIVE = 0x0001, // default is case sensitive
   RE_UNANCHORED = 0x0002,       // default (for DFA) is to anchor at the first matching position
   RE_ANCHORED = 0x0004,         // default (for Regex) is unanchored
@@ -42,8 +41,7 @@ enum REFlags
 class Regex
 {
 public:
-  Regex():regex(NULL), regex_extra(NULL) {
-  }
+  Regex() : regex(NULL), regex_extra(NULL) {}
   bool compile(const char *pattern, unsigned flags = 0);
   // It is safe to call exec() concurrently on the same object instance
   bool exec(const char *str);
@@ -59,14 +57,13 @@ typedef struct __pat {
   int _idx;
   Regex *_re;
   char *_p;
-  __pat * _next;
+  __pat *_next;
 } dfa_pattern;
 
 class DFA
 {
 public:
-  DFA():_my_patterns(0) {
-  }
+  DFA() : _my_patterns(0) {}
 
   ~DFA();
 
@@ -77,9 +74,9 @@ public:
   int match(const char *str, int length) const;
 
 private:
-  dfa_pattern * build(const char *pattern, unsigned flags = 0);
+  dfa_pattern *build(const char *pattern, unsigned flags = 0);
 
-  dfa_pattern * _my_patterns;
+  dfa_pattern *_my_patterns;
 };
 
 #endif /* __TS_REGEX_H__ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Regression.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Regression.cc b/lib/ts/Regression.cc
index 39e7438..e64632c 100644
--- a/lib/ts/Regression.cc
+++ b/lib/ts/Regression.cc
@@ -43,12 +43,13 @@ int RegressionTest::final_status = REGRESSION_TEST_PASSED;
 char *
 regression_status_string(int status)
 {
-  return (char *) (status == REGRESSION_TEST_NOT_RUN ? "NOT_RUN" :
-                   (status == REGRESSION_TEST_PASSED ? "PASSED" :
-                    (status == REGRESSION_TEST_INPROGRESS ? "INPROGRESS" : "FAILED")));
+  return (
+    char *)(status == REGRESSION_TEST_NOT_RUN ?
+              "NOT_RUN" :
+              (status == REGRESSION_TEST_PASSED ? "PASSED" : (status == REGRESSION_TEST_INPROGRESS ? "INPROGRESS" : "FAILED")));
 }
 
-RegressionTest::RegressionTest(const char *name_arg, TestFunction * function_arg, int aopt)
+RegressionTest::RegressionTest(const char *name_arg, TestFunction *function_arg, int aopt)
 {
   name = name_arg;
   function = function_arg;
@@ -68,16 +69,16 @@ RegressionTest::RegressionTest(const char *name_arg, TestFunction * function_arg
 }
 
 static inline int
-start_test(RegressionTest * t)
+start_test(RegressionTest *t)
 {
   ink_assert(t->status == REGRESSION_TEST_NOT_RUN);
   t->status = REGRESSION_TEST_INPROGRESS;
   fprintf(stderr, "REGRESSION TEST %s started\n", t->name);
-  (*t->function) (t, regression_level, &t->status);
+  (*t->function)(t, regression_level, &t->status);
   int tresult = t->status;
   if (tresult != REGRESSION_TEST_INPROGRESS) {
-    fprintf(stderr, "    REGRESSION_RESULT %s:%*s %s\n", t->name,
-            40 - (int)strlen(t->name), " ", regression_status_string(tresult));
+    fprintf(stderr, "    REGRESSION_RESULT %s:%*s %s\n", t->name, 40 - (int)strlen(t->name), " ",
+            regression_status_string(tresult));
     t->printed = 1;
   }
   return tresult;
@@ -92,7 +93,7 @@ RegressionTest::run(char *atest)
     dfa.compile(".*");
   fprintf(stderr, "REGRESSION_TEST initialization begun\n");
   // start the non exclusive tests
-  for (RegressionTest * t = test; t; t = t->next) {
+  for (RegressionTest *t = test; t; t = t->next) {
     if ((dfa.match(t->name) >= 0)) {
       int res = start_test(t);
       if (res == REGRESSION_TEST_FAILED)
@@ -106,15 +107,14 @@ RegressionTest::run(char *atest)
 int
 RegressionTest::run_some()
 {
-
   if (current) {
     if (current->status == REGRESSION_TEST_INPROGRESS)
       return REGRESSION_TEST_INPROGRESS;
     else if (current->status != REGRESSION_TEST_NOT_RUN) {
       if (!current->printed) {
         current->printed = true;
-        fprintf(stderr, "    REGRESSION_RESULT %s:%*s %s\n", current->name,
-                40 - (int)strlen(current->name), " ", regression_status_string(current->status));
+        fprintf(stderr, "    REGRESSION_RESULT %s:%*s %s\n", current->name, 40 - (int)strlen(current->name), " ",
+                regression_status_string(current->status));
       }
       current = current->next;
     }
@@ -148,8 +148,8 @@ check_test_list:
   while (t) {
     if ((t->status == REGRESSION_TEST_PASSED || t->status == REGRESSION_TEST_FAILED) && !t->printed) {
       t->printed = true;
-      fprintf(stderr, "    REGRESSION_RESULT %s:%*s %s\n", t->name,
-              40 - (int)strlen(t->name), " ", regression_status_string(t->status));
+      fprintf(stderr, "    REGRESSION_RESULT %s:%*s %s\n", t->name, 40 - (int)strlen(t->name), " ",
+              regression_status_string(t->status));
     }
 
     switch (t->status) {
@@ -202,9 +202,10 @@ rperf(RegressionTest *t, const char *tag, double val)
   return (l);
 }
 
-REGRESSION_TEST(Regression) (RegressionTest * t, int atype, int *status) {
-  (void) t;
-  (void) atype;
+REGRESSION_TEST(Regression)(RegressionTest *t, int atype, int *status)
+{
+  (void)t;
+  (void)atype;
   rprintf(t, "regression test\n");
   rperf(t, "speed", 100.0);
   if (!test)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Regression.h
----------------------------------------------------------------------
diff --git a/lib/ts/Regression.h b/lib/ts/Regression.h
index 189abe5..ef0f5c7 100644
--- a/lib/ts/Regression.h
+++ b/lib/ts/Regression.h
@@ -45,28 +45,27 @@
 
 
 // status values
-#define REGRESSION_TEST_PASSED         1
-#define REGRESSION_TEST_INPROGRESS     0 // initial value
-#define REGRESSION_TEST_FAILED         -1
-#define REGRESSION_TEST_NOT_RUN        -2
+#define REGRESSION_TEST_PASSED 1
+#define REGRESSION_TEST_INPROGRESS 0 // initial value
+#define REGRESSION_TEST_FAILED -1
+#define REGRESSION_TEST_NOT_RUN -2
 
 // regression types
-#define REGRESSION_TEST_NONE           0
-#define REGRESSION_TEST_QUICK          1
-#define REGRESSION_TEST_NIGHTLY        2
-#define REGRESSION_TEST_EXTENDED       3
- // use only for testing TS error handling!
-#define REGRESSION_TEST_FATAL          4
+#define REGRESSION_TEST_NONE 0
+#define REGRESSION_TEST_QUICK 1
+#define REGRESSION_TEST_NIGHTLY 2
+#define REGRESSION_TEST_EXTENDED 3
+// use only for testing TS error handling!
+#define REGRESSION_TEST_FATAL 4
 
 // regression options
-#define REGRESSION_OPT_EXCLUSIVE       (1 << 0)
+#define REGRESSION_OPT_EXCLUSIVE (1 << 0)
 
 struct RegressionTest;
 
-typedef void TestFunction(RegressionTest * t, int type, int *status);
+typedef void TestFunction(RegressionTest *t, int type, int *status);
 
-struct RegressionTest
-{
+struct RegressionTest {
   const char *name;
   TestFunction *function;
   RegressionTest *next;
@@ -74,7 +73,7 @@ struct RegressionTest
   int printed;
   int opt;
 
-  RegressionTest(const char *name_arg, TestFunction * function_arg, int aopt);
+  RegressionTest(const char *name_arg, TestFunction *function_arg, int aopt);
 
   static int final_status;
   static int ran_tests;
@@ -85,17 +84,17 @@ struct RegressionTest
   static int check_status();
 };
 
-#define REGRESSION_TEST(_f) \
-void RegressionTest_##_f(RegressionTest * t, int atype, int *pstatus); \
-RegressionTest regressionTest_##_f(#_f,&RegressionTest_##_f, 0);\
-void RegressionTest_##_f
+#define REGRESSION_TEST(_f)                                             \
+  void RegressionTest_##_f(RegressionTest *t, int atype, int *pstatus); \
+  RegressionTest regressionTest_##_f(#_f, &RegressionTest_##_f, 0);     \
+  void RegressionTest_##_f
 
-#define EXCLUSIVE_REGRESSION_TEST(_f) \
-void RegressionTest_##_f(RegressionTest * t, int atype, int *pstatus); \
-RegressionTest regressionTest_##_f(#_f,&RegressionTest_##_f, REGRESSION_OPT_EXCLUSIVE);\
-void RegressionTest_##_f
+#define EXCLUSIVE_REGRESSION_TEST(_f)                                                      \
+  void RegressionTest_##_f(RegressionTest *t, int atype, int *pstatus);                    \
+  RegressionTest regressionTest_##_f(#_f, &RegressionTest_##_f, REGRESSION_OPT_EXCLUSIVE); \
+  void RegressionTest_##_f
 
-int rprintf(RegressionTest * t, const char *format, ...);
+int rprintf(RegressionTest *t, const char *format, ...);
 int rperf(RegressionTest *t, const char *tag, double val);
 char *regression_status_string(int status);
 


[34/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterHandler.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterHandler.h b/iocore/cluster/P_ClusterHandler.h
index 4a62755..c6461ed 100644
--- a/iocore/cluster/P_ClusterHandler.h
+++ b/iocore/cluster/P_ClusterHandler.h
@@ -34,45 +34,45 @@
 class ClusterLoadMonitor;
 
 struct ClusterCalloutContinuation;
-typedef int (ClusterCalloutContinuation::*ClstCoutContHandler) (int, void *);
+typedef int (ClusterCalloutContinuation::*ClstCoutContHandler)(int, void *);
 
-struct ClusterCalloutContinuation:public Continuation
-{
+struct ClusterCalloutContinuation : public Continuation {
   struct ClusterHandler *_ch;
 
-  int CalloutHandler(int event, Event * e);
-    ClusterCalloutContinuation(struct ClusterHandler *ch);
-   ~ClusterCalloutContinuation();
+  int CalloutHandler(int event, Event *e);
+  ClusterCalloutContinuation(struct ClusterHandler *ch);
+  ~ClusterCalloutContinuation();
 };
 
-struct ClusterControl: public Continuation
-{
+struct ClusterControl : public Continuation {
   int len; // TODO: Should this be 64-bit ?
   char size_index;
   int64_t *real_data;
   char *data;
-  void (*free_proc) (void *);
+  void (*free_proc)(void *);
   void *free_proc_arg;
-    Ptr<IOBufferBlock> iob_block;
+  Ptr<IOBufferBlock> iob_block;
 
-  IOBufferBlock *get_block()
+  IOBufferBlock *
+  get_block()
   {
     return iob_block;
   }
-  bool fast_data()
+  bool
+  fast_data()
   {
     return (len <= MAX_FAST_CONTROL_MESSAGE);
   }
-  bool valid_alloc_data()
+  bool
+  valid_alloc_data()
   {
     return iob_block && real_data && data;
   }
 
-  enum
-  {
+  enum {
     // DATA_HDR = size_index (1 byte) + magicno (1 byte) + sizeof(this)
 
-    DATA_HDR = (sizeof(int64_t) * 2)      // must be multiple of sizeof(int64_t)
+    DATA_HDR = (sizeof(int64_t) * 2) // must be multiple of sizeof(int64_t)
   };
 
   ClusterControl();
@@ -81,19 +81,21 @@ struct ClusterControl: public Continuation
   virtual void freeall() = 0;
 };
 
-struct OutgoingControl: public ClusterControl
-{
+struct OutgoingControl : public ClusterControl {
   ClusterHandler *ch;
   ink_hrtime submit_time;
 
   static OutgoingControl *alloc();
 
-    OutgoingControl();
-  void alloc_data(bool align_int32_on_non_int64_boundary = true) {
-    real_alloc_data(1, align_int32_on_non_int64_boundary);      /* read access */
+  OutgoingControl();
+  void
+  alloc_data(bool align_int32_on_non_int64_boundary = true)
+  {
+    real_alloc_data(1, align_int32_on_non_int64_boundary); /* read access */
   }
 
-  void set_data(char *adata, int alen)
+  void
+  set_data(char *adata, int alen)
   {
     data = adata;
     len = alen;
@@ -108,31 +110,33 @@ struct OutgoingControl: public ClusterControl
     iob_block->_buf_end = iob_block->end();
   }
 
-  void set_data(IOBufferBlock * buf, void (*free_data_proc) (void *), void *free_data_arg)
+  void
+  set_data(IOBufferBlock *buf, void (*free_data_proc)(void *), void *free_data_arg)
   {
     data = buf->data->data();
-    len = bytes_IOBufferBlockList(buf, 1);      // read avail bytes
+    len = bytes_IOBufferBlockList(buf, 1); // read avail bytes
     free_proc = free_data_proc;
     free_proc_arg = free_data_arg;
     real_data = 0;
     iob_block = buf;
   }
-  int startEvent(int event, Event * e);
+  int startEvent(int event, Event *e);
   virtual void freeall();
 };
 
 //
 // incoming control messsage are received by this machine
 //
-struct IncomingControl: public ClusterControl
-{
+struct IncomingControl : public ClusterControl {
   ink_hrtime recognized_time;
 
   static IncomingControl *alloc();
 
-    IncomingControl();
-  void alloc_data(bool align_int32_on_non_int64_boundary = true) {
-    real_alloc_data(0, align_int32_on_non_int64_boundary);      /* write access */
+  IncomingControl();
+  void
+  alloc_data(bool align_int32_on_non_int64_boundary = true)
+  {
+    real_alloc_data(0, align_int32_on_non_int64_boundary); /* write access */
   }
   virtual void freeall();
 };
@@ -140,21 +144,17 @@ struct IncomingControl: public ClusterControl
 //
 // Interface structure for internal_invoke_remote()
 //
-struct invoke_remote_data_args
-{
+struct invoke_remote_data_args {
   int32_t magicno;
   OutgoingControl *msg_oc;
   OutgoingControl *data_oc;
   int dest_channel;
   ClusterVCToken token;
 
-  enum
-  {
-    MagicNo = 0x04141998
+  enum {
+    MagicNo = 0x04141998,
   };
-    invoke_remote_data_args():magicno(MagicNo), msg_oc(NULL), data_oc(NULL), dest_channel(0)
-  {
-  }
+  invoke_remote_data_args() : magicno(MagicNo), msg_oc(NULL), data_oc(NULL), dest_channel(0) {}
 };
 
 //
@@ -163,27 +163,26 @@ struct invoke_remote_data_args
 //
 
 // type
-#define CLUSTER_SEND_FREE   0
-#define CLUSTER_SEND_DATA   1
-#define CLUSTER_SEQUENCE_NUMBER(_x) (((unsigned int)_x)&0xFFFF)
-
-struct Descriptor
-{                               // Note: Over the Wire structure
-  uint32_t type:1;
-  uint32_t channel:15;
-  uint16_t sequence_number;       // lower 16 bits of the ClusterVCToken.seq
+#define CLUSTER_SEND_FREE 0
+#define CLUSTER_SEND_DATA 1
+#define CLUSTER_SEQUENCE_NUMBER(_x) (((unsigned int)_x) & 0xFFFF)
+
+struct Descriptor { // Note: Over the Wire structure
+  uint32_t type : 1;
+  uint32_t channel : 15;
+  uint16_t sequence_number; // lower 16 bits of the ClusterVCToken.seq
   uint32_t length;
 
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
-    ats_swap16((uint16_t *) this);    // Hack
-    ats_swap16((uint16_t *) & sequence_number);
-    ats_swap32((uint32_t *) & length);
+    ats_swap16((uint16_t *)this); // Hack
+    ats_swap16((uint16_t *)&sequence_number);
+    ats_swap32((uint32_t *)&length);
   }
 };
 
-struct ClusterMsgHeader
-{                               // Note: Over the Wire structure
+struct ClusterMsgHeader { // Note: Over the Wire structure
   uint16_t count;
   uint16_t descriptor_cksum;
   uint16_t control_bytes_cksum;
@@ -191,7 +190,8 @@ struct ClusterMsgHeader
   uint32_t control_bytes;
   uint32_t count_check;
 
-  void clear()
+  void
+  clear()
   {
     count = 0;
     descriptor_cksum = 0;
@@ -200,34 +200,32 @@ struct ClusterMsgHeader
     control_bytes = 0;
     count_check = 0;
   }
-  ClusterMsgHeader():count(0), descriptor_cksum(0), control_bytes_cksum(0), unused(0), control_bytes(0), count_check(0)
-  {
-  }
-  inline void SwapBytes()
+  ClusterMsgHeader() : count(0), descriptor_cksum(0), control_bytes_cksum(0), unused(0), control_bytes(0), count_check(0) {}
+  inline void
+  SwapBytes()
   {
-    ats_swap16((uint16_t *) & count);
-    ats_swap16((uint16_t *) & descriptor_cksum);
-    ats_swap16((uint16_t *) & control_bytes_cksum);
-    ats_swap16((uint16_t *) & unused);
-    ats_swap32((uint32_t *) & control_bytes);
-    ats_swap32((uint32_t *) & count_check);
+    ats_swap16((uint16_t *)&count);
+    ats_swap16((uint16_t *)&descriptor_cksum);
+    ats_swap16((uint16_t *)&control_bytes_cksum);
+    ats_swap16((uint16_t *)&unused);
+    ats_swap32((uint32_t *)&control_bytes);
+    ats_swap32((uint32_t *)&count_check);
   }
 };
 
-struct ClusterMsg
-{
+struct ClusterMsg {
   Descriptor *descriptor;
-    Ptr<IOBufferBlock> iob_descriptor_block;
+  Ptr<IOBufferBlock> iob_descriptor_block;
   int count;
   int control_bytes;
   int descriptor_cksum;
   int control_bytes_cksum;
   int unused;
-  int state;                    // Only used by read to denote
-  //   read phase (count, descriptor, data)
-    Queue<OutgoingControl> outgoing_control;
-    Queue<OutgoingControl> outgoing_small_control;
-    Queue<OutgoingControl> outgoing_callout; // compound msg callbacks
+  int state; // Only used by read to denote
+             //   read phase (count, descriptor, data)
+  Queue<OutgoingControl> outgoing_control;
+  Queue<OutgoingControl> outgoing_small_control;
+  Queue<OutgoingControl> outgoing_callout; // compound msg callbacks
 
   // read processing usage.
   int control_data_offset;
@@ -237,22 +235,24 @@ struct ClusterMsg
   int did_large_control_msgs;
   int did_freespace_msgs;
 
-  ClusterMsgHeader *hdr()
+  ClusterMsgHeader *
+  hdr()
   {
-    return (ClusterMsgHeader *) (((char *) descriptor)
-                                 - sizeof(ClusterMsgHeader));
+    return (ClusterMsgHeader *)(((char *)descriptor) - sizeof(ClusterMsgHeader));
   }
 
-  IOBufferBlock *get_block()
+  IOBufferBlock *
+  get_block()
   {
     return iob_descriptor_block;
   }
 
-  IOBufferBlock *get_block_header()
+  IOBufferBlock *
+  get_block_header()
   {
     int start_offset;
 
-    start_offset = (char *) hdr() - iob_descriptor_block->buf();
+    start_offset = (char *)hdr() - iob_descriptor_block->buf();
     iob_descriptor_block->reset();
     iob_descriptor_block->next = 0;
     iob_descriptor_block->fill(start_offset);
@@ -260,12 +260,12 @@ struct ClusterMsg
     return iob_descriptor_block;
   }
 
-  IOBufferBlock *get_block_descriptor()
+  IOBufferBlock *
+  get_block_descriptor()
   {
     int start_offset;
 
-    start_offset = ((char *) hdr() + sizeof(ClusterMsgHeader))
-      - iob_descriptor_block->buf();
+    start_offset = ((char *)hdr() + sizeof(ClusterMsgHeader)) - iob_descriptor_block->buf();
     iob_descriptor_block->reset();
     iob_descriptor_block->next = 0;
     iob_descriptor_block->fill(start_offset);
@@ -273,7 +273,8 @@ struct ClusterMsg
     return iob_descriptor_block;
   }
 
-  void clear()
+  void
+  clear()
   {
     hdr()->clear();
     count = 0;
@@ -291,10 +292,11 @@ struct ClusterMsg
     did_large_control_msgs = 0;
     did_freespace_msgs = 0;
   }
-  uint16_t calc_control_bytes_cksum()
+  uint16_t
+  calc_control_bytes_cksum()
   {
     uint16_t cksum = 0;
-    char *p = (char *) &descriptor[count];
+    char *p = (char *)&descriptor[count];
     char *endp = p + control_bytes;
     while (p < endp) {
       cksum += *p;
@@ -302,56 +304,53 @@ struct ClusterMsg
     }
     return cksum;
   }
-  uint16_t calc_descriptor_cksum()
+  uint16_t
+  calc_descriptor_cksum()
   {
     uint16_t cksum = 0;
-    char *p = (char *) &descriptor[0];
-    char *endp = (char *) &descriptor[count];
+    char *p = (char *)&descriptor[0];
+    char *endp = (char *)&descriptor[count];
     while (p < endp) {
       cksum += *p;
       ++p;
     }
     return cksum;
   }
-ClusterMsg():descriptor(NULL), iob_descriptor_block(NULL), count(0),
-    control_bytes(0),
-    descriptor_cksum(0), control_bytes_cksum(0),
-    unused(0), state(0),
-    control_data_offset(0),
-    did_small_control_set_data(0),
-    did_large_control_set_data(0), did_small_control_msgs(0), did_large_control_msgs(0), did_freespace_msgs(0) {
+  ClusterMsg()
+    : descriptor(NULL), iob_descriptor_block(NULL), count(0), control_bytes(0), descriptor_cksum(0), control_bytes_cksum(0),
+      unused(0), state(0), control_data_offset(0), did_small_control_set_data(0), did_large_control_set_data(0),
+      did_small_control_msgs(0), did_large_control_msgs(0), did_freespace_msgs(0)
+  {
   }
-
 };
 
 //
 // State for a particular (read/write) direction of a cluster link
 //
 struct ClusterHandler;
-struct ClusterState: public Continuation
-{
+struct ClusterState : public Continuation {
   ClusterHandler *ch;
   bool read_channel;
-  bool do_iodone_event;         // schedule_imm() on i/o complete
+  bool do_iodone_event; // schedule_imm() on i/o complete
   int n_descriptors;
   ClusterMsg msg;
   unsigned int sequence_number;
-  int to_do;                    // # of bytes to transact
-  int did;                      // # of bytes transacted
-  int n_iov;                    // defined iov(s) in this operation
-  int io_complete;              // current i/o complete
-  int io_complete_event;        // current i/o complete event
-  VIO *v;                       // VIO associated with current op
-  int bytes_xfered;             // bytes xfered at last callback
-  int last_ndone;               // last do_io ndone
+  int to_do;             // # of bytes to transact
+  int did;               // # of bytes transacted
+  int n_iov;             // defined iov(s) in this operation
+  int io_complete;       // current i/o complete
+  int io_complete_event; // current i/o complete event
+  VIO *v;                // VIO associated with current op
+  int bytes_xfered;      // bytes xfered at last callback
+  int last_ndone;        // last do_io ndone
   int total_bytes_xfered;
-  IOVec *iov;                   // io vector for readv, writev
+  IOVec *iov; // io vector for readv, writev
   Ptr<IOBufferData> iob_iov;
 
   // Write byte bank structures
-  char *byte_bank;              // bytes buffered for transit
-  int n_byte_bank;              // number of bytes buffered for transit
-  int byte_bank_size;           // allocated size of byte bank
+  char *byte_bank;    // bytes buffered for transit
+  int n_byte_bank;    // number of bytes buffered for transit
+  int byte_bank_size; // allocated size of byte bank
 
   int missed;
   bool missed_msg;
@@ -360,11 +359,10 @@ struct ClusterState: public Continuation
 
   Ptr<IOBufferBlock> block[MAX_TCOUNT];
   class MIOBuffer *mbuf;
-  int state;                    // See enum defs below
+  int state; // See enum defs below
 
 
-  enum
-  {
+  enum {
     READ_START = 1,
     READ_HEADER,
     READ_AWAIT_HEADER,
@@ -378,14 +376,13 @@ struct ClusterState: public Continuation
     READ_COMPLETE
   } read_state_t;
 
-  enum
-  {
+  enum {
     WRITE_START = 1,
     WRITE_SETUP,
     WRITE_INITIATE,
     WRITE_AWAIT_COMPLETION,
     WRITE_POST_COMPLETE,
-    WRITE_COMPLETE
+    WRITE_COMPLETE,
   } write_state_t;
 
   ClusterState(ClusterHandler *, bool);
@@ -402,8 +399,7 @@ struct ClusterState: public Continuation
 // ClusterHandlerBase superclass for processors with
 // bi-directional VConnections.
 //
-struct ClusterHandlerBase: public Continuation
-{
+struct ClusterHandlerBase : public Continuation {
   //
   // Private
   //
@@ -413,13 +409,10 @@ struct ClusterHandlerBase: public Continuation
   int min_priority;
   Event *trigger_event;
 
-  ClusterHandlerBase():Continuation(NULL), read_vcs(NULL), write_vcs(NULL), cur_vcs(0), min_priority(1)
-  {
-  }
+  ClusterHandlerBase() : Continuation(NULL), read_vcs(NULL), write_vcs(NULL), cur_vcs(0), min_priority(1) {}
 };
 
-struct ClusterHandler:public ClusterHandlerBase
-{
+struct ClusterHandler : public ClusterHandlerBase {
 #ifdef MSG_TRACE
   FILE *t_fd;
 #endif
@@ -434,11 +427,10 @@ struct ClusterHandler:public ClusterHandlerBase
   bool dead;
   bool downing;
 
-  int32_t active;                 // handler currently running
+  int32_t active; // handler currently running
   bool on_stolen_thread;
 
-  struct ChannelData
-  {
+  struct ChannelData {
     int channel_number;
     LINK(ChannelData, link);
   };
@@ -449,16 +441,15 @@ struct ClusterHandler:public ClusterHandlerBase
   Queue<ChannelData> free_local_channels;
 
   bool connector;
-  int cluster_connect_state;    // see clcon_state_t enum
+  int cluster_connect_state; // see clcon_state_t enum
   ClusterHelloMessage clusteringVersion;
   ClusterHelloMessage nodeClusteringVersion;
   bool needByteSwap;
   int configLookupFails;
 
-#define CONFIG_LOOKUP_RETRIES	10
+#define CONFIG_LOOKUP_RETRIES 10
 
-  enum
-  {
+  enum {
     CLCON_INITIAL = 1,
     CLCON_SEND_MSG,
     CLCON_SEND_MSG_COMPLETE,
@@ -475,7 +466,7 @@ struct ClusterHandler:public ClusterHandlerBase
   InkAtomicList outgoing_control_al[CLUSTER_CMSG_QUEUES];
   InkAtomicList external_incoming_control;
   InkAtomicList external_incoming_open_local;
-  ClusterCalloutContinuation * callout_cont[MAX_COMPLETION_CALLBACK_EVENTS];
+  ClusterCalloutContinuation *callout_cont[MAX_COMPLETION_CALLBACK_EVENTS];
   Event *callout_events[MAX_COMPLETION_CALLBACK_EVENTS];
   Event *cluster_periodic_event;
   Queue<OutgoingControl> outgoing_control[CLUSTER_CMSG_QUEUES];
@@ -505,7 +496,7 @@ struct ClusterHandler:public ClusterHandlerBase
   bool control_message_write;
 
 #ifdef CLUSTER_STATS
-    Ptr<IOBufferBlock> message_blk;
+  Ptr<IOBufferBlock> message_blk;
 
   int64_t _vc_writes;
   int64_t _vc_write_bytes;
@@ -542,7 +533,8 @@ struct ClusterHandler:public ClusterHandlerBase
   int _n_write_post_complete;
   int _n_write_complete;
 
-  void clear_cluster_stats()
+  void
+  clear_cluster_stats()
   {
     _vc_writes = 0;
     _vc_write_bytes = 0;
@@ -579,30 +571,31 @@ struct ClusterHandler:public ClusterHandlerBase
     _n_write_post_complete = 0;
     _n_write_complete = 0;
   }
-#endif                          // CLUSTER_STATS
+#endif // CLUSTER_STATS
 
   ClusterHandler();
   ~ClusterHandler();
   bool check_channel(int c);
-  int alloc_channel(ClusterVConnection * vc, int requested_channel = 0);
-  void free_channel(ClusterVConnection * vc);
-//
-//  local_channel()
-//  - Initiator node-node TCP socket  &&  Odd channel  => Local Channel
-//  - !Initiator node-node TCP socket &&  Even channel => Local Channel
-  inline bool local_channel(int i)
+  int alloc_channel(ClusterVConnection *vc, int requested_channel = 0);
+  void free_channel(ClusterVConnection *vc);
+  //
+  //  local_channel()
+  //  - Initiator node-node TCP socket  &&  Odd channel  => Local Channel
+  //  - !Initiator node-node TCP socket &&  Even channel => Local Channel
+  inline bool
+  local_channel(int i)
   {
     return !connector == !(i & 1);
   }
 
   void close_ClusterVConnection(ClusterVConnection *);
-  int cluster_signal_and_update(int event, ClusterVConnection * vc, ClusterVConnState * s);
-  int cluster_signal_and_update_locked(int event, ClusterVConnection * vc, ClusterVConnState * s);
-  int cluster_signal_error_and_update(ClusterVConnection * vc, ClusterVConnState * s, int lerrno);
+  int cluster_signal_and_update(int event, ClusterVConnection *vc, ClusterVConnState *s);
+  int cluster_signal_and_update_locked(int event, ClusterVConnection *vc, ClusterVConnState *s);
+  int cluster_signal_error_and_update(ClusterVConnection *vc, ClusterVConnState *s, int lerrno);
   void close_free_lock(ClusterVConnection *, ClusterVConnState *);
 
-#define CLUSTER_READ       true
-#define CLUSTER_WRITE      false
+#define CLUSTER_READ true
+#define CLUSTER_WRITE false
 
   bool build_data_vector(char *, int, bool);
   bool build_initial_vector(bool);
@@ -615,7 +608,7 @@ struct ClusterHandler:public ClusterHandlerBase
   void process_small_control_msgs();
   void process_large_control_msgs();
   void process_freespace_msgs();
-  bool complete_channel_read(int, ClusterVConnection * vc);
+  bool complete_channel_read(int, ClusterVConnection *vc);
   void finish_delayed_reads();
   // returns: false if the channel was closed
 
@@ -625,27 +618,27 @@ struct ClusterHandler:public ClusterHandlerBase
   int build_freespace_descriptors();
   int build_controlmsg_descriptors();
   int add_small_controlmsg_descriptors();
-  int valid_for_data_write(ClusterVConnection * vc);
-  int valid_for_freespace_write(ClusterVConnection * vc);
+  int valid_for_data_write(ClusterVConnection *vc);
+  int valid_for_freespace_write(ClusterVConnection *vc);
 
   int machine_down();
-  int remote_close(ClusterVConnection * vc, ClusterVConnState * ns);
-  void steal_thread(EThread * t);
+  int remote_close(ClusterVConnection *vc, ClusterVConnState *ns);
+  void steal_thread(EThread *t);
 
 #define CLUSTER_FREE_ALL_LOCKS -1
   void free_locks(bool read_flag, int i = CLUSTER_FREE_ALL_LOCKS);
   bool get_read_locks();
   bool get_write_locks();
-  int zombify(Event * e = NULL);        // optional event to use
+  int zombify(Event *e = NULL); // optional event to use
 
-  int connectClusterEvent(int event, Event * e);
-  int startClusterEvent(int event, Event * e);
-  int mainClusterEvent(int event, Event * e);
-  int beginClusterEvent(int event, Event * e);
-  int zombieClusterEvent(int event, Event * e);
-  int protoZombieEvent(int event, Event * e);
+  int connectClusterEvent(int event, Event *e);
+  int startClusterEvent(int event, Event *e);
+  int mainClusterEvent(int event, Event *e);
+  int beginClusterEvent(int event, Event *e);
+  int zombieClusterEvent(int event, Event *e);
+  int protoZombieEvent(int event, Event *e);
 
-  void vcs_push(ClusterVConnection * vc, int type);
+  void vcs_push(ClusterVConnection *vc, int type);
   bool vc_ok_read(ClusterVConnection *);
   bool vc_ok_write(ClusterVConnection *);
   int do_open_local_requests();
@@ -664,7 +657,7 @@ struct ClusterHandler:public ClusterHandlerBase
 };
 
 // Valid (ClusterVConnection *) in ClusterHandler.channels[]
-#define VALID_CHANNEL(vc) (vc && !(((uintptr_t) vc) & 1))
+#define VALID_CHANNEL(vc) (vc && !(((uintptr_t)vc) & 1))
 
 // outgoing control continuations
 extern ClassAllocator<OutgoingControl> outControlAllocator;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterInline.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterInline.h b/iocore/cluster/P_ClusterInline.h
index b4c1f15..246f65d 100644
--- a/iocore/cluster/P_ClusterInline.h
+++ b/iocore/cluster/P_ClusterInline.h
@@ -33,7 +33,7 @@
 #include "P_ClusterHandler.h"
 
 inline Action *
-Cluster_lookup(Continuation * cont, CacheKey * key, CacheFragType frag_type, char *hostname, int host_len)
+Cluster_lookup(Continuation *cont, CacheKey *key, CacheFragType frag_type, char *hostname, int host_len)
 {
   // Try to send remote, if not possible, handle locally
   Action *retAct;
@@ -48,24 +48,22 @@ Cluster_lookup(Continuation * cont, CacheKey * key, CacheFragType frag_type, cha
     } else {
       // not remote, do local lookup
       CacheContinuation::cacheContAllocator_free(cc);
-      return (Action *) NULL;
+      return (Action *)NULL;
     }
   } else {
     Action a;
     a = cont;
     return CacheContinuation::callback_failure(&a, CACHE_EVENT_LOOKUP_FAILED, 0);
   }
-  return (Action *) NULL;
+  return (Action *)NULL;
 }
 
 inline Action *
-Cluster_read(ClusterMachine * owner_machine, int opcode,
-             Continuation * cont, MIOBuffer * buf,
-             CacheURL * url, CacheHTTPHdr * request,
-             CacheLookupHttpConfig * params, CacheKey * key,
-             time_t pin_in_cache, CacheFragType frag_type, char *hostname, int host_len)
+Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOBuffer *buf, CacheURL *url, CacheHTTPHdr *request,
+             CacheLookupHttpConfig *params, CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, char *hostname,
+             int host_len)
 {
-  (void) params;
+  (void)params;
   if (clusterProcessor.disable_remote_cluster_ops(owner_machine)) {
     Action a;
     a = cont;
@@ -79,8 +77,7 @@ Cluster_read(ClusterMachine * owner_machine, int opcode,
   char *data;
 
   if (vers == CacheOpMsg_long::CACHE_OP_LONG_MESSAGE_VERSION) {
-    if ((opcode == CACHE_OPEN_READ_LONG)
-        || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
+    if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
       // Determine length of data to Marshal
       flen = op_to_sizeof_fixedlen_msg(opcode);
 
@@ -95,11 +92,11 @@ Cluster_read(ClusterMachine * owner_machine, int opcode,
       len += params->marshal_length();
       len += url_hlen;
 
-      if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE)       // Bound marshalled data
+      if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
         goto err_exit;
 
       // Perform data Marshal operation
-      msg = (char *) ALLOCA_DOUBLE(flen + len);
+      msg = (char *)ALLOCA_DOUBLE(flen + len);
       data = msg + flen;
 
       int cur_len = len;
@@ -119,8 +116,7 @@ Cluster_read(ClusterMachine * owner_machine, int opcode,
       readArgs.url_md5 = &url_only_md5;
       readArgs.pin_in_cache = pin_in_cache;
       readArgs.frag_type = frag_type;
-      return CacheContinuation::do_op(cont, owner_machine, (void *) &readArgs,
-                                      opcode, (char *) msg, (flen + len), -1, buf);
+      return CacheContinuation::do_op(cont, owner_machine, (void *)&readArgs, opcode, (char *)msg, (flen + len), -1, buf);
     } else {
       // Build message if we have host data.
 
@@ -129,10 +125,10 @@ Cluster_read(ClusterMachine * owner_machine, int opcode,
         flen = op_to_sizeof_fixedlen_msg(opcode);
         len = host_len;
 
-        if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE)     // Bound marshalled data
+        if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
           goto err_exit;
 
-        msg = (char *) ALLOCA_DOUBLE(flen + len);
+        msg = (char *)ALLOCA_DOUBLE(flen + len);
         data = msg + flen;
         memcpy(data, hostname, host_len);
 
@@ -144,8 +140,7 @@ Cluster_read(ClusterMachine * owner_machine, int opcode,
       CacheOpArgs_General readArgs;
       readArgs.url_md5 = key;
       readArgs.frag_type = frag_type;
-      return CacheContinuation::do_op(cont, owner_machine, (void *) &readArgs,
-                                      opcode, (char *) msg, (flen + len), -1, buf);
+      return CacheContinuation::do_op(cont, owner_machine, (void *)&readArgs, opcode, (char *)msg, (flen + len), -1, buf);
     }
 
   } else {
@@ -161,15 +156,12 @@ err_exit:
 }
 
 inline Action *
-Cluster_write(Continuation * cont, int expected_size,
-              MIOBuffer * buf, ClusterMachine * m,
-              INK_MD5 * url_md5, CacheFragType ft, int options,
-              time_t pin_in_cache, int opcode,
-              CacheKey * key, CacheURL * url,
-              CacheHTTPHdr * request, CacheHTTPInfo * old_info, char *hostname, int host_len)
+Cluster_write(Continuation *cont, int expected_size, MIOBuffer *buf, ClusterMachine *m, INK_MD5 *url_md5, CacheFragType ft,
+              int options, time_t pin_in_cache, int opcode, CacheKey *key, CacheURL *url, CacheHTTPHdr *request,
+              CacheHTTPInfo *old_info, char *hostname, int host_len)
 {
-  (void) key;
-  (void) request;
+  (void)key;
+  (void)request;
   if (clusterProcessor.disable_remote_cluster_ops(m)) {
     Action a;
     a = cont;
@@ -183,65 +175,62 @@ Cluster_write(Continuation * cont, int expected_size,
   int vers = CacheOpMsg_long::protoToVersion(m->msg_proto_major);
 
   switch (opcode) {
-  case CACHE_OPEN_WRITE:
-    {
-      // Build message if we have host data
-      if (host_len) {
-        // Determine length of data to Marshal
-        flen = op_to_sizeof_fixedlen_msg(CACHE_OPEN_WRITE);
-        len = host_len;
+  case CACHE_OPEN_WRITE: {
+    // Build message if we have host data
+    if (host_len) {
+      // Determine length of data to Marshal
+      flen = op_to_sizeof_fixedlen_msg(CACHE_OPEN_WRITE);
+      len = host_len;
 
-        if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE)     // Bound marshalled data
-          goto err_exit;
+      if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
+        goto err_exit;
 
-        msg = (char *) ALLOCA_DOUBLE(flen + len);
-        data = msg + flen;
+      msg = (char *)ALLOCA_DOUBLE(flen + len);
+      data = msg + flen;
 
-        memcpy(data, hostname, host_len);
-      }
-      break;
+      memcpy(data, hostname, host_len);
     }
-  case CACHE_OPEN_WRITE_LONG:
-    {
-      int url_hlen;
-      const char *url_hostname = url->host_get(&url_hlen);
+    break;
+  }
+  case CACHE_OPEN_WRITE_LONG: {
+    int url_hlen;
+    const char *url_hostname = url->host_get(&url_hlen);
 
-      // Determine length of data to Marshal
-      flen = op_to_sizeof_fixedlen_msg(CACHE_OPEN_WRITE_LONG);
-      len = 0;
+    // Determine length of data to Marshal
+    flen = op_to_sizeof_fixedlen_msg(CACHE_OPEN_WRITE_LONG);
+    len = 0;
 
-      if (old_info == (CacheHTTPInfo *) CACHE_ALLOW_MULTIPLE_WRITES) {
-        old_info = 0;
-        allow_multiple_writes = 1;
-      }
-      if (old_info) {
-        len += old_info->marshal_length();
-      }
-      len += url_hlen;
+    if (old_info == (CacheHTTPInfo *)CACHE_ALLOW_MULTIPLE_WRITES) {
+      old_info = 0;
+      allow_multiple_writes = 1;
+    }
+    if (old_info) {
+      len += old_info->marshal_length();
+    }
+    len += url_hlen;
 
-      if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE)       // Bound marshalled data
-        goto err_exit;
+    if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
+      goto err_exit;
 
-      // Perform data Marshal operation
-      msg = (char *) ALLOCA_DOUBLE(flen + len);
-      data = msg + flen;
+    // Perform data Marshal operation
+    msg = (char *)ALLOCA_DOUBLE(flen + len);
+    data = msg + flen;
 
-      if (old_info) {
-        int res = old_info->marshal(data, len);
+    if (old_info) {
+      int res = old_info->marshal(data, len);
 
-        if (res < 0) {
-          goto err_exit;
-        }
-        data += res;
+      if (res < 0) {
+        goto err_exit;
       }
-      memcpy(data, url_hostname, url_hlen);
-      break;
+      data += res;
     }
-  default:
-    {
-      ink_release_assert(!"open_write_internal invalid opcode.");
-    }                           // End of case
-  }                             // End of switch
+    memcpy(data, url_hostname, url_hlen);
+    break;
+  }
+  default: {
+    ink_release_assert(!"open_write_internal invalid opcode.");
+  } // End of case
+  } // End of switch
 
   if (vers == CacheOpMsg_long::CACHE_OP_LONG_MESSAGE_VERSION) {
     // Do remote open_write()
@@ -253,13 +242,13 @@ Cluster_write(Continuation * cont, int expected_size,
     writeArgs.cfl_flags |= (old_info ? CFL_LOPENWRITE_HAVE_OLDINFO : 0);
     writeArgs.cfl_flags |= (allow_multiple_writes ? CFL_ALLOW_MULTIPLE_WRITES : 0);
 
-    return CacheContinuation::do_op(cont, m, (void *) &writeArgs, opcode, msg, flen + len, expected_size, buf);
+    return CacheContinuation::do_op(cont, m, (void *)&writeArgs, opcode, msg, flen + len, expected_size, buf);
   } else {
     //////////////////////////////////////////////////////////////
     // Create the specified down rev version of this message
     //////////////////////////////////////////////////////////////
     ink_release_assert(!"CacheOpMsg_long [write] bad msg version");
-    return (Action *) 0;
+    return (Action *)0;
   }
 
 err_exit:
@@ -269,8 +258,7 @@ err_exit:
 }
 
 inline Action *
-Cluster_link(ClusterMachine * m, Continuation * cont, CacheKey * from, CacheKey * to,
-             CacheFragType type, char *hostname, int host_len)
+Cluster_link(ClusterMachine *m, Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType type, char *hostname, int host_len)
 {
   if (clusterProcessor.disable_remote_cluster_ops(m)) {
     Action a;
@@ -289,7 +277,7 @@ Cluster_link(ClusterMachine * m, Continuation * cont, CacheKey * from, CacheKey
     if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
       goto err_exit;
 
-    char *msg = (char *) ALLOCA_DOUBLE(flen + len);
+    char *msg = (char *)ALLOCA_DOUBLE(flen + len);
     memcpy((msg + flen), hostname, host_len);
 
     // Setup args for remote link
@@ -297,7 +285,7 @@ Cluster_link(ClusterMachine * m, Continuation * cont, CacheKey * from, CacheKey
     linkArgs.from = from;
     linkArgs.to = to;
     linkArgs.frag_type = type;
-    return CacheContinuation::do_op(cont, m, (void *) &linkArgs, CACHE_LINK, msg, (flen + len));
+    return CacheContinuation::do_op(cont, m, (void *)&linkArgs, CACHE_LINK, msg, (flen + len));
   } else {
     //////////////////////////////////////////////////////////////
     // Create the specified down rev version of this message
@@ -313,7 +301,7 @@ err_exit:
 }
 
 inline Action *
-Cluster_deref(ClusterMachine * m, Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int host_len)
+Cluster_deref(ClusterMachine *m, Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int host_len)
 {
   if (clusterProcessor.disable_remote_cluster_ops(m)) {
     Action a;
@@ -332,14 +320,14 @@ Cluster_deref(ClusterMachine * m, Continuation * cont, CacheKey * key, CacheFrag
     if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
       goto err_exit;
 
-    char *msg = (char *) ALLOCA_DOUBLE(flen + len);
+    char *msg = (char *)ALLOCA_DOUBLE(flen + len);
     memcpy((msg + flen), hostname, host_len);
 
     // Setup args for remote deref
     CacheOpArgs_Deref drefArgs;
     drefArgs.md5 = key;
     drefArgs.frag_type = type;
-    return CacheContinuation::do_op(cont, m, (void *) &drefArgs, CACHE_DEREF, msg, (flen + len));
+    return CacheContinuation::do_op(cont, m, (void *)&drefArgs, CACHE_DEREF, msg, (flen + len));
   } else {
     //////////////////////////////////////////////////////////////
     // Create the specified down rev version of this message
@@ -355,8 +343,8 @@ err_exit:
 }
 
 inline Action *
-Cluster_remove(ClusterMachine * m, Continuation * cont, CacheKey * key,
-               bool rm_user_agents, bool rm_link, CacheFragType frag_type, char *hostname, int host_len)
+Cluster_remove(ClusterMachine *m, Continuation *cont, CacheKey *key, bool rm_user_agents, bool rm_link, CacheFragType frag_type,
+               char *hostname, int host_len)
 {
   if (clusterProcessor.disable_remote_cluster_ops(m)) {
     Action a;
@@ -375,7 +363,7 @@ Cluster_remove(ClusterMachine * m, Continuation * cont, CacheKey * key,
     if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
       goto err_exit;
 
-    char *msg = (char *) ALLOCA_DOUBLE(flen + len);
+    char *msg = (char *)ALLOCA_DOUBLE(flen + len);
     memcpy((msg + flen), hostname, host_len);
 
     // Setup args for remote update
@@ -384,13 +372,13 @@ Cluster_remove(ClusterMachine * m, Continuation * cont, CacheKey * key,
     updateArgs.cfl_flags |= (rm_user_agents ? CFL_REMOVE_USER_AGENTS : 0);
     updateArgs.cfl_flags |= (rm_link ? CFL_REMOVE_LINK : 0);
     updateArgs.frag_type = frag_type;
-    return CacheContinuation::do_op(cont, m, (void *) &updateArgs, CACHE_REMOVE, msg, (flen + len));
+    return CacheContinuation::do_op(cont, m, (void *)&updateArgs, CACHE_REMOVE, msg, (flen + len));
   } else {
     //////////////////////////////////////////////////////////////
     // Create the specified down rev version of this message
     //////////////////////////////////////////////////////////////
     ink_release_assert(!"CacheOpMsg_short [CACHE_REMOVE] bad msg version");
-    return (Action *) 0;
+    return (Action *)0;
   }
 
 err_exit:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterInternal.h b/iocore/cluster/P_ClusterInternal.h
index eaa18e3..b672972 100644
--- a/iocore/cluster/P_ClusterInternal.h
+++ b/iocore/cluster/P_ClusterInternal.h
@@ -34,150 +34,140 @@
 /*************************************************************************/
 // Compilation Options
 /*************************************************************************/
-#define CLUSTER_THREAD_STEALING		1
-#define CLUSTER_TOMCAT			1
-#define CLUSTER_STATS			1
+#define CLUSTER_THREAD_STEALING 1
+#define CLUSTER_TOMCAT 1
+#define CLUSTER_STATS 1
 
 
-#define ALIGN_DOUBLE(_p)   ((((uintptr_t) (_p)) + 7) & ~7)
+#define ALIGN_DOUBLE(_p) ((((uintptr_t)(_p)) + 7) & ~7)
 #define ALLOCA_DOUBLE(_sz) ALIGN_DOUBLE(alloca((_sz) + 8))
 
 /*************************************************************************/
 // Configuration Parameters
 /*************************************************************************/
 // Note: MAX_TCOUNT must be power of 2
-#define MAX_TCOUNT         	 128
-#define CONTROL_DATA             (128*1024)
-#define READ_BANK_BUF_SIZE 	 DEFAULT_MAX_BUFFER_SIZE
-#define READ_BANK_BUF_INDEX 	 (DEFAULT_BUFFER_SIZES-1)
-#define ALLOC_DATA_MAGIC	 0xA5   // 8 bits in size
-#define READ_LOCK_SPIN_COUNT	 1
-#define WRITE_LOCK_SPIN_COUNT	 1
+#define MAX_TCOUNT 128
+#define CONTROL_DATA (128 * 1024)
+#define READ_BANK_BUF_SIZE DEFAULT_MAX_BUFFER_SIZE
+#define READ_BANK_BUF_INDEX (DEFAULT_BUFFER_SIZES - 1)
+#define ALLOC_DATA_MAGIC 0xA5 // 8 bits in size
+#define READ_LOCK_SPIN_COUNT 1
+#define WRITE_LOCK_SPIN_COUNT 1
 
 // Unix specific optimizations
 // #define CLUSTER_IMMEDIATE_NETIO       1
 
-  // (see ClusterHandler::mainClusterEvent)
-  // this is equivalent to a max of 0.7 seconds
-#define CLUSTER_BUCKETS          64
-#define CLUSTER_PERIOD           HRTIME_MSECONDS(10)
+// (see ClusterHandler::mainClusterEvent)
+// this is equivalent to a max of 0.7 seconds
+#define CLUSTER_BUCKETS 64
+#define CLUSTER_PERIOD HRTIME_MSECONDS(10)
 
-  // Per instance maximum time allotted to cluster thread
-#define CLUSTER_MAX_RUN_TIME    HRTIME_MSECONDS(100)
-  // Per instance maximum time allotted to thread stealing
-#define CLUSTER_MAX_THREAD_STEAL_TIME 	HRTIME_MSECONDS(10)
+// Per instance maximum time allotted to cluster thread
+#define CLUSTER_MAX_RUN_TIME HRTIME_MSECONDS(100)
+// Per instance maximum time allotted to thread stealing
+#define CLUSTER_MAX_THREAD_STEAL_TIME HRTIME_MSECONDS(10)
 
-  // minimum number of channels to allocate
-#define MIN_CHANNELS             4096
-#define MAX_CHANNELS             ((32*1024) - 1)        // 15 bits in Descriptor
+// minimum number of channels to allocate
+#define MIN_CHANNELS 4096
+#define MAX_CHANNELS ((32 * 1024) - 1) // 15 bits in Descriptor
 
-#define CLUSTER_CONTROL_CHANNEL  0
-#define LAST_DEDICATED_CHANNEL   0
+#define CLUSTER_CONTROL_CHANNEL 0
+#define LAST_DEDICATED_CHANNEL 0
 
-#define CLUSTER_PHASES           1
+#define CLUSTER_PHASES 1
 
 #define CLUSTER_INITIAL_PRIORITY CLUSTER_PHASES
-  // how often to retry connect to machines which are supposed to be in the
-  // cluster
-#define CLUSTER_BUMP_LENGTH      1
-#define CLUSTER_MEMBER_DELAY     HRTIME_SECONDS(1)
-  // How long to leave an unconnected ClusterVConnection waiting
-  // Note: assumes (CLUSTER_CONNECT_TIMEOUT == 2 * CACHE_CLUSTER_TIMEOUT)
+// how often to retry connect to machines which are supposed to be in the
+// cluster
+#define CLUSTER_BUMP_LENGTH 1
+#define CLUSTER_MEMBER_DELAY HRTIME_SECONDS(1)
+// How long to leave an unconnected ClusterVConnection waiting
+// Note: assumes (CLUSTER_CONNECT_TIMEOUT == 2 * CACHE_CLUSTER_TIMEOUT)
 #ifdef CLUSTER_TEST_DEBUG
-#define CLUSTER_CONNECT_TIMEOUT  HRTIME_SECONDS(65536)
+#define CLUSTER_CONNECT_TIMEOUT HRTIME_SECONDS(65536)
 #else
-#define CLUSTER_CONNECT_TIMEOUT  HRTIME_SECONDS(10)
+#define CLUSTER_CONNECT_TIMEOUT HRTIME_SECONDS(10)
 #endif
-#define CLUSTER_CONNECT_RETRY    HRTIME_MSECONDS(20)
-#define CLUSTER_RETRY            HRTIME_MSECONDS(10)
+#define CLUSTER_CONNECT_RETRY HRTIME_MSECONDS(20)
+#define CLUSTER_RETRY HRTIME_MSECONDS(10)
 #define CLUSTER_DELAY_BETWEEN_WRITES HRTIME_MSECONDS(10)
 
-  // Force close on cluster channel if no activity detected in this interval
+// Force close on cluster channel if no activity detected in this interval
 #ifdef CLUSTER_TEST_DEBUG
 #define CLUSTER_CHANNEL_INACTIVITY_TIMEOUT (65536 * HRTIME_SECONDS(60))
 #else
 #define CLUSTER_CHANNEL_INACTIVITY_TIMEOUT (10 * HRTIME_SECONDS(60))
 #endif
 
-  // Defines for work deferred to ET_NET threads
-#define COMPLETION_CALLBACK_PERIOD	HRTIME_MSECONDS(10)
-#define MAX_COMPLETION_CALLBACK_EVENTS	16
+// Defines for work deferred to ET_NET threads
+#define COMPLETION_CALLBACK_PERIOD HRTIME_MSECONDS(10)
+#define MAX_COMPLETION_CALLBACK_EVENTS 16
 
-  // ClusterHandler::mainClusterEvent() thread active state
-#define CLUSTER_ACTIVE           1
-#define CLUSTER_NOT_ACTIVE       0
+// ClusterHandler::mainClusterEvent() thread active state
+#define CLUSTER_ACTIVE 1
+#define CLUSTER_NOT_ACTIVE 0
 
-  // defines for ClusterHandler::remote_closed
-#define FORCE_CLOSE_ON_OPEN_CHANNEL	-2
+// defines for ClusterHandler::remote_closed
+#define FORCE_CLOSE_ON_OPEN_CHANNEL -2
 
-  // defines for machine_config_change()
-#define MACHINE_CONFIG 		0
-#define CLUSTER_CONFIG 		1
+// defines for machine_config_change()
+#define MACHINE_CONFIG 0
+#define CLUSTER_CONFIG 1
 
 // Debug interface category definitions
-#define CL_NOTE	 	"cluster_note"
-#define CL_WARN	 	"cluster_warn"
-#define CL_PROTO	"cluster_proto"
-#define CL_TRACE	"cluster_trace"
+#define CL_NOTE "cluster_note"
+#define CL_WARN "cluster_warn"
+#define CL_PROTO "cluster_proto"
+#define CL_TRACE "cluster_trace"
 
 /*************************************************************************/
 // Constants
 /*************************************************************************/
-#define MAX_FAST_CONTROL_MESSAGE 504    // 512 - 4 (cluster func #) - 4 align
-#define SMALL_CONTROL_MESSAGE    MAX_FAST_CONTROL_MESSAGE       // copied instead
-                                                           //  of vectored
+#define MAX_FAST_CONTROL_MESSAGE 504                   // 512 - 4 (cluster func #) - 4 align
+#define SMALL_CONTROL_MESSAGE MAX_FAST_CONTROL_MESSAGE // copied instead
+                                                       //  of vectored
 #define WRITE_MESSAGE_ALREADY_BUILT -1
 
-#define MAGIC_COUNT(_x) \
-(0xBADBAD ^ ~(uint32_t)_x.msg.count \
- ^ ~(uint32_t)_x.msg.descriptor_cksum \
- ^ ~(uint32_t)_x.msg.control_bytes_cksum \
- ^ ~(uint32_t)_x.msg.unused \
- ^ ~((uint32_t)_x.msg.control_bytes << 16) ^_x.sequence_number)
+#define MAGIC_COUNT(_x)                                                                                              \
+  (0xBADBAD ^ ~(uint32_t)_x.msg.count ^ ~(uint32_t)_x.msg.descriptor_cksum ^ ~(uint32_t)_x.msg.control_bytes_cksum ^ \
+   ~(uint32_t)_x.msg.unused ^ ~((uint32_t)_x.msg.control_bytes << 16) ^ _x.sequence_number)
 
-#define DOUBLE_ALIGN(_x)    ((((uintptr_t)_x)+7)&~7)
+#define DOUBLE_ALIGN(_x) ((((uintptr_t)_x) + 7) & ~7)
 
 /*************************************************************************/
 // Testing Defines
 /*************************************************************************/
-#define MISS_TEST                0
-#define TEST_PARTIAL_WRITES      0
-#define TEST_PARTIAL_READS       0
-#define TEST_TIMING              0
-#define TEST_READ_LOCKS_MISSED   0
-#define TEST_WRITE_LOCKS_MISSED  0
-#define TEST_ENTER_EXIT          0
-#define TEST_ENTER_EXIT          0
+#define MISS_TEST 0
+#define TEST_PARTIAL_WRITES 0
+#define TEST_PARTIAL_READS 0
+#define TEST_TIMING 0
+#define TEST_READ_LOCKS_MISSED 0
+#define TEST_WRITE_LOCKS_MISSED 0
+#define TEST_ENTER_EXIT 0
+#define TEST_ENTER_EXIT 0
 
 //
 // Timing testing
 //
 #if TEST_TIMING
-#define TTTEST(_x) \
-fprintf(stderr, _x " at: %u\n", \
-	((unsigned int)(ink_get_hrtime()/HRTIME_MSECOND)) % 1000)
-#define TTEST(_x) \
-fprintf(stderr, _x " for: %d at: %u\n", vc->channel, \
-	((unsigned int)(ink_get_hrtime()/HRTIME_MSECOND)) % 1000)
-#define TIMEOUT_TESTS(_s,_d) \
-    if (*(int*)_d == 8)  \
-      fprintf(stderr,_s" lookup  %d\n", *(int*)(_d+20)); \
-    else if (*(int*)_d == 10) \
-      fprintf(stderr,_s" op %d %d\n", *(int*)(_d+36), \
-	      *(int*)(_d+40)); \
-    else if (*(int*)_d == 11) \
-      fprintf(stderr,_s" rop %d %d\n", *(int*)(_d+4), \
-	      *(int*)(_d+8))
+#define TTTEST(_x) fprintf(stderr, _x " at: %u\n", ((unsigned int)(ink_get_hrtime() / HRTIME_MSECOND)) % 1000)
+#define TTEST(_x) fprintf(stderr, _x " for: %d at: %u\n", vc->channel, ((unsigned int)(ink_get_hrtime() / HRTIME_MSECOND)) % 1000)
+#define TIMEOUT_TESTS(_s, _d)                                                \
+  if (*(int *)_d == 8)                                                       \
+    fprintf(stderr, _s " lookup  %d\n", *(int *)(_d + 20));                  \
+  else if (*(int *)_d == 10)                                                 \
+    fprintf(stderr, _s " op %d %d\n", *(int *)(_d + 36), *(int *)(_d + 40)); \
+  else if (*(int *)_d == 11)                                                 \
+  fprintf(stderr, _s " rop %d %d\n", *(int *)(_d + 4), *(int *)(_d + 8))
 #else
 #define TTTEST(_x)
 #define TTEST(_x)
-#define TIMEOUT_TESTS(_x,_y)
+#define TIMEOUT_TESTS(_x, _y)
 #endif
 
 #if (TEST_READ_LOCKS_MISSED || TEST_WRITE_LOCKS_MISSED)
 static unsigned int test_cluster_locks_missed = 0;
-static
-test_cluster_lock_might_fail()
+static test_cluster_lock_might_fail()
 {
   return (!(rand_r(&test_cluster_locks_missed) % 13));
 }
@@ -194,67 +184,63 @@ test_cluster_lock_might_fail()
 #endif
 
 #if TEST_ENTER_EXIT
-struct enter_exit_class
-{
+struct enter_exit_class {
   int *outv;
-    enter_exit_class(int *in, int *out):outv(out)
-  {
-    (*in)++;
-  }
-   ~enter_exit_class()
-  {
-    (*outv)++;
-  }
+  enter_exit_class(int *in, int *out) : outv(out) { (*in)++; }
+  ~enter_exit_class() { (*outv)++; }
 };
 
-#define enter_exit(_x,_y) enter_exit_class a(_x,_y)
+#define enter_exit(_x, _y) enter_exit_class a(_x, _y)
 #else
-#define enter_exit(_x,_y)
+#define enter_exit(_x, _y)
 #endif
 
-#define DOT_SEPARATED(_x)                             \
-((unsigned char*)&(_x))[0], ((unsigned char*)&(_x))[1],   \
-  ((unsigned char*)&(_x))[2], ((unsigned char*)&(_x))[3]
+#define DOT_SEPARATED(_x) \
+  ((unsigned char *)&(_x))[0], ((unsigned char *)&(_x))[1], ((unsigned char *)&(_x))[2], ((unsigned char *)&(_x))[3]
 
 //
 // RPC message for CLOSE_CHANNEL_CLUSTER_FUNCTION
 //
-struct CloseMessage:public ClusterMessageHeader
-{
+struct CloseMessage : public ClusterMessageHeader {
   uint32_t channel;
   int32_t status;
   int32_t lerrno;
   uint32_t sequence_number;
 
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    CLOSE_CHAN_MESSAGE_VERSION = MAX_VERSION
+    CLOSE_CHAN_MESSAGE_VERSION = MAX_VERSION,
   };
 
-    CloseMessage(uint16_t vers = CLOSE_CHAN_MESSAGE_VERSION)
-:  ClusterMessageHeader(vers), channel(0), status(0), lerrno(0), sequence_number(0) {
+  CloseMessage(uint16_t vers = CLOSE_CHAN_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), channel(0), status(0), lerrno(0), sequence_number(0)
+  {
   }
   ////////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return CLOSE_CHAN_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
     return sizeof(CloseMessage);
   }
-  void init(uint16_t vers = CLOSE_CHAN_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = CLOSE_CHAN_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ats_swap32(&channel);
-      ats_swap32((uint32_t *) & status);
-      ats_swap32((uint32_t *) & lerrno);
+      ats_swap32((uint32_t *)&status);
+      ats_swap32((uint32_t *)&lerrno);
       ats_swap32(&sequence_number);
     }
   }
@@ -264,36 +250,36 @@ struct CloseMessage:public ClusterMessageHeader
 //
 // RPC message for MACHINE_LIST_CLUSTER_FUNCTION
 //
-struct MachineListMessage:public ClusterMessageHeader
-{
-  uint32_t n_ip;                  // Valid entries in ip[]
-  uint32_t ip[CLUSTER_MAX_MACHINES];      // variable length data
+struct MachineListMessage : public ClusterMessageHeader {
+  uint32_t n_ip;                     // Valid entries in ip[]
+  uint32_t ip[CLUSTER_MAX_MACHINES]; // variable length data
 
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    MACHINE_LIST_MESSAGE_VERSION = MAX_VERSION
+    MACHINE_LIST_MESSAGE_VERSION = MAX_VERSION,
   };
 
-    MachineListMessage():ClusterMessageHeader(MACHINE_LIST_MESSAGE_VERSION), n_ip(0)
-  {
-    memset(ip, 0, sizeof(ip));
-  }
+  MachineListMessage() : ClusterMessageHeader(MACHINE_LIST_MESSAGE_VERSION), n_ip(0) { memset(ip, 0, sizeof(ip)); }
   ////////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return MACHINE_LIST_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
     return sizeof(ClusterMessageHeader);
   }
-  void init(uint16_t vers = MACHINE_LIST_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = MACHINE_LIST_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     ats_swap32(&n_ip);
   }
@@ -303,39 +289,43 @@ struct MachineListMessage:public ClusterMessageHeader
 //
 // RPC message for SET_CHANNEL_DATA_CLUSTER_FUNCTION
 //
-struct SetChanDataMessage:public ClusterMessageHeader
-{
+struct SetChanDataMessage : public ClusterMessageHeader {
   uint32_t channel;
   uint32_t sequence_number;
-  uint32_t data_type;             // enum CacheDataType
+  uint32_t data_type; // enum CacheDataType
   char data[4];
 
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    SET_CHANNEL_DATA_MESSAGE_VERSION = MAX_VERSION
+    SET_CHANNEL_DATA_MESSAGE_VERSION = MAX_VERSION,
   };
 
-    SetChanDataMessage(uint16_t vers = SET_CHANNEL_DATA_MESSAGE_VERSION)
-:  ClusterMessageHeader(vers), channel(0), sequence_number(0), data_type(0) {
+  SetChanDataMessage(uint16_t vers = SET_CHANNEL_DATA_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), channel(0), sequence_number(0), data_type(0)
+  {
     memset(data, 0, sizeof(data));
   }
   ////////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return SET_CHANNEL_DATA_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
     SetChanDataMessage *p = 0;
-    return (int) DOUBLE_ALIGN((int64_t) ((char *) &p->data[0] - (char *) p));
+    return (int)DOUBLE_ALIGN((int64_t)((char *)&p->data[0] - (char *)p));
   }
-  void init(uint16_t vers = SET_CHANNEL_DATA_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = SET_CHANNEL_DATA_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ats_swap32(&channel);
@@ -349,36 +339,40 @@ struct SetChanDataMessage:public ClusterMessageHeader
 //
 // RPC message for SET_CHANNEL_PIN_CLUSTER_FUNCTION
 //
-struct SetChanPinMessage:public ClusterMessageHeader
-{
+struct SetChanPinMessage : public ClusterMessageHeader {
   uint32_t channel;
   uint32_t sequence_number;
   uint32_t pin_time;
 
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    SET_CHANNEL_PIN_MESSAGE_VERSION = MAX_VERSION
+    SET_CHANNEL_PIN_MESSAGE_VERSION = MAX_VERSION,
   };
 
-    SetChanPinMessage(uint16_t vers = SET_CHANNEL_PIN_MESSAGE_VERSION)
-:  ClusterMessageHeader(vers), channel(0), sequence_number(0), pin_time(0) {
+  SetChanPinMessage(uint16_t vers = SET_CHANNEL_PIN_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), channel(0), sequence_number(0), pin_time(0)
+  {
   }
   ////////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return SET_CHANNEL_PIN_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) sizeof(SetChanPinMessage);
+    return (int)sizeof(SetChanPinMessage);
   }
-  void init(uint16_t vers = SET_CHANNEL_PIN_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = SET_CHANNEL_PIN_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ats_swap32(&channel);
@@ -392,36 +386,40 @@ struct SetChanPinMessage:public ClusterMessageHeader
 //
 // RPC message for SET_CHANNEL_PRIORITY_CLUSTER_FUNCTION
 //
-struct SetChanPriorityMessage:public ClusterMessageHeader
-{
+struct SetChanPriorityMessage : public ClusterMessageHeader {
   uint32_t channel;
   uint32_t sequence_number;
   uint32_t disk_priority;
 
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    SET_CHANNEL_PRIORITY_MESSAGE_VERSION = MAX_VERSION
+    SET_CHANNEL_PRIORITY_MESSAGE_VERSION = MAX_VERSION,
   };
 
-    SetChanPriorityMessage(uint16_t vers = SET_CHANNEL_PRIORITY_MESSAGE_VERSION)
-:  ClusterMessageHeader(vers), channel(0), sequence_number(0), disk_priority(0) {
+  SetChanPriorityMessage(uint16_t vers = SET_CHANNEL_PRIORITY_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), channel(0), sequence_number(0), disk_priority(0)
+  {
   }
   ////////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return SET_CHANNEL_PRIORITY_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) sizeof(SetChanPriorityMessage);
+    return (int)sizeof(SetChanPriorityMessage);
   }
-  void init(uint16_t vers = SET_CHANNEL_PRIORITY_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = SET_CHANNEL_PRIORITY_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ats_swap32(&channel);
@@ -454,7 +452,7 @@ IsHighBitSet(int *val)
 // ClusterAccept -- Handle cluster connect events from peer
 //                  cluster nodes.
 /////////////////////////////////////////////////////////////////
-class ClusterAccept:public Continuation
+class ClusterAccept : public Continuation
 {
 public:
   ClusterAccept(int *, int, int);
@@ -463,9 +461,9 @@ public:
   int ClusterAcceptEvent(int, void *);
   int ClusterAcceptMachine(NetVConnection *);
 
-   ~ClusterAccept();
-private:
+  ~ClusterAccept();
 
+private:
   int *p_cluster_port;
   int socket_send_bufsize;
   int socket_recv_bufsize;
@@ -476,13 +474,13 @@ private:
 
 // VC++ 5.0 special
 struct ClusterHandler;
-typedef int (ClusterHandler::*ClusterContHandler) (int, void *);
+typedef int (ClusterHandler::*ClusterContHandler)(int, void *);
 
 struct OutgoingControl;
-typedef int (OutgoingControl::*OutgoingCtrlHandler) (int, void *);
+typedef int (OutgoingControl::*OutgoingCtrlHandler)(int, void *);
 
 struct ClusterVConnection;
-typedef int (ClusterVConnection::*ClusterVConnHandler) (int, void *);
+typedef int (ClusterVConnection::*ClusterVConnHandler)(int, void *);
 
 // Library  declarations
 extern void cluster_set_priority(ClusterHandler *, ClusterVConnState *, int);
@@ -493,7 +491,7 @@ extern void cluster_reschedule(ClusterHandler *, ClusterVConnection *, ClusterVC
 extern void cluster_reschedule_offset(ClusterHandler *, ClusterVConnection *, ClusterVConnState *, int);
 extern void cluster_disable(ClusterHandler *, ClusterVConnection *, ClusterVConnState *);
 extern void cluster_update_priority(ClusterHandler *, ClusterVConnection *, ClusterVConnState *, int64_t, int64_t);
-#define CLUSTER_BUMP_NO_REMOVE    -1
+#define CLUSTER_BUMP_NO_REMOVE -1
 extern void cluster_bump(ClusterHandler *, ClusterVConnectionBase *, ClusterVConnState *, int);
 
 extern IOBufferBlock *clone_IOBufferBlockList(IOBufferBlock *, int, int, IOBufferBlock **);
@@ -501,7 +499,7 @@ extern IOBufferBlock *consume_IOBufferBlockList(IOBufferBlock *, int64_t);
 extern int64_t bytes_IOBufferBlockList(IOBufferBlock *, int64_t);
 
 // ClusterVConnection declarations
-extern void clusterVCAllocator_free(ClusterVConnection * vc);
+extern void clusterVCAllocator_free(ClusterVConnection *vc);
 extern ClassAllocator<ClusterVConnection> clusterVCAllocator;
 extern ClassAllocator<ByteBankDescriptor> byteBankAllocator;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterLib.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterLib.h b/iocore/cluster/P_ClusterLib.h
index eff5098..39e510b 100644
--- a/iocore/cluster/P_ClusterLib.h
+++ b/iocore/cluster/P_ClusterLib.h
@@ -53,14 +53,13 @@ extern int partial_writev(int, IOVec *, int, int);
 extern void dump_time_buckets();
 
 struct GlobalClusterPeriodicEvent;
-typedef int (GlobalClusterPeriodicEvent::*GClusterPEHandler) (int, void *);
+typedef int (GlobalClusterPeriodicEvent::*GClusterPEHandler)(int, void *);
 
-struct GlobalClusterPeriodicEvent:public Continuation
-{
+struct GlobalClusterPeriodicEvent : public Continuation {
   GlobalClusterPeriodicEvent();
   ~GlobalClusterPeriodicEvent();
   void init();
-  int calloutEvent(Event * e, void *data);
+  int calloutEvent(Event *e, void *data);
 
   // Private data
   Event *_thisCallout;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterLoadMonitor.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterLoadMonitor.h b/iocore/cluster/P_ClusterLoadMonitor.h
index 89156bd..60452bc 100644
--- a/iocore/cluster/P_ClusterLoadMonitor.h
+++ b/iocore/cluster/P_ClusterLoadMonitor.h
@@ -35,7 +35,7 @@
 //***************************************************************************
 // ClusterLoadMonitor class -- Compute cluster interconnect load metric
 //***************************************************************************
-class ClusterLoadMonitor:public Continuation
+class ClusterLoadMonitor : public Continuation
 {
 public:
   /////////////////////////////////////
@@ -52,28 +52,27 @@ public:
   static int cf_cluster_load_clear_duration;
   static int cf_cluster_load_exceed_duration;
 
-  struct cluster_load_ping_msg
-  {
+  struct cluster_load_ping_msg {
     int magicno;
     int version;
     int sequence_number;
     ink_hrtime send_time;
     ClusterLoadMonitor *monitor;
 
-    enum
-    {
+    enum {
       CL_MSG_MAGICNO = 0x12ABCDEF,
-      CL_MSG_VERSION = 1
+      CL_MSG_VERSION = 1,
     };
-      cluster_load_ping_msg(ClusterLoadMonitor * m = 0)
-  :  magicno(CL_MSG_MAGICNO), version(CL_MSG_VERSION), sequence_number(0), send_time(0), monitor(m) {
+    cluster_load_ping_msg(ClusterLoadMonitor *m = 0)
+      : magicno(CL_MSG_MAGICNO), version(CL_MSG_VERSION), sequence_number(0), send_time(0), monitor(m)
+    {
     }
   };
 
   static void cluster_load_ping_rethandler(ClusterHandler *, void *, int);
 
 public:
-  ClusterLoadMonitor(ClusterHandler * ch);
+  ClusterLoadMonitor(ClusterHandler *ch);
   void init();
   ~ClusterLoadMonitor();
   void cancel_monitor();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterMachine.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterMachine.h b/iocore/cluster/P_ClusterMachine.h
index 4415d5d..c98c794 100644
--- a/iocore/cluster/P_ClusterMachine.h
+++ b/iocore/cluster/P_ClusterMachine.h
@@ -39,7 +39,7 @@
 // Timeout the Machine * this amount of time after they
 // fall out of the current configuration that are deleted.
 //
-#define MACHINE_TIMEOUT            (HRTIME_DAY*2)
+#define MACHINE_TIMEOUT (HRTIME_DAY * 2)
 
 
 //
@@ -51,12 +51,11 @@
 //
 //  Long running operations should use more sophisticated synchronization.
 //
-#define NO_RACE_DELAY                  HRTIME_HOUR      // a long long time
+#define NO_RACE_DELAY HRTIME_HOUR // a long long time
 
-struct ClusterHandler;           // Leave this a class - VC++ gets very anal  ~SR -- which version of VC++? ~igalic
+struct ClusterHandler; // Leave this a class - VC++ gets very anal  ~SR -- which version of VC++? ~igalic
 
-struct ClusterMachine: public Server
-{
+struct ClusterMachine : public Server {
   bool dead;
   char *hostname;
   int hostname_len;
@@ -87,17 +86,17 @@ struct ClusterMachine: public Server
   ClusterHandler **clusterHandlers;
 };
 
-struct MachineListElement
-{
+struct MachineListElement {
   unsigned int ip;
   int port;
 };
 
-struct MachineList
-{
+struct MachineList {
   int n;
   MachineListElement machine[1];
-  MachineListElement *find(unsigned int ip, int port = 0) {
+  MachineListElement *
+  find(unsigned int ip, int port = 0)
+  {
     for (int i = 0; i < n; i++)
       if (machine[i].ip == ip && (!port || machine[i].port == port))
         return &machine[i];
@@ -106,20 +105,20 @@ struct MachineList
 };
 
 MachineList *read_MachineList(const char *filename, int test_fd = -1);
-void free_MachineList(MachineList * l);
+void free_MachineList(MachineList *l);
 
-struct clusterConfigFile
-{
-  char *parseFile(int fd)
+struct clusterConfigFile {
+  char *
+  parseFile(int fd)
   {
-    return (char *) read_MachineList(NULL, fd);
+    return (char *)read_MachineList(NULL, fd);
   }
 };
 
 inkcoreapi ClusterMachine *this_cluster_machine();
 void create_this_cluster_machine();
 
-void free_ClusterMachine(ClusterMachine * m);
+void free_ClusterMachine(ClusterMachine *m);
 
 MachineList *the_cluster_machines_config();
 MachineList *the_cluster_config();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_TimeTrace.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_TimeTrace.h b/iocore/cluster/P_TimeTrace.h
index e4f3796..e92a7f8 100644
--- a/iocore/cluster/P_TimeTrace.h
+++ b/iocore/cluster/P_TimeTrace.h
@@ -32,8 +32,8 @@
 
 // #define ENABLE_TIME_TRACE
 
-#define TIME_DIST_BUCKETS               500
-#define TIME_DIST_BUCKETS_SIZE          TIME_DIST_BUCKETS+1
+#define TIME_DIST_BUCKETS 500
+#define TIME_DIST_BUCKETS_SIZE TIME_DIST_BUCKETS + 1
 
 #ifdef ENABLE_TIME_TRACE
 extern int cdb_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
@@ -65,14 +65,15 @@ extern int cluster_send_events;
 #endif // ENABLE_TIME_TRACE
 
 #ifdef ENABLE_TIME_TRACE
-#define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt) do { \
-  ink_hrtime now = ink_get_hrtime(); \
-  unsigned int bucket = (now - _start_time) / HRTIME_MSECONDS(10); \
-  if (bucket > TIME_DIST_BUCKETS) \
-    bucket = TIME_DIST_BUCKETS; \
-  ink_atomic_increment(&_time_dist[bucket], 1); \
-  ink_atomic_increment(&_time_cnt, 1); \
-} while(0)
+#define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt)           \
+  do {                                                               \
+    ink_hrtime now = ink_get_hrtime();                               \
+    unsigned int bucket = (now - _start_time) / HRTIME_MSECONDS(10); \
+    if (bucket > TIME_DIST_BUCKETS)                                  \
+      bucket = TIME_DIST_BUCKETS;                                    \
+    ink_atomic_increment(&_time_dist[bucket], 1);                    \
+    ink_atomic_increment(&_time_cnt, 1);                             \
+  } while (0)
 
 #else // !ENABLE_TIME_TRACE
 #define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/test_I_Cluster.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/test_I_Cluster.cc b/iocore/cluster/test_I_Cluster.cc
index 587834f..fb10885 100644
--- a/iocore/cluster/test_I_Cluster.cc
+++ b/iocore/cluster/test_I_Cluster.cc
@@ -62,7 +62,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -85,20 +84,18 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
-  // XXX: HP-UX ???
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
+// XXX: HP-UX ???
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -121,13 +118,13 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
+                 diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/test_P_Cluster.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/test_P_Cluster.cc b/iocore/cluster/test_P_Cluster.cc
index 587834f..fb10885 100644
--- a/iocore/cluster/test_P_Cluster.cc
+++ b/iocore/cluster/test_P_Cluster.cc
@@ -62,7 +62,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -85,20 +84,18 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
-  // XXX: HP-UX ???
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
+// XXX: HP-UX ???
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -121,13 +118,13 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
+                 diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 


[13/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Map.h
----------------------------------------------------------------------
diff --git a/lib/ts/Map.h b/lib/ts/Map.h
index 6814f61..1d37b36 100644
--- a/lib/ts/Map.h
+++ b/lib/ts/Map.h
@@ -30,17 +30,18 @@
 #include "List.h"
 #include "Vec.h"
 
-#define MAP_INTEGRAL_SIZE               (1 << (2))
+#define MAP_INTEGRAL_SIZE (1 << (2))
 //#define MAP_INITIAL_SHIFT               ((2)+1)
 //#define MAP_INITIAL_SIZE                (1 << MAP_INITIAL_SHIFT)
 
 typedef const char cchar;
 
-template<class A>
+template <class A>
 static inline char *
-_dupstr(cchar *s, cchar *e = 0) {
-  int l = e ? e-s : strlen(s);
-  char *ss = (char*)A::alloc(l+1);
+_dupstr(cchar *s, cchar *e = 0)
+{
+  int l = e ? e - s : strlen(s);
+  char *ss = (char *)A::alloc(l + 1);
   memcpy(ss, s, l);
   ss[l] = 0;
   return ss;
@@ -48,22 +49,28 @@ _dupstr(cchar *s, cchar *e = 0) {
 
 // Simple direct mapped Map (pointer hash table) and Environment
 
-template <class K, class C> class MapElem {
- public:
-  K     key;
-  C     value;
+template <class K, class C> class MapElem
+{
+public:
+  K key;
+  C value;
   bool operator==(MapElem &e) { return e.key == key; }
   operator uintptr_t(void) { return (uintptr_t)(uintptr_t)key; }
-  MapElem(uintptr_t x) { ink_assert(!x); key = 0; }
+  MapElem(uintptr_t x)
+  {
+    ink_assert(!x);
+    key = 0;
+  }
   MapElem(K akey, C avalue) : key(akey), value(avalue) {}
   MapElem(MapElem &e) : key(e.key), value(e.value) {}
   MapElem() : key(0) {}
 };
 
-template <class K, class C, class A = DefaultAlloc> class Map : public Vec<MapElem<K,C>, A> {
- public:
-  typedef MapElem<K,C> ME;
-  typedef Vec<ME,A> PType;
+template <class K, class C, class A = DefaultAlloc> class Map : public Vec<MapElem<K, C>, A>
+{
+public:
+  typedef MapElem<K, C> ME;
+  typedef Vec<ME, A> PType;
   using PType::n;
   using PType::i;
   using PType::v;
@@ -74,189 +81,251 @@ template <class K, class C, class A = DefaultAlloc> class Map : public Vec<MapEl
   void get_keys(Vec<K> &keys);
   void get_keys_set(Vec<K> &keys);
   void get_values(Vec<C> &values);
-  void map_union(Map<K,C> &m);
-  bool some_disjunction(Map<K,C> &m) const;
+  void map_union(Map<K, C> &m);
+  bool some_disjunction(Map<K, C> &m) const;
 };
 
-template <class C> class HashFns {
- public:
+template <class C> class HashFns
+{
+public:
   static uintptr_t hash(C a);
   static int equal(C a, C b);
 };
 
-template <class K, class C> class HashSetFns {
- public:
+template <class K, class C> class HashSetFns
+{
+public:
   static uintptr_t hash(C a);
   static uintptr_t hash(K a);
   static int equal(C a, C b);
   static int equal(K a, C b);
 };
 
-template <class K, class AHashFns, class C, class A = DefaultAlloc> class HashMap : public Map<K,C,A> {
- public:
-  typedef MapElem<K,C> value_type; ///< What's stored in the table.
-  using Map<K,C,A>::n;
-  using Map<K,C,A>::i;
-  using Map<K,C,A>::v;
-  using Map<K,C,A>::e;
-  MapElem<K,C> *get_internal(K akey);
+template <class K, class AHashFns, class C, class A = DefaultAlloc> class HashMap : public Map<K, C, A>
+{
+public:
+  typedef MapElem<K, C> value_type; ///< What's stored in the table.
+  using Map<K, C, A>::n;
+  using Map<K, C, A>::i;
+  using Map<K, C, A>::v;
+  using Map<K, C, A>::e;
+  MapElem<K, C> *get_internal(K akey);
   C get(K akey);
-  value_type* put(K akey, C avalue);
+  value_type *put(K akey, C avalue);
   void get_keys(Vec<K> &keys);
   void get_values(Vec<C> &values);
 };
 
-#define form_Map(_c, _p, _v) if ((_v).n) for (_c *qq__##_p = (_c*)0, *_p = &(_v).v[0]; \
-             ((uintptr_t)(qq__##_p) < (_v).n) && ((_p = &(_v).v[(uintptr_t)qq__##_p]) || 1); \
-             qq__##_p = (_c*)(((uintptr_t)qq__##_p) + 1)) \
-          if ((_p)->key)
+#define form_Map(_c, _p, _v)                                                                                                       \
+  if ((_v).n)                                                                                                                      \
+    for (_c *qq__##_p = (_c *)0, *_p = &(_v).v[0]; ((uintptr_t)(qq__##_p) < (_v).n) && ((_p = &(_v).v[(uintptr_t)qq__##_p]) || 1); \
+         qq__##_p = (_c *)(((uintptr_t)qq__##_p) + 1))                                                                             \
+      if ((_p)->key)
 
 
-template <class K, class AHashFns, class C, class A = DefaultAlloc> class HashSet : public Vec<C,A> {
- public:
-  typedef Vec<C,A> V;
+template <class K, class AHashFns, class C, class A = DefaultAlloc> class HashSet : public Vec<C, A>
+{
+public:
+  typedef Vec<C, A> V;
   using V::n;
   using V::i;
   using V::v;
   using V::e;
   C get(K akey);
-  C *put( C avalue);
+  C *put(C avalue);
 };
 
-class StringHashFns {
- public:
-  static uintptr_t hash(cchar *s) {
+class StringHashFns
+{
+public:
+  static uintptr_t
+  hash(cchar *s)
+  {
     uintptr_t h = 0;
     // 31 changed to 27, to avoid prime2 in vec.cpp
-    while (*s) h = h * 27 + (unsigned char)*s++;
+    while (*s)
+      h = h * 27 + (unsigned char)*s++;
     return h;
   }
-  static int equal(cchar *a, cchar *b) { return !strcmp(a, b); }
+  static int
+  equal(cchar *a, cchar *b)
+  {
+    return !strcmp(a, b);
+  }
 };
 
-class CaseStringHashFns {
- public:
-  static uintptr_t hash(cchar *s) {
+class CaseStringHashFns
+{
+public:
+  static uintptr_t
+  hash(cchar *s)
+  {
     uintptr_t h = 0;
     // 31 changed to 27, to avoid prime2 in vec.cpp
-    while (*s) h = h * 27 + (unsigned char)toupper(*s++);
+    while (*s)
+      h = h * 27 + (unsigned char)toupper(*s++);
     return h;
   }
-  static int equal(cchar *a, cchar *b) { return !strcasecmp(a, b); }
+  static int
+  equal(cchar *a, cchar *b)
+  {
+    return !strcasecmp(a, b);
+  }
 };
 
-class PointerHashFns {
- public:
-  static uintptr_t hash(void *s) { return (uintptr_t)(uintptr_t)s; }
-  static int equal(void *a, void *b) { return a == b; }
+class PointerHashFns
+{
+public:
+  static uintptr_t
+  hash(void *s)
+  {
+    return (uintptr_t)(uintptr_t)s;
+  }
+  static int
+  equal(void *a, void *b)
+  {
+    return a == b;
+  }
 };
 
-template <class C, class AHashFns, class A = DefaultAlloc> class ChainHash : public Map<uintptr_t, List<C,A>,A> {
- public:
-  using Map<uintptr_t, List<C,A>,A>::n;
-  using Map<uintptr_t, List<C,A>,A>::v;
+template <class C, class AHashFns, class A = DefaultAlloc> class ChainHash : public Map<uintptr_t, List<C, A>, A>
+{
+public:
+  using Map<uintptr_t, List<C, A>, A>::n;
+  using Map<uintptr_t, List<C, A>, A>::v;
   typedef ConsCell<C, A> ChainCons;
   C put(C c);
   C get(C c);
   C put_bag(C c);
-  int get_bag(C c,Vec<C> &v);
+  int get_bag(C c, Vec<C> &v);
   int del(C avalue);
   void get_elements(Vec<C> &elements);
 };
 
-template <class K, class AHashFns, class C, class A = DefaultAlloc> class ChainHashMap :
-  public Map<uintptr_t, List<MapElem<K,C>,A>,A> {
- public:
-  using Map<uintptr_t, List<MapElem<K,C>,A>,A>::n;
-  using Map<uintptr_t, List<MapElem<K,C>,A>,A>::v;
-  MapElem<K,C> *put(K akey, C avalue);
+template <class K, class AHashFns, class C, class A = DefaultAlloc>
+class ChainHashMap : public Map<uintptr_t, List<MapElem<K, C>, A>, A>
+{
+public:
+  using Map<uintptr_t, List<MapElem<K, C>, A>, A>::n;
+  using Map<uintptr_t, List<MapElem<K, C>, A>, A>::v;
+  MapElem<K, C> *put(K akey, C avalue);
   C get(K akey);
   int del(K akey);
-  MapElem<K,C> *put_bag(K akey, C c);
+  MapElem<K, C> *put_bag(K akey, C c);
   int get_bag(K akey, Vec<C> &v);
   void get_keys(Vec<K> &keys);
   void get_values(Vec<C> &values);
 };
 
-template<class F = StringHashFns, class A = DefaultAlloc>
-class StringChainHash : public ChainHash<cchar *, F, A> {
- public:
+template <class F = StringHashFns, class A = DefaultAlloc> class StringChainHash : public ChainHash<cchar *, F, A>
+{
+public:
   cchar *canonicalize(cchar *s, cchar *e);
-  cchar *canonicalize(cchar *s) { return canonicalize(s, s + strlen(s)); }
+  cchar *
+  canonicalize(cchar *s)
+  {
+    return canonicalize(s, s + strlen(s));
+  }
 };
 
-template <class C, class AHashFns, int N, class A = DefaultAlloc> class NBlockHash {
- public:
+template <class C, class AHashFns, int N, class A = DefaultAlloc> class NBlockHash
+{
+public:
   int n;
   int i;
   C *v;
   C e[N];
 
-  C* end() { return last(); }
-  int length() { return N * n; }
+  C *
+  end()
+  {
+    return last();
+  }
+  int
+  length()
+  {
+    return N * n;
+  }
   C *first();
   C *last();
   C put(C c);
   C get(C c);
-  C* assoc_put(C *c);
-  C* assoc_get(C *c);
+  C *assoc_put(C *c);
+  C *assoc_get(C *c);
   int del(C c);
   void clear();
   void reset();
   int count();
   void size(int p2);
-  void copy(const NBlockHash<C,AHashFns,N,A> &hh);
-  void move(NBlockHash<C,AHashFns,N,A> &hh);
+  void copy(const NBlockHash<C, AHashFns, N, A> &hh);
+  void move(NBlockHash<C, AHashFns, N, A> &hh);
   NBlockHash();
-  NBlockHash(NBlockHash<C,AHashFns,N,A> &hh) { v = e; copy(hh); }
+  NBlockHash(NBlockHash<C, AHashFns, N, A> &hh)
+  {
+    v = e;
+    copy(hh);
+  }
 };
 
 /* use forv_Vec on BlockHashes */
 
 #define DEFAULT_BLOCK_HASH_SIZE 4
-template <class C, class ABlockHashFns> class BlockHash :
-  public NBlockHash<C, ABlockHashFns, DEFAULT_BLOCK_HASH_SIZE> {};
+template <class C, class ABlockHashFns> class BlockHash : public NBlockHash<C, ABlockHashFns, DEFAULT_BLOCK_HASH_SIZE>
+{
+};
 typedef BlockHash<cchar *, StringHashFns> StringBlockHash;
 
-template <class K, class C, class A = DefaultAlloc> class Env {
- public:
+template <class K, class C, class A = DefaultAlloc> class Env
+{
+public:
   typedef ConsCell<C, A> EnvCons;
   void put(K akey, C avalue);
   C get(K akey);
   void push();
   void pop();
-  void clear() { store.clear(); scope.clear(); }
+  void
+  clear()
+  {
+    store.clear();
+    scope.clear();
+  }
 
   Env() {}
-  Map<K,List<C> *, A> store;
+  Map<K, List<C> *, A> store;
   List<List<K>, A> scope;
   List<C, A> *get_bucket(K akey);
 };
 
 /* IMPLEMENTATION */
 
-template <class K, class C, class A> inline C
-Map<K,C,A>::get(K akey) {
-  MapElem<K,C> e(akey, (C)0);
-  MapElem<K,C> *x = this->set_in(e);
+template <class K, class C, class A>
+inline C
+Map<K, C, A>::get(K akey)
+{
+  MapElem<K, C> e(akey, (C)0);
+  MapElem<K, C> *x = this->set_in(e);
   if (x)
     return x->value;
   return (C)0;
 }
 
-template <class K, class C, class A> inline C *
-Map<K,C,A>::getp(K akey) {
-  MapElem<K,C> e(akey, (C)0);
-  MapElem<K,C> *x = this->set_in(e);
+template <class K, class C, class A>
+inline C *
+Map<K, C, A>::getp(K akey)
+{
+  MapElem<K, C> e(akey, (C)0);
+  MapElem<K, C> *x = this->set_in(e);
   if (x)
     return &x->value;
   return 0;
 }
 
-template <class K, class C, class A> inline MapElem<K,C> *
-Map<K,C,A>::put(K akey, C avalue) {
-  MapElem<K,C> e(akey, avalue);
-  MapElem<K,C> *x = this->set_in(e);
+template <class K, class C, class A>
+inline MapElem<K, C> *
+Map<K, C, A>::put(K akey, C avalue)
+{
+  MapElem<K, C> e(akey, avalue);
+  MapElem<K, C> *x = this->set_in(e);
   if (x) {
     x->value = avalue;
     return x;
@@ -264,47 +333,59 @@ Map<K,C,A>::put(K akey, C avalue) {
     return this->set_add(e);
 }
 
-template <class K, class C, class A> inline MapElem<K,C> *
-Map<K,C,A>::put(K akey) {
-  MapElem<K,C> e(akey, 0);
-  MapElem<K,C> *x = this->set_in(e);
+template <class K, class C, class A>
+inline MapElem<K, C> *
+Map<K, C, A>::put(K akey)
+{
+  MapElem<K, C> e(akey, 0);
+  MapElem<K, C> *x = this->set_in(e);
   if (x)
     return x;
   else
     return this->set_add(e);
 }
 
-template <class K, class C, class A> inline void
-Map<K,C,A>::get_keys(Vec<K> &keys) {
+template <class K, class C, class A>
+inline void
+Map<K, C, A>::get_keys(Vec<K> &keys)
+{
   for (int i = 0; i < n; i++)
     if (v[i].key)
       keys.add(v[i].key);
 }
 
-template <class K, class C, class A> inline void
-Map<K,C,A>::get_keys_set(Vec<K> &keys) {
+template <class K, class C, class A>
+inline void
+Map<K, C, A>::get_keys_set(Vec<K> &keys)
+{
   for (int i = 0; i < n; i++)
     if (v[i].key)
       keys.set_add(v[i].key);
 }
 
-template <class K, class C, class A> inline void
-Map<K,C,A>::get_values(Vec<C> &values) {
+template <class K, class C, class A>
+inline void
+Map<K, C, A>::get_values(Vec<C> &values)
+{
   for (int i = 0; i < n; i++)
     if (v[i].key)
       values.set_add(v[i].value);
   values.set_to_vec();
 }
 
-template <class K, class C, class A> inline void
-Map<K,C,A>::map_union(Map<K,C> &m) {
+template <class K, class C, class A>
+inline void
+Map<K, C, A>::map_union(Map<K, C> &m)
+{
   for (int i = 0; i < m.n; i++)
     if (m.v[i].key)
       put(m.v[i].key, m.v[i].value);
 }
 
-template <class K, class C, class A> inline bool
-Map<K,C,A>::some_disjunction(Map<K,C> &m) const {
+template <class K, class C, class A>
+inline bool
+Map<K, C, A>::some_disjunction(Map<K, C> &m) const
+{
   for (size_t i = 0; i < m.n; i++) {
     if (m.v[i].key && get(m.v[i].key) != m.v[i].value) {
       return true;
@@ -318,24 +399,30 @@ Map<K,C,A>::some_disjunction(Map<K,C> &m) const {
   return false;
 }
 
-template <class K, class C, class A> inline void
-map_set_add(Map<K,Vec<C,A>*,A> &m, K akey, C avalue) {
-  Vec<C,A> *v = m.get(akey);
+template <class K, class C, class A>
+inline void
+map_set_add(Map<K, Vec<C, A> *, A> &m, K akey, C avalue)
+{
+  Vec<C, A> *v = m.get(akey);
   if (!v)
-    m.put(akey, (v = new Vec<C,A>));
+    m.put(akey, (v = new Vec<C, A>));
   v->set_add(avalue);
 }
 
-template <class K, class C, class A> inline void
-map_set_add(Map<K,Vec<C,A>*,A> &m, K akey, Vec<C> *madd) {
-  Vec<C,A> *v = m.get(akey);
+template <class K, class C, class A>
+inline void
+map_set_add(Map<K, Vec<C, A> *, A> &m, K akey, Vec<C> *madd)
+{
+  Vec<C, A> *v = m.get(akey);
   if (!v)
-    m.put(akey, (v = new Vec<C,A>));
+    m.put(akey, (v = new Vec<C, A>));
   v->set_union(*madd);
 }
 
-template <class K, class AHashFns, class C, class A> inline C
-HashSet<K, AHashFns, C, A>::get(K akey) {
+template <class K, class AHashFns, class C, class A>
+inline C
+HashSet<K, AHashFns, C, A>::get(K akey)
+{
   if (!n)
     return 0;
   if (n <= MAP_INTEGRAL_SIZE) {
@@ -347,7 +434,7 @@ HashSet<K, AHashFns, C, A>::get(K akey) {
   }
   uintptr_t h = AHashFns::hash(akey);
   h = h % n;
-  for (int k = h, j = 0; j < i + 3;j++) {
+  for (int k = h, j = 0; j < i + 3; j++) {
     if (!v[k])
       return 0;
     else if (AHashFns::equal(akey, v[k]))
@@ -357,8 +444,10 @@ HashSet<K, AHashFns, C, A>::get(K akey) {
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A> inline C *
-HashSet<K, AHashFns, C, A>::put(C avalue) {
+template <class K, class AHashFns, class C, class A>
+inline C *
+HashSet<K, AHashFns, C, A>::put(C avalue)
+{
   if (n < MAP_INTEGRAL_SIZE) {
     if (!v)
       v = e;
@@ -367,7 +456,7 @@ HashSet<K, AHashFns, C, A>::put(C avalue) {
         return &v[i];
     v[n] = avalue;
     n++;
-    return &v[n-1];
+    return &v[n - 1];
   }
   if (n > MAP_INTEGRAL_SIZE) {
     uintptr_t h = AHashFns::hash(avalue);
@@ -380,21 +469,23 @@ HashSet<K, AHashFns, C, A>::put(C avalue) {
       k = (k + open_hash_primes[j]) % n;
     }
   } else
-    i = SET_INITIAL_INDEX-1; // will be incremented in set_expand
-  HashSet<K,AHashFns,C,A> vv(*this);
-  Vec<C,A>::set_expand();
+    i = SET_INITIAL_INDEX - 1; // will be incremented in set_expand
+  HashSet<K, AHashFns, C, A> vv(*this);
+  Vec<C, A>::set_expand();
   for (int i = 0; i < vv.n; i++)
     if (vv.v[i])
       put(vv.v[i]);
   return put(avalue);
 }
 
-template <class K, class AHashFns, class C, class A> inline MapElem<K,C> *
-HashMap<K,AHashFns,C,A>::get_internal(K akey) {
+template <class K, class AHashFns, class C, class A>
+inline MapElem<K, C> *
+HashMap<K, AHashFns, C, A>::get_internal(K akey)
+{
   if (!n)
     return 0;
   if (n <= MAP_INTEGRAL_SIZE) {
-    for (MapElem<K,C> *c = v; c < v + n; c++)
+    for (MapElem<K, C> *c = v; c < v + n; c++)
       if (c->key)
         if (AHashFns::equal(akey, c->key))
           return c;
@@ -402,7 +493,7 @@ HashMap<K,AHashFns,C,A>::get_internal(K akey) {
   }
   uintptr_t h = AHashFns::hash(akey);
   h = h % n;
-  for (size_t k = h, j = 0; j < i + 3;j++) {
+  for (size_t k = h, j = 0; j < i + 3; j++) {
     if (!v[k].key)
       return 0;
     else if (AHashFns::equal(akey, v[k].key))
@@ -412,17 +503,21 @@ HashMap<K,AHashFns,C,A>::get_internal(K akey) {
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A> inline C
-HashMap<K,AHashFns,C,A>::get(K akey) {
-  MapElem<K,C> *x = get_internal(akey);
+template <class K, class AHashFns, class C, class A>
+inline C
+HashMap<K, AHashFns, C, A>::get(K akey)
+{
+  MapElem<K, C> *x = get_internal(akey);
   if (!x)
     return 0;
   return x->value;
 }
 
-template <class K, class AHashFns, class C, class A> inline MapElem<K,C> *
-HashMap<K,AHashFns,C,A>::put(K akey, C avalue) {
-  MapElem<K,C> *x = get_internal(akey);
+template <class K, class AHashFns, class C, class A>
+inline MapElem<K, C> *
+HashMap<K, AHashFns, C, A>::put(K akey, C avalue)
+{
+  MapElem<K, C> *x = get_internal(akey);
   if (x) {
     x->value = avalue;
     return x;
@@ -433,7 +528,7 @@ HashMap<K,AHashFns,C,A>::put(K akey, C avalue) {
       v[n].key = akey;
       v[n].value = avalue;
       n++;
-      return &v[n-1];
+      return &v[n - 1];
     }
     if (n > MAP_INTEGRAL_SIZE) {
       uintptr_t h = AHashFns::hash(akey);
@@ -447,108 +542,122 @@ HashMap<K,AHashFns,C,A>::put(K akey, C avalue) {
         k = (k + open_hash_primes[j]) % n;
       }
     } else
-      i = SET_INITIAL_INDEX-1; // will be incremented in set_expand
+      i = SET_INITIAL_INDEX - 1; // will be incremented in set_expand
   }
-  HashMap<K,AHashFns,C,A> vv(*this);
-  Map<K,C,A>::set_expand();
+  HashMap<K, AHashFns, C, A> vv(*this);
+  Map<K, C, A>::set_expand();
   for (size_t i = 0; i < vv.n; i++)
     if (vv.v[i].key)
       put(vv.v[i].key, vv.v[i].value);
   return put(akey, avalue);
 }
 
-template <class K, class AHashFns, class C, class A> inline void
-HashMap<K,AHashFns,C,A>::get_keys(Vec<K> &keys) { Map<K,C,A>::get_keys(keys); }
+template <class K, class AHashFns, class C, class A>
+inline void
+HashMap<K, AHashFns, C, A>::get_keys(Vec<K> &keys)
+{
+  Map<K, C, A>::get_keys(keys);
+}
 
-template <class K, class AHashFns, class C, class A> inline void
-HashMap<K,AHashFns,C,A>::get_values(Vec<C> &values) { Map<K,C,A>::get_values(values); }
+template <class K, class AHashFns, class C, class A>
+inline void
+HashMap<K, AHashFns, C, A>::get_values(Vec<C> &values)
+{
+  Map<K, C, A>::get_values(values);
+}
 
-template <class C, class AHashFns, class A> C
-ChainHash<C, AHashFns, A>::put(C c) {
+template <class C, class AHashFns, class A>
+C
+ChainHash<C, AHashFns, A>::put(C c)
+{
   uintptr_t h = AHashFns::hash(c);
-  List<C,A> *l;
-  MapElem<uintptr_t,List<C,A> > e(h, (C)0);
-  MapElem<uintptr_t,List<C,A> > *x = this->set_in(e);
+  List<C, A> *l;
+  MapElem<uintptr_t, List<C, A> > e(h, (C)0);
+  MapElem<uintptr_t, List<C, A> > *x = this->set_in(e);
   if (x)
     l = &x->value;
   else {
-    l = &Map<uintptr_t, List<C,A>, A>::put(h, c)->value;
+    l = &Map<uintptr_t, List<C, A>, A>::put(h, c)->value;
     return l->head->car;
   }
-  forc_List(ChainCons, x, *l)
-    if (AHashFns::equal(c, x->car))
-      return x->car;
+  forc_List(ChainCons, x, *l) if (AHashFns::equal(c, x->car)) return x->car;
   l->push(c);
   return (C)0;
 }
 
-template <class C, class AHashFns, class A> C
-ChainHash<C, AHashFns, A>::get(C c) {
+template <class C, class AHashFns, class A>
+C
+ChainHash<C, AHashFns, A>::get(C c)
+{
   uintptr_t h = AHashFns::hash(c);
   List<C> empty;
-  MapElem<uintptr_t,List<C,A> > e(h, empty);
-  MapElem<uintptr_t,List<C,A> > *x = this->set_in(e);
+  MapElem<uintptr_t, List<C, A> > e(h, empty);
+  MapElem<uintptr_t, List<C, A> > *x = this->set_in(e);
   if (!x)
     return 0;
   List<C> *l = &x->value;
-  forc_List(ChainCons, x, *l)
-    if (AHashFns::equal(c, x->car))
-      return x->car;
+  forc_List(ChainCons, x, *l) if (AHashFns::equal(c, x->car)) return x->car;
   return 0;
 }
 
-template <class C, class AHashFns, class A> C
-ChainHash<C, AHashFns, A>::put_bag(C c) {
+template <class C, class AHashFns, class A>
+C
+ChainHash<C, AHashFns, A>::put_bag(C c)
+{
   uintptr_t h = AHashFns::hash(c);
   List<C, A> *l;
-  MapElem<uintptr_t,List<C,A> > e(h, (C)0);
-  MapElem<uintptr_t,List<C,A> > *x = this->set_in(e);
+  MapElem<uintptr_t, List<C, A> > e(h, (C)0);
+  MapElem<uintptr_t, List<C, A> > *x = this->set_in(e);
   if (x)
     l = &x->value;
   else {
-    l = &Map<uintptr_t, List<C,A> >::put(h, c)->value;
+    l = &Map<uintptr_t, List<C, A> >::put(h, c)->value;
     return l->head->car;
   }
   l->push(c);
   return (C)0;
 }
 
-template <class C, class AHashFns, class A> int
-ChainHash<C, AHashFns, A>::get_bag(C c, Vec<C> &v) {
+template <class C, class AHashFns, class A>
+int
+ChainHash<C, AHashFns, A>::get_bag(C c, Vec<C> &v)
+{
   uintptr_t h = AHashFns::hash(c);
-  List<C,A> empty;
-  MapElem<uintptr_t,List<C,A> > e(h, empty);
-  MapElem<uintptr_t,List<C,A> > *x = this->set_in(e);
+  List<C, A> empty;
+  MapElem<uintptr_t, List<C, A> > e(h, empty);
+  MapElem<uintptr_t, List<C, A> > *x = this->set_in(e);
   if (!x)
     return 0;
-  List<C,A> *l = &x->value;
-  forc_List(C, x, *l)
-    if (AHashFns::equal(c, x->car))
-      v.add(x->car);
+  List<C, A> *l = &x->value;
+  forc_List(C, x, *l) if (AHashFns::equal(c, x->car)) v.add(x->car);
   return v.n;
 }
 
-template <class C, class AHashFns, class A> void
-ChainHash<C, AHashFns, A>::get_elements(Vec<C> &elements) {
+template <class C, class AHashFns, class A>
+void
+ChainHash<C, AHashFns, A>::get_elements(Vec<C> &elements)
+{
   for (int i = 0; i < n; i++) {
     List<C, A> *l = &v[i].value;
-    forc_List(C, x, *l)
-      elements.add(x);
+    forc_List(C, x, *l) elements.add(x);
   }
 }
 
-template <class C, class AHashFns, class A> int
-ChainHash<C, AHashFns, A>::del(C c) {
+template <class C, class AHashFns, class A>
+int
+ChainHash<C, AHashFns, A>::del(C c)
+{
   uintptr_t h = AHashFns::hash(c);
   List<C> *l;
-  MapElem<uintptr_t,List<C,A> > e(h, (C)0);
-  MapElem<uintptr_t,List<C,A> > *x = this->set_in(e);
+  MapElem<uintptr_t, List<C, A> > e(h, (C)0);
+  MapElem<uintptr_t, List<C, A> > *x = this->set_in(e);
   if (x)
     l = &x->value;
   else
     return 0;
   ConsCell<C> *last = 0;
-  forc_List(ConsCell<C>, x, *l) {
+  forc_List(ConsCell<C>, x, *l)
+  {
     if (AHashFns::equal(c, x->car)) {
       if (!last)
         l->head = x->cdr;
@@ -562,21 +671,23 @@ ChainHash<C, AHashFns, A>::del(C c) {
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A>  MapElem<K,C> *
-ChainHashMap<K, AHashFns, C, A>::put(K akey, C avalue) {
+template <class K, class AHashFns, class C, class A>
+MapElem<K, C> *
+ChainHashMap<K, AHashFns, C, A>::put(K akey, C avalue)
+{
   uintptr_t h = AHashFns::hash(akey);
-  List<MapElem<K,C>,A> empty;
-  List<MapElem<K,C>,A> *l;
+  List<MapElem<K, C>, A> empty;
+  List<MapElem<K, C>, A> *l;
   MapElem<K, C> c(akey, avalue);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > e(h, empty);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > *x = this->set_in(e);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > e(h, empty);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > *x = this->set_in(e);
   if (x)
     l = &x->value;
   else {
-    l = &Map<uintptr_t, List<MapElem<K,C>,A>,A>::put(h, c)->value;
+    l = &Map<uintptr_t, List<MapElem<K, C>, A>, A>::put(h, c)->value;
     return &l->head->car;
   }
-  for (ConsCell<MapElem<K,C>,A> *p  = l->head; p; p = p->cdr)
+  for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr)
     if (AHashFns::equal(akey, p->car.key)) {
       p->car.value = avalue;
       return &p->car;
@@ -585,71 +696,79 @@ ChainHashMap<K, AHashFns, C, A>::put(K akey, C avalue) {
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A> C
-ChainHashMap<K, AHashFns, C, A>::get(K akey) {
+template <class K, class AHashFns, class C, class A>
+C
+ChainHashMap<K, AHashFns, C, A>::get(K akey)
+{
   uintptr_t h = AHashFns::hash(akey);
-  List<MapElem<K,C>, A> empty;
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > e(h, empty);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > *x = this->set_in(e);
+  List<MapElem<K, C>, A> empty;
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > e(h, empty);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > *x = this->set_in(e);
   if (!x)
     return 0;
-  List<MapElem<K,C>,A> *l = &x->value;
+  List<MapElem<K, C>, A> *l = &x->value;
   if (l->head)
-    for (ConsCell<MapElem<K,C>,A> *p  = l->head; p; p = p->cdr)
+    for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr)
       if (AHashFns::equal(akey, p->car.key))
         return p->car.value;
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A> MapElem<K,C> *
-ChainHashMap<K, AHashFns, C, A>::put_bag(K akey, C avalue) {
+template <class K, class AHashFns, class C, class A>
+MapElem<K, C> *
+ChainHashMap<K, AHashFns, C, A>::put_bag(K akey, C avalue)
+{
   uintptr_t h = AHashFns::hash(akey);
-  List<MapElem<K,C>,A> empty;
-  List<MapElem<K,C>,A> *l;
+  List<MapElem<K, C>, A> empty;
+  List<MapElem<K, C>, A> *l;
   MapElem<K, C> c(akey, avalue);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > e(h, empty);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > *x = this->set_in(e);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > e(h, empty);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > *x = this->set_in(e);
   if (x)
     l = &x->value;
   else {
-    l = &Map<uintptr_t, List<MapElem<K,C>,A>,A>::put(h, c)->value;
+    l = &Map<uintptr_t, List<MapElem<K, C>, A>, A>::put(h, c)->value;
     return &l->head->car;
   }
-  for (ConsCell<MapElem<K,C>,A> *p  = l->head; p; p = p->cdr)
+  for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr)
     if (AHashFns::equal(akey, p->car.key) && AHashFns::equal_value(avalue, p->car.value))
       return &p->car;
   l->push(c);
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A> int
-ChainHashMap<K, AHashFns, C, A>::get_bag(K akey, Vec<C> &v) {
+template <class K, class AHashFns, class C, class A>
+int
+ChainHashMap<K, AHashFns, C, A>::get_bag(K akey, Vec<C> &v)
+{
   uintptr_t h = AHashFns::hash(akey);
-  List<MapElem<K,C>,A> empty;
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > e(h, empty);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > *x = this->set_in(e);
+  List<MapElem<K, C>, A> empty;
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > e(h, empty);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > *x = this->set_in(e);
   if (!x)
     return 0;
-  List<MapElem<K,C>,A> *l = &x->value;
-  for (ConsCell<MapElem<K,C>,A> *p  = l->head; p; p = p->cdr)
+  List<MapElem<K, C>, A> *l = &x->value;
+  for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr)
     if (AHashFns::equal(akey, p->car.key))
       return v.add(x->car);
   return v.n;
 }
 
-template <class K, class AHashFns, class C, class A> int
-ChainHashMap<K, AHashFns, C, A>::del(K akey) {
+template <class K, class AHashFns, class C, class A>
+int
+ChainHashMap<K, AHashFns, C, A>::del(K akey)
+{
   uintptr_t h = AHashFns::hash(akey);
-  List<MapElem<K,C>,A> empty;
-  List<MapElem<K,C>,A> *l;
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > e(h, empty);
-  MapElem<uintptr_t,List<MapElem<K,C>,A> > *x = this->set_in(e);
+  List<MapElem<K, C>, A> empty;
+  List<MapElem<K, C>, A> *l;
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > e(h, empty);
+  MapElem<uintptr_t, List<MapElem<K, C>, A> > *x = this->set_in(e);
   if (x)
     l = &x->value;
   else
     return 0;
-  ConsCell<MapElem<K,C>,A> *last = 0;
-  for (ConsCell<MapElem<K,C>,A> *p = l->head; p; p = p->cdr) {
+  ConsCell<MapElem<K, C>, A> *last = 0;
+  for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr) {
     if (AHashFns::equal(akey, p->car.key)) {
       if (!last)
         l->head = p->cdr;
@@ -662,41 +781,50 @@ ChainHashMap<K, AHashFns, C, A>::del(K akey) {
   return 0;
 }
 
-template <class K, class AHashFns, class C, class A> void
-ChainHashMap<K, AHashFns, C, A>::get_keys(Vec<K> &keys) {
+template <class K, class AHashFns, class C, class A>
+void
+ChainHashMap<K, AHashFns, C, A>::get_keys(Vec<K> &keys)
+{
   for (size_t i = 0; i < n; i++) {
-    List<MapElem<K,C> > *l = &v[i].value;
+    List<MapElem<K, C> > *l = &v[i].value;
     if (l->head)
-      for (ConsCell<MapElem<K,C>,A> *p  = l->head; p; p = p->cdr)
+      for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr)
         keys.add(p->car.key);
   }
 }
 
-template <class K, class AHashFns, class C, class A> void
-ChainHashMap<K, AHashFns, C, A>::get_values(Vec<C> &values) {
+template <class K, class AHashFns, class C, class A>
+void
+ChainHashMap<K, AHashFns, C, A>::get_values(Vec<C> &values)
+{
   for (size_t i = 0; i < n; i++) {
-    List<MapElem<K,C>,A> *l = &v[i].value;
+    List<MapElem<K, C>, A> *l = &v[i].value;
     if (l->head)
-      for (ConsCell<MapElem<K,C>,A> *p  = l->head; p; p = p->cdr)
+      for (ConsCell<MapElem<K, C>, A> *p = l->head; p; p = p->cdr)
         values.add(p->car.value);
   }
 }
 
-template <class F, class A> inline cchar *
-StringChainHash<F,A>::canonicalize(cchar *s, cchar *e) {
+template <class F, class A>
+inline cchar *
+StringChainHash<F, A>::canonicalize(cchar *s, cchar *e)
+{
   uintptr_t h = 0;
   cchar *a = s;
   // 31 changed to 27, to avoid prime2 in vec.cpp
   if (e)
-    while (a != e) h = h * 27 + (unsigned char)*a++;
+    while (a != e)
+      h = h * 27 + (unsigned char)*a++;
   else
-    while (*a) h = h * 27 + (unsigned char)*a++;
-  MapElem<uintptr_t,List<cchar*, A> > me(h, (char*)0);
-  MapElem<uintptr_t,List<cchar*, A> > *x = this->set_in(me);
+    while (*a)
+      h = h * 27 + (unsigned char)*a++;
+  MapElem<uintptr_t, List<cchar *, A> > me(h, (char *)0);
+  MapElem<uintptr_t, List<cchar *, A> > *x = this->set_in(me);
   if (x) {
-    List<cchar*, A> *l = &x->value;
+    List<cchar *, A> *l = &x->value;
     typedef ConsCell<cchar *, A> TT;
-    forc_List(TT, x, *l) {
+    forc_List(TT, x, *l)
+    {
       a = s;
       cchar *b = x->car;
       while (1) {
@@ -707,7 +835,8 @@ StringChainHash<F,A>::canonicalize(cchar *s, cchar *e) {
         }
         if (a >= e || *a != *b)
           break;
-        a++; b++;
+        a++;
+        b++;
       }
     }
   }
@@ -718,17 +847,21 @@ StringChainHash<F,A>::canonicalize(cchar *s, cchar *e) {
   return s;
 }
 
-template <class K, class C, class A> inline C
-Env<K,C,A>::get(K akey) {
-  MapElem<K,List<C, A> *> e(akey, 0);
-  MapElem<K,List<C, A> *> *x = store.set_in(e);
+template <class K, class C, class A>
+inline C
+Env<K, C, A>::get(K akey)
+{
+  MapElem<K, List<C, A> *> e(akey, 0);
+  MapElem<K, List<C, A> *> *x = store.set_in(e);
   if (x)
     return x->value->first();
   return (C)0;
 }
 
-template <class K, class C, class A> inline List<C, A> *
-Env<K,C,A>::get_bucket(K akey) {
+template <class K, class C, class A>
+inline List<C, A> *
+Env<K, C, A>::get_bucket(K akey)
+{
   List<C, A> *bucket = store.get(akey);
   if (bucket)
     return bucket;
@@ -737,41 +870,52 @@ Env<K,C,A>::get_bucket(K akey) {
   return bucket;
 }
 
-template <class K, class C, class A> inline void
-Env<K,C,A>::put(K akey, C avalue) {
+template <class K, class C, class A>
+inline void
+Env<K, C, A>::put(K akey, C avalue)
+{
   scope.head->car.push(akey);
   get_bucket(akey)->push(avalue);
 }
 
-template <class K, class C, class A> inline void
-Env<K,C,A>::push() {
+template <class K, class C, class A>
+inline void
+Env<K, C, A>::push()
+{
   scope.push();
 }
 
-template <class K, class C, class A> inline void
-Env<K,C,A>::pop() {
-  forc_List(EnvCons, e, scope.first())
-    get_bucket(e->car)->pop();
+template <class K, class C, class A>
+inline void
+Env<K, C, A>::pop()
+{
+  forc_List(EnvCons, e, scope.first()) get_bucket(e->car)->pop();
 }
 
-template <class C, class AHashFns, int N, class A> inline
-NBlockHash<C, AHashFns, N, A>::NBlockHash() : n(1), i(0) {
+template <class C, class AHashFns, int N, class A> inline NBlockHash<C, AHashFns, N, A>::NBlockHash() : n(1), i(0)
+{
   memset(&e[0], 0, sizeof(e));
   v = e;
 }
 
-template <class C, class AHashFns, int N, class A> inline C*
-NBlockHash<C, AHashFns, N, A>::first() {
+template <class C, class AHashFns, int N, class A>
+inline C *
+NBlockHash<C, AHashFns, N, A>::first()
+{
   return &v[0];
 }
 
-template <class C, class AHashFns, int N, class A> inline C*
-NBlockHash<C, AHashFns, N, A>::last() {
+template <class C, class AHashFns, int N, class A>
+inline C *
+NBlockHash<C, AHashFns, N, A>::last()
+{
   return &v[n * N];
 }
 
-template <class C, class AHashFns, int N, class A> inline C
-NBlockHash<C, AHashFns, N, A>::put(C c) {
+template <class C, class AHashFns, int N, class A>
+inline C
+NBlockHash<C, AHashFns, N, A>::put(C c)
+{
   int a;
   uintptr_t h = AHashFns::hash(c);
   C *x = &v[(h % n) * N];
@@ -789,7 +933,7 @@ NBlockHash<C, AHashFns, N, A>::put(C c) {
   C *old_v = v;
   i = i + 1;
   size(i);
-  for (;vv < ve; vv++)
+  for (; vv < ve; vv++)
     if (*vv)
       put(*vv);
   if (old_v != &e[0])
@@ -797,15 +941,19 @@ NBlockHash<C, AHashFns, N, A>::put(C c) {
   return put(c);
 }
 
-template <class C, class AHashFns, int N, class A> inline void
-NBlockHash<C, AHashFns, N, A>::size(int p2) {
+template <class C, class AHashFns, int N, class A>
+inline void
+NBlockHash<C, AHashFns, N, A>::size(int p2)
+{
   n = prime2[p2];
-  v = (C*)A::alloc(n * sizeof(C) * N);
+  v = (C *)A::alloc(n * sizeof(C) * N);
   memset(v, 0, n * sizeof(C) * N);
 }
 
-template <class C, class AHashFns, int N, class A> inline C
-NBlockHash<C, AHashFns, N, A>::get(C c) {
+template <class C, class AHashFns, int N, class A>
+inline C
+NBlockHash<C, AHashFns, N, A>::get(C c)
+{
   if (!n)
     return (C)0;
   uintptr_t h = AHashFns::hash(c);
@@ -819,10 +967,12 @@ NBlockHash<C, AHashFns, N, A>::get(C c) {
   return (C)0;
 }
 
-template <class C, class AHashFns, int N, class A> inline C*
-NBlockHash<C, AHashFns, N, A>::assoc_get(C *c) {
+template <class C, class AHashFns, int N, class A>
+inline C *
+NBlockHash<C, AHashFns, N, A>::assoc_get(C *c)
+{
   if (!n)
-    return (C*)0;
+    return (C *)0;
   uintptr_t h = AHashFns::hash(*c);
   C *x = &v[(h % n) * N];
   int a = 0;
@@ -830,15 +980,17 @@ NBlockHash<C, AHashFns, N, A>::assoc_get(C *c) {
     a = c - x + 1;
   for (; a < N; a++) {
     if (!x[a])
-      return (C*)0;
+      return (C *)0;
     if (AHashFns::equal(*c, x[a]))
       return &x[a];
   }
-  return (C*)0;
+  return (C *)0;
 }
 
-template <class C, class AHashFns, int N, class A> inline C*
-NBlockHash<C, AHashFns, N, A>::assoc_put(C *c) {
+template <class C, class AHashFns, int N, class A>
+inline C *
+NBlockHash<C, AHashFns, N, A>::assoc_put(C *c)
+{
   int a;
   uintptr_t h = AHashFns::hash(*c);
   C *x = &v[(h % n) * N];
@@ -848,15 +1000,17 @@ NBlockHash<C, AHashFns, N, A>::assoc_put(C *c) {
   }
   if (a < N) {
     x[a] = *c;
-    return  &x[a];
+    return &x[a];
   }
   x[i % N] = *c;
   i++;
   return &x[i % N];
 }
 
-template <class C, class AHashFns, int N, class A> inline int
-NBlockHash<C, AHashFns, N, A>::del(C c) {
+template <class C, class AHashFns, int N, class A>
+inline int
+NBlockHash<C, AHashFns, N, A>::del(C c)
+{
   int a, b;
   if (!n)
     return 0;
@@ -884,21 +1038,28 @@ NBlockHash<C, AHashFns, N, A>::del(C c) {
   return 0;
 }
 
-template <class C, class AHashFns, int N, class A> inline void
-NBlockHash<C, AHashFns, N, A>::clear() {
-  if (v && v != e) A::free(v);
+template <class C, class AHashFns, int N, class A>
+inline void
+NBlockHash<C, AHashFns, N, A>::clear()
+{
+  if (v && v != e)
+    A::free(v);
   v = e;
   n = 1;
 }
 
-template <class C, class AHashFns, int N, class A> inline void
-NBlockHash<C, AHashFns, N, A>::reset() {
+template <class C, class AHashFns, int N, class A>
+inline void
+NBlockHash<C, AHashFns, N, A>::reset()
+{
   if (v)
     memset(v, 0, n * N * sizeof(C));
 }
 
-template <class C, class AHashFns, int N, class A> inline int
-NBlockHash<C, AHashFns, N, A>::count() {
+template <class C, class AHashFns, int N, class A>
+inline int
+NBlockHash<C, AHashFns, N, A>::count()
+{
   int nelements = 0;
   C *l = last();
   for (C *xx = first(); xx < l; xx++)
@@ -907,8 +1068,10 @@ NBlockHash<C, AHashFns, N, A>::count() {
   return nelements;
 }
 
-template <class C, class AHashFns, int N, class A> inline void
-NBlockHash<C, AHashFns, N, A>::copy(const NBlockHash<C, AHashFns, N, A> &hh) {
+template <class C, class AHashFns, int N, class A>
+inline void
+NBlockHash<C, AHashFns, N, A>::copy(const NBlockHash<C, AHashFns, N, A> &hh)
+{
   clear();
   n = hh.n;
   i = hh.i;
@@ -917,15 +1080,17 @@ NBlockHash<C, AHashFns, N, A>::copy(const NBlockHash<C, AHashFns, N, A> &hh) {
     v = e;
   } else {
     if (hh.v) {
-      v = (C*)A::alloc(n * sizeof(C) * N);
+      v = (C *)A::alloc(n * sizeof(C) * N);
       memcpy(v, hh.v, n * sizeof(C) * N);
     } else
       v = 0;
   }
 }
 
-template <class C, class AHashFns, int N, class A> inline void
-NBlockHash<C, AHashFns, N, A>::move(NBlockHash<C, AHashFns, N, A> &hh) {
+template <class C, class AHashFns, int N, class A>
+inline void
+NBlockHash<C, AHashFns, N, A>::move(NBlockHash<C, AHashFns, N, A> &hh)
+{
   clear();
   n = hh.n;
   i = hh.i;
@@ -1024,25 +1189,25 @@ void test_map();
     which creates the internal links used by @c TSHashTable.
 
  */
-template <
-  typename H ///< Hashing utility class.
->
-class TSHashTable {
+template <typename H ///< Hashing utility class.
+          >
+class TSHashTable
+{
 public:
   typedef TSHashTable self; ///< Self reference type.
 
   // Make embedded types easier to use by importing them to the class namespace.
-  typedef H Hasher; ///< Rename and promote.
-  typedef typename Hasher::ID ID; ///< ID type.
-  typedef typename Hasher::Key Key; ///< Key type.
-  typedef typename Hasher::Value Value; ///< Stored value (element) type.
+  typedef H Hasher;                           ///< Rename and promote.
+  typedef typename Hasher::ID ID;             ///< ID type.
+  typedef typename Hasher::Key Key;           ///< Key type.
+  typedef typename Hasher::Value Value;       ///< Stored value (element) type.
   typedef typename Hasher::ListHead ListHead; ///< Anchor for chain.
 
   /// When the hash table is expanded.
   enum ExpansionPolicy {
-    MANUAL, ///< Client must explicitly expand the table.
+    MANUAL,  ///< Client must explicitly expand the table.
     AVERAGE, ///< Table expands if average chain length exceeds limit. [default]
-    MAXIMUM ///< Table expands if any chain length exceeds limit.
+    MAXIMUM  ///< Table expands if any chain length exceeds limit.
   };
 
   /** Hash bucket.
@@ -1053,7 +1218,7 @@ public:
   */
   struct Bucket {
     ListHead m_chain; ///< Chain of elements.
-    size_t m_count; ///< # of elements in chain.
+    size_t m_count;   ///< # of elements in chain.
 
     /** Internal chain for iteration.
 
@@ -1071,7 +1236,7 @@ public:
         exact.  What we want is to avoid expanding to shorten the chain if it won't help, which it
         won't if all the keys are the same.
 
-	@internal Because we've selected the default to be @c false so we can use @c Vec which zero fills empty elements.
+        @internal Because we've selected the default to be @c false so we can use @c Vec which zero fills empty elements.
     */
     bool m_mixed_p;
 
@@ -1090,33 +1255,44 @@ public:
       @a m_value member.
    */
   struct Location {
-    Value* m_value; ///< The value located.
-    Bucket* m_bucket; ///< Containing bucket of value.
-    ID m_id; ///< ID (hashed key).
+    Value *m_value;    ///< The value located.
+    Bucket *m_bucket;  ///< Containing bucket of value.
+    ID m_id;           ///< ID (hashed key).
     size_t m_distance; ///< How many values in the chain we've gone past to get here.
 
     /// Default constructor - empty location.
     Location() : m_value(NULL), m_bucket(NULL), m_id(0), m_distance(0) {}
 
     /// Check for location being valid (referencing a value).
-    bool isValid() const { return NULL != m_value; }
+    bool
+    isValid() const
+    {
+      return NULL != m_value;
+    }
 
     /// Automatically cast to a @c Value* for convenience.
     /// @note This lets you assign the return of @c find to a @c Value*.
     /// @note This also permits the use of this class directly as a boolean expression.
-    operator Value* () const { return m_value; }
+    operator Value *() const { return m_value; }
 
     /// Dereference.
-    Value& operator * () const { return *m_value; }
+    Value &operator*() const { return *m_value; }
     /// Dereference.
-    Value* operator -> () const { return m_value; }
+    Value *operator->() const { return m_value; }
 
     /// Find next value with matching key (prefix).
-    Location& operator ++ () { if (m_value) this->advance(); return *this; }
+    Location &operator++()
+    {
+      if (m_value)
+        this->advance();
+      return *this;
+    }
     /// Find next value with matching key (postfix).
-    Location& operator ++ (int) {
+    Location &operator++(int)
+    {
       Location zret(*this);
-      if (m_value) this->advance();
+      if (m_value)
+        this->advance();
       return zret;
     }
 
@@ -1132,24 +1308,24 @@ public:
       @internal Iterator is end if m_value is NULL.
    */
   struct iterator {
-    Value* m_value; ///< Current location.
-    Bucket* m_bucket; ///< Current bucket;
+    Value *m_value;   ///< Current location.
+    Bucket *m_bucket; ///< Current bucket;
 
     iterator() : m_value(0), m_bucket(0) {}
-    iterator& operator ++ ();
-    Value& operator * () { return *m_value; }
-    Value* operator -> () { return m_value; }
-    bool operator == (iterator const& that) { return m_bucket == that.m_bucket && m_value == that.m_value; }
-    bool operator != (iterator const& that) { return !(*this == that); }
+    iterator &operator++();
+    Value &operator*() { return *m_value; }
+    Value *operator->() { return m_value; }
+    bool operator==(iterator const &that) { return m_bucket == that.m_bucket && m_value == that.m_value; }
+    bool operator!=(iterator const &that) { return !(*this == that); }
 
   protected:
     /// Internal iterator constructor.
-    iterator(Bucket* b, Value* v) : m_value(v), m_bucket(b) {}
+    iterator(Bucket *b, Value *v) : m_value(v), m_bucket(b) {}
     friend class TSHashTable;
   };
 
   iterator begin(); ///< First element.
-  iterator end(); ///< Past last element.
+  iterator end();   ///< Past last element.
 
   /// The default starting number of buckets.
   static size_t const DEFAULT_BUCKET_COUNT = 7; ///< POOMA.
@@ -1165,7 +1341,7 @@ public:
       The @a value must @b NOT already be in a table of this type.
       @note The value itself is put in the table, @b not a copy.
   */
-  void insert(Value* value);
+  void insert(Value *value);
 
   /** Find a value that matches @a key.
 
@@ -1183,7 +1359,7 @@ public:
       value to construct a @c Location that can be used with other methods. The @a m_distance value
       is not set in this case for performance reasons.
    */
-  Location find(Value* value);
+  Location find(Value *value);
 
   /** Remove the value at @a location from the table.
 
@@ -1191,7 +1367,7 @@ public:
 
       @return @c true if the value was removed, @c false otherwise.
   */
-  bool remove(Location const& location);
+  bool remove(Location const &location);
 
   /** Remove @b all values with @a key.
 
@@ -1209,19 +1385,43 @@ public:
   void clear();
 
   /// Get the number of elements in the table.
-  size_t count() const { return m_count; }
+  size_t
+  count() const
+  {
+    return m_count;
+  }
 
   /// Get the number of buckets in the table.
-  size_t bucketCount() const { return m_array.n; }
+  size_t
+  bucketCount() const
+  {
+    return m_array.n;
+  }
 
   /// Enable or disable expanding the table when chains are long.
-  void setExpansionPolicy(ExpansionPolicy p) { m_expansion_policy = p; }
+  void
+  setExpansionPolicy(ExpansionPolicy p)
+  {
+    m_expansion_policy = p;
+  }
   /// Get the current expansion policy.
-  void expansionPolicy() const { return m_expansion_policy; }
+  void
+  expansionPolicy() const
+  {
+    return m_expansion_policy;
+  }
   /// Set the limit value for the expansion policy.
-  void setExpansionLimit(size_t n) { m_expansion_limit = n; }
+  void
+  setExpansionLimit(size_t n)
+  {
+    m_expansion_limit = n;
+  }
   /// Set the limit value for the expansion policy.
-  size_t expansionLimit() const { return m_expansion_limit; }
+  size_t
+  expansionLimit() const
+  {
+    return m_expansion_limit;
+  }
 
   /** Expand the hash.
 
@@ -1232,10 +1432,10 @@ public:
 protected:
   typedef Vec<Bucket, DefaultAlloc, 0> Array; ///< Bucket array.
 
-  size_t m_count; ///< # of elements stored in the table.
+  size_t m_count;                     ///< # of elements stored in the table.
   ExpansionPolicy m_expansion_policy; ///< When to exand the table.
-  size_t m_expansion_limit; ///< Limit value for expansion.
-  Array m_array; ///< Bucket storage.
+  size_t m_expansion_limit;           ///< Limit value for expansion.
+  Array m_array;                      ///< Bucket storage.
   /// Make available to nested classes statically.
   // We must reach inside the link hackery because we're in a template and
   // must use typename. Older compilers don't handle typename outside of
@@ -1248,28 +1448,29 @@ protected:
   /** Get the ID and bucket for key.
       Fills @a m_id and @a m_bucket in @a location from @a key.
   */
-  void findBucket(Key key, Location& location);
+  void findBucket(Key key, Location &location);
 };
 
-template < typename H > typename TSHashTable<H>::iterator
-TSHashTable<H>::begin() {
+template <typename H>
+typename TSHashTable<H>::iterator
+TSHashTable<H>::begin()
+{
   // Get the first non-empty bucket, if any.
-  Bucket* b = m_bucket_chain.head;
-  return b && b->m_chain.head
-    ? iterator(b, b->m_chain.head)
-    : this->end()
-    ;
+  Bucket *b = m_bucket_chain.head;
+  return b && b->m_chain.head ? iterator(b, b->m_chain.head) : this->end();
 }
 
-template < typename H > typename TSHashTable<H>::iterator
-TSHashTable<H>::end() {
-  return iterator(0,0);
+template <typename H>
+typename TSHashTable<H>::iterator
+TSHashTable<H>::end()
+{
+  return iterator(0, 0);
 }
 
-template < typename H > typename TSHashTable<H>::iterator&
-TSHashTable<H>::iterator::operator ++ () {
+template <typename H> typename TSHashTable<H>::iterator &TSHashTable<H>::iterator::operator++()
+{
   if (m_value) {
-    if (NULL == (m_value = ListHead::next(m_value))) { // end of bucket, next bucket.
+    if (NULL == (m_value = ListHead::next(m_value))) {        // end of bucket, next bucket.
       if (NULL != (m_bucket = BucketChain::next(m_bucket))) { // found non-empty next bucket.
         m_value = m_bucket->m_chain.head;
         ink_assert(m_value); // if bucket is in chain, must be non-empty.
@@ -1279,49 +1480,60 @@ TSHashTable<H>::iterator::operator ++ () {
   return *this;
 }
 
-template < typename H > TSHashTable<H>::TSHashTable(size_t nb)
-  : m_count(0), m_expansion_policy(AVERAGE), m_expansion_limit(DEFAULT_EXPANSION_LIMIT) {
+template <typename H>
+TSHashTable<H>::TSHashTable(size_t nb)
+  : m_count(0), m_expansion_policy(AVERAGE), m_expansion_limit(DEFAULT_EXPANSION_LIMIT)
+{
   if (nb) {
     int idx = 1;
-    while (prime2[idx] < nb) ++idx;
+    while (prime2[idx] < nb)
+      ++idx;
     m_array.n = 1; // anything non-zero.
     m_array.i = idx - 1;
   }
   m_array.set_expand();
 }
 
-template < typename H > void
-TSHashTable<H>::Location::advance() {
+template <typename H>
+void
+TSHashTable<H>::Location::advance()
+{
   Key key = Hasher::key(m_value);
   // assumes valid location with correct key, advance to next matching key or make location invalid.
   do {
     ++m_distance;
     m_value = ListHead::next(m_value);
-  } while (m_value && ! Hasher::equal(key, Hasher::key(m_value)));
+  } while (m_value && !Hasher::equal(key, Hasher::key(m_value)));
 }
 
-template < typename H > void
-TSHashTable<H>::findBucket(Key key, Location& location) {
+template <typename H>
+void
+TSHashTable<H>::findBucket(Key key, Location &location)
+{
   location.m_id = Hasher::hash(key);
   location.m_bucket = &(m_array[location.m_id % m_array.n]);
 }
 
-template < typename H > typename TSHashTable<H>::Location
-TSHashTable<H>::find(Key key) {
+template <typename H>
+typename TSHashTable<H>::Location
+TSHashTable<H>::find(Key key)
+{
   Location zret;
-  Value* v;
+  Value *v;
 
   this->findBucket(key, zret); // zret gets updated to match the bucket.
   v = zret.m_bucket->m_chain.head;
   // Search for first matching key.
-  while (0 != v && ! Hasher::equal(key, Hasher::key(v)))
+  while (0 != v && !Hasher::equal(key, Hasher::key(v)))
     v = ListHead::next(v);
   zret.m_value = v;
   return zret;
 }
 
-template < typename H > typename TSHashTable<H>::Location
-TSHashTable<H>::find(Value* value) {
+template <typename H>
+typename TSHashTable<H>::Location
+TSHashTable<H>::find(Value *value)
+{
   Location zret;
   this->findBucket(Hasher::key(value), zret);
   if (zret.m_bucket->m_chain.in(value)) // just checks value links and chain head.
@@ -1329,16 +1541,18 @@ TSHashTable<H>::find(Value* value) {
   return zret;
 }
 
-template < typename H > void
-TSHashTable<H>::insert(Value* value) {
+template <typename H>
+void
+TSHashTable<H>::insert(Value *value)
+{
   Key key = Hasher::key(value);
-  Bucket* bucket = &(m_array[Hasher::hash(key) % m_array.n]);
+  Bucket *bucket = &(m_array[Hasher::hash(key) % m_array.n]);
 
   // Bad client if already in a list!
-  ink_assert(! bucket->m_chain.in(value));
+  ink_assert(!bucket->m_chain.in(value));
 
   // Mark mixed if not already marked and we're adding a different key.
-  if (!bucket->m_mixed_p && !bucket->m_chain.empty() && ! Hasher::equal(key, Hasher::key(bucket->m_chain.head)))
+  if (!bucket->m_mixed_p && !bucket->m_chain.empty() && !Hasher::equal(key, Hasher::key(bucket->m_chain.head)))
     bucket->m_mixed_p = true;
 
   bucket->m_chain.push(value);
@@ -1346,13 +1560,15 @@ TSHashTable<H>::insert(Value* value) {
   if (1 == ++(bucket->m_count)) // not empty, put it on the non-empty list.
     m_bucket_chain.push(bucket);
   // auto expand if appropriate.
-  if ((AVERAGE == m_expansion_policy && (m_count / m_array.n) > m_expansion_limit)
-      || (MAXIMUM == m_expansion_policy && bucket->m_count > m_expansion_limit && bucket->m_mixed_p))
+  if ((AVERAGE == m_expansion_policy && (m_count / m_array.n) > m_expansion_limit) ||
+      (MAXIMUM == m_expansion_policy && bucket->m_count > m_expansion_limit && bucket->m_mixed_p))
     this->expand();
 }
 
-template < typename H > bool
-TSHashTable<H>::remove(Location const& l) {
+template <typename H>
+bool
+TSHashTable<H>::remove(Location const &l)
+{
   bool zret = false;
   if (l.isValid()) {
     ink_assert(l.m_bucket->m_count);
@@ -1360,7 +1576,7 @@ TSHashTable<H>::remove(Location const& l) {
     l.m_bucket->m_chain.remove(l.m_value);
     --m_count;
     --(l.m_bucket->m_count);
-    if (0 == l.m_bucket->m_count)  // if it's now empty, take it out of the non-empty bucket chain.
+    if (0 == l.m_bucket->m_count) // if it's now empty, take it out of the non-empty bucket chain.
       m_bucket_chain.remove(l.m_bucket);
     else if (1 == l.m_bucket->m_count) // if count drops to 1, then it's not mixed any more.
       l.m_bucket->m_mixed_p = false;
@@ -1369,8 +1585,10 @@ TSHashTable<H>::remove(Location const& l) {
   return zret;
 }
 
-template < typename H > bool
-TSHashTable<H>::remove(Key key) {
+template <typename H>
+bool
+TSHashTable<H>::remove(Key key)
+{
   Location loc = this->find(key);
   bool zret = loc.isValid();
   while (loc.isValid()) {
@@ -1381,11 +1599,13 @@ TSHashTable<H>::remove(Key key) {
   return zret;
 }
 
-template < typename H > void
-TSHashTable<H>::clear() {
+template <typename H>
+void
+TSHashTable<H>::clear()
+{
   Bucket null_bucket;
   // Remove the values but not the actual buckets.
-  for ( size_t i = 0 ; i < m_array.n ; ++i ) {
+  for (size_t i = 0; i < m_array.n; ++i) {
     m_array[i] = null_bucket;
   }
   // Clear container data.
@@ -1393,9 +1613,11 @@ TSHashTable<H>::clear() {
   m_bucket_chain.clear();
 }
 
-template < typename H > void
-TSHashTable<H>::expand() {
-  Bucket* b = m_bucket_chain.head; // stash before reset.
+template <typename H>
+void
+TSHashTable<H>::expand()
+{
+  Bucket *b = m_bucket_chain.head; // stash before reset.
   ExpansionPolicy org_expansion_policy = m_expansion_policy;
   Array tmp;
   tmp.move(m_array); // stash the current array here.
@@ -1406,14 +1628,14 @@ TSHashTable<H>::expand() {
   // Because we moved the array, we have to copy back a couple of things to make
   // the expansion actually expand. How this is supposed to work without leaks or
   // mucking about in the internal is unclear to me.
-  m_array.n = 1; // anything non-zero.
-  m_array.i = tmp.i;  // set the base index.
+  m_array.n = 1;        // anything non-zero.
+  m_array.i = tmp.i;    // set the base index.
   m_array.set_expand(); // bumps array size up to next index value.
 
   m_expansion_policy = MANUAL; // disable any auto expand while we're expanding.
   // Move the values from the stashed array to the expanded hash.
   while (b) {
-    Value* v = b->m_chain.head;
+    Value *v = b->m_chain.head;
     while (v) {
       b->m_chain.remove(v); // clear local pointers to be safe.
       this->insert(v);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/MatcherUtils.cc
----------------------------------------------------------------------
diff --git a/lib/ts/MatcherUtils.cc b/lib/ts/MatcherUtils.cc
index a3ef2af..1449b4f 100644
--- a/lib/ts/MatcherUtils.cc
+++ b/lib/ts/MatcherUtils.cc
@@ -29,9 +29,9 @@
  *
  ****************************************************************************/
 
-#include "libts.h"      /* MAGIC_EDITING_TAG */
+#include "libts.h" /* MAGIC_EDITING_TAG */
 
-config_parse_error::config_parse_error(const char * fmt, ...)
+config_parse_error::config_parse_error(const char *fmt, ...)
 {
   va_list ap;
   int num;
@@ -60,7 +60,6 @@ config_parse_error::config_parse_error(const char * fmt, ...)
 char *
 readIntoBuffer(const char *file_path, const char *module_name, int *read_size_ptr)
 {
-
   int fd;
   struct stat file_info;
   char *file_buf;
@@ -83,7 +82,7 @@ readIntoBuffer(const char *file_path, const char *module_name, int *read_size_pt
   }
 
   if (file_info.st_size < 0) {
-    Error("%s Can not get correct file size for %s file : %" PRId64 "", module_name, file_path, (int64_t) file_info.st_size);
+    Error("%s Can not get correct file size for %s file : %" PRId64 "", module_name, file_path, (int64_t)file_info.st_size);
     close(fd);
     return NULL;
   }
@@ -104,8 +103,7 @@ readIntoBuffer(const char *file_path, const char *module_name, int *read_size_pt
   } else if (read_size < file_info.st_size) {
     // We don't want to signal this error on WIN32 because the sizes
     // won't match if the file contains any CR/LF sequence.
-    Error("%s Only able to read %d bytes out %d for %s file",
-          module_name, read_size, (int) file_info.st_size, file_path);
+    Error("%s Only able to read %d bytes out %d for %s file", module_name, read_size, (int)file_info.st_size, file_path);
     file_buf[read_size] = '\0';
   }
 
@@ -135,7 +133,7 @@ unescapifyStr(char *buffer)
     if (*read == '%' && *(read + 1) != '\0' && *(read + 2) != '\0') {
       subStr[0] = *(++read);
       subStr[1] = *(++read);
-      *write = (char)strtol(subStr, (char **) NULL, 16);
+      *write = (char)strtol(subStr, (char **)NULL, 16);
       read++;
       write++;
     } else if (*read == '+') {
@@ -153,14 +151,17 @@ unescapifyStr(char *buffer)
   return (write - buffer);
 }
 
-char const*
-ExtractIpRange(char* match_str, in_addr_t* min, in_addr_t* max) {
+char const *
+ExtractIpRange(char *match_str, in_addr_t *min, in_addr_t *max)
+{
   IpEndpoint ip_min, ip_max;
-  char const* zret = ExtractIpRange(match_str, &ip_min.sa, &ip_max.sa);
+  char const *zret = ExtractIpRange(match_str, &ip_min.sa, &ip_max.sa);
   if (0 == zret) { // success
     if (ats_is_ip4(&ip_min) && ats_is_ip4(&ip_max)) {
-      if (min) *min = ntohl(ats_ip4_addr_cast(&ip_min));
-      if (max) *max = ntohl(ats_ip4_addr_cast(&ip_max));
+      if (min)
+        *min = ntohl(ats_ip4_addr_cast(&ip_min));
+      if (max)
+        *max = ntohl(ats_ip4_addr_cast(&ip_max));
     } else {
       zret = "The addresses were not IPv4 addresses.";
     }
@@ -183,7 +184,7 @@ ExtractIpRange(char* match_str, in_addr_t* min, in_addr_t* max) {
 //     that describes the reason for the error.
 //
 const char *
-ExtractIpRange(char *match_str, sockaddr* addr1, sockaddr* addr2)
+ExtractIpRange(char *match_str, sockaddr *addr1, sockaddr *addr2)
 {
   Tokenizer rangeTok("-/");
   bool mask = strchr(match_str, '/') != NULL;
@@ -207,7 +208,6 @@ ExtractIpRange(char *match_str, sockaddr* addr1, sockaddr* addr2)
 
   // Handle a IP range
   if (numToks == 2) {
-
     if (mask) {
       if (!ats_is_ip4(&la1)) {
         return "Masks supported only for IPv4";
@@ -273,8 +273,7 @@ tokLine(char *buf, char **last, char cont)
       if (cont != '\0' && prev != NULL && *prev == cont) {
         *prev = ' ';
         *cur = ' ';
-      }
-      else {
+      } else {
         *cur = '\0';
         *last = cur;
         return start;
@@ -293,15 +292,7 @@ tokLine(char *buf, char **last, char cont)
   return NULL;
 }
 
-const char *matcher_type_str[] = {
-  "invalid",
-  "host",
-  "domain",
-  "ip",
-  "url_regex",
-  "url",
-  "host_regex"
-};
+const char *matcher_type_str[] = {"invalid", "host", "domain", "ip", "url_regex", "url", "host_regex"};
 
 // char* processDurationString(char* str, int* seconds)
 //
@@ -337,7 +328,6 @@ processDurationString(char *str, int *seconds)
   len = strlen(str);
   for (int i = 0; i < len; i++) {
     if (!ParseRules::is_digit(*current)) {
-
       // Make sure there is a time to proces
       if (current == s) {
         return "Malformed time";
@@ -379,7 +369,6 @@ processDurationString(char *str, int *seconds)
 
       result += (multiplier * tmp);
       s = current + 1;
-
     }
     current++;
   }
@@ -405,17 +394,11 @@ processDurationString(char *str, int *seconds)
   return NULL;
 }
 
-const matcher_tags http_dest_tags = {
-  "dest_host", "dest_domain", "dest_ip", "url_regex", "url", "host_regex", true
-};
+const matcher_tags http_dest_tags = {"dest_host", "dest_domain", "dest_ip", "url_regex", "url", "host_regex", true};
 
-const matcher_tags ip_allow_tags = {
-  NULL, NULL, "src_ip", NULL, NULL, NULL, false
-};
+const matcher_tags ip_allow_tags = {NULL, NULL, "src_ip", NULL, NULL, NULL, false};
 
-const matcher_tags socks_server_tags = {
-  NULL, NULL, "dest_ip", NULL, NULL, NULL, false
-};
+const matcher_tags socks_server_tags = {NULL, NULL, "dest_ip", NULL, NULL, NULL, false};
 
 // char* parseConfigLine(char* line, matcher_line* p_line,
 //                       const matcher_tags* tags)
@@ -427,12 +410,14 @@ const matcher_tags socks_server_tags = {
 //     a static error string is returned
 //
 const char *
-parseConfigLine(char *line, matcher_line *p_line, const matcher_tags * tags)
+parseConfigLine(char *line, matcher_line *p_line, const matcher_tags *tags)
 {
-  enum pState
-  {
-    FIND_LABEL, PARSE_LABEL,
-    PARSE_VAL, START_PARSE_VAL, CONSUME
+  enum pState {
+    FIND_LABEL,
+    PARSE_LABEL,
+    PARSE_VAL,
+    START_PARSE_VAL,
+    CONSUME,
   };
 
   pState state = FIND_LABEL;
@@ -453,7 +438,6 @@ parseConfigLine(char *line, matcher_line *p_line, const matcher_tags * tags)
   }
 
   do {
-
     switch (state) {
     case FIND_LABEL:
       if (!isspace(*s)) {
@@ -483,7 +467,6 @@ parseConfigLine(char *line, matcher_line *p_line, const matcher_tags * tags)
       } else {
         inQuote = false;
         val = s;
-
       }
 
       if (inQuote == false && (isspace(*s) || *(s + 1) == '\0')) {
@@ -531,8 +514,7 @@ parseConfigLine(char *line, matcher_line *p_line, const matcher_tags * tags)
           state = CONSUME;
           *s = '\0';
         }
-      } else if ((*s == '\\' && ParseRules::is_digit(*(s + 1)))
-                 || !ParseRules::is_char(*s)) {
+      } else if ((*s == '\\' && ParseRules::is_digit(*(s + 1))) || !ParseRules::is_char(*s)) {
         // INKqa10511
         // traffic server need to handle unicode characters
         // right now ignore the entry
@@ -555,7 +537,6 @@ parseConfigLine(char *line, matcher_line *p_line, const matcher_tags * tags)
     }
 
     if (state == CONSUME) {
-
       // See if there are any quote copy overs
       //   we've pushed into the future
       if (copyForward != NULL) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/MatcherUtils.h
----------------------------------------------------------------------
diff --git a/lib/ts/MatcherUtils.h b/lib/ts/MatcherUtils.h
index 7dc5d97..d9ad8d4 100644
--- a/lib/ts/MatcherUtils.h
+++ b/lib/ts/MatcherUtils.h
@@ -42,25 +42,21 @@ int unescapifyStr(char *buffer);
     @a min and @a max should be at least the size of @c sockaddr_in6 to hold
     an IP address.
 */
-char const* ExtractIpRange(
-  char *match_str,
-  sockaddr* min,
-  sockaddr* max
-);
+char const *ExtractIpRange(char *match_str, sockaddr *min, sockaddr *max);
 
 /// Convenience overload for IPv4.
-char const* ExtractIpRange(
-  char *match_str,
-  in_addr_t * addr1, ///< [in,out] Returned address in host order.
-  in_addr_t * addr2 ///< [in,out] Returned address in host order.
-);
+char const *ExtractIpRange(char *match_str,
+                           in_addr_t *addr1, ///< [in,out] Returned address in host order.
+                           in_addr_t *addr2  ///< [in,out] Returned address in host order.
+                           );
 
 /// Convenience overload for IPv6.
-inline char const* ExtractIpRange(
-  char *match_str,
-  sockaddr_in6* addr1, ///< [in,out] Returned address in network order.
-  sockaddr_in6* addr2 ///< [in,out] Returned address in network order.
-) {
+inline char const *
+ExtractIpRange(char *match_str,
+               sockaddr_in6 *addr1, ///< [in,out] Returned address in network order.
+               sockaddr_in6 *addr2  ///< [in,out] Returned address in network order.
+               )
+{
   return ExtractIpRange(match_str, ats_ip_sa_cast(addr1), ats_ip_sa_cast(addr2));
 }
 
@@ -69,68 +65,71 @@ char *tokLine(char *buf, char **last, char cont = '\0');
 const char *processDurationString(char *str, int *seconds);
 
 // The first class types we support matching on
-enum matcher_type
-{ MATCH_NONE, MATCH_HOST, MATCH_DOMAIN,
-  MATCH_IP, MATCH_REGEX, MATCH_URL, MATCH_HOST_REGEX
+enum matcher_type {
+  MATCH_NONE,
+  MATCH_HOST,
+  MATCH_DOMAIN,
+  MATCH_IP,
+  MATCH_REGEX,
+  MATCH_URL,
+  MATCH_HOST_REGEX,
 };
 extern const char *matcher_type_str[];
 
 // A parsed config file line
 const int MATCHER_MAX_TOKENS = 40;
-struct matcher_line
-{
-  matcher_type type;            // dest type
-  int dest_entry;               // entry which specifies the destination
-  int num_el;                   // Number of elements
-  char *line[2][MATCHER_MAX_TOKENS];    // label, value pairs
-  int line_num;                 // config file line number
-  matcher_line *next;           // use for linked list
+struct matcher_line {
+  matcher_type type;                 // dest type
+  int dest_entry;                    // entry which specifies the destination
+  int num_el;                        // Number of elements
+  char *line[2][MATCHER_MAX_TOKENS]; // label, value pairs
+  int line_num;                      // config file line number
+  matcher_line *next;                // use for linked list
 };
 
 // Tag set to use to determining primary selector type
-struct matcher_tags
-{
+struct matcher_tags {
   const char *match_host;
   const char *match_domain;
   const char *match_ip;
   const char *match_regex;
   const char *match_url;
   const char *match_host_regex;
-  bool dest_error_msg;          // whether to use src or destination in any error messages
-
-  bool empty() const {
-    return this->match_host == NULL &&
-      this->match_domain == NULL &&
-      this->match_ip == NULL &&
-      this->match_regex == NULL &&
-      this->match_url == NULL &&
-      this->match_host_regex == NULL;
-  }
+  bool dest_error_msg; // whether to use src or destination in any error messages
 
+  bool
+  empty() const
+  {
+    return this->match_host == NULL && this->match_domain == NULL && this->match_ip == NULL && this->match_regex == NULL &&
+           this->match_url == NULL && this->match_host_regex == NULL;
+  }
 };
 
 extern const matcher_tags http_dest_tags;
 extern const matcher_tags ip_allow_tags;
 extern const matcher_tags socks_server_tags;
 
-const char *parseConfigLine(char *line, matcher_line * p_line, const matcher_tags * tags);
+const char *parseConfigLine(char *line, matcher_line *p_line, const matcher_tags *tags);
 
-struct config_parse_error
-{
+struct config_parse_error {
   // Wrapper to make a syntactically nice success value.
-  static config_parse_error ok() {
+  static config_parse_error
+  ok()
+  {
     return config_parse_error();
   }
 
-  config_parse_error(const config_parse_error& rhs) {
+  config_parse_error(const config_parse_error &rhs)
+  {
     if (rhs.msg.get()) {
       this->msg = ats_strdup(rhs.msg.get());
     }
   }
 
-  explicit config_parse_error(const char * fmt, ...) TS_NONNULL(2) TS_PRINTFLIKE(2, 3);
+  explicit config_parse_error(const char *fmt, ...) TS_NONNULL(2) TS_PRINTFLIKE(2, 3);
 
-  config_parse_error& operator=(const config_parse_error& rhs) {
+  config_parse_error &operator=(const config_parse_error &rhs)
+  {
     if (rhs.msg.get()) {
       this->msg = ats_strdup(rhs.msg.get());
     } else {
@@ -140,18 +139,17 @@ struct config_parse_error
     return *this;
   }
 
-  const char * get() const {
+  const char *
+  get() const
+  {
     return msg.get();
   }
 
   // A config error object evaluates to true if there is an error message.
-  operator bool() const {
-    return msg.get() != NULL;
-  }
+  operator bool() const { return msg.get() != NULL; }
 
 private:
-  config_parse_error() {
-  }
+  config_parse_error() {}
 
   ats_scoped_str msg;
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/MimeTable.cc
----------------------------------------------------------------------
diff --git a/lib/ts/MimeTable.cc b/lib/ts/MimeTable.cc
index 213da4f..83cc337 100644
--- a/lib/ts/MimeTable.cc
+++ b/lib/ts/MimeTable.cc
@@ -21,112 +21,106 @@
   limitations under the License.
  */
 
-#include "libts.h"        /* MAGIC_EDITING_TAG */
-
-MimeTableEntry
-  MimeTable::m_table[] = {
-  {"ai", "application/postscript", "8bit", "text"},
-  {"aif", "audio/x-aiff", "binary", "sound"},
-  {"aifc", "audio/x-aiff", "binary", "sound"},
-  {"aiff", "audio/x-aiff", "binary", "sound"},
-  {"arj", "application/x-arj-compressed", "binary", "binary"},
-  {"au", "audio/basic", "binary", "sound"},
-  {"avi", "video/x-msvideo", "binary", "movie"},
-  {"bcpio", "application/x-bcpio", "binary", "binary"},
-  {"bin", "application/macbinary", "macbinary", "binary"},
-  {"c", "text/plain", "7bit", "text"},
-  {"cc", "text/plain", "7bit", "text"},
-  {"cdf", "application/x-netcdf", "binary", "binary"},
-  {"cpio", "application/x-cpio", "binary", "binary"},
-  {"csh", "application/x-csh", "7bit", "text"},
-  {"doc", "application/msword", "binary", "binary"},
-  {"dvi", "application/x-dvi", "binary", "binary"},
-  {"eps", "application/postscript", "8bit", "text"},
-  {"etx", "text/x-setext", "7bit", "text"},
-  {"exe", "application/octet-stream", "binary", "binary"},
-  {"f90", "text/plain", "7bit", "text"},
-  {"gif", "image/gif", "binary", "image"},
-  {"gtar", "application/x-gtar", "binary", "binary"},
-  {"gz", "application/x-gzip", "x-gzip", "binary"},
-  {"h", "text/plain", "7bit", "text"},
-  {"hdf", "application/x-hdf", "binary", "binary"},
-  {"hh", "text/plain", "7bit", "text"},
-  {"hqx", "application/mac-binhex40", "mac-binhex40", "binary"},
-  {"htm", "text/html", "8bit", "text"},
-  {"html", "text/html", "8bit", "text"},
-  {"ief", "image/ief", "binary", "image"},
-  {"jpe", "image/jpeg", "binary", "image"},
-  {"jpeg", "image/jpeg", "binary", "image"},
-  {"jpg", "image/jpeg", "binary", "image"},
-  {"latex", "application/x-latex", "8bit", "text"},
-  {"lha", "application/x-lha-compressed", "binary", "binary"},
-  {"lsm", "text/plain", "7bit", "text"},
-  {"lzh", "application/x-lha-compressed", "binary", "binary"},
-  {"m", "text/plain", "7bit", "text"},
-  {"man", "application/x-troff-man", "7bit", "text"},
-  {"me", "application/x-troff-me", "7bit", "text"},
-  {"mif", "application/x-mif", "binary", "binary"},
-  {"mime", "www/mime", "8bit", "text"},
-  {"mov", "video/quicktime", "binary", "movie"},
-  {"movie", "video/x-sgi-movie", "binary", "movie"},
-  {"mp2", "audio/mpeg", "binary", "sound"},
-  {"mp3", "audio/mpeg", "binary", "sound"},
-  {"mpe", "video/mpeg", "binary", "movie"},
-  {"mpeg", "video/mpeg", "binary", "movie"},
-  {"mpg", "video/mpeg", "binary", "movie"},
-  {"ms", "application/x-troff-ms", "7bit", "text"},
-  {"msw", "application/msword", "binary", "binary"},
-  {"mwrt", "application/macwriteii", "binary", "binary"},
-  {"nc", "application/x-netcdf", "binary", "binary"},
-  {"oda", "application/oda", "binary", "binary"},
-  {"pbm", "image/x-portable-bitmap", "binary", "image"},
-  {"pdf", "application/pdf", "binary", "binary"},
-  {"pgm", "image/x-portable-graymap", "binary", "image"},
-  {"pic", "application/pict", "binary", "image"},
-  {"pict", "application/pict", "binary", "image"},
-  {"pnm", "image/x-portable-anymap", "binary", "image"},
-  {"ppm", "image/x-portable-pixmap", "binary", "image"},
-  {"ps", "application/postscript", "8bit", "text"},
-  {"qt", "video/quicktime", "binary", "movie"},
-  {"ras", "image/cmu-raster", "binary", "image"},
-  {"rgb", "image/x-rgb", "binary", "image"},
-  {"roff", "application/x-troff", "7bit", "text"},
-  {"rpm", "application/x-rpm", "binary", "binary"},
-  {"rtf", "application/x-rtf", "7bit", "binary"},
-  {"rtx", "text/richtext", "7bit", "text"},
-  {"sh", "application/x-sh", "7bit", "text"},
-  {"shar", "application/x-shar", "8bit", "text"},
-  {"sit", "application/stuffit", "binary", "binary"},
-  {"snd", "audio/basic", "binary", "sound"},
-  {"src", "application/x-wais-source", "7bit", "text"},
-  {"sv4cpio", "application/x-sv4cpio", "binary", "binary"},
-  {"sv4crc", "application/x-sv4crc", "binary", "binary"},
-  {"t", "application/x-troff", "7bit", "text"},
-  {"tar", "application/x-tar", "binary", "binary"},
-  {"tcl", "application/x-tcl", "7bit", "text"},
-  {"tex", "application/x-tex", "8bit", "text"},
-  {"texi", "application/x-texinfo", "7bit", "text"},
-  {"texinfo", "application/x-texinfo", "7bit", "text"},
-  {"tgz", "application/x-tar", "x-gzip", "binary"},
-  {"tif", "image/tiff", "binary", "image"},
-  {"tiff", "image/tiff", "binary", "image"},
-  {"tr", "application/x-troff", "7bit", "text"},
-  {"tsv", "text/tab-separated-values", "7bit", "text"},
-  {"txt", "text/plain", "7bit", "text"},
-  {"ustar", "application/x-ustar", "binary", "binary"},
-  {"wav", "audio/x-wav", "binary", "sound"},
-  {"xbm", "image/x-xbitmap", "binary", "image"},
-  {"xpm", "image/x-xpixmap", "binary", "image"},
-  {"xwd", "image/x-xwindowdump", "binary", "image"},
-  {"Z", "application/x-compressed", "x-compress", "binary"},
-  {"zip", "application/x-zip-compressed", "zip", "binary"}
-};
-int
-  MimeTable::m_table_size = (sizeof(MimeTable::m_table)) / (sizeof(MimeTable::m_table[0]));
-MimeTableEntry
-MimeTable::m_unknown = { "unknown", "application/x-unknown-content-type", "binary", "unknown" };
-MimeTable
-  mimeTable;
+#include "libts.h" /* MAGIC_EDITING_TAG */
+
+MimeTableEntry MimeTable::m_table[] = {{"ai", "application/postscript", "8bit", "text"},
+                                       {"aif", "audio/x-aiff", "binary", "sound"},
+                                       {"aifc", "audio/x-aiff", "binary", "sound"},
+                                       {"aiff", "audio/x-aiff", "binary", "sound"},
+                                       {"arj", "application/x-arj-compressed", "binary", "binary"},
+                                       {"au", "audio/basic", "binary", "sound"},
+                                       {"avi", "video/x-msvideo", "binary", "movie"},
+                                       {"bcpio", "application/x-bcpio", "binary", "binary"},
+                                       {"bin", "application/macbinary", "macbinary", "binary"},
+                                       {"c", "text/plain", "7bit", "text"},
+                                       {"cc", "text/plain", "7bit", "text"},
+                                       {"cdf", "application/x-netcdf", "binary", "binary"},
+                                       {"cpio", "application/x-cpio", "binary", "binary"},
+                                       {"csh", "application/x-csh", "7bit", "text"},
+                                       {"doc", "application/msword", "binary", "binary"},
+                                       {"dvi", "application/x-dvi", "binary", "binary"},
+                                       {"eps", "application/postscript", "8bit", "text"},
+                                       {"etx", "text/x-setext", "7bit", "text"},
+                                       {"exe", "application/octet-stream", "binary", "binary"},
+                                       {"f90", "text/plain", "7bit", "text"},
+                                       {"gif", "image/gif", "binary", "image"},
+                                       {"gtar", "application/x-gtar", "binary", "binary"},
+                                       {"gz", "application/x-gzip", "x-gzip", "binary"},
+                                       {"h", "text/plain", "7bit", "text"},
+                                       {"hdf", "application/x-hdf", "binary", "binary"},
+                                       {"hh", "text/plain", "7bit", "text"},
+                                       {"hqx", "application/mac-binhex40", "mac-binhex40", "binary"},
+                                       {"htm", "text/html", "8bit", "text"},
+                                       {"html", "text/html", "8bit", "text"},
+                                       {"ief", "image/ief", "binary", "image"},
+                                       {"jpe", "image/jpeg", "binary", "image"},
+                                       {"jpeg", "image/jpeg", "binary", "image"},
+                                       {"jpg", "image/jpeg", "binary", "image"},
+                                       {"latex", "application/x-latex", "8bit", "text"},
+                                       {"lha", "application/x-lha-compressed", "binary", "binary"},
+                                       {"lsm", "text/plain", "7bit", "text"},
+                                       {"lzh", "application/x-lha-compressed", "binary", "binary"},
+                                       {"m", "text/plain", "7bit", "text"},
+                                       {"man", "application/x-troff-man", "7bit", "text"},
+                                       {"me", "application/x-troff-me", "7bit", "text"},
+                                       {"mif", "application/x-mif", "binary", "binary"},
+                                       {"mime", "www/mime", "8bit", "text"},
+                                       {"mov", "video/quicktime", "binary", "movie"},
+                                       {"movie", "video/x-sgi-movie", "binary", "movie"},
+                                       {"mp2", "audio/mpeg", "binary", "sound"},
+                                       {"mp3", "audio/mpeg", "binary", "sound"},
+                                       {"mpe", "video/mpeg", "binary", "movie"},
+                                       {"mpeg", "video/mpeg", "binary", "movie"},
+                                       {"mpg", "video/mpeg", "binary", "movie"},
+                                       {"ms", "application/x-troff-ms", "7bit", "text"},
+                                       {"msw", "application/msword", "binary", "binary"},
+                                       {"mwrt", "application/macwriteii", "binary", "binary"},
+                                       {"nc", "application/x-netcdf", "binary", "binary"},
+                                       {"oda", "application/oda", "binary", "binary"},
+                                       {"pbm", "image/x-portable-bitmap", "binary", "image"},
+                                       {"pdf", "application/pdf", "binary", "binary"},
+                                       {"pgm", "image/x-portable-graymap", "binary", "image"},
+                                       {"pic", "application/pict", "binary", "image"},
+                                       {"pict", "application/pict", "binary", "image"},
+                                       {"pnm", "image/x-portable-anymap", "binary", "image"},
+                                       {"ppm", "image/x-portable-pixmap", "binary", "image"},
+                                       {"ps", "application/postscript", "8bit", "text"},
+                                       {"qt", "video/quicktime", "binary", "movie"},
+                                       {"ras", "image/cmu-raster", "binary", "image"},
+                                       {"rgb", "image/x-rgb", "binary", "image"},
+                                       {"roff", "application/x-troff", "7bit", "text"},
+                                       {"rpm", "application/x-rpm", "binary", "binary"},
+                                       {"rtf", "application/x-rtf", "7bit", "binary"},
+                                       {"rtx", "text/richtext", "7bit", "text"},
+                                       {"sh", "application/x-sh", "7bit", "text"},
+                                       {"shar", "application/x-shar", "8bit", "text"},
+                                       {"sit", "application/stuffit", "binary", "binary"},
+                                       {"snd", "audio/basic", "binary", "sound"},
+                                       {"src", "application/x-wais-source", "7bit", "text"},
+                                       {"sv4cpio", "application/x-sv4cpio", "binary", "binary"},
+                                       {"sv4crc", "application/x-sv4crc", "binary", "binary"},
+                                       {"t", "application/x-troff", "7bit", "text"},
+                                       {"tar", "application/x-tar", "binary", "binary"},
+                                       {"tcl", "application/x-tcl", "7bit", "text"},
+                                       {"tex", "application/x-tex", "8bit", "text"},
+                                       {"texi", "application/x-texinfo", "7bit", "text"},
+                                       {"texinfo", "application/x-texinfo", "7bit", "text"},
+                                       {"tgz", "application/x-tar", "x-gzip", "binary"},
+                                       {"tif", "image/tiff", "binary", "image"},
+                                       {"tiff", "image/tiff", "binary", "image"},
+                                       {"tr", "application/x-troff", "7bit", "text"},
+                                       {"tsv", "text/tab-separated-values", "7bit", "text"},
+                                       {"txt", "text/plain", "7bit", "text"},
+                                       {"ustar", "application/x-ustar", "binary", "binary"},
+                                       {"wav", "audio/x-wav", "binary", "sound"},
+                                       {"xbm", "image/x-xbitmap", "binary", "image"},
+                                       {"xpm", "image/x-xpixmap", "binary", "image"},
+                                       {"xwd", "image/x-xwindowdump", "binary", "image"},
+                                       {"Z", "application/x-compressed", "x-compress", "binary"},
+                                       {"zip", "application/x-zip-compressed", "zip", "binary"}};
+int MimeTable::m_table_size = (sizeof(MimeTable::m_table)) / (sizeof(MimeTable::m_table[0]));
+MimeTableEntry MimeTable::m_unknown = {"unknown", "application/x-unknown-content-type", "binary", "unknown"};
+MimeTable mimeTable;
 ////////////////////////////////////////////////////////////////
 //
 //  class MimeTable
@@ -150,9 +144,7 @@ MimeTable::get_entry_path(const char *path)
     // file has no extension. make a best  //
     // guess, or return null for unknown   //
     /////////////////////////////////////////
-    if (ParseRules::strcasestr(path, "index") ||
-        ParseRules::strcasestr(path, "README") ||
-        ParseRules::strcasestr(path, "ls-lR") ||
+    if (ParseRules::strcasestr(path, "index") || ParseRules::strcasestr(path, "README") || ParseRules::strcasestr(path, "ls-lR") ||
         ParseRules::strcasestr(path, "config") || (path[0] == '\0') || (path[strlen(path) - 1] == '/'))
       e = get_entry("txt");
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/MimeTable.h
----------------------------------------------------------------------
diff --git a/lib/ts/MimeTable.h b/lib/ts/MimeTable.h
index 149d519..f0cc6fa 100644
--- a/lib/ts/MimeTable.h
+++ b/lib/ts/MimeTable.h
@@ -21,43 +21,29 @@
   limitations under the License.
  */
 
-#if !defined (_MimeTable_h_)
+#if !defined(_MimeTable_h_)
 #define _MimeTable_h_
 
 #include <string.h>
 #include "ink_defs.h"
 #include "ink_string.h"
 
-struct MimeTableEntry
-{
+struct MimeTableEntry {
   const char *name;
   const char *mime_type;
   const char *mime_encoding;
   const char *icon;
 
-  friend int operator ==(const MimeTableEntry & a, const MimeTableEntry & b)
-  {
-    return (strcasecmp(a.name, b.name) == 0);
-  }
-  friend int operator <(const MimeTableEntry & a, const MimeTableEntry & b)
-  {
-    return (strcasecmp(a.name, b.name) < 0);
-  }
-  friend int operator >(const MimeTableEntry & a, const MimeTableEntry & b)
-  {
-    return (strcasecmp(a.name, b.name) < 0);
-  }
+  friend int operator==(const MimeTableEntry &a, const MimeTableEntry &b) { return (strcasecmp(a.name, b.name) == 0); }
+  friend int operator<(const MimeTableEntry &a, const MimeTableEntry &b) { return (strcasecmp(a.name, b.name) < 0); }
+  friend int operator>(const MimeTableEntry &a, const MimeTableEntry &b) { return (strcasecmp(a.name, b.name) < 0); }
 };
 
 class MimeTable
 {
 public:
-  MimeTable()
-  {
-  }
-   ~MimeTable()
-  {
-  }
+  MimeTable() {}
+  ~MimeTable() {}
 
   MimeTableEntry *get_entry_path(const char *path);
   MimeTableEntry *get_entry(const char *name);
@@ -69,7 +55,7 @@ private:
 
 private:
   MimeTable(const MimeTable &);
-  MimeTable & operator =(const MimeTable &);
+  MimeTable &operator=(const MimeTable &);
 };
 extern MimeTable mimeTable;
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ParseRules.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ParseRules.cc b/lib/ts/ParseRules.cc
index 3a53e98..5864e70 100644
--- a/lib/ts/ParseRules.cc
+++ b/lib/ts/ParseRules.cc
@@ -28,7 +28,7 @@
 
  ****************************************************************************/
 
-#include "libts.h"      /* MAGIC_EDITING_TAG */
+#include "libts.h" /* MAGIC_EDITING_TAG */
 
 const unsigned int parseRulesCType[256] = {
 #include "ParseRulesCType"
@@ -48,8 +48,8 @@ ParseRules::scan_while(unsigned char *ptr, unsigned int n, uint32_t bitmask)
   unsigned char *align_ptr;
   uintptr_t f_bytes, b_bytes, words, align_off;
 
-  align_off = ((uintptr_t) ptr & 3);
-  align_ptr = (unsigned char *) (((uintptr_t) ptr) & ~3);
+  align_off = ((uintptr_t)ptr & 3);
+  align_ptr = (unsigned char *)(((uintptr_t)ptr) & ~3);
 
   f_bytes = (align_off ? 4 - align_off : 0);
 
@@ -60,7 +60,7 @@ ParseRules::scan_while(unsigned char *ptr, unsigned int n, uint32_t bitmask)
       if (!is_type(ptr[i], bitmask))
         return (&ptr[i]);
   } else {
-    wptr = ((uint32_t *) align_ptr) + (align_off ? 1 : 0);
+    wptr = ((uint32_t *)align_ptr) + (align_off ? 1 : 0);
     switch (align_off) {
     case 1:
       if (!is_type(align_ptr[1], bitmask))
@@ -80,11 +80,10 @@ ParseRules::scan_while(unsigned char *ptr, unsigned int n, uint32_t bitmask)
 
     for (i = 0; i < words; i++) {
       uint32_t word = wptr[i];
-      uint32_t result = (is_type(((word >> 0) & 0xFF), bitmask) &
-                       is_type(((word >> 8) & 0xFF), bitmask) &
-                       is_type(((word >> 16) & 0xFF), bitmask) & is_type(((word >> 24) & 0xFF), bitmask));
+      uint32_t result = (is_type(((word >> 0) & 0xFF), bitmask) & is_type(((word >> 8) & 0xFF), bitmask) &
+                         is_type(((word >> 16) & 0xFF), bitmask) & is_type(((word >> 24) & 0xFF), bitmask));
       if (result == 0) {
-        unsigned char *cptr = (unsigned char *) &(wptr[i]);
+        unsigned char *cptr = (unsigned char *)&(wptr[i]);
         if (!is_type(cptr[0], bitmask))
           return (&cptr[0]);
         if (!is_type(cptr[1], bitmask))
@@ -95,7 +94,7 @@ ParseRules::scan_while(unsigned char *ptr, unsigned int n, uint32_t bitmask)
       }
     }
 
-    align_ptr = (unsigned char *) &(wptr[words]);
+    align_ptr = (unsigned char *)&(wptr[words]);
 
     switch (b_bytes) {
     case 1:
@@ -133,7 +132,7 @@ ParseRules::ink_tolower_buffer(char *ptr, unsigned int n)
     for (i = 0; i < n; i++)
       ptr[i] = ParseRules::ink_tolower(ptr[i]);
   } else {
-    uintptr_t fpad = 4 - ((uintptr_t) ptr & 3);
+    uintptr_t fpad = 4 - ((uintptr_t)ptr & 3);
     uintptr_t words = (n - fpad) >> 2;
     uintptr_t bpad = n - fpad - (words << 2);
 
@@ -151,13 +150,13 @@ ParseRules::ink_tolower_buffer(char *ptr, unsigned int n)
       break;
     }
 
-    uint32_t *wptr = (uint32_t *) ptr;
+    uint32_t *wptr = (uint32_t *)ptr;
     for (i = 0; i < words; i++) {
       uint32_t word = *wptr;
-      ((unsigned char *) &word)[0] = ParseRules::ink_tolower(((unsigned char *) &word)[0]);
-      ((unsigned char *) &word)[1] = ParseRules::ink_tolower(((unsigned char *) &word)[1]);
-      ((unsigned char *) &word)[2] = ParseRules::ink_tolower(((unsigned char *) &word)[2]);
-      ((unsigned char *) &word)[3] = ParseRules::ink_tolower(((unsigned char *) &word)[3]);
+      ((unsigned char *)&word)[0] = ParseRules::ink_tolower(((unsigned char *)&word)[0]);
+      ((unsigned char *)&word)[1] = ParseRules::ink_tolower(((unsigned char *)&word)[1]);
+      ((unsigned char *)&word)[2] = ParseRules::ink_tolower(((unsigned char *)&word)[2]);
+      ((unsigned char *)&word)[3] = ParseRules::ink_tolower(((unsigned char *)&word)[3]);
       *wptr++ = word;
     }
 


[06/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_res_mkquery.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_res_mkquery.cc b/lib/ts/ink_res_mkquery.cc
index b992eb5..1101628 100644
--- a/lib/ts/ink_res_mkquery.cc
+++ b/lib/ts/ink_res_mkquery.cc
@@ -65,7 +65,6 @@
  */
 
 
-
 #include "ink_config.h"
 #include "ink_defs.h"
 
@@ -90,95 +89,91 @@
  * Form all types of queries.
  * Returns the size of the result or -1.
  */
-int
-ink_res_mkquery(ink_res_state statp,
-	     int op,			/*!< opcode of query  */
-	     const char *dname,		/*!< domain name  */
-	     int _class, int type,	/*!< _class and type of query  */
-	     const u_char *data,	/*!< resource record data  */
-	     int datalen,		/*!< length of data  */
-             const u_char */* newrr_in  ATS_UNUSED */,	/*!< new rr for modify or append  */
-	     u_char *buf,		/*!< buffer to put query  */
-	     int buflen)		/*!< size of buffer  */
+int ink_res_mkquery(ink_res_state statp, int op,               /*!< opcode of query  */
+                    const char *dname,                         /*!< domain name  */
+                    int _class, int type,                      /*!< _class and type of query  */
+                    const u_char *data,                        /*!< resource record data  */
+                    int datalen,                               /*!< length of data  */
+                    const u_char * /* newrr_in  ATS_UNUSED */, /*!< new rr for modify or append  */
+                    u_char *buf,                               /*!< buffer to put query  */
+                    int buflen)                                /*!< size of buffer  */
 {
-	HEADER *hp;
-	u_char *cp, *ep;
-	int n;
-	u_char *dnptrs[20], **dpp, **lastdnptr;
-
-	/*
-	 * Initialize header fields.
-	 */
-	if ((buf == NULL) || (buflen < HFIXEDSZ))
-		return (-1);
-	memset(buf, 0, HFIXEDSZ);
-	hp = (HEADER *) buf;
-	hp->id = htons(++statp->id);
-	hp->opcode = op;
-	hp->rd = (statp->options & INK_RES_RECURSE) != 0U;
-	hp->rcode = NOERROR;
-	cp = buf + HFIXEDSZ;
-	ep = buf + buflen;
-	dpp = dnptrs;
-	*dpp++ = buf;
-	*dpp++ = NULL;
-	lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
-	/*
-	 * perform opcode specific processing
-	 */
-	switch (op) {
-	case QUERY:	/*FALLTHROUGH*/
-	case NS_NOTIFY_OP:
-		if (ep - cp < QFIXEDSZ)
-			return (-1);
-		if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs,
-		    lastdnptr)) < 0)
-			return (-1);
-		cp += n;
-		NS_PUT16(type, cp);
-		NS_PUT16(_class, cp);
-		hp->qdcount = htons(1);
-		if (op == QUERY || data == NULL)
-			break;
-		/*
-		 * Make an additional record for completion domain.
-		 */
-		if ((ep - cp) < RRFIXEDSZ)
-			return (-1);
-		n = dn_comp((const char *)data, cp, ep - cp - RRFIXEDSZ,
-			    dnptrs, lastdnptr);
-		if (n < 0)
-			return (-1);
-		cp += n;
-		NS_PUT16(T_NULL, cp);
-		NS_PUT16(_class, cp);
-		NS_PUT32(0, cp);
-		NS_PUT16(0, cp);
-		hp->arcount = htons(1);
-		break;
-
-	case IQUERY:
-		/*
-		 * Initialize answer section
-		 */
-		if (ep - cp < 1 + RRFIXEDSZ + datalen)
-			return (-1);
-		*cp++ = '\0';	/*%< no domain name */
-		NS_PUT16(type, cp);
-		NS_PUT16(_class, cp);
-		NS_PUT32(0, cp);
-		NS_PUT16(datalen, cp);
-		if (datalen) {
-			memcpy(cp, data, datalen);
-			cp += datalen;
-		}
-		hp->ancount = htons(1);
-		break;
-
-	default:
-		return (-1);
-	}
-	return (cp - buf);
+  HEADER *hp;
+  u_char *cp, *ep;
+  int n;
+  u_char *dnptrs[20], **dpp, **lastdnptr;
+
+  /*
+   * Initialize header fields.
+   */
+  if ((buf == NULL) || (buflen < HFIXEDSZ))
+    return (-1);
+  memset(buf, 0, HFIXEDSZ);
+  hp = (HEADER *)buf;
+  hp->id = htons(++statp->id);
+  hp->opcode = op;
+  hp->rd = (statp->options & INK_RES_RECURSE) != 0U;
+  hp->rcode = NOERROR;
+  cp = buf + HFIXEDSZ;
+  ep = buf + buflen;
+  dpp = dnptrs;
+  *dpp++ = buf;
+  *dpp++ = NULL;
+  lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
+  /*
+   * perform opcode specific processing
+   */
+  switch (op) {
+  case QUERY: /*FALLTHROUGH*/
+  case NS_NOTIFY_OP:
+    if (ep - cp < QFIXEDSZ)
+      return (-1);
+    if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs, lastdnptr)) < 0)
+      return (-1);
+    cp += n;
+    NS_PUT16(type, cp);
+    NS_PUT16(_class, cp);
+    hp->qdcount = htons(1);
+    if (op == QUERY || data == NULL)
+      break;
+    /*
+     * Make an additional record for completion domain.
+     */
+    if ((ep - cp) < RRFIXEDSZ)
+      return (-1);
+    n = dn_comp((const char *)data, cp, ep - cp - RRFIXEDSZ, dnptrs, lastdnptr);
+    if (n < 0)
+      return (-1);
+    cp += n;
+    NS_PUT16(T_NULL, cp);
+    NS_PUT16(_class, cp);
+    NS_PUT32(0, cp);
+    NS_PUT16(0, cp);
+    hp->arcount = htons(1);
+    break;
+
+  case IQUERY:
+    /*
+     * Initialize answer section
+     */
+    if (ep - cp < 1 + RRFIXEDSZ + datalen)
+      return (-1);
+    *cp++ = '\0'; /*%< no domain name */
+    NS_PUT16(type, cp);
+    NS_PUT16(_class, cp);
+    NS_PUT32(0, cp);
+    NS_PUT16(datalen, cp);
+    if (datalen) {
+      memcpy(cp, data, datalen);
+      cp += datalen;
+    }
+    hp->ancount = htons(1);
+    break;
+
+  default:
+    return (-1);
+  }
+  return (cp - buf);
 }
 
 /* Public. */
@@ -191,80 +186,80 @@ ink_res_mkquery(ink_res_state statp,
  *\li	boolean.
  */
 static int
-printable(int ch) {
-	return (ch > 0x20 && ch < 0x7f);
+printable(int ch)
+{
+  return (ch > 0x20 && ch < 0x7f);
 }
 
-static const char	digits[] = "0123456789";
+static const char digits[] = "0123456789";
 
 static int
 labellen(const u_char *lp)
 {
-	int bitlen;
-	u_char l = *lp;
-
-	if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
-		/* should be avoided by the caller */
-		return(-1);
-	}
-
-	if ((l & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
-		if (l == INK_DNS_LABELTYPE_BITSTRING) {
-			if ((bitlen = *(lp + 1)) == 0)
-				bitlen = 256;
-			return((bitlen + 7 ) / 8 + 1);
-		}
-		return(-1);	/*%< unknwon ELT */
-	}
-	return(l);
+  int bitlen;
+  u_char l = *lp;
+
+  if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+    /* should be avoided by the caller */
+    return (-1);
+  }
+
+  if ((l & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
+    if (l == INK_DNS_LABELTYPE_BITSTRING) {
+      if ((bitlen = *(lp + 1)) == 0)
+        bitlen = 256;
+      return ((bitlen + 7) / 8 + 1);
+    }
+    return (-1); /*%< unknwon ELT */
+  }
+  return (l);
 }
 
 static int
 decode_bitstring(const unsigned char **cpp, char *dn, const char *eom)
 {
-	const unsigned char *cp = *cpp;
-	char *beg = dn, tc;
-	int b, blen, plen, i;
-
-	if ((blen = (*cp & 0xff)) == 0)
-		blen = 256;
-	plen = (blen + 3) / 4;
-	plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
-	if (dn + plen >= eom)
-		return(-1);
-
-	cp++;
-	i = SPRINTF((dn, "\\[x"));
-	if (i < 0)
-		return (-1);
-	dn += i;
-	for (b = blen; b > 7; b -= 8, cp++) {
-		i = SPRINTF((dn, "%02x", *cp & 0xff));
-		if (i < 0)
-			return (-1);
-		dn += i;
-	}
-	if (b > 4) {
-		tc = *cp++;
-		i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
-		if (i < 0)
-			return (-1);
-		dn += i;
-	} else if (b > 0) {
-		tc = *cp++;
-		i = SPRINTF((dn, "%1x",
-			       ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
-		if (i < 0)
-			return (-1);
-		dn += i;
-	}
-	i = SPRINTF((dn, "/%d]", blen));
-	if (i < 0)
-		return (-1);
-	dn += i;
-
-	*cpp = cp;
-	return(dn - beg);
+  const unsigned char *cp = *cpp;
+  char *beg = dn, tc;
+  int b, blen, plen, i;
+
+  if ((blen = (*cp & 0xff)) == 0)
+    blen = 256;
+  plen = (blen + 3) / 4;
+  plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
+  if (dn + plen >= eom)
+    return (-1);
+
+  cp++;
+  i = SPRINTF((dn, "\\[x"));
+  if (i < 0)
+    return (-1);
+  dn += i;
+  for (b = blen; b > 7; b -= 8, cp++) {
+    i = SPRINTF((dn, "%02x", *cp & 0xff));
+    if (i < 0)
+      return (-1);
+    dn += i;
+  }
+  if (b > 4) {
+    tc = *cp++;
+    i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
+    if (i < 0)
+      return (-1);
+    dn += i;
+  } else if (b > 0) {
+    tc = *cp++;
+    i = SPRINTF((dn, "%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
+    if (i < 0)
+      return (-1);
+    dn += i;
+  }
+  i = SPRINTF((dn, "/%d]", blen));
+  if (i < 0)
+    return (-1);
+  dn += i;
+
+  *cpp = cp;
+  return (dn - beg);
 }
 
 /*%
@@ -275,21 +270,22 @@ decode_bitstring(const unsigned char **cpp, char *dn, const char *eom)
  *\li	boolean.
  */
 static int
-special(int ch) {
-	switch (ch) {
-	case 0x22: /*%< '"' */
-	case 0x2E: /*%< '.' */
-	case 0x3B: /*%< ';' */
-	case 0x5C: /*%< '\\' */
-	case 0x28: /*%< '(' */
-	case 0x29: /*%< ')' */
-	/* Special modifiers in zone files. */
-	case 0x40: /*%< '@' */
-	case 0x24: /*%< '$' */
-		return (1);
-	default:
-		return (0);
-	}
+special(int ch)
+{
+  switch (ch) {
+  case 0x22: /*%< '"' */
+  case 0x2E: /*%< '.' */
+  case 0x3B: /*%< ';' */
+  case 0x5C: /*%< '\\' */
+  case 0x28: /*%< '(' */
+  case 0x29: /*%< ')' */
+  /* Special modifiers in zone files. */
+  case 0x40: /*%< '@' */
+  case 0x24: /*%< '$' */
+    return (1);
+  default:
+    return (0);
+  }
 }
 
 /*%
@@ -305,93 +301,92 @@ special(int ch) {
 int
 ink_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
 {
-	const u_char *cp;
-	char *dn, *eom;
-	u_char c;
-	unsigned n;
-	int l;
-
-	cp = src;
-	dn = dst;
-	eom = dst + dstsiz;
-
-	while ((n = *cp++) != 0) {
-		if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
-			/* Some kind of compression pointer. */
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if (dn != dst) {
-			if (dn >= eom) {
-				errno = EMSGSIZE;
-				return (-1);
-			}
-			*dn++ = '.';
-		}
-		if ((l = labellen(cp - 1)) < 0) {
-			errno = EMSGSIZE; /*%< XXX */
-			return(-1);
-		}
-		if (dn + l >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
-			int m;
-
-			if (n != INK_DNS_LABELTYPE_BITSTRING) {
-				/* XXX: labellen should reject this case */
-				errno = EINVAL;
-				return(-1);
-			}
-			if ((m = decode_bitstring(&cp, dn, eom)) < 0)
-			{
-				errno = EMSGSIZE;
-				return(-1);
-			}
-			dn += m;
-			continue;
-		}
-		for ((void)NULL; l > 0; l--) {
-			c = *cp++;
-			if (special(c)) {
-				if (dn + 1 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = (char)c;
-			} else if (!printable(c)) {
-				if (dn + 3 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = digits[c / 100];
-				*dn++ = digits[(c % 100) / 10];
-				*dn++ = digits[c % 10];
-			} else {
-				if (dn >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = (char)c;
-			}
-		}
-	}
-	if (dn == dst) {
-		if (dn >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		*dn++ = '.';
-	}
-	if (dn >= eom) {
-		errno = EMSGSIZE;
-		return (-1);
-	}
-	*dn++ = '\0';
-	return (dn - dst);
+  const u_char *cp;
+  char *dn, *eom;
+  u_char c;
+  unsigned n;
+  int l;
+
+  cp = src;
+  dn = dst;
+  eom = dst + dstsiz;
+
+  while ((n = *cp++) != 0) {
+    if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+      /* Some kind of compression pointer. */
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if (dn != dst) {
+      if (dn >= eom) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      *dn++ = '.';
+    }
+    if ((l = labellen(cp - 1)) < 0) {
+      errno = EMSGSIZE; /*%< XXX */
+      return (-1);
+    }
+    if (dn + l >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
+      int m;
+
+      if (n != INK_DNS_LABELTYPE_BITSTRING) {
+        /* XXX: labellen should reject this case */
+        errno = EINVAL;
+        return (-1);
+      }
+      if ((m = decode_bitstring(&cp, dn, eom)) < 0) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      dn += m;
+      continue;
+    }
+    for ((void)NULL; l > 0; l--) {
+      c = *cp++;
+      if (special(c)) {
+        if (dn + 1 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = (char)c;
+      } else if (!printable(c)) {
+        if (dn + 3 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = digits[c / 100];
+        *dn++ = digits[(c % 100) / 10];
+        *dn++ = digits[c % 10];
+      } else {
+        if (dn >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = (char)c;
+      }
+    }
+  }
+  if (dn == dst) {
+    if (dn >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    *dn++ = '.';
+  }
+  if (dn >= eom) {
+    errno = EMSGSIZE;
+    return (-1);
+  }
+  *dn++ = '\0';
+  return (dn - dst);
 }
 
 /*%
@@ -412,93 +407,92 @@ int
 ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
 #endif
 {
-	const u_char *cp;
-	char *dn, *eom;
-	u_char c;
-	unsigned n;
-	int l;
-
-	cp = src;
-	dn = dst;
-	eom = dst + dstsiz;
-
-	while ((n = *cp++) != 0) {
-		if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
-			/* Some kind of compression pointer. */
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if (dn != dst) {
-			if (dn >= eom) {
-				errno = EMSGSIZE;
-				return (-1);
-			}
-			*dn++ = '.';
-		}
-		if ((l = labellen(cp - 1)) < 0) {
-			errno = EMSGSIZE; /*%< XXX */
-			return(-1);
-		}
-		if (dn + l >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
-			int m;
-
-			if (n != INK_DNS_LABELTYPE_BITSTRING) {
-				/* XXX: labellen should reject this case */
-				errno = EINVAL;
-				return(-1);
-			}
-			if ((m = decode_bitstring(&cp, dn, eom)) < 0)
-			{
-				errno = EMSGSIZE;
-				return(-1);
-			}
-			dn += m;
-			continue;
-		}
-		for ((void)NULL; l > 0; l--) {
-			c = *cp++;
-			if (special(c)) {
-				if (dn + 1 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = (char)c;
-			} else if (!printable(c)) {
-				if (dn + 3 >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = '\\';
-				*dn++ = digits[c / 100];
-				*dn++ = digits[(c % 100) / 10];
-				*dn++ = digits[c % 10];
-			} else {
-				if (dn >= eom) {
-					errno = EMSGSIZE;
-					return (-1);
-				}
-				*dn++ = (char)c;
-			}
-		}
-	}
-	if (dn == dst) {
-		if (dn >= eom) {
-			errno = EMSGSIZE;
-			return (-1);
-		}
-		*dn++ = '.';
-	}
-	if (dn >= eom) {
-		errno = EMSGSIZE;
-		return (-1);
-	}
-	*dn++ = '\0';
-	return (dn - dst);
+  const u_char *cp;
+  char *dn, *eom;
+  u_char c;
+  unsigned n;
+  int l;
+
+  cp = src;
+  dn = dst;
+  eom = dst + dstsiz;
+
+  while ((n = *cp++) != 0) {
+    if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+      /* Some kind of compression pointer. */
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if (dn != dst) {
+      if (dn >= eom) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      *dn++ = '.';
+    }
+    if ((l = labellen(cp - 1)) < 0) {
+      errno = EMSGSIZE; /*%< XXX */
+      return (-1);
+    }
+    if (dn + l >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    if ((n & NS_CMPRSFLGS) == INK_NS_TYPE_ELT) {
+      int m;
+
+      if (n != INK_DNS_LABELTYPE_BITSTRING) {
+        /* XXX: labellen should reject this case */
+        errno = EINVAL;
+        return (-1);
+      }
+      if ((m = decode_bitstring(&cp, dn, eom)) < 0) {
+        errno = EMSGSIZE;
+        return (-1);
+      }
+      dn += m;
+      continue;
+    }
+    for ((void)NULL; l > 0; l--) {
+      c = *cp++;
+      if (special(c)) {
+        if (dn + 1 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = (char)c;
+      } else if (!printable(c)) {
+        if (dn + 3 >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = '\\';
+        *dn++ = digits[c / 100];
+        *dn++ = digits[(c % 100) / 10];
+        *dn++ = digits[c % 10];
+      } else {
+        if (dn >= eom) {
+          errno = EMSGSIZE;
+          return (-1);
+        }
+        *dn++ = (char)c;
+      }
+    }
+  }
+  if (dn == dst) {
+    if (dn >= eom) {
+      errno = EMSGSIZE;
+      return (-1);
+    }
+    *dn++ = '.';
+  }
+  if (dn >= eom) {
+    errno = EMSGSIZE;
+    return (-1);
+  }
+  *dn++ = '\0';
+  return (dn - dst);
 }
 
 HostResStyle
@@ -507,26 +501,33 @@ ats_host_res_from(int family, HostResPreferenceOrder order)
   bool v4 = false, v6 = false;
   HostResPreference client = AF_INET6 == family ? HOST_RES_PREFER_IPV6 : HOST_RES_PREFER_IPV4;
 
-  for ( int i = 0 ; i < N_HOST_RES_PREFERENCE_ORDER ; ++i ) {
+  for (int i = 0; i < N_HOST_RES_PREFERENCE_ORDER; ++i) {
     HostResPreference p = order[i];
-    if (HOST_RES_PREFER_CLIENT == p) p = client; // CLIENT -> actual value
+    if (HOST_RES_PREFER_CLIENT == p)
+      p = client; // CLIENT -> actual value
     if (HOST_RES_PREFER_IPV4 == p) {
-      if (v6) return HOST_RES_IPV6;
-      else v4 = true;
+      if (v6)
+        return HOST_RES_IPV6;
+      else
+        v4 = true;
     } else if (HOST_RES_PREFER_IPV6 == p) {
-      if (v4) return HOST_RES_IPV4;
-      else v6 = true;
+      if (v4)
+        return HOST_RES_IPV4;
+      else
+        v6 = true;
     } else {
       break;
     }
   }
-  if (v4) return HOST_RES_IPV4_ONLY;
-  else if (v6) return HOST_RES_IPV6_ONLY;
+  if (v4)
+    return HOST_RES_IPV4_ONLY;
+  else if (v6)
+    return HOST_RES_IPV6_ONLY;
   return HOST_RES_NONE;
 }
 
 HostResStyle
-ats_host_res_match(sockaddr const* addr)
+ats_host_res_match(sockaddr const *addr)
 {
   HostResStyle zret = HOST_RES_NONE;
   if (ats_is_ip6(addr))

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_resolver.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resolver.h b/lib/ts/ink_resolver.h
index a561797..00bf5b2 100644
--- a/lib/ts/ink_resolver.h
+++ b/lib/ts/ink_resolver.h
@@ -67,7 +67,7 @@
 */
 
 #ifndef _ink_resolver_h_
-#define	_ink_resolver_h_
+#define _ink_resolver_h_
 
 #include "ink_platform.h"
 #include <ts/ink_inet.h>
@@ -75,86 +75,85 @@
 #include <arpa/nameser.h>
 
 #if defined(openbsd)
-#define NS_INT16SZ          INT16SZ
-#define NS_INT32SZ          INT32SZ
-#define NS_CMPRSFLGS        INDIR_MASK
-#define NS_GET16            GETSHORT
-#define NS_GET32            GETLONG
-#define NS_PUT16            PUTSHORT
-#define NS_PUT32            PUTLONG
+#define NS_INT16SZ INT16SZ
+#define NS_INT32SZ INT32SZ
+#define NS_CMPRSFLGS INDIR_MASK
+#define NS_GET16 GETSHORT
+#define NS_GET32 GETLONG
+#define NS_PUT16 PUTSHORT
+#define NS_PUT32 PUTLONG
 #endif
 
-#define INK_RES_F_VC        0x00000001      /*%< socket is TCP */
-#define INK_RES_F_CONN      0x00000002      /*%< socket is connected */
-#define INK_RES_F_EDNS0ERR  0x00000004      /*%< EDNS0 caused errors */
-#define INK_RES_F__UNUSED   0x00000008      /*%< (unused) */
-#define INK_RES_F_LASTMASK  0x000000F0      /*%< ordinal server of last res_nsend */
-#define INK_RES_F_LASTSHIFT 4               /*%< bit position of LASTMASK "flag" */
+#define INK_RES_F_VC 0x00000001       /*%< socket is TCP */
+#define INK_RES_F_CONN 0x00000002     /*%< socket is connected */
+#define INK_RES_F_EDNS0ERR 0x00000004 /*%< EDNS0 caused errors */
+#define INK_RES_F__UNUSED 0x00000008  /*%< (unused) */
+#define INK_RES_F_LASTMASK 0x000000F0 /*%< ordinal server of last res_nsend */
+#define INK_RES_F_LASTSHIFT 4         /*%< bit position of LASTMASK "flag" */
 #define INK_RES_GETLAST(res) (((res)._flags & INK_RES_F_LASTMASK) >> INK_RES_F_LASTSHIFT)
 
 /* res_findzonecut2() options */
-#define INK_RES_EXHAUSTIVE  0x00000001      /*%< always do all queries */
-#define INK_RES_IPV4ONLY    0x00000002      /*%< IPv4 only */
-#define INK_RES_IPV6ONLY    0x00000004      /*%< IPv6 only */
+#define INK_RES_EXHAUSTIVE 0x00000001 /*%< always do all queries */
+#define INK_RES_IPV4ONLY 0x00000002   /*%< IPv4 only */
+#define INK_RES_IPV6ONLY 0x00000004   /*%< IPv6 only */
 
 /*%
  *  * Resolver options (keep these in synch with res_debug.c, please)
  [amc] Most of these are never used. AFAICT it's RECURSE and DEBUG only.
  *   */
-#define INK_RES_INIT        0x00000001      /*%< address initialized */
-#define INK_RES_DEBUG       0x00000002      /*%< print debug messages */
-#define INK_RES_AAONLY      0x00000004      /*%< authoritative answers only (!IMPL)*/
-#define INK_RES_USEVC       0x00000008      /*%< use virtual circuit */
-#define INK_RES_PRIMARY     0x00000010      /*%< query primary server only (!IMPL) */
-#define INK_RES_IGNTC       0x00000020      /*%< ignore trucation errors */
-#define INK_RES_RECURSE     0x00000040      /*%< recursion desired */
-#define INK_RES_DEFNAMES    0x00000080      /*%< use default domain name */
-#define INK_RES_STAYOPEN    0x00000100      /*%< Keep TCP socket open */
-#define INK_RES_DNSRCH      0x00000200      /*%< search up local domain tree */
-#define INK_RES_INSECURE1   0x00000400      /*%< type 1 security disabled */
-#define INK_RES_INSECURE2   0x00000800      /*%< type 2 security disabled */
-#define INK_RES_NOALIASES   0x00001000      /*%< shuts off HOSTALIASES feature */
-#define INK_RES_USE_INET6   0x00002000      /*%< use/map IPv6 in gethostbyname() */
-#define INK_RES_ROTATE      0x00004000      /*%< rotate ns list after each query */
-#define INK_RES_NOCHECKNAME 0x00008000      /*%< do not check names for sanity. */
-#define INK_RES_KEEPTSIG    0x00010000      /*%< do not strip TSIG records */
-#define INK_RES_BLAST       0x00020000      /*%< blast all recursive servers */
-#define INK_RES_NSID        0x00040000      /*%< request name server ID */
-#define INK_RES_NOTLDQUERY  0x00100000      /*%< don't unqualified name as a tld */
-#define INK_RES_USE_DNSSEC  0x00200000      /*%< use DNSSEC using OK bit in OPT */
-/* #define INK_RES_DEBUG2   0x00400000 */   /* nslookup internal */
+#define INK_RES_INIT 0x00000001           /*%< address initialized */
+#define INK_RES_DEBUG 0x00000002          /*%< print debug messages */
+#define INK_RES_AAONLY 0x00000004         /*%< authoritative answers only (!IMPL)*/
+#define INK_RES_USEVC 0x00000008          /*%< use virtual circuit */
+#define INK_RES_PRIMARY 0x00000010        /*%< query primary server only (!IMPL) */
+#define INK_RES_IGNTC 0x00000020          /*%< ignore trucation errors */
+#define INK_RES_RECURSE 0x00000040        /*%< recursion desired */
+#define INK_RES_DEFNAMES 0x00000080       /*%< use default domain name */
+#define INK_RES_STAYOPEN 0x00000100       /*%< Keep TCP socket open */
+#define INK_RES_DNSRCH 0x00000200         /*%< search up local domain tree */
+#define INK_RES_INSECURE1 0x00000400      /*%< type 1 security disabled */
+#define INK_RES_INSECURE2 0x00000800      /*%< type 2 security disabled */
+#define INK_RES_NOALIASES 0x00001000      /*%< shuts off HOSTALIASES feature */
+#define INK_RES_USE_INET6 0x00002000      /*%< use/map IPv6 in gethostbyname() */
+#define INK_RES_ROTATE 0x00004000         /*%< rotate ns list after each query */
+#define INK_RES_NOCHECKNAME 0x00008000    /*%< do not check names for sanity. */
+#define INK_RES_KEEPTSIG 0x00010000       /*%< do not strip TSIG records */
+#define INK_RES_BLAST 0x00020000          /*%< blast all recursive servers */
+#define INK_RES_NSID 0x00040000           /*%< request name server ID */
+#define INK_RES_NOTLDQUERY 0x00100000     /*%< don't unqualified name as a tld */
+#define INK_RES_USE_DNSSEC 0x00200000     /*%< use DNSSEC using OK bit in OPT */
+/* #define INK_RES_DEBUG2   0x00400000 */ /* nslookup internal */
 /* KAME extensions: use higher bit to avoid conflict with ISC use */
-#define INK_RES_USE_DNAME   0x10000000      /*%< use DNAME */
-#define INK_RES_USE_EDNS0   0x40000000      /*%< use EDNS0 if configured */
-
-#define INK_RES_DEFAULT     (INK_RES_RECURSE | INK_RES_DEFNAMES | \
-                         INK_RES_DNSRCH)
-
-#define INK_MAXNS                   32      /*%< max # name servers we'll track */
-#define INK_MAXDFLSRCH              3       /*%< # default domain levels to try */
-#define INK_MAXDNSRCH               6       /*%< max # domains in search path */
-#define INK_LOCALDOMAINPARTS        2       /*%< min levels in name that is "local" */
-#define INK_RES_TIMEOUT             5       /*%< min. seconds between retries */
-#define INK_RES_TIMEOUT             5       /*%< min. seconds between retries */
-#define INK_RES_MAXNDOTS            15      /*%< should reflect bit field size */
-#define INK_RES_MAXRETRANS          30      /*%< only for resolv.conf/RES_OPTIONS */
-#define INK_RES_MAXRETRY            5       /*%< only for resolv.conf/RES_OPTIONS */
-#define INK_RES_DFLRETRY            2       /*%< Default #/tries. */
-#define INK_RES_MAXTIME             65535   /*%< Infinity, in milliseconds. */
-
-#define INK_NS_TYPE_ELT  0x40 /*%< EDNS0 extended label type */
+#define INK_RES_USE_DNAME 0x10000000 /*%< use DNAME */
+#define INK_RES_USE_EDNS0 0x40000000 /*%< use EDNS0 if configured */
+
+#define INK_RES_DEFAULT (INK_RES_RECURSE | INK_RES_DEFNAMES | INK_RES_DNSRCH)
+
+#define INK_MAXNS 32           /*%< max # name servers we'll track */
+#define INK_MAXDFLSRCH 3       /*%< # default domain levels to try */
+#define INK_MAXDNSRCH 6        /*%< max # domains in search path */
+#define INK_LOCALDOMAINPARTS 2 /*%< min levels in name that is "local" */
+#define INK_RES_TIMEOUT 5      /*%< min. seconds between retries */
+#define INK_RES_TIMEOUT 5      /*%< min. seconds between retries */
+#define INK_RES_MAXNDOTS 15    /*%< should reflect bit field size */
+#define INK_RES_MAXRETRANS 30  /*%< only for resolv.conf/RES_OPTIONS */
+#define INK_RES_MAXRETRY 5     /*%< only for resolv.conf/RES_OPTIONS */
+#define INK_RES_DFLRETRY 2     /*%< Default #/tries. */
+#define INK_RES_MAXTIME 65535  /*%< Infinity, in milliseconds. */
+
+#define INK_NS_TYPE_ELT 0x40 /*%< EDNS0 extended label type */
 #define INK_DNS_LABELTYPE_BITSTRING 0x41
 
 /// IP family preference for DNS resolution.
 /// Used for configuration.
 enum HostResPreference {
   HOST_RES_PREFER_NONE = 0, ///< Invalid / init value.
-  HOST_RES_PREFER_CLIENT, ///< Prefer family of client connection.
-  HOST_RES_PREFER_IPV4, ///< Prefer IPv4.
-  HOST_RES_PREFER_IPV6  ///< Prefer IPv6
+  HOST_RES_PREFER_CLIENT,   ///< Prefer family of client connection.
+  HOST_RES_PREFER_IPV4,     ///< Prefer IPv4.
+  HOST_RES_PREFER_IPV6      ///< Prefer IPv6
 };
 /// # of preference values.
-static int const N_HOST_RES_PREFERENCE = HOST_RES_PREFER_IPV6+1;
+static int const N_HOST_RES_PREFERENCE = HOST_RES_PREFER_IPV6 + 1;
 /// # of entries in a preference ordering.
 static int const N_HOST_RES_PREFERENCE_ORDER = 3;
 /// Storage for preference ordering.
@@ -164,126 +163,113 @@ extern HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER;
 /// Global (configurable) default.
 extern HostResPreferenceOrder host_res_default_preference_order;
 /// String versions of @c FamilyPreference
-extern char const* const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE];
+extern char const *const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE];
 
 /// IP family to use in a DNS query for a host address.
 /// Used during DNS query operations.
-enum HostResStyle{
-  HOST_RES_NONE = 0, ///< No preference / unspecified / init value.
-  HOST_RES_IPV4, ///< Use IPv4 if possible.
+enum HostResStyle {
+  HOST_RES_NONE = 0,  ///< No preference / unspecified / init value.
+  HOST_RES_IPV4,      ///< Use IPv4 if possible.
   HOST_RES_IPV4_ONLY, ///< Resolve on IPv4 addresses.
-  HOST_RES_IPV6, ///< Use IPv6 if possible.
-  HOST_RES_IPV6_ONLY ///< Resolve only IPv6 addresses.
+  HOST_RES_IPV6,      ///< Use IPv6 if possible.
+  HOST_RES_IPV6_ONLY  ///< Resolve only IPv6 addresses.
 };
 
 /// Strings for host resolution styles
-extern char const* const HOST_RES_STYLE_STRING[];
+extern char const *const HOST_RES_STYLE_STRING[];
 
 /// Caclulate the effective resolution preferences.
-extern HostResStyle
-ats_host_res_from(
-		   int family, ///< Connection family
-		   HostResPreferenceOrder ///< Preference ordering.
-		   );
+extern HostResStyle ats_host_res_from(int family,            ///< Connection family
+                                      HostResPreferenceOrder ///< Preference ordering.
+                                      );
 /// Calculate the host resolution style to force a family match to @a addr.
-extern HostResStyle
-ats_host_res_match(sockaddr const* addr);
+extern HostResStyle ats_host_res_match(sockaddr const *addr);
 
 /** Parse a host resolution configuration string.
  */
-extern void
-parse_host_res_preference(
-			 char const* value, ///< [in] Configuration string.
-			  HostResPreferenceOrder order /// [out] Order to update.
-			  );
+extern void parse_host_res_preference(char const *value,           ///< [in] Configuration string.
+                                      HostResPreferenceOrder order /// [out] Order to update.
+                                      );
 
 #ifndef NS_GET16
-#define NS_GET16(s, cp) do { \
-        const u_char *t_cp = (const u_char *)(cp); \
-        (s) = ((uint16_t)t_cp[0] << 8) \
-            | ((uint16_t)t_cp[1]) \
-            ; \
-        (cp) += NS_INT16SZ; \
-} while (0)
+#define NS_GET16(s, cp)                                   \
+  do {                                                    \
+    const u_char *t_cp = (const u_char *)(cp);            \
+    (s) = ((uint16_t)t_cp[0] << 8) | ((uint16_t)t_cp[1]); \
+    (cp) += NS_INT16SZ;                                   \
+  } while (0)
 #endif
 
 #ifndef NS_GET32
-#define NS_GET32(l, cp) do { \
-        const u_char *t_cp = (const u_char *)(cp); \
-        (l) = ((uint32_t)t_cp[0] << 24) \
-            | ((uint32_t)t_cp[1] << 16) \
-            | ((uint32_t)t_cp[2] << 8) \
-            | ((uint32_t)t_cp[3]) \
-            ; \
-        (cp) += NS_INT32SZ; \
-} while (0)
+#define NS_GET32(l, cp)                                                                                           \
+  do {                                                                                                            \
+    const u_char *t_cp = (const u_char *)(cp);                                                                    \
+    (l) = ((uint32_t)t_cp[0] << 24) | ((uint32_t)t_cp[1] << 16) | ((uint32_t)t_cp[2] << 8) | ((uint32_t)t_cp[3]); \
+    (cp) += NS_INT32SZ;                                                                                           \
+  } while (0)
 #endif
 
 #ifndef NS_PUT16
-#define NS_PUT16(s, cp) do { \
-        uint16_t t_s = (uint16_t)(s); \
-        u_char *t_cp = (u_char *)(cp); \
-        *t_cp++ = t_s >> 8; \
-        *t_cp   = t_s; \
-        (cp) += NS_INT16SZ; \
-} while (0)
+#define NS_PUT16(s, cp)            \
+  do {                             \
+    uint16_t t_s = (uint16_t)(s);  \
+    u_char *t_cp = (u_char *)(cp); \
+    *t_cp++ = t_s >> 8;            \
+    *t_cp = t_s;                   \
+    (cp) += NS_INT16SZ;            \
+  } while (0)
 #endif
 
 #ifndef NS_PUT32
-#define NS_PUT32(l, cp) do { \
-        uint32_t t_l = (uint32_t)(l); \
-        u_char *t_cp = (u_char *)(cp); \
-        *t_cp++ = t_l >> 24; \
-        *t_cp++ = t_l >> 16; \
-        *t_cp++ = t_l >> 8; \
-        *t_cp   = t_l; \
-        (cp) += NS_INT32SZ; \
-} while (0)
+#define NS_PUT32(l, cp)            \
+  do {                             \
+    uint32_t t_l = (uint32_t)(l);  \
+    u_char *t_cp = (u_char *)(cp); \
+    *t_cp++ = t_l >> 24;           \
+    *t_cp++ = t_l >> 16;           \
+    *t_cp++ = t_l >> 8;            \
+    *t_cp = t_l;                   \
+    (cp) += NS_INT32SZ;            \
+  } while (0)
 #endif
 
 // Do we really need these to be C compatible? - AMC
 struct ts_imp_res_state {
-  int     retrans;                /*%< retransmission time interval */
-  int     retry;                  /*%< number of times to retransmit */
+  int retrans; /*%< retransmission time interval */
+  int retry;   /*%< number of times to retransmit */
 #ifdef sun
-  unsigned   options;                /*%< option flags - see below. */
+  unsigned options; /*%< option flags - see below. */
 #else
-  u_long  options;                /*%< option flags - see below. */
+  u_long options; /*%< option flags - see below. */
 #endif
-  int     nscount;                /*%< number of name servers */
-  IpEndpoint nsaddr_list[INK_MAXNS];    /*%< address of name server */
-  u_short id;                     /*%< current message id */
-  char    *dnsrch[MAXDNSRCH+1];   /*%< components of domain to search */
-  char    defdname[256];          /*%< default domain (deprecated) */
+  int nscount;                       /*%< number of name servers */
+  IpEndpoint nsaddr_list[INK_MAXNS]; /*%< address of name server */
+  u_short id;                        /*%< current message id */
+  char *dnsrch[MAXDNSRCH + 1];       /*%< components of domain to search */
+  char defdname[256];                /*%< default domain (deprecated) */
 #ifdef sun
-  unsigned   pfcode;                 /*%< RES_PRF_ flags - see below. */
+  unsigned pfcode; /*%< RES_PRF_ flags - see below. */
 #else
-  u_long  pfcode;                 /*%< RES_PRF_ flags - see below. */
+  u_long pfcode;  /*%< RES_PRF_ flags - see below. */
 #endif
-  unsigned ndots:4;               /*%< threshold for initial abs. query */
-  unsigned nsort:4;               /*%< number of elements in sort_list[] */
-  char    unused[3];
-  res_send_qhook qhook;           /*%< query hook */
-  res_send_rhook rhook;           /*%< response hook */
-  int     res_h_errno;            /*%< last one set for this context */
-  int     _vcsock;                /*%< PRIVATE: for res_send VC i/o */
-  unsigned   _flags;                 /*%< PRIVATE: see below */
-  unsigned   _pad;                   /*%< make _u 64 bit aligned */
-  uint16_t              _nstimes[INK_MAXNS]; /*%< ms. */
+  unsigned ndots : 4; /*%< threshold for initial abs. query */
+  unsigned nsort : 4; /*%< number of elements in sort_list[] */
+  char unused[3];
+  res_send_qhook qhook;         /*%< query hook */
+  res_send_rhook rhook;         /*%< response hook */
+  int res_h_errno;              /*%< last one set for this context */
+  int _vcsock;                  /*%< PRIVATE: for res_send VC i/o */
+  unsigned _flags;              /*%< PRIVATE: see below */
+  unsigned _pad;                /*%< make _u 64 bit aligned */
+  uint16_t _nstimes[INK_MAXNS]; /*%< ms. */
 };
 typedef ts_imp_res_state *ink_res_state;
 
-int ink_res_init(
-  ink_res_state,
-  IpEndpoint const* pHostList,
-  size_t pHostListSize,
-  const char *pDefDomain = NULL,
-  const char *pSearchList = NULL,
-  const char *pResolvConf = NULL
-);
+int ink_res_init(ink_res_state, IpEndpoint const *pHostList, size_t pHostListSize, const char *pDefDomain = NULL,
+                 const char *pSearchList = NULL, const char *pResolvConf = NULL);
 
-int ink_res_mkquery(ink_res_state, int, const char *, int, int,
-                    const unsigned char *, int, const unsigned char *, unsigned char *, int);
+int ink_res_mkquery(ink_res_state, int, const char *, int, int, const unsigned char *, int, const unsigned char *, unsigned char *,
+                    int);
 
 int ink_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz);
 
@@ -294,12 +280,9 @@ void ts_host_res_global_init();
 /** Generate a string representation of a host resolution preference ordering.
     @return The length of the string.
  */
-int
-ts_host_res_order_to_string(
-			    HostResPreferenceOrder const& order, ///< order to print
-			    char* out, ///< Target buffer for string.
-			    int size ///< Size of buffer.
-			    );
-
-#endif   /* _ink_resolver_h_ */
+int ts_host_res_order_to_string(HostResPreferenceOrder const &order, ///< order to print
+                                char *out,                           ///< Target buffer for string.
+                                int size                             ///< Size of buffer.
+                                );
 
+#endif /* _ink_resolver_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_resource.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resource.cc b/lib/ts/ink_resource.cc
index f0fc983..cbb4b58 100644
--- a/lib/ts/ink_resource.cc
+++ b/lib/ts/ink_resource.cc
@@ -27,7 +27,7 @@
 
 volatile int res_track_memory = 0; // Disabled by default
 
-std::map<const char*, Resource*> ResourceTracker::_resourceMap;
+std::map<const char *, Resource *> ResourceTracker::_resourceMap;
 ink_mutex ResourceTracker::resourceLock = PTHREAD_MUTEX_INITIALIZER;
 
 /**
@@ -36,16 +36,23 @@ ink_mutex ResourceTracker::resourceLock = PTHREAD_MUTEX_INITIALIZER;
 class Resource
 {
 public:
-  Resource(): _incrementCount(0), _decrementCount(0), _value(0) {}
+  Resource() : _incrementCount(0), _decrementCount(0), _value(0) {}
   void increment(const int64_t size);
-  int64_t getValue() const { return _value; }
+  int64_t
+  getValue() const
+  {
+    return _value;
+  }
+
 private:
   int64_t _incrementCount;
   int64_t _decrementCount;
   int64_t _value;
 };
 
-void Resource::increment(const int64_t size) {
+void
+Resource::increment(const int64_t size)
+{
   ink_atomic_increment(&_value, size);
   if (size >= 0) {
     ink_atomic_increment(&_incrementCount, 1);
@@ -55,17 +62,18 @@ void Resource::increment(const int64_t size) {
 }
 
 void
-ResourceTracker::increment(const char *name, const int64_t size) {
+ResourceTracker::increment(const char *name, const int64_t size)
+{
   Resource &resource = lookup(name);
   resource.increment(size);
 }
 
-Resource&
+Resource &
 ResourceTracker::lookup(const char *name)
 {
   Resource *resource = NULL;
   ink_mutex_acquire(&resourceLock);
-  std::map<const char*, Resource*>::iterator it = _resourceMap.find(name);
+  std::map<const char *, Resource *>::iterator it = _resourceMap.find(name);
   if (it != _resourceMap.end()) {
     resource = it->second;
   } else {
@@ -79,7 +87,8 @@ ResourceTracker::lookup(const char *name)
 }
 
 void
-ResourceTracker::dump(FILE *fd) {
+ResourceTracker::dump(FILE *fd)
+{
   if (!res_track_memory) {
     return;
   }
@@ -89,8 +98,7 @@ ResourceTracker::dump(FILE *fd) {
   if (!_resourceMap.empty()) {
     fprintf(fd, "%50s | %20s\n", "Location", "Size In-use");
     fprintf(fd, "---------------------------------------------------+------------------------\n");
-    for (std::map<const char*, Resource*>::const_iterator it = _resourceMap.begin();
-        it != _resourceMap.end(); ++it) {
+    for (std::map<const char *, Resource *>::const_iterator it = _resourceMap.begin(); it != _resourceMap.end(); ++it) {
       const Resource &resource = *it->second;
       fprintf(fd, "%50s | %20" PRId64 "\n", it->first, resource.getValue());
       total += resource.getValue();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_resource.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resource.h b/lib/ts/ink_resource.h
index 7be1447..02e36e0 100644
--- a/lib/ts/ink_resource.h
+++ b/lib/ts/ink_resource.h
@@ -27,11 +27,11 @@
 #include "ink_mutex.h"
 #include <map>
 
-extern volatile int res_track_memory;   /* set this to zero to disable resource tracking */
+extern volatile int res_track_memory; /* set this to zero to disable resource tracking */
 
-#define __RES_PATH(x)   #x
-#define _RES_PATH(x)    __RES_PATH (x)
-#define RES_PATH(x)     x __FILE__ ":" _RES_PATH (__LINE__)
+#define __RES_PATH(x) #x
+#define _RES_PATH(x) __RES_PATH(x)
+#define RES_PATH(x) x __FILE__ ":" _RES_PATH(__LINE__)
 
 class Resource;
 
@@ -42,12 +42,13 @@ class Resource;
 class ResourceTracker
 {
 public:
-  ResourceTracker() {};
-  static void increment(const char* name, const int64_t size);
+  ResourceTracker(){};
+  static void increment(const char *name, const int64_t size);
   static void dump(FILE *fd);
+
 private:
-  static Resource& lookup(const char* name);
-  static std::map<const char*, Resource*> _resourceMap;
+  static Resource &lookup(const char *name);
+  static std::map<const char *, Resource *> _resourceMap;
   static ink_mutex resourceLock;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_rwlock.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_rwlock.cc b/lib/ts/ink_rwlock.cc
index bcbc70a..a28f8ee 100644
--- a/lib/ts/ink_rwlock.cc
+++ b/lib/ts/ink_rwlock.cc
@@ -30,7 +30,7 @@
 // Note: This should be called only once.
 //-------------------------------------------------------------------------
 int
-ink_rwlock_init(ink_rwlock * rw)
+ink_rwlock_init(ink_rwlock *rw)
 {
   int result;
 
@@ -48,8 +48,7 @@ ink_rwlock_init(ink_rwlock * rw)
   return 0;
 
 Lerror:
-  return result;              /* an errno value */
-
+  return result; /* an errno value */
 }
 
 //-------------------------------------------------------------------------
@@ -57,7 +56,7 @@ Lerror:
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_destroy(ink_rwlock * rw)
+ink_rwlock_destroy(ink_rwlock *rw)
 {
   if (rw->rw_magic != RW_MAGIC)
     return EINVAL;
@@ -77,7 +76,7 @@ ink_rwlock_destroy(ink_rwlock * rw)
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_rdlock(ink_rwlock * rw)
+ink_rwlock_rdlock(ink_rwlock *rw)
 {
   int result;
 
@@ -93,7 +92,7 @@ ink_rwlock_rdlock(ink_rwlock * rw)
     ink_cond_wait(&rw->rw_condreaders, &rw->rw_mutex);
     rw->rw_nwaitreaders--;
   }
-  rw->rw_refcount++;            /* another reader has a read lock */
+  rw->rw_refcount++; /* another reader has a read lock */
 
   ink_mutex_release(&rw->rw_mutex);
 
@@ -105,7 +104,7 @@ ink_rwlock_rdlock(ink_rwlock * rw)
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_wrlock(ink_rwlock * rw)
+ink_rwlock_wrlock(ink_rwlock *rw)
 {
   int result;
 
@@ -132,7 +131,7 @@ ink_rwlock_wrlock(ink_rwlock * rw)
 //-------------------------------------------------------------------------
 
 int
-ink_rwlock_unlock(ink_rwlock * rw)
+ink_rwlock_unlock(ink_rwlock *rw)
 {
   int result;
 
@@ -143,9 +142,9 @@ ink_rwlock_unlock(ink_rwlock * rw)
     return result;
 
   if (rw->rw_refcount > 0)
-    rw->rw_refcount--;          /* releasing a reader */
+    rw->rw_refcount--; /* releasing a reader */
   else if (rw->rw_refcount == -1)
-    rw->rw_refcount = 0;        /* releasing a reader */
+    rw->rw_refcount = 0; /* releasing a reader */
   else
     ink_release_assert("invalid rw_refcount!");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_rwlock.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_rwlock.h b/lib/ts/ink_rwlock.h
index 06a732e..01e87be 100644
--- a/lib/ts/ink_rwlock.h
+++ b/lib/ts/ink_rwlock.h
@@ -35,21 +35,20 @@
 
 #define RW_MAGIC 0x19283746
 
-struct ink_rwlock
-{
-  ink_mutex rw_mutex;           /* basic lock on this struct */
-  ink_cond rw_condreaders;      /* for reader threads waiting */
-  ink_cond rw_condwriters;      /* for writer threads waiting */
-  int rw_magic;                 /* for error checking */
-  int rw_nwaitreaders;          /* the number waiting */
-  int rw_nwaitwriters;          /* the number waiting */
+struct ink_rwlock {
+  ink_mutex rw_mutex;      /* basic lock on this struct */
+  ink_cond rw_condreaders; /* for reader threads waiting */
+  ink_cond rw_condwriters; /* for writer threads waiting */
+  int rw_magic;            /* for error checking */
+  int rw_nwaitreaders;     /* the number waiting */
+  int rw_nwaitwriters;     /* the number waiting */
   int rw_refcount;
 };
 
-int ink_rwlock_init(ink_rwlock * rw);
-int ink_rwlock_destroy(ink_rwlock * rw);
-int ink_rwlock_rdlock(ink_rwlock * rw);
-int ink_rwlock_wrlock(ink_rwlock * rw);
-int ink_rwlock_unlock(ink_rwlock * rw);
+int ink_rwlock_init(ink_rwlock *rw);
+int ink_rwlock_destroy(ink_rwlock *rw);
+int ink_rwlock_rdlock(ink_rwlock *rw);
+int ink_rwlock_wrlock(ink_rwlock *rw);
+int ink_rwlock_unlock(ink_rwlock *rw);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sock.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sock.cc b/lib/ts/ink_sock.cc
index f1e699f..3c72103 100644
--- a/lib/ts/ink_sock.cc
+++ b/lib/ts/ink_sock.cc
@@ -37,11 +37,11 @@
 
 
 #ifdef CHECK_PLAUSIBILITY_OF_SOCKADDR
-#define CHECK_PLAUSIBLE_SOCKADDR(_n,_f,_l) check_plausible_sockaddr(_n,_f,_n)
+#define CHECK_PLAUSIBLE_SOCKADDR(_n, _f, _l) check_plausible_sockaddr(_n, _f, _n)
 inline void
-check_valid_sockaddr(sockaddr * sa, char *file, int line)
+check_valid_sockaddr(sockaddr *sa, char *file, int line)
 {
-  sockaddr_in *si = (sockaddr_in *) sa;
+  sockaddr_in *si = (sockaddr_in *)sa;
   unsigned short port = ntohs(si->sin_port);
   unsigned short addr = ntohl(si->sin_addr.s_addr);
 
@@ -52,7 +52,7 @@ check_valid_sockaddr(sockaddr * sa, char *file, int line)
   }
 }
 #else
-#define CHECK_PLAUSIBLE_SOCKADDR(_n,_f,_l)
+#define CHECK_PLAUSIBLE_SOCKADDR(_n, _f, _l)
 #endif
 
 int
@@ -70,7 +70,7 @@ safe_getsockopt(int s, int level, int optname, char *optval, int *optlevel)
 {
   int r;
   do {
-    r = getsockopt(s, level, optname, optval, (socklen_t *) optlevel);
+    r = getsockopt(s, level, optname, optval, (socklen_t *)optlevel);
   } while (r < 0 && (errno == EAGAIN || errno == EINTR));
   return r;
 }
@@ -162,7 +162,7 @@ safe_ioctl(int fd, int request, char *arg)
 }
 
 int
-safe_bind(int s, struct sockaddr const* name, int namelen)
+safe_bind(int s, struct sockaddr const *name, int namelen)
 {
   int r;
   CHECK_PLAUSIBLE_SOCKADDR(name, __FILE__, __LINE__);
@@ -187,7 +187,7 @@ safe_getsockname(int s, struct sockaddr *name, int *namelen)
 {
   int r;
   do {
-    r = getsockname(s, name, (socklen_t *) namelen);
+    r = getsockname(s, name, (socklen_t *)namelen);
   } while (r < 0 && (errno == EAGAIN || errno == EINTR));
   return r;
 }
@@ -197,7 +197,7 @@ safe_getpeername(int s, struct sockaddr *name, int *namelen)
 {
   int r;
   do {
-    r = getpeername(s, name, (socklen_t*)namelen);
+    r = getpeername(s, name, (socklen_t *)namelen);
   } while (r < 0 && (errno == EAGAIN || errno == EINTR));
   return r;
 }
@@ -222,7 +222,7 @@ fd_read_line(int fd, char *s, int len)
 {
   char c;
   int numread = 0, r;
-  //char *buf = s;
+  // char *buf = s;
   do {
     do
       r = read(fd, &c, 1);
@@ -254,17 +254,17 @@ close_socket(int s)
 int
 write_socket(int s, const char *buffer, int length)
 {
-  return write(s, (const void *) buffer, length);
+  return write(s, (const void *)buffer, length);
 }
 
 int
 read_socket(int s, char *buffer, int length)
 {
-  return read(s, (void *) buffer, length);
+  return read(s, (void *)buffer, length);
 }
 
 int
-bind_unix_domain_socket(const char * path, mode_t mode)
+bind_unix_domain_socket(const char *path, mode_t mode)
 {
   int sockfd;
   struct sockaddr_un sockaddr;
@@ -310,4 +310,3 @@ fail:
   errno = errsav;
   return -1;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sock.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sock.h b/lib/ts/ink_sock.h
index 859d0b8..629ded3 100644
--- a/lib/ts/ink_sock.h
+++ b/lib/ts/ink_sock.h
@@ -27,7 +27,7 @@
 
 
 ***************************************************************************/
-#if !defined (_ink_sock_h_)
+#if !defined(_ink_sock_h_)
 #define _ink_sock_h_
 
 #include "ink_platform.h"
@@ -37,7 +37,7 @@
 
 int safe_setsockopt(int s, int level, int optname, char *optval, int optlevel);
 int safe_getsockopt(int s, int level, int optname, char *optval, int *optlevel);
-int safe_bind(int s, struct sockaddr const* name, int namelen);
+int safe_bind(int s, struct sockaddr const *name, int namelen);
 int safe_listen(int s, int backlog);
 int safe_getsockname(int s, struct sockaddr *name, int *namelen);
 int safe_getpeername(int s, struct sockaddr *name, int *namelen);
@@ -63,6 +63,6 @@ int read_socket(int s, char *buffer, int length);
 
 inkcoreapi uint32_t ink_inet_addr(const char *s);
 
-int bind_unix_domain_socket(const char * path, mode_t mode);
+int bind_unix_domain_socket(const char *path, mode_t mode);
 
 #endif /* _ink_sock_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sprintf.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sprintf.cc b/lib/ts/ink_sprintf.cc
index 8c053ee..26a0716 100644
--- a/lib/ts/ink_sprintf.cc
+++ b/lib/ts/ink_sprintf.cc
@@ -80,63 +80,63 @@ ink_bvsprintf(char *buffer, const char *format, va_list ap)
     // handle non-% characters //
     /////////////////////////////
 
-    if (buffer)                 // if have output buffer
+    if (buffer) // if have output buffer
       while (*s && (*s != '%')) {
         *d++ = *s++;
-      }                         //   really copy, else
+      } //   really copy, else
     else
       while (*s && (*s != '%')) {
         d++;
         s++;
-      }                         //   pass over string
+      } //   pass over string
 
     ///////////////////////////
     // handle NUL characters //
     ///////////////////////////
 
     if (*s == NUL)
-      break;                    // end of string
+      break; // end of string
 
     /////////////////////////
     // handle % characters //
     /////////////////////////
 
-    ++s;                        // consume % character
+    ++s; // consume % character
 
-    switch (*s)                 // dispatch on flag
+    switch (*s) // dispatch on flag
     {
-    case 's':                  // %s pattern
-      ++s;                      // consume 's'
-      s_val = va_arg(ap_local, char *);       // grab string argument
-      p = s_val;                // temporary pointer
-      if (buffer)               // if have output buffer
+    case 's':                           // %s pattern
+      ++s;                              // consume 's'
+      s_val = va_arg(ap_local, char *); // grab string argument
+      p = s_val;                        // temporary pointer
+      if (buffer)                       // if have output buffer
         while (*p) {
           *d++ = *p++;
-        }                       //   copy value
-      else                      // else
+        }  //   copy value
+      else // else
         while (*p) {
           d++;
           p++;
-        }                       //   pass over value
+        } //   pass over value
       break;
-    case 'd':                  // %d pattern
-      ++s;                      // consume 'd'
-      d_val = va_arg(ap_local, int);  // grab integer argument
-      snprintf(d_buffer, sizeof(d_buffer), "%d", d_val);        // stringify integer
-      p = d_buffer;             // temporary pointer
-      if (buffer)               // if have output buffer
+    case 'd':                                            // %d pattern
+      ++s;                                               // consume 'd'
+      d_val = va_arg(ap_local, int);                     // grab integer argument
+      snprintf(d_buffer, sizeof(d_buffer), "%d", d_val); // stringify integer
+      p = d_buffer;                                      // temporary pointer
+      if (buffer)                                        // if have output buffer
         while (*p) {
           *d++ = *p++;
-        }                       //   copy value
-      else                      // else
+        }  //   copy value
+      else // else
         while (*p) {
           d++;
           p++;
-        }                       //   pass over value
+        } //   pass over value
       break;
-    default:                   // something else
+    default: // something else
       if (buffer)
-        *d = *s;                // copy unknown character
+        *d = *s; // copy unknown character
       ++d;
       ++s;
       break;
@@ -148,5 +148,5 @@ ink_bvsprintf(char *buffer, const char *format, va_list ap)
   ++d;
 
   va_end(ap_local);
-  return (int) (d - buffer);
+  return (int)(d - buffer);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sprintf.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sprintf.h b/lib/ts/ink_sprintf.h
index 67da29f..7686d0c 100644
--- a/lib/ts/ink_sprintf.h
+++ b/lib/ts/ink_sprintf.h
@@ -32,17 +32,14 @@
   ****************************************************************************/
 
 #ifndef _ink_sprintf_h_
-#define	_ink_sprintf_h_
+#define _ink_sprintf_h_
 
 #include <stdio.h>
 #include <stdarg.h>
 #include "ink_apidefs.h"
 #include "ink_defs.h"
 
-int
-ink_bsprintf(char *buffer, const char *format, ...)
-TS_PRINTFLIKE(2, 3);
-int
-ink_bvsprintf(char *buffer, const char *format, va_list ap);
+int ink_bsprintf(char *buffer, const char *format, ...) TS_PRINTFLIKE(2, 3);
+int ink_bvsprintf(char *buffer, const char *format, va_list ap);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_stack_trace.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_stack_trace.cc b/lib/ts/ink_stack_trace.cc
index 17f9ddc..b38b8e1 100644
--- a/lib/ts/ink_stack_trace.cc
+++ b/lib/ts/ink_stack_trace.cc
@@ -35,7 +35,7 @@
 
 #if TS_HAS_BACKTRACE
 
-#include <execinfo.h>           /* for backtrace_symbols, etc. */
+#include <execinfo.h> /* for backtrace_symbols, etc. */
 #include <signal.h>
 
 void
@@ -63,14 +63,14 @@ ink_stack_trace_dump()
   }
 }
 
-#else  /* !TS_HAS_BACKTRACE */
+#else /* !TS_HAS_BACKTRACE */
 
 void
 ink_stack_trace_dump()
 {
   const char msg[] = "ink_stack_trace_dump not implemented on this operating system\n";
   if (write(STDERR_FILENO, msg, sizeof(msg) - 1) == -1)
-      return;
+    return;
 }
 
-#endif  /* TS_HAS_BACKTRACE */
+#endif /* TS_HAS_BACKTRACE */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_stack_trace.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_stack_trace.h b/lib/ts/ink_stack_trace.h
index 7490cb8..a2e5904 100644
--- a/lib/ts/ink_stack_trace.h
+++ b/lib/ts/ink_stack_trace.h
@@ -25,16 +25,15 @@
 #define ink_stack_trace_h
 
 // The max number of levels in the stack trace
-#define INK_STACK_TRACE_MAX_LEVELS		100
+#define INK_STACK_TRACE_MAX_LEVELS 100
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 /* dumps the current back trace to stderr */
-  void ink_stack_trace_dump();
+void ink_stack_trace_dump();
 #ifdef __cplusplus
 }
 #endif
 
-#endif                          /* ink_stack_trace_h */
+#endif /* ink_stack_trace_h */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string++.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string++.cc b/lib/ts/ink_string++.cc
index dcc1799..dacc870 100644
--- a/lib/ts/ink_string++.cc
+++ b/lib/ts/ink_string++.cc
@@ -42,7 +42,7 @@
   -------------------------------------------------------------------------*/
 
 void
-StrList::dump(FILE * fp)
+StrList::dump(FILE *fp)
 {
   Str *str;
 
@@ -64,23 +64,23 @@ StrList::_new_cell(const char *s, int len_not_counting_nul)
   if (cells_allocated < STRLIST_BASE_CELLS) {
     cell = &(base_cells[cells_allocated]);
   } else {
-    p = (char *) alloc(sizeof(Str) + 7);
+    p = (char *)alloc(sizeof(Str) + 7);
     if (p == NULL)
-      return (NULL);            // FIX: scale heap
-    p = (char *) ((((uintptr_t)p) + 7) & ~7);       // round up to multiple of 8
-    cell = (Str *) p;
+      return (NULL);                         // FIX: scale heap
+    p = (char *)((((uintptr_t)p) + 7) & ~7); // round up to multiple of 8
+    cell = (Str *)p;
   }
   ++cells_allocated;
 
   // are we supposed to copy the string?
   if (copy_when_adding_string) {
-    char *buf = (char *) alloc(l + 1);
+    char *buf = (char *)alloc(l + 1);
     if (buf == NULL)
-      return (NULL);            // FIX: need to grow heap!
+      return (NULL); // FIX: need to grow heap!
     memcpy(buf, s, l);
     buf[l] = '\0';
 
-    cell->str = (const char *) buf;
+    cell->str = (const char *)buf;
   } else {
     cell->str = s;
   }
@@ -114,7 +114,7 @@ StrList::overflow_heap_clean()
 }
 
 
-#define INIT_OVERFLOW_ALIGNMENT      8
+#define INIT_OVERFLOW_ALIGNMENT 8
 // XXX: This is basically INK_ALIGN_DEFAULT
 const int overflow_head_hdr_size = INK_ALIGN(sizeof(StrListOverflow), INIT_OVERFLOW_ALIGNMENT);
 
@@ -140,9 +140,8 @@ StrListOverflow::clean()
 }
 
 void *
-StrListOverflow::alloc(int size, StrListOverflow ** new_heap_ptr)
+StrListOverflow::alloc(int size, StrListOverflow **new_heap_ptr)
 {
-
   if (size > (heap_size - heap_used)) {
     int new_heap_size = heap_size * 2;
 
@@ -156,11 +155,11 @@ StrListOverflow::alloc(int size, StrListOverflow ** new_heap_ptr)
     return next->alloc(size, new_heap_ptr);
   }
 
-  char *start = ((char *) this) + overflow_head_hdr_size;
+  char *start = ((char *)this) + overflow_head_hdr_size;
   char *rval = start + heap_used;
   heap_used += size;
   ink_assert(heap_used <= heap_size);
-  return (void *) rval;
+  return (void *)rval;
 }
 
 StrListOverflow *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string++.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string++.h b/lib/ts/ink_string++.h
index 768303e..338b13a 100644
--- a/lib/ts/ink_string++.h
+++ b/lib/ts/ink_string++.h
@@ -30,7 +30,7 @@
 
  ****************************************************************************/
 
-#if !defined (_ink_string_pp_h_)
+#if !defined(_ink_string_pp_h_)
 #define _ink_string_pp_h_
 #include <stdio.h>
 #include <strings.h>
@@ -61,7 +61,7 @@ _strlen(const char *src)
   const char *old_src = src;
   while (*src)
     src++;
-  return (int) (src - old_src);
+  return (int)(src - old_src);
 }
 
 /***********************************************************************
@@ -70,16 +70,13 @@ _strlen(const char *src)
  *                                                                     *
  ***********************************************************************/
 
-struct Str
-{
-  const char *str;              // string pointer
-  size_t len;                   // length of string (not counting NUL)
-  struct Str *next;             // next in list
-  struct Str *prev;             // prev in list
+struct Str {
+  const char *str;  // string pointer
+  size_t len;       // length of string (not counting NUL)
+  struct Str *next; // next in list
+  struct Str *prev; // prev in list
 
-    Str():str(NULL), len(0), next(NULL), prev(NULL)
-  {
-  }
+  Str() : str(NULL), len(0), next(NULL), prev(NULL) {}
   Str(char *s)
   {
     str = s;
@@ -95,7 +92,8 @@ struct Str
     prev = NULL;
   }
 
-  void clean()
+  void
+  clean()
   {
     str = NULL;
     len = 0;
@@ -103,8 +101,10 @@ struct Str
     prev = NULL;
   }
 
-  void dump(FILE * fp = stderr) {
-    fprintf(fp, "Str [\"%.*s\", len %d]\n", (int) len, str, (int) len);
+  void
+  dump(FILE *fp = stderr)
+  {
+    fprintf(fp, "Str [\"%.*s\", len %d]\n", (int)len, str, (int)len);
   }
 };
 
@@ -114,33 +114,32 @@ struct Str
  *                                                                     *
  ***********************************************************************/
 
-#define	STRLIST_BASE_HEAP_SIZE		128
-#define	STRLIST_OVERFLOW_HEAP_SIZE	1024
-#define	STRLIST_BASE_CELLS		5
+#define STRLIST_BASE_HEAP_SIZE 128
+#define STRLIST_OVERFLOW_HEAP_SIZE 1024
+#define STRLIST_BASE_CELLS 5
 
 struct StrListOverflow;
 
-struct StrList
-{
+struct StrList {
 public:
   int count;
   Str *head;
   Str *tail;
 
 public:
-    StrList(bool do_copy_when_adding_string = true);
-   ~StrList();
+  StrList(bool do_copy_when_adding_string = true);
+  ~StrList();
 
   Str *get_idx(int i);
-  void append(Str * str);
-  void prepend(Str * str);
-  void add_after(Str * prev, Str * str);
-  void detach(Str * str);
+  void append(Str *str);
+  void prepend(Str *str);
+  void add_after(Str *prev, Str *str);
+  void detach(Str *str);
 
   Str *new_cell(const char *s, int len_not_counting_nul);
   Str *append_string(const char *s, int len_not_counting_nul);
 
-  void dump(FILE * fp = stderr);
+  void dump(FILE *fp = stderr);
 
 private:
   void init();
@@ -162,15 +161,14 @@ private:
   bool copy_when_adding_string;
 };
 
-struct StrListOverflow
-{
+struct StrListOverflow {
   StrListOverflow *next;
   int heap_size;
   int heap_used;
 
   void init();
   void clean();
-  void *alloc(int size, StrListOverflow ** new_heap_ptr);
+  void *alloc(int size, StrListOverflow **new_heap_ptr);
   static StrListOverflow *create_heap(int user_size);
 };
 
@@ -194,17 +192,14 @@ StrList::clean()
   init();
 }
 
-inline
-StrList::StrList(bool do_copy_when_adding_string)
+inline StrList::StrList(bool do_copy_when_adding_string)
 {
   memset(base_heap, 0, sizeof(base_heap));
   copy_when_adding_string = do_copy_when_adding_string;
   init();
 }
 
-inline
-StrList::~
-StrList()
+inline StrList::~StrList()
 {
   clean();
 }
@@ -217,7 +212,7 @@ StrList::base_heap_alloc(int size)
   if (size <= (base_heap_size - base_heap_used)) {
     p = &(base_heap[base_heap_used]);
     base_heap_used += size;
-    return ((void *) p);
+    return ((void *)p);
   } else
     return (NULL);
 }
@@ -253,12 +248,13 @@ StrList::get_idx(int i)
 {
   Str *s;
 
-  for (s = head; ((s != NULL) && i); s = s->next, i--);
+  for (s = head; ((s != NULL) && i); s = s->next, i--)
+    ;
   return ((i == 0) ? s : NULL);
 }
 
 inline void
-StrList::append(Str * str)
+StrList::append(Str *str)
 {
   // do nothing if str is NULL to avoid pointer chasing below
   if (str == NULL)
@@ -276,7 +272,7 @@ StrList::append(Str * str)
 }
 
 inline void
-StrList::prepend(Str * str)
+StrList::prepend(Str *str)
 {
   if (str == NULL)
     return;
@@ -293,7 +289,7 @@ StrList::prepend(Str * str)
 }
 
 inline void
-StrList::add_after(Str * prev, Str * str)
+StrList::add_after(Str *prev, Str *str)
 {
   if (str == NULL || prev == NULL)
     return;
@@ -306,7 +302,7 @@ StrList::add_after(Str * prev, Str * str)
 }
 
 inline void
-StrList::detach(Str * str)
+StrList::detach(Str *str)
 {
   if (str == NULL)
     return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.cc b/lib/ts/ink_string.cc
index c079b5e..f8178e1 100644
--- a/lib/ts/ink_string.cc
+++ b/lib/ts/ink_string.cc
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 
-#include "libts.h"   /* MAGIC_EDITING_TAG */
+#include "libts.h" /* MAGIC_EDITING_TAG */
 
 #include <assert.h>
 #include <stdarg.h>
@@ -36,7 +36,7 @@ char *
 ink_memcpy_until_char(char *dst, char *src, unsigned int n, unsigned char c)
 {
   unsigned int i = 0;
-  for (; ((i < n) && (((unsigned char) src[i]) != c)); i++)
+  for (; ((i < n) && (((unsigned char)src[i]) != c)); i++)
     dst[i] = src[i];
   return &src[i];
 }
@@ -72,7 +72,7 @@ ink_string_concatenate_strings(char *dest, ...)
   *d++ = '\0';
   va_end(ap);
   return (dest);
-}                               /* End ink_string_concatenate_strings */
+} /* End ink_string_concatenate_strings */
 
 
 /*---------------------------------------------------------------------------*
@@ -109,7 +109,7 @@ ink_string_concatenate_strings_n(char *dest, int n, ...)
     *d = '\0';
   va_end(ap);
   return (dest);
-}                               /* End ink_string_concatenate_strings_n */
+} /* End ink_string_concatenate_strings_n */
 
 
 /*---------------------------------------------------------------------------*
@@ -138,7 +138,8 @@ ink_string_append(char *dest, char *src, int n)
 
   /* Scan For End Of Dest */
 
-  for (d = dest; (d <= last_valid_char) && (*d != '\0'); d++);
+  for (d = dest; (d <= last_valid_char) && (*d != '\0'); d++)
+    ;
 
   /* If At End Of String, NUL Terminate & Exit */
 
@@ -161,7 +162,7 @@ ink_string_append(char *dest, char *src, int n)
     *d = '\0';
 
   return (dest);
-}                               /* End ink_string_append */
+} /* End ink_string_append */
 
 
 #if !HAVE_STRLCPY
@@ -183,12 +184,12 @@ ink_strlcpy(char *dst, const char *src, size_t siz)
   /* Not enough room in dst, add NUL and traverse rest of src */
   if (n == 0) {
     if (siz != 0)
-      *d = '\0';      /* NUL-terminate dst */
+      *d = '\0'; /* NUL-terminate dst */
     while (*s++)
       ;
   }
 
-  return (s - src - 1);   /* count does not include NUL */
+  return (s - src - 1); /* count does not include NUL */
 }
 #endif
 
@@ -218,7 +219,6 @@ ink_strlcat(char *dst, const char *src, size_t siz)
   }
   *d = '\0';
 
-  return (dlen + (s - src));  /* count does not include NUL */
+  return (dlen + (s - src)); /* count does not include NUL */
 }
 #endif
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_string.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.h b/lib/ts/ink_string.h
index a822cc5..74d4ea4 100644
--- a/lib/ts/ink_string.h
+++ b/lib/ts/ink_string.h
@@ -60,7 +60,7 @@ inkcoreapi char *ink_string_append(char *dest, char *src, int n);
  * Returns strlen(src); if retval >= siz, truncation occurred.
  */
 #if HAVE_STRLCPY
-#define  ink_strlcpy strlcpy
+#define ink_strlcpy strlcpy
 #else
 size_t ink_strlcpy(char *dst, const char *str, size_t siz);
 #endif
@@ -72,7 +72,7 @@ size_t ink_strlcpy(char *dst, const char *str, size_t siz);
  * If retval >= siz, truncation occurred.
  */
 #if HAVE_STRLCAT
-#define  ink_strlcat strlcat
+#define ink_strlcat strlcat
 #else
 size_t ink_strlcat(char *dst, const char *str, size_t siz);
 #endif
@@ -146,14 +146,12 @@ ptr_len_casecmp(const char *p1, int l1, const char *p2, int l2)
 inline const char *
 ptr_len_str(const char *p1, int l1, const char *str)
 {
-
   if (str && str[0]) {
     int str_index = 0;
     const char *match_start = NULL;
 
     while (l1 > 0) {
       if (*p1 == str[str_index]) {
-
         // If this is the start of a match,
         //    record it;
         if (str_index == 0) {
@@ -185,8 +183,6 @@ ptr_len_str(const char *p1, int l1, const char *str)
 inline int
 ptr_len_ncmp(const char *p1, int l1, const char *str, int n)
 {
-
-
   while (l1 > 0 && n > 0) {
     if (*str == '\0') {
       return 1;
@@ -229,8 +225,6 @@ ptr_len_ncmp(const char *p1, int l1, const char *str, int n)
 inline int
 ptr_len_ncasecmp(const char *p1, int l1, const char *str, int n)
 {
-
-
   while (l1 > 0 && n > 0) {
     if (*str == '\0') {
       return 1;
@@ -272,7 +266,6 @@ ptr_len_ncasecmp(const char *p1, int l1, const char *str, int n)
 inline int
 ptr_len_casecmp(const char *p1, int l1, const char *str)
 {
-
   while (l1 > 0) {
     if (*str == '\0') {
       return 1;
@@ -313,7 +306,6 @@ ptr_len_casecmp(const char *p1, int l1, const char *str)
 inline int
 ptr_len_cmp(const char *p1, int l1, const char *str)
 {
-
   while (l1 > 0) {
     if (*str == '\0') {
       return 1;
@@ -357,7 +349,7 @@ ptr_len_pbrk(const char *p1, int l1, const char *str)
 
     while (*str_cur != '\0') {
       if (*p1 == *str_cur) {
-        return (char *) p1;
+        return (char *)p1;
       }
       str_cur++;
     }
@@ -373,27 +365,27 @@ ptr_len_pbrk(const char *p1, int l1, const char *str)
 // On error, we'll return 0, and nothing is written to the buffer.
 // TODO: Do these really need to be inline?
 inline int
-ink_small_itoa(int val, char* buf, int buf_len)
+ink_small_itoa(int val, char *buf, int buf_len)
 {
   ink_assert(buf_len > 5);
   ink_assert((val >= 0) && (val < 100000));
 
-  if (val < 10) {               // 0 - 9
+  if (val < 10) { // 0 - 9
     buf[0] = '0' + val;
     return 1;
-  } else if (val < 100) {       // 10 - 99
+  } else if (val < 100) { // 10 - 99
     buf[1] = '0' + (val % 10);
     val /= 10;
     buf[0] = '0' + (val % 10);
     return 2;
-  } else if (val < 1000) {      // 100 - 999
+  } else if (val < 1000) { // 100 - 999
     buf[2] = '0' + (val % 10);
     val /= 10;
     buf[1] = '0' + (val % 10);
     val /= 10;
     buf[0] = '0' + (val % 10);
     return 3;
-  } else if (val < 10000) {     // 1000 - 9999
+  } else if (val < 10000) { // 1000 - 9999
     buf[3] = '0' + (val % 10);
     val /= 10;
     buf[2] = '0' + (val % 10);
@@ -402,7 +394,7 @@ ink_small_itoa(int val, char* buf, int buf_len)
     val /= 10;
     buf[0] = '0' + (val % 10);
     return 4;
-  } else {                      // 10000 - 99999
+  } else { // 10000 - 99999
     buf[4] = '0' + (val % 10);
     val /= 10;
     buf[3] = '0' + (val % 10);
@@ -417,7 +409,7 @@ ink_small_itoa(int val, char* buf, int buf_len)
 }
 
 inline int
-ink_fast_itoa(int32_t val, char* buf, int buf_len)
+ink_fast_itoa(int32_t val, char *buf, int buf_len)
 {
   if ((val < 0) || (val > 99999)) {
     int ret = snprintf(buf, buf_len, "%d", val);
@@ -429,7 +421,7 @@ ink_fast_itoa(int32_t val, char* buf, int buf_len)
 }
 
 inline int
-ink_fast_uitoa(uint32_t val, char* buf, int buf_len)
+ink_fast_uitoa(uint32_t val, char *buf, int buf_len)
 {
   if (val > 99999) {
     int ret = snprintf(buf, buf_len, "%u", val);
@@ -441,7 +433,7 @@ ink_fast_uitoa(uint32_t val, char* buf, int buf_len)
 }
 
 inline int
-ink_fast_ltoa(int64_t val, char* buf, int buf_len)
+ink_fast_ltoa(int64_t val, char *buf, int buf_len)
 {
   if ((val < 0) || (val > 99999)) {
     int ret = snprintf(buf, buf_len, "%" PRId64 "", val);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sys_control.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sys_control.cc b/lib/ts/ink_sys_control.cc
index 770f3aa..626b496 100644
--- a/lib/ts/ink_sys_control.cc
+++ b/lib/ts/ink_sys_control.cc
@@ -31,9 +31,9 @@ ink_max_out_rlimit(int which, bool max_it, bool unlim_it)
   struct rlimit rl;
 
 #if defined(linux)
-#  define MAGIC_CAST(x) (enum __rlimit_resource)(x)
+#define MAGIC_CAST(x) (enum __rlimit_resource)(x)
 #else
-#  define MAGIC_CAST(x) x
+#define MAGIC_CAST(x) x
 #endif
 
   if (max_it) {
@@ -71,7 +71,7 @@ ink_get_max_files()
   struct rlimit lim;
 
   // Linux-only ...
-  if ((fd = fopen("/proc/sys/fs/file-max","r"))) {
+  if ((fd = fopen("/proc/sys/fs/file-max", "r"))) {
     uint64_t fmax;
     if (fscanf(fd, "%" PRIu64 "", &fmax) == 1) {
       fclose(fd);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_sys_control.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_sys_control.h b/lib/ts/ink_sys_control.h
index 15e2b2c..7326f6b 100644
--- a/lib/ts/ink_sys_control.h
+++ b/lib/ts/ink_sys_control.h
@@ -26,7 +26,7 @@
 
 #include <sys/resource.h>
 
-rlim_t ink_max_out_rlimit(int which, bool max_it=true, bool unlim_it=true);
+rlim_t ink_max_out_rlimit(int which, bool max_it = true, bool unlim_it = true);
 rlim_t ink_get_max_files();
 
 #endif /*_INK_SYS_CONTROL_H*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_syslog.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_syslog.cc b/lib/ts/ink_syslog.cc
index e8e637c..65f8d04 100644
--- a/lib/ts/ink_syslog.cc
+++ b/lib/ts/ink_syslog.cc
@@ -30,33 +30,30 @@
  ****************************************************************************/
 #include "libts.h"
 
-struct syslog_fac
-{
+struct syslog_fac {
   char *long_str;
   char *short_str;
   int fac_int;
 };
 
-static const syslog_fac convert_table[] = {
-  {(char *) "LOG_KERN", (char *) "KERN", LOG_KERN},
-  {(char *) "LOG_USER", (char *) "USER", LOG_USER},
-  {(char *) "LOG_MAIL", (char *) "MAIL", LOG_MAIL},
-  {(char *) "LOG_DAEMON", (char *) "DAEMON", LOG_DAEMON},
-  {(char *) "LOG_AUTH", (char *) "AUTH", LOG_AUTH},
-  {(char *) "LOG_LPR", (char *) "LPR", LOG_LPR},
-  {(char *) "LOG_NEWS", (char *) "NEWS", LOG_NEWS},
-  {(char *) "LOG_UUCP", (char *) "UUCP", LOG_UUCP},
-  {(char *) "LOG_CRON", (char *) "CRON", LOG_CRON},
-  {(char *) "LOG_LOCAL0", (char *) "LOCAL0", LOG_LOCAL0},
-  {(char *) "LOG_LOCAL1", (char *) "LOCAL1", LOG_LOCAL1},
-  {(char *) "LOG_LOCAL2", (char *) "LOCAL2", LOG_LOCAL2},
-  {(char *) "LOG_LOCAL3", (char *) "LOCAL3", LOG_LOCAL3},
-  {(char *) "LOG_LOCAL4", (char *) "LOCAL4", LOG_LOCAL4},
-  {(char *) "LOG_LOCAL5", (char *) "LOCAL5", LOG_LOCAL5},
-  {(char *) "LOG_LOCAL6", (char *) "LOCAL6", LOG_LOCAL6},
-  {(char *) "LOG_LOCAL7", (char *) "LOCAL7", LOG_LOCAL7},
-  {(char *) "INVALID_LOG_FAC", (char *) "INVALID", -1}
-};
+static const syslog_fac convert_table[] = {{(char *)"LOG_KERN", (char *) "KERN", LOG_KERN},
+                                           {(char *)"LOG_USER", (char *) "USER", LOG_USER},
+                                           {(char *)"LOG_MAIL", (char *) "MAIL", LOG_MAIL},
+                                           {(char *)"LOG_DAEMON", (char *) "DAEMON", LOG_DAEMON},
+                                           {(char *)"LOG_AUTH", (char *) "AUTH", LOG_AUTH},
+                                           {(char *)"LOG_LPR", (char *) "LPR", LOG_LPR},
+                                           {(char *)"LOG_NEWS", (char *) "NEWS", LOG_NEWS},
+                                           {(char *)"LOG_UUCP", (char *) "UUCP", LOG_UUCP},
+                                           {(char *)"LOG_CRON", (char *) "CRON", LOG_CRON},
+                                           {(char *)"LOG_LOCAL0", (char *) "LOCAL0", LOG_LOCAL0},
+                                           {(char *)"LOG_LOCAL1", (char *) "LOCAL1", LOG_LOCAL1},
+                                           {(char *)"LOG_LOCAL2", (char *) "LOCAL2", LOG_LOCAL2},
+                                           {(char *)"LOG_LOCAL3", (char *) "LOCAL3", LOG_LOCAL3},
+                                           {(char *)"LOG_LOCAL4", (char *) "LOCAL4", LOG_LOCAL4},
+                                           {(char *)"LOG_LOCAL5", (char *) "LOCAL5", LOG_LOCAL5},
+                                           {(char *)"LOG_LOCAL6", (char *) "LOCAL6", LOG_LOCAL6},
+                                           {(char *)"LOG_LOCAL7", (char *) "LOCAL7", LOG_LOCAL7},
+                                           {(char *)"INVALID_LOG_FAC", (char *) "INVALID", -1}};
 static const int convert_table_size = sizeof(convert_table) / sizeof(syslog_fac) - 1;
 
 // int facility_string_to_int(const char* str)
@@ -69,7 +66,6 @@ static const int convert_table_size = sizeof(convert_table) / sizeof(syslog_fac)
 int
 facility_string_to_int(const char *str)
 {
-
   if (str == NULL) {
     return -1;
   }
@@ -78,7 +74,6 @@ facility_string_to_int(const char *str)
     if (strcasecmp(convert_table[i].long_str, str) == 0 || strcasecmp(convert_table[i].short_str, str) == 0) {
       return convert_table[i].fac_int;
     }
-
   }
   return -1;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_thread.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_thread.cc b/lib/ts/ink_thread.cc
index 3894d38..ef38815 100644
--- a/lib/ts/ink_thread.cc
+++ b/lib/ts/ink_thread.cc
@@ -43,9 +43,9 @@ static int64_t ink_semaphore_count = 0;
 #endif
 
 void
-ink_sem_init(ink_semaphore * sp, unsigned int count)
+ink_sem_init(ink_semaphore *sp, unsigned int count)
 {
-  // Darwin has sem_open, but not sem_init. We emulate sem_init with sem_open.
+// Darwin has sem_open, but not sem_init. We emulate sem_init with sem_open.
 #if TS_EMULATE_ANON_SEMAPHORES
   char sname[NAME_MAX];
 
@@ -63,7 +63,7 @@ ink_sem_init(ink_semaphore * sp, unsigned int count)
 }
 
 void
-ink_sem_destroy(ink_semaphore * sp)
+ink_sem_destroy(ink_semaphore *sp)
 {
 #if TS_EMULATE_ANON_SEMAPHORES
   ink_assert(sem_close(sp->get()) != -1);
@@ -73,24 +73,26 @@ ink_sem_destroy(ink_semaphore * sp)
 }
 
 void
-ink_sem_wait(ink_semaphore * sp)
+ink_sem_wait(ink_semaphore *sp)
 {
   int r;
-  while (EINTR == (r = sem_wait(sp->get())));
+  while (EINTR == (r = sem_wait(sp->get())))
+    ;
   ink_assert(!r);
 }
 
 bool
-ink_sem_trywait(ink_semaphore * sp)
+ink_sem_trywait(ink_semaphore *sp)
 {
   int r;
-  while (EINTR == (r = sem_trywait(sp->get())));
+  while (EINTR == (r = sem_trywait(sp->get())))
+    ;
   ink_assert(r == 0 || (errno == EAGAIN));
   return r == 0;
 }
 
 void
-ink_sem_post(ink_semaphore * sp)
+ink_sem_post(ink_semaphore *sp)
 {
   ink_assert(sem_post(sp->get()) != -1);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_thread.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_thread.h b/lib/ts/ink_thread.h
index 0bf2829..0fa4ff7 100644
--- a/lib/ts/ink_thread.h
+++ b/lib/ts/ink_thread.h
@@ -64,13 +64,15 @@ typedef pthread_key_t ink_thread_key;
 
 struct ink_semaphore {
 #if TS_EMULATE_ANON_SEMAPHORES
-  sem_t * sema;
+  sem_t *sema;
   int64_t semid;
 #else
   sem_t sema;
 #endif
 
-  sem_t * get() {
+  sem_t *
+  get()
+  {
 #if TS_EMULATE_ANON_SEMAPHORES
     return sema;
 #else
@@ -103,7 +105,7 @@ typedef timestruc_t ink_timestruc;
 #if defined(POSIX_THREAD)
 
 static inline void
-ink_thread_key_create(ink_thread_key * key, void (*destructor) (void *value))
+ink_thread_key_create(ink_thread_key *key, void (*destructor)(void *value))
 {
   ink_assert(!pthread_key_create(key, destructor));
 }
@@ -128,7 +130,7 @@ ink_thread_key_delete(ink_thread_key key)
 
 
 static inline ink_thread
-ink_thread_create(void *(*f) (void *), void *a, int detached = 0, size_t stacksize = 0)
+ink_thread_create(void *(*f)(void *), void *a, int detached = 0, size_t stacksize = 0)
 {
   ink_thread t;
   int ret;
@@ -153,14 +155,14 @@ ink_thread_create(void *(*f) (void *), void *a, int detached = 0, size_t stacksi
    * Fix for INKqa10118.
    * If the thread has not been created successfully return 0.
    */
-  return ret ? (ink_thread) 0 : t;
+  return ret ? (ink_thread)0 : t;
 }
 
 static inline void
 ink_thread_cancel(ink_thread who)
 {
 #if defined(freebsd)
-  (void) who;
+  (void)who;
   ink_assert(!"not supported");
 #else
   int ret = pthread_cancel(who);
@@ -186,8 +188,8 @@ static inline int
 ink_thread_get_priority(ink_thread t, int *priority)
 {
 #if defined(freebsd)
-  (void) t;
-  (void) priority;
+  (void)t;
+  (void)priority;
   ink_assert(!"not supported");
   return -1;
 #else
@@ -200,7 +202,7 @@ ink_thread_get_priority(ink_thread t, int *priority)
 }
 
 static inline int
-ink_thread_sigsetmask(int how, const sigset_t * set, sigset_t * oset)
+ink_thread_sigsetmask(int how, const sigset_t *set, sigset_t *oset)
 {
   return (pthread_sigmask(how, set, oset));
 }
@@ -209,38 +211,39 @@ ink_thread_sigsetmask(int how, const sigset_t * set, sigset_t * oset)
  * Posix Semaphores
  ******************************************************************/
 
-void ink_sem_init(ink_semaphore * sp, unsigned int count);
-void ink_sem_destroy(ink_semaphore * sp);
-void ink_sem_wait(ink_semaphore * sp);
-bool ink_sem_trywait(ink_semaphore * sp);
-void ink_sem_post(ink_semaphore * sp);
+void ink_sem_init(ink_semaphore *sp, unsigned int count);
+void ink_sem_destroy(ink_semaphore *sp);
+void ink_sem_wait(ink_semaphore *sp);
+bool ink_sem_trywait(ink_semaphore *sp);
+void ink_sem_post(ink_semaphore *sp);
 
 /*******************************************************************
  * Posix Condition Variables
  ******************************************************************/
 
 static inline void
-ink_cond_init(ink_cond * cp)
+ink_cond_init(ink_cond *cp)
 {
   ink_assert(pthread_cond_init(cp, NULL) == 0);
 }
 
 static inline void
-ink_cond_destroy(ink_cond * cp)
+ink_cond_destroy(ink_cond *cp)
 {
   ink_assert(pthread_cond_destroy(cp) == 0);
 }
 
 static inline void
-ink_cond_wait(ink_cond * cp, ink_mutex * mp)
+ink_cond_wait(ink_cond *cp, ink_mutex *mp)
 {
   ink_assert(pthread_cond_wait(cp, mp) == 0);
 }
 static inline int
-ink_cond_timedwait(ink_cond * cp, ink_mutex * mp, ink_timestruc * t)
+ink_cond_timedwait(ink_cond *cp, ink_mutex *mp, ink_timestruc *t)
 {
   int err;
-  while (EINTR == (err = pthread_cond_timedwait(cp, mp, t)));
+  while (EINTR == (err = pthread_cond_timedwait(cp, mp, t)))
+    ;
 #if defined(freebsd) || defined(openbsd)
   ink_assert((err == 0) || (err == ETIMEDOUT));
 #else
@@ -250,13 +253,13 @@ ink_cond_timedwait(ink_cond * cp, ink_mutex * mp, ink_timestruc * t)
 }
 
 static inline void
-ink_cond_signal(ink_cond * cp)
+ink_cond_signal(ink_cond *cp)
 {
   ink_assert(pthread_cond_signal(cp) == 0);
 }
 
 static inline void
-ink_cond_broadcast(ink_cond * cp)
+ink_cond_broadcast(ink_cond *cp)
 {
   ink_assert(pthread_cond_broadcast(cp) == 0);
 }
@@ -277,7 +280,7 @@ ink_thread_exit(void *status)
 // Linux specific... Feel free to add support for other platforms
 // that has a feature to give a thread specific name / tag.
 static inline void
-ink_set_thread_name(const char* name ATS_UNUSED)
+ink_set_thread_name(const char *name ATS_UNUSED)
 {
 #if defined(HAVE_PTHREAD_SETNAME_NP_1)
   pthread_setname_np(name);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_time.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_time.cc b/lib/ts/ink_time.cc
index a40b9f4..38f47fe 100644
--- a/lib/ts/ink_time.cc
+++ b/lib/ts/ink_time.cc
@@ -85,16 +85,14 @@ ink_microseconds(int which)
 double
 ink_time_wall_seconds()
 {
-
   struct timeval s_val;
 
   gettimeofday(&s_val, 0);
-  return ((double) s_val.tv_sec + 0.000001 * s_val.tv_usec);
-}                               /* End ink_time_wall_seconds */
+  return ((double)s_val.tv_sec + 0.000001 * s_val.tv_usec);
+} /* End ink_time_wall_seconds */
 
 
-struct dtconv
-{
+struct dtconv {
   char *abbrev_month_names[12];
   char *month_names[12];
   char *abbrev_weekday_names[7];
@@ -108,14 +106,13 @@ struct dtconv
 };
 
 
-
 /*
  * The man page for cftime lies. It claims that it is thread safe.
  * Instead, it silently trashes the heap (by freeing things more than
  * once) when used in a mulithreaded program. Gack!
  */
 int
-cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock)
+cftime_replacement(char *s, int maxsize, const char *format, const time_t *clock)
 {
   struct tm tm;
 
@@ -127,24 +124,22 @@ cftime_replacement(char *s, int maxsize, const char *format, const time_t * cloc
 #undef cftime
 /* Throw an error if they ever call plain-old cftime. */
 int
-cftime(char *s, char *format, const time_t * clock)
+cftime(char *s, char *format, const time_t *clock)
 {
-  (void) s;
-  (void) format;
-  (void) clock;
+  (void)s;
+  (void)format;
+  (void)clock;
   printf("ERROR cftime is not thread safe -- call cftime_replacement\n");
   ink_assert(!"cftime");
   return 0;
 }
 
-#define DAYS_OFFSET  25508
+#define DAYS_OFFSET 25508
 
 ink_time_t
-convert_tm(const struct tm * tp)
+convert_tm(const struct tm *tp)
 {
-  static const int days[12] = {
-    305, 336, -1, 30, 60, 91, 121, 152, 183, 213, 244, 274
-  };
+  static const int days[12] = {305, 336, -1, 30, 60, 91, 121, 152, 183, 213, 244, 274};
 
   ink_time_t t;
   int year;
@@ -156,8 +151,8 @@ convert_tm(const struct tm * tp)
   mday = tp->tm_mday;
 
   /* what should we do? */
-  if ((year<70) || (year> 137))
-    return (ink_time_t) UNDEFINED_TIME;
+  if ((year < 70) || (year > 137))
+    return (ink_time_t)UNDEFINED_TIME;
 
   mday += days[month];
   /* month base == march */
@@ -172,13 +167,13 @@ convert_tm(const struct tm * tp)
 }
 
 char *
-ink_ctime_r(const ink_time_t * clock, char *buf)
+ink_ctime_r(const ink_time_t *clock, char *buf)
 {
   return ctime_r(clock, buf);
 }
 
 struct tm *
-ink_localtime_r(const ink_time_t * clock, struct tm *res)
+ink_localtime_r(const ink_time_t *clock, struct tm *res)
 {
   return localtime_r(clock, res);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_time.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_time.h b/lib/ts/ink_time.h
index 04d3b1a..1da2373 100644
--- a/lib/ts/ink_time.h
+++ b/lib/ts/ink_time.h
@@ -32,7 +32,7 @@
  ****************************************************************************/
 
 #ifndef _ink_time_h_
-#define	_ink_time_h_
+#define _ink_time_h_
 
 #include "ink_platform.h"
 #include "ink_defs.h"
@@ -60,13 +60,13 @@ typedef time_t ink_time_t;
 uint64_t ink_microseconds(int which);
 double ink_time_wall_seconds();
 
-int cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock);
+int cftime_replacement(char *s, int maxsize, const char *format, const time_t *clock);
 #define cftime(s, format, clock) cftime_replacement(s, 8192, format, clock)
 
 ink_time_t convert_tm(const struct tm *tp);
 
-inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
-inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
+inkcoreapi char *ink_ctime_r(const ink_time_t *clock, char *buf);
+inkcoreapi struct tm *ink_localtime_r(const ink_time_t *clock, struct tm *res);
 
 /*===========================================================================*
                               Inline Stuffage
@@ -82,7 +82,7 @@ ink_timezone()
   return tzp.tz_minuteswest * 60;
 }
 
-#else  // non-freebsd, non-openbsd for the else
+#else // non-freebsd, non-openbsd for the else
 
 inline int
 ink_timezone()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/libts.h
----------------------------------------------------------------------
diff --git a/lib/ts/libts.h b/lib/ts/libts.h
index 8a3d9fa..d244158 100644
--- a/lib/ts/libts.h
+++ b/lib/ts/libts.h
@@ -34,8 +34,8 @@
 
  */
 
-#if !defined (_inktomiplus_h_)
-#define	_inktomiplus_h_
+#if !defined(_inktomiplus_h_)
+#define _inktomiplus_h_
 
 /* Removed for now, to fix build on Solaris
 #define std *** _FIXME_REMOVE_DEPENDENCY_ON_THE_STL_ ***

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/llqueue.cc
----------------------------------------------------------------------
diff --git a/lib/ts/llqueue.cc b/lib/ts/llqueue.cc
index 81125e2..414ecb6 100644
--- a/lib/ts/llqueue.cc
+++ b/lib/ts/llqueue.cc
@@ -38,9 +38,9 @@
 // were supposed to work, but #ifdef'ing them out of here for now.
 #ifdef NOT_USED_HERE
 static LLQrec *
-newrec(LLQ * Q)
+newrec(LLQ *Q)
 {
-  LLQrec * new_val;
+  LLQrec *new_val;
   int i;
 
   if (Q->free != NULL) {
@@ -64,7 +64,7 @@ newrec(LLQ * Q)
 
 // Not used either ...
 static void
-freerec(LLQ * Q, LLQrec * rec)
+freerec(LLQ *Q, LLQrec *rec)
 {
   rec->next = Q->free;
   Q->free = rec;
@@ -74,7 +74,7 @@ freerec(LLQ * Q, LLQrec * rec)
 LLQ *
 create_queue()
 {
-  LLQ * new_val = (LLQ *)ats_malloc(sizeof(LLQ));
+  LLQ *new_val = (LLQ *)ats_malloc(sizeof(LLQ));
 
   ink_sem_init(&(new_val->sema), 0);
   ink_mutex_init(&(new_val->mux), "LLQ::create_queue");
@@ -87,7 +87,7 @@ create_queue()
 
 // matching delete function, only for empty queue!
 void
-delete_queue(LLQ * Q)
+delete_queue(LLQ *Q)
 {
   // There seems to have been some ideas of making sure that this queue is
   // actually empty ...
@@ -100,9 +100,9 @@ delete_queue(LLQ * Q)
 }
 
 int
-enqueue(LLQ * Q, void *data)
+enqueue(LLQ *Q, void *data)
 {
-  LLQrec * new_val;
+  LLQrec *new_val;
 
   ink_mutex_acquire(&(Q->mux));
   new_val = (LLQrec *)ats_malloc(sizeof(LLQrec));
@@ -125,7 +125,7 @@ enqueue(LLQ * Q, void *data)
 }
 
 uint64_t
-queue_len(LLQ * Q)
+queue_len(LLQ *Q)
 {
   uint64_t len;
 
@@ -137,7 +137,7 @@ queue_len(LLQ * Q)
 }
 
 uint64_t
-queue_highwater(LLQ * Q)
+queue_highwater(LLQ *Q)
 {
   uint64_t highwater;
 
@@ -149,7 +149,6 @@ queue_highwater(LLQ * Q)
 }
 
 
-
 /*
  *---------------------------------------------------------------------------
  *
@@ -170,7 +169,7 @@ queue_highwater(LLQ * Q)
  *---------------------------------------------------------------------------
  */
 bool
-queue_is_empty(LLQ * Q)
+queue_is_empty(LLQ *Q)
 {
   uint64_t len;
 
@@ -180,16 +179,15 @@ queue_is_empty(LLQ * Q)
 }
 
 void *
-dequeue(LLQ * Q)
+dequeue(LLQ *Q)
 {
-  LLQrec * rec;
+  LLQrec *rec;
   void *d;
   ink_sem_wait(&(Q->sema));
   ink_mutex_acquire(&(Q->mux));
 
 
   if (Q->head == NULL) {
-
     ink_mutex_release(&(Q->mux));
 
     return NULL;
@@ -202,7 +200,7 @@ dequeue(LLQ * Q)
     Q->tail = NULL;
 
   d = rec->data;
-//freerec(Q, rec);
+  // freerec(Q, rec);
   ats_free(rec);
 
   Q->len--;
@@ -212,7 +210,6 @@ dequeue(LLQ * Q)
 }
 
 
-
 #ifdef LLQUEUE_MAIN
 
 void *
@@ -227,12 +224,12 @@ testfun(void *unused)
   do {
     scanf("%d", &num);
     if (num == 0) {
-      printf("DEQUEUE: %d\n", (int) dequeue(Q));
+      printf("DEQUEUE: %d\n", (int)dequeue(Q));
     } else if (num == -1) {
       printf("queue_is_empty: %d\n", queue_is_empty(Q));
     } else {
       printf("enqueue: %d\n", num);
-      enqueue(Q, (void *) num);
+      enqueue(Q, (void *)num);
     }
   } while (num >= -1);
 
@@ -245,7 +242,7 @@ testfun(void *unused)
 void
 main()
 {
-  assert(thr_create(NULL, 0, testfun, (void *) NULL, THR_NEW_LWP, NULL) == 0);
+  assert(thr_create(NULL, 0, testfun, (void *)NULL, THR_NEW_LWP, NULL) == 0);
   while (1) {
     ;
   }


[20/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Response.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Response.cc b/lib/atscppapi/src/Response.cc
index 2ec042c..b60d4f1 100644
--- a/lib/atscppapi/src/Response.cc
+++ b/lib/atscppapi/src/Response.cc
@@ -26,89 +26,103 @@
 using namespace atscppapi;
 using std::string;
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @private
  */
-struct ResponseState: noncopyable {
+struct ResponseState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   Headers headers_;
-  ResponseState() : hdr_buf_(NULL), hdr_loc_(NULL) { }
+  ResponseState() : hdr_buf_(NULL), hdr_loc_(NULL) {}
 };
-
 }
 
-Response::Response() {
+Response::Response()
+{
   state_ = new ResponseState();
-//  state_->headers_.setType(Headers::TYPE_RESPONSE);
+  //  state_->headers_.setType(Headers::TYPE_RESPONSE);
 }
 
-void Response::init(void *hdr_buf, void *hdr_loc) {
+void
+Response::init(void *hdr_buf, void *hdr_loc)
+{
   state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
   state_->hdr_loc_ = static_cast<TSMLoc>(hdr_loc);
   state_->headers_.reset(state_->hdr_buf_, state_->hdr_loc_);
   LOG_DEBUG("Initializing response %p with hdr_buf=%p and hdr_loc=%p", this, state_->hdr_buf_, state_->hdr_loc_);
 }
 
-HttpVersion Response::getVersion() const {
+HttpVersion
+Response::getVersion() const
+{
   HttpVersion ret_val = HTTP_VERSION_UNKNOWN;
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     ret_val = utils::internal::getHttpVersion(state_->hdr_buf_, state_->hdr_loc_);
-    LOG_DEBUG("Initializing response version to %d [%s] with hdr_buf=%p and hdr_loc=%p",
-        ret_val, HTTP_VERSION_STRINGS[ret_val].c_str(), state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Initializing response version to %d [%s] with hdr_buf=%p and hdr_loc=%p", ret_val,
+              HTTP_VERSION_STRINGS[ret_val].c_str(), state_->hdr_buf_, state_->hdr_loc_);
   }
   return ret_val;
 }
 
-HttpStatus Response::getStatusCode() const {
+HttpStatus
+Response::getStatusCode() const
+{
   HttpStatus ret_val = HTTP_STATUS_UNKNOWN;
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     ret_val = static_cast<HttpStatus>(TSHttpHdrStatusGet(state_->hdr_buf_, state_->hdr_loc_));
-    LOG_DEBUG("Initializing response status code to %d with hdr_buf=%p and hdr_loc=%p",
-        ret_val, state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Initializing response status code to %d with hdr_buf=%p and hdr_loc=%p", ret_val, state_->hdr_buf_,
+              state_->hdr_loc_);
   }
   return ret_val;
 }
 
-void Response::setStatusCode(HttpStatus code) {
+void
+Response::setStatusCode(HttpStatus code)
+{
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     TSHttpHdrStatusSet(state_->hdr_buf_, state_->hdr_loc_, static_cast<TSHttpStatus>(code));
-    LOG_DEBUG("Changing response status code to %d with hdr_buf=%p and hdr_loc=%p",
-        code, state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Changing response status code to %d with hdr_buf=%p and hdr_loc=%p", code, state_->hdr_buf_, state_->hdr_loc_);
   }
 }
 
-string Response::getReasonPhrase() const {
+string
+Response::getReasonPhrase() const
+{
   string ret_str;
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     int length;
     const char *str = TSHttpHdrReasonGet(state_->hdr_buf_, state_->hdr_loc_, &length);
     if (str && length) {
       ret_str.assign(str, length);
-      LOG_DEBUG("Initializing response reason phrase to '%s' with hdr_buf=%p and hdr_loc=%p",
-          ret_str.c_str(), state_->hdr_buf_, state_->hdr_loc_);
+      LOG_DEBUG("Initializing response reason phrase to '%s' with hdr_buf=%p and hdr_loc=%p", ret_str.c_str(), state_->hdr_buf_,
+                state_->hdr_loc_);
     } else {
-      LOG_ERROR("TSHttpHdrReasonGet returned null string or zero length. str=%p, length=%d, hdr_buf=%p, hdr_loc=%p",
-          str, length, state_->hdr_buf_, state_->hdr_loc_);
+      LOG_ERROR("TSHttpHdrReasonGet returned null string or zero length. str=%p, length=%d, hdr_buf=%p, hdr_loc=%p", str, length,
+                state_->hdr_buf_, state_->hdr_loc_);
     }
   }
   return ret_str; // if not initialized, we will just return an empty string
 }
 
-void Response::setReasonPhrase(const string &phrase) {
+void
+Response::setReasonPhrase(const string &phrase)
+{
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     TSHttpHdrReasonSet(state_->hdr_buf_, state_->hdr_loc_, phrase.c_str(), phrase.length());
-    LOG_DEBUG("Changing response reason phrase to '%s' with hdr_buf=%p and hdr_loc=%p",
-        phrase.c_str(), state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Changing response reason phrase to '%s' with hdr_buf=%p and hdr_loc=%p", phrase.c_str(), state_->hdr_buf_,
+              state_->hdr_loc_);
   }
 }
 
-Headers &Response::getHeaders() const {
-  return state_->headers_;  // if not initialized, we will just return an empty object
+Headers &
+Response::getHeaders() const
+{
+  return state_->headers_; // if not initialized, we will just return an empty object
 }
 
-Response::~Response() {
+Response::~Response()
+{
   delete state_;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Stat.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Stat.cc b/lib/atscppapi/src/Stat.cc
index b10082b..0885c84 100644
--- a/lib/atscppapi/src/Stat.cc
+++ b/lib/atscppapi/src/Stat.cc
@@ -28,19 +28,24 @@
 using namespace atscppapi;
 using std::string;
 
-Stat::Stat() : stat_id_(TS_ERROR) {
-// ATS Guarantees that stat ids will always be > 0. So we can use stat_id_ > 0 to
-// verify that this stat has been properly initialized.
+Stat::Stat() : stat_id_(TS_ERROR)
+{
+  // ATS Guarantees that stat ids will always be > 0. So we can use stat_id_ > 0 to
+  // verify that this stat has been properly initialized.
 }
 
-Stat::~Stat() {
-// we really dont have any cleanup since ATS doesn't expose a method to destroy stats
+Stat::~Stat()
+{
+  // we really dont have any cleanup since ATS doesn't expose a method to destroy stats
 }
 
-bool Stat::init(string name, Stat::SyncType type, bool persistent) {
+bool
+Stat::init(string name, Stat::SyncType type, bool persistent)
+{
   // TS_RECORDDATATYPE_INT is the only type currently supported
   // so that's why this api doesn't expose other types, TSStatSync is equivalent to StatSyncType
-  stat_id_ = TSStatCreate(name.c_str(), TS_RECORDDATATYPE_INT, persistent ?  TS_STAT_PERSISTENT : TS_STAT_NON_PERSISTENT, static_cast<TSStatSync>(type));
+  stat_id_ = TSStatCreate(name.c_str(), TS_RECORDDATATYPE_INT, persistent ? TS_STAT_PERSISTENT : TS_STAT_NON_PERSISTENT,
+                          static_cast<TSStatSync>(type));
   if (stat_id_ != TS_ERROR) {
     LOG_DEBUG("Created new stat named '%s' with stat_id = %d", name.c_str(), stat_id_);
   } else {
@@ -58,7 +63,9 @@ bool Stat::init(string name, Stat::SyncType type, bool persistent) {
   return true;
 }
 
-void Stat::set(int64_t value) {
+void
+Stat::set(int64_t value)
+{
   if (stat_id_ == TS_ERROR) {
     return;
   }
@@ -66,7 +73,9 @@ void Stat::set(int64_t value) {
   TSStatIntSet(stat_id_, value);
 }
 
-int64_t Stat::get() const {
+int64_t
+Stat::get() const
+{
   if (stat_id_ == TS_ERROR) {
     return 0;
   }
@@ -74,7 +83,9 @@ int64_t Stat::get() const {
   return TSStatIntGet(stat_id_);
 }
 
-void Stat::increment(int64_t amount) {
+void
+Stat::increment(int64_t amount)
+{
   if (stat_id_ == TS_ERROR) {
     return;
   }
@@ -82,15 +93,12 @@ void Stat::increment(int64_t amount) {
   TSStatIntIncrement(stat_id_, amount);
 }
 
-void Stat::decrement(int64_t amount) {
+void
+Stat::decrement(int64_t amount)
+{
   if (stat_id_ == TS_ERROR) {
     return;
   }
 
   TSStatIntDecrement(stat_id_, amount);
 }
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Transaction.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index b1ff159..823bee7 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -39,7 +39,7 @@ using namespace atscppapi;
 /**
  * @private
  */
-struct atscppapi::TransactionState: noncopyable {
+struct atscppapi::TransactionState : noncopyable {
   TSHttpTxn txn_;
   std::list<TransactionPlugin *> plugins_;
   TSMBuffer client_request_hdr_buf_;
@@ -58,28 +58,28 @@ struct atscppapi::TransactionState: noncopyable {
 
   TransactionState(TSHttpTxn txn, TSMBuffer client_request_hdr_buf, TSMLoc client_request_hdr_loc)
     : txn_(txn), client_request_hdr_buf_(client_request_hdr_buf), client_request_hdr_loc_(client_request_hdr_loc),
-      client_request_(txn, client_request_hdr_buf, client_request_hdr_loc),
-      server_request_hdr_buf_(NULL), server_request_hdr_loc_(NULL),
-      server_response_hdr_buf_(NULL), server_response_hdr_loc_(NULL),
-      client_response_hdr_buf_(NULL), client_response_hdr_loc_(NULL)
-  { };
+      client_request_(txn, client_request_hdr_buf, client_request_hdr_loc), server_request_hdr_buf_(NULL),
+      server_request_hdr_loc_(NULL), server_response_hdr_buf_(NULL), server_response_hdr_loc_(NULL), client_response_hdr_buf_(NULL),
+      client_response_hdr_loc_(NULL){};
 };
 
-Transaction::Transaction(void *raw_txn) {
+Transaction::Transaction(void *raw_txn)
+{
   TSHttpTxn txn = static_cast<TSHttpTxn>(raw_txn);
   TSMBuffer hdr_buf;
   TSMLoc hdr_loc;
-  (void) TSHttpTxnClientReqGet(txn, &hdr_buf, &hdr_loc);
+  (void)TSHttpTxnClientReqGet(txn, &hdr_buf, &hdr_loc);
   if (!hdr_buf || !hdr_loc) {
     LOG_ERROR("TSHttpTxnClientReqGet tshttptxn=%p returned a null hdr_buf=%p or hdr_loc=%p.", txn, hdr_buf, hdr_loc);
   }
 
   state_ = new TransactionState(txn, hdr_buf, hdr_loc);
-  LOG_DEBUG("Transaction tshttptxn=%p constructing Transaction object %p, client req hdr_buf=%p, client req hdr_loc=%p",
-      txn, this, hdr_buf, hdr_loc);
+  LOG_DEBUG("Transaction tshttptxn=%p constructing Transaction object %p, client req hdr_buf=%p, client req hdr_loc=%p", txn, this,
+            hdr_buf, hdr_loc);
 }
 
-Transaction::~Transaction() {
+Transaction::~Transaction()
+{
   LOG_DEBUG("Transaction tshttptxn=%p destroying Transaction object %p", state_->txn_, this);
   static const TSMLoc NULL_PARENT_LOC = NULL;
   TSHandleMLocRelease(state_->client_request_hdr_buf_, NULL_PARENT_LOC, state_->client_request_hdr_loc_);
@@ -98,43 +98,61 @@ Transaction::~Transaction() {
   delete state_;
 }
 
-void Transaction::resume() {
+void
+Transaction::resume()
+{
   TSHttpTxnReenable(state_->txn_, static_cast<TSEvent>(TS_EVENT_HTTP_CONTINUE));
 }
 
-void Transaction::error() {
+void
+Transaction::error()
+{
   LOG_DEBUG("Transaction tshttptxn=%p reenabling to error state", state_->txn_);
   TSHttpTxnReenable(state_->txn_, static_cast<TSEvent>(TS_EVENT_HTTP_ERROR));
 }
 
-void Transaction::error(const std::string &page) {
+void
+Transaction::error(const std::string &page)
+{
   setErrorBody(page);
   error(); // finally, reenable with HTTP_ERROR
 }
 
-void Transaction::setErrorBody(const std::string &page) {
+void
+Transaction::setErrorBody(const std::string &page)
+{
   LOG_DEBUG("Transaction tshttptxn=%p setting error body page: %s", state_->txn_, page.c_str());
   TSHttpTxnErrorBodySet(state_->txn_, TSstrdup(page.c_str()), page.length(), NULL); // Default to text/html
 }
 
-bool Transaction::isInternalRequest() const {
+bool
+Transaction::isInternalRequest() const
+{
   return TSHttpIsInternalRequest(state_->txn_) == TS_SUCCESS;
 }
 
-void *Transaction::getAtsHandle() const {
+void *
+Transaction::getAtsHandle() const
+{
   return static_cast<void *>(state_->txn_);
 }
 
-const std::list<atscppapi::TransactionPlugin *> &Transaction::getPlugins() const {
+const std::list<atscppapi::TransactionPlugin *> &
+Transaction::getPlugins() const
+{
   return state_->plugins_;
 }
 
-void Transaction::addPlugin(TransactionPlugin *plugin) {
+void
+Transaction::addPlugin(TransactionPlugin *plugin)
+{
   LOG_DEBUG("Transaction tshttptxn=%p registering new TransactionPlugin %p.", state_->txn_, plugin);
   state_->plugins_.push_back(plugin);
 }
 
-shared_ptr<Transaction::ContextValue> Transaction::getContextValue(const std::string &key) {
+shared_ptr<Transaction::ContextValue>
+Transaction::getContextValue(const std::string &key)
+{
   shared_ptr<Transaction::ContextValue> return_context_value;
   map<string, shared_ptr<Transaction::ContextValue> >::iterator iter = state_->context_values_.find(key);
   if (iter != state_->context_values_.end()) {
@@ -144,66 +162,92 @@ shared_ptr<Transaction::ContextValue> Transaction::getContextValue(const std::st
   return return_context_value;
 }
 
-void Transaction::setContextValue(const std::string &key, shared_ptr<Transaction::ContextValue> value) {
+void
+Transaction::setContextValue(const std::string &key, shared_ptr<Transaction::ContextValue> value)
+{
   state_->context_values_[key] = value;
 }
 
-ClientRequest &Transaction::getClientRequest() {
+ClientRequest &
+Transaction::getClientRequest()
+{
   return state_->client_request_;
 }
 
-Request &Transaction::getServerRequest() {
+Request &
+Transaction::getServerRequest()
+{
   return state_->server_request_;
 }
 
-Response &Transaction::getServerResponse() {
+Response &
+Transaction::getServerResponse()
+{
   return state_->server_response_;
 }
 
-Response &Transaction::getClientResponse() {
+Response &
+Transaction::getClientResponse()
+{
   return state_->client_response_;
 }
 
-string Transaction::getEffectiveUrl() {
-	string ret_val;
-	int length = 0;
-	char *buf = TSHttpTxnEffectiveUrlStringGet(state_->txn_, &length);
-	if (buf && length) {
-		ret_val.assign(buf, length);
-	}
+string
+Transaction::getEffectiveUrl()
+{
+  string ret_val;
+  int length = 0;
+  char *buf = TSHttpTxnEffectiveUrlStringGet(state_->txn_, &length);
+  if (buf && length) {
+    ret_val.assign(buf, length);
+  }
 
-	if (buf)
-		TSfree(buf);
+  if (buf)
+    TSfree(buf);
 
-	return ret_val;
+  return ret_val;
 }
 
-bool Transaction::setCacheUrl(const string &cache_url) {
+bool
+Transaction::setCacheUrl(const string &cache_url)
+{
   TSReturnCode res = TSCacheUrlSet(state_->txn_, cache_url.c_str(), cache_url.length());
   return (res == TS_SUCCESS);
 }
 
-const sockaddr *Transaction::getIncomingAddress() const {
+const sockaddr *
+Transaction::getIncomingAddress() const
+{
   return TSHttpTxnIncomingAddrGet(state_->txn_);
 }
 
-const sockaddr *Transaction::getClientAddress() const {
+const sockaddr *
+Transaction::getClientAddress() const
+{
   return TSHttpTxnClientAddrGet(state_->txn_);
 }
 
-const sockaddr *Transaction::getNextHopAddress() const {
+const sockaddr *
+Transaction::getNextHopAddress() const
+{
   return TSHttpTxnNextHopAddrGet(state_->txn_);
 }
 
-const sockaddr *Transaction::getServerAddress() const {
+const sockaddr *
+Transaction::getServerAddress() const
+{
   return TSHttpTxnServerAddrGet(state_->txn_);
 }
 
-bool Transaction::setServerAddress(const sockaddr *sockaddress) {
-  return TSHttpTxnServerAddrSet(state_->txn_,sockaddress) == TS_SUCCESS;
+bool
+Transaction::setServerAddress(const sockaddr *sockaddress)
+{
+  return TSHttpTxnServerAddrSet(state_->txn_, sockaddress) == TS_SUCCESS;
 }
 
-bool Transaction::setIncomingPort(uint16_t port) {
+bool
+Transaction::setIncomingPort(uint16_t port)
+{
   TSHttpTxnClientIncomingPortSet(state_->txn_, port);
   return true; // In reality TSHttpTxnClientIncomingPortSet should return SUCCESS or ERROR.
 }
@@ -214,49 +258,61 @@ bool Transaction::setIncomingPort(uint16_t port) {
  * know that it's a server or client response because of the
  * TS C api which is TSHttpTxnServerRespBodyBytesGet.
  */
-size_t Transaction::getServerResponseBodySize() {
+size_t
+Transaction::getServerResponseBodySize()
+{
   return static_cast<size_t>(TSHttpTxnServerRespBodyBytesGet(state_->txn_));
 }
 
-size_t Transaction::getServerResponseHeaderSize() {
+size_t
+Transaction::getServerResponseHeaderSize()
+{
   return static_cast<size_t>(TSHttpTxnServerRespHdrBytesGet(state_->txn_));
 }
 
-size_t Transaction::getClientResponseBodySize() {
+size_t
+Transaction::getClientResponseBodySize()
+{
   return static_cast<size_t>(TSHttpTxnClientRespBodyBytesGet(state_->txn_));
 }
 
-size_t Transaction::getClientResponseHeaderSize() {
+size_t
+Transaction::getClientResponseHeaderSize()
+{
   return static_cast<size_t>(TSHttpTxnClientRespHdrBytesGet(state_->txn_));
 }
 
-void Transaction::setTimeout(Transaction::TimeoutType type, int time_ms) {
+void
+Transaction::setTimeout(Transaction::TimeoutType type, int time_ms)
+{
   switch (type) {
-    case TIMEOUT_DNS:
-      TSHttpTxnDNSTimeoutSet(state_->txn_, time_ms);
-      break;
-    case TIMEOUT_CONNECT:
-      TSHttpTxnConnectTimeoutSet(state_->txn_, time_ms);
-      break;
-    case TIMEOUT_NO_ACTIVITY:
-      TSHttpTxnNoActivityTimeoutSet(state_->txn_, time_ms);
-      break;
-    case TIMEOUT_ACTIVE:
-      TSHttpTxnActiveTimeoutSet(state_->txn_, time_ms);
-      break;
-    default:
-      break;
+  case TIMEOUT_DNS:
+    TSHttpTxnDNSTimeoutSet(state_->txn_, time_ms);
+    break;
+  case TIMEOUT_CONNECT:
+    TSHttpTxnConnectTimeoutSet(state_->txn_, time_ms);
+    break;
+  case TIMEOUT_NO_ACTIVITY:
+    TSHttpTxnNoActivityTimeoutSet(state_->txn_, time_ms);
+    break;
+  case TIMEOUT_ACTIVE:
+    TSHttpTxnActiveTimeoutSet(state_->txn_, time_ms);
+    break;
+  default:
+    break;
   }
 }
 
-void Transaction::redirectTo(std::string const& url) {
-  char* s = ats_strdup(url.c_str());
+void
+Transaction::redirectTo(std::string const &url)
+{
+  char *s = ats_strdup(url.c_str());
   // Must re-alloc the string locally because ownership is transferred to the transaction.
   TSHttpTxnRedirectUrlSet(state_->txn_, s, url.length());
 }
 
-namespace {
-
+namespace
+{
 /**
  * initializeHandles is a convenience functor that takes a pointer to a TS Function that
  * will return the TSMBuffer and TSMLoc for a given server request/response or client/request response
@@ -267,52 +323,59 @@ namespace {
  * @param hdr_loc the address where the mem loc will be storeds
  * @param name name of the entity - used for logging
  */
-class initializeHandles {
+class initializeHandles
+{
 public:
   typedef TSReturnCode (*GetterFunction)(TSHttpTxn, TSMBuffer *, TSMLoc *);
-  initializeHandles(GetterFunction getter) : getter_(getter) { }
-  bool operator()(TSHttpTxn txn, TSMBuffer &hdr_buf, TSMLoc &hdr_loc, const char *handles_name) {
+  initializeHandles(GetterFunction getter) : getter_(getter) {}
+  bool operator()(TSHttpTxn txn, TSMBuffer &hdr_buf, TSMLoc &hdr_loc, const char *handles_name)
+  {
     if (!hdr_buf && !hdr_loc) {
       if (getter_(txn, &hdr_buf, &hdr_loc) == TS_SUCCESS) {
         return true;
-      }
-      else {
+      } else {
         LOG_ERROR("Could not get %s", handles_name);
       }
-    }
-    else {
+    } else {
       LOG_ERROR("%s already initialized", handles_name);
     }
     return false;
   }
+
 private:
   GetterFunction getter_;
 };
 
 } // anonymous namespace
 
-void Transaction::initServerRequest() {
+void
+Transaction::initServerRequest()
+{
   static initializeHandles initializeServerRequestHandles(TSHttpTxnServerReqGet);
-  if (initializeServerRequestHandles(state_->txn_, state_->server_request_hdr_buf_,
-                                     state_->server_request_hdr_loc_, "server request")) {
+  if (initializeServerRequestHandles(state_->txn_, state_->server_request_hdr_buf_, state_->server_request_hdr_loc_,
+                                     "server request")) {
     LOG_DEBUG("Initializing server request");
     state_->server_request_.init(state_->server_request_hdr_buf_, state_->server_request_hdr_loc_);
   }
 }
 
-void Transaction::initServerResponse() {
+void
+Transaction::initServerResponse()
+{
   static initializeHandles initializeServerResponseHandles(TSHttpTxnServerRespGet);
-  if (initializeServerResponseHandles(state_->txn_, state_->server_response_hdr_buf_,
-                                      state_->server_response_hdr_loc_, "server response")) {
+  if (initializeServerResponseHandles(state_->txn_, state_->server_response_hdr_buf_, state_->server_response_hdr_loc_,
+                                      "server response")) {
     LOG_DEBUG("Initializing server response");
     state_->server_response_.init(state_->server_response_hdr_buf_, state_->server_response_hdr_loc_);
   }
 }
 
-void Transaction::initClientResponse() {
+void
+Transaction::initClientResponse()
+{
   static initializeHandles initializeClientResponseHandles(TSHttpTxnClientRespGet);
-  if (initializeClientResponseHandles(state_->txn_, state_->client_response_hdr_buf_,
-                                      state_->client_response_hdr_loc_, "client response")) {
+  if (initializeClientResponseHandles(state_->txn_, state_->client_response_hdr_buf_, state_->client_response_hdr_loc_,
+                                      "client response")) {
     LOG_DEBUG("Initializing client response");
     state_->client_response_.init(state_->client_response_hdr_buf_, state_->client_response_hdr_loc_);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/TransactionPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/TransactionPlugin.cc b/lib/atscppapi/src/TransactionPlugin.cc
index 52af478..537a25c 100644
--- a/lib/atscppapi/src/TransactionPlugin.cc
+++ b/lib/atscppapi/src/TransactionPlugin.cc
@@ -36,17 +36,18 @@ using atscppapi::TransactionPlugin;
 /**
  * @private
  */
-struct atscppapi::TransactionPluginState: noncopyable {
+struct atscppapi::TransactionPluginState : noncopyable {
   TSCont cont_;
   TSHttpTxn ats_txn_handle_;
   shared_ptr<Mutex> mutex_;
-  TransactionPluginState(TSHttpTxn ats_txn_handle) : ats_txn_handle_(ats_txn_handle),
-                                                     mutex_(new Mutex(Mutex::TYPE_RECURSIVE)) { }
+  TransactionPluginState(TSHttpTxn ats_txn_handle) : ats_txn_handle_(ats_txn_handle), mutex_(new Mutex(Mutex::TYPE_RECURSIVE)) {}
 };
 
-namespace {
-
-static int handleTransactionPluginEvents(TSCont cont, TSEvent event, void *edata) {
+namespace
+{
+static int
+handleTransactionPluginEvents(TSCont cont, TSEvent event, void *edata)
+{
   TSHttpTxn txn = static_cast<TSHttpTxn>(edata);
   TransactionPlugin *plugin = static_cast<TransactionPlugin *>(TSContDataGet(cont));
   LOG_DEBUG("cont=%p, event=%d, tshttptxn=%p, plugin=%p", cont, event, edata, plugin);
@@ -56,28 +57,33 @@ static int handleTransactionPluginEvents(TSCont cont, TSEvent event, void *edata
 
 } /* anonymous namespace */
 
-TransactionPlugin::TransactionPlugin(Transaction &transaction) {
+TransactionPlugin::TransactionPlugin(Transaction &transaction)
+{
   state_ = new TransactionPluginState(static_cast<TSHttpTxn>(transaction.getAtsHandle()));
   TSMutex mutex = NULL;
   state_->cont_ = TSContCreate(handleTransactionPluginEvents, mutex);
   TSContDataSet(state_->cont_, static_cast<void *>(this));
-  LOG_DEBUG("Creating new TransactionPlugin=%p tshttptxn=%p, cont=%p", this, state_->ats_txn_handle_,
-            state_->cont_);
+  LOG_DEBUG("Creating new TransactionPlugin=%p tshttptxn=%p, cont=%p", this, state_->ats_txn_handle_, state_->cont_);
 }
 
-shared_ptr<Mutex> TransactionPlugin::getMutex() {
+shared_ptr<Mutex>
+TransactionPlugin::getMutex()
+{
   return state_->mutex_;
 }
 
-TransactionPlugin::~TransactionPlugin() {
+TransactionPlugin::~TransactionPlugin()
+{
   LOG_DEBUG("Destroying TransactionPlugin=%p", this);
   TSContDestroy(state_->cont_);
   delete state_;
 }
 
-void TransactionPlugin::registerHook(Plugin::HookType hook_type) {
-  LOG_DEBUG("TransactionPlugin=%p tshttptxn=%p registering hook_type=%d [%s]", this, state_->ats_txn_handle_,
-            hook_type, HOOK_TYPE_STRINGS[hook_type].c_str());
+void
+TransactionPlugin::registerHook(Plugin::HookType hook_type)
+{
+  LOG_DEBUG("TransactionPlugin=%p tshttptxn=%p registering hook_type=%d [%s]", this, state_->ats_txn_handle_, hook_type,
+            HOOK_TYPE_STRINGS[hook_type].c_str());
   TSHttpHookID hook_id = atscppapi::utils::internal::convertInternalHookToTsHook(hook_type);
   TSHttpTxnHookAdd(state_->ats_txn_handle_, hook_id, state_->cont_);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/TransformationPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/TransformationPlugin.cc b/lib/atscppapi/src/TransformationPlugin.cc
index 8c21ea9..8ef496b 100644
--- a/lib/atscppapi/src/TransformationPlugin.cc
+++ b/lib/atscppapi/src/TransformationPlugin.cc
@@ -39,7 +39,7 @@ using atscppapi::TransformationPlugin;
 /**
  * @private
  */
-struct atscppapi::TransformationPluginState: noncopyable {
+struct atscppapi::TransformationPluginState : noncopyable {
   TSVConn vconn_;
   Transaction &transaction_;
   TransformationPlugin &transformation_plugin_;
@@ -59,15 +59,16 @@ struct atscppapi::TransformationPluginState: noncopyable {
   std::string request_xform_output_; // in case of request xform, data produced is buffered here
 
   TransformationPluginState(atscppapi::Transaction &transaction, TransformationPlugin &transformation_plugin,
-      TransformationPlugin::Type type, TSHttpTxn txn)
-    : vconn_(NULL), transaction_(transaction), transformation_plugin_(transformation_plugin), type_(type),
-      output_vio_(NULL), txn_(txn), output_buffer_(NULL), output_buffer_reader_(NULL), bytes_written_(0),
-      input_complete_dispatched_(false) {
+                            TransformationPlugin::Type type, TSHttpTxn txn)
+    : vconn_(NULL), transaction_(transaction), transformation_plugin_(transformation_plugin), type_(type), output_vio_(NULL),
+      txn_(txn), output_buffer_(NULL), output_buffer_reader_(NULL), bytes_written_(0), input_complete_dispatched_(false)
+  {
     output_buffer_ = TSIOBufferCreate();
     output_buffer_reader_ = TSIOBufferReaderAlloc(output_buffer_);
   };
 
-  ~TransformationPluginState() {
+  ~TransformationPluginState()
+  {
     if (output_buffer_reader_) {
       TSIOBufferReaderFree(output_buffer_reader_);
       output_buffer_reader_ = NULL;
@@ -80,15 +81,19 @@ struct atscppapi::TransformationPluginState: noncopyable {
   }
 };
 
-namespace {
-
-void cleanupTransformation(TSCont contp) {
+namespace
+{
+void
+cleanupTransformation(TSCont contp)
+{
   LOG_DEBUG("Destroying transformation contp=%p", contp);
   TSContDataSet(contp, reinterpret_cast<void *>(0xDEADDEAD));
   TSContDestroy(contp);
 }
 
-int handleTransformationPluginRead(TSCont contp, TransformationPluginState *state) {
+int
+handleTransformationPluginRead(TSCont contp, TransformationPluginState *state)
+{
   // Traffic Server naming is quite confusing, in this context the write_vio
   // is actually the vio we read from.
   TSVIO write_vio = TSVConnWriteVIOGet(contp);
@@ -102,11 +107,14 @@ int handleTransformationPluginRead(TSCont contp, TransformationPluginState *stat
        * the amount of data actually in the read buffer.
        **/
       int64_t avail = TSIOBufferReaderAvail(TSVIOReaderGet(write_vio));
-      LOG_DEBUG("Transformation contp=%p write_vio=%p, to_read=%" PRId64 ", buffer reader avail=%" PRId64, contp, write_vio, to_read, avail);
+      LOG_DEBUG("Transformation contp=%p write_vio=%p, to_read=%" PRId64 ", buffer reader avail=%" PRId64, contp, write_vio,
+                to_read, avail);
 
       if (to_read > avail) {
         to_read = avail;
-        LOG_DEBUG("Transformation contp=%p write_vio=%p, to read > avail, fixing to_read to be equal to avail. to_read=%" PRId64 ", buffer reader avail=%" PRId64, contp, write_vio, to_read, avail);
+        LOG_DEBUG("Transformation contp=%p write_vio=%p, to read > avail, fixing to_read to be equal to avail. to_read=%" PRId64
+                  ", buffer reader avail=%" PRId64,
+                  contp, write_vio, to_read, avail);
       }
 
       if (to_read > 0) {
@@ -133,7 +141,7 @@ int handleTransformationPluginRead(TSCont contp, TransformationPluginState *stat
 
         /* Now call the client to tell them about data */
         if (in_data.length() > 0) {
-           state->transformation_plugin_.consume(in_data);
+          state->transformation_plugin_.consume(in_data);
         }
       }
 
@@ -141,7 +149,8 @@ int handleTransformationPluginRead(TSCont contp, TransformationPluginState *stat
       TSCont vio_cont = TSVIOContGet(write_vio); // for some reason this can occasionally be null
 
       if (TSVIONTodoGet(write_vio) > 0) {
-        LOG_DEBUG("Transformation contp=%p write_vio=%p, vio_cont=%p still has bytes left to process, todo > 0.", contp, write_vio, vio_cont);
+        LOG_DEBUG("Transformation contp=%p write_vio=%p, vio_cont=%p still has bytes left to process, todo > 0.", contp, write_vio,
+                  vio_cont);
 
         if (to_read > 0) {
           TSVIOReenable(write_vio);
@@ -152,15 +161,16 @@ int handleTransformationPluginRead(TSCont contp, TransformationPluginState *stat
           }
         }
       } else {
-        LOG_DEBUG("Transformation contp=%p write_vio=%p, vio_cont=%p has no bytes left to process, will send WRITE_COMPLETE.", contp, write_vio, vio_cont);
+        LOG_DEBUG("Transformation contp=%p write_vio=%p, vio_cont=%p has no bytes left to process, will send WRITE_COMPLETE.",
+                  contp, write_vio, vio_cont);
 
         /* Call back the write VIO continuation to let it know that we have completed the write operation. */
         if (!state->input_complete_dispatched_) {
-         state->transformation_plugin_.handleInputComplete();
-         state->input_complete_dispatched_ = true;
-         if (vio_cont && 0 != TSVIOBufferGet(write_vio)) {
-           TSContCall(vio_cont, static_cast<TSEvent>(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
-         }
+          state->transformation_plugin_.handleInputComplete();
+          state->input_complete_dispatched_ = true;
+          if (vio_cont && 0 != TSVIOBufferGet(write_vio)) {
+            TSContCall(vio_cont, static_cast<TSEvent>(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
+          }
         }
       }
     } else {
@@ -169,11 +179,11 @@ int handleTransformationPluginRead(TSCont contp, TransformationPluginState *stat
 
       /* Call back the write VIO continuation to let it know that we have completed the write operation. */
       if (!state->input_complete_dispatched_) {
-       state->transformation_plugin_.handleInputComplete();
-       state->input_complete_dispatched_ = true;
-       if (vio_cont && 0 != TSVIOBufferGet(write_vio)) {
-         TSContCall(vio_cont, static_cast<TSEvent>(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
-       }
+        state->transformation_plugin_.handleInputComplete();
+        state->input_complete_dispatched_ = true;
+        if (vio_cont && 0 != TSVIOBufferGet(write_vio)) {
+          TSContCall(vio_cont, static_cast<TSEvent>(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
+        }
       }
     }
   } else {
@@ -182,7 +192,9 @@ int handleTransformationPluginRead(TSCont contp, TransformationPluginState *stat
   return 0;
 }
 
-int handleTransformationPluginEvents(TSCont contp, TSEvent event, void *edata) {
+int
+handleTransformationPluginEvents(TSCont contp, TSEvent event, void *edata)
+{
   TransformationPluginState *state = static_cast<TransformationPluginState *>(TSContDataGet(contp));
   LOG_DEBUG("Transformation contp=%p event=%d edata=%p tshttptxn=%p", contp, event, edata, state->txn_);
 
@@ -196,8 +208,9 @@ int handleTransformationPluginEvents(TSCont contp, TSEvent event, void *edata) {
 
   if (event == TS_EVENT_VCONN_WRITE_COMPLETE) {
     TSVConn output_vconn = TSTransformOutputVConnGet(state->vconn_);
-    LOG_DEBUG("Transformation contp=%p tshttptxn=%p received WRITE_COMPLETE, shutting down outputvconn=%p ", contp, state->txn_, output_vconn);
-    TSVConnShutdown(output_vconn, 0, 1);  // The other end is done reading our output
+    LOG_DEBUG("Transformation contp=%p tshttptxn=%p received WRITE_COMPLETE, shutting down outputvconn=%p ", contp, state->txn_,
+              output_vconn);
+    TSVConnShutdown(output_vconn, 0, 1); // The other end is done reading our output
     return 0;
   } else if (event == TS_EVENT_ERROR) {
     TSVIO write_vio;
@@ -206,7 +219,8 @@ int handleTransformationPluginEvents(TSCont contp, TSEvent event, void *edata) {
      our parent transformation. */
     write_vio = TSVConnWriteVIOGet(state->vconn_);
     TSCont vio_cont = TSVIOContGet(write_vio);
-    LOG_ERROR("Transformation contp=%p tshttptxn=%p received EVENT_ERROR forwarding to write_vio=%p viocont=%p", contp, state->txn_, write_vio, vio_cont);
+    LOG_ERROR("Transformation contp=%p tshttptxn=%p received EVENT_ERROR forwarding to write_vio=%p viocont=%p", contp, state->txn_,
+              write_vio, vio_cont);
     if (vio_cont) {
       TSContCall(vio_cont, TS_EVENT_ERROR, write_vio);
     }
@@ -220,21 +234,26 @@ int handleTransformationPluginEvents(TSCont contp, TSEvent event, void *edata) {
 } /* anonymous namespace */
 
 TransformationPlugin::TransformationPlugin(Transaction &transaction, TransformationPlugin::Type type)
-  : TransactionPlugin(transaction) {
+  : TransactionPlugin(transaction)
+{
   state_ = new TransformationPluginState(transaction, *this, type, static_cast<TSHttpTxn>(transaction.getAtsHandle()));
   state_->vconn_ = TSTransformCreate(handleTransformationPluginEvents, state_->txn_);
   TSContDataSet(state_->vconn_, static_cast<void *>(state_)); // edata in a TransformationHandler is NOT a TSHttpTxn.
-  LOG_DEBUG("Creating TransformationPlugin=%p (vconn)contp=%p tshttptxn=%p transformation_type=%d", this, state_->vconn_, state_->txn_, type);
+  LOG_DEBUG("Creating TransformationPlugin=%p (vconn)contp=%p tshttptxn=%p transformation_type=%d", this, state_->vconn_,
+            state_->txn_, type);
   TSHttpTxnHookAdd(state_->txn_, utils::internal::convertInternalTransformationTypeToTsHook(type), state_->vconn_);
 }
 
-TransformationPlugin::~TransformationPlugin() {
+TransformationPlugin::~TransformationPlugin()
+{
   LOG_DEBUG("Destroying TransformationPlugin=%p", this);
   cleanupTransformation(state_->vconn_);
   delete state_;
 }
 
-size_t TransformationPlugin::doProduce(const std::string &data) {
+size_t
+TransformationPlugin::doProduce(const std::string &data)
+{
   LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p producing output with length=%ld", this, state_->txn_, data.length());
   int64_t write_length = static_cast<int64_t>(data.length());
   if (!write_length) {
@@ -249,14 +268,14 @@ size_t TransformationPlugin::doProduce(const std::string &data) {
       // You always write INT64_MAX, this basically says you're not sure how much data you're going to write
       state_->output_vio_ = TSVConnWrite(output_vconn, state_->vconn_, state_->output_buffer_reader_, INT64_MAX);
     } else {
-      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p output_vconn=%p cannot issue TSVConnWrite due to null output vconn.",
-          this, state_->txn_, output_vconn);
+      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p output_vconn=%p cannot issue TSVConnWrite due to null output vconn.", this,
+                state_->txn_, output_vconn);
       return 0;
     }
 
     if (!state_->output_vio_) {
-      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p state_->output_vio=%p, TSVConnWrite failed.",
-          this, state_->txn_, state_->output_vio_);
+      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p state_->output_vio=%p, TSVConnWrite failed.", this, state_->txn_,
+                state_->output_vio_);
       return 0;
     }
   }
@@ -264,58 +283,69 @@ size_t TransformationPlugin::doProduce(const std::string &data) {
   // Finally we can copy this data into the output_buffer
   int64_t bytes_written = TSIOBufferWrite(state_->output_buffer_, data.c_str(), write_length);
   state_->bytes_written_ += bytes_written; // So we can set BytesDone on outputComplete().
-  LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p write to TSIOBuffer %" PRId64 " bytes total bytes written %" PRId64, this, state_->txn_, bytes_written, state_->bytes_written_);
+  LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p write to TSIOBuffer %" PRId64 " bytes total bytes written %" PRId64, this,
+            state_->txn_, bytes_written, state_->bytes_written_);
 
   // Sanity Checks
   if (bytes_written != write_length) {
-    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p bytes written < expected. bytes_written=%" PRId64 " write_length=%" PRId64, this, state_->txn_, bytes_written, write_length);
+    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p bytes written < expected. bytes_written=%" PRId64 " write_length=%" PRId64,
+              this, state_->txn_, bytes_written, write_length);
   }
 
   int connection_closed = TSVConnClosedGet(state_->vconn_);
-  LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p vconn=%p connection_closed=%d", this, state_->txn_, state_->vconn_, connection_closed);
+  LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p vconn=%p connection_closed=%d", this, state_->txn_, state_->vconn_,
+            connection_closed);
 
   if (!connection_closed) {
     TSVIOReenable(state_->output_vio_); // Wake up the downstream vio
   } else {
-    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p output_vio=%p connection_closed=%d : Couldn't reenable output vio (connection closed).", this, state_->txn_, state_->output_vio_, connection_closed);
+    LOG_ERROR(
+      "TransformationPlugin=%p tshttptxn=%p output_vio=%p connection_closed=%d : Couldn't reenable output vio (connection closed).",
+      this, state_->txn_, state_->output_vio_, connection_closed);
   }
 
   return static_cast<size_t>(bytes_written);
 }
 
-size_t TransformationPlugin::produce(const std::string &data) {
+size_t
+TransformationPlugin::produce(const std::string &data)
+{
   if (state_->type_ == REQUEST_TRANSFORMATION) {
     state_->request_xform_output_.append(data);
     return data.size();
-  }
-  else {
+  } else {
     return doProduce(data);
   }
 }
 
-size_t TransformationPlugin::setOutputComplete() {
+size_t
+TransformationPlugin::setOutputComplete()
+{
   if (state_->type_ == REQUEST_TRANSFORMATION) {
     doProduce(state_->request_xform_output_);
   }
 
   int connection_closed = TSVConnClosedGet(state_->vconn_);
-  LOG_DEBUG("OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p connection_closed=%d, total bytes written=%" PRId64, this, state_->txn_, state_->vconn_, connection_closed,state_->bytes_written_);
+  LOG_DEBUG("OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p connection_closed=%d, total bytes written=%" PRId64, this,
+            state_->txn_, state_->vconn_, connection_closed, state_->bytes_written_);
 
   if (!connection_closed && !state_->output_vio_) {
-      LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p output complete without writing any data, initiating write of 0 bytes.", this, state_->txn_);
+    LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p output complete without writing any data, initiating write of 0 bytes.", this,
+              state_->txn_);
 
-      // We're done without ever outputting anything, to correctly
-      // clean up we'll initiate a write then immeidately set it to 0 bytes done.
-      state_->output_vio_ = TSVConnWrite(TSTransformOutputVConnGet(state_->vconn_), state_->vconn_, state_->output_buffer_reader_, 0);
+    // We're done without ever outputting anything, to correctly
+    // clean up we'll initiate a write then immeidately set it to 0 bytes done.
+    state_->output_vio_ = TSVConnWrite(TSTransformOutputVConnGet(state_->vconn_), state_->vconn_, state_->output_buffer_reader_, 0);
 
-      if (state_->output_vio_) {
-        TSVIONDoneSet(state_->output_vio_, 0);
-        TSVIOReenable(state_->output_vio_); // Wake up the downstream vio
-      } else {
-        LOG_ERROR("TransformationPlugin=%p tshttptxn=%p unable to reenable output_vio=%p because VConnWrite failed.", this, state_->txn_, state_->output_vio_);
-      }
+    if (state_->output_vio_) {
+      TSVIONDoneSet(state_->output_vio_, 0);
+      TSVIOReenable(state_->output_vio_); // Wake up the downstream vio
+    } else {
+      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p unable to reenable output_vio=%p because VConnWrite failed.", this,
+                state_->txn_, state_->output_vio_);
+    }
 
-      return 0;
+    return 0;
   }
 
   if (!connection_closed) {
@@ -326,10 +356,12 @@ size_t TransformationPlugin::setOutputComplete() {
       TSVIONBytesSet(state_->output_vio_, state_->bytes_written_);
       TSVIOReenable(state_->output_vio_); // Wake up the downstream vio
     } else {
-      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p unable to reenable output_vio=%p connection was closed=%d.", this, state_->txn_, state_->output_vio_, connection_closed);
+      LOG_ERROR("TransformationPlugin=%p tshttptxn=%p unable to reenable output_vio=%p connection was closed=%d.", this,
+                state_->txn_, state_->output_vio_, connection_closed);
     }
   } else {
-    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p unable to reenable output_vio=%p connection was closed=%d.", this, state_->txn_, state_->output_vio_, connection_closed);
+    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p unable to reenable output_vio=%p connection was closed=%d.", this, state_->txn_,
+              state_->output_vio_, connection_closed);
   }
 
   return state_->bytes_written_;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Url.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Url.cc b/lib/atscppapi/src/Url.cc
index 1b69f4c..177cd9e 100644
--- a/lib/atscppapi/src/Url.cc
+++ b/lib/atscppapi/src/Url.cc
@@ -30,40 +30,47 @@ using std::string;
 /**
  * @private
  */
-struct atscppapi::UrlState: noncopyable {
+struct atscppapi::UrlState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc url_loc_;
-  UrlState(TSMBuffer hdr_buf, TSMLoc url_loc) :
-      hdr_buf_(hdr_buf), url_loc_(url_loc) {
-  }
+  UrlState(TSMBuffer hdr_buf, TSMLoc url_loc) : hdr_buf_(hdr_buf), url_loc_(url_loc) {}
 };
 
-Url::Url() {
+Url::Url()
+{
   state_ = new UrlState(static_cast<TSMBuffer>(NULL), static_cast<TSMLoc>(NULL));
 }
 
-Url::Url(void *hdr_buf, void *url_loc) {
+Url::Url(void *hdr_buf, void *url_loc)
+{
   state_ = new UrlState(static_cast<TSMBuffer>(hdr_buf), static_cast<TSMLoc>(url_loc));
 }
 
-void Url::init(void *hdr_buf, void *url_loc) {
+void
+Url::init(void *hdr_buf, void *url_loc)
+{
   state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
   state_->url_loc_ = static_cast<TSMLoc>(url_loc);
 }
 
-Url::~Url() {
+Url::~Url()
+{
   delete state_;
 }
 
-bool inline Url::isInitialized() const {
+bool inline Url::isInitialized() const
+{
   return state_->hdr_buf_ && state_->url_loc_;
 }
 
-void Url::reset() {
-
+void
+Url::reset()
+{
 }
 
-std::string Url::getUrlString() const {
+std::string
+Url::getUrlString() const
+{
   std::string ret_str;
   if (isInitialized()) {
     int length;
@@ -73,14 +80,16 @@ std::string Url::getUrlString() const {
       TSfree(memptr);
       LOG_DEBUG("Got URL [%s]", ret_str.c_str());
     } else {
-      LOG_ERROR("Got null/zero-length URL string; hdr_buf %p, url_loc %p, ptr %p, length %d", state_->hdr_buf_,
-                state_->url_loc_, memptr, length);
+      LOG_ERROR("Got null/zero-length URL string; hdr_buf %p, url_loc %p, ptr %p, length %d", state_->hdr_buf_, state_->url_loc_,
+                memptr, length);
     }
   }
   return ret_str;
 }
 
-std::string Url::getPath() const {
+std::string
+Url::getPath() const
+{
   std::string ret_str;
   if (isInitialized()) {
     int length;
@@ -93,7 +102,9 @@ std::string Url::getPath() const {
   return ret_str;
 }
 
-std::string Url::getQuery() const {
+std::string
+Url::getQuery() const
+{
   std::string ret_str;
   if (isInitialized()) {
     int length;
@@ -106,7 +117,9 @@ std::string Url::getQuery() const {
   return ret_str;
 }
 
-std::string Url::getScheme() const {
+std::string
+Url::getScheme() const
+{
   std::string ret_str;
   if (isInitialized()) {
     int length;
@@ -119,7 +132,9 @@ std::string Url::getScheme() const {
   return ret_str;
 }
 
-std::string Url::getHost() const {
+std::string
+Url::getHost() const
+{
   std::string ret_str;
   if (isInitialized()) {
     int length;
@@ -132,7 +147,9 @@ std::string Url::getHost() const {
   return ret_str;
 }
 
-uint16_t Url::getPort() const {
+uint16_t
+Url::getPort() const
+{
   uint16_t ret_val = 0;
   if (isInitialized()) {
     ret_val = static_cast<uint16_t>(TSUrlPortGet(state_->hdr_buf_, state_->url_loc_));
@@ -141,7 +158,9 @@ uint16_t Url::getPort() const {
   return ret_val;
 }
 
-void Url::setPath(const std::string &path) {
+void
+Url::setPath(const std::string &path)
+{
   if (!isInitialized()) {
     LOG_ERROR("Url %p not initialized", this);
     return;
@@ -154,7 +173,9 @@ void Url::setPath(const std::string &path) {
   }
 }
 
-void Url::setQuery(const std::string &query) {
+void
+Url::setQuery(const std::string &query)
+{
   if (!isInitialized()) {
     LOG_ERROR("Url %p not initialized", this);
     return;
@@ -167,9 +188,12 @@ void Url::setQuery(const std::string &query) {
   }
 }
 
-void Url::setScheme(const std::string &scheme) {
+void
+Url::setScheme(const std::string &scheme)
+{
   if (!isInitialized()) {
-    LOG_ERROR("Url %p not initialized", this);;
+    LOG_ERROR("Url %p not initialized", this);
+    ;
     return;
   }
 
@@ -180,7 +204,9 @@ void Url::setScheme(const std::string &scheme) {
   }
 }
 
-void Url::setHost(const std::string &host) {
+void
+Url::setHost(const std::string &host)
+{
   if (!isInitialized()) {
     LOG_ERROR("Url %p not initialized", this);
     return;
@@ -193,7 +219,9 @@ void Url::setHost(const std::string &host) {
   }
 }
 
-void Url::setPort(const uint16_t port) {
+void
+Url::setPort(const uint16_t port)
+{
   if (!isInitialized()) {
     LOG_ERROR("Url %p not initialized", this);
     return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Async.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Async.h b/lib/atscppapi/src/include/atscppapi/Async.h
index 72e0eb5..56aaa2a 100644
--- a/lib/atscppapi/src/include/atscppapi/Async.h
+++ b/lib/atscppapi/src/include/atscppapi/Async.h
@@ -29,8 +29,8 @@
 #include <atscppapi/noncopyable.h>
 #include <atscppapi/shared_ptr.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @private
  *
@@ -38,7 +38,8 @@ namespace atscppapi {
  * is used to dispatch an event to a receiver. This interface exists so that the types in this
  * header file can be defined.
  */
-class AsyncDispatchControllerBase : noncopyable {
+class AsyncDispatchControllerBase : noncopyable
+{
 public:
   /**
    * Dispatches an async event to a receiver.
@@ -53,7 +54,7 @@ public:
   /** Returns true if receiver can be communicated with */
   virtual bool isEnabled() = 0;
 
-  virtual ~AsyncDispatchControllerBase() { }
+  virtual ~AsyncDispatchControllerBase() {}
 };
 
 /**
@@ -63,7 +64,8 @@ public:
  * handles this case. Because of this decoupling, it is the responsibility of the provider
  * to manage it's expiration - self-destruct on completion is a good option.
  */
-class AsyncProvider {
+class AsyncProvider
+{
 public:
   /**
    * This method is invoked when the async operation is requested. This call should be used
@@ -74,20 +76,28 @@ public:
 
   /** Base implementation just breaks communication channel with receiver. Implementations
    * should add business logic here. */
-  virtual void cancel() {
+  virtual void
+  cancel()
+  {
     if (dispatch_controller_) {
       dispatch_controller_->disable();
     }
   }
 
-  virtual ~AsyncProvider() { }
+  virtual ~AsyncProvider() {}
 
 protected:
-  shared_ptr<AsyncDispatchControllerBase> getDispatchController() { return dispatch_controller_; }
+  shared_ptr<AsyncDispatchControllerBase>
+  getDispatchController()
+  {
+    return dispatch_controller_;
+  }
 
 private:
   shared_ptr<AsyncDispatchControllerBase> dispatch_controller_;
-  void doRun(shared_ptr<AsyncDispatchControllerBase> dispatch_controller) {
+  void
+  doRun(shared_ptr<AsyncDispatchControllerBase> dispatch_controller)
+  {
     dispatch_controller_ = dispatch_controller;
     run();
   }
@@ -100,10 +110,13 @@ private:
  * @brief Dispatch controller implementation. When invoking the receiver, it verifies that the
  * receiver is still alive, locks the mutex and then invokes handleAsyncComplete().
  */
-template<typename AsyncEventReceiverType, typename AsyncProviderType>
-class AsyncDispatchController : public AsyncDispatchControllerBase {
+template <typename AsyncEventReceiverType, typename AsyncProviderType>
+class AsyncDispatchController : public AsyncDispatchControllerBase
+{
 public:
-  bool dispatch() {
+  bool
+  dispatch()
+  {
     bool ret = false;
     ScopedSharedMutexLock scopedLock(dispatch_mutex_);
     if (event_receiver_) {
@@ -113,12 +126,16 @@ public:
     return ret;
   }
 
-  void disable() {
+  void
+  disable()
+  {
     ScopedSharedMutexLock scopedLock(dispatch_mutex_);
     event_receiver_ = NULL;
   }
 
-  bool isEnabled() {
+  bool
+  isEnabled()
+  {
     return (event_receiver_ != NULL);
   }
 
@@ -129,14 +146,17 @@ public:
    * @param provider Async operation provider that is passed to the receiver on dispatch.
    * @param mutex Mutex of the receiver that is locked during the dispatch
    */
-  AsyncDispatchController(AsyncEventReceiverType *event_receiver, AsyncProviderType *provider, shared_ptr<Mutex> mutex) :
-    event_receiver_(event_receiver), dispatch_mutex_(mutex), provider_(provider) {
+  AsyncDispatchController(AsyncEventReceiverType *event_receiver, AsyncProviderType *provider, shared_ptr<Mutex> mutex)
+    : event_receiver_(event_receiver), dispatch_mutex_(mutex), provider_(provider)
+  {
   }
 
-  virtual ~AsyncDispatchController() { }
+  virtual ~AsyncDispatchController() {}
+
 public:
   AsyncEventReceiverType *event_receiver_;
   shared_ptr<Mutex> dispatch_mutex_;
+
 private:
   AsyncProviderType *provider_;
 };
@@ -148,16 +168,20 @@ private:
  * alive to receive the async complete dispatch. When the receiver dies, this promise is
  * broken and it automatically updates the dispatch controller.
  */
-template<typename AsyncEventReceiverType, typename AsyncProviderType>
-class AsyncReceiverPromise : noncopyable {
+template <typename AsyncEventReceiverType, typename AsyncProviderType> class AsyncReceiverPromise : noncopyable
+{
 public:
-  AsyncReceiverPromise(shared_ptr<AsyncDispatchController<AsyncEventReceiverType, AsyncProviderType> > dispatch_controller) :
-    dispatch_controller_(dispatch_controller) { }
+  AsyncReceiverPromise(shared_ptr<AsyncDispatchController<AsyncEventReceiverType, AsyncProviderType> > dispatch_controller)
+    : dispatch_controller_(dispatch_controller)
+  {
+  }
 
-  ~AsyncReceiverPromise() {
+  ~AsyncReceiverPromise()
+  {
     ScopedSharedMutexLock scopedLock(dispatch_controller_->dispatch_mutex_);
     dispatch_controller_->event_receiver_ = NULL;
   }
+
 protected:
   shared_ptr<AsyncDispatchController<AsyncEventReceiverType, AsyncProviderType> > dispatch_controller_;
 };
@@ -166,8 +190,8 @@ protected:
  * @brief AsyncReceiver is the interface that receivers of async operations must implement. It is
  * templated on the type of the async operation provider.
  */
-template<typename AsyncProviderType>
-class AsyncReceiver : noncopyable {
+template <typename AsyncProviderType> class AsyncReceiver : noncopyable
+{
 public:
   /**
    * This method is invoked when the async operation is completed. The
@@ -177,10 +201,12 @@ public:
    * @param provider A reference to the provider which completed the async operation.
    */
   virtual void handleAsyncComplete(AsyncProviderType &provider) = 0;
-  virtual ~AsyncReceiver() { }
+  virtual ~AsyncReceiver() {}
+
 protected:
-  AsyncReceiver() { }
+  AsyncReceiver() {}
   friend class Async;
+
 private:
   mutable std::list<shared_ptr<AsyncReceiverPromise<AsyncReceiver<AsyncProviderType>, AsyncProviderType> > > receiver_promises_;
 };
@@ -188,7 +214,8 @@ private:
 /**
  * @brief This class provides a method to create an async operation.
  */
-class Async : noncopyable {
+class Async : noncopyable
+{
 public:
   /**
    * This method sets up the dispatch controller to link the async operation provider and
@@ -201,20 +228,21 @@ public:
    *              TransactionPlugin::getMutex() here and global plugins can pass an appropriate
    *              or NULL mutex.
    */
-  template<typename AsyncProviderType>
-  static void execute(AsyncReceiver<AsyncProviderType> *event_receiver, AsyncProviderType *provider, shared_ptr<Mutex> mutex) {
+  template <typename AsyncProviderType>
+  static void
+  execute(AsyncReceiver<AsyncProviderType> *event_receiver, AsyncProviderType *provider, shared_ptr<Mutex> mutex)
+  {
     if (!mutex.get()) {
       mutex.reset(new Mutex(Mutex::TYPE_RECURSIVE));
     }
-    shared_ptr<AsyncDispatchController<AsyncReceiver<AsyncProviderType>, AsyncProviderType > > dispatcher(
-      new AsyncDispatchController<AsyncReceiver<AsyncProviderType>, AsyncProviderType >(event_receiver, provider, mutex));
-    shared_ptr<AsyncReceiverPromise<AsyncReceiver<AsyncProviderType>, AsyncProviderType > > receiver_promise(
-      new AsyncReceiverPromise<AsyncReceiver<AsyncProviderType>, AsyncProviderType >(dispatcher));
+    shared_ptr<AsyncDispatchController<AsyncReceiver<AsyncProviderType>, AsyncProviderType> > dispatcher(
+      new AsyncDispatchController<AsyncReceiver<AsyncProviderType>, AsyncProviderType>(event_receiver, provider, mutex));
+    shared_ptr<AsyncReceiverPromise<AsyncReceiver<AsyncProviderType>, AsyncProviderType> > receiver_promise(
+      new AsyncReceiverPromise<AsyncReceiver<AsyncProviderType>, AsyncProviderType>(dispatcher));
     event_receiver->receiver_promises_.push_back(receiver_promise); // now if the event receiver dies, we're safe.
     provider->doRun(dispatcher);
   }
 };
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h b/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
index 35f5091..57d40e0 100644
--- a/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
+++ b/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
@@ -30,11 +30,14 @@
 #include <atscppapi/Request.h>
 #include <atscppapi/Response.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 // forward declarations
 struct AsyncHttpFetchState;
-namespace utils { class internal; }
+namespace utils
+{
+  class internal;
+}
 
 /**
  * @brief This class provides an implementation of AsyncProvider that
@@ -43,7 +46,8 @@ namespace utils { class internal; }
  *
  * See example async_http_fetch{,_streaming} for sample usage.
  */
-class AsyncHttpFetch : public AsyncProvider {
+class AsyncHttpFetch : public AsyncProvider
+{
 public:
   /** Deprecated. Use variant with streaming flag argument */
   AsyncHttpFetch(const std::string &url_str, HttpMethod http_method = HTTP_METHOD_GET);
@@ -53,11 +57,10 @@ public:
 
   enum StreamingFlag {
     STREAMING_DISABLED = 0,
-    STREAMING_ENABLED = 0x1
+    STREAMING_ENABLED = 0x1,
   };
 
-  AsyncHttpFetch(const std::string &url_str, StreamingFlag streaming_flag,
-                 HttpMethod http_method = HTTP_METHOD_GET);
+  AsyncHttpFetch(const std::string &url_str, StreamingFlag streaming_flag, HttpMethod http_method = HTTP_METHOD_GET);
 
   AsyncHttpFetch(const std::string &url_str, StreamingFlag streaming_flag, const std::string &request_body);
 
@@ -68,8 +71,14 @@ public:
    */
   Headers &getRequestHeaders();
 
-  enum Result { RESULT_SUCCESS = 10000, RESULT_TIMEOUT, RESULT_FAILURE, RESULT_HEADER_COMPLETE,
-                RESULT_PARTIAL_BODY, RESULT_BODY_COMPLETE };
+  enum Result {
+    RESULT_SUCCESS = 10000,
+    RESULT_TIMEOUT,
+    RESULT_FAILURE,
+    RESULT_HEADER_COMPLETE,
+    RESULT_PARTIAL_BODY,
+    RESULT_BODY_COMPLETE
+  };
 
   /**
    * Used to extract the response after request completion. Without
@@ -115,13 +124,13 @@ public:
    * Starts a HTTP fetch of the Request contained.
    */
   virtual void run();
+
 protected:
   virtual ~AsyncHttpFetch();
 
 private:
   AsyncHttpFetchState *state_;
-  void init(const std::string &url_str, HttpMethod http_method, const std::string &request_body,
-            StreamingFlag streaming_flag);
+  void init(const std::string &url_str, HttpMethod http_method, const std::string &request_body, StreamingFlag streaming_flag);
   friend class utils::internal;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/AsyncTimer.h b/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
index ecb6621..a6f51ff 100644
--- a/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
+++ b/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
@@ -30,8 +30,8 @@
 #include <atscppapi/Request.h>
 #include <atscppapi/Response.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 // forward declarations
 struct AsyncTimerState;
 
@@ -45,10 +45,13 @@ struct AsyncTimerState;
  *
  * See example async_timer for sample usage.
  */
-class AsyncTimer : public AsyncProvider {
+class AsyncTimer : public AsyncProvider
+{
 public:
-
-  enum Type { TYPE_ONE_OFF = 0, TYPE_PERIODIC };
+  enum Type {
+    TYPE_ONE_OFF = 0,
+    TYPE_PERIODIC,
+  };
 
   /**
    * Constructor.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/CaseInsensitiveStringComparator.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/CaseInsensitiveStringComparator.h b/lib/atscppapi/src/include/atscppapi/CaseInsensitiveStringComparator.h
index a47462a..a131ea0 100644
--- a/lib/atscppapi/src/include/atscppapi/CaseInsensitiveStringComparator.h
+++ b/lib/atscppapi/src/include/atscppapi/CaseInsensitiveStringComparator.h
@@ -26,14 +26,15 @@
 
 #include <string>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * @brief A case insensitive comparator that can be used with standard library containers.
  *
  * The primary use for this class is to make all Headers case insensitive.
  */
-class CaseInsensitiveStringComparator {
+class CaseInsensitiveStringComparator
+{
 public:
   /**
    * @return true if lhs is lexicographically "less-than" rhs; meant for use in std::map or other standard library containers.
@@ -45,7 +46,6 @@ public:
    */
   int compare(const std::string &lhs, const std::string &rhs) const;
 };
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/ClientRequest.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/ClientRequest.h b/lib/atscppapi/src/include/atscppapi/ClientRequest.h
index 0eee284..ef057bb 100644
--- a/lib/atscppapi/src/include/atscppapi/ClientRequest.h
+++ b/lib/atscppapi/src/include/atscppapi/ClientRequest.h
@@ -26,8 +26,8 @@
 
 #include <atscppapi/Request.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 struct ClientRequestState;
 
 /**
@@ -35,7 +35,8 @@ struct ClientRequestState;
  * server request as it has two URLs - the pristine URL sent by the client
  * and a remapped URL created by the server.
  */
-class ClientRequest : public Request {
+class ClientRequest : public Request
+{
 public:
   /**
    * @private
@@ -50,10 +51,10 @@ public:
   const Url &getPristineUrl() const;
 
   ~ClientRequest();
+
 private:
   ClientRequestState *state_;
 };
-
 }
 
 #endif /* ATSCPPAPI_CLIENTREQUEST_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h b/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
index 2c77769..4325a21 100644
--- a/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
@@ -27,8 +27,8 @@
 
 #include <atscppapi/Plugin.h>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 struct GlobalPluginState;
 
 /**
@@ -56,7 +56,8 @@ struct GlobalPluginState;
  * \endcode
  * @see Plugin
  */
-class GlobalPlugin : public Plugin {
+class GlobalPlugin : public Plugin
+{
 public:
   /**
    * registerHook is the mechanism used to attach a global hook.
@@ -71,6 +72,7 @@ public:
    */
   void registerHook(Plugin::HookType);
   virtual ~GlobalPlugin();
+
 protected:
   /**
    * Constructor.
@@ -80,6 +82,7 @@ protected:
    *                                     when other plugins create requests). Defaults to false.
    */
   GlobalPlugin(bool ignore_internal_transactions = false);
+
 private:
   GlobalPluginState *state_; /**< Internal state tied to a GlobalPlugin */
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h b/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
index 6a6443f..4740fec 100644
--- a/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
+++ b/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
@@ -28,63 +28,63 @@
 #include <string>
 #include "atscppapi/TransformationPlugin.h"
 
-namespace atscppapi {
-
-namespace transformations {
-
-/**
- * Internal state for Deflate Transformations
- * @private
- */
-struct GzipDeflateTransformationState;
-
-/**
- * @brief A TransformationPlugin to easily add gzip deflate to your TransformationPlugin chain.
- *
- * The GzipDeflateTransformation is a helper transformation that can be used
- * to easily compress content. For a full example of GzipDeflateTransformation
- * and GzipInflateTransformation see examples/gzip_transformation/.
- *
- * @note GzipDeflateTransformation DOES NOT set Content-Encoding headers, it is the
- * users responsibility to set any applicable headers.
- *
- * @see GzipInflateTransformation
- */
-class GzipDeflateTransformation : public TransformationPlugin {
-public:
+namespace atscppapi
+{
+namespace transformations
+{
   /**
-   * A full example of how to use GzipDeflateTransformation and GzipInflateTransformation is available
-   * in examples/gzip_tranformation/
-   *
-   * @param transaction As with any TransformationPlugin you must pass in the transaction
-   * @param type because the GzipDeflateTransformation can be used with both requests and responses
-   *  you must specify the Type.
-   *
-   * @see TransformationPlugin::Type
+   * Internal state for Deflate Transformations
+   * @private
    */
-  GzipDeflateTransformation(Transaction &transaction, TransformationPlugin::Type type);
+  struct GzipDeflateTransformationState;
 
   /**
-   * Any TransformationPlugin must implement consume(), this method will take content
-   * from the transformation chain and gzip compress it.
+   * @brief A TransformationPlugin to easily add gzip deflate to your TransformationPlugin chain.
    *
-   * @param data the input data to compress
-   */
-  void consume(const std::string &data);
-
-  /**
-   * Any TransformationPlugin must implement handleInputComplete(), this method will
-   * finalize the gzip compression and flush any remaining data and the epilouge.
+   * The GzipDeflateTransformation is a helper transformation that can be used
+   * to easily compress content. For a full example of GzipDeflateTransformation
+   * and GzipInflateTransformation see examples/gzip_transformation/.
+   *
+   * @note GzipDeflateTransformation DOES NOT set Content-Encoding headers, it is the
+   * users responsibility to set any applicable headers.
+   *
+   * @see GzipInflateTransformation
    */
-  void handleInputComplete();
-
-  virtual ~GzipDeflateTransformation();
-private:
-  GzipDeflateTransformationState *state_; /** Internal state for Gzip Deflate Transformations */
-};
-
+  class GzipDeflateTransformation : public TransformationPlugin
+  {
+  public:
+    /**
+     * A full example of how to use GzipDeflateTransformation and GzipInflateTransformation is available
+     * in examples/gzip_tranformation/
+     *
+     * @param transaction As with any TransformationPlugin you must pass in the transaction
+     * @param type because the GzipDeflateTransformation can be used with both requests and responses
+     *  you must specify the Type.
+     *
+     * @see TransformationPlugin::Type
+     */
+    GzipDeflateTransformation(Transaction &transaction, TransformationPlugin::Type type);
+
+    /**
+     * Any TransformationPlugin must implement consume(), this method will take content
+     * from the transformation chain and gzip compress it.
+     *
+     * @param data the input data to compress
+     */
+    void consume(const std::string &data);
+
+    /**
+     * Any TransformationPlugin must implement handleInputComplete(), this method will
+     * finalize the gzip compression and flush any remaining data and the epilouge.
+     */
+    void handleInputComplete();
+
+    virtual ~GzipDeflateTransformation();
+
+  private:
+    GzipDeflateTransformationState *state_; /** Internal state for Gzip Deflate Transformations */
+  };
 }
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h b/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
index 1c32663..d0e4713 100644
--- a/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
+++ b/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
@@ -28,62 +28,64 @@
 #include <string>
 #include "atscppapi/TransformationPlugin.h"
 
-namespace atscppapi {
-
-namespace transformations {
-
-/**
- * Internal state for Inflate Transformations
- * @private
- */
-struct GzipInflateTransformationState;
-
-/**
- * @brief A TransformationPlugin to easily add gzip inflate to your TransformationPlugin chain.
- *
- * The GzipInflateTransformation is a helper transformation that can be used
- * to easily decompress gzipped content. For a full example of GzipInflateTransformation
- * and GzipDeflateTransformation see examples/gzip_transformation/.
- *
- * @note GzipDeflateTransformation DOES NOT set or check Content-Encoding headers, it is the
- * users responsibility to set any applicable headers and check that the content is acctually
- * gzipped by checking the Content-Encoding header before creating a GzipInflateTransformation,
- * see examples/gzip_transformation/ for a full example.
- *
- * @see GzipDeflateTransformation
- */
-class GzipInflateTransformation : public TransformationPlugin {
-public:
+namespace atscppapi
+{
+namespace transformations
+{
   /**
-   * A full example of how to use GzipInflateTransformation and GzipDeflateTransformation is available
-   * in examples/gzip_tranformation/
-   *
-   * @param transaction As with any TransformationPlugin you must pass in the transaction
-   * @param type because the GzipInflateTransformation can be used with both requests and responses
-   *  you must specify the Type.
-   *
-   * @see TransformationPlugin::Type
+   * Internal state for Inflate Transformations
+   * @private
    */
-  GzipInflateTransformation(Transaction &transaction, TransformationPlugin::Type type);
+  struct GzipInflateTransformationState;
 
   /**
-   * Any TransformationPlugin must implement consume(), this method will take content
-   * from the transformation chain and gzip decompress it.
+   * @brief A TransformationPlugin to easily add gzip inflate to your TransformationPlugin chain.
+   *
+   * The GzipInflateTransformation is a helper transformation that can be used
+   * to easily decompress gzipped content. For a full example of GzipInflateTransformation
+   * and GzipDeflateTransformation see examples/gzip_transformation/.
    *
-   * @param data the input data to decompress
+   * @note GzipDeflateTransformation DOES NOT set or check Content-Encoding headers, it is the
+   * users responsibility to set any applicable headers and check that the content is acctually
+   * gzipped by checking the Content-Encoding header before creating a GzipInflateTransformation,
+   * see examples/gzip_transformation/ for a full example.
+   *
+   * @see GzipDeflateTransformation
    */
-  void consume(const std::string &);
+  class GzipInflateTransformation : public TransformationPlugin
+  {
+  public:
+    /**
+     * A full example of how to use GzipInflateTransformation and GzipDeflateTransformation is available
+     * in examples/gzip_tranformation/
+     *
+     * @param transaction As with any TransformationPlugin you must pass in the transaction
+     * @param type because the GzipInflateTransformation can be used with both requests and responses
+     *  you must specify the Type.
+     *
+     * @see TransformationPlugin::Type
+     */
+    GzipInflateTransformation(Transaction &transaction, TransformationPlugin::Type type);
 
-  /**
-   * Any TransformationPlugin must implement handleInputComplete(), this method will
-   * finalize the gzip decompression.
-   */
-  void handleInputComplete();
+    /**
+     * Any TransformationPlugin must implement consume(), this method will take content
+     * from the transformation chain and gzip decompress it.
+     *
+     * @param data the input data to decompress
+     */
+    void consume(const std::string &);
+
+    /**
+     * Any TransformationPlugin must implement handleInputComplete(), this method will
+     * finalize the gzip decompression.
+     */
+    void handleInputComplete();
+
+    virtual ~GzipInflateTransformation();
 
-  virtual ~GzipInflateTransformation();
-private:
-  GzipInflateTransformationState *state_; /** Internal state for Gzip Deflate Transformations */
-};
+  private:
+    GzipInflateTransformationState *state_; /** Internal state for Gzip Deflate Transformations */
+  };
 
 } /* transformations */
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/Headers.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Headers.h b/lib/atscppapi/src/include/atscppapi/Headers.h
index 751ff6b..563be66 100644
--- a/lib/atscppapi/src/include/atscppapi/Headers.h
+++ b/lib/atscppapi/src/include/atscppapi/Headers.h
@@ -27,8 +27,8 @@
 #include <atscppapi/noncopyable.h>
 #include <string>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 struct HeadersState;
 struct HeaderFieldIteratorState;
 struct HeaderFieldValueIteratorState;
@@ -41,67 +41,69 @@ class Response;
  * Because header field names must be case insensitive this allows easy case insentive comparisons of names.
  *
  */
-class HeaderFieldName {
- private:
-   std::string name_;
- public:
-   typedef std::string::size_type size_type;
+class HeaderFieldName
+{
+private:
+  std::string name_;
 
-   /**
-    * Constructor: build a new HeaderField name with the given string
-    */
-   HeaderFieldName(const std::string &name);
+public:
+  typedef std::string::size_type size_type;
 
-   /**
-    * std::string conversion
-    * @return a string which is this HeaderFieldName
-    */
-   operator std::string();
+  /**
+   * Constructor: build a new HeaderField name with the given string
+   */
+  HeaderFieldName(const std::string &name);
 
-   /**
-     * const char * conversion
-     * @return a const char * which is this HeaderFieldName
-     */
-   operator const char*();
+  /**
+   * std::string conversion
+   * @return a string which is this HeaderFieldName
+   */
+  operator std::string();
 
-   /**
-    * @return the length of this HeaderFieldName
+  /**
+    * const char * conversion
+    * @return a const char * which is this HeaderFieldName
     */
-   size_type length();
+  operator const char *();
 
-   /**
-    * @return a string which is this HeaderFieldName
+  /**
+   * @return the length of this HeaderFieldName
+   */
+  size_type length();
+
+  /**
+   * @return a string which is this HeaderFieldName
+   */
+  std::string str();
+
+  /**
+   * @return a const char * which points to the name of this HeaderFIeldName
+   */
+  const char *c_str();
+
+  /**
+   * Case insensitive comparison of this HeaderFieldName
+   * @return true if the two strings are equal.
+   */
+  bool operator==(const char *field_name);
+
+  /**
+    * Case insensitive comparison of this HeaderFieldName
+    * @return true if the two strings are equal.
     */
-   std::string str();
+  bool operator==(const std::string &field_name);
 
-   /**
-    * @return a const char * which points to the name of this HeaderFIeldName
+  /**
+    * Case insensitive comparison of this HeaderFieldName
+    * @return true if the two strings are not equal.
     */
-   const char *c_str();
+  bool operator!=(const char *field_name);
 
-   /**
+  /**
     * Case insensitive comparison of this HeaderFieldName
-    * @return true if the two strings are equal.
+    * @return true if the two strings are not equal.
     */
-   bool operator==(const char *field_name);
-
-   /**
-     * Case insensitive comparison of this HeaderFieldName
-     * @return true if the two strings are equal.
-     */
-   bool operator==(const std::string &field_name);
-
-   /**
-     * Case insensitive comparison of this HeaderFieldName
-     * @return true if the two strings are not equal.
-     */
-   bool operator!=(const char *field_name);
-
-   /**
-     * Case insensitive comparison of this HeaderFieldName
-     * @return true if the two strings are not equal.
-     */
-   bool operator!=(const std::string &field_name);
+  bool operator!=(const std::string &field_name);
 };
 
 class HeaderField;
@@ -111,58 +113,59 @@ class HeaderField;
  */
 class header_field_value_iterator : public std::iterator<std::forward_iterator_tag, int>
 {
-  private:
-    HeaderFieldValueIteratorState *state_;
-  public:
-    /**
-      * Constructor for header_field_value_iterator, this shouldn't need to be used directly.
-      * @param bufp the TSMBuffer associated with the headers
-      * @param mloc the TSMLoc associated with the headers.
-      * @param field_loc the TSMLoc assocated with the field.
-      * @param index the index of the value in the HeaderField
-      * @warning This shouldn't need to be used directly!
-      */
-    header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, int index);
-
-    /**
-      * Copy Constructor for header_field_value_iterator, this shouldn't need to be used directly.
-      * @param header_field_value_iterator an existing iterator to copy
-      * @warning This shouldn't need to be used directly!
-      */
-    header_field_value_iterator(const header_field_value_iterator& it);
-    ~header_field_value_iterator();
-
-    /**
-     * Dereference this iterator into a string (get the value pointed to by this iterator)
-     * @return a string which is the value pointed to by this iterator
-     */
-    std::string operator*();
-
-    /**
-     * Advance the iterator to the next header field value
-     * @return a reference to a the next iterator
-     */
-    header_field_value_iterator& operator++();
-
-    /**
-     * Advance the current iterator to the next header field
-     * @return a new iterator which points to the next element
-     */
-    header_field_value_iterator operator++(int);
-
-    /**
-     * Compare two iterators returning true if they are equal
-     * @return true if two iterators are equal
-     */
-    bool operator==(const header_field_value_iterator& rhs) const;
-
-    /**
-     * Compare two iterators returning true if they are NOT equal
-     * @return true if two iterators are not equal.
-     */
-    bool operator!=(const header_field_value_iterator& rhs) const;
-
-    friend class HeaderField;
+private:
+  HeaderFieldValueIteratorState *state_;
+
+public:
+  /**
+    * Constructor for header_field_value_iterator, this shouldn't need to be used directly.
+    * @param bufp the TSMBuffer associated with the headers
+    * @param mloc the TSMLoc associated with the headers.
+    * @param field_loc the TSMLoc assocated with the field.
+    * @param index the index of the value in the HeaderField
+    * @warning This shouldn't need to be used directly!
+    */
+  header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, int index);
+
+  /**
+    * Copy Constructor for header_field_value_iterator, this shouldn't need to be used directly.
+    * @param header_field_value_iterator an existing iterator to copy
+    * @warning This shouldn't need to be used directly!
+    */
+  header_field_value_iterator(const header_field_value_iterator &it);
+  ~header_field_value_iterator();
+
+  /**
+   * Dereference this iterator into a string (get the value pointed to by this iterator)
+   * @return a string which is the value pointed to by this iterator
+   */
+  std::string operator*();
+
+  /**
+   * Advance the iterator to the next header field value
+   * @return a reference to a the next iterator
+   */
+  header_field_value_iterator &operator++();
+
+  /**
+   * Advance the current iterator to the next header field
+   * @return a new iterator which points to the next element
+   */
+  header_field_value_iterator operator++(int);
+
+  /**
+   * Compare two iterators returning true if they are equal
+   * @return true if two iterators are equal
+   */
+  bool operator==(const header_field_value_iterator &rhs) const;
+
+  /**
+   * Compare two iterators returning true if they are NOT equal
+   * @return true if two iterators are not equal.
+   */
+  bool operator!=(const header_field_value_iterator &rhs) const;
+
+  friend class HeaderField;
 };
 
 /**
@@ -170,69 +173,71 @@ class header_field_value_iterator : public std::iterator<std::forward_iterator_t
  */
 class header_field_iterator : public std::iterator<std::forward_iterator_tag, int>
 {
-  private:
-    HeaderFieldIteratorState *state_;
-    header_field_iterator(void *hdr_buf, void *hdr_loc, void *field_loc);
-  public:
-    ~header_field_iterator();
-
-    /**
-      * Copy Constructor for header_field_iterator, this shouldn't need to be used directly.
-      * @param header_field_iterator: for constructing the iterator.
-      * @warning This shouldn't need to be used directly!
-     */
-    header_field_iterator(const header_field_iterator& it);
-
-    header_field_iterator &operator=(const header_field_iterator &rhs);
-
-    /**
-     * Advance the iterator to the next header field
-     * @return a reference to a the next iterator
-     */
-    header_field_iterator& operator++();
-
-    /**
-     * Advance the current iterator to the next header field
-     * @return a new iterator which points to the next element
-     */
-    header_field_iterator operator++(int);
-
-    /**
-     * Advance the iterator to the next header field with the same name
-     * @return a reference to a the next iterator
-     */
-    header_field_iterator& nextDup();
-
-    /**
-     * Comparison operator, compare two iterators
-     * @return true if the two iterators point to the same HeaderField
-     */
-    bool operator==(const header_field_iterator& rhs) const;
-
-    /**
-     * Inequality Operator, compare two iterators
-     * @return false if the two iterators are the same.
-     */
-    bool operator!=(const header_field_iterator& rhs) const;
-
-    /**
-     * Dereference an iterator
-     * @return a HeaderField pointed to by this iterator
-     */
-    HeaderField operator*();
-
-    friend class HeaderField;
-    friend class Headers;
+private:
+  HeaderFieldIteratorState *state_;
+  header_field_iterator(void *hdr_buf, void *hdr_loc, void *field_loc);
+
+public:
+  ~header_field_iterator();
+
+  /**
+    * Copy Constructor for header_field_iterator, this shouldn't need to be used directly.
+    * @param header_field_iterator: for constructing the iterator.
+    * @warning This shouldn't need to be used directly!
+   */
+  header_field_iterator(const header_field_iterator &it);
+
+  header_field_iterator &operator=(const header_field_iterator &rhs);
+
+  /**
+   * Advance the iterator to the next header field
+   * @return a reference to a the next iterator
+   */
+  header_field_iterator &operator++();
+
+  /**
+   * Advance the current iterator to the next header field
+   * @return a new iterator which points to the next element
+   */
+  header_field_iterator operator++(int);
+
+  /**
+   * Advance the iterator to the next header field with the same name
+   * @return a reference to a the next iterator
+   */
+  header_field_iterator &nextDup();
+
+  /**
+   * Comparison operator, compare two iterators
+   * @return true if the two iterators point to the same HeaderField
+   */
+  bool operator==(const header_field_iterator &rhs) const;
+
+  /**
+   * Inequality Operator, compare two iterators
+   * @return false if the two iterators are the same.
+   */
+  bool operator!=(const header_field_iterator &rhs) const;
+
+  /**
+   * Dereference an iterator
+   * @return a HeaderField pointed to by this iterator
+   */
+  HeaderField operator*();
+
+  friend class HeaderField;
+  friend class Headers;
 };
 
 /**
  * @brief A HeaderField is a class that contains the header field name and all of the values.
  * @note You may have several HeaderFields with the same name for a given set of Headers.
  */
-class HeaderField {
+class HeaderField
+{
 private:
   header_field_iterator iter_;
-  HeaderField(header_field_iterator iter) : iter_(iter) { }
+  HeaderField(header_field_iterator iter) : iter_(iter) {}
 
 public:
   typedef unsigned int size_type;
@@ -350,7 +355,7 @@ public:
    * @note This is a case insensitive comparison.
    * @return true if the name is NOT equal (case insensitive comparison).
    */
-  bool operator!=(const std::string &field_name) const ;
+  bool operator!=(const std::string &field_name) const;
 
   /**
    * Set the VALUES of the header field to the given value string
@@ -379,7 +384,7 @@ public:
     * Get a string representing all the header field's values
     * @return a string representation of all the header fields
     */
-  friend std::ostream& operator<<(std::ostream& os, HeaderField& obj);
+  friend std::ostream &operator<<(std::ostream &os, HeaderField &obj);
 
   /**
     * Get a string representing all the header field's values.
@@ -393,7 +398,8 @@ public:
 /**
  * @brief Encapsulates the headers portion of a request or response.
  */
-class Headers: noncopyable {
+class Headers : noncopyable
+{
 public:
   /**
    * Constructor for Headers. This creates a "detached" headers, i.e., not tied to any transaction.
@@ -404,7 +410,8 @@ public:
    * Constructor for Headers, this shouldn't be used directly unless you're trying to mix the C++ and C apis.
    * @param bufp the TSMBuffer associated with the headers
    * @param mloc the TSMLoc associated with the headers.
-   * @warning This should only be used if you're mixing the C++ and C apis, it will be constructed automatically if using only the C++ api.
+   * @warning This should only be used if you're mixing the C++ and C apis, it will be constructed automatically if using only the
+   * C++ api.
    */
   Headers(void *bufp, void *mloc);
 
@@ -585,16 +592,16 @@ public:
     */
   std::string wireStr();
 
-  friend std::ostream& operator<<(std::ostream &os, Headers &obj);
+  friend std::ostream &operator<<(std::ostream &os, Headers &obj);
 
   ~Headers();
+
 private:
   HeadersState *state_;
   friend class Request;
   friend class ClientRequest;
   friend class Response;
 };
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/HttpMethod.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/HttpMethod.h b/lib/atscppapi/src/include/atscppapi/HttpMethod.h
index 44029f7..7dc3b3d 100644
--- a/lib/atscppapi/src/include/atscppapi/HttpMethod.h
+++ b/lib/atscppapi/src/include/atscppapi/HttpMethod.h
@@ -26,8 +26,8 @@
 
 #include <string>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * An enumeration of all available Http Methods.
  */
@@ -53,7 +53,6 @@ enum HttpMethod {
  * \endcode
  */
 extern const std::string HTTP_METHOD_STRINGS[];
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/HttpStatus.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/HttpStatus.h b/lib/atscppapi/src/include/atscppapi/HttpStatus.h
index e1ba25b..bfea2fd 100644
--- a/lib/atscppapi/src/include/atscppapi/HttpStatus.h
+++ b/lib/atscppapi/src/include/atscppapi/HttpStatus.h
@@ -27,13 +27,12 @@
 
 #include <string>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * An enumeration of all available Http Status Codes.
  */
-enum HttpStatus
-{
+enum HttpStatus {
   HTTP_STATUS_UNKNOWN = 0,
 
   HTTP_STATUS_CONTINUE = 100,
@@ -98,7 +97,6 @@ enum HttpStatus
   HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511
 
 };
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/HttpVersion.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/HttpVersion.h b/lib/atscppapi/src/include/atscppapi/HttpVersion.h
index fdbd639..8cf0839 100644
--- a/lib/atscppapi/src/include/atscppapi/HttpVersion.h
+++ b/lib/atscppapi/src/include/atscppapi/HttpVersion.h
@@ -27,8 +27,8 @@
 
 #include <string>
 
-namespace atscppapi {
-
+namespace atscppapi
+{
 /**
  * An enumeration of all available Http Versions.
  */
@@ -46,7 +46,6 @@ enum HttpVersion {
  * \endcode
  */
 extern const std::string HTTP_VERSION_STRINGS[];
-
 }
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/include/atscppapi/InterceptPlugin.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/InterceptPlugin.h b/lib/atscppapi/src/include/atscppapi/InterceptPlugin.h
index 709e9c5..48c2de8 100644
--- a/lib/atscppapi/src/include/atscppapi/InterceptPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/InterceptPlugin.h
@@ -28,16 +28,15 @@
 #include <atscppapi/Transaction.h>
 #include <atscppapi/TransactionPlugin.h>
 
-namespace atscppapi {
-
-
-
+namespace atscppapi
+{
 /**
  * Allows a plugin to act as a server and return the response. This
  * plugin can be created in read request headers hook (pre or post
  * remap).
  */
-class InterceptPlugin : public TransactionPlugin {
+class InterceptPlugin : public TransactionPlugin
+{
 protected:
   /**
    * The available types of intercepts.
@@ -53,7 +52,7 @@ protected:
 public:
   enum RequestDataType {
     REQUEST_HEADER = 0,
-    REQUEST_BODY
+    REQUEST_BODY,
   };
 
   /**
@@ -82,7 +81,11 @@ protected:
    */
   bool produce(const void *data, int data_size);
 
-  bool produce(const std::string &data) { return produce(data.data(), data.size()); }
+  bool
+  produce(const std::string &data)
+  {
+    return produce(data.data(), data.size());
+  }
 
   bool setOutputComplete();
 


[30/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/test_Buffer.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Buffer.cc b/iocore/eventsystem/test_Buffer.cc
index a86c86a..1826c76 100644
--- a/iocore/eventsystem/test_Buffer.cc
+++ b/iocore/eventsystem/test_Buffer.cc
@@ -25,7 +25,7 @@
 #include "I_Layout.h"
 
 #define TEST_TIME_SECOND 60
-#define TEST_THREADS     2
+#define TEST_THREADS 2
 
 Diags *diags;
 #define DIAGS_LOG_FILE "diags.log"
@@ -55,7 +55,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -78,15 +77,14 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 static void
@@ -109,16 +107,17 @@ init_diags(const char *bdt, const char *bat)
   diags = new Diags(bdt, bat, diags_log_fp);
 
   if (diags_log_fp == NULL) {
-    Warning("couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    Warning("couldn't open diags log file '%s', "
+            "will not log to this file",
+            diags_logpath);
   }
 
   Status("opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 int
-main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
+main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
 {
   RecModeT mode_type = RECM_STAND_ALONE;
 
@@ -138,7 +137,7 @@ main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
     IOBufferReader *b2reader ATS_UNUSED = b2->alloc_reader();
     b2->fill(b2->write_avail());
 
-    //b1->write(b2reader, 2*1024);
+    // b1->write(b2reader, 2*1024);
 
     free_MIOBuffer(b2);
     free_MIOBuffer(b1);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/eventsystem/test_Event.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Event.cc b/iocore/eventsystem/test_Event.cc
index fc2f9c3..5dbab87 100644
--- a/iocore/eventsystem/test_Event.cc
+++ b/iocore/eventsystem/test_Event.cc
@@ -25,7 +25,7 @@
 #include "I_Layout.h"
 
 #define TEST_TIME_SECOND 60
-#define TEST_THREADS     2
+#define TEST_THREADS 2
 
 int count;
 Diags *diags;
@@ -56,7 +56,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -79,15 +78,14 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 static void
@@ -110,34 +108,29 @@ init_diags(const char *bdt, const char *bat)
   diags = new Diags(bdt, bat, diags_log_fp);
 
   if (diags_log_fp == NULL) {
-    Warning("couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    Warning("couldn't open diags log file '%s', "
+            "will not log to this file",
+            diags_logpath);
   }
 
   Status("opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
-struct alarm_printer:public Continuation
-{
-  alarm_printer(ProxyMutex * m):Continuation(m)
+struct alarm_printer : public Continuation {
+  alarm_printer(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&alarm_printer::dummy_function); }
+  int
+  dummy_function(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   {
-    SET_HANDLER(&alarm_printer::dummy_function);
-  }
-  int dummy_function(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
-  {
-    ink_atomic_increment((int *) &count, 1);
+    ink_atomic_increment((int *)&count, 1);
     printf("Count = %d\n", count);
     return 0;
   }
 };
-struct process_killer:public Continuation
-{
-  process_killer(ProxyMutex * m):Continuation(m)
-  {
-    SET_HANDLER(&process_killer::kill_function);
-  }
-  int kill_function(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
+struct process_killer : public Continuation {
+  process_killer(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&process_killer::kill_function); }
+  int
+  kill_function(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   {
     printf("Count is %d \n", count);
     if (count <= 0)
@@ -150,7 +143,7 @@ struct process_killer:public Continuation
 };
 
 int
-main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
+main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
 {
   RecModeT mode_type = RECM_STAND_ALONE;
   count = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 3f4a0cf..9add8a9 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -71,9 +71,9 @@ ClassAllocator<HostDBContinuation> hostDBContAllocator("hostDBContAllocator");
 
 HostDBCache hostDB;
 
-void ParseHostFile(char const* path);
+void ParseHostFile(char const *path);
 
-static  Queue <HostDBContinuation > remoteHostDBQueue[MULTI_CACHE_PARTITIONS];
+static Queue<HostDBContinuation> remoteHostDBQueue[MULTI_CACHE_PARTITIONS];
 
 char *
 HostDBInfo::srvname(HostDBRoundRobin *rr)
@@ -81,57 +81,55 @@ HostDBInfo::srvname(HostDBRoundRobin *rr)
   if (!is_srv || !data.srv.srv_offset)
     return NULL;
   ink_assert(this - rr->info >= 0 && this - rr->info < rr->rrcount && data.srv.srv_offset < rr->length);
-  return (char *) rr + data.srv.srv_offset;
+  return (char *)rr + data.srv.srv_offset;
 }
 
 static inline int
-corrupt_debugging_callout(HostDBInfo * e, RebuildMC & r)
+corrupt_debugging_callout(HostDBInfo *e, RebuildMC &r)
 {
-  Debug("hostdb", "corrupt %ld part %d",
-    (long)((char *) &e->app.rr.offset - r.data), r.partition);
+  Debug("hostdb", "corrupt %ld part %d", (long)((char *)&e->app.rr.offset - r.data), r.partition);
   return -1;
 }
 
 static inline bool
-is_addr_valid(
-  uint8_t af, ///< Address family (format of data)
-  void* ptr ///< Raw address data (not a sockaddr variant!)
-) {
-  return
-    (AF_INET == af && INADDR_ANY != *(reinterpret_cast<in_addr_t*>(ptr)))
-    || (AF_INET6 == af && !IN6_IS_ADDR_UNSPECIFIED(reinterpret_cast<in6_addr*>(ptr)))
-    ;
+is_addr_valid(uint8_t af, ///< Address family (format of data)
+              void *ptr   ///< Raw address data (not a sockaddr variant!)
+              )
+{
+  return (AF_INET == af && INADDR_ANY != *(reinterpret_cast<in_addr_t *>(ptr))) ||
+         (AF_INET6 == af && !IN6_IS_ADDR_UNSPECIFIED(reinterpret_cast<in6_addr *>(ptr)));
 }
 
 static inline void
-ip_addr_set(
-  sockaddr* ip, ///< Target storage, sockaddr compliant.
-  uint8_t af, ///< Address format.
-  void* ptr ///< Raw address data
-) {
+ip_addr_set(sockaddr *ip, ///< Target storage, sockaddr compliant.
+            uint8_t af,   ///< Address format.
+            void *ptr     ///< Raw address data
+            )
+{
   if (AF_INET6 == af)
-    ats_ip6_set(ip, *static_cast<in6_addr*>(ptr));
+    ats_ip6_set(ip, *static_cast<in6_addr *>(ptr));
   else if (AF_INET == af)
-    ats_ip4_set(ip, *static_cast<in_addr_t*>(ptr));
-  else ats_ip_invalidate(ip);
+    ats_ip4_set(ip, *static_cast<in_addr_t *>(ptr));
+  else
+    ats_ip_invalidate(ip);
 }
 
 static inline void
-ip_addr_set(
-  IpAddr& ip, ///< Target storage.
-  uint8_t af, ///< Address format.
-  void* ptr ///< Raw address data
-) {
+ip_addr_set(IpAddr &ip, ///< Target storage.
+            uint8_t af, ///< Address format.
+            void *ptr   ///< Raw address data
+            )
+{
   if (AF_INET6 == af)
-    ip = *static_cast<in6_addr*>(ptr);
+    ip = *static_cast<in6_addr *>(ptr);
   else if (AF_INET == af)
-    ip = *static_cast<in_addr_t*>(ptr);
+    ip = *static_cast<in_addr_t *>(ptr);
   else
     ip.invalidate();
 }
 
 inline void
-hostdb_cont_free(HostDBContinuation * cont)
+hostdb_cont_free(HostDBContinuation *cont)
 {
   if (cont->pending_action)
     cont->pending_action->cancel();
@@ -145,7 +143,8 @@ hostdb_cont_free(HostDBContinuation * cont)
    @return @c true if @a mark was updated, @c false if no retry should be done.
 */
 static inline bool
-check_for_retry(HostDBMark& mark, HostResStyle style) {
+check_for_retry(HostDBMark &mark, HostResStyle style)
+{
   bool zret = true;
   if (HOSTDB_MARK_IPV4 == mark && HOST_RES_IPV4 == style)
     mark = HOSTDB_MARK_IPV6;
@@ -156,22 +155,20 @@ check_for_retry(HostDBMark& mark, HostResStyle style) {
   return zret;
 }
 
-char const*
-string_for(HostDBMark mark) {
-  static char const* STRING[] = {
-    "Generic", "IPv4", "IPv6", "SRV"
-  };
+char const *
+string_for(HostDBMark mark)
+{
+  static char const *STRING[] = {"Generic", "IPv4", "IPv6", "SRV"};
   return STRING[mark];
 }
 
 //
 // Function Prototypes
 //
-static Action *
-register_ShowHostDB(Continuation * c, HTTPHdr * h);
+static Action *register_ShowHostDB(Continuation *c, HTTPHdr *h);
 
-HostDBMD5&
-HostDBMD5::set_host(char const* name, int len)
+HostDBMD5 &
+HostDBMD5::set_host(char const *name, int len)
 {
   host_name = name;
   host_len = len;
@@ -179,14 +176,15 @@ HostDBMD5::set_host(char const* name, int len)
   if (host_name && SplitDNSConfig::isSplitDNSEnabled()) {
     const char *scan;
     // I think this is checking for a hostname that is just an address.
-    for (scan = host_name ; *scan != '\0' && (ParseRules::is_digit(*scan) || '.' == *scan || ':' == *scan); ++scan)
+    for (scan = host_name; *scan != '\0' && (ParseRules::is_digit(*scan) || '.' == *scan || ':' == *scan); ++scan)
       ;
     if ('\0' != *scan) {
       // config is released in the destructor, because we must make sure values we
       // get out of it don't evaporate while @a this is still around.
-      if (!pSD) pSD = SplitDNSConfig::acquire();
+      if (!pSD)
+        pSD = SplitDNSConfig::acquire();
       if (pSD) {
-        dns_server = static_cast<DNSServer*>(pSD->getDNSRecord(host_name));
+        dns_server = static_cast<DNSServer *>(pSD->getDNSRecord(host_name));
       }
     } else {
       dns_server = 0;
@@ -197,39 +195,41 @@ HostDBMD5::set_host(char const* name, int len)
 }
 
 void
-HostDBMD5::refresh() {
+HostDBMD5::refresh()
+{
   MD5Context ctx;
 
   if (host_name) {
-    char const* server_line = dns_server ? dns_server->x_dns_ip_line : 0;
+    char const *server_line = dns_server ? dns_server->x_dns_ip_line : 0;
     uint8_t m = static_cast<uint8_t>(db_mark); // be sure of the type.
 
     ctx.update(host_name, host_len);
-    ctx.update(reinterpret_cast<uint8_t*>(&port), sizeof(port));
+    ctx.update(reinterpret_cast<uint8_t *>(&port), sizeof(port));
     ctx.update(&m, sizeof(m));
-    if (server_line) ctx.update(server_line, strlen(server_line));
+    if (server_line)
+      ctx.update(server_line, strlen(server_line));
   } else {
     // INK_MD5 the ip, pad on both sizes with 0's
     // so that it does not intersect the string space
     //
-    char buff[TS_IP6_SIZE+4];
+    char buff[TS_IP6_SIZE + 4];
     int n = ip.isIp6() ? sizeof(in6_addr) : sizeof(in_addr_t);
     memset(buff, 0, 2);
-    memcpy(buff+2, ip._addr._byte, n);
-    memset(buff + 2 + n , 0, 2);
-    ctx.update(buff, n+4);
+    memcpy(buff + 2, ip._addr._byte, n);
+    memset(buff + 2 + n, 0, 2);
+    ctx.update(buff, n + 4);
   }
   ctx.finalize(hash);
 }
 
-HostDBMD5::HostDBMD5()
-  : host_name(0), host_len(0), port(0),
-    dns_server(0), pSD(0), db_mark(HOSTDB_MARK_GENERIC)
+HostDBMD5::HostDBMD5() : host_name(0), host_len(0), port(0), dns_server(0), pSD(0), db_mark(HOSTDB_MARK_GENERIC)
 {
 }
 
-HostDBMD5::~HostDBMD5() {
-  if (pSD) SplitDNSConfig::release(pSD);
+HostDBMD5::~HostDBMD5()
+{
+  if (pSD)
+    SplitDNSConfig::release(pSD);
 }
 
 HostDBCache::HostDBCache()
@@ -242,7 +242,7 @@ HostDBCache::HostDBCache()
 
 
 int
-HostDBCache::rebuild_callout(HostDBInfo * e, RebuildMC & r)
+HostDBCache::rebuild_callout(HostDBInfo *e, RebuildMC &r)
 {
   if (e->round_robin && e->reverse_dns)
     return corrupt_debugging_callout(e, r);
@@ -252,7 +252,7 @@ HostDBCache::rebuild_callout(HostDBInfo * e, RebuildMC & r)
     if (e->data.hostname_offset > 0) {
       if (!valid_offset(e->data.hostname_offset - 1))
         return corrupt_debugging_callout(e, r);
-      char *p = (char *) ptr(&e->data.hostname_offset, r.partition);
+      char *p = (char *)ptr(&e->data.hostname_offset, r.partition);
       if (!p)
         return corrupt_debugging_callout(e, r);
       char *s = p;
@@ -270,19 +270,18 @@ HostDBCache::rebuild_callout(HostDBInfo * e, RebuildMC & r)
       return 0;
     if (!valid_offset(e->app.rr.offset - 1))
       return corrupt_debugging_callout(e, r);
-    HostDBRoundRobin *rr = (HostDBRoundRobin *) ptr(&e->app.rr.offset, r.partition);
+    HostDBRoundRobin *rr = (HostDBRoundRobin *)ptr(&e->app.rr.offset, r.partition);
     if (!rr)
       return corrupt_debugging_callout(e, r);
-    if (rr->rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || rr->rrcount <= 0 ||
-        rr->good > HOST_DB_MAX_ROUND_ROBIN_INFO || rr->good <= 0 || rr->good > rr->rrcount)
+    if (rr->rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || rr->rrcount <= 0 || rr->good > HOST_DB_MAX_ROUND_ROBIN_INFO ||
+        rr->good <= 0 || rr->good > rr->rrcount)
       return corrupt_debugging_callout(e, r);
     for (int i = 0; i < rr->good; i++) {
-      if (!valid_heap_pointer(((char *) &rr->info[i + 1]) - 1))
+      if (!valid_heap_pointer(((char *)&rr->info[i + 1]) - 1))
         return -1;
       if (!ats_is_ip(rr->info[i].ip()))
         return corrupt_debugging_callout(e, r);
-      if (rr->info[i].md5_high != e->md5_high ||
-          rr->info[i].md5_low != e->md5_low || rr->info[i].md5_low_low != e->md5_low_low)
+      if (rr->info[i].md5_high != e->md5_high || rr->info[i].md5_low != e->md5_low || rr->info[i].md5_low_low != e->md5_low_low)
         return corrupt_debugging_callout(e, r);
     }
   }
@@ -299,15 +298,15 @@ HostDBProcessor::cache()
 }
 
 
-struct HostDBTestRR: public Continuation
-{
+struct HostDBTestRR : public Continuation {
   int fd;
   char b[512];
   int nb;
   int outstanding, success, failure;
   int in;
 
-  int mainEvent(int event, Event * e)
+  int
+  mainEvent(int event, Event *e)
   {
     if (event == EVENT_INTERVAL) {
       printf("HostDBTestRR: %d outstanding %d succcess %d failure\n", outstanding, success, failure);
@@ -347,15 +346,15 @@ struct HostDBTestRR: public Continuation
   }
 
 
-  void read_some()
+  void
+  read_some()
   {
     nb = read(fd, b + nb, 512 - nb);
     ink_release_assert(nb >= 0);
   }
 
 
-  HostDBTestRR()
-    : Continuation(new_ProxyMutex()), nb(0), outstanding(0), success(0), failure(0), in(0)
+  HostDBTestRR() : Continuation(new_ProxyMutex()), nb(0), outstanding(0), success(0), failure(0), in(0)
   {
     printf("starting HostDBTestRR....\n");
     fd = open("hostdb_test.config", O_RDONLY, 0);
@@ -364,15 +363,11 @@ struct HostDBTestRR: public Continuation
     SET_HANDLER(&HostDBTestRR::mainEvent);
   }
 
-  ~HostDBTestRR()
-  {
-    close(fd);
-  }
+  ~HostDBTestRR() { close(fd); }
 };
 
 
-struct HostDBSyncer: public Continuation
-{
+struct HostDBSyncer : public Continuation {
   int frequency;
   ink_hrtime start_time;
 
@@ -383,8 +378,7 @@ struct HostDBSyncer: public Continuation
 };
 
 
-HostDBSyncer::HostDBSyncer():
-Continuation(new_ProxyMutex()), frequency(0), start_time(0)
+HostDBSyncer::HostDBSyncer() : Continuation(new_ProxyMutex()), frequency(0), start_time(0)
 {
   SET_HANDLER(&HostDBSyncer::sync_event);
 }
@@ -459,7 +453,7 @@ HostDBCache::start(int flags)
   hostDBStore->add(hostDBSpan);
 
   Debug("hostdb", "Opening %s, size=%d", hostdb_filename, hostdb_size);
-  if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */ ) < 0) {
+  if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */) < 0) {
     ats_scoped_str rundir(RecConfigReadRuntimeDir());
     ats_scoped_str config(Layout::relative_to(rundir, "hostdb.config"));
 
@@ -533,7 +527,7 @@ HostDBProcessor::start(int, size_t)
   hostdb_current_interval = (unsigned int)(ink_get_based_hrtime() / HOST_DB_TIMEOUT_INTERVAL);
 
   HostDBContinuation *b = hostDBContAllocator.alloc();
-  SET_CONTINUATION_HANDLER(b, (HostDBContHandler) & HostDBContinuation::backgroundEvent);
+  SET_CONTINUATION_HANDLER(b, (HostDBContHandler)&HostDBContinuation::backgroundEvent);
   b->mutex = new_ProxyMutex();
   eventProcessor.schedule_every(b, HOST_DB_TIMEOUT_INTERVAL, ET_DNS);
 
@@ -547,13 +541,13 @@ HostDBProcessor::start(int, size_t)
 
 
 void
-HostDBContinuation::init(HostDBMD5 const& the_md5, Options const& opt)
+HostDBContinuation::init(HostDBMD5 const &the_md5, Options const &opt)
 {
   md5 = the_md5;
   if (md5.host_name) {
     // copy to backing store.
-    if (md5.host_len > static_cast<int>(sizeof(md5_host_name_store)-1))
-      md5.host_len = sizeof(md5_host_name_store)-1;
+    if (md5.host_len > static_cast<int>(sizeof(md5_host_name_store) - 1))
+      md5.host_len = sizeof(md5_host_name_store) - 1;
     memcpy(md5_host_name_store, md5.host_name, md5.host_len);
   } else {
     md5.host_len = 0;
@@ -563,29 +557,30 @@ HostDBContinuation::init(HostDBMD5 const& the_md5, Options const& opt)
 
   host_res_style = opt.host_res_style;
   dns_lookup_timeout = opt.timeout;
-  mutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+  mutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
   if (opt.cont) {
     action = opt.cont;
   } else {
-    //ink_assert(!"this sucks");
+    // ink_assert(!"this sucks");
     action.mutex = mutex;
   }
 }
 
 void
-HostDBContinuation::refresh_MD5() {
-  ProxyMutex* old_bucket_mutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+HostDBContinuation::refresh_MD5()
+{
+  ProxyMutex *old_bucket_mutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
   // We're not pending DNS anymore.
   remove_trigger_pending_dns();
   md5.refresh();
   // Update the mutex if it's from the bucket.
   // Some call sites modify this after calling @c init so need to check.
   if (old_bucket_mutex == mutex)
-    mutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+    mutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
 }
 
 static bool
-reply_to_cont(Continuation * cont, HostDBInfo * r, bool is_srv = false)
+reply_to_cont(Continuation *cont, HostDBInfo *r, bool is_srv = false)
 {
   if (r == NULL || r->is_srv != is_srv || r->failed()) {
     cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, NULL);
@@ -627,20 +622,20 @@ reply_to_cont(Continuation * cont, HostDBInfo * r, bool is_srv = false)
 }
 
 inline HostResStyle
-host_res_style_for(sockaddr const* ip) {
+host_res_style_for(sockaddr const *ip)
+{
   return ats_is_ip6(ip) ? HOST_RES_IPV6_ONLY : HOST_RES_IPV4_ONLY;
 }
 
 inline HostResStyle
-host_res_style_for(HostDBMark mark) {
-  return HOSTDB_MARK_IPV4 == mark ? HOST_RES_IPV4_ONLY
-    : HOSTDB_MARK_IPV6 == mark ? HOST_RES_IPV6_ONLY
-    : HOST_RES_NONE
-    ;
+host_res_style_for(HostDBMark mark)
+{
+  return HOSTDB_MARK_IPV4 == mark ? HOST_RES_IPV4_ONLY : HOSTDB_MARK_IPV6 == mark ? HOST_RES_IPV6_ONLY : HOST_RES_NONE;
 }
 
 inline HostDBMark
-db_mark_for(HostResStyle style) {
+db_mark_for(HostResStyle style)
+{
   HostDBMark zret = HOSTDB_MARK_GENERIC;
   if (HOST_RES_IPV4 == style || HOST_RES_IPV4_ONLY == style)
     zret = HOSTDB_MARK_IPV4;
@@ -650,26 +645,27 @@ db_mark_for(HostResStyle style) {
 }
 
 inline HostDBMark
-db_mark_for(sockaddr const* ip) {
+db_mark_for(sockaddr const *ip)
+{
   return ats_is_ip6(ip) ? HOSTDB_MARK_IPV6 : HOSTDB_MARK_IPV4;
 }
 
 inline HostDBMark
-db_mark_for(IpAddr const& ip) {
+db_mark_for(IpAddr const &ip)
+{
   return ip.isIp6() ? HOSTDB_MARK_IPV6 : HOSTDB_MARK_IPV4;
 }
 
 HostDBInfo *
-probe(ProxyMutex *mutex, HostDBMD5 const& md5, bool ignore_timeout)
+probe(ProxyMutex *mutex, HostDBMD5 const &md5, bool ignore_timeout)
 {
-  ink_assert(this_ethread() == hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets))->thread_holding);
+  ink_assert(this_ethread() == hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets))->thread_holding);
   if (hostdb_enable) {
     uint64_t folded_md5 = fold_md5(md5.hash);
     HostDBInfo *r = hostDB.lookup_block(folded_md5, hostDB.levels);
-    Debug("hostdb", "probe %.*s %" PRIx64 " %d [ignore_timeout = %d]",
-          md5.host_len, md5.host_name, folded_md5, !!r, ignore_timeout);
+    Debug("hostdb", "probe %.*s %" PRIx64 " %d [ignore_timeout = %d]", md5.host_len, md5.host_name, folded_md5, !!r,
+          ignore_timeout);
     if (r && md5.hash[1] == r->md5_high) {
-
       // Check for timeout (fail probe)
       //
       if (r->is_deleted()) {
@@ -686,7 +682,7 @@ probe(ProxyMutex *mutex, HostDBMD5 const& md5, bool ignore_timeout)
         HOSTDB_INCREMENT_DYN_STAT(hostdb_ttl_expires_stat);
         return NULL;
       }
-//error conditions
+      // error conditions
       if (r->reverse_dns && !r->hostname()) {
         Debug("hostdb", "missing reverse dns");
         hostDB.delete_block(r);
@@ -700,11 +696,9 @@ probe(ProxyMutex *mutex, HostDBMD5 const& md5, bool ignore_timeout)
       // Check for stale (revalidate offline if we are the owner)
       // -or-
       // we are beyond our TTL but we choose to serve for another N seconds [hostdb_serve_stale_but_revalidate seconds]
-      if ((!ignore_timeout && r->is_ip_stale()
-           && !cluster_machine_at_depth(master_hash(md5.hash))
-           && !r->reverse_dns) || (r->is_ip_timeout() && r->serve_stale_but_revalidate())) {
-        Debug("hostdb", "stale %u %u %u, using it and refreshing it", r->ip_interval(),
-              r->ip_timestamp, r->ip_timeout_interval);
+      if ((!ignore_timeout && r->is_ip_stale() && !cluster_machine_at_depth(master_hash(md5.hash)) && !r->reverse_dns) ||
+          (r->is_ip_timeout() && r->serve_stale_but_revalidate())) {
+        Debug("hostdb", "stale %u %u %u, using it and refreshing it", r->ip_interval(), r->ip_timestamp, r->ip_timeout_interval);
         r->refresh_ip();
         if (!is_dotted_form_hostname(md5.host_name)) {
           HostDBContinuation *c = hostDBContAllocator.alloc();
@@ -746,8 +740,8 @@ HostDBContinuation::insert(unsigned int attl)
     attl = HOST_DB_MAX_TTL;
   r->ip_timeout_interval = attl;
   r->ip_timestamp = hostdb_current_interval;
-  Debug("hostdb", "inserting for: %.*s: (md5: %" PRIx64 ") bucket: %d now: %u timeout: %u ttl: %u", md5.host_len, md5.host_name, folded_md5, bucket, r->ip_timestamp,
-        r->ip_timeout_interval, attl);
+  Debug("hostdb", "inserting for: %.*s: (md5: %" PRIx64 ") bucket: %d now: %u timeout: %u ttl: %u", md5.host_len, md5.host_name,
+        folded_md5, bucket, r->ip_timestamp, r->ip_timeout_interval, attl);
   return r;
 }
 
@@ -756,8 +750,8 @@ HostDBContinuation::insert(unsigned int attl)
 // Get an entry by either name or IP
 //
 Action *
-HostDBProcessor::getby(Continuation * cont,
-                       const char *hostname, int len, sockaddr const* ip, bool aforce_dns, HostResStyle host_res_style, int dns_lookup_timeout)
+HostDBProcessor::getby(Continuation *cont, const char *hostname, int len, sockaddr const *ip, bool aforce_dns,
+                       HostResStyle host_res_style, int dns_lookup_timeout)
 {
   HostDBMD5 md5;
   EThread *thread = this_ethread();
@@ -790,7 +784,7 @@ HostDBProcessor::getby(Continuation * cont,
       // find the partition lock
       //
       // TODO: Could we reuse the "mutex" above safely? I think so but not sure.
-      ProxyMutex *bmutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+      ProxyMutex *bmutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
       MUTEX_TRY_LOCK(lock, bmutex, thread);
       MUTEX_TRY_LOCK(lock2, cont->mutex, thread);
 
@@ -803,10 +797,7 @@ HostDBProcessor::getby(Continuation * cont,
           if (!loop) {
             // No retry -> final result. Return it.
             Debug("hostdb", "immediate answer for %s",
-                  hostname ? hostname
-                  : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb)
-                  : "<null>"
-              );
+                  hostname ? hostname : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb) : "<null>");
             HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
             reply_to_cont(cont, r);
             return ACTION_RESULT_DONE;
@@ -817,10 +808,7 @@ HostDBProcessor::getby(Continuation * cont,
     } while (loop);
   }
   Debug("hostdb", "delaying force %d answer for %s", aforce_dns,
-    hostname ? hostname
-    : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb)
-    : "<null>"
-  );
+        hostname ? hostname : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb) : "<null>");
 
 Lretry:
   // Otherwise, create a continuation to do a deeper probe in the background
@@ -832,7 +820,7 @@ Lretry:
   opt.cont = cont;
   opt.host_res_style = host_res_style;
   c->init(md5, opt);
-  SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::probeEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::probeEvent);
 
   // Since ProxyMutexPtr has a cast operator, gcc-3.x get upset
   // about ambiguity when doing this comparison, so by reversing
@@ -850,7 +838,7 @@ Lretry:
 // Wrapper from getbyname to getby
 //
 Action *
-HostDBProcessor::getbyname_re(Continuation * cont, const char *ahostname, int len, Options const& opt)
+HostDBProcessor::getbyname_re(Continuation *cont, const char *ahostname, int len, Options const &opt)
 {
   bool force_dns = false;
   EThread *thread = this_ethread();
@@ -869,8 +857,8 @@ HostDBProcessor::getbyname_re(Continuation * cont, const char *ahostname, int le
 
 /* Support SRV records */
 Action *
-HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn process_srv_info,
-                                  const char *hostname, int len, Options const& opt)
+HostDBProcessor::getSRVbyname_imm(Continuation *cont, process_srv_info_pfn process_srv_info, const char *hostname, int len,
+                                  Options const &opt)
 {
   ink_assert(cont->mutex->thread_holding == this_ethread());
   bool force_dns = false;
@@ -890,7 +878,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
   HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
 
   if (!hostdb_enable || !*hostname) {
-    (cont->*process_srv_info) (NULL);
+    (cont->*process_srv_info)(NULL);
     return ACTION_RESULT_DONE;
   }
 
@@ -903,7 +891,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
   // Attempt to find the result in-line, for level 1 hits
   if (!force_dns) {
     // find the partition lock
-    ProxyMutex *bucket_mutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+    ProxyMutex *bucket_mutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
     MUTEX_TRY_LOCK(lock, bucket_mutex, thread);
 
     // If we can get the lock and a level 1 probe succeeds, return
@@ -913,7 +901,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
         Debug("hostdb", "immediate SRV answer for %s from hostdb", hostname);
         Debug("dns_srv", "immediate SRV answer for %s from hostdb", hostname);
         HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
-        (cont->*process_srv_info) (r);
+        (cont->*process_srv_info)(r);
         return ACTION_RESULT_DONE;
       }
     }
@@ -928,7 +916,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
   copt.cont = cont;
   copt.force_dns = force_dns;
   c->init(md5, copt);
-  SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::probeEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::probeEvent);
 
   if (thread->mutex == cont->mutex) {
     thread->schedule_in(c, MUTEX_RETRY_DELAY);
@@ -943,8 +931,8 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
 // Wrapper from getbyname to getby
 //
 Action *
-HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn process_hostdb_info,
-                               const char *hostname, int len, Options const& opt)
+HostDBProcessor::getbyname_imm(Continuation *cont, process_hostdb_info_pfn process_hostdb_info, const char *hostname, int len,
+                               Options const &opt)
 {
   ink_assert(cont->mutex->thread_holding == this_ethread());
   bool force_dns = false;
@@ -963,7 +951,7 @@ HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn proc
   HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
 
   if (!hostdb_enable || !*hostname) {
-    (cont->*process_hostdb_info) (NULL);
+    (cont->*process_hostdb_info)(NULL);
     return ACTION_RESULT_DONE;
   }
 
@@ -978,7 +966,7 @@ HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn proc
     do {
       loop = false; // loop only on explicit set for retry
       // find the partition lock
-      ProxyMutex *bucket_mutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+      ProxyMutex *bucket_mutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
       MUTEX_LOCK(lock, bucket_mutex, thread);
       // do a level 1 probe for immediate result.
       HostDBInfo *r = probe(bucket_mutex, md5, false);
@@ -989,7 +977,7 @@ HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn proc
           // No retry -> final result. Return it.
           Debug("hostdb", "immediate answer for %.*s", md5.host_len, md5.host_name);
           HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
-          (cont->*process_hostdb_info) (r);
+          (cont->*process_hostdb_info)(r);
           return ACTION_RESULT_DONE;
         }
         md5.refresh(); // Update for retry.
@@ -1007,7 +995,7 @@ HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn proc
   copt.timeout = opt.timeout;
   copt.host_res_style = opt.host_res_style;
   c->init(md5, copt);
-  SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::probeEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::probeEvent);
 
   thread->schedule_in(c, HOST_DB_RETRY_PERIOD);
 
@@ -1016,7 +1004,7 @@ HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn proc
 
 
 static void
-do_setby(HostDBInfo * r, HostDBApplicationInfo * app, const char *hostname, IpAddr const& ip, bool is_srv = false)
+do_setby(HostDBInfo *r, HostDBApplicationInfo *app, const char *hostname, IpAddr const &ip, bool is_srv = false)
 {
   HostDBRoundRobin *rr = r->rr();
 
@@ -1053,7 +1041,7 @@ do_setby(HostDBInfo * r, HostDBApplicationInfo * app, const char *hostname, IpAd
 }
 
 void
-HostDBProcessor::setby(const char *hostname, int len, sockaddr const* ip, HostDBApplicationInfo * app)
+HostDBProcessor::setby(const char *hostname, int len, sockaddr const *ip, HostDBApplicationInfo *app)
 {
   if (!hostdb_enable)
     return;
@@ -1067,7 +1055,7 @@ HostDBProcessor::setby(const char *hostname, int len, sockaddr const* ip, HostDB
 
   // Attempt to find the result in-line, for level 1 hits
 
-  ProxyMutex *mutex = hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets));
+  ProxyMutex *mutex = hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets));
   EThread *thread = this_ethread();
   MUTEX_TRY_LOCK(lock, mutex, thread);
 
@@ -1083,15 +1071,15 @@ HostDBProcessor::setby(const char *hostname, int len, sockaddr const* ip, HostDB
   c->init(md5);
   c->app.allotment.application1 = app->allotment.application1;
   c->app.allotment.application2 = app->allotment.application2;
-  SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::setbyEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::setbyEvent);
   thread->schedule_in(c, MUTEX_RETRY_DELAY);
 }
 
 void
-HostDBProcessor::setby_srv(const char *hostname, int len, const char *target, HostDBApplicationInfo * app)
+HostDBProcessor::setby_srv(const char *hostname, int len, const char *target, HostDBApplicationInfo *app)
 {
   if (!hostdb_enable || !hostname || !target)
-      return;
+    return;
 
   HostDBMD5 md5;
   md5.set_host(hostname, len ? len : strlen(hostname));
@@ -1106,8 +1094,7 @@ HostDBProcessor::setby_srv(const char *hostname, int len, const char *target, Ho
   ink_strlcpy(c->srv_target_name, target, MAXDNAME);
   c->app.allotment.application1 = app->allotment.application1;
   c->app.allotment.application2 = app->allotment.application2;
-  SET_CONTINUATION_HANDLER(c,
-      (HostDBContHandler) & HostDBContinuation::setbyEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::setbyEvent);
   eventProcessor.schedule_imm(c);
 }
 int
@@ -1124,7 +1111,7 @@ HostDBContinuation::setbyEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
 
 
 static int
-remove_round_robin(HostDBInfo * r, const char *hostname, IpAddr const& ip)
+remove_round_robin(HostDBInfo *r, const char *hostname, IpAddr const &ip)
 {
   if (r) {
     if (!r->round_robin)
@@ -1146,7 +1133,7 @@ remove_round_robin(HostDBInfo * r, const char *hostname, IpAddr const& ip)
         } else {
           if (diags->on("hostdb")) {
             int bufsize = rr->good * INET6_ADDRSTRLEN;
-            char *rr_ip_list = (char *) alloca(bufsize);
+            char *rr_ip_list = (char *)alloca(bufsize);
             char *p = rr_ip_list;
             for (int n = 0; n < rr->good; ++n) {
               ats_ip_ntop(rr->info[n].ip(), p, bufsize);
@@ -1164,7 +1151,7 @@ remove_round_robin(HostDBInfo * r, const char *hostname, IpAddr const& ip)
   return false;
 }
 
-# if 0
+#if 0
 Action *
 HostDBProcessor::failed_connect_on_ip_for_name(Continuation * cont, sockaddr const* ip, const char *hostname, int len)
 {
@@ -1201,11 +1188,11 @@ HostDBProcessor::failed_connect_on_ip_for_name(Continuation * cont, sockaddr con
 #endif
 
 int
-HostDBContinuation::removeEvent(int /* event ATS_UNUSED */, Event * e)
+HostDBContinuation::removeEvent(int /* event ATS_UNUSED */, Event *e)
 {
   Continuation *cont = action.continuation;
 
-  MUTEX_TRY_LOCK(lock, cont ? (ProxyMutex *) cont->mutex : (ProxyMutex *) NULL, e->ethread);
+  MUTEX_TRY_LOCK(lock, cont ? (ProxyMutex *)cont->mutex : (ProxyMutex *)NULL, e->ethread);
   if (!lock.is_locked()) {
     e->schedule_in(HOST_DB_RETRY_PERIOD);
     return EVENT_CONT;
@@ -1213,15 +1200,12 @@ HostDBContinuation::removeEvent(int /* event ATS_UNUSED */, Event * e)
   if (!action.cancelled) {
     if (!hostdb_enable) {
       if (cont)
-        cont->handleEvent(EVENT_HOST_DB_IP_REMOVED, (void *) NULL);
+        cont->handleEvent(EVENT_HOST_DB_IP_REMOVED, (void *)NULL);
     } else {
       HostDBInfo *r = probe(mutex, md5, false);
       bool res = (remove_round_robin(r, md5.host_name, md5.ip) ? true : false);
       if (cont)
-        cont->handleEvent(
-          EVENT_HOST_DB_IP_REMOVED,
-          res ? static_cast<void *>(&md5.ip) : static_cast<void *>(NULL)
-        );
+        cont->handleEvent(EVENT_HOST_DB_IP_REMOVED, res ? static_cast<void *>(&md5.ip) : static_cast<void *>(NULL));
     }
   }
   hostdb_cont_free(this);
@@ -1233,11 +1217,11 @@ HostDBContinuation::removeEvent(int /* event ATS_UNUSED */, Event * e)
 // calling continuation or to the calling cluster node.
 //
 HostDBInfo *
-HostDBContinuation::lookup_done(IpAddr const& ip, char const* aname, bool around_robin, unsigned int ttl_seconds, SRVHosts * srv)
+HostDBContinuation::lookup_done(IpAddr const &ip, char const *aname, bool around_robin, unsigned int ttl_seconds, SRVHosts *srv)
 {
   HostDBInfo *i = NULL;
 
-  ink_assert(this_ethread() == hostDB.lock_for_bucket((int) (fold_md5(md5.hash) % hostDB.buckets))->thread_holding);
+  ink_assert(this_ethread() == hostDB.lock_for_bucket((int)(fold_md5(md5.hash) % hostDB.buckets))->thread_holding);
   if (!ip.isValid() || !aname || !aname[0]) {
     if (is_byname()) {
       Debug("hostdb", "lookup_done() failed for '%.*s'", md5.host_len, md5.host_name);
@@ -1247,7 +1231,7 @@ HostDBContinuation::lookup_done(IpAddr const& ip, char const* aname, bool around
       ip_text_buffer b;
       Debug("hostdb", "failed for %s", md5.ip.toString(b, sizeof b));
     }
-    i = insert(hostdb_ip_fail_timeout_interval);        // currently ... 0
+    i = insert(hostdb_ip_fail_timeout_interval); // currently ... 0
     i->round_robin = false;
     i->is_srv = is_srv();
     i->reverse_dns = !is_byname() && !is_srv();
@@ -1276,7 +1260,8 @@ HostDBContinuation::lookup_done(IpAddr const& ip, char const* aname, bool around
     // Not sure about this - it seems wrong but I can't be sure. If we got a fail
     // in the DNS event, 0 is passed in which we then change to 1 here. Do we need this
     // to be non-zero to avoid an infinite timeout?
-    if (0 == ttl_seconds) ttl_seconds = 1;
+    if (0 == ttl_seconds)
+      ttl_seconds = 1;
 
     i = insert(ttl_seconds);
     if (is_byname()) {
@@ -1306,7 +1291,7 @@ HostDBContinuation::lookup_done(IpAddr const& ip, char const* aname, bool around
       const size_t s_size = strlen(aname) + 1;
       void *s = hostDB.alloc(&i->data.hostname_offset, s_size);
       if (s) {
-        ink_strlcpy((char *) s, aname, s_size);
+        ink_strlcpy((char *)s, aname, s_size);
         i->round_robin = false;
         i->reverse_dns = true;
         i->is_srv = false;
@@ -1326,7 +1311,7 @@ HostDBContinuation::lookup_done(IpAddr const& ip, char const* aname, bool around
 
 
 int
-HostDBContinuation::dnsPendingEvent(int event, Event * e)
+HostDBContinuation::dnsPendingEvent(int event, Event *e)
 {
   ink_assert(this_ethread() == hostDB.lock_for_bucket(fold_md5(md5.hash) % hostDB.buckets)->thread_holding);
   if (timeout) {
@@ -1335,7 +1320,7 @@ HostDBContinuation::dnsPendingEvent(int event, Event * e)
   }
   if (event == EVENT_INTERVAL) {
     // we timed out, return a failure to the user
-    MUTEX_TRY_LOCK_FOR(lock, action.mutex, ((Event *) e)->ethread, action.continuation);
+    MUTEX_TRY_LOCK_FOR(lock, action.mutex, ((Event *)e)->ethread, action.continuation);
     if (!lock.is_locked()) {
       timeout = eventProcessor.schedule_in(this, HOST_DB_RETRY_PERIOD);
       return EVENT_CONT;
@@ -1346,13 +1331,13 @@ HostDBContinuation::dnsPendingEvent(int event, Event * e)
     hostdb_cont_free(this);
     return EVENT_DONE;
   } else {
-    SET_HANDLER((HostDBContHandler) & HostDBContinuation::probeEvent);
+    SET_HANDLER((HostDBContHandler)&HostDBContinuation::probeEvent);
     return probeEvent(EVENT_INTERVAL, NULL);
   }
 }
 
 static int
-restore_info(HostDBInfo * r, HostDBInfo * old_r, HostDBInfo & old_info, HostDBRoundRobin * old_rr_data)
+restore_info(HostDBInfo *r, HostDBInfo *old_r, HostDBInfo &old_info, HostDBRoundRobin *old_rr_data)
 {
   if (old_rr_data) {
     for (int j = 0; j < old_rr_data->rrcount; j++)
@@ -1372,7 +1357,7 @@ restore_info(HostDBInfo * r, HostDBInfo * old_r, HostDBInfo & old_info, HostDBRo
 // DNS lookup result state
 //
 int
-HostDBContinuation::dnsEvent(int event, HostEnt * e)
+HostDBContinuation::dnsEvent(int event, HostEnt *e)
 {
   ink_assert(this_ethread() == hostDB.lock_for_bucket(fold_md5(md5.hash) % hostDB.buckets)->thread_holding);
   if (timeout) {
@@ -1416,7 +1401,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
     }
 
     ttl = failed ? 0 : e->ttl / 60;
-    int ttl_seconds = failed ? 0 : e->ttl; //ebalsa: moving to second accuracy
+    int ttl_seconds = failed ? 0 : e->ttl; // ebalsa: moving to second accuracy
 
     HostDBInfo *old_r = probe(mutex, md5, true);
     HostDBInfo old_info;
@@ -1426,28 +1411,24 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
 #ifdef DEBUG
     if (old_rr_data) {
       for (int i = 0; i < old_rr_data->rrcount; ++i) {
-        if (old_r->md5_high != old_rr_data->info[i].md5_high ||
-            old_r->md5_low != old_rr_data->info[i].md5_low ||
+        if (old_r->md5_high != old_rr_data->info[i].md5_high || old_r->md5_low != old_rr_data->info[i].md5_low ||
             old_r->md5_low_low != old_rr_data->info[i].md5_low_low)
           ink_assert(0);
       }
     }
 #endif
     int n = 0, nn = 0;
-    void* first = 0;
+    void *first = 0;
     uint8_t af = e ? e->ent.h_addrtype : AF_UNSPEC; // address family
     if (rr) {
       if (is_srv() && !failed) {
         n = e->srv_hosts.srv_host_count;
       } else {
-        void* ptr; // tmp for current entry.
-        for (
-            ; nn < HOST_DB_MAX_ROUND_ROBIN_INFO
-              && 0 != (ptr = e->ent.h_addr_list[nn])
-            ; ++nn
-        ) {
+        void *ptr; // tmp for current entry.
+        for (; nn < HOST_DB_MAX_ROUND_ROBIN_INFO && 0 != (ptr = e->ent.h_addr_list[nn]); ++nn) {
           if (is_addr_valid(af, ptr)) {
-            if (! first) first = ptr;
+            if (!first)
+              first = ptr;
             ++n;
           } else {
             Warning("Zero address removed from round-robin list for '%s'", md5.host_name);
@@ -1469,15 +1450,16 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
     IpAddr tip; // temp storage if needed.
 
     if (is_byname()) {
-      if (first) ip_addr_set(tip, af, first);
+      if (first)
+        ip_addr_set(tip, af, first);
       r = lookup_done(tip, md5.host_name, rr, ttl_seconds, failed ? 0 : &e->srv_hosts);
     } else if (is_srv()) {
       if (!failed)
-        tip._family = AF_INET; // force the tip valid, or else the srv will fail
-      r = lookup_done(tip,  /* junk: FIXME: is the code in lookup_done() wrong to NEED this? */
-                      md5.host_name,     /* hostname */
-                      rr,       /* is round robin, doesnt matter for SRV since we recheck getCount() inside lookup_done() */
-                      ttl_seconds,      /* ttl in seconds */
+        tip._family = AF_INET;       // force the tip valid, or else the srv will fail
+      r = lookup_done(tip,           /* junk: FIXME: is the code in lookup_done() wrong to NEED this? */
+                      md5.host_name, /* hostname */
+                      rr,            /* is round robin, doesnt matter for SRV since we recheck getCount() inside lookup_done() */
+                      ttl_seconds,   /* ttl in seconds */
                       failed ? 0 : &e->srv_hosts);
     } else if (failed) {
       r = lookup_done(tip, md5.host_name, false, ttl_seconds, 0);
@@ -1490,7 +1472,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
 
     if (rr) {
       const int rrsize = HostDBRoundRobin::size(n, e->srv_hosts.srv_hosts_length);
-      HostDBRoundRobin *rr_data = (HostDBRoundRobin *) hostDB.alloc(&r->app.rr.offset, rrsize);
+      HostDBRoundRobin *rr_data = (HostDBRoundRobin *)hostDB.alloc(&r->app.rr.offset, rrsize);
 
       Debug("hostdb", "allocating %d bytes for %d RR at %p %d", rrsize, n, rr_data, r->app.rr.offset);
 
@@ -1499,7 +1481,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
         int i = 0, ii = 0;
         if (is_srv()) {
           int skip = 0;
-          char *pos = (char *) rr_data + sizeof(HostDBRoundRobin) + n * sizeof(HostDBInfo);
+          char *pos = (char *)rr_data + sizeof(HostDBRoundRobin) + n * sizeof(HostDBInfo);
           SRV *q[HOST_DB_MAX_ROUND_ROBIN_INFO];
           ink_assert(n <= HOST_DB_MAX_ROUND_ROBIN_INFO);
           // sort
@@ -1518,7 +1500,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
 
           for (i = 0; i < n; ++i) {
             SRV *t = q[i];
-            HostDBInfo& item = rr_data->info[i];
+            HostDBInfo &item = rr_data->info[i];
 
             memset(&item, 0, sizeof(item));
             item.round_robin = 0;
@@ -1532,7 +1514,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
             ink_assert((skip + t->host_len) <= e->srv_hosts.srv_hosts_length);
 
             memcpy(pos + skip, t->host, t->host_len);
-            item.data.srv.srv_offset = (pos - (char *) rr_data) + skip;
+            item.data.srv.srv_offset = (pos - (char *)rr_data) + skip;
 
             skip += t->host_len;
 
@@ -1564,7 +1546,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
         } else {
           for (ii = 0; ii < nn; ++ii) {
             if (is_addr_valid(af, e->ent.h_addr_list[ii])) {
-              HostDBInfo& item = rr_data->info[i];
+              HostDBInfo &item = rr_data->info[i];
               ip_addr_set(item.ip(), af, e->ent.h_addr_list[ii]);
               item.full = 1;
               item.round_robin = 0;
@@ -1606,7 +1588,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
       // Check for IP family failover
       if (failed && check_for_retry(md5.db_mark, host_res_style)) {
         this->refresh_MD5(); // family changed if we're doing a retry.
-        SET_CONTINUATION_HANDLER(this, (HostDBContHandler) & HostDBContinuation::probeEvent);
+        SET_CONTINUATION_HANDLER(this, (HostDBContHandler)&HostDBContinuation::probeEvent);
         thread->schedule_in(this, MUTEX_RETRY_DELAY);
         return EVENT_CONT;
       }
@@ -1614,7 +1596,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
       MUTEX_TRY_LOCK_FOR(lock, action.mutex, thread, action.continuation);
       if (!lock.is_locked()) {
         remove_trigger_pending_dns();
-        SET_HANDLER((HostDBContHandler) & HostDBContinuation::probeEvent);
+        SET_HANDLER((HostDBContHandler)&HostDBContinuation::probeEvent);
         thread->schedule_in(this, HOST_DB_RETRY_PERIOD);
         return EVENT_CONT;
       }
@@ -1651,7 +1633,7 @@ struct HostDB_get_message {
 int
 HostDBContinuation::make_get_message(char *buf, int size)
 {
-  ink_assert(size >= (int) sizeof(HostDB_get_message));
+  ink_assert(size >= (int)sizeof(HostDB_get_message));
 
   HostDB_get_message *msg = reinterpret_cast<HostDB_get_message *>(buf);
   msg->md5 = md5.hash;
@@ -1671,7 +1653,8 @@ HostDBContinuation::make_get_message(char *buf, int size)
 //
 // Make and send a get message
 //
-bool HostDBContinuation::do_get_response(Event * /* e ATS_UNUSED */)
+bool
+HostDBContinuation::do_get_response(Event * /* e ATS_UNUSED */)
 {
   if (!hostdb_cluster)
     return false;
@@ -1697,17 +1680,17 @@ bool HostDBContinuation::do_get_response(Event * /* e ATS_UNUSED */)
   HostDB_get_message msg;
 
   memset(&msg, 0, sizeof(msg));
-  int len = make_get_message((char *) &msg, sizeof(HostDB_get_message));
+  int len = make_get_message((char *)&msg, sizeof(HostDB_get_message));
 
   // Setup this continuation, with a timeout
   //
   remoteHostDBQueue[key_partition()].enqueue(this);
-  SET_HANDLER((HostDBContHandler) & HostDBContinuation::clusterEvent);
+  SET_HANDLER((HostDBContHandler)&HostDBContinuation::clusterEvent);
   timeout = mutex->thread_holding->schedule_in(this, HOST_DB_CLUSTER_TIMEOUT);
 
   // Send the message
   //
-  clusterProcessor.invoke_remote(m->pop_ClusterHandler(), GET_HOSTINFO_CLUSTER_FUNCTION, (char *) &msg, len);
+  clusterProcessor.invoke_remote(m->pop_ClusterHandler(), GET_HOSTINFO_CLUSTER_FUNCTION, (char *)&msg, len);
 
   return true;
 }
@@ -1722,9 +1705,9 @@ struct HostDB_put_message {
   INK_MD5 md5;
   IpEndpoint ip;
   unsigned int ttl;
-  unsigned int missing:1;
-  unsigned int round_robin:1;
-  Continuation* cont;
+  unsigned int missing : 1;
+  unsigned int round_robin : 1;
+  Continuation *cont;
   unsigned int application1;
   unsigned int application2;
   int namelen;
@@ -1736,9 +1719,9 @@ struct HostDB_put_message {
 // Build the put message
 //
 int
-HostDBContinuation::make_put_message(HostDBInfo * r, Continuation * c, char *buf, int size)
+HostDBContinuation::make_put_message(HostDBInfo *r, Continuation *c, char *buf, int size)
 {
-  ink_assert(size >= (int) sizeof(HostDB_put_message));
+  ink_assert(size >= (int)sizeof(HostDB_put_message));
 
   HostDB_put_message *msg = reinterpret_cast<HostDB_put_message *>(buf);
   memset(msg, 0, sizeof(HostDB_put_message));
@@ -1770,7 +1753,7 @@ HostDBContinuation::make_put_message(HostDBInfo * r, Continuation * c, char *buf
 // Build the put message and send it
 //
 void
-HostDBContinuation::do_put_response(ClusterMachine * m, HostDBInfo * r, Continuation * c)
+HostDBContinuation::do_put_response(ClusterMachine *m, HostDBInfo *r, Continuation *c)
 {
   // don't remote fill round-robin DNS entries
   // if configured not to cluster them
@@ -1778,10 +1761,9 @@ HostDBContinuation::do_put_response(ClusterMachine * m, HostDBInfo * r, Continua
     return;
 
   HostDB_put_message msg;
-  int len = make_put_message(r, c, (char *) &msg, sizeof(HostDB_put_message));
-
-  clusterProcessor.invoke_remote(m->pop_ClusterHandler(), PUT_HOSTINFO_CLUSTER_FUNCTION, (char *) &msg, len);
+  int len = make_put_message(r, c, (char *)&msg, sizeof(HostDB_put_message));
 
+  clusterProcessor.invoke_remote(m->pop_ClusterHandler(), PUT_HOSTINFO_CLUSTER_FUNCTION, (char *)&msg, len);
 }
 
 
@@ -1789,7 +1771,7 @@ HostDBContinuation::do_put_response(ClusterMachine * m, HostDBInfo * r, Continua
 // Probe state
 //
 int
-HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event * e)
+HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event *e)
 {
   ink_assert(!link.prev && !link.next);
   EThread *t = e ? e->ethread : this_ethread();
@@ -1815,7 +1797,6 @@ HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event * e)
   }
 
   if (!force_dns) {
-
     // Do the probe
     //
     HostDBInfo *r = probe(mutex, md5, false);
@@ -1854,7 +1835,7 @@ HostDBContinuation::set_check_pending_dns()
 {
   Queue<HostDBContinuation> &q = hostDB.pending_dns_for_hash(md5.hash);
   HostDBContinuation *c = q.head;
-  for (; c; c = (HostDBContinuation *) c->link.next) {
+  for (; c; c = (HostDBContinuation *)c->link.next) {
     if (md5.hash == c->md5.hash) {
       Debug("hostdb", "enqueuing additional request");
       q.enqueue(this);
@@ -1874,7 +1855,7 @@ HostDBContinuation::remove_trigger_pending_dns()
   HostDBContinuation *c = q.head;
   Queue<HostDBContinuation> qq;
   while (c) {
-    HostDBContinuation *n = (HostDBContinuation *) c->link.next;
+    HostDBContinuation *n = (HostDBContinuation *)c->link.next;
     if (md5.hash == c->md5.hash) {
       Debug("hostdb", "dequeuing additional request");
       q.remove(c);
@@ -1915,7 +1896,7 @@ HostDBContinuation::do_dns()
     DNSProcessor::Options opt;
     opt.timeout = dns_lookup_timeout;
     opt.host_res_style = host_res_style_for(md5.db_mark);
-    SET_HANDLER((HostDBContHandler) & HostDBContinuation::dnsEvent);
+    SET_HANDLER((HostDBContHandler)&HostDBContinuation::dnsEvent);
     if (is_byname()) {
       if (md5.dns_server)
         opt.handler = md5.dns_server->x_dnsH;
@@ -1929,7 +1910,7 @@ HostDBContinuation::do_dns()
       pending_action = dnsProcessor.gethostbyaddr(this, &md5.ip, opt);
     }
   } else {
-    SET_HANDLER((HostDBContHandler) & HostDBContinuation::dnsPendingEvent);
+    SET_HANDLER((HostDBContHandler)&HostDBContinuation::dnsPendingEvent);
   }
 }
 
@@ -1938,11 +1919,11 @@ HostDBContinuation::do_dns()
 // Handle the response (put message)
 //
 int
-HostDBContinuation::clusterResponseEvent(int/*  event ATS_UNUSED */, Event * e)
+HostDBContinuation::clusterResponseEvent(int /*  event ATS_UNUSED */, Event *e)
 {
   if (from_cont) {
     HostDBContinuation *c;
-    for (c = (HostDBContinuation *) remoteHostDBQueue[key_partition()].head; c; c = (HostDBContinuation *) c->link.next)
+    for (c = (HostDBContinuation *)remoteHostDBQueue[key_partition()].head; c; c = (HostDBContinuation *)c->link.next)
       if (c == from_cont)
         break;
 
@@ -1975,7 +1956,7 @@ HostDBContinuation::clusterResponseEvent(int/*  event ATS_UNUSED */, Event * e)
 // Wait for the response (put message)
 //
 int
-HostDBContinuation::clusterEvent(int event, Event * e)
+HostDBContinuation::clusterEvent(int event, Event *e)
 {
   // remove ourselves from the queue
   //
@@ -1987,15 +1968,15 @@ HostDBContinuation::clusterEvent(int event, Event * e)
     hostdb_cont_free(this);
     return EVENT_DONE;
 
-    // handle the put response, e is really a HostDBContinuation *
-    //
+  // handle the put response, e is really a HostDBContinuation *
+  //
   case EVENT_HOST_DB_GET_RESPONSE:
     if (timeout) {
       timeout->cancel(this);
       timeout = NULL;
     }
     if (e) {
-      HostDBContinuation *c = (HostDBContinuation *) e;
+      HostDBContinuation *c = (HostDBContinuation *)e;
       HostDBInfo *r = lookup_done(md5.ip, c->md5.host_name, false, c->ttl, NULL);
       r->app.allotment.application1 = c->app.allotment.application1;
       r->app.allotment.application2 = c->app.allotment.application2;
@@ -2019,22 +2000,22 @@ HostDBContinuation::clusterEvent(int event, Event * e)
     }
     return failed_cluster_request(e);
 
-    // did not get the put message in time
-    //
-  case EVENT_INTERVAL:{
-      MUTEX_TRY_LOCK_FOR(lock, action.mutex, e->ethread, action.continuation);
-      if (!lock.is_locked()) {
-        e->schedule_in(HOST_DB_RETRY_PERIOD);
-        return EVENT_CONT;
-      }
-      return failed_cluster_request(e);
+  // did not get the put message in time
+  //
+  case EVENT_INTERVAL: {
+    MUTEX_TRY_LOCK_FOR(lock, action.mutex, e->ethread, action.continuation);
+    if (!lock.is_locked()) {
+      e->schedule_in(HOST_DB_RETRY_PERIOD);
+      return EVENT_CONT;
     }
+    return failed_cluster_request(e);
+  }
   }
 }
 
 
 int
-HostDBContinuation::failed_cluster_request(Event * e)
+HostDBContinuation::failed_cluster_request(Event *e)
 {
   if (action.cancelled) {
     hostdb_cont_free(this);
@@ -2056,7 +2037,7 @@ void
 get_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED */)
 {
   HostDBMD5 md5;
-  HostDB_get_message *msg = (HostDB_get_message *) data;
+  HostDB_get_message *msg = (HostDB_get_message *)data;
 
   md5.host_name = msg->name;
   md5.host_len = msg->namelen;
@@ -2071,7 +2052,7 @@ get_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
     pSD = SplitDNSConfig::acquire();
 
     if (0 != pSD) {
-      md5.dns_server = static_cast<DNSServer*>(pSD->getDNSRecord(hostname));
+      md5.dns_server = static_cast<DNSServer *>(pSD->getDNSRecord(hostname));
     }
     SplitDNSConfig::release(pSD);
   }
@@ -2079,7 +2060,7 @@ get_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
 
   HostDBContinuation *c = hostDBContAllocator.alloc();
   HostDBContinuation::Options copt;
-  SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::probeEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::probeEvent);
   c->from = ch->machine;
   c->from_cont = msg->cont;
 
@@ -2101,12 +2082,12 @@ get_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
 void
 put_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED */)
 {
-  HostDB_put_message *msg = (HostDB_put_message *) data;
+  HostDB_put_message *msg = (HostDB_put_message *)data;
   HostDBContinuation *c = hostDBContAllocator.alloc();
   HostDBContinuation::Options copt;
   HostDBMD5 md5;
 
-  SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::clusterResponseEvent);
+  SET_CONTINUATION_HANDLER(c, (HostDBContHandler)&HostDBContinuation::clusterResponseEvent);
   md5.host_name = msg->name;
   md5.host_len = msg->namelen;
   md5.ip.assign(&msg->ip.sa);
@@ -2116,7 +2097,7 @@ put_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
   copt.host_res_style = host_res_style_for(&msg->ip.sa);
   c->init(md5, copt);
   c->mutex = hostDB.lock_for_bucket(fold_md5(msg->md5) % hostDB.buckets);
-  c->from_cont = msg->cont;     // cannot use action if cont freed due to timeout
+  c->from_cont = msg->cont; // cannot use action if cont freed due to timeout
   c->missing = msg->missing;
   c->round_robin = msg->round_robin;
   c->ttl = msg->ttl;
@@ -2138,8 +2119,8 @@ HostDBContinuation::backgroundEvent(int /* event ATS_UNUSED */, Event * /* e ATS
   // hostdb_current_interval is bumped every HOST_DB_TIMEOUT_INTERVAL seconds
   // so we need to scale that so the user config value is in seconds.
   if (hostdb_hostfile_check_interval && // enabled
-      (hostdb_current_interval - hostdb_hostfile_check_timestamp) * (HOST_DB_TIMEOUT_INTERVAL / HRTIME_SECOND) > hostdb_hostfile_check_interval
-  ) {
+      (hostdb_current_interval - hostdb_hostfile_check_timestamp) * (HOST_DB_TIMEOUT_INTERVAL / HRTIME_SECOND) >
+        hostdb_hostfile_check_interval) {
     struct stat info;
     char path[sizeof(hostdb_hostfile_path)];
 
@@ -2163,7 +2144,8 @@ HostDBContinuation::backgroundEvent(int /* event ATS_UNUSED */, Event * /* e ATS
   return EVENT_CONT;
 }
 
-bool HostDBInfo::match(INK_MD5 & md5, int /* bucket ATS_UNUSED */, int buckets)
+bool
+HostDBInfo::match(INK_MD5 &md5, int /* bucket ATS_UNUSED */, int buckets)
 {
   if (md5[1] != md5_high)
     return false;
@@ -2174,14 +2156,13 @@ bool HostDBInfo::match(INK_MD5 & md5, int /* bucket ATS_UNUSED */, int buckets)
   if (!ttag)
     ttag = 1;
 
-  struct
-  {
-    unsigned int md5_low_low:24;
+  struct {
+    unsigned int md5_low_low : 24;
     unsigned int md5_low;
   } tmp;
 
-  tmp.md5_low_low = (unsigned int) ttag;
-  tmp.md5_low = (unsigned int) (ttag >> 24);
+  tmp.md5_low_low = (unsigned int)ttag;
+  tmp.md5_low = (unsigned int)(ttag >> 24);
 
   return tmp.md5_low_low == md5_low_low && tmp.md5_low == md5_low;
 }
@@ -2193,7 +2174,7 @@ HostDBInfo::hostname()
   if (!reverse_dns)
     return NULL;
 
-  return (char *) hostDB.ptr(&data.hostname_offset, hostDB.ptr_to_partition((char *) this));
+  return (char *)hostDB.ptr(&data.hostname_offset, hostDB.ptr_to_partition((char *)this));
 }
 
 
@@ -2203,9 +2184,10 @@ HostDBInfo::rr()
   if (!round_robin)
     return NULL;
 
-  HostDBRoundRobin *r = (HostDBRoundRobin *) hostDB.ptr(&app.rr.offset, hostDB.ptr_to_partition((char *) this));
+  HostDBRoundRobin *r = (HostDBRoundRobin *)hostDB.ptr(&app.rr.offset, hostDB.ptr_to_partition((char *)this));
 
-  if (r && (r->rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || r->rrcount <= 0 || r->good > HOST_DB_MAX_ROUND_ROBIN_INFO || r->good <= 0)) {
+  if (r &&
+      (r->rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || r->rrcount <= 0 || r->good > HOST_DB_MAX_ROUND_ROBIN_INFO || r->good <= 0)) {
     ink_assert(!"bad round-robin");
     return NULL;
   }
@@ -2245,20 +2227,20 @@ HostDBInfo::heap_offset_ptr()
 
 
 ClusterMachine *
-HostDBContinuation::master_machine(ClusterConfiguration * cc)
+HostDBContinuation::master_machine(ClusterConfiguration *cc)
 {
-  return cc->machine_hash((int) (md5.hash[1] >> 32));
+  return cc->machine_hash((int)(md5.hash[1] >> 32));
 }
 
 struct ShowHostDB;
-typedef int (ShowHostDB::*ShowHostDBEventHandler) (int event, Event * data);
-struct ShowHostDB: public ShowCont
-{
+typedef int (ShowHostDB::*ShowHostDBEventHandler)(int event, Event *data);
+struct ShowHostDB : public ShowCont {
   char *name;
   IpEndpoint ip;
   bool force;
 
-  int showMain(int event, Event * e)
+  int
+  showMain(int event, Event *e)
   {
     CHECK_SHOW(begin("HostDB"));
     CHECK_SHOW(show("<form method = GET action = \"./name\">\n"
@@ -2271,37 +2253,41 @@ struct ShowHostDB: public ShowCont
                     "</form>\n"
                     "<form method = GET action = \"./nameforce\">\n"
                     "Force DNS by name (e.g. trafficserver.apache.org):<br>\n"
-                    "<input type=text name=name size=64 maxlength=256>\n" "</form>\n"));
+                    "<input type=text name=name size=64 maxlength=256>\n"
+                    "</form>\n"));
     return complete(event, e);
   }
 
 
-  int showLookup(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
+  int
+  showLookup(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   {
     SET_HANDLER(&ShowHostDB::showLookupDone);
     if (name)
-      hostDBProcessor.getbyname_re(this, name, 0, HostDBProcessor::Options().setFlags(force ? HostDBProcessor::HOSTDB_FORCE_DNS_ALWAYS : 0));
+      hostDBProcessor.getbyname_re(this, name, 0,
+                                   HostDBProcessor::Options().setFlags(force ? HostDBProcessor::HOSTDB_FORCE_DNS_ALWAYS : 0));
     else
       hostDBProcessor.getbyaddr_re(this, &ip.sa);
     return EVENT_CONT;
   }
 
 
-  int showOne(HostDBInfo * r, bool rr, int event, Event * e)
+  int
+  showOne(HostDBInfo *r, bool rr, int event, Event *e)
   {
     ip_text_buffer b;
     CHECK_SHOW(show("<table border=1>\n"));
-    CHECK_SHOW(show("<tr><td>%s</td><td>%s%s</td></tr>\n",
-                    "Type", r->round_robin ? "Round-Robin" : "", r->reverse_dns ? "Reverse DNS" : "DNS"));
+    CHECK_SHOW(show("<tr><td>%s</td><td>%s%s</td></tr>\n", "Type", r->round_robin ? "Round-Robin" : "",
+                    r->reverse_dns ? "Reverse DNS" : "DNS"));
     CHECK_SHOW(show("<tr><td>%s</td><td>%u</td></tr>\n", "App1", r->app.allotment.application1));
     CHECK_SHOW(show("<tr><td>%s</td><td>%u</td></tr>\n", "App2", r->app.allotment.application2));
     if (!rr) {
-      CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Stale", r->is_ip_stale()? "Yes" : "No"));
-      CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Timed-Out", r->is_ip_timeout()? "Yes" : "No"));
+      CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Stale", r->is_ip_stale() ? "Yes" : "No"));
+      CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Timed-Out", r->is_ip_timeout() ? "Yes" : "No"));
       CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n", "TTL", r->ip_time_remaining()));
     }
     if (r->reverse_dns) {
-      CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Hostname", r->hostname()? r->hostname() : "<none>"));
+      CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Hostname", r->hostname() ? r->hostname() : "<none>"));
     } else {
       CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "IP", ats_ip_ntop(r->ip(), b, sizeof b)));
     }
@@ -2310,9 +2296,10 @@ struct ShowHostDB: public ShowCont
   }
 
 
-  int showLookupDone(int event, Event * e)
+  int
+  showLookupDone(int event, Event *e)
   {
-    HostDBInfo *r = (HostDBInfo *) e;
+    HostDBInfo *r = (HostDBInfo *)e;
 
     CHECK_SHOW(begin("HostDB Lookup"));
     if (name) {
@@ -2347,20 +2334,18 @@ struct ShowHostDB: public ShowCont
   }
 
 
-  ShowHostDB(Continuation * c, HTTPHdr * h)
-    : ShowCont(c, h), name(0), force(0)
-    {
-      ats_ip_invalidate(&ip);
-      SET_HANDLER(&ShowHostDB::showMain);
-    }
-
+  ShowHostDB(Continuation *c, HTTPHdr *h) : ShowCont(c, h), name(0), force(0)
+  {
+    ats_ip_invalidate(&ip);
+    SET_HANDLER(&ShowHostDB::showMain);
+  }
 };
 
-#define STR_LEN_EQ_PREFIX(_x,_l,_s) (!ptr_len_ncasecmp(_x,_l,_s,sizeof(_s)-1))
+#define STR_LEN_EQ_PREFIX(_x, _l, _s) (!ptr_len_ncasecmp(_x, _l, _s, sizeof(_s) - 1))
 
 
 static Action *
-register_ShowHostDB(Continuation * c, HTTPHdr * h)
+register_ShowHostDB(Continuation *c, HTTPHdr *h)
 {
   ShowHostDB *s = new ShowHostDB(c, h);
   int path_len;
@@ -2376,7 +2361,7 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
     if (s->sarg)
       gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
     if (gn) {
-      ats_ip_pton(gn+1, &s->ip); // hope that's null terminated.
+      ats_ip_pton(gn + 1, &s->ip); // hope that's null terminated.
     }
     SET_CONTINUATION_HANDLER(s, &ShowHostDB::showLookup);
   } else if (STR_LEN_EQ_PREFIX(path, path_len, "name")) {
@@ -2397,28 +2382,27 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
 
 
 #define HOSTDB_TEST_MAX_OUTSTANDING 100
-#define HOSTDB_TEST_LENGTH          100000
+#define HOSTDB_TEST_LENGTH 100000
 
 struct HostDBTestReverse;
-typedef int (HostDBTestReverse::*HostDBTestReverseHandler) (int, void *);
-struct HostDBTestReverse: public Continuation
-{
+typedef int (HostDBTestReverse::*HostDBTestReverseHandler)(int, void *);
+struct HostDBTestReverse : public Continuation {
   int outstanding;
   int total;
 #if HAVE_LRAND48_R
   struct drand48_data dr;
 #endif
 
-  int mainEvent(int event, Event * e)
+  int
+  mainEvent(int event, Event *e)
   {
     if (event == EVENT_HOST_DB_LOOKUP) {
-      HostDBInfo *i = (HostDBInfo *) e;
+      HostDBInfo *i = (HostDBInfo *)e;
       if (i)
-          printf("HostDBTestReverse: reversed %s\n", i->hostname());
-        outstanding--;
+        printf("HostDBTestReverse: reversed %s\n", i->hostname());
+      outstanding--;
     }
-    while (outstanding < HOSTDB_TEST_MAX_OUTSTANDING && total < HOSTDB_TEST_LENGTH)
-    {
+    while (outstanding < HOSTDB_TEST_MAX_OUTSTANDING && total < HOSTDB_TEST_LENGTH) {
       long l = 0;
 #if HAVE_LRAND48_R
       lrand48_r(&dr, &l);
@@ -2439,8 +2423,9 @@ struct HostDBTestReverse: public Continuation
     }
     return EVENT_CONT;
   }
-HostDBTestReverse():Continuation(new_ProxyMutex()), outstanding(0), total(0) {
-    SET_HANDLER((HostDBTestReverseHandler) & HostDBTestReverse::mainEvent);
+  HostDBTestReverse() : Continuation(new_ProxyMutex()), outstanding(0), total(0)
+  {
+    SET_HANDLER((HostDBTestReverseHandler)&HostDBTestReverse::mainEvent);
 #if HAVE_SRAND48_R
     srand48_r(time(NULL), &dr);
 #else
@@ -2477,37 +2462,32 @@ ink_hostdb_init(ModuleVersion v)
   init_called = 1;
   // do one time stuff
   // create a stat block for HostDBStats
-  hostdb_rsb = RecAllocateRawStatBlock((int) HostDB_Stat_Count);
+  hostdb_rsb = RecAllocateRawStatBlock((int)HostDB_Stat_Count);
 
   //
   // Register stats
   //
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.total_entries",
-                     RECD_INT, RECP_PERSISTENT, (int) hostdb_total_entries_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.total_entries", RECD_INT, RECP_PERSISTENT,
+                     (int)hostdb_total_entries_stat, RecRawStatSyncCount);
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.total_lookups",
-                     RECD_INT, RECP_PERSISTENT, (int) hostdb_total_lookups_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.total_lookups", RECD_INT, RECP_PERSISTENT,
+                     (int)hostdb_total_lookups_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.total_hits",
-                     RECD_INT, RECP_PERSISTENT, (int) hostdb_total_hits_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.total_hits", RECD_INT, RECP_PERSISTENT,
+                     (int)hostdb_total_hits_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.ttl", RECD_FLOAT, RECP_PERSISTENT, (int) hostdb_ttl_stat, RecRawStatSyncAvg);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.ttl", RECD_FLOAT, RECP_PERSISTENT, (int)hostdb_ttl_stat,
+                     RecRawStatSyncAvg);
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.ttl_expires",
-                     RECD_INT, RECP_PERSISTENT, (int) hostdb_ttl_expires_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.ttl_expires", RECD_INT, RECP_PERSISTENT,
+                     (int)hostdb_ttl_expires_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.re_dns_on_reload",
-                     RECD_INT, RECP_PERSISTENT, (int) hostdb_re_dns_on_reload_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.re_dns_on_reload", RECD_INT, RECP_PERSISTENT,
+                     (int)hostdb_re_dns_on_reload_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS,
-                     "proxy.process.hostdb.bytes", RECD_INT, RECP_PERSISTENT, (int) hostdb_bytes_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(hostdb_rsb, RECT_PROCESS, "proxy.process.hostdb.bytes", RECD_INT, RECP_PERSISTENT, (int)hostdb_bytes_stat,
+                     RecRawStatSyncCount);
 
   ts_host_res_global_init();
 }
@@ -2517,50 +2497,46 @@ ink_hostdb_init(ModuleVersion v)
 struct HostFilePair {
   typedef HostFilePair self;
   IpAddr ip;
-  char const* name;
+  char const *name;
 };
 
 struct HostDBFileContinuation : public Continuation {
   typedef HostDBFileContinuation self;
 
-  int idx; ///< Working index.
-  char const* name; ///< Host name (just for debugging)
-  INK_MD5 md5; ///< Key for entry.
+  int idx;          ///< Working index.
+  char const *name; ///< Host name (just for debugging)
+  INK_MD5 md5;      ///< Key for entry.
   typedef std::vector<INK_MD5> Keys;
-  Keys* keys; ///< Entries from file.
+  Keys *keys;          ///< Entries from file.
   ats_scoped_str path; ///< Used to keep the host file name around.
 
-  HostDBFileContinuation()
-    : Continuation(0)
-    {
-    }
+  HostDBFileContinuation() : Continuation(0) {}
 
-  int insertEvent(int event, void* data);
-  int removeEvent(int event, void* data);
+  int insertEvent(int event, void *data);
+  int removeEvent(int event, void *data);
 
   /// Set the current entry in the HostDB.
-  HostDBInfo* setDBEntry();
+  HostDBInfo *setDBEntry();
   /// Create and schedule an update continuation.
-  static void scheduleUpdate(
-    int idx, ///< Pair index to process.
-    Keys* keys = 0 ///< Key table if any.
-    );
+  static void scheduleUpdate(int idx,       ///< Pair index to process.
+                             Keys *keys = 0 ///< Key table if any.
+                             );
   /// Create and schedule a remove continuation.
-  static void scheduleRemove(
-    int idx, ///< Index of current new key to check against.
-    Keys* keys ///< new valid keys
-    );
+  static void scheduleRemove(int idx,   ///< Index of current new key to check against.
+                             Keys *keys ///< new valid keys
+                             );
   /// Finish update
-  static void finish(
-    Keys* keys ///< Valid keys from update.
-    );
+  static void finish(Keys *keys ///< Valid keys from update.
+                     );
   /// Clean up this instance.
   void destroy();
 };
 
 ClassAllocator<HostDBFileContinuation> hostDBFileContAllocator("hostDBFileContAllocator");
 
-void HostDBFileContinuation::destroy() {
+void
+HostDBFileContinuation::destroy()
+{
   this->~HostDBFileContinuation();
   hostDBFileContAllocator.free(this);
 }
@@ -2580,20 +2556,23 @@ std::vector<HostFilePair> HostFilePairs;
 HostDBFileContinuation::Keys HostFileKeys;
 /// Ordering operator for HostFilePair.
 /// We want to group first by name and then by address family.
-bool CmpHostFilePair(HostFilePair const& lhs, HostFilePair const& rhs) {
+bool
+CmpHostFilePair(HostFilePair const &lhs, HostFilePair const &rhs)
+{
   int zret = strcasecmp(lhs.name, rhs.name);
   return zret < 0 || (0 == zret && lhs.ip < rhs.ip);
 }
 // Actual ordering doesn't matter as long as it's consistent.
-bool CmpMD5(INK_MD5 const& lhs, INK_MD5 const& rhs) {
-  return lhs[0] < rhs[0] || 
-    (lhs[0] == rhs[0] && lhs[1] < rhs[1])
-    ;
+bool
+CmpMD5(INK_MD5 const &lhs, INK_MD5 const &rhs)
+{
+  return lhs[0] < rhs[0] || (lhs[0] == rhs[0] && lhs[1] < rhs[1]);
 }
 
 /// Finish current update.
 void
-HostDBFileContinuation::finish(Keys* keys) {
+HostDBFileContinuation::finish(Keys *keys)
+{
   HostFilePairs.clear();
   HostFileKeys.clear();
   if (keys) {
@@ -2605,19 +2584,18 @@ HostDBFileContinuation::finish(Keys* keys) {
   HostDBFileUpdateActive = 0;
 }
 
-HostDBInfo*
-HostDBFileContinuation::setDBEntry() {
-  HostDBInfo* r;
+HostDBInfo *
+HostDBFileContinuation::setDBEntry()
+{
+  HostDBInfo *r;
   uint64_t folded_md5 = fold_md5(md5);
 
   // remove the old one to prevent buildup
   if (0 != (r = hostDB.lookup_block(folded_md5, 3))) {
     hostDB.delete_block(r);
-    Debug("hostdb", "Update host file entry %s - %" PRIx64 ".%" PRIx64,
-          name, md5[0], md5[1] );
+    Debug("hostdb", "Update host file entry %s - %" PRIx64 ".%" PRIx64, name, md5[0], md5[1]);
   } else {
-    Debug("hostdb", "Add host file entry %s - %" PRIx64 ".%" PRIx64,
-          name, md5[0],md5[1] );
+    Debug("hostdb", "Add host file entry %s - %" PRIx64 ".%" PRIx64, name, md5[0], md5[1]);
   }
 
   r = hostDB.insert_block(folded_md5, NULL, 0);
@@ -2629,11 +2607,12 @@ HostDBFileContinuation::setDBEntry() {
 }
 
 int
-HostDBFileContinuation::insertEvent(int, void*) {
+HostDBFileContinuation::insertEvent(int, void *)
+{
   int n = HostFilePairs.size();
-  HostFilePair const& first = HostFilePairs[idx];
+  HostFilePair const &first = HostFilePairs[idx];
   int last = idx + 1;
-  HostDBInfo* r = 0;
+  HostDBInfo *r = 0;
 
   ink_assert(idx < n);
 
@@ -2651,11 +2630,11 @@ HostDBFileContinuation::insertEvent(int, void*) {
   if (k > 1) {
     // multiple entries, need round robin
     int s = HostDBRoundRobin::size(k, false);
-    HostDBRoundRobin* rr_data = static_cast<HostDBRoundRobin*>(hostDB.alloc(&r->app.rr.offset, s));
+    HostDBRoundRobin *rr_data = static_cast<HostDBRoundRobin *>(hostDB.alloc(&r->app.rr.offset, s));
     if (rr_data) {
       int dst = 0; // index of destination RR item.
-      for (int src = idx ; src < last ; ++src, ++dst ) {
-        HostDBInfo& item = rr_data->info[dst];
+      for (int src = idx; src < last; ++src, ++dst) {
+        HostDBInfo &item = rr_data->info[dst];
         item.data.ip.assign(HostFilePairs[src].ip);
         item.full = 1;
         item.round_robin = false;
@@ -2684,7 +2663,7 @@ HostDBFileContinuation::insertEvent(int, void*) {
     this->scheduleUpdate(last, keys);
   } else {
     std::sort(keys->begin(), keys->end(), &CmpMD5);
-//    keys->qsort(&CmpMD5);
+    //    keys->qsort(&CmpMD5);
     // Switch to removing dead entries.
     this->scheduleRemove(keys->size() - 1, keys);
   }
@@ -2694,10 +2673,11 @@ HostDBFileContinuation::insertEvent(int, void*) {
 }
 
 int
-HostDBFileContinuation::removeEvent(int, void*) {
-  HostDBInfo* r;
+HostDBFileContinuation::removeEvent(int, void *)
+{
+  HostDBInfo *r;
   uint64_t folded_md5 = fold_md5(md5);
-  Debug("hostdb", "Remove host file entry %" PRIx64 ".%" PRIx64, md5[0],md5[1] );
+  Debug("hostdb", "Remove host file entry %" PRIx64 ".%" PRIx64, md5[0], md5[1]);
   if (0 != (r = hostDB.lookup_block(folded_md5, 3)))
     hostDB.delete_block(r);
   this->scheduleRemove(idx, keys);
@@ -2706,9 +2686,10 @@ HostDBFileContinuation::removeEvent(int, void*) {
 }
 
 void
-HostDBFileContinuation::scheduleUpdate(int idx, Keys* keys) {
-  HostDBFileContinuation* c = hostDBFileContAllocator.alloc();
-  HostFilePair& pair = HostFilePairs[idx];
+HostDBFileContinuation::scheduleUpdate(int idx, Keys *keys)
+{
+  HostDBFileContinuation *c = hostDBFileContAllocator.alloc();
+  HostFilePair &pair = HostFilePairs[idx];
   HostDBMD5 md5;
 
   md5.set_host(pair.name, strlen(pair.name));
@@ -2722,11 +2703,11 @@ HostDBFileContinuation::scheduleUpdate(int idx, Keys* keys) {
   c->md5 = md5.hash;
   c->mutex = hostDB.lock_for_bucket(fold_md5(md5.hash) % hostDB.buckets);
   eventProcessor.schedule_imm(c, ET_CALL, EVENT_IMMEDIATE, 0);
-
 }
 
 void
-HostDBFileContinuation::scheduleRemove(int idx, Keys* keys) {
+HostDBFileContinuation::scheduleRemove(int idx, Keys *keys)
+{
   bool targetp = false; // Have a valid target?
   INK_MD5 md5;
 
@@ -2755,7 +2736,7 @@ HostDBFileContinuation::scheduleRemove(int idx, Keys* keys) {
   }
 
   if (targetp) {
-    HostDBFileContinuation* c = hostDBFileContAllocator.alloc();
+    HostDBFileContinuation *c = hostDBFileContAllocator.alloc();
     SET_CONTINUATION_HANDLER(c, &HostDBFileContinuation::removeEvent);
     c->md5 = md5;
     c->idx = idx;
@@ -2768,14 +2749,15 @@ HostDBFileContinuation::scheduleRemove(int idx, Keys* keys) {
 }
 
 void
-ParseHostLine(char* l) {
+ParseHostLine(char *l)
+{
   Tokenizer elts(" \t");
   int n_elts = elts.Initialize(l, SHARE_TOKS);
   // Elements should be the address then a list of host names.
   // Don't use RecHttpLoadIp because the address *must* be literal.
   HostFilePair item;
   if (n_elts > 1 && 0 == item.ip.load(elts[0]) && !item.ip.isLoopback()) {
-    for ( int i = 1 ; i < n_elts ; ++i ) {
+    for (int i = 1; i < n_elts; ++i) {
       item.name = elts[i];
       HostFilePairs.push_back(item);
     }
@@ -2784,10 +2766,11 @@ ParseHostLine(char* l) {
 
 
 void
-ParseHostFile(char const* path) {
+ParseHostFile(char const *path)
+{
   bool success = false;
   // Test and set for update in progress.
-  if (0 != ink_atomic_swap(&HostDBFileUpdateActive,1)) {
+  if (0 != ink_atomic_swap(&HostDBFileUpdateActive, 1)) {
     Debug("hostdb", "Skipped load of host file because update already in progress");
     return;
   }
@@ -2798,11 +2781,11 @@ ParseHostFile(char const* path) {
     struct stat info;
     if (0 == fstat(fd, &info)) {
       // +1 in case no terminating newline
-      int64_t size = info.st_size+1;
-      HostFileText = static_cast<char*>(ats_malloc(size));
+      int64_t size = info.st_size + 1;
+      HostFileText = static_cast<char *>(ats_malloc(size));
       if (HostFileText) {
-        char* base = HostFileText;
-        char* limit;
+        char *base = HostFileText;
+        char *limit;
 
         size = read(fd, HostFileText, info.st_size);
         limit = HostFileText + size;
@@ -2816,10 +2799,13 @@ ParseHostFile(char const* path) {
           char *spot = strchr(base, '\n');
 
           // terminate the line.
-          if (0 == spot) spot = limit; // no trailing EOL, grab remaining
-          else *spot = 0;
+          if (0 == spot)
+            spot = limit; // no trailing EOL, grab remaining
+          else
+            *spot = 0;
 
-          while (base < spot && isspace(*base)) ++base; // skip leading ws
+          while (base < spot && isspace(*base))
+            ++base;                        // skip leading ws
           if (*base != '#' && base < spot) // non-empty non-comment line
             ParseHostLine(base);
           base = spot + 1;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/I_HostDB.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/I_HostDB.h b/iocore/hostdb/I_HostDB.h
index a823e55..25a3fa9 100644
--- a/iocore/hostdb/I_HostDB.h
+++ b/iocore/hostdb/I_HostDB.h
@@ -42,9 +42,6 @@
 #define HOSTDB_MODULE_MAJOR_VERSION 2
 #define HOSTDB_MODULE_MINOR_VERSION 0
 
-#define HOSTDB_MODULE_VERSION makeModuleVersion(                 \
-                                    HOSTDB_MODULE_MAJOR_VERSION, \
-                                    HOSTDB_MODULE_MINOR_VERSION, \
-                                    PUBLIC_MODULE_HEADER)
+#define HOSTDB_MODULE_VERSION makeModuleVersion(HOSTDB_MODULE_MAJOR_VERSION, HOSTDB_MODULE_MINOR_VERSION, PUBLIC_MODULE_HEADER)
 
 #endif /* _I_HostDB_h_ */


[05/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/load_http_hdr.cc
----------------------------------------------------------------------
diff --git a/lib/ts/load_http_hdr.cc b/lib/ts/load_http_hdr.cc
index 2ea31a3..66de373 100644
--- a/lib/ts/load_http_hdr.cc
+++ b/lib/ts/load_http_hdr.cc
@@ -43,18 +43,17 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-enum hdr_type
-{
+enum hdr_type {
   UNKNOWN_HDR,
   REQUEST_HDR,
   RESPONSE_HDR,
   HTTP_INFO_HDR,
-  RAW_MBUFFER
+  RAW_MBUFFER,
 };
 
 void walk_mime_field(MIMEField f);
-void walk_mstring(MBuffer * bufp, int32_t offset);
-void walk_mbuffer(MBuffer * bufp);
+void walk_mstring(MBuffer *bufp, int32_t offset);
+void walk_mbuffer(MBuffer *bufp);
 void print_http_info_impl(HTTPInfo hi);
 void print_http_hdr_impl(HTTPHdr h);
 
@@ -110,7 +109,6 @@ dump_hdr(char *mbuf, hdr_type h_type)
 void
 load_buffer(int fd, hdr_type h_type)
 {
-
   struct stat s_info;
 
   if (fstat(fd, &s_info) < 0) {
@@ -166,7 +164,6 @@ load_buffer(int fd, hdr_type h_type)
   int cur_line = 0;
 
   while (cur_line < num_lines && bytes_read < mbuf_size) {
-
     int *cur_ptr;
     num_el = el_tok.Initialize(line_tok[cur_line]);
 
@@ -176,7 +173,7 @@ load_buffer(int fd, hdr_type h_type)
         fprintf(stderr, "Corrupted data file\n");
         exit(1);
       }
-      cur_ptr = (int *) (mbuf + bytes_read);
+      cur_ptr = (int *)(mbuf + bytes_read);
       *cur_ptr = el;
       bytes_read += 4;
     }
@@ -185,7 +182,7 @@ load_buffer(int fd, hdr_type h_type)
 
   if (bytes_read != mbuf_length) {
     fprintf(stderr, "Size mismatch: read %d  mbuf_length %d  mbuf_size %d\n", bytes_read, mbuf_length, mbuf_size);
-//      exit(1);
+    //      exit(1);
   }
 
   /*
@@ -213,7 +210,6 @@ load_buffer(int fd, hdr_type h_type)
 int
 main(int argc, const char *argv[])
 {
-
   hdr_type h_type = UNKNOWN_HDR;
 
   http_init();
@@ -251,63 +247,46 @@ main(int argc, const char *argv[])
   Code for manual groking the mbuf objects
 *******************************************************************/
 
-//extern const char *marshal_strs[];
-
-char *marshal_type_strs[] = {
-  "EMPTY ",
-  "OBJ   ",
-  "STR   ",
-  "URL   ",
-  "URL_F ",
-  "URL_H ",
-  "M_VALS",
-  "M_FLD ",
-  "M_HDR ",
-  "H_HDR ",
-  "H_REQ ",
-  "H_RESP",
-  "H_INFO"
-};
+// extern const char *marshal_strs[];
+
+char *marshal_type_strs[] = {"EMPTY ", "OBJ   ", "STR   ", "URL   ", "URL_F ", "URL_H ", "M_VALS",
+                             "M_FLD ", "M_HDR ", "H_HDR ", "H_REQ ", "H_RESP", "H_INFO"};
 
 void
-walk_mbuffer(MBuffer * bufp)
+walk_mbuffer(MBuffer *bufp)
 {
   int offset = 3;
   int max_offset = (*bufp->m_length) / 4;
 
   do {
-    MObjectImpl *mo = (MObjectImpl *) mbuffer_get_obj(bufp, offset);
-    printf("offset %.3d  m_length %.2d  m_type %s     ", offset, (int) mo->m_length, marshal_type_strs[mo->type]);
-
-    switch ((int) mo->type) {
-    case MARSHAL_MIME_FIELD:
-      {
-        MIMEField f(bufp, offset);
-        walk_mime_field(f);
-        break;
-      }
-    case MARSHAL_STRING:
-      {
-        walk_mstring(bufp, offset);
-        printf("\n");
-        break;
-      }
-    case MARSHAL_HTTP_INFO:
-      {
-        HTTPInfo i(bufp, offset);
-        print_http_info_impl(i);
-        printf("\n");
-        break;
-      }
+    MObjectImpl *mo = (MObjectImpl *)mbuffer_get_obj(bufp, offset);
+    printf("offset %.3d  m_length %.2d  m_type %s     ", offset, (int)mo->m_length, marshal_type_strs[mo->type]);
+
+    switch ((int)mo->type) {
+    case MARSHAL_MIME_FIELD: {
+      MIMEField f(bufp, offset);
+      walk_mime_field(f);
+      break;
+    }
+    case MARSHAL_STRING: {
+      walk_mstring(bufp, offset);
+      printf("\n");
+      break;
+    }
+    case MARSHAL_HTTP_INFO: {
+      HTTPInfo i(bufp, offset);
+      print_http_info_impl(i);
+      printf("\n");
+      break;
+    }
     case MARSHAL_HTTP_HEADER:
     case MARSHAL_HTTP_HEADER_REQ:
-    case MARSHAL_HTTP_HEADER_RESP:
-      {
-        HTTPHdr h(bufp, offset);
-        print_http_hdr_impl(h);
-        printf("\n");
-        break;
-      }
+    case MARSHAL_HTTP_HEADER_RESP: {
+      HTTPHdr h(bufp, offset);
+      print_http_hdr_impl(h);
+      printf("\n");
+      break;
+    }
 
 
     default:
@@ -319,16 +298,16 @@ walk_mbuffer(MBuffer * bufp)
 }
 
 void
-walk_mstring(MBuffer * bufp, int32_t offset)
+walk_mstring(MBuffer *bufp, int32_t offset)
 {
   int bufindex = 0;
   int dumpoffset = 0;
   char fbuf[4096];
 
-//    int32_t soffset = field_offset;
-//    soffset <<= MARSHAL_ALIGNMENT;
-//    printf("offset: %d.  shifted field_offset: %d\n",
-//         field_offset, soffset);
+  //    int32_t soffset = field_offset;
+  //    soffset <<= MARSHAL_ALIGNMENT;
+  //    printf("offset: %d.  shifted field_offset: %d\n",
+  //         field_offset, soffset);
 
   memset(fbuf, 0, 4096);
   mstring_print(bufp, offset, fbuf, 4095, &bufindex, &dumpoffset);
@@ -339,22 +318,21 @@ walk_mstring(MBuffer * bufp, int32_t offset)
 void
 walk_mime_field(MIMEField f)
 {
-
   int bufindex = 0;
   int dumpoffset = 0;
   char fbuf[4096];
 
-//    int32_t soffset = field_offset;
-//    soffset <<= MARSHAL_ALIGNMENT;
-//    printf("offset: %d.  shifted field_offset: %d\n",
-//         field_offset, soffset);
+  //    int32_t soffset = field_offset;
+  //    soffset <<= MARSHAL_ALIGNMENT;
+  //    printf("offset: %d.  shifted field_offset: %d\n",
+  //         field_offset, soffset);
 
   MIMEFieldImpl *fi = MIMEFieldPtr(f.m_buffer, f.m_offset);
   memset(fbuf, 0, 4096);
   mime_field_print(f.m_buffer, f.m_offset, fbuf, 4095, &bufindex, &dumpoffset);
 
-  printf("(%d,%d) [%d,%d,%d] %s", (int) fi->m_nvalues, (int) fi->m_flags,
-         (int) fi->m_name_offset, (int) fi->m_values_offset, (int) fi->m_next_offset, fbuf);
+  printf("(%d,%d) [%d,%d,%d] %s", (int)fi->m_nvalues, (int)fi->m_flags, (int)fi->m_name_offset, (int)fi->m_values_offset,
+         (int)fi->m_next_offset, fbuf);
 }
 
 void
@@ -409,8 +387,7 @@ print_http_info_impl(HTTPInfo hi)
     return;
   }
 
-  printf("id: %d  rid: %d  req: %d  resp: %d",
-         info->m_id, info->m_rid, info->m_request_offset, info->m_response_offset);
+  printf("id: %d  rid: %d  req: %d  resp: %d", info->m_id, info->m_rid, info->m_request_offset, info->m_response_offset);
 }
 
 void
@@ -419,18 +396,16 @@ print_http_hdr_impl(HTTPHdr h)
   HTTPHdrImpl *hdr = HTTPHdrPtr(h.m_buffer, h.m_offset);
 
   if (hdr->type == MARSHAL_HTTP_HEADER) {
-    printf("fields: %d", (int) hdr->m_fields_offset);
+    printf("fields: %d", (int)hdr->m_fields_offset);
     return;
   } else if (hdr->type == MARSHAL_HTTP_HEADER_REQ) {
-    printf("method: %d  url: %d  fields: %d",
-           (int) hdr->u.req.m_method_offset, (int) hdr->u.req.m_url_offset, (int) hdr->m_fields_offset);
+    printf("method: %d  url: %d  fields: %d", (int)hdr->u.req.m_method_offset, (int)hdr->u.req.m_url_offset,
+           (int)hdr->m_fields_offset);
   } else if (hdr->type == MARSHAL_HTTP_HEADER_RESP) {
-    printf("status: %d  reason: %d  fields: %d",
-           (int) hdr->u.resp.m_status, (int) hdr->u.resp.m_reason_offset, (int) hdr->m_fields_offset);
+    printf("status: %d  reason: %d  fields: %d", (int)hdr->u.resp.m_status, (int)hdr->u.resp.m_reason_offset,
+           (int)hdr->m_fields_offset);
   } else {
     printf("Type match failed\n");
     return;
   }
-
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/lockfile.cc
----------------------------------------------------------------------
diff --git a/lib/ts/lockfile.cc b/lib/ts/lockfile.cc
index f6e9587..d8646ad 100644
--- a/lib/ts/lockfile.cc
+++ b/lib/ts/lockfile.cc
@@ -24,22 +24,22 @@
 #include "ink_platform.h"
 #include "ink_lockfile.h"
 
-#define LOCKFILE_BUF_LEN 16     // 16 bytes should be enought for a pid
+#define LOCKFILE_BUF_LEN 16 // 16 bytes should be enought for a pid
 
 int
-Lockfile::Open(pid_t * holding_pid)
+Lockfile::Open(pid_t *holding_pid)
 {
   char buf[LOCKFILE_BUF_LEN];
   pid_t val;
   int err;
   *holding_pid = 0;
 
-#define FAIL(x) \
-{ \
-  if (fd > 0) \
-    close (fd); \
-  return (x); \
-}
+#define FAIL(x)  \
+  {              \
+    if (fd > 0)  \
+      close(fd); \
+    return (x);  \
+  }
 
   struct flock lock;
   char *t;
@@ -89,7 +89,7 @@ Lockfile::Open(pid_t * holding_pid)
     *t = '\0';
 
     // coverity[secure_coding]
-    if (sscanf(buf, "%d\n", (int*)&val) != 1) {
+    if (sscanf(buf, "%d\n", (int *)&val) != 1) {
       *holding_pid = 0;
     } else {
       *holding_pid = val;
@@ -118,13 +118,13 @@ Lockfile::Open(pid_t * holding_pid)
   // Return the file descriptor of the opened lockfile. When this file
   // descriptor is closed the lock will be released.
 
-  return (1);                   // success
+  return (1); // success
 
 #undef FAIL
 }
 
 int
-Lockfile::Get(pid_t * holding_pid)
+Lockfile::Get(pid_t *holding_pid)
 {
   char buf[LOCKFILE_BUF_LEN];
   int err;
@@ -152,18 +152,18 @@ Lockfile::Get(pid_t * holding_pid)
     return (-errno);
   }
   // Write our process id to the Lockfile.
-  snprintf(buf, sizeof(buf), "%d\n", (int) getpid());
+  snprintf(buf, sizeof(buf), "%d\n", (int)getpid());
 
   do {
     err = write(fd, buf, strlen(buf));
   } while ((err < 0) && (errno == EINTR));
 
-  if (err != (int) strlen(buf)) {
+  if (err != (int)strlen(buf)) {
     close(fd);
     return (-errno);
   }
 
-  return (1);                   // success
+  return (1); // success
 }
 
 void
@@ -205,14 +205,14 @@ lockfile_kill_internal(pid_t init_pid, int init_sig, pid_t pid, const char * /*
     // Wait for children to exit
     do {
       err = waitpid(-1, &status, WNOHANG);
-      if (err == -1) break;
-    } while(!WIFEXITED(status) && !WIFSIGNALED(status));
+      if (err == -1)
+        break;
+    } while (!WIFEXITED(status) && !WIFSIGNALED(status));
   }
 
   do {
     err = kill(pid, sig);
   } while ((err == 0) || ((err < 0) && (errno == EINTR)));
-
 }
 
 void
@@ -223,10 +223,10 @@ Lockfile::Kill(int sig, int initial_sig, const char *pname)
   pid_t holding_pid;
 
   err = Open(&holding_pid);
-  if (err == 1)                 // success getting the lock file
+  if (err == 1) // success getting the lock file
   {
     Close();
-  } else if (err == 0)          // someone else has the lock
+  } else if (err == 0) // someone else has the lock
   {
     pid = holding_pid;
     if (pid != 0) {
@@ -243,10 +243,10 @@ Lockfile::KillGroup(int sig, int initial_sig, const char *pname)
   pid_t holding_pid;
 
   err = Open(&holding_pid);
-  if (err == 1)                 // success getting the lock file
+  if (err == 1) // success getting the lock file
   {
     Close();
-  } else if (err == 0)          // someone else has the lock
+  } else if (err == 0) // someone else has the lock
   {
     do {
       pid = getpgid(holding_pid);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/mkdfa.c
----------------------------------------------------------------------
diff --git a/lib/ts/mkdfa.c b/lib/ts/mkdfa.c
index d02ae25..7b94b93 100644
--- a/lib/ts/mkdfa.c
+++ b/lib/ts/mkdfa.c
@@ -27,29 +27,26 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define SIZEOF(t) (sizeof (t) / (sizeof ((t)[0])))
+#define SIZEOF(t) (sizeof(t) / (sizeof((t)[0])))
 
 
 typedef struct _info_t info_t;
 typedef struct _state_t state_t;
 typedef struct _transition_t transition_t;
 
-struct _info_t
-{
+struct _info_t {
   const char *name;
   const char *value;
   int namelen;
 };
 
-struct _state_t
-{
+struct _state_t {
   int num;
   const char *value;
   transition_t *transitions;
 };
 
-struct _transition_t
-{
+struct _transition_t {
   int value;
   state_t *state;
   transition_t *next;
@@ -269,7 +266,7 @@ mkstate()
 {
   state_t *state;
 
-  state = (state_t *) malloc(sizeof(state_t));
+  state = (state_t *)malloc(sizeof(state_t));
   state->num = state_count++;
   state->value = NULL;
   state->transitions = NULL;
@@ -282,7 +279,7 @@ mktransition()
 {
   transition_t *transition;
 
-  transition = (transition_t *) malloc(sizeof(transition_t));
+  transition = (transition_t *)malloc(sizeof(transition_t));
   transition->value = 0;
   transition->state = NULL;
   transition->next = NULL;
@@ -291,7 +288,7 @@ mktransition()
 }
 
 void
-prstate(state_t * state)
+prstate(state_t *state)
 {
   transition_t *transitions;
 
@@ -315,7 +312,7 @@ prstate(state_t * state)
 }
 
 void
-add_states(state_t * state, info_t * info, int pos)
+add_states(state_t *state, info_t *info, int pos)
 {
   transition_t *transitions;
 
@@ -378,7 +375,7 @@ prtable(const char *type, const char *name, int *table, int size)
 }
 
 int
-mkmap(state_t * state)
+mkmap(state_t *state)
 {
   static int count = 1;
 
@@ -401,7 +398,7 @@ mkmap(state_t * state)
 }
 
 void
-mkaccept(state_t * state, const char *defvalue)
+mkaccept(state_t *state, const char *defvalue)
 {
   transition_t *transitions;
 
@@ -418,11 +415,11 @@ mkaccept(state_t * state, const char *defvalue)
 }
 
 void
-mkprefix(state_t * state, char *prefix, int length)
+mkprefix(state_t *state, char *prefix, int length)
 {
   transition_t *transitions;
 
-  prefixtbl[state->num] = (char *) malloc(sizeof(char) * (length + 1));
+  prefixtbl[state->num] = (char *)malloc(sizeof(char) * (length + 1));
   strncpy(prefixtbl[state->num], prefix, length);
   prefixtbl[state->num][length] = '\0';
 
@@ -435,7 +432,7 @@ mkprefix(state_t * state, char *prefix, int length)
 }
 
 int
-checkbase(state_t * state, int base)
+checkbase(state_t *state, int base)
 {
   transition_t *transitions;
 
@@ -450,7 +447,7 @@ checkbase(state_t * state, int base)
 }
 
 void
-mktranstables(state_t * state)
+mktranstables(state_t *state)
 {
   transition_t *transitions;
   int base;
@@ -483,14 +480,14 @@ mktranstables(state_t * state)
 }
 
 void
-mktables(state_t * state, const char *defvalue, int useprefix)
+mktables(state_t *state, const char *defvalue, int useprefix)
 {
   char prefix[1024];
   int char_count;
   int i;
 
   /* make the character map */
-  map = (int *) malloc(sizeof(int) * 256);
+  map = (int *)malloc(sizeof(int) * 256);
   for (i = 0; i < 256; i++)
     map[i] = 0;
 
@@ -500,7 +497,7 @@ mktables(state_t * state, const char *defvalue, int useprefix)
   printf("\n");
 
   /* make the accept state table */
-  accepttbl = (const char **) malloc(sizeof(const char *) * state_count);
+  accepttbl = (const char **)malloc(sizeof(const char *) * state_count);
   for (i = 0; i < state_count; i++)
     accepttbl[i] = NULL;
 
@@ -517,7 +514,7 @@ mktables(state_t * state, const char *defvalue, int useprefix)
 
   /* make the prefix table */
   if (useprefix) {
-    prefixtbl = (char **) malloc(sizeof(char *) * state_count);
+    prefixtbl = (char **)malloc(sizeof(char *) * state_count);
     for (i = 0; i < state_count; i++)
       prefixtbl[i] = NULL;
 
@@ -535,9 +532,9 @@ mktables(state_t * state, const char *defvalue, int useprefix)
 
   /* make the state transition tables */
 
-  basetbl = (int *) malloc(sizeof(int) * state_count);
-  nexttbl = (int *) malloc(sizeof(int) * (state_count + char_count));
-  checktbl = (int *) malloc(sizeof(int) * (state_count + char_count));
+  basetbl = (int *)malloc(sizeof(int) * state_count);
+  nexttbl = (int *)malloc(sizeof(int) * (state_count + char_count));
+  checktbl = (int *)malloc(sizeof(int) * (state_count + char_count));
 
   for (i = 0; i < state_count; i++) {
     basetbl[i] = -1;
@@ -568,7 +565,7 @@ rundfa(const char *buf, int length)
   end = buf + length;
 
   while (buf != end) {
-    ch = map[(int) *buf++];
+    ch = map[(int)*buf++];
 
     tmp = basetbl[state] + ch;
     if (checktbl[tmp] != state)
@@ -580,7 +577,7 @@ rundfa(const char *buf, int length)
 }
 
 void
-mkdfa(info_t * infos, int ninfos, int useprefix, int debug)
+mkdfa(info_t *infos, int ninfos, int useprefix, int debug)
 {
   /*
      static const char *names[] =

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/signals.cc
----------------------------------------------------------------------
diff --git a/lib/ts/signals.cc b/lib/ts/signals.cc
index 58676b3..ec11af3 100644
--- a/lib/ts/signals.cc
+++ b/lib/ts/signals.cc
@@ -34,7 +34,7 @@ bool
 signal_check_handler(int signal, signal_handler_t handler)
 {
   struct sigaction oact;
-  void * sigact;
+  void *sigact;
 
   ink_release_assert(sigaction(signal, NULL, &oact) == 0);
   if (handler == (signal_handler_t)SIG_DFL || handler == (signal_handler_t)SIG_IGN) {
@@ -60,7 +60,7 @@ signal_check_handler(int signal, signal_handler_t handler)
 void
 check_signals(signal_handler_t handler)
 {
-  signal_check_handler(SIGPIPE, (signal_handler_t) SIG_IGN);
+  signal_check_handler(SIGPIPE, (signal_handler_t)SIG_IGN);
   signal_check_handler(SIGQUIT, handler);
   signal_check_handler(SIGHUP, handler);
   signal_check_handler(SIGTERM, handler);
@@ -99,7 +99,7 @@ signal_reset_default(int signo)
 // certain the DEC pthreads SIGPIPE bug isn't back..
 //
 static void *
-check_signal_thread(void * ptr)
+check_signal_thread(void *ptr)
 {
   signal_handler_t handler = (signal_handler_t)ptr;
   for (;;) {
@@ -153,7 +153,7 @@ signal_is_crash(int signo)
 }
 
 void
-signal_format_siginfo(int signo, siginfo_t * info, const char * msg)
+signal_format_siginfo(int signo, siginfo_t *info, const char *msg)
 {
   (void)info;
   (void)signo;
@@ -213,8 +213,7 @@ signal_register_default_handler(signal_handler_t handler)
 
   set_signal(SIGQUIT, handler);
   set_signal(SIGTERM, handler);
-  set_signal(SIGINT,  handler);
+  set_signal(SIGINT, handler);
   set_signal(SIGUSR1, handler);
   set_signal(SIGUSR2, handler);
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/signals.h
----------------------------------------------------------------------
diff --git a/lib/ts/signals.h b/lib/ts/signals.h
index b94f30f..558a884 100644
--- a/lib/ts/signals.h
+++ b/lib/ts/signals.h
@@ -29,7 +29,7 @@
 #ifndef __SIGNALS_H__
 #define __SIGNALS_H__
 
-typedef void (*signal_handler_t)(int signo, siginfo_t * info, void * ctx);
+typedef void (*signal_handler_t)(int signo, siginfo_t *info, void *ctx);
 
 // Default crash signal handler that dumps a stack trace and exits.
 void signal_crash_handler(int, siginfo_t *, void *);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_List.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_List.cc b/lib/ts/test_List.cc
index fc736ac..86618b0 100644
--- a/lib/ts/test_List.cc
+++ b/lib/ts/test_List.cc
@@ -24,36 +24,43 @@
 
 #include "List.h"
 
-class Foo { public:
+class Foo
+{
+public:
   int x;
 
-  void foo() {}
+  void
+  foo()
+  {
+  }
 
   SLINK(Foo, slink);
   LINK(Foo, dlink);
 
-  Foo(int i = 0): x(i) {}
+  Foo(int i = 0) : x(i) {}
 };
 
-int main() {
-   SList(Foo,slink) s;
-   DList(Foo,dlink) d;
-   Que(Foo,dlink) q;
-   Foo *f = new Foo;
-   f->x = 7;
-   s.push(f);
-   d.push(s.pop());
-   q.enqueue(d.pop());
-   for (int i = 0; i < 100; i++)
-     q.enqueue(new Foo(i));
-   int tot = 0;
-   for (int i = 0; i < 101; i++)
-     tot += q.dequeue()->x;
-   if (tot != 4957) {
-     printf("test_List FAILED\n");
-     exit(1);
-   } else {
-     printf("test_List PASSED\n");
-     exit(0);
-   }
+int
+main()
+{
+  SList(Foo, slink) s;
+  DList(Foo, dlink) d;
+  Que(Foo, dlink) q;
+  Foo *f = new Foo;
+  f->x = 7;
+  s.push(f);
+  d.push(s.pop());
+  q.enqueue(d.pop());
+  for (int i = 0; i < 100; i++)
+    q.enqueue(new Foo(i));
+  int tot = 0;
+  for (int i = 0; i < 101; i++)
+    tot += q.dequeue()->x;
+  if (tot != 4957) {
+    printf("test_List FAILED\n");
+    exit(1);
+  } else {
+    printf("test_List PASSED\n");
+    exit(0);
+  }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_Map.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_Map.cc b/lib/ts/test_Map.cc
index 3824607..bb0c12c 100644
--- a/lib/ts/test_Map.cc
+++ b/lib/ts/test_Map.cc
@@ -33,8 +33,12 @@ struct Item {
     typedef Item Value;
     typedef DList(Item, m_link) ListHead;
 
-    static ID hash(Key key) { return key; }
-    static Key key(Value*);
+    static ID
+    hash(Key key)
+    {
+      return key;
+    }
+    static Key key(Value *);
     static bool equal(Key lhs, Key rhs);
   };
 
@@ -45,61 +49,75 @@ struct Item {
   Item(uint32_t key, uint32_t value) : _key(key), _value(value) {}
 };
 
-uint32_t Item::Hash::key(Value* v) { return v->_key; }
-bool Item::Hash::equal(Key lhs, Key rhs) { return lhs == rhs; }
+uint32_t
+Item::Hash::key(Value *v)
+{
+  return v->_key;
+}
+bool
+Item::Hash::equal(Key lhs, Key rhs)
+{
+  return lhs == rhs;
+}
 
 typedef TSHashTable<Item::Hash> Table;
 
-void test_TSHashTable() {
+void
+test_TSHashTable()
+{
   static uint32_t const N = 270;
   Table t;
-  Item* item;
+  Item *item;
   Table::Location loc;
 
   item = new Item(1);
   t.insert(item);
-  for ( uint32_t i = 2 ; i <= N ; ++i ) {
+  for (uint32_t i = 2; i <= N; ++i) {
     t.insert(new Item(i));
   }
 
-  for ( uint32_t i = 1 ; i <= N ; ++i) {
+  for (uint32_t i = 1; i <= N; ++i) {
     Table::Location l = t.find(i);
     ink_assert(l.isValid());
     ink_assert(i == l->_value);
   }
 
-  ink_assert(!(t.find(N*2).isValid()));
+  ink_assert(!(t.find(N * 2).isValid()));
 
-  loc = t.find(N/2 | 1);
+  loc = t.find(N / 2 | 1);
   if (loc)
     t.remove(loc);
   else
-    ink_assert(! "Did not find expected value");
+    ink_assert(!"Did not find expected value");
 
-  if (! loc)
+  if (!loc)
     ; // compiler check.
 
-  ink_assert(!(t.find(N/2 | 1).isValid()));
+  ink_assert(!(t.find(N / 2 | 1).isValid()));
 
-  for ( uint32_t i = 1 ; i <= N ; i += 2) {
+  for (uint32_t i = 1; i <= N; i += 2) {
     t.remove(i);
   }
 
-  for ( uint32_t i = 1 ; i <= N ; ++i) {
+  for (uint32_t i = 1; i <= N; ++i) {
     Table::Location l = t.find(i);
-    if (1 & i) ink_assert(! l.isValid());
-    else ink_assert(l.isValid());
+    if (1 & i)
+      ink_assert(!l.isValid());
+    else
+      ink_assert(l.isValid());
   }
 
   int n = 0;
-  for ( Table::iterator spot = t.begin(), limit = t.end() ; spot != limit ; ++spot ) {
+  for (Table::iterator spot = t.begin(), limit = t.end(); spot != limit; ++spot) {
     ++n;
     ink_assert((spot->_value & 1) == 0);
   }
-  ink_assert(n == N/2);
+  ink_assert(n == N / 2);
 }
 
-int main(int /* argc ATS_UNUSED */, char **/*argv ATS_UNUSED */) {
+int
+main(int /* argc ATS_UNUSED */, char ** /*argv ATS_UNUSED */)
+{
   typedef Map<cchar *, cchar *> SSMap;
   typedef MapElem<cchar *, cchar *> SSMapElem;
 #define form_SSMap(_p, _v) form_Map(SSMapElem, _p, _v)
@@ -108,17 +126,17 @@ int main(int /* argc ATS_UNUSED */, char **/*argv ATS_UNUSED */) {
   ssm.put("b", "B");
   ssm.put("c", "C");
   ssm.put("d", "D");
-  form_SSMap(x, ssm) { /* nop */ }
-
-/*
-  if ((ssm).n)
-    for (SSMapElem *qq__x = (SSMapElem*)0, *x = &(ssm).v[0];
-             ((intptr_t)(qq__x) < (ssm).n) && ((x = &(ssm).v[(intptr_t)qq__x]) || 1);
-             qq__x = (SSMapElem*)(((intptr_t)qq__x) + 1))
-          if ((x)->key) {
-            // nop
-          }
-          */
+  form_SSMap(x, ssm) { /* nop */}
+
+  /*
+    if ((ssm).n)
+      for (SSMapElem *qq__x = (SSMapElem*)0, *x = &(ssm).v[0];
+               ((intptr_t)(qq__x) < (ssm).n) && ((x = &(ssm).v[(intptr_t)qq__x]) || 1);
+               qq__x = (SSMapElem*)(((intptr_t)qq__x) + 1))
+            if ((x)->key) {
+              // nop
+            }
+            */
 
   StringChainHash<> h;
   cchar *hi = "hi", *ho = "ho", *hum = "hum", *hhi = "hhi";
@@ -197,4 +215,3 @@ int main(int /* argc ATS_UNUSED */, char **/*argv ATS_UNUSED */) {
 
   printf("test_Map PASSED\n");
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_Regex.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_Regex.cc b/lib/ts/test_Regex.cc
index 8ed4323..792cdeb 100644
--- a/lib/ts/test_Regex.cc
+++ b/lib/ts/test_Regex.cc
@@ -34,17 +34,12 @@ typedef struct {
 } test_t;
 
 static const test_t test_data[] = {
-  {"^foo", {{"foo", true},
-            {"bar", false},
-            {"foobar", true},
-            {"foobarbaz", true}}},
-  {"foo$", {{"foo", true},
-            {"bar", false},
-            {"foobar", false},
-            {"foobarbaz", false}}},
+  {"^foo", {{"foo", true}, {"bar", false}, {"foobar", true}, {"foobarbaz", true}}},
+  {"foo$", {{"foo", true}, {"bar", false}, {"foobar", false}, {"foobarbaz", false}}},
 };
 
-static void test_basic()
+static void
+test_basic()
 {
   for (unsigned int i = 0; i < countof(test_data); i++) {
     Regex r;
@@ -58,7 +53,8 @@ static void test_basic()
   }
 }
 
-int main(int /* argc ATS_UNUSED */, char **/* argv ATS_UNUSED */)
+int
+main(int /* argc ATS_UNUSED */, char ** /* argv ATS_UNUSED */)
 {
   test_basic();
   printf("test_Regex PASSED\n");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_Vec.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_Vec.cc b/lib/ts/test_Vec.cc
index f8693c1..2eb7cc6 100644
--- a/lib/ts/test_Vec.cc
+++ b/lib/ts/test_Vec.cc
@@ -27,7 +27,8 @@
 #include <ink_assert.h>
 #include "Vec.h"
 
-static void test_append()
+static void
+test_append()
 {
   static const char value[] = "this is a string";
   unsigned int len = (int)sizeof(value) - 1;
@@ -52,24 +53,25 @@ static void test_append()
   ink_assert(str.length() == 1000 * len);
 }
 
-static void test_basic()
+static void
+test_basic()
 {
   Vec<void *> v, vv, vvv;
   int tt = 99 * 50, t = 0;
 
   for (size_t i = 0; i < 100; i++)
-    v.add((void*)(intptr_t)i);
+    v.add((void *)(intptr_t)i);
   for (size_t i = 0; i < 100; i++)
     t += (int)(intptr_t)v.v[i];
   ink_assert(t == tt);
 
   t = 0;
   for (size_t i = 1; i < 100; i++)
-    vv.set_add((void*)(intptr_t)i);
+    vv.set_add((void *)(intptr_t)i);
   for (size_t i = 1; i < 100; i++)
-    vvv.set_add((void*)(intptr_t)i);
+    vvv.set_add((void *)(intptr_t)i);
   for (size_t i = 1; i < 100; i++)
-    vvv.set_add((void*)(intptr_t)(i * 1000));
+    vvv.set_add((void *)(intptr_t)(i * 1000));
   vv.set_union(vvv);
   for (size_t i = 0; i < vv.n; i++)
     if (vv.v[i])
@@ -80,7 +82,7 @@ static void test_basic()
   v.reserve(1000);
   t = 0;
   for (size_t i = 0; i < 1000; i++)
-    v.add((void*)(intptr_t)i);
+    v.add((void *)(intptr_t)i);
   for (size_t i = 0; i < 1000; i++)
     t += (int)(intptr_t)v.v[i];
   ink_assert(t == 999 * 500);
@@ -108,20 +110,21 @@ static void test_basic()
 
   UnionFind uf;
   uf.size(4);
-  uf.unify(0,1);
-  uf.unify(2,3);
+  uf.unify(0, 1);
+  uf.unify(2, 3);
   ink_assert(uf.find(2) == uf.find(3));
   ink_assert(uf.find(0) == uf.find(1));
   ink_assert(uf.find(0) != uf.find(3));
   ink_assert(uf.find(1) != uf.find(3));
   ink_assert(uf.find(1) != uf.find(2));
   ink_assert(uf.find(0) != uf.find(2));
-  uf.unify(1,2);
+  uf.unify(1, 2);
   ink_assert(uf.find(0) == uf.find(3));
   ink_assert(uf.find(1) == uf.find(3));
 }
 
-int main(int /* argc ATS_UNUSED */, char **/* argv ATS_UNUSED */)
+int
+main(int /* argc ATS_UNUSED */, char ** /* argv ATS_UNUSED */)
 {
   test_append();
   test_basic();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_arena.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_arena.cc b/lib/ts/test_arena.cc
index e0d83b2..515a8bf 100644
--- a/lib/ts/test_arena.cc
+++ b/lib/ts/test_arena.cc
@@ -84,7 +84,7 @@ test_block_boundries()
 
     // Allocate and fill the array
     for (j = 0; j < regions_to_test; j++) {
-      test_regions[j] = (char *) a->alloc(test_size);
+      test_regions[j] = (char *)a->alloc(test_size);
       fill_test_data(test_regions[j], test_size, j);
     }
 
@@ -106,7 +106,7 @@ test_block_boundries()
     a->reset();
   }
 
-  delete[]test_regions;
+  delete[] test_regions;
   delete a;
   return failures;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_atomic.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_atomic.cc b/lib/ts/test_atomic.cc
index ba95daf..932328a 100644
--- a/lib/ts/test_atomic.cc
+++ b/lib/ts/test_atomic.cc
@@ -43,7 +43,7 @@ volatile int al_done = 0;
 void *
 testalist(void *ame)
 {
-  int me = (int) (uintptr_t) ame;
+  int me = (int)(uintptr_t)ame;
   int j, k;
   for (k = 0; k < MAX_ALIST_ARRAY; k++)
     ink_atomiclist_push(&al[k % MAX_ALIST_TEST], &al_test[me][k]);
@@ -51,21 +51,20 @@ testalist(void *ame)
   for (j = 0; j < 1000000; j++)
     if ((x = ink_atomiclist_pop(&al[me])))
       ink_atomiclist_push(&al[rand() % MAX_ALIST_TEST], x);
-  ink_atomic_increment((int *) &al_done, 1);
+  ink_atomic_increment((int *)&al_done, 1);
   return NULL;
 }
 #endif // !LONG_ATOMICLIST_TEST
 
 #ifdef LONG_ATOMICLIST_TEST
 /************************************************************************/
-#define MAX_ATOMIC_LISTS	(4 * 1024)
-#define MAX_ITEMS_PER_LIST	(1 * 1024)
-#define MAX_TEST_THREADS	64
+#define MAX_ATOMIC_LISTS (4 * 1024)
+#define MAX_ITEMS_PER_LIST (1 * 1024)
+#define MAX_TEST_THREADS 64
 static InkAtomicList alists[MAX_ATOMIC_LISTS];
 struct listItem *items[MAX_ATOMIC_LISTS * MAX_ITEMS_PER_LIST];
 
-struct listItem
-{
+struct listItem {
   int data1;
   int data2;
   void *link;
@@ -83,11 +82,11 @@ init_data()
   struct listItem *plistItem;
 
   for (ali = 0; ali < MAX_ATOMIC_LISTS; ali++)
-    ink_atomiclist_init(&alists[ali], "alist", ((char *) &l.link - (char *) &l));
+    ink_atomiclist_init(&alists[ali], "alist", ((char *)&l.link - (char *)&l));
 
   for (ali = 0; ali < MAX_ATOMIC_LISTS; ali++) {
     for (j = 0; j < MAX_ITEMS_PER_LIST; j++) {
-      plistItem = (struct listItem *) malloc(sizeof(struct listItem));
+      plistItem = (struct listItem *)malloc(sizeof(struct listItem));
       items[ali + j] = plistItem;
       plistItem->data1 = ali + j;
       plistItem->data2 = ali + rand();
@@ -109,26 +108,26 @@ cycle_data(void *d)
   int iterations;
   int me;
 
-  me = (int) d;
+  me = (int)d;
   iterations = 0;
 
   while (1) {
     l = &alists[(me + rand()) % MAX_ATOMIC_LISTS];
 
-    pli = (struct listItem *) ink_atomiclist_popall(l);
+    pli = (struct listItem *)ink_atomiclist_popall(l);
     if (!pli)
       continue;
 
     // Place listItems into random queues
     while (pli) {
       ink_assert((pli->data1 ^ pli->data2 ^ pli->data3 ^ pli->data4) == pli->check);
-      pli_next = (struct listItem *) pli->link;
+      pli_next = (struct listItem *)pli->link;
       pli->link = 0;
-      ink_atomiclist_push(&alists[(me + rand()) % MAX_ATOMIC_LISTS], (void *) pli);
+      ink_atomiclist_push(&alists[(me + rand()) % MAX_ATOMIC_LISTS], (void *)pli);
       pli = pli_next;
     }
     iterations++;
-    poll(0, 0, 10);             // 10 msec delay
+    poll(0, 0, 10); // 10 msec delay
     if ((iterations % 100) == 0)
       printf("%d ", me);
   }
@@ -138,13 +137,13 @@ cycle_data(void *d)
 #endif // LONG_ATOMICLIST_TEST
 
 int
-main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
+main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
 {
 #ifndef LONG_ATOMICLIST_TEST
   int32_t m = 1, n = 100;
-  //int64 lm = 1LL, ln = 100LL;
-  const char* m2 = "hello";
-  char* n2;
+  // int64 lm = 1LL, ln = 100LL;
+  const char *m2 = "hello";
+  char *n2;
 
   printf("sizeof(int32_t)==%d   sizeof(void *)==%d\n", (int)sizeof(int32_t), (int)sizeof(void *));
 
@@ -158,16 +157,16 @@ main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
   printf("changed to: %d,  result=%s\n", m, n ? "true" : "false");
 
   printf("CAS pointer: '%s' == 'hello'  then  'new'\n", m2);
-  n = ink_atomic_cas( &m2,  "hello",  "new");
-  printf("changed to: %s, result=%s\n", m2, n ? (char *) "true" : (char *) "false");
+  n = ink_atomic_cas(&m2, "hello", "new");
+  printf("changed to: %s, result=%s\n", m2, n ? (char *)"true" : (char *)"false");
 
   printf("CAS pointer: '%s' == 'hello'  then  'new2'\n", m2);
-  n = ink_atomic_cas(&m2, m2,  "new2");
+  n = ink_atomic_cas(&m2, m2, "new2");
   printf("changed to: %s, result=%s\n", m2, n ? "true" : "false");
 
   n = 100;
   printf("Atomic Inc of %d\n", n);
-  m = ink_atomic_increment((int *) &n, 1);
+  m = ink_atomic_increment((int *)&n, 1);
   printf("changed to: %d,  result=%d\n", n, m);
 
 
@@ -205,11 +204,11 @@ main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
 
     init_data();
     for (id = 0; id < MAX_TEST_THREADS; id++) {
-      ink_assert(thr_create(NULL, 0, cycle_data, (void *) id, THR_NEW_LWP, NULL) == 0);
+      ink_assert(thr_create(NULL, 0, cycle_data, (void *)id, THR_NEW_LWP, NULL) == 0);
     }
   }
   while (1) {
-    poll(0, 0, 10);             // 10 msec delay
+    poll(0, 0, 10); // 10 msec delay
   }
 #endif // LONG_ATOMICLIST_TEST
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_freelist.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_freelist.cc b/lib/ts/test_freelist.cc
index 677da63..9d8e5b4 100644
--- a/lib/ts/test_freelist.cc
+++ b/lib/ts/test_freelist.cc
@@ -37,7 +37,7 @@ test(void *d)
   int id;
   void *m1, *m2, *m3;
 
-  id = (intptr_t) d;
+  id = (intptr_t)d;
 
   time_t start = time(NULL);
   int count = 0;
@@ -47,8 +47,8 @@ test(void *d)
     m3 = ink_freelist_new(flist);
 
     if ((m1 == m2) || (m1 == m3) || (m2 == m3)) {
-      printf("0x%08" PRIx64 "   0x%08" PRIx64 "   0x%08" PRIx64 "\n",
-             (uint64_t)(uintptr_t)m1, (uint64_t)(uintptr_t)m2, (uint64_t)(uintptr_t)m3);
+      printf("0x%08" PRIx64 "   0x%08" PRIx64 "   0x%08" PRIx64 "\n", (uint64_t)(uintptr_t)m1, (uint64_t)(uintptr_t)m2,
+             (uint64_t)(uintptr_t)m3);
       exit(1);
     }
 
@@ -65,12 +65,11 @@ test(void *d)
       return NULL;
     }
   }
-
 }
 
 
 int
-main(int /* argc ATS_UNUSED */, char */*argv ATS_UNUSED */[])
+main(int /* argc ATS_UNUSED */, char * /*argv ATS_UNUSED */ [])
 {
   int i;
 
@@ -81,7 +80,7 @@ main(int /* argc ATS_UNUSED */, char */*argv ATS_UNUSED */[])
     ink_thread_create(test, (void *)((intptr_t)i));
   }
 
-  test((void *) NTHREADS);
+  test((void *)NTHREADS);
 
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_geometry.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_geometry.cc b/lib/ts/test_geometry.cc
index ffa01d7..ff14e4c 100644
--- a/lib/ts/test_geometry.cc
+++ b/lib/ts/test_geometry.cc
@@ -28,7 +28,8 @@
 // geometry of an arbitrary device file. That's useful when figuring out how ATS will
 // perceive different devices on differen operating systems.
 
-int main(int argc, const char ** argv)
+int
+main(int argc, const char **argv)
 {
   for (int i = 1; i < argc; ++i) {
     int fd;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_memchr.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_memchr.cc b/lib/ts/test_memchr.cc
index 6f990fd..294207c 100644
--- a/lib/ts/test_memchr.cc
+++ b/lib/ts/test_memchr.cc
@@ -29,17 +29,17 @@
 void *
 ink_memchr(const void *as, int ac, size_t an)
 {
-  unsigned char c = (unsigned char) ac;
-  unsigned char *s = (unsigned char *) as;
+  unsigned char c = (unsigned char)ac;
+  unsigned char *s = (unsigned char *)as;
 
   // initial segment
 
-  int i_len = (int)(((uintptr_t) 8 - (uintptr_t) as) & 7);
+  int i_len = (int)(((uintptr_t)8 - (uintptr_t)as) & 7);
 
   // too short to concern us
 
-  if ((int) an < i_len) {
-    for (int i = 0; i < (int) an; i++)
+  if ((int)an < i_len) {
+    for (int i = 0; i < (int)an; i++)
       if (s[i] == c)
         return &s[i];
     return 0;
@@ -67,7 +67,7 @@ ink_memchr(const void *as, int ac, size_t an)
   ib |= (ib << 16);
   unsigned int im = 0x7efefeff;
   if (i_len & 4) {
-    unsigned int ibp = *(unsigned int *) s;
+    unsigned int ibp = *(unsigned int *)s;
     unsigned int ibb = ibp ^ ib;
     ibb = ((ibb + im) ^ ~ibb) & ~im;
     if (ibb) {
@@ -84,17 +84,17 @@ ink_memchr(const void *as, int ac, size_t an)
   }
   // next 8x bytes
   uint64_t m = 0x7efefefefefefeffLL;
-  uint64_t b = ((uint64_t) ib);
+  uint64_t b = ((uint64_t)ib);
   b |= (b << 32);
-  uint64_t *p = (uint64_t *) s;
-  unsigned int n = (((unsigned int) an) - (s - (unsigned char *) as)) >> 3;
+  uint64_t *p = (uint64_t *)s;
+  unsigned int n = (((unsigned int)an) - (s - (unsigned char *)as)) >> 3;
   uint64_t *end = p + n;
   while (p < end) {
     uint64_t bp = *p;
     uint64_t bb = bp ^ b;
     bb = ((bb + m) ^ ~bb) & ~m;
     if (bb) {
-      s = (unsigned char *) p;
+      s = (unsigned char *)p;
       if (s[0] == c)
         return &s[0];
       if (s[1] == c)
@@ -117,13 +117,13 @@ ink_memchr(const void *as, int ac, size_t an)
 
   // terminal segement
 
-  i_len = an - (((unsigned char *) p) - ((unsigned char *) as));
-  s = (unsigned char *) p;
+  i_len = an - (((unsigned char *)p) - ((unsigned char *)as));
+  s = (unsigned char *)p;
 
   // n-(4..8)..n bytes
 
   if (i_len & 4) {
-    unsigned int ibp = *(unsigned int *) s;
+    unsigned int ibp = *(unsigned int *)s;
     unsigned int ibb = ibp ^ ib;
     ibb = ((ibb + im) ^ ~ibb) & ~im;
     if (ibb) {
@@ -157,7 +157,7 @@ ink_memchr(const void *as, int ac, size_t an)
 }
 
 
-#define MEMCHR(_s,_c) ink_memchr(_s,_c,strlen(_s))?:""
+#define MEMCHR(_s, _c) ink_memchr(_s, _c, strlen(_s)) ?: ""
 main()
 {
   int i = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/test_strings.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_strings.cc b/lib/ts/test_strings.cc
index d78742e..ac32b5b 100644
--- a/lib/ts/test_strings.cc
+++ b/lib/ts/test_strings.cc
@@ -53,76 +53,70 @@ clock_t start, stop;
 
 void *ink_memchr(const void *as, int ac, size_t an);
 
-#define STRLEN_TEST(_func_,_size_) \
-{ \
-    start = clock(); \
-    for (i = 0; i < cycles; i++) { \
-	iresult = _func_ (_size_); \
-    } \
-    stop = clock(); \
-    printf ("%20s\t%10s\t%1.03g usec/op\n", \
-            #_func_, #_size_, ((double)stop-start)/((double)cycles)); \
-}
+#define STRLEN_TEST(_func_, _size_)                                                                      \
+  {                                                                                                      \
+    start = clock();                                                                                     \
+    for (i = 0; i < cycles; i++) {                                                                       \
+      iresult = _func_(_size_);                                                                          \
+    }                                                                                                    \
+    stop = clock();                                                                                      \
+    printf("%20s\t%10s\t%1.03g usec/op\n", #_func_, #_size_, ((double)stop - start) / ((double)cycles)); \
+  }
 
-#define STRCHR_TEST(_func_,_size_,_chr_) \
-{ \
-    start = clock(); \
-    for (i = 0; i < cycles; i++) { \
-	sresult = _func_ (_size_,_chr_); \
-    } \
-    stop = clock(); \
-    printf ("%20s\t%10s\t%1.03g usec/op\t%s\n", \
-            #_func_, #_size_, ((double)stop-start)/((double)cycles), \
-	    (sresult)? "found" : "not found"); \
-}
+#define STRCHR_TEST(_func_, _size_, _chr_)                                                                  \
+  {                                                                                                         \
+    start = clock();                                                                                        \
+    for (i = 0; i < cycles; i++) {                                                                          \
+      sresult = _func_(_size_, _chr_);                                                                      \
+    }                                                                                                       \
+    stop = clock();                                                                                         \
+    printf("%20s\t%10s\t%1.03g usec/op\t%s\n", #_func_, #_size_, ((double)stop - start) / ((double)cycles), \
+           (sresult) ? "found" : "not found");                                                              \
+  }
 
-#define JP_MEMCHR_TEST(_func_,_size_,_chr_,_len_) \
-{ \
-    start = clock(); \
-    for (i = 0; i < cycles; i++) { \
-	sresult = (char*) ink_memchr (_size_,_chr_,_len_); \
-    } \
-    stop = clock(); \
-    printf ("%20s\t%10s\t%1.03g usec/op\t%s\n", \
-            "jp_memchr", #_size_, ((double)stop-start)/((double)cycles), \
-	    (sresult)? "found" : "not found"); \
-}
+#define JP_MEMCHR_TEST(_func_, _size_, _chr_, _len_)                                                            \
+  {                                                                                                             \
+    start = clock();                                                                                            \
+    for (i = 0; i < cycles; i++) {                                                                              \
+      sresult = (char *)ink_memchr(_size_, _chr_, _len_);                                                       \
+    }                                                                                                           \
+    stop = clock();                                                                                             \
+    printf("%20s\t%10s\t%1.03g usec/op\t%s\n", "jp_memchr", #_size_, ((double)stop - start) / ((double)cycles), \
+           (sresult) ? "found" : "not found");                                                                  \
+  }
 
-#define STRCMP_TEST(_func_,_size_,_str_) \
-{ \
-    start = clock(); \
-    for (i = 0; i < cycles; i++) { \
-	iresult = _func_ (_size_,_str_); \
-    } \
-    stop = clock(); \
-    printf ("%20s\t%10s\t%1.03g usec/op\t%s\n", \
-            #_func_, #_size_, ((double)stop-start)/((double)cycles), \
-	    (sresult)? "not matching" : "matching"); \
-}
+#define STRCMP_TEST(_func_, _size_, _str_)                                                                  \
+  {                                                                                                         \
+    start = clock();                                                                                        \
+    for (i = 0; i < cycles; i++) {                                                                          \
+      iresult = _func_(_size_, _str_);                                                                      \
+    }                                                                                                       \
+    stop = clock();                                                                                         \
+    printf("%20s\t%10s\t%1.03g usec/op\t%s\n", #_func_, #_size_, ((double)stop - start) / ((double)cycles), \
+           (sresult) ? "not matching" : "matching");                                                        \
+  }
 
-#define STRCPY_TEST(_func_,_size_) \
-{ \
-    char buf[1024]; \
-    start = clock(); \
-    for (i = 0; i < cycles; i++) { \
-	sresult = _func_ (buf,_size_); \
-    } \
-    stop = clock(); \
-    printf ("%20s\t%10s\t%1.03g usec/op\n", \
-            #_func_, #_size_, ((double)stop-start)/((double)cycles)); \
-}
+#define STRCPY_TEST(_func_, _size_)                                                                      \
+  {                                                                                                      \
+    char buf[1024];                                                                                      \
+    start = clock();                                                                                     \
+    for (i = 0; i < cycles; i++) {                                                                       \
+      sresult = _func_(buf, _size_);                                                                     \
+    }                                                                                                    \
+    stop = clock();                                                                                      \
+    printf("%20s\t%10s\t%1.03g usec/op\n", #_func_, #_size_, ((double)stop - start) / ((double)cycles)); \
+  }
 
-#define MEMCPY_TEST(_func_,_size_,_len_) \
-{ \
-    char buf[1024]; \
-    start = clock(); \
-    for (i = 0; i < cycles; i++) { \
-	sresult = (char*) _func_ (buf,_size_,_len_); \
-    } \
-    stop = clock(); \
-    printf ("%20s\t%10s\t%10s\t%1.03g usec/op\n", \
-            #_func_, #_size_, #_len_, ((double)stop-start)/((double)cycles)); \
-}
+#define MEMCPY_TEST(_func_, _size_, _len_)                                                                             \
+  {                                                                                                                    \
+    char buf[1024];                                                                                                    \
+    start = clock();                                                                                                   \
+    for (i = 0; i < cycles; i++) {                                                                                     \
+      sresult = (char *)_func_(buf, _size_, _len_);                                                                    \
+    }                                                                                                                  \
+    stop = clock();                                                                                                    \
+    printf("%20s\t%10s\t%10s\t%1.03g usec/op\n", #_func_, #_size_, #_len_, ((double)stop - start) / ((double)cycles)); \
+  }
 
 /* version from ink_string.h */
 inline char *
@@ -149,7 +143,7 @@ ink_memcpy(char *d, char *s, int len)
 inline char *
 jp_strchr(char *s, char c)
 {
-  return (char *) ink_memchr(s, c, strlen(s));
+  return (char *)ink_memchr(s, c, strlen(s));
 }
 
 void
@@ -251,17 +245,17 @@ main(int argc, char *argv[])
 void *
 ink_memchr(const void *as, int ac, size_t an)
 {
-  unsigned char c = (unsigned char) ac;
-  unsigned char *s = (unsigned char *) as;
+  unsigned char c = (unsigned char)ac;
+  unsigned char *s = (unsigned char *)as;
 
   // initial segment
 
-  int i_len = (int)(((uintptr_t) 8 - (uintptr_t) as) & 7);
+  int i_len = (int)(((uintptr_t)8 - (uintptr_t)as) & 7);
 
   // too short to concern us
 
-  if ((int) an < i_len) {
-    for (int i = 0; i < (int) an; i++)
+  if ((int)an < i_len) {
+    for (int i = 0; i < (int)an; i++)
       if (s[i] == c)
         return &s[i];
     return 0;
@@ -289,7 +283,7 @@ ink_memchr(const void *as, int ac, size_t an)
   ib |= (ib << 16);
   unsigned int im = 0x7efefeff;
   if (i_len & 4) {
-    unsigned int ibp = *(unsigned int *) s;
+    unsigned int ibp = *(unsigned int *)s;
     unsigned int ibb = ibp ^ ib;
     ibb = ((ibb + im) ^ ~ibb) & ~im;
     if (ibb) {
@@ -306,17 +300,17 @@ ink_memchr(const void *as, int ac, size_t an)
   }
   // next 8x bytes
   uint64_t m = 0x7efefefefefefeffLL;
-  uint64_t b = ((uint64_t) ib);
+  uint64_t b = ((uint64_t)ib);
   b |= (b << 32);
-  uint64_t *p = (uint64_t *) s;
-  unsigned int n = (((unsigned int) an) - (s - (unsigned char *) as)) >> 3;
+  uint64_t *p = (uint64_t *)s;
+  unsigned int n = (((unsigned int)an) - (s - (unsigned char *)as)) >> 3;
   uint64_t *end = p + n;
   while (p < end) {
     uint64_t bp = *p;
     uint64_t bb = bp ^ b;
     bb = ((bb + m) ^ ~bb) & ~m;
     if (bb) {
-      s = (unsigned char *) p;
+      s = (unsigned char *)p;
       if (s[0] == c)
         return &s[0];
       if (s[1] == c)
@@ -339,13 +333,13 @@ ink_memchr(const void *as, int ac, size_t an)
 
   // terminal segement
 
-  i_len = an - (((unsigned char *) p) - ((unsigned char *) as));
-  s = (unsigned char *) p;
+  i_len = an - (((unsigned char *)p) - ((unsigned char *)as));
+  s = (unsigned char *)p;
 
   // n-(4..8)..n bytes
 
   if (i_len & 4) {
-    unsigned int ibp = *(unsigned int *) s;
+    unsigned int ibp = *(unsigned int *)s;
     unsigned int ibb = ibp ^ ib;
     ibb = ((ibb + im) ^ ~ibb) & ~im;
     if (ibb) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/Wccp.h
----------------------------------------------------------------------
diff --git a/lib/wccp/Wccp.h b/lib/wccp/Wccp.h
index cfe99c7..8dd92d7 100644
--- a/lib/wccp/Wccp.h
+++ b/lib/wccp/Wccp.h
@@ -1,5 +1,5 @@
-# if ! defined(ATS_WCCP_API_HEADER)
-# define ATS_WCCP_API_HEADER
+#if !defined(ATS_WCCP_API_HEADER)
+#define ATS_WCCP_API_HEADER
 
 /** @file
     WCCP (v2) support API.
@@ -23,33 +23,36 @@
     limitations under the License.
  */
 
-# include <ts/TsBuffer.h>
-# include <tsconfig/Errata.h>
-# include <memory.h>
-# include <ink_defs.h>
-# include <ink_memory.h>
+#include <ts/TsBuffer.h>
+#include <tsconfig/Errata.h>
+#include <memory.h>
+#include <ink_defs.h>
+#include <ink_memory.h>
 // Nasty, defining this with no prefix. The value is still available
 // in TS_VERSION_STRING.
-# undef VERSION
+#undef VERSION
 
 // INADDR_ANY
-# include <netinet/in.h>
+#include <netinet/in.h>
 
 /// WCCP Support.
-namespace wccp {
-
+namespace wccp
+{
 /// Forward declare implementation classes.
 class Impl;
 class CacheImpl;
 class RouterImpl;
 
 /// Namespace for implementation details.
-namespace detail {
+namespace detail
+{
   /// Cache implementation details.
-  namespace cache {
+  namespace cache
+  {
     struct GroupData;
   }
-  namespace router {
+  namespace router
+  {
     struct GroupData;
   }
 }
@@ -58,7 +61,7 @@ namespace detail {
 /// @note Sec 4.14: HERE_I_AM_T.
 static time_t const TIME_UNIT = 10;
 static time_t const ASSIGN_WAIT = (3 * TIME_UNIT) / 2;
-static time_t const RAPID_TIME = TIME_UNIT/10;
+static time_t const RAPID_TIME = TIME_UNIT / 10;
 
 /// Service group related constants.
 /// @internal In a struct so enum values can be imported to more than
@@ -68,18 +71,18 @@ struct ServiceConstants {
   /// @internal Enumerations values match protocol values.
   enum PacketStyle {
     NO_PACKET_STYLE = 0, ///< Undefined or invalid.
-    GRE = 1, ///< GRE tunnel only. [default]
-    L2 = 2, ///< L2 rewrite only.
-    GRE_OR_L2 = 3 ///< L2 rewrite or GRE tunnel.
+    GRE = 1,             ///< GRE tunnel only. [default]
+    L2 = 2,              ///< L2 rewrite only.
+    GRE_OR_L2 = 3        ///< L2 rewrite or GRE tunnel.
   };
 
   /// Cache assignment supported methods.
   /// @internal Enumerations values match protocol values.
   enum CacheAssignmentStyle {
     NO_CACHE_ASSIGN_STYLE = 0, ///< Undefined or invalid.
-    HASH_ONLY = 1, ///< Use only hash assignment. [default]
-    MASK_ONLY = 2, ///< Use only mask assignment.
-    HASH_OR_MASK = 3 ///< Use hash or mask assignment.
+    HASH_ONLY = 1,             ///< Use only hash assignment. [default]
+    MASK_ONLY = 2,             ///< Use only mask assignment.
+    HASH_OR_MASK = 3           ///< Use hash or mask assignment.
   };
 };
 
@@ -89,20 +92,21 @@ struct ServiceConstants {
     in serialized form because it is copied to and from message data far more
     often then it is accessed directly.
  */
-class ServiceGroup : public ServiceConstants {
+class ServiceGroup : public ServiceConstants
+{
 public:
   typedef ServiceGroup self; ///< Self reference type.
 
   /// Type of service.
   enum Type {
     STANDARD = 0, ///< Well known service.
-    DYNAMIC = 1 ///< Dynamic (locally defined) service.
+    DYNAMIC = 1   ///< Dynamic (locally defined) service.
   };
 
   /// Result codes for service definition.
   enum Result {
     DEFINED = 0, ///< Service group was created by the call.
-    EXISTS = 1, ///< Service group already existed.
+    EXISTS = 1,  ///< Service group already existed.
     CONFLICT = 2 ///< Service group existed but didn't match new definition.
   };
 
@@ -120,96 +124,93 @@ public:
   /// @name Flag mask values.
   //@{
   /// Source IP address hash
-  static uint32_t const SRC_IP_HASH = 1<<0;
+  static uint32_t const SRC_IP_HASH = 1 << 0;
   /// Destination IP address hash
-  static uint32_t const DST_IP_HASH = 1<<1;
+  static uint32_t const DST_IP_HASH = 1 << 1;
   /// Source port hash.
-  static uint32_t const SRC_PORT_HASH = 1<<2;
+  static uint32_t const SRC_PORT_HASH = 1 << 2;
   /// Destination port hash
-  static uint32_t const DST_PORT_HASH = 1<<3;
+  static uint32_t const DST_PORT_HASH = 1 << 3;
   /// @a m_ports has port information.
-  static uint32_t const PORTS_DEFINED = 1<<4;
+  static uint32_t const PORTS_DEFINED = 1 << 4;
   /// @a m_ports has source ports (otherwise destination ports).
-  static uint32_t const PORTS_SOURCE = 1<<5;
+  static uint32_t const PORTS_SOURCE = 1 << 5;
   /// Alternate source IP address hash
-  static uint32_t const SRC_IP_ALT_HASH = 1<<8;
+  static uint32_t const SRC_IP_ALT_HASH = 1 << 8;
   /// Alternate destination IP address hash
-  static uint32_t const DST_IP_ALT_HASH = 1<<9;
+  static uint32_t const DST_IP_ALT_HASH = 1 << 9;
   /// Alternate source port hash
-  static uint32_t const SRC_PORT_ALT_HASH = 1<<10;
+  static uint32_t const SRC_PORT_ALT_HASH = 1 << 10;
   /// Alternate destination port hash
-  static uint32_t const DST_PORT_ALT_HASH = 1<<11;
+  static uint32_t const DST_PORT_ALT_HASH = 1 << 11;
   /// All hash related flags.
-  static uint32_t const HASH_FLAGS =
-    SRC_IP_HASH | DST_IP_HASH | SRC_PORT_HASH | DST_PORT_HASH
-    | SRC_IP_ALT_HASH | DST_IP_ALT_HASH | SRC_PORT_ALT_HASH | DST_PORT_ALT_HASH
-    ;
+  static uint32_t const HASH_FLAGS = SRC_IP_HASH | DST_IP_HASH | SRC_PORT_HASH | DST_PORT_HASH | SRC_IP_ALT_HASH | DST_IP_ALT_HASH |
+                                     SRC_PORT_ALT_HASH | DST_PORT_ALT_HASH;
   //@}
 
   /// Default constructor - no member initialization.
   ServiceGroup();
   /// Test for equivalent.
-  bool operator == (self const& that) const;
+  bool operator==(self const &that) const;
   /// Test for not equivalent.
-  bool operator != (self const& that) const;
+  bool operator!=(self const &that) const;
 
   /// @name Accessors
   //@{
   ServiceGroup::Type getSvcType() const; ///< Get service type field.
-  /** Set the service type.
-      If @a svc is @c SERVICE_STANDARD then all fields except the
-      component header and service id are set to zero as required
-      by the protocol.
-  */
-  self& setSvcType(ServiceGroup::Type svc);
+                                         /** Set the service type.
+                                             If @a svc is @c SERVICE_STANDARD then all fields except the
+                                             component header and service id are set to zero as required
+                                             by the protocol.
+                                         */
+  self &setSvcType(ServiceGroup::Type svc);
 
-  uint8_t getSvcId() const; ///< Get service ID field.
-  self& setSvcId(uint8_t id); ///< Set service ID field to @a id.
+  uint8_t getSvcId() const;   ///< Get service ID field.
+  self &setSvcId(uint8_t id); ///< Set service ID field to @a id.
 
-  uint8_t getPriority() const; ///< Get priority field.
-  self& setPriority(uint8_t pri); ///< Set priority field to @a p.
+  uint8_t getPriority() const;    ///< Get priority field.
+  self &setPriority(uint8_t pri); ///< Set priority field to @a p.
 
-  uint8_t getProtocol() const; ///< Get protocol field.
-  self& setProtocol(uint8_t p); ///< Set protocol field to @a p.
+  uint8_t getProtocol() const;  ///< Get protocol field.
+  self &setProtocol(uint8_t p); ///< Set protocol field to @a p.
 
-  uint32_t getFlags() const; ///< Get flags field.
-  self& setFlags(uint32_t f); ///< Set the flags flags in field to @a f.
+  uint32_t getFlags() const;  ///< Get flags field.
+  self &setFlags(uint32_t f); ///< Set the flags flags in field to @a f.
   /// Set the flags in the flag field that are set in @a f.
   /// Other flags are unchanged.
-  self& enableFlags(uint32_t f);
+  self &enableFlags(uint32_t f);
   /// Clear the flags in the flag field that are set in @a f.
   /// Other flags are unchanged.
-  self& disableFlags(uint32_t f);
+  self &disableFlags(uint32_t f);
 
   /// Get a port value.
-  uint16_t getPort(
-    int idx ///< Index of target port.
-  ) const;
+  uint16_t getPort(int idx ///< Index of target port.
+                   ) const;
   /// Set a port value.
-  self& setPort(
-    int idx, ///< Index of port.
-    uint16_t port ///< Value for port.
-  );
+  self &setPort(int idx,      ///< Index of port.
+                uint16_t port ///< Value for port.
+                );
   /// Zero (clear) all ports.
-  self& clearPorts();
+  self &clearPorts();
   //@}
 
 protected:
-  uint8_t m_svc_type; ///< @ref Type.
-  uint8_t m_svc_id; ///< ID for service type.
-  uint8_t m_priority; ///< Redirection priority ordering.
-  uint8_t m_protocol; ///< IP protocol for service.
-  uint32_t m_flags; ///< Flags.
+  uint8_t m_svc_type;        ///< @ref Type.
+  uint8_t m_svc_id;          ///< ID for service type.
+  uint8_t m_priority;        ///< Redirection priority ordering.
+  uint8_t m_protocol;        ///< IP protocol for service.
+  uint32_t m_flags;          ///< Flags.
   uint16_t m_ports[N_PORTS]; ///< Service ports.
 };
 
 /// Security component option (sub-type)
 enum SecurityOption {
   SECURITY_NONE = 0, ///< No security @c WCCP2_NO_SECURITY
-  SECURITY_MD5 = 1 ///< MD5 security @c WCCP2_MD5_SECURITY
+  SECURITY_MD5 = 1   ///< MD5 security @c WCCP2_MD5_SECURITY
 };
 
-class EndPoint {
+class EndPoint
+{
 public:
   typedef EndPoint self; ///< Self reference type.
   typedef Impl ImplType; ///< Implementation type.
@@ -217,9 +218,8 @@ public:
   /** Set the identifying IP address.
       This is also used as the address for the socket.
   */
-  self& setAddr(
-    uint32_t addr ///< IP address.
-  );
+  self &setAddr(uint32_t addr ///< IP address.
+                );
 
   /** Check if this endpoint is ready to use.
       @return @c true if the address has been set and services
@@ -238,9 +238,8 @@ public:
       @return 0 on success, -ERRNO on failure.
       @see setAddr
   */
-  int open(
-    uint32_t addr = INADDR_ANY ///< Local IP address for socket.
-  );
+  int open(uint32_t addr = INADDR_ANY ///< Local IP address for socket.
+           );
 
   /// Get the internal socket.
   /// Useful primarily for socket options and using
@@ -248,13 +247,11 @@ public:
   int getSocket() const;
 
   /// Use MD5 based security with @a key.
-  void useMD5Security(
-    char const* key ///< Shared hash key.
-  );
+  void useMD5Security(char const *key ///< Shared hash key.
+                      );
   /// Use MD5 based security with @a key.
-  void useMD5Security(
-    ts::ConstBuffer const& key ///< Shared hash key.
-  );
+  void useMD5Security(ts::ConstBuffer const &key ///< Shared hash key.
+                      );
 
   /// Perform house keeping, including sending outbound messages.
   int housekeeping();
@@ -267,7 +264,7 @@ protected:
   /// Default constructor.
   EndPoint();
   /// Copy constructor.
-  EndPoint(self const& that);
+  EndPoint(self const &that);
   /// Force virtual destructor
   virtual ~EndPoint();
 
@@ -279,15 +276,16 @@ protected:
       implementation instantiation to be virtual so the correct type is
       created.
    */
-  ImplType* instance();
+  ImplType *instance();
 
-  virtual ImplType* make() = 0; ///< Create a new implementation instance.
+  virtual ImplType *make() = 0; ///< Create a new implementation instance.
 };
 
-class Cache : public EndPoint {
+class Cache : public EndPoint
+{
 public:
-  typedef Cache self; ///< Self reference type.
-  typedef EndPoint super; ///< Parent type.
+  typedef Cache self;         ///< Self reference type.
+  typedef EndPoint super;     ///< Parent type.
   typedef CacheImpl ImplType; ///< Implementation type.
 
   class Service;
@@ -298,9 +296,8 @@ public:
   ~Cache();
 
   /// Define services from a configuration file.
-  ts::Errata loadServicesFromFile(
-    char const* path ///< Path to file.
-  );
+  ts::Errata loadServicesFromFile(char const *path ///< Path to file.
+                                  );
 
   /** Define a service group.
 
@@ -311,10 +308,8 @@ public:
       - @c ServiceGroup::EXISTS if the service matches the existing service.
       - @c ServiceGroup::CONFLICT if the service doesn't match the existing service.
    */
-  Service defineServiceGroup(
-    ServiceGroup const& svc, ///< Service group description.
-    ServiceGroup::Result* result = 0
-  );
+  Service defineServiceGroup(ServiceGroup const &svc, ///< Service group description.
+                             ServiceGroup::Result *result = 0);
 
   /** Add a seed router to the service group.
 
@@ -326,29 +321,30 @@ public:
       Seed routers are removed when a reply is received from that router.
 
   */
-  self& addSeedRouter(
-    uint8_t id, ///< Service group ID.
-    uint32_t addr ///< IP address of router.
-  );
+  self &addSeedRouter(uint8_t id,   ///< Service group ID.
+                      uint32_t addr ///< IP address of router.
+                      );
 
   /// Number of seconds until next housekeeping activity is due.
   time_t waitTime() const;
+
 protected:
   /// Get implementation instance, creating if needed.
-  ImplType* instance();
+  ImplType *instance();
   /// Get the current implementation instance cast to correct type.
-  ImplType* impl();
+  ImplType *impl();
   /// Get the current implementation instance cast to correct type.
-  ImplType const* impl() const;
+  ImplType const *impl() const;
   /// Create a new implementation instance.
-  super::ImplType* make();
+  super::ImplType *make();
 };
 
 /** Hold a reference to a service group in this end point.
     This is useful when multiple operations are to be done on the
     same group, rather than doing a lookup by id every time.
 */
-class Cache::Service : public ServiceConstants {
+class Cache::Service : public ServiceConstants
+{
 public:
   typedef Service self; ///< Self reference type.
 
@@ -356,44 +352,39 @@ public:
   Service();
 
   /// Add an address for a seed router.
-  self& addSeedRouter(
-    uint32_t addr ///< Router IP address.
-  );
+  self &addSeedRouter(uint32_t addr ///< Router IP address.
+                      );
   /// Set the security key.
-  self& setKey(
-    char const* key /// Shared key.
-  );
+  self &setKey(char const *key /// Shared key.
+               );
   /// Set the service local security option.
-  self& setSecurity(
-    SecurityOption opt ///< Security style to use.
-  );
+  self &setSecurity(SecurityOption opt ///< Security style to use.
+                    );
   /// Set intercepted packet forwarding style.
-  self& setForwarding(
-    PacketStyle style ///< Type of forwarding supported.
-  );
+  self &setForwarding(PacketStyle style ///< Type of forwarding supported.
+                      );
   /// Enable or disable packet return by layer 2 rewrite.
-  self& setReturn(
-    PacketStyle style ///< Type of return supported.
-  );
+  self &setReturn(PacketStyle style ///< Type of return supported.
+                  );
 
   /// Set cache assignment style.
-  self& setCacheAssignment(
-    CacheAssignmentStyle style ///< Style to use.
-  );
+  self &setCacheAssignment(CacheAssignmentStyle style ///< Style to use.
+                           );
 
 
 private:
-  Service(Cache const& cache, detail::cache::GroupData& group);
-  Cache m_cache; ///< Parent cache.
-  detail::cache::GroupData* m_group; ///< Service Group data.
+  Service(Cache const &cache, detail::cache::GroupData &group);
+  Cache m_cache;                     ///< Parent cache.
+  detail::cache::GroupData *m_group; ///< Service Group data.
   friend class Cache;
 };
 
 
-class Router : public EndPoint {
+class Router : public EndPoint
+{
 public:
-  typedef Router self; ///< Self reference type.
-  typedef EndPoint super; ///< Parent type.
+  typedef Router self;         ///< Self reference type.
+  typedef EndPoint super;      ///< Parent type.
   typedef RouterImpl ImplType; ///< Implementation type.
 
   /// Default constructor
@@ -403,110 +394,127 @@ public:
 
   /// Transmit pending messages.
   int sendPendingMessages();
+
 protected:
   /// Get implementation instance, creating if needed.
-  ImplType* instance();
+  ImplType *instance();
   /// Get the current implementation instance cast to correct type.
-  ImplType* impl();
+  ImplType *impl();
   /// Create a new implementation instance.
-  super::ImplType* make();
+  super::ImplType *make();
 };
 
 // ------------------------------------------------------
-inline bool
-ServiceGroup::operator != (self const& that) const {
+inline bool ServiceGroup::operator!=(self const &that) const
+{
   return !(*this == that);
 }
 
 inline ServiceGroup::Type
-ServiceGroup::getSvcType() const {
+ServiceGroup::getSvcType() const
+{
   return static_cast<ServiceGroup::Type>(m_svc_type);
 }
 inline uint8_t
-ServiceGroup::getSvcId() const {
+ServiceGroup::getSvcId() const
+{
   return m_svc_id;
 }
 
-inline ServiceGroup&
-ServiceGroup::setSvcId(uint8_t id) {
+inline ServiceGroup &
+ServiceGroup::setSvcId(uint8_t id)
+{
   m_svc_id = id;
   return *this;
 }
 
 inline uint8_t
-ServiceGroup::getPriority() const {
+ServiceGroup::getPriority() const
+{
   return m_priority;
 }
 
-inline ServiceGroup&
-ServiceGroup::setPriority(uint8_t pri) {
+inline ServiceGroup &
+ServiceGroup::setPriority(uint8_t pri)
+{
   m_priority = pri;
   return *this;
 }
 
 inline uint8_t
-ServiceGroup::getProtocol() const {
+ServiceGroup::getProtocol() const
+{
   return m_protocol;
 }
 
-inline ServiceGroup&
-ServiceGroup::setProtocol(uint8_t proto) {
+inline ServiceGroup &
+ServiceGroup::setProtocol(uint8_t proto)
+{
   m_protocol = proto;
   return *this;
 }
 
 inline uint32_t
-ServiceGroup::getFlags() const {
+ServiceGroup::getFlags() const
+{
   return ntohl(m_flags);
 }
 
-inline ServiceGroup&
-ServiceGroup::setFlags(uint32_t flags) {
+inline ServiceGroup &
+ServiceGroup::setFlags(uint32_t flags)
+{
   m_flags = htonl(flags);
   return *this;
 }
 
-inline ServiceGroup&
-ServiceGroup::enableFlags(uint32_t flags) {
+inline ServiceGroup &
+ServiceGroup::enableFlags(uint32_t flags)
+{
   m_flags |= htonl(flags);
   return *this;
 }
 
-inline ServiceGroup&
-ServiceGroup::disableFlags(uint32_t flags) {
+inline ServiceGroup &
+ServiceGroup::disableFlags(uint32_t flags)
+{
   m_flags &= ~htonl(flags);
   return *this;
 }
 
 inline uint16_t
-ServiceGroup::getPort (int idx) const {
+ServiceGroup::getPort(int idx) const
+{
   return ntohs(m_ports[idx]);
 }
 
-inline ServiceGroup&
-ServiceGroup::setPort(int idx, uint16_t port) {
+inline ServiceGroup &
+ServiceGroup::setPort(int idx, uint16_t port)
+{
   m_ports[idx] = htons(port);
   return *this;
 }
 
-inline ServiceGroup&
-ServiceGroup::clearPorts() {
+inline ServiceGroup &
+ServiceGroup::clearPorts()
+{
   memset(m_ports, 0, sizeof(m_ports));
   return *this;
 }
 
-inline Cache::Service::Service() : m_group(0) { }
+inline Cache::Service::Service() : m_group(0)
+{
+}
 
-inline Cache::Service::Service(
-  Cache const& cache,
-  detail::cache::GroupData& group
-) : m_cache(cache), m_group(&group) {
+inline Cache::Service::Service(Cache const &cache, detail::cache::GroupData &group) : m_cache(cache), m_group(&group)
+{
 }
 
-inline void EndPoint::useMD5Security(char const* key) {
+inline void
+EndPoint::useMD5Security(char const *key)
+{
   this->useMD5Security(ts::ConstBuffer(key, strlen(key)));
 }
 // ------------------------------------------------------
 
 } // namespace Wccp
-# endif // include guard.
+#endif // include guard.


[51/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
TS-3419 Fix some enum's such that clang-format can handle it the way we want.
        Basically this means having a trailing , on short enum's.
TS-3419 Run clang-format over most of the source


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/65477944
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/65477944
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/65477944

Branch: refs/heads/master
Commit: 65477944357bdb8bef778dda91ff1319271d9172
Parents: 3535b30
Author: Leif Hedstrom <le...@ogre.com>
Authored: Sat Mar 21 14:51:04 2015 -0600
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Sun Mar 22 19:16:11 2015 -0600

----------------------------------------------------------------------
 cmd/traffic_cop/traffic_cop.cc                  |  183 +-
 cmd/traffic_crashlog/procinfo.cc                |   90 +-
 cmd/traffic_crashlog/traffic_crashlog.cc        |   41 +-
 cmd/traffic_crashlog/traffic_crashlog.h         |   35 +-
 cmd/traffic_ctl/alarm.cc                        |   34 +-
 cmd/traffic_ctl/config.cc                       |  115 +-
 cmd/traffic_ctl/metric.cc                       |   29 +-
 cmd/traffic_ctl/server.cc                       |   36 +-
 cmd/traffic_ctl/storage.cc                      |   13 +-
 cmd/traffic_ctl/traffic_ctl.cc                  |   45 +-
 cmd/traffic_ctl/traffic_ctl.h                   |  163 +-
 cmd/traffic_layout/traffic_layout.cc            |   10 +-
 cmd/traffic_line/traffic_line.cc                |   28 +-
 cmd/traffic_manager/StatProcessor.cc            |   80 +-
 cmd/traffic_manager/StatProcessor.h             |    7 +-
 cmd/traffic_manager/StatType.cc                 |  245 +-
 cmd/traffic_manager/StatType.h                  |   56 +-
 cmd/traffic_manager/StatXML.cc                  |    4 -
 cmd/traffic_manager/StatXML.h                   |    7 +-
 cmd/traffic_manager/traffic_manager.cc          |  147 +-
 cmd/traffic_top/stats.h                         |  118 +-
 cmd/traffic_top/traffic_top.cc                  |   95 +-
 cmd/traffic_via/traffic_via.cc                  |  293 +-
 cmd/traffic_wccp/wccp_client.cc                 |   66 +-
 example/add-header/add-header.c                 |    3 +-
 example/append-transform/append-transform.c     |   40 +-
 example/basic-auth/basic-auth.c                 |   17 +-
 example/blacklist-0/blacklist-0.c               |   10 +-
 example/blacklist-1/blacklist-1.c               |   35 +-
 example/bnull-transform/bnull-transform.c       |   47 +-
 example/cache-scan/cache-scan.cc                |  129 +-
 example/file-1/file-1.c                         |    1 -
 example/intercept/intercept.cc                  |  183 +-
 example/lifecycle-plugin/lifecycle-plugin.c     |   14 +-
 example/null-transform/null-transform.c         |   46 +-
 example/output-header/output-header.c           |    5 +-
 example/prefetch/prefetch-plugin-eg1.c          |   13 +-
 example/prefetch/test-hns-plugin.c              |   27 +-
 example/protocol/Protocol.c                     |    4 +-
 example/protocol/Protocol.h                     |    5 +-
 example/protocol/TxnSM.c                        |  128 +-
 example/protocol/TxnSM.h                        |    9 +-
 example/query-remap/query-remap.c               |   40 +-
 example/redirect-1/redirect-1.c                 |   32 +-
 example/remap/remap.cc                          |   78 +-
 example/remap_header_add/remap_header_add.cc    |   42 +-
 example/replace-header/replace-header.c         |    2 +-
 example/response-header-1/response-header-1.c   |   49 +-
 example/secure-link/secure-link.c               |   42 +-
 example/server-transform/server-transform.c     |   65 +-
 example/session-1/session-1.c                   |    4 +-
 example/ssl-preaccept/ats-util.h                |   19 +-
 example/ssl-preaccept/ssl-preaccept.cc          |   58 +-
 example/ssl-sni-whitelist/ssl-sni-whitelist.cc  |   50 +-
 example/ssl-sni/ssl-sni.cc                      |   50 +-
 example/thread-1/thread-1.c                     |   10 +-
 example/thread-pool/include/gen.c               |    1 -
 example/thread-pool/psi.c                       |   53 +-
 example/thread-pool/test/SDKTest/psi_server.c   |   46 +-
 example/thread-pool/thread.c                    |   22 +-
 example/thread-pool/thread.h                    |   30 +-
 example/version/version.c                       |    6 +-
 iocore/aio/AIO.cc                               |  119 +-
 iocore/aio/I_AIO.h                              |   79 +-
 iocore/aio/P_AIO.h                              |   57 +-
 iocore/aio/test_AIO.cc                          |  181 +-
 iocore/cache/Cache.cc                           | 1094 ++--
 iocore/cache/CacheDir.cc                        |  242 +-
 iocore/cache/CacheDisk.cc                       |   25 +-
 iocore/cache/CacheHosting.cc                    |  356 +-
 iocore/cache/CacheHttp.cc                       |   59 +-
 iocore/cache/CacheLink.cc                       |   53 +-
 iocore/cache/CachePages.cc                      |  476 +-
 iocore/cache/CachePagesInternal.cc              |  144 +-
 iocore/cache/CacheRead.cc                       |  318 +-
 iocore/cache/CacheTest.cc                       |  405 +-
 iocore/cache/CacheVol.cc                        |   67 +-
 iocore/cache/CacheWrite.cc                      |  394 +-
 iocore/cache/I_Cache.h                          |   91 +-
 iocore/cache/I_CacheDefs.h                      |   65 +-
 iocore/cache/I_Store.h                          |  139 +-
 iocore/cache/Inline.cc                          |    2 -
 iocore/cache/P_CacheArray.h                     |   68 +-
 iocore/cache/P_CacheBC.h                        |  208 +-
 iocore/cache/P_CacheDir.h                       |  310 +-
 iocore/cache/P_CacheDisk.h                      |   82 +-
 iocore/cache/P_CacheHosting.h                   |  107 +-
 iocore/cache/P_CacheHttp.h                      |   34 +-
 iocore/cache/P_CacheInternal.h                  |  426 +-
 iocore/cache/P_CacheTest.h                      |   58 +-
 iocore/cache/P_CacheVol.h                       |  413 +-
 iocore/cache/P_RamCache.h                       |    5 +-
 iocore/cache/RamCacheCLFUS.cc                   |  225 +-
 iocore/cache/RamCacheLRU.cc                     |   42 +-
 iocore/cache/Store.cc                           |  145 +-
 iocore/cluster/ClusterAPI.cc                    |  177 +-
 iocore/cluster/ClusterCache.cc                  | 1908 ++++---
 iocore/cluster/ClusterConfig.cc                 |  155 +-
 iocore/cluster/ClusterHandler.cc                |  599 +--
 iocore/cluster/ClusterHandlerBase.cc            |  722 ++-
 iocore/cluster/ClusterHash.cc                   |   10 +-
 iocore/cluster/ClusterLib.cc                    |   76 +-
 iocore/cluster/ClusterLoadMonitor.cc            |   80 +-
 iocore/cluster/ClusterMachine.cc                |   68 +-
 iocore/cluster/ClusterProcessor.cc              |  439 +-
 iocore/cluster/ClusterRPC.cc                    |  114 +-
 iocore/cluster/ClusterVConnection.cc            |  157 +-
 iocore/cluster/P_Cluster.h                      |   39 +-
 iocore/cluster/P_ClusterCache.h                 |  739 +--
 iocore/cluster/P_ClusterCacheInternal.h         |  438 +-
 iocore/cluster/P_ClusterHandler.h               |  313 +-
 iocore/cluster/P_ClusterInline.h                |  164 +-
 iocore/cluster/P_ClusterInternal.h              |  358 +-
 iocore/cluster/P_ClusterLib.h                   |    7 +-
 iocore/cluster/P_ClusterLoadMonitor.h           |   17 +-
 iocore/cluster/P_ClusterMachine.h               |   31 +-
 iocore/cluster/P_TimeTrace.h                    |   21 +-
 iocore/cluster/test_I_Cluster.cc                |   19 +-
 iocore/cluster/test_P_Cluster.cc                |   19 +-
 iocore/dns/DNS.cc                               |  565 +--
 iocore/dns/DNSConnection.cc                     |   32 +-
 iocore/dns/I_DNSProcessor.h                     |   71 +-
 iocore/dns/I_SplitDNS.h                         |    6 +-
 iocore/dns/I_SplitDNSProcessor.h                |    6 +-
 iocore/dns/Inline.cc                            |    2 -
 iocore/dns/P_DNS.h                              |    2 +-
 iocore/dns/P_DNSConnection.h                    |   83 +-
 iocore/dns/P_DNSProcessor.h                     |  154 +-
 iocore/dns/P_SplitDNS.h                         |    8 +-
 iocore/dns/P_SplitDNSProcessor.h                |   53 +-
 iocore/dns/SRV.h                                |   26 +-
 iocore/dns/SplitDNS.cc                          |   71 +-
 iocore/dns/test_I_DNS.cc                        |   17 +-
 iocore/dns/test_P_DNS.cc                        |   13 +-
 iocore/eventsystem/IOBuffer.cc                  |   38 +-
 iocore/eventsystem/I_Action.h                   |   32 +-
 iocore/eventsystem/I_Continuation.h             |   43 +-
 iocore/eventsystem/I_EThread.h                  |   34 +-
 iocore/eventsystem/I_Event.h                    |  150 +-
 iocore/eventsystem/I_EventProcessor.h           |   48 +-
 iocore/eventsystem/I_EventSystem.h              |    6 +-
 iocore/eventsystem/I_IOBuffer.h                 |  359 +-
 iocore/eventsystem/I_Lock.h                     |  221 +-
 iocore/eventsystem/I_PriorityEventQueue.h       |   28 +-
 iocore/eventsystem/I_Processor.h                |   20 +-
 iocore/eventsystem/I_ProtectedQueue.h           |   11 +-
 iocore/eventsystem/I_ProxyAllocator.h           |   75 +-
 iocore/eventsystem/I_SocketManager.h            |   24 +-
 iocore/eventsystem/I_Tasks.h                    |    8 +-
 iocore/eventsystem/I_Thread.h                   |   22 +-
 iocore/eventsystem/I_VConnection.h              |  127 +-
 iocore/eventsystem/I_VIO.h                      |   36 +-
 iocore/eventsystem/Inline.cc                    |    1 -
 iocore/eventsystem/Lock.cc                      |   38 +-
 iocore/eventsystem/PQ-List.cc                   |    4 +-
 iocore/eventsystem/P_EventSystem.h              |    8 +-
 iocore/eventsystem/P_Freer.h                    |   91 +-
 iocore/eventsystem/P_IOBuffer.h                 |  126 +-
 iocore/eventsystem/P_ProtectedQueue.h           |    6 +-
 iocore/eventsystem/P_Thread.h                   |   11 +-
 iocore/eventsystem/P_UnixEThread.h              |   38 +-
 iocore/eventsystem/P_UnixEvent.h                |   14 +-
 iocore/eventsystem/P_UnixEventProcessor.h       |   22 +-
 iocore/eventsystem/P_UnixSocketManager.h        |  100 +-
 iocore/eventsystem/P_VConnection.h              |   16 +-
 iocore/eventsystem/P_VIO.h                      |   34 +-
 iocore/eventsystem/Processor.cc                 |    6 +-
 iocore/eventsystem/ProtectedQueue.cc            |   18 +-
 iocore/eventsystem/ProxyAllocator.cc            |   16 +-
 iocore/eventsystem/SocketManager.cc             |    7 +-
 iocore/eventsystem/Thread.cc                    |   31 +-
 iocore/eventsystem/UnixEThread.cc               |  272 +-
 iocore/eventsystem/UnixEventProcessor.cc        |   58 +-
 iocore/eventsystem/test_Buffer.cc               |   21 +-
 iocore/eventsystem/test_Event.cc                |   43 +-
 iocore/hostdb/HostDB.cc                         |  714 ++-
 iocore/hostdb/I_HostDB.h                        |    5 +-
 iocore/hostdb/I_HostDBProcessor.h               |  272 +-
 iocore/hostdb/Inline.cc                         |    2 -
 iocore/hostdb/MultiCache.cc                     |  328 +-
 iocore/hostdb/P_HostDB.h                        |   13 +-
 iocore/hostdb/P_HostDBProcessor.h               |  253 +-
 iocore/hostdb/P_MultiCache.h                    |  298 +-
 iocore/hostdb/include/Machine.h                 |   27 +-
 iocore/hostdb/test_I_HostDB.cc                  |   19 +-
 iocore/hostdb/test_P_HostDB.cc                  |   13 +-
 iocore/net/Connection.cc                        |   46 +-
 iocore/net/I_Net.h                              |   40 +-
 iocore/net/I_NetProcessor.h                     |   60 +-
 iocore/net/I_NetVConnection.h                   |   86 +-
 iocore/net/I_SessionAccept.h                    |   11 +-
 iocore/net/I_Socks.h                            |   40 +-
 iocore/net/I_UDPConnection.h                    |   16 +-
 iocore/net/I_UDPNet.h                           |   24 +-
 iocore/net/I_UDPPacket.h                        |   24 +-
 iocore/net/Inline.cc                            |    1 -
 iocore/net/Net.cc                               |   86 +-
 iocore/net/NetTest-http-server.c                |   58 +-
 iocore/net/NetVCTest.cc                         |  116 +-
 iocore/net/NetVConnection.cc                    |    1 -
 iocore/net/OCSPStapling.cc                      |   58 +-
 iocore/net/P_CompletionUtil.h                   |   24 +-
 iocore/net/P_Connection.h                       |   96 +-
 iocore/net/P_InkBulkIO.h                        |   69 +-
 iocore/net/P_LibBulkIO.h                        |   58 +-
 iocore/net/P_Net.h                              |   49 +-
 iocore/net/P_NetAccept.h                        |   34 +-
 iocore/net/P_NetVCTest.h                        |   26 +-
 iocore/net/P_NetVConnection.h                   |   24 +-
 iocore/net/P_OCSPStapling.h                     |    8 +-
 iocore/net/P_SSLCertLookup.h                    |   46 +-
 iocore/net/P_SSLConfig.h                        |   78 +-
 iocore/net/P_SSLNetAccept.h                     |   14 +-
 iocore/net/P_SSLNetProcessor.h                  |   16 +-
 iocore/net/P_SSLNetVConnection.h                |   93 +-
 iocore/net/P_SSLNextProtocolAccept.h            |   20 +-
 iocore/net/P_SSLNextProtocolSet.h               |   19 +-
 iocore/net/P_SSLUtils.h                         |   99 +-
 iocore/net/P_Socks.h                            |   50 +-
 iocore/net/P_UDPConnection.h                    |   35 +-
 iocore/net/P_UDPIOEvent.h                       |   48 +-
 iocore/net/P_UDPNet.h                           |  102 +-
 iocore/net/P_UDPPacket.h                        |   52 +-
 iocore/net/P_UnixCompletionUtil.h               |   46 +-
 iocore/net/P_UnixNet.h                          |  204 +-
 iocore/net/P_UnixNetProcessor.h                 |   37 +-
 iocore/net/P_UnixNetState.h                     |    5 +-
 iocore/net/P_UnixNetVConnection.h               |   97 +-
 iocore/net/P_UnixPollDescriptor.h               |   57 +-
 iocore/net/P_UnixUDPConnection.h                |   25 +-
 iocore/net/SSLCertLookup.cc                     |  150 +-
 iocore/net/SSLConfig.cc                         |   48 +-
 iocore/net/SSLNetAccept.cc                      |    6 +-
 iocore/net/SSLNetProcessor.cc                   |   27 +-
 iocore/net/SSLNetVConnection.cc                 |  342 +-
 iocore/net/SSLNextProtocolAccept.cc             |   43 +-
 iocore/net/SSLNextProtocolSet.cc                |   35 +-
 iocore/net/SSLSessionCache.cc                   |  109 +-
 iocore/net/SSLSessionCache.h                    |   68 +-
 iocore/net/SSLUtils.cc                          |  806 ++-
 iocore/net/Socks.cc                             |  180 +-
 iocore/net/UnixConnection.cc                    |  167 +-
 iocore/net/UnixNet.cc                           |  201 +-
 iocore/net/UnixNetAccept.cc                     |  131 +-
 iocore/net/UnixNetPages.cc                      |  122 +-
 iocore/net/UnixNetProcessor.cc                  |  124 +-
 iocore/net/UnixNetVConnection.cc                |   96 +-
 iocore/net/UnixUDPConnection.cc                 |   25 +-
 iocore/net/UnixUDPNet.cc                        |  178 +-
 iocore/net/test_I_Net.cc                        |   23 +-
 iocore/net/test_I_UDPNet.cc                     |   49 +-
 iocore/net/test_P_Net.cc                        |   31 +-
 iocore/net/test_P_UDPNet.cc                     |   49 +-
 iocore/net/test_certlookup.cc                   |   61 +-
 iocore/utils/I_Machine.h                        |   27 +-
 iocore/utils/I_OneWayMultiTunnel.h              |   22 +-
 iocore/utils/I_OneWayTunnel.h                   |   43 +-
 iocore/utils/Machine.cc                         |  123 +-
 iocore/utils/OneWayMultiTunnel.cc               |   73 +-
 iocore/utils/OneWayTunnel.cc                    |   74 +-
 .../examples/async_http_fetch/AsyncHttpFetch.cc |   99 +-
 .../AsyncHttpFetchStreaming.cc                  |   65 +-
 .../examples/async_timer/AsyncTimer.cc          |   31 +-
 lib/atscppapi/examples/boom/boom.cc             |  162 +-
 .../examples/clientredirect/ClientRedirect.cc   |   32 +-
 .../examples/clientrequest/ClientRequest.cc     |   35 +-
 .../examples/customresponse/CustomResponse.cc   |   31 +-
 .../examples/globalhook/GlobalHookPlugin.cc     |   17 +-
 .../GzipTransformationPlugin.cc                 |   79 +-
 .../examples/helloworld/HelloWorldPlugin.cc     |   13 +-
 lib/atscppapi/examples/intercept/intercept.cc   |   32 +-
 .../InternalTransactionHandling.cc              |   30 +-
 .../examples/logger_example/LoggerExample.cc    |   44 +-
 .../MultipleTransactionHookPlugins.cc           |   61 +-
 .../NullTransformationPlugin.cc                 |   51 +-
 .../examples/post_buffer/PostBuffer.cc          |   31 +-
 .../examples/remap_plugin/RemapPlugin.cc        |   14 +-
 .../examples/serverresponse/ServerResponse.cc   |   44 +-
 .../examples/stat_example/StatExample.cc        |   18 +-
 .../timeout_example/TimeoutExamplePlugin.cc     |   18 +-
 .../transactionhook/TransactionHookPlugin.cc    |   29 +-
 lib/atscppapi/src/AsyncHttpFetch.cc             |  108 +-
 lib/atscppapi/src/AsyncTimer.cc                 |   44 +-
 .../src/CaseInsensitiveStringComparator.cc      |   14 +-
 lib/atscppapi/src/ClientRequest.cc              |   23 +-
 lib/atscppapi/src/GlobalPlugin.cc               |   25 +-
 lib/atscppapi/src/GzipDeflateTransformation.cc  |   41 +-
 lib/atscppapi/src/GzipInflateTransformation.cc  |   44 +-
 lib/atscppapi/src/Headers.cc                    |  390 +-
 lib/atscppapi/src/HttpMethod.cc                 |   17 +-
 lib/atscppapi/src/HttpVersion.cc                |    7 +-
 lib/atscppapi/src/InterceptPlugin.cc            |  111 +-
 lib/atscppapi/src/Logger.cc                     |  104 +-
 lib/atscppapi/src/Plugin.cc                     |   17 +-
 lib/atscppapi/src/RemapPlugin.cc                |   16 +-
 lib/atscppapi/src/Request.cc                    |   71 +-
 lib/atscppapi/src/Response.cc                   |   70 +-
 lib/atscppapi/src/Stat.cc                       |   40 +-
 lib/atscppapi/src/Transaction.cc                |  227 +-
 lib/atscppapi/src/TransactionPlugin.cc          |   34 +-
 lib/atscppapi/src/TransformationPlugin.cc       |  150 +-
 lib/atscppapi/src/Url.cc                        |   78 +-
 lib/atscppapi/src/include/atscppapi/Async.h     |   96 +-
 .../src/include/atscppapi/AsyncHttpFetch.h      |   31 +-
 .../src/include/atscppapi/AsyncTimer.h          |   13 +-
 .../atscppapi/CaseInsensitiveStringComparator.h |    8 +-
 .../src/include/atscppapi/ClientRequest.h       |    9 +-
 .../src/include/atscppapi/GlobalPlugin.h        |    9 +-
 .../atscppapi/GzipDeflateTransformation.h       |  100 +-
 .../atscppapi/GzipInflateTransformation.h       |   98 +-
 lib/atscppapi/src/include/atscppapi/Headers.h   |  335 +-
 .../src/include/atscppapi/HttpMethod.h          |    5 +-
 .../src/include/atscppapi/HttpStatus.h          |    8 +-
 .../src/include/atscppapi/HttpVersion.h         |    5 +-
 .../src/include/atscppapi/InterceptPlugin.h     |   17 +-
 lib/atscppapi/src/include/atscppapi/Logger.h    |   66 +-
 lib/atscppapi/src/include/atscppapi/Mutex.h     |  112 +-
 lib/atscppapi/src/include/atscppapi/Plugin.h    |   84 +-
 .../src/include/atscppapi/PluginInit.h          |    6 +-
 .../src/include/atscppapi/RemapPlugin.h         |   25 +-
 lib/atscppapi/src/include/atscppapi/Request.h   |    9 +-
 lib/atscppapi/src/include/atscppapi/Response.h  |   14 +-
 lib/atscppapi/src/include/atscppapi/Stat.h      |   14 +-
 .../src/include/atscppapi/Transaction.h         |   29 +-
 .../src/include/atscppapi/TransactionPlugin.h   |   14 +-
 .../include/atscppapi/TransformationPlugin.h    |   11 +-
 lib/atscppapi/src/include/atscppapi/Url.h       |    9 +-
 .../src/include/atscppapi/noncopyable.h         |    9 +-
 .../src/include/atscppapi/shared_ptr.h          |   12 +-
 lib/atscppapi/src/include/atscppapi/utils.h     |   52 +-
 lib/atscppapi/src/include/logging_internal.h    |    4 +-
 lib/atscppapi/src/include/utils_internal.h      |  122 +-
 lib/atscppapi/src/utils.cc                      |   22 +-
 lib/atscppapi/src/utils_internal.cc             |   96 +-
 lib/records/I_RecAlarms.h                       |   40 +-
 lib/records/I_RecCore.h                         |  237 +-
 lib/records/I_RecDefs.h                         |  122 +-
 lib/records/I_RecEvents.h                       |   26 +-
 lib/records/I_RecHttp.h                         |  270 +-
 lib/records/I_RecLocal.h                        |    2 +-
 lib/records/I_RecMutex.h                        |   11 +-
 lib/records/I_RecProcess.h                      |   68 +-
 lib/records/I_RecSignals.h                      |   36 +-
 lib/records/P_RecCore.cc                        |  154 +-
 lib/records/P_RecCore.h                         |   25 +-
 lib/records/P_RecDefs.h                         |   83 +-
 lib/records/P_RecMessage.h                      |   12 +-
 lib/records/P_RecProcess.h                      |    2 +-
 lib/records/P_RecUtils.h                        |   23 +-
 lib/records/RecConfigParse.cc                   |   36 +-
 lib/records/RecCore.cc                          |  140 +-
 lib/records/RecDebug.cc                         |    2 +-
 lib/records/RecFile.cc                          |   27 +-
 lib/records/RecHttp.cc                          |  419 +-
 lib/records/RecLocal.cc                         |   26 +-
 lib/records/RecMessage.cc                       |   59 +-
 lib/records/RecMutex.cc                         |   10 +-
 lib/records/RecProcess.cc                       |  104 +-
 lib/records/RecUtils.cc                         |   56 +-
 lib/records/test_I_RecLocal.cc                  |   34 +-
 lib/records/test_RecordsConfig.cc               |   11 +-
 lib/ts/Allocator.h                              |   54 +-
 lib/ts/Arena.cc                                 |   22 +-
 lib/ts/Arena.h                                  |   27 +-
 lib/ts/Bitops.cc                                |   44 +-
 lib/ts/Bitops.h                                 |   13 +-
 lib/ts/CompileParseRules.cc                     |    8 +-
 lib/ts/ConsistentHash.cc                        |    7 +-
 lib/ts/ConsistentHash.h                         |   12 +-
 lib/ts/CryptoHash.h                             |  193 +-
 lib/ts/Diags.cc                                 |   53 +-
 lib/ts/Diags.h                                  |  201 +-
 lib/ts/DynArray.h                               |   80 +-
 lib/ts/EventNotify.cc                           |    7 +-
 lib/ts/Hash.cc                                  |   12 +-
 lib/ts/Hash.h                                   |   16 +-
 lib/ts/HashFNV.h                                |   36 +-
 lib/ts/HashMD5.cc                               |   63 +-
 lib/ts/HashMD5.h                                |   22 +-
 lib/ts/HashSip.cc                               |   38 +-
 lib/ts/HashSip.h                                |    7 +-
 lib/ts/HostLookup.cc                            |  222 +-
 lib/ts/HostLookup.h                             |   86 +-
 lib/ts/INK_MD5.h                                |   10 +-
 lib/ts/I_Layout.h                               |    5 +-
 lib/ts/I_Version.h                              |   40 +-
 lib/ts/InkErrno.h                               |   64 +-
 lib/ts/InkPool.h                                |   31 +-
 lib/ts/IntrusiveDList.h                         |  230 +-
 lib/ts/IntrusivePtrTest.cc                      |   45 +-
 lib/ts/IpMap.cc                                 | 1800 +++----
 lib/ts/IpMap.h                                  |  302 +-
 lib/ts/IpMapConf.cc                             |   45 +-
 lib/ts/IpMapConf.h                              |    4 +-
 lib/ts/IpMapTest.cc                             |  110 +-
 lib/ts/Layout.cc                                |   29 +-
 lib/ts/List.h                                   |  552 ++-
 lib/ts/MMH.cc                                   |  305 +-
 lib/ts/MMH.h                                    |   20 +-
 lib/ts/Map.h                                    |  980 ++--
 lib/ts/MatcherUtils.cc                          |   73 +-
 lib/ts/MatcherUtils.h                           |  100 +-
 lib/ts/MimeTable.cc                             |  210 +-
 lib/ts/MimeTable.h                              |   30 +-
 lib/ts/ParseRules.cc                            |   29 +-
 lib/ts/ParseRules.h                             |  247 +-
 lib/ts/Ptr.h                                    |  222 +-
 lib/ts/RawHashTable.cc                          |    1 -
 lib/ts/RawHashTable.h                           |  128 +-
 lib/ts/RbTree.cc                                |  529 +-
 lib/ts/RbTree.h                                 |  363 +-
 lib/ts/Regex.cc                                 |   49 +-
 lib/ts/Regex.h                                  |   15 +-
 lib/ts/Regression.cc                            |   35 +-
 lib/ts/Regression.h                             |   47 +-
 lib/ts/SimpleTokenizer.h                        |   81 +-
 lib/ts/TestBox.h                                |   73 +-
 lib/ts/TestHttpHeader.cc                        |   23 +-
 lib/ts/TextBuffer.cc                            |   13 +-
 lib/ts/TextBuffer.h                             |   30 +-
 lib/ts/Tokenizer.cc                             |   63 +-
 lib/ts/Tokenizer.h                              |   36 +-
 lib/ts/Trie.h                                   |   69 +-
 lib/ts/TsBuffer.h                               |  823 +--
 lib/ts/Vec.cc                                   |  101 +-
 lib/ts/Vec.h                                    |  671 ++-
 lib/ts/Version.cc                               |   57 +-
 lib/ts/defalloc.h                               |   19 +-
 lib/ts/fastlz.c                                 |  367 +-
 lib/ts/fastlz.h                                 |   16 +-
 lib/ts/ink_aiocb.h                              |   25 +-
 lib/ts/ink_align.h                              |   17 +-
 lib/ts/ink_apidefs.h                            |   10 +-
 lib/ts/ink_args.cc                              |  112 +-
 lib/ts/ink_args.h                               |   53 +-
 lib/ts/ink_assert.h                             |   17 +-
 lib/ts/ink_atomic.h                             |   68 +-
 lib/ts/ink_auth_api.cc                          |   19 +-
 lib/ts/ink_auth_api.h                           |  141 +-
 lib/ts/ink_base64.cc                            |   26 +-
 lib/ts/ink_cap.cc                               |  134 +-
 lib/ts/ink_cap.h                                |   26 +-
 lib/ts/ink_code.cc                              |   29 +-
 lib/ts/ink_code.h                               |   12 +-
 lib/ts/ink_defs.cc                              |    2 +-
 lib/ts/ink_defs.h                               |   58 +-
 lib/ts/ink_error.cc                             |   14 +-
 lib/ts/ink_error.h                              |    2 +-
 lib/ts/ink_exception.h                          |   20 +-
 lib/ts/ink_file.cc                              |  106 +-
 lib/ts/ink_file.h                               |   41 +-
 lib/ts/ink_hash_table.cc                        |  143 +-
 lib/ts/ink_hash_table.h                         |  114 +-
 lib/ts/ink_hrtime.cc                            |   19 +-
 lib/ts/ink_hrtime.h                             |   76 +-
 lib/ts/ink_inet.cc                              |  350 +-
 lib/ts/ink_inet.h                               | 1057 ++--
 lib/ts/ink_inout.h                              |   70 +-
 lib/ts/ink_llqueue.h                            |   22 +-
 lib/ts/ink_lockfile.h                           |   30 +-
 lib/ts/ink_memory.cc                            |   45 +-
 lib/ts/ink_memory.h                             |  273 +-
 lib/ts/ink_mutex.h                              |   21 +-
 lib/ts/ink_platform.h                           |   66 +-
 lib/ts/ink_queue.cc                             |  174 +-
 lib/ts/ink_queue.h                              |  185 +-
 lib/ts/ink_queue_ext.cc                         |  100 +-
 lib/ts/ink_queue_ext.h                          |  178 +-
 lib/ts/ink_queue_utils.cc                       |   10 +-
 lib/ts/ink_rand.cc                              |   41 +-
 lib/ts/ink_rand.h                               |    7 +-
 lib/ts/ink_res_init.cc                          |  131 +-
 lib/ts/ink_res_mkquery.cc                       |  701 +--
 lib/ts/ink_resolver.h                           |  287 +-
 lib/ts/ink_resource.cc                          |   28 +-
 lib/ts/ink_resource.h                           |   17 +-
 lib/ts/ink_rwlock.cc                            |   19 +-
 lib/ts/ink_rwlock.h                             |   25 +-
 lib/ts/ink_sock.cc                              |   25 +-
 lib/ts/ink_sock.h                               |    6 +-
 lib/ts/ink_sprintf.cc                           |   52 +-
 lib/ts/ink_sprintf.h                            |    9 +-
 lib/ts/ink_stack_trace.cc                       |    8 +-
 lib/ts/ink_stack_trace.h                        |    9 +-
 lib/ts/ink_string++.cc                          |   25 +-
 lib/ts/ink_string++.h                           |   76 +-
 lib/ts/ink_string.cc                            |   20 +-
 lib/ts/ink_string.h                             |   32 +-
 lib/ts/ink_sys_control.cc                       |    6 +-
 lib/ts/ink_sys_control.h                        |    2 +-
 lib/ts/ink_syslog.cc                            |   43 +-
 lib/ts/ink_thread.cc                            |   18 +-
 lib/ts/ink_thread.h                             |   47 +-
 lib/ts/ink_time.cc                              |   35 +-
 lib/ts/ink_time.h                               |   10 +-
 lib/ts/libts.h                                  |    4 +-
 lib/ts/llqueue.cc                               |   35 +-
 lib/ts/load_http_hdr.cc                         |  133 +-
 lib/ts/lockfile.cc                              |   42 +-
 lib/ts/mkdfa.c                                  |   49 +-
 lib/ts/signals.cc                               |   11 +-
 lib/ts/signals.h                                |    2 +-
 lib/ts/test_List.cc                             |   55 +-
 lib/ts/test_Map.cc                              |   81 +-
 lib/ts/test_Regex.cc                            |   16 +-
 lib/ts/test_Vec.cc                              |   25 +-
 lib/ts/test_arena.cc                            |    4 +-
 lib/ts/test_atomic.cc                           |   47 +-
 lib/ts/test_freelist.cc                         |   11 +-
 lib/ts/test_geometry.cc                         |    3 +-
 lib/ts/test_memchr.cc                           |   28 +-
 lib/ts/test_strings.cc                          |  152 +-
 lib/wccp/Wccp.h                                 |  334 +-
 lib/wccp/WccpConfig.cc                          |  489 +-
 lib/wccp/WccpEndPoint.cc                        |  757 ++-
 lib/wccp/WccpLocal.h                            | 2761 ++++++-----
 lib/wccp/WccpMeta.h                             |  159 +-
 lib/wccp/WccpMsg.cc                             | 1095 ++--
 lib/wccp/WccpStatic.cc                          |  113 +-
 lib/wccp/WccpUtil.h                             |  200 +-
 lib/wccp/wccp-test-router.cc                    |   64 +-
 mgmt/Alarms.cc                                  |  130 +-
 mgmt/Alarms.h                                   |   66 +-
 mgmt/BaseManager.cc                             |   35 +-
 mgmt/BaseManager.h                              |   74 +-
 mgmt/FileManager.cc                             |  163 +-
 mgmt/FileManager.h                              |   63 +-
 mgmt/LocalManager.cc                            |  251 +-
 mgmt/LocalManager.h                             |   33 +-
 mgmt/MgmtDefs.h                                 |   22 +-
 mgmt/MultiFile.cc                               |   32 +-
 mgmt/MultiFile.h                                |   21 +-
 mgmt/ProcessManager.cc                          |   77 +-
 mgmt/ProcessManager.h                           |   21 +-
 mgmt/ProxyConfig.cc                             |  108 +-
 mgmt/ProxyConfig.h                              |   68 +-
 mgmt/RecordsConfig.cc                           |    3 +-
 mgmt/RecordsConfig.h                            |   28 +-
 mgmt/RecordsConfigUtils.cc                      |   28 +-
 mgmt/Rollback.cc                                |  134 +-
 mgmt/Rollback.h                                 |   64 +-
 mgmt/WebMgmtUtils.cc                            |  229 +-
 mgmt/WebMgmtUtils.h                             |   10 +-
 mgmt/api/APITestCliRemote.cc                    |  225 +-
 mgmt/api/CfgContextDefs.h                       |   19 +-
 mgmt/api/CfgContextImpl.cc                      |  287 +-
 mgmt/api/CfgContextImpl.h                       |  325 +-
 mgmt/api/CfgContextManager.cc                   |  137 +-
 mgmt/api/CfgContextManager.h                    |   28 +-
 mgmt/api/CfgContextUtils.cc                     |  563 +--
 mgmt/api/CfgContextUtils.h                      |   86 +-
 mgmt/api/CoreAPI.cc                             |  128 +-
 mgmt/api/CoreAPI.h                              |   59 +-
 mgmt/api/CoreAPIRemote.cc                       |  104 +-
 mgmt/api/CoreAPIShared.cc                       |   13 +-
 mgmt/api/CoreAPIShared.h                        |   48 +-
 mgmt/api/EventCallback.cc                       |   47 +-
 mgmt/api/EventCallback.h                        |   20 +-
 mgmt/api/EventControlMain.cc                    |  150 +-
 mgmt/api/EventControlMain.h                     |   15 +-
 mgmt/api/GenericParser.cc                       |  159 +-
 mgmt/api/GenericParser.h                        |  102 +-
 mgmt/api/INKMgmtAPI.cc                          |  408 +-
 mgmt/api/NetworkMessage.cc                      |  189 +-
 mgmt/api/NetworkMessage.h                       |   24 +-
 mgmt/api/NetworkUtilsLocal.cc                   |    2 +-
 mgmt/api/NetworkUtilsLocal.h                    |    2 +-
 mgmt/api/NetworkUtilsRemote.cc                  |   96 +-
 mgmt/api/NetworkUtilsRemote.h                   |    9 +-
 mgmt/api/TSControlMain.cc                       |  291 +-
 mgmt/api/TSControlMain.h                        |    3 +-
 mgmt/api/include/mgmtapi.h                      | 1505 +++---
 mgmt/cluster/ClusterCom.cc                      |  581 ++-
 mgmt/cluster/ClusterCom.h                       |   62 +-
 mgmt/cluster/VMap.cc                            |  207 +-
 mgmt/cluster/VMap.h                             |   23 +-
 mgmt/utils/ExpandingArray.cc                    |    9 +-
 mgmt/utils/ExpandingArray.h                     |   13 +-
 mgmt/utils/MgmtHashTable.h                      |   68 +-
 mgmt/utils/MgmtMarshall.cc                      |   65 +-
 mgmt/utils/MgmtMarshall.h                       |   30 +-
 mgmt/utils/MgmtSocket.cc                        |   42 +-
 mgmt/utils/MgmtSocket.h                         |    6 +-
 mgmt/utils/MgmtUtils.cc                         |   75 +-
 mgmt/utils/MgmtUtils.h                          |   12 +-
 mgmt/utils/test_marshall.cc                     |  144 +-
 mgmt/web2/WebCompatibility.cc                   |   25 +-
 mgmt/web2/WebCompatibility.h                    |   12 +-
 mgmt/web2/WebGlobals.h                          |   54 +-
 mgmt/web2/WebHttp.cc                            |   63 +-
 mgmt/web2/WebHttp.h                             |    6 +-
 mgmt/web2/WebHttpContext.cc                     |   16 +-
 mgmt/web2/WebHttpContext.h                      |   21 +-
 mgmt/web2/WebHttpMessage.cc                     |  113 +-
 mgmt/web2/WebHttpMessage.h                      |   94 +-
 mgmt/web2/WebIntrMain.cc                        |   85 +-
 mgmt/web2/WebOverview.cc                        |   88 +-
 mgmt/web2/WebOverview.h                         |   52 +-
 mgmt/web2/WebUtils.cc                           |    5 +-
 mgmt/web2/WebUtils.h                            |    3 +-
 plugins/cacheurl/cacheurl.cc                    |  108 +-
 plugins/conf_remap/conf_remap.cc                |   70 +-
 .../ats_pagespeed/ats_base_fetch.cc             |   75 +-
 .../experimental/ats_pagespeed/ats_base_fetch.h |   54 +-
 .../ats_pagespeed/ats_beacon_intercept.cc       |   93 +-
 .../experimental/ats_pagespeed/ats_config.cc    |   79 +-
 plugins/experimental/ats_pagespeed/ats_config.h |   66 +-
 .../ats_pagespeed/ats_header_utils.cc           |   35 +-
 .../ats_pagespeed/ats_header_utils.h            |   10 +-
 .../ats_pagespeed/ats_log_message_handler.cc    |   48 +-
 .../ats_pagespeed/ats_log_message_handler.h     |   15 +-
 .../ats_pagespeed/ats_message_handler.cc        |   50 +-
 .../ats_pagespeed/ats_message_handler.h         |   60 +-
 .../experimental/ats_pagespeed/ats_pagespeed.cc |  448 +-
 .../experimental/ats_pagespeed/ats_pagespeed.h  |   65 +-
 .../ats_pagespeed/ats_process_context.cc        |   46 +-
 .../ats_pagespeed/ats_process_context.h         |   40 +-
 .../ats_pagespeed/ats_resource_intercept.cc     |  240 +-
 .../ats_pagespeed/ats_resource_intercept.h      |   24 +-
 .../ats_pagespeed/ats_rewrite_driver_factory.cc |  234 +-
 .../ats_pagespeed/ats_rewrite_driver_factory.h  |  106 +-
 .../ats_pagespeed/ats_rewrite_options.cc        |  111 +-
 .../ats_pagespeed/ats_rewrite_options.h         |   74 +-
 .../ats_pagespeed/ats_server_context.cc         |   20 +-
 .../ats_pagespeed/ats_server_context.h          |   25 +-
 .../ats_pagespeed/ats_thread_system.h           |   15 +-
 .../ats_pagespeed/gzip/configuration.cc         |  403 +-
 .../ats_pagespeed/gzip/configuration.h          |  131 +-
 .../ats_pagespeed/gzip/debug_macros.h           |   43 +-
 plugins/experimental/ats_pagespeed/gzip/gzip.cc |  271 +-
 plugins/experimental/ats_pagespeed/gzip/misc.cc |   32 +-
 plugins/experimental/ats_pagespeed/gzip/misc.h  |   32 +-
 plugins/experimental/authproxy/authproxy.cc     |  258 +-
 plugins/experimental/authproxy/utils.cc         |   55 +-
 plugins/experimental/authproxy/utils.h          |   39 +-
 .../background_fetch/background_fetch.cc        |  193 +-
 plugins/experimental/balancer/balancer.cc       |   33 +-
 plugins/experimental/balancer/balancer.h        |   22 +-
 plugins/experimental/balancer/hash.cc           |   73 +-
 plugins/experimental/balancer/roundrobin.cc     |   25 +-
 .../experimental/buffer_upload/buffer_upload.cc |  378 +-
 .../experimental/channel_stats/channel_stats.cc |  266 +-
 .../experimental/channel_stats/debug_macros.h   |   72 +-
 .../collapsed_connection/MurmurHash3.cc         |  227 +-
 .../collapsed_connection/MurmurHash3.h          |    4 +-
 .../P_collapsed_connection.h                    |   33 +-
 .../collapsed_connection.cc                     |  141 +-
 .../custom_redirect/custom_redirect.cc          |  217 +-
 plugins/experimental/epic/epic.cc               |  401 +-
 plugins/experimental/escalate/escalate.cc       |   41 +-
 plugins/experimental/esi/combo_handler.cc       |  233 +-
 plugins/experimental/esi/esi.cc                 |  571 +--
 .../esi/fetcher/FetchedDataProcessor.h          |   13 +-
 .../experimental/esi/fetcher/HttpDataFetcher.h  |   35 +-
 .../esi/fetcher/HttpDataFetcherImpl.cc          |   73 +-
 .../esi/fetcher/HttpDataFetcherImpl.h           |   45 +-
 plugins/experimental/esi/lib/Attribute.h        |    7 +-
 plugins/experimental/esi/lib/ComponentBase.h    |   17 +-
 plugins/experimental/esi/lib/DocNode.cc         |   48 +-
 plugins/experimental/esi/lib/DocNode.h          |   27 +-
 plugins/experimental/esi/lib/EsiGunzip.cc       |   35 +-
 plugins/experimental/esi/lib/EsiGunzip.h        |   12 +-
 plugins/experimental/esi/lib/EsiGzip.cc         |   65 +-
 plugins/experimental/esi/lib/EsiGzip.h          |   15 +-
 plugins/experimental/esi/lib/EsiParser.cc       |  283 +-
 plugins/experimental/esi/lib/EsiParser.h        |   70 +-
 plugins/experimental/esi/lib/EsiProcessor.cc    |  593 ++-
 plugins/experimental/esi/lib/EsiProcessor.h     |   54 +-
 plugins/experimental/esi/lib/Expression.cc      |   83 +-
 plugins/experimental/esi/lib/Expression.h       |   51 +-
 plugins/experimental/esi/lib/FailureInfo.cc     |  124 +-
 plugins/experimental/esi/lib/FailureInfo.h      |  114 +-
 plugins/experimental/esi/lib/HandlerManager.cc  |   31 +-
 plugins/experimental/esi/lib/HandlerManager.h   |   21 +-
 plugins/experimental/esi/lib/HttpHeader.h       |    7 +-
 .../esi/lib/IncludeHandlerFactory.h             |   16 +-
 .../esi/lib/SpecialIncludeHandler.h             |   28 +-
 plugins/experimental/esi/lib/Stats.cc           |   69 +-
 plugins/experimental/esi/lib/Stats.h            |   51 +-
 plugins/experimental/esi/lib/StringHash.h       |   13 +-
 plugins/experimental/esi/lib/Utils.cc           |   41 +-
 plugins/experimental/esi/lib/Utils.h            |   48 +-
 plugins/experimental/esi/lib/Variables.cc       |  209 +-
 plugins/experimental/esi/lib/Variables.h        |   56 +-
 plugins/experimental/esi/lib/gzip.cc            |   34 +-
 plugins/experimental/esi/lib/gzip.h             |   13 +-
 plugins/experimental/esi/serverIntercept.cc     |   75 +-
 .../experimental/esi/test/StubIncludeHandler.cc |   17 +-
 .../experimental/esi/test/StubIncludeHandler.h  |   14 +-
 .../experimental/esi/test/TestHandlerManager.cc |   10 +-
 .../experimental/esi/test/TestHttpDataFetcher.h |   35 +-
 plugins/experimental/esi/test/docnode_test.cc   |   16 +-
 plugins/experimental/esi/test/parser_test.cc    |   93 +-
 plugins/experimental/esi/test/print_funcs.cc    |    8 +-
 plugins/experimental/esi/test/processor_test.cc |  349 +-
 plugins/experimental/esi/test/sampleProb.cc     |  274 +-
 plugins/experimental/esi/test/utils_test.cc     |   31 +-
 plugins/experimental/esi/test/vars_test.cc      |   47 +-
 plugins/experimental/generator/generator.cc     |  234 +-
 plugins/experimental/geoip_acl/acl.cc           |   57 +-
 plugins/experimental/geoip_acl/acl.h            |   83 +-
 plugins/experimental/geoip_acl/geoip_acl.cc     |   24 +-
 plugins/experimental/geoip_acl/lulu.h           |    3 +-
 .../header_normalize/header_normalize.cc        |   34 +-
 .../experimental/healthchecks/healthchecks.c    |  109 +-
 plugins/experimental/hipes/gen_escape.c         |   14 +-
 plugins/experimental/hipes/hipes.cc             |  114 +-
 .../memcached_remap/memcached_remap.cc          |  364 +-
 plugins/experimental/metalink/metalink.cc       |   92 +-
 plugins/experimental/mysql_remap/default.h      |    2 +-
 .../experimental/mysql_remap/lib/dictionary.c   |  457 +-
 .../experimental/mysql_remap/lib/dictionary.h   |   40 +-
 .../experimental/mysql_remap/lib/iniparser.c    |  630 +--
 .../experimental/mysql_remap/lib/iniparser.h    |   38 +-
 plugins/experimental/mysql_remap/mysql_remap.cc |  154 +-
 .../regex_revalidate/regex_revalidate.c         |  805 ++-
 plugins/experimental/remap_stats/remap_stats.c  |   58 +-
 plugins/experimental/s3_auth/s3_auth.cc         |  158 +-
 plugins/experimental/spdy/http.cc               |  385 +-
 plugins/experimental/spdy/http.h                |   76 +-
 plugins/experimental/spdy/io.cc                 |   66 +-
 plugins/experimental/spdy/io.h                  |  241 +-
 plugins/experimental/spdy/lib/base/atomic.h     |   39 +-
 plugins/experimental/spdy/lib/base/inet.h       |   76 +-
 plugins/experimental/spdy/lib/base/logging.cc   |   38 +-
 plugins/experimental/spdy/lib/base/logging.h    |   54 +-
 plugins/experimental/spdy/lib/spdy/message.cc   |  681 ++-
 plugins/experimental/spdy/lib/spdy/spdy.h       |  521 +-
 plugins/experimental/spdy/lib/spdy/zstream.cc   |  140 +-
 plugins/experimental/spdy/lib/spdy/zstream.h    |  148 +-
 plugins/experimental/spdy/protocol.cc           |  244 +-
 plugins/experimental/spdy/protocol.h            |   24 +-
 plugins/experimental/spdy/spdy.cc               |  500 +-
 plugins/experimental/spdy/stream.cc             |  454 +-
 plugins/experimental/spdy/strings.cc            |  150 +-
 plugins/experimental/spdy/tests/stubs.cc        |   16 +-
 plugins/experimental/spdy/tests/zstream_test.cc |  303 +-
 plugins/experimental/ssl_cert_loader/ats-util.h |   10 +-
 .../experimental/ssl_cert_loader/domain-tree.cc |   24 +-
 .../experimental/ssl_cert_loader/domain-tree.h  |   29 +-
 .../ssl_cert_loader/ssl-cert-loader.cc          |   92 +-
 plugins/experimental/sslheaders/expand.cc       |   56 +-
 plugins/experimental/sslheaders/sslheaders.cc   |   49 +-
 plugins/experimental/sslheaders/sslheaders.h    |   55 +-
 .../experimental/sslheaders/test_sslheaders.cc  |  118 +-
 plugins/experimental/sslheaders/util.cc         |   27 +-
 .../stale_while_revalidate.c                    | 1136 ++---
 plugins/experimental/ts_lua/ts_lua.c            |   29 +-
 .../ts_lua/ts_lua_cached_response.c             |   87 +-
 .../ts_lua/ts_lua_cached_response.h             |    2 +-
 .../experimental/ts_lua/ts_lua_client_request.c |  218 +-
 .../experimental/ts_lua/ts_lua_client_request.h |    2 +-
 .../ts_lua/ts_lua_client_response.c             |  102 +-
 .../ts_lua/ts_lua_client_response.h             |    2 +-
 plugins/experimental/ts_lua/ts_lua_common.h     |  134 +-
 plugins/experimental/ts_lua/ts_lua_context.c    |   26 +-
 plugins/experimental/ts_lua/ts_lua_context.h    |    4 +-
 plugins/experimental/ts_lua/ts_lua_crypto.c     |   83 +-
 plugins/experimental/ts_lua/ts_lua_crypto.h     |    2 +-
 plugins/experimental/ts_lua/ts_lua_hook.c       |   65 +-
 plugins/experimental/ts_lua/ts_lua_hook.h       |    2 +-
 plugins/experimental/ts_lua/ts_lua_http.c       |   76 +-
 plugins/experimental/ts_lua/ts_lua_http.h       |    2 +-
 plugins/experimental/ts_lua/ts_lua_http_cntl.c  |   24 +-
 plugins/experimental/ts_lua/ts_lua_http_cntl.h  |    2 +-
 .../experimental/ts_lua/ts_lua_http_config.c    |  121 +-
 .../experimental/ts_lua/ts_lua_http_config.h    |    2 +-
 .../experimental/ts_lua/ts_lua_http_intercept.c |   70 +-
 .../experimental/ts_lua/ts_lua_http_intercept.h |    2 +-
 .../experimental/ts_lua/ts_lua_http_milestone.c |   49 +-
 .../experimental/ts_lua/ts_lua_http_milestone.h |    2 +-
 plugins/experimental/ts_lua/ts_lua_log.c        |   29 +-
 plugins/experimental/ts_lua/ts_lua_log.h        |    2 +-
 plugins/experimental/ts_lua/ts_lua_mgmt.c       |   18 +-
 plugins/experimental/ts_lua/ts_lua_mgmt.h       |    2 +-
 plugins/experimental/ts_lua/ts_lua_misc.c       |   38 +-
 plugins/experimental/ts_lua/ts_lua_misc.h       |    2 +-
 plugins/experimental/ts_lua/ts_lua_package.c    |   51 +-
 plugins/experimental/ts_lua/ts_lua_package.h    |    2 +-
 plugins/experimental/ts_lua/ts_lua_remap.c      |   18 +-
 plugins/experimental/ts_lua/ts_lua_remap.h      |    2 +-
 .../experimental/ts_lua/ts_lua_server_request.c |  195 +-
 .../experimental/ts_lua/ts_lua_server_request.h |    2 +-
 .../ts_lua/ts_lua_server_response.c             |   91 +-
 .../ts_lua/ts_lua_server_response.h             |    2 +-
 plugins/experimental/ts_lua/ts_lua_stat.c       |   80 +-
 plugins/experimental/ts_lua/ts_lua_stat.h       |    2 +-
 plugins/experimental/ts_lua/ts_lua_string.c     |    2 +-
 plugins/experimental/ts_lua/ts_lua_string.h     |    2 +-
 plugins/experimental/ts_lua/ts_lua_transform.c  |   19 +-
 plugins/experimental/ts_lua/ts_lua_util.c       |  116 +-
 plugins/experimental/ts_lua/ts_lua_util.h       |   34 +-
 plugins/experimental/url_sig/url_sig.c          |  104 +-
 plugins/experimental/url_sig/url_sig.h          |   26 +-
 plugins/experimental/xdebug/xdebug.cc           |  122 +-
 plugins/gzip/configuration.cc                   |  407 +-
 plugins/gzip/configuration.h                    |  149 +-
 plugins/gzip/debug_macros.h                     |   43 +-
 plugins/gzip/gzip.cc                            |  275 +-
 plugins/gzip/misc.cc                            |   32 +-
 plugins/gzip/misc.h                             |   32 +-
 plugins/header_rewrite/condition.cc             |    4 +-
 plugins/header_rewrite/condition.h              |   49 +-
 plugins/header_rewrite/conditions.cc            |  119 +-
 plugins/header_rewrite/conditions.h             |  173 +-
 plugins/header_rewrite/expander.cc              |    2 +-
 plugins/header_rewrite/expander.h               |    9 +-
 plugins/header_rewrite/factory.cc               |   12 +-
 plugins/header_rewrite/factory.h                |    4 +-
 plugins/header_rewrite/header_rewrite.cc        |   76 +-
 plugins/header_rewrite/lulu.cc                  |   50 +-
 plugins/header_rewrite/lulu.h                   |   54 +-
 plugins/header_rewrite/matcher.h                |  105 +-
 plugins/header_rewrite/operator.cc              |    7 +-
 plugins/header_rewrite/operator.h               |   26 +-
 plugins/header_rewrite/operators.cc             |  108 +-
 plugins/header_rewrite/operators.h              |  120 +-
 plugins/header_rewrite/parser.cc                |   13 +-
 plugins/header_rewrite/parser.h                 |   50 +-
 plugins/header_rewrite/regex_helper.cc          |   64 +-
 plugins/header_rewrite/regex_helper.h           |   28 +-
 plugins/header_rewrite/resources.cc             |    2 +-
 plugins/header_rewrite/resources.h              |   13 +-
 plugins/header_rewrite/ruleset.cc               |   12 +-
 plugins/header_rewrite/ruleset.h                |   53 +-
 plugins/header_rewrite/statement.cc             |    8 +-
 plugins/header_rewrite/statement.h              |   66 +-
 plugins/header_rewrite/value.h                  |   49 +-
 plugins/libloader/libloader.c                   |   73 +-
 plugins/regex_remap/regex_remap.cc              |  318 +-
 plugins/stats_over_http/stats_over_http.c       |  113 +-
 plugins/tcpinfo/tcpinfo.cc                      |  182 +-
 proxy/AbstractBuffer.cc                         |   52 +-
 proxy/AbstractBuffer.h                          |   80 +-
 proxy/CacheControl.cc                           |   81 +-
 proxy/CacheControl.h                            |   44 +-
 proxy/CompletionUtil.h                          |   24 +-
 proxy/ConfigParse.h                             |    8 +-
 proxy/ControlBase.cc                            |  547 +-
 proxy/ControlBase.h                             |   43 +-
 proxy/ControlMatcher.cc                         |  224 +-
 proxy/ControlMatcher.h                          |  241 +-
 proxy/CoreUtils.cc                              |  207 +-
 proxy/CoreUtils.h                               |   62 +-
 proxy/Crash.cc                                  |   18 +-
 proxy/DynamicStats.h                            |   30 +-
 proxy/EventName.cc                              |  146 +-
 proxy/FetchSM.cc                                |  102 +-
 proxy/FetchSM.h                                 |   69 +-
 proxy/HttpTransStats.h                          |    4 +-
 proxy/ICP.cc                                    | 2054 ++++----
 proxy/ICP.h                                     |  686 +--
 proxy/ICPConfig.cc                              |  472 +-
 proxy/ICPProcessor.cc                           |    4 +-
 proxy/ICPProcessor.h                            |   10 +-
 proxy/ICPStats.cc                               |  134 +-
 proxy/ICPevents.h                               |    3 +-
 proxy/ICPlog.h                                  |   14 +-
 proxy/IPAllow.cc                                |   60 +-
 proxy/IPAllow.h                                 |   49 +-
 proxy/InkAPI.cc                                 | 1703 ++++---
 proxy/InkAPIInternal.h                          |  133 +-
 proxy/InkAPITest.cc                             | 1424 +++---
 proxy/InkAPITestTool.cc                         |  372 +-
 proxy/InkIOCoreAPI.cc                           |   42 +-
 proxy/InkPool_r.h                               |   24 +-
 proxy/Main.cc                                   |  488 +-
 proxy/Main.h                                    |   12 +-
 proxy/ParentSelection.cc                        |  309 +-
 proxy/ParentSelection.h                         |   84 +-
 proxy/Plugin.cc                                 |   91 +-
 proxy/Plugin.h                                  |   19 +-
 proxy/PluginVC.cc                               |  138 +-
 proxy/PluginVC.h                                |  124 +-
 proxy/Prefetch.cc                               |  752 ++-
 proxy/Prefetch.h                                |  162 +-
 proxy/ProtoSM.h                                 |   38 +-
 proxy/ProtocolProbeSessionAccept.cc             |   40 +-
 proxy/ProtocolProbeSessionAccept.h              |   27 +-
 proxy/ProxyClientSession.cc                     |   46 +-
 proxy/ProxyClientSession.h                      |   51 +-
 proxy/RegressionSM.cc                           |   88 +-
 proxy/RegressionSM.h                            |   18 +-
 proxy/ReverseProxy.cc                           |   39 +-
 proxy/ReverseProxy.h                            |    2 +-
 proxy/Show.h                                    |   46 +-
 proxy/SocksProxy.cc                             |  409 +-
 proxy/StatPages.cc                              |   18 +-
 proxy/StatPages.h                               |   42 +-
 proxy/StatSystem.cc                             |  300 +-
 proxy/StatSystem.h                              |  553 +--
 proxy/StufferUdpReceiver.cc                     |   74 +-
 proxy/TestClusterHash.cc                        |   12 +-
 proxy/TestDNS.cc                                |  121 +-
 proxy/TestPreProc.cc                            |   16 +-
 proxy/TestPreProc.h                             |   13 +-
 proxy/TestProxy.cc                              |  118 +-
 proxy/TestSimpleProxy.cc                        |   49 +-
 proxy/TimeTrace.h                               |   21 +-
 proxy/Transform.cc                              |  259 +-
 proxy/Transform.h                               |   33 +-
 proxy/TransformInternal.h                       |   42 +-
 proxy/UDPAPIClientTest.cc                       |   12 +-
 proxy/UDPAPIClientTest.h                        |    2 +-
 proxy/UDPAPITest.cc                             |   12 +-
 proxy/UDPAPITest.h                              |    2 +-
 proxy/UnixCompletionUtil.h                      |   46 +-
 proxy/Update.cc                                 | 1758 ++++---
 proxy/Update.h                                  |  191 +-
 proxy/api/ts/InkAPIPrivateIOCore.h              |   97 +-
 proxy/api/ts/TsException.h                      |   68 +-
 proxy/api/ts/experimental.h                     | 1273 +++--
 proxy/api/ts/remap.h                            |  201 +-
 proxy/api/ts/ts.h                               | 4690 +++++++++---------
 proxy/congest/Congestion.cc                     |  168 +-
 proxy/congest/Congestion.h                      |  175 +-
 proxy/congest/CongestionDB.cc                   |  107 +-
 proxy/congest/CongestionDB.h                    |   38 +-
 proxy/congest/CongestionStats.cc                |   24 +-
 proxy/congest/CongestionStats.h                 |    7 +-
 proxy/congest/CongestionTest.cc                 |  103 +-
 proxy/congest/MT_hashtable.h                    |  163 +-
 proxy/hdrs/HTTP.cc                              |  425 +-
 proxy/hdrs/HTTP.h                               |  426 +-
 proxy/hdrs/HdrHeap.cc                           |  214 +-
 proxy/hdrs/HdrHeap.h                            |  284 +-
 proxy/hdrs/HdrTSOnly.cc                         |   36 +-
 proxy/hdrs/HdrTest.cc                           | 1600 +++---
 proxy/hdrs/HdrTest.h                            |   22 +-
 proxy/hdrs/HdrToken.cc                          |  536 +-
 proxy/hdrs/HdrToken.h                           |  240 +-
 proxy/hdrs/HdrUtils.cc                          |   62 +-
 proxy/hdrs/HdrUtils.h                           |   27 +-
 proxy/hdrs/HttpCompat.cc                        |  158 +-
 proxy/hdrs/HttpCompat.h                         |   46 +-
 proxy/hdrs/MIME.cc                              |  526 +-
 proxy/hdrs/MIME.h                               |  511 +-
 proxy/hdrs/URL.cc                               |  383 +-
 proxy/hdrs/URL.h                                |   75 +-
 proxy/hdrs/load_http_hdr.cc                     |   49 +-
 proxy/hdrs/test_header.cc                       |  582 +--
 proxy/hdrs/test_urlhash.cc                      |   10 +-
 proxy/http/HttpBodyFactory.cc                   |  151 +-
 proxy/http/HttpBodyFactory.h                    |   91 +-
 proxy/http/HttpCacheSM.cc                       |   73 +-
 proxy/http/HttpCacheSM.h                        |   50 +-
 proxy/http/HttpClientSession.cc                 |   83 +-
 proxy/http/HttpClientSession.h                  |   69 +-
 proxy/http/HttpConfig.cc                        | 1315 ++---
 proxy/http/HttpConfig.h                         |  211 +-
 proxy/http/HttpConnectionCount.h                |   41 +-
 proxy/http/HttpDebugNames.cc                    |   67 +-
 proxy/http/HttpDebugNames.h                     |    2 +-
 proxy/http/HttpPages.cc                         |   37 +-
 proxy/http/HttpPages.h                          |   20 +-
 proxy/http/HttpProxyAPIEnums.h                  |    2 +-
 proxy/http/HttpProxyServerMain.cc               |   47 +-
 proxy/http/HttpProxyServerMain.h                |    2 +-
 proxy/http/HttpSM.cc                            | 2410 +++++----
 proxy/http/HttpSM.h                             |  204 +-
 proxy/http/HttpServerSession.cc                 |   18 +-
 proxy/http/HttpServerSession.h                  |   35 +-
 proxy/http/HttpSessionAccept.cc                 |   10 +-
 proxy/http/HttpSessionAccept.h                  |  264 +-
 proxy/http/HttpSessionManager.cc                |   77 +-
 proxy/http/HttpSessionManager.h                 |   80 +-
 proxy/http/HttpTransact.cc                      | 2034 ++++----
 proxy/http/HttpTransact.h                       |  812 ++-
 proxy/http/HttpTransactCache.cc                 |  218 +-
 proxy/http/HttpTransactCache.h                  |   84 +-
 proxy/http/HttpTransactHeaders.cc               |  108 +-
 proxy/http/HttpTransactHeaders.h                |   80 +-
 proxy/http/HttpTunnel.cc                        |  283 +-
 proxy/http/HttpTunnel.h                         |  195 +-
 proxy/http/HttpUpdateSM.cc                      |  131 +-
 proxy/http/HttpUpdateSM.h                       |   21 +-
 proxy/http/HttpUpdateTester.cc                  |   19 +-
 proxy/http/RegressionHttpTransact.cc            |   79 +-
 proxy/http/TestHttpTransact.cc                  |   38 +-
 proxy/http/TestUrl.cc                           |    5 +-
 proxy/http/remap/AclFiltering.cc                |   16 +-
 proxy/http/remap/AclFiltering.h                 |   26 +-
 proxy/http/remap/RemapConfig.cc                 |  302 +-
 proxy/http/remap/RemapConfig.h                  |   48 +-
 proxy/http/remap/RemapPluginInfo.cc             |    6 +-
 proxy/http/remap/RemapPluginInfo.h              |   19 +-
 proxy/http/remap/RemapPlugins.cc                |   39 +-
 proxy/http/remap/RemapPlugins.h                 |   50 +-
 proxy/http/remap/RemapProcessor.cc              |   37 +-
 proxy/http/remap/RemapProcessor.h               |   37 +-
 proxy/http/remap/UrlMapping.cc                  |   34 +-
 proxy/http/remap/UrlMapping.h                   |  101 +-
 proxy/http/remap/UrlMappingPathIndex.cc         |    6 +-
 proxy/http/remap/UrlMappingPathIndex.h          |   31 +-
 proxy/http/remap/UrlRewrite.cc                  |  175 +-
 proxy/http/remap/UrlRewrite.h                   |  116 +-
 proxy/http/test_socket_close.cc                 |   83 +-
 proxy/http/testheaders.cc                       |   77 +-
 proxy/http2/HPACK.cc                            |  283 +-
 proxy/http2/HPACK.h                             |  123 +-
 proxy/http2/HTTP2.cc                            |  463 +-
 proxy/http2/HTTP2.h                             |  167 +-
 proxy/http2/Http2ClientSession.cc               |   80 +-
 proxy/http2/Http2ClientSession.h                |  113 +-
 proxy/http2/Http2ConnectionState.cc             |  278 +-
 proxy/http2/Http2ConnectionState.h              |  130 +-
 proxy/http2/Http2SessionAccept.cc               |   15 +-
 proxy/http2/Http2SessionAccept.h                |   11 +-
 proxy/http2/HuffmanCodec.cc                     |  549 +-
 proxy/http2/HuffmanCodec.h                      |    2 +-
 proxy/logcat.cc                                 |   31 +-
 proxy/logging/Log.cc                            |  735 +--
 proxy/logging/Log.h                             |   63 +-
 proxy/logging/LogAccess.cc                      |   66 +-
 proxy/logging/LogAccess.h                       |  189 +-
 proxy/logging/LogAccessHttp.cc                  |  124 +-
 proxy/logging/LogAccessHttp.h                   |   88 +-
 proxy/logging/LogAccessICP.cc                   |   32 +-
 proxy/logging/LogAccessICP.h                    |   42 +-
 proxy/logging/LogAccessTest.cc                  |   12 +-
 proxy/logging/LogAccessTest.h                   |   47 +-
 proxy/logging/LogBuffer.cc                      |  152 +-
 proxy/logging/LogBuffer.h                       |  186 +-
 proxy/logging/LogBufferSink.h                   |    6 +-
 proxy/logging/LogCollationAccept.cc             |   16 +-
 proxy/logging/LogCollationAccept.h              |   11 +-
 proxy/logging/LogCollationBase.h                |    9 +-
 proxy/logging/LogCollationClientSM.cc           |  247 +-
 proxy/logging/LogCollationClientSM.h            |   29 +-
 proxy/logging/LogCollationHostSM.cc             |  102 +-
 proxy/logging/LogCollationHostSM.h              |   27 +-
 proxy/logging/LogConfig.cc                      |  593 +--
 proxy/logging/LogConfig.h                       |   68 +-
 proxy/logging/LogField.cc                       |  138 +-
 proxy/logging/LogField.h                        |   99 +-
 proxy/logging/LogFieldAliasMap.cc               |    7 +-
 proxy/logging/LogFieldAliasMap.h                |   92 +-
 proxy/logging/LogFile.cc                        |  188 +-
 proxy/logging/LogFile.h                         |  114 +-
 proxy/logging/LogFilter.cc                      |  298 +-
 proxy/logging/LogFilter.h                       |  259 +-
 proxy/logging/LogFormat.cc                      |  134 +-
 proxy/logging/LogFormat.h                       |  124 +-
 proxy/logging/LogHost.cc                        |  111 +-
 proxy/logging/LogHost.h                         |   81 +-
 proxy/logging/LogLimits.h                       |    9 +-
 proxy/logging/LogObject.cc                      |  353 +-
 proxy/logging/LogObject.h                       |  299 +-
 proxy/logging/LogPredefined.cc                  |   41 +-
 proxy/logging/LogPredefined.h                   |   34 +-
 proxy/logging/LogSock.cc                        |   98 +-
 proxy/logging/LogSock.h                         |   52 +-
 proxy/logging/LogStandalone.cc                  |   23 +-
 proxy/logging/LogUtils.cc                       |   83 +-
 proxy/logging/LogUtils.h                        |   51 +-
 proxy/logstats.cc                               |  391 +-
 proxy/sac.cc                                    |   16 +-
 proxy/shared/DiagsConfig.cc                     |  103 +-
 proxy/shared/DiagsConfig.h                      |   10 +-
 proxy/shared/Error.cc                           |    5 +-
 proxy/shared/Error.h                            |   78 +-
 proxy/shared/InkXml.cc                          |   31 +-
 proxy/shared/InkXml.h                           |   68 +-
 proxy/shared/UglyLogStubs.cc                    |   55 +-
 proxy/spdy/SpdyCallbacks.cc                     |  245 +-
 proxy/spdy/SpdyCallbacks.h                      |   77 +-
 proxy/spdy/SpdyClientSession.cc                 |   92 +-
 proxy/spdy/SpdyClientSession.h                  |   67 +-
 proxy/spdy/SpdyCommon.cc                        |   21 +-
 proxy/spdy/SpdyCommon.h                         |   50 +-
 proxy/spdy/SpdyDefs.h                           |   15 +-
 proxy/spdy/SpdySessionAccept.cc                 |    9 +-
 proxy/spdy/SpdySessionAccept.h                  |    7 +-
 proxy/test_xml_parser.cc                        |    8 +-
 tools/http_load/http_load.c                     |  389 +-
 tools/http_load/port.h                          |    6 +-
 tools/http_load/timers.c                        |   75 +-
 tools/http_load/timers.h                        |   15 +-
 tools/jtest/jtest.cc                            | 2760 ++++++-----
 tools/lighttpd_mod_generator/mod_generator.c    |   97 +-
 1080 files changed, 69351 insertions(+), 71634 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 6fde7aa..115b1cc 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -33,35 +33,34 @@
 #include <string>
 #include <map>
 
-#if defined(linux) || defined (solaris)
+#if defined(linux) || defined(solaris)
 #include "sys/utsname.h"
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
 
-union semun
-{
-  int val;                      /* value for SETVAL */
-  struct semid_ds *buf;         /* buffer for IPC_STAT, IPC_SET */
-  unsigned short int *array;    /* array for GETALL, SETALL */
-  struct seminfo *__buf;        /* buffer for IPC_INFO */
+union semun {
+  int val;                   /* value for SETVAL */
+  struct semid_ds *buf;      /* buffer for IPC_STAT, IPC_SET */
+  unsigned short int *array; /* array for GETALL, SETALL */
+  struct seminfo *__buf;     /* buffer for IPC_INFO */
 };
-#endif  // linux check
+#endif // linux check
 #include <grp.h>
 
 static const int MAX_LOGIN = ink_login_name_max();
 
-#define OPTIONS_MAX     32
+#define OPTIONS_MAX 32
 #define OPTIONS_LEN_MAX 1024
 
 #ifndef WAIT_ANY
-#define WAIT_ANY (pid_t) -1
+#define WAIT_ANY (pid_t) - 1
 #endif // !WAIT_ANY
 
-#define COP_FATAL    LOG_ALERT
-#define COP_WARNING  LOG_ERR
-#define COP_DEBUG    LOG_DEBUG
-#define COP_NOTICE   LOG_NOTICE
+#define COP_FATAL LOG_ALERT
+#define COP_WARNING LOG_ERR
+#define COP_DEBUG LOG_DEBUG
+#define COP_NOTICE LOG_NOTICE
 
 static const char *runtime_dir;
 static char config_file[PATH_NAME_MAX];
@@ -83,7 +82,7 @@ static int debug_flag = false;
 static int stdout_flag = false;
 static int stop_flag = false;
 
-static char* admin_user;
+static char *admin_user;
 static uid_t admin_uid;
 static gid_t admin_gid;
 static bool admin_user_p = false;
@@ -107,18 +106,18 @@ static int manager_failures = 0;
 static int server_failures = 0;
 static int server_not_found = 0;
 
-static const int sleep_time = 10;       // 10 sec
-static const int manager_timeout = 3 * 60;      //  3 min
-static const int server_timeout = 3 * 60;       //  3 min
+static const int sleep_time = 10;          // 10 sec
+static const int manager_timeout = 3 * 60; //  3 min
+static const int server_timeout = 3 * 60;  //  3 min
 
 // traffic_manager flap detection
 #define MANAGER_FLAP_DETECTION 1
 #if defined(MANAGER_FLAP_DETECTION)
-#define MANAGER_MAX_FLAP_COUNT 3        // if flap this many times, give up for a while
-#define MANAGER_FLAP_INTERVAL_MSEC 60000        // if x number of flaps happen in this interval, declare flapping
-#define MANAGER_FLAP_RETRY_MSEC 60000   // if flapping, don't try to restart until after this retry duration
-static bool manager_flapping = false;   // is the manager flapping?
-static int manager_flap_count = 0;      // how many times has the manager flapped?
+#define MANAGER_MAX_FLAP_COUNT 3                        // if flap this many times, give up for a while
+#define MANAGER_FLAP_INTERVAL_MSEC 60000                // if x number of flaps happen in this interval, declare flapping
+#define MANAGER_FLAP_RETRY_MSEC 60000                   // if flapping, don't try to restart until after this retry duration
+static bool manager_flapping = false;                   // is the manager flapping?
+static int manager_flap_count = 0;                      // how many times has the manager flapped?
 static ink_hrtime manager_flap_interval_start_time = 0; // first time we attempted to start the manager in past little while)
 static ink_hrtime manager_flap_retry_start_time = 0;    // first time we attempted to start the manager in past little while)
 #endif
@@ -140,35 +139,39 @@ static void cop_log(int priority, const char *format, ...) TS_PRINTFLIKE(2, 3);
 
 static void get_admin_user(void);
 
-struct ConfigValue
-{
-  ConfigValue()
-    : config_type(RECT_NULL), data_type(RECD_NULL) {
-  }
+struct ConfigValue {
+  ConfigValue() : config_type(RECT_NULL), data_type(RECD_NULL) {}
 
-  ConfigValue(RecT _t, RecDataT _d, const std::string& _v)
-    : config_type(_t), data_type(_d), data_value(_v) {
-  }
+  ConfigValue(RecT _t, RecDataT _d, const std::string &_v) : config_type(_t), data_type(_d), data_value(_v) {}
 
-  RecT        config_type;
-  RecDataT    data_type;
+  RecT config_type;
+  RecDataT data_type;
   std::string data_value;
 };
 
 typedef std::map<std::string, ConfigValue> ConfigValueTable;
 static ConfigValueTable configTable;
 
-#define cop_log_trace(...) do { if (debug_flag) cop_log(COP_DEBUG, __VA_ARGS__); } while (0)
+#define cop_log_trace(...)             \
+  do {                                 \
+    if (debug_flag)                    \
+      cop_log(COP_DEBUG, __VA_ARGS__); \
+  } while (0)
 
 static const char *
 priority_name(int priority)
 {
   switch (priority) {
-    case COP_DEBUG:   return "DEBUG";
-    case COP_WARNING: return "WARNING";
-    case COP_FATAL:   return "FATAL";
-    case COP_NOTICE:  return "NOTICE";
-    default:          return "unknown";
+  case COP_DEBUG:
+    return "DEBUG";
+  case COP_WARNING:
+    return "WARNING";
+  case COP_FATAL:
+    return "FATAL";
+  case COP_NOTICE:
+    return "NOTICE";
+  default:
+    return "unknown";
   }
 }
 
@@ -200,11 +203,12 @@ cop_log(int priority, const char *format, ...)
 
 
 void
-chown_file_to_admin_user(const char *file) {
+chown_file_to_admin_user(const char *file)
+{
   if (admin_user_p) {
     if (chown(file, admin_uid, admin_gid) < 0 && errno != ENOENT) {
-      cop_log(COP_FATAL, "cop couldn't chown the file: '%s' for '%s' (%d/%d) : [%d] %s\n",
-              file, admin_user, admin_uid, admin_gid, errno, strerror(errno));
+      cop_log(COP_FATAL, "cop couldn't chown the file: '%s' for '%s' (%d/%d) : [%d] %s\n", file, admin_user, admin_uid, admin_gid,
+              errno, strerror(errno));
     }
   }
 }
@@ -240,7 +244,7 @@ sig_term(int signum)
   pid_t pid = 0;
   int status = 0;
 
-  //killsig = SIGTERM;
+  // killsig = SIGTERM;
 
   cop_log_trace("Entering sig_term(%d)\n", signum);
 
@@ -271,7 +275,7 @@ sig_term(int signum)
 
 static void
 #if defined(solaris)
-sig_fatal(int signum, siginfo_t * t, void *c)
+sig_fatal(int signum, siginfo_t *t, void *c)
 #else
 sig_fatal(int signum)
 #endif
@@ -281,9 +285,12 @@ sig_fatal(int signum)
   if (t) {
     if (t->si_code <= 0) {
       cop_log(COP_FATAL, "cop received fatal user signal [%d] from"
-              " pid [%d] uid [%d]\n", signum, (int)(t->si_pid), t->si_uid);
+                         " pid [%d] uid [%d]\n",
+              signum, (int)(t->si_pid), t->si_uid);
     } else {
-      cop_log(COP_FATAL, "cop received fatal kernel signal [%d], " "reason [%d]\n", signum, t->si_code);
+      cop_log(COP_FATAL, "cop received fatal kernel signal [%d], "
+                         "reason [%d]\n",
+              signum, t->si_code);
     }
   } else {
 #endif
@@ -298,13 +305,15 @@ sig_fatal(int signum)
 
 static void
 #if defined(solaris)
-sig_alarm_warn(int signum, siginfo_t * t, void *c)
+sig_alarm_warn(int signum, siginfo_t *t, void *c)
 #else
 sig_alarm_warn(int signum)
 #endif
 {
   cop_log_trace("Entering sig_alarm_warn(%d)\n", signum);
-  cop_log(COP_WARNING, "unable to kill traffic_server for the last" " %d seconds\n", kill_timeout);
+  cop_log(COP_WARNING, "unable to kill traffic_server for the last"
+                       " %d seconds\n",
+          kill_timeout);
 
   // Set us up for another alarm
   alarm(kill_timeout);
@@ -359,7 +368,6 @@ set_alarm_warn()
 
   sigaction(SIGALRM, &action, NULL);
   cop_log_trace("Leaving set_alarm_warn()\n");
-
 }
 
 static void
@@ -419,7 +427,7 @@ milliseconds(void)
   // Make liberal use of casting to ink_hrtime to ensure the
   //  compiler does not truncate our result
   cop_log_trace("Leaving milliseconds()\n");
-  return ((ink_hrtime) curTime.tv_sec * 1000) + ((ink_hrtime) curTime.tv_usec / 1000);
+  return ((ink_hrtime)curTime.tv_sec * 1000) + ((ink_hrtime)curTime.tv_usec / 1000);
 }
 
 static void
@@ -467,16 +475,16 @@ transient_error(int error, int wait_ms)
 }
 
 static void
-config_register_variable(RecT rec_type, RecDataT data_type, const char * name, const char * value, bool /* inc_version */)
+config_register_variable(RecT rec_type, RecDataT data_type, const char *name, const char *value, bool /* inc_version */)
 {
   configTable[std::string(name)] = ConfigValue(rec_type, data_type, value);
 }
 
 static void
-config_register_default(const RecordElement * record, void *)
+config_register_default(const RecordElement *record, void *)
 {
   if (record->type == RECT_CONFIG || record->type == RECT_LOCAL) {
-    const char * value = record->value ? record->value : ""; // splooch NULL values so std::string can swallow them
+    const char *value = record->value ? record->value : ""; // splooch NULL values so std::string can swallow them
     configTable[std::string(record->name)] = ConfigValue(record->type, record->value_type, value);
   }
 }
@@ -606,7 +614,7 @@ config_reload_records()
     exit(1);
   }
 
-  if (stat_buf.st_mtime <= last_mod) {  // no change, no need to re-read
+  if (stat_buf.st_mtime <= last_mod) { // no change, no need to re-read
     return;
   } else {
     last_mod = stat_buf.st_mtime;
@@ -843,7 +851,6 @@ poll_write(int fd, int timeout)
 static int
 open_socket(int port, const char *ip = NULL, char const *ip_to_bind = NULL)
 {
-
   int sock = 0;
   struct addrinfo hints;
   struct addrinfo *result = NULL;
@@ -871,7 +878,7 @@ open_socket(int port, const char *ip = NULL, char const *ip_to_bind = NULL)
 
   err = getaddrinfo(ip, port_str, &hints, &result);
   if (err != 0) {
-    cop_log (COP_WARNING, "(test) unable to get address info [%d %s] at ip %s, port %s\n", err, gai_strerror(err), ip, port_str);
+    cop_log(COP_WARNING, "(test) unable to get address info [%d %s] at ip %s, port %s\n", err, gai_strerror(err), ip, port_str);
     goto getaddrinfo_error;
   }
 
@@ -892,7 +899,7 @@ open_socket(int port, const char *ip = NULL, char const *ip_to_bind = NULL)
 
     err = getaddrinfo(ip_to_bind, NULL, &hints, &result_to_bind);
     if (err != 0) {
-      cop_log (COP_WARNING, "(test) unable to get address info [%d %s] at ip %s\n", err, gai_strerror(err), ip_to_bind);
+      cop_log(COP_WARNING, "(test) unable to get address info [%d %s] at ip %s\n", err, gai_strerror(err), ip_to_bind);
       freeaddrinfo(result_to_bind);
       goto error;
     }
@@ -910,13 +917,13 @@ open_socket(int port, const char *ip = NULL, char const *ip_to_bind = NULL)
       // also set REUSEADDR so that previous cop connections in the TIME_WAIT state
       // do not interfere
       if (safe_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, SOCKOPT_ON, sizeof(int)) < 0) {
-        cop_log (COP_WARNING, "(test) unable to set REUSEADDR socket option [%d '%s']\n", errno, strerror (errno));
+        cop_log(COP_WARNING, "(test) unable to set REUSEADDR socket option [%d '%s']\n", errno, strerror(errno));
       }
     }
 #endif
 
     if (safe_bind(sock, result_to_bind->ai_addr, result_to_bind->ai_addrlen) < 0) {
-      cop_log (COP_WARNING, "(test) unable to bind socket [%d '%s']\n", errno, strerror (errno));
+      cop_log(COP_WARNING, "(test) unable to bind socket [%d '%s']\n", errno, strerror(errno));
     }
 
     freeaddrinfo(result_to_bind);
@@ -956,8 +963,8 @@ getaddrinfo_error:
 }
 
 static int
-test_port(int port, const char *request, char *buffer, int bufsize,
-          int64_t test_timeout, char const *ip = NULL, char const *ip_to_bind = NULL)
+test_port(int port, const char *request, char *buffer, int bufsize, int64_t test_timeout, char const *ip = NULL,
+          char const *ip_to_bind = NULL)
 {
   int64_t start_time, timeout;
   int sock;
@@ -1193,7 +1200,7 @@ test_mgmt_cli_port()
   TSString val = NULL;
   int ret = 0;
 
-  if (TSRecordGetString("proxy.config.manager_binary", &val) !=  TS_ERR_OKAY) {
+  if (TSRecordGetString("proxy.config.manager_binary", &val) != TS_ERR_OKAY) {
     cop_log(COP_WARNING, "(cli test) unable to retrieve manager_binary\n");
     ret = -1;
   } else {
@@ -1238,7 +1245,7 @@ test_http_port(int port, char *request, int timeout, char const *ip = NULL, char
   }
 
   if (strncmp(p, "200", 3) != 0) {
-    char pstatus[4] = { 0 };
+    char pstatus[4] = {0};
     ink_strlcpy(pstatus, p, sizeof(pstatus));
     cop_log(COP_WARNING, "(http test) received non-200 status(%s)\n", pstatus);
     return -1;
@@ -1439,9 +1446,7 @@ check_programs()
     // Spawn the manager (check for flapping manager too)
     ink_hrtime now = milliseconds();
     if (!manager_flapping) {
-      if ((manager_flap_interval_start_time == 0) ||
-          (now - manager_flap_interval_start_time > MANAGER_FLAP_INTERVAL_MSEC)
-        ) {
+      if ((manager_flap_interval_start_time == 0) || (now - manager_flap_interval_start_time > MANAGER_FLAP_INTERVAL_MSEC)) {
         // either:
         // . it's our first time through
         // . we were flapping a while ago, but we would
@@ -1452,8 +1457,7 @@ check_programs()
       }
       if (manager_flap_count >= MANAGER_MAX_FLAP_COUNT) {
         // we've flapped too many times, hold off for a while
-        cop_log(COP_WARNING, "unable to start traffic_manager, retrying in %d second(s)\n",
-                MANAGER_FLAP_RETRY_MSEC / 1000);
+        cop_log(COP_WARNING, "unable to start traffic_manager, retrying in %d second(s)\n", MANAGER_FLAP_RETRY_MSEC / 1000);
         manager_flapping = true;
         manager_flap_retry_start_time = now;
       } else {
@@ -1549,9 +1553,8 @@ check_memory()
       // 3:    >0      low     low     (bad; covered by 1)
       // 4:     0       0      high    (okay)
       // 5:     0       0      low     (bad)
-      if ((swapsize != 0 && swapfree < check_memory_min_swapfree_kb) ||
-          (swapsize == 0 && memfree < check_memory_min_memfree_kb)) {
-        cop_log(COP_WARNING, "Low memory available (swap: %dkB, mem: %dkB)\n", (int) swapfree, (int) memfree);
+      if ((swapsize != 0 && swapfree < check_memory_min_swapfree_kb) || (swapsize == 0 && memfree < check_memory_min_memfree_kb)) {
+        cop_log(COP_WARNING, "Low memory available (swap: %dkB, mem: %dkB)\n", (int)swapfree, (int)memfree);
         cop_log(COP_WARNING, "Killing '%s' and '%s'\n", manager_binary, server_binary);
         manager_failures = 0;
         safe_kill(manager_lockfile, manager_binary, true);
@@ -1594,7 +1597,7 @@ check_no_run()
 // to taking a void* and returning a void*. The change was made
 // so that we can call ink_thread_create() on this function
 // in the case of running cop as a win32 service.
-static void*
+static void *
 check(void *arg)
 {
   bool mgmt_init = false;
@@ -1615,8 +1618,7 @@ check(void *arg)
     if (child_pid > 0) {
       if (WIFEXITED(child_status) == 0) {
         // Child terminated abnormally
-        cop_log(COP_WARNING,
-                "cop received non-normal child status signal [%d %d]\n", child_pid, WEXITSTATUS(child_status));
+        cop_log(COP_WARNING, "cop received non-normal child status signal [%d %d]\n", child_pid, WEXITSTATUS(child_status));
       } else {
         // normal termination
         cop_log(COP_WARNING, "cop received child status signal [%d %d]\n", child_pid, child_status);
@@ -1704,10 +1706,10 @@ init_signals()
 
   sigaction(SIGCHLD, &action, NULL);
 
-  // Handle a bunch of fatal signals. We simply call abort() when
-  // these signals arrive in order to generate a core. There is some
-  // difficulty with generating core files when linking with libthread
-  // under solaris.
+// Handle a bunch of fatal signals. We simply call abort() when
+// these signals arrive in order to generate a core. There is some
+// difficulty with generating core files when linking with libthread
+// under solaris.
 #if defined(solaris)
   action.sa_handler = NULL;
   action.sa_sigaction = sig_fatal;
@@ -1748,7 +1750,6 @@ init_signals()
 static void
 init_lockfiles()
 {
-
   cop_log_trace("Entering init_lockfiles()\n");
   Layout::relative_to(cop_lockfile, sizeof(cop_lockfile), runtime_dir, COP_LOCK);
   Layout::relative_to(manager_lockfile, sizeof(manager_lockfile), runtime_dir, MANAGER_LOCK);
@@ -1782,8 +1783,8 @@ init_config_file()
   if (stat(config_file, &info) < 0) {
     Layout::relative_to(config_file, sizeof(config_file), config_dir, "records.config");
     if (stat(config_file, &info) < 0) {
-      cop_log(COP_FATAL, "unable to locate \"%s/records.config\" or \"%s/records.config.shadow\"\n",
-          (const char *)config_dir, (const char *)config_dir);
+      cop_log(COP_FATAL, "unable to locate \"%s/records.config\" or \"%s/records.config.shadow\"\n", (const char *)config_dir,
+              (const char *)config_dir);
       exit(1);
     }
   }
@@ -1809,7 +1810,7 @@ init()
 
   runtime_dir = config_read_runtime_dir();
   if (stat(runtime_dir, &info) < 0) {
-    cop_log(COP_FATAL, "unable to locate local state directory '%s'\n",runtime_dir);
+    cop_log(COP_FATAL, "unable to locate local state directory '%s'\n", runtime_dir);
     cop_log(COP_FATAL, " please try setting correct root path in either env variable TS_ROOT \n");
     exit(1);
   }
@@ -1821,18 +1822,17 @@ init()
 }
 
 static const ArgumentDescription argument_descriptions[] = {
-  { "debug", 'd', "Enable debug logging", "F", &debug_flag, NULL, NULL },
-  { "stdout", 'o', "Print log messages to standard output", "F", &stdout_flag, NULL, NULL },
-  { "stop", 's', "Send child processes SIGSTOP instead of SIGKILL", "F", &stop_flag, NULL, NULL },
+  {"debug", 'd', "Enable debug logging", "F", &debug_flag, NULL, NULL},
+  {"stdout", 'o', "Print log messages to standard output", "F", &stdout_flag, NULL, NULL},
+  {"stop", 's', "Send child processes SIGSTOP instead of SIGKILL", "F", &stop_flag, NULL, NULL},
   HELP_ARGUMENT_DESCRIPTION(),
-  VERSION_ARGUMENT_DESCRIPTION()
-};
+  VERSION_ARGUMENT_DESCRIPTION()};
 
 int
 main(int /* argc */, const char *argv[])
 {
   int fd;
-  appVersionInfo.setup(PACKAGE_NAME,"traffic_cop", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
+  appVersionInfo.setup(PACKAGE_NAME, "traffic_cop", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
 
   // Before accessing file system initialize Layout engine
   Layout::create();
@@ -1862,13 +1862,13 @@ main(int /* argc */, const char *argv[])
     int res;
     res = getpwuid_r(uid, &passwdInfo, buf, bufSize, &ppasswd);
     if (!res && ppasswd) {
-        initgroups(ppasswd->pw_name,gid);
+      initgroups(ppasswd->pw_name, gid);
     }
   }
 
-  setsid();                     // Important, thanks Vlad. :)
+  setsid(); // Important, thanks Vlad. :)
 #if (defined(freebsd) && !defined(kfreebsd)) || defined(openbsd)
-  setpgrp(0,0);
+  setpgrp(0, 0);
 #else
   setpgrp();
 #endif
@@ -1901,4 +1901,3 @@ main(int /* argc */, const char *argv[])
 
   return 0;
 }
-


[28/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/test_I_HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/test_I_HostDB.cc b/iocore/hostdb/test_I_HostDB.cc
index fced5aa..671924d 100644
--- a/iocore/hostdb/test_I_HostDB.cc
+++ b/iocore/hostdb/test_I_HostDB.cc
@@ -55,7 +55,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -78,19 +77,17 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -113,19 +110,17 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', " "will not log to this file",
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
                  diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
-class HostDBTest:Continuation
+class HostDBTest : Continuation
 {
-
-
 };
 
 main()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/hostdb/test_P_HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/test_P_HostDB.cc b/iocore/hostdb/test_P_HostDB.cc
index b4ef752..2e34176 100644
--- a/iocore/hostdb/test_P_HostDB.cc
+++ b/iocore/hostdb/test_P_HostDB.cc
@@ -24,14 +24,13 @@
 #include "P_HostDB.h"
 
 Diags *diags;
-struct NetTesterSM:public Continuation
-{
+struct NetTesterSM : public Continuation {
   VIO *read_vio;
   IOBufferReader *reader;
   NetVConnection *vc;
   MIOBuffer *buf;
 
-    NetTesterSM(ProxyMutex * _mutex, NetVConnection * _vc):Continuation(_mutex)
+  NetTesterSM(ProxyMutex *_mutex, NetVConnection *_vc) : Continuation(_mutex)
   {
     MUTEX_TRY_LOCK(lock, mutex, _vc->thread);
     ink_release_assert(lock);
@@ -43,7 +42,8 @@ struct NetTesterSM:public Continuation
   }
 
 
-  int handle_read(int event, void *data)
+  int
+  handle_read(int event, void *data)
   {
     int r;
     char *str;
@@ -56,7 +56,7 @@ struct NetTesterSM:public Continuation
       fflush(stdout);
       break;
     case VC_EVENT_READ_COMPLETE:
-      /* FALLSTHROUGH */
+    /* FALLSTHROUGH */
     case VC_EVENT_EOS:
       r = reader->read_avail();
       str = new char[r + 10];
@@ -70,12 +70,9 @@ struct NetTesterSM:public Continuation
       break;
     default:
       ink_release_assert(!"unknown event");
-
     }
     return EVENT_CONT;
   }
-
-
 };
 
 main()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/Connection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Connection.cc b/iocore/net/Connection.cc
index deff04d..6360db3 100644
--- a/iocore/net/Connection.cc
+++ b/iocore/net/Connection.cc
@@ -36,10 +36,10 @@
 // set in the OS
 // #define RECV_BUF_SIZE            (1024*64)
 // #define SEND_BUF_SIZE            (1024*64)
-#define FIRST_RANDOM_PORT        16000
-#define LAST_RANDOM_PORT         32000
+#define FIRST_RANDOM_PORT 16000
+#define LAST_RANDOM_PORT 32000
 
-#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
+#define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y))
 
 #ifndef FD_CLOEXEC
 #define FD_CLOEXEC 1
@@ -58,19 +58,13 @@ get_listen_backlog(void)
 //
 // Functions
 //
-char const*
-NetVCOptions::toString(addr_bind_style s) {
-  return ANY_ADDR == s ? "any"
-    : INTF_ADDR == s ? "interface"
-    : "foreign"
-    ;
+char const *
+NetVCOptions::toString(addr_bind_style s)
+{
+  return ANY_ADDR == s ? "any" : INTF_ADDR == s ? "interface" : "foreign";
 }
 
-Connection::Connection()
-  : fd(NO_FD)
-  , is_bound(false)
-  , is_connected(false)
-  , sock_type(0)
+Connection::Connection() : fd(NO_FD), is_bound(false), is_connected(false), sock_type(0)
 {
   memset(&addr, 0, sizeof(addr));
 }
@@ -83,7 +77,7 @@ Connection::~Connection()
 
 
 int
-Server::accept(Connection * c)
+Server::accept(Connection *c)
 {
   int res = 0;
   socklen_t sz = sizeof(c->addr);
@@ -94,10 +88,8 @@ Server::accept(Connection * c)
   c->fd = res;
   if (is_debug_tag_set("iocore_net_server")) {
     ip_port_text_buffer ipb1, ipb2;
-      Debug("iocore_net_server", "Connection accepted [Server]. %s -> %s\n"
-        , ats_ip_nptop(&c->addr, ipb2, sizeof(ipb2))
-        , ats_ip_nptop(&addr, ipb1, sizeof(ipb1))
-      );
+    Debug("iocore_net_server", "Connection accepted [Server]. %s -> %s\n", ats_ip_nptop(&c->addr, ipb2, sizeof(ipb2)),
+          ats_ip_nptop(&addr, ipb1, sizeof(ipb1)));
   }
 
 #ifdef SET_CLOSE_ON_EXEC
@@ -150,11 +142,7 @@ add_http_filter(int fd ATS_UNUSED)
 }
 
 int
-Server::setup_fd_for_listen(
-  bool non_blocking,
-  int recv_bufsize,
-  int send_bufsize,
-  bool transparent)
+Server::setup_fd_for_listen(bool non_blocking, int recv_bufsize, int send_bufsize, bool transparent)
 {
   int res = 0;
 
@@ -167,7 +155,7 @@ Server::setup_fd_for_listen(
 #ifdef SEND_BUF_SIZE
   {
     int send_buf_size = SEND_BUF_SIZE;
-    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &send_buf_size, sizeof(int)) < 0)) {
+    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&send_buf_size, sizeof(int)) < 0)) {
       goto Lerror;
     }
   }
@@ -176,7 +164,7 @@ Server::setup_fd_for_listen(
 #ifdef RECV_BUF_SIZE
   {
     int recv_buf_size = RECV_BUF_SIZE;
-    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &recv_buf_size, sizeof(int))) < 0) {
+    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&recv_buf_size, sizeof(int))) < 0) {
       goto Lerror;
     }
   }
@@ -221,7 +209,7 @@ Server::setup_fd_for_listen(
     struct linger l;
     l.l_onoff = 0;
     l.l_linger = 0;
-    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &l, sizeof(l))) < 0) {
+    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, sizeof(l))) < 0) {
       goto Lerror;
     }
   }
@@ -262,7 +250,7 @@ Server::setup_fd_for_listen(
 
 #if defined(TCP_MAXSEG)
   if (NetProcessor::accept_mss > 0) {
-    if ((res = safe_setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, (char *) &NetProcessor::accept_mss, sizeof(int))) < 0) {
+    if ((res = safe_setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, (char *)&NetProcessor::accept_mss, sizeof(int))) < 0) {
       goto Lerror;
     }
   }
@@ -323,7 +311,7 @@ Server::listen(bool non_blocking, int recv_bufsize, int send_bufsize, bool trans
   // Original just did this on port == 0.
   namelen = sizeof(addr);
   if ((res = safe_getsockname(fd, &addr.sa, &namelen))) {
-      goto Lerror;
+    goto Lerror;
   }
 
   return 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_Net.h b/iocore/net/I_Net.h
index 333f24b..cabe8e1 100644
--- a/iocore/net/I_Net.h
+++ b/iocore/net/I_Net.h
@@ -47,32 +47,30 @@
 
 #define NET_SYSTEM_MODULE_MAJOR_VERSION 1
 #define NET_SYSTEM_MODULE_MINOR_VERSION 0
-#define NET_SYSTEM_MODULE_VERSION makeModuleVersion(                 \
-                                    NET_SYSTEM_MODULE_MAJOR_VERSION, \
-                                    NET_SYSTEM_MODULE_MINOR_VERSION, \
-                                    PUBLIC_MODULE_HEADER)
+#define NET_SYSTEM_MODULE_VERSION \
+  makeModuleVersion(NET_SYSTEM_MODULE_MAJOR_VERSION, NET_SYSTEM_MODULE_MINOR_VERSION, PUBLIC_MODULE_HEADER)
 
 static int const NO_FD = -1;
 
 extern int net_config_poll_timeout;
 
-#define NET_EVENT_OPEN                    (NET_EVENT_EVENTS_START)
-#define NET_EVENT_OPEN_FAILED             (NET_EVENT_EVENTS_START+1)
-#define NET_EVENT_ACCEPT                  (NET_EVENT_EVENTS_START+2)
-#define NET_EVENT_ACCEPT_SUCCEED          (NET_EVENT_EVENTS_START+3)
-#define NET_EVENT_ACCEPT_FAILED           (NET_EVENT_EVENTS_START+4)
-#define NET_EVENT_CANCEL                  (NET_EVENT_EVENTS_START+5)
-#define NET_EVENT_DATAGRAM_READ_COMPLETE  (NET_EVENT_EVENTS_START+6)
-#define NET_EVENT_DATAGRAM_READ_ERROR     (NET_EVENT_EVENTS_START+7)
-#define NET_EVENT_DATAGRAM_WRITE_COMPLETE (NET_EVENT_EVENTS_START+8)
-#define NET_EVENT_DATAGRAM_WRITE_ERROR    (NET_EVENT_EVENTS_START+9)
-#define NET_EVENT_DATAGRAM_READ_READY     (NET_EVENT_EVENTS_START+10)
-#define NET_EVENT_DATAGRAM_OPEN           (NET_EVENT_EVENTS_START+11)
-#define NET_EVENT_DATAGRAM_ERROR          (NET_EVENT_EVENTS_START+12)
-#define NET_EVENT_ACCEPT_INTERNAL         (NET_EVENT_EVENTS_START+22)
-#define NET_EVENT_CONNECT_INTERNAL        (NET_EVENT_EVENTS_START+23)
-
-#define MAIN_ACCEPT_PORT                  -1
+#define NET_EVENT_OPEN (NET_EVENT_EVENTS_START)
+#define NET_EVENT_OPEN_FAILED (NET_EVENT_EVENTS_START + 1)
+#define NET_EVENT_ACCEPT (NET_EVENT_EVENTS_START + 2)
+#define NET_EVENT_ACCEPT_SUCCEED (NET_EVENT_EVENTS_START + 3)
+#define NET_EVENT_ACCEPT_FAILED (NET_EVENT_EVENTS_START + 4)
+#define NET_EVENT_CANCEL (NET_EVENT_EVENTS_START + 5)
+#define NET_EVENT_DATAGRAM_READ_COMPLETE (NET_EVENT_EVENTS_START + 6)
+#define NET_EVENT_DATAGRAM_READ_ERROR (NET_EVENT_EVENTS_START + 7)
+#define NET_EVENT_DATAGRAM_WRITE_COMPLETE (NET_EVENT_EVENTS_START + 8)
+#define NET_EVENT_DATAGRAM_WRITE_ERROR (NET_EVENT_EVENTS_START + 9)
+#define NET_EVENT_DATAGRAM_READ_READY (NET_EVENT_EVENTS_START + 10)
+#define NET_EVENT_DATAGRAM_OPEN (NET_EVENT_EVENTS_START + 11)
+#define NET_EVENT_DATAGRAM_ERROR (NET_EVENT_EVENTS_START + 12)
+#define NET_EVENT_ACCEPT_INTERNAL (NET_EVENT_EVENTS_START + 22)
+#define NET_EVENT_CONNECT_INTERNAL (NET_EVENT_EVENTS_START + 23)
+
+#define MAIN_ACCEPT_PORT -1
 
 /*
  * Net system uses event threads

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_NetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index 2cfa2ae..92de427 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -38,7 +38,7 @@ struct NetVCOptions;
   state machine.
 
 */
-class NetProcessor:public Processor
+class NetProcessor : public Processor
 {
 public:
   /** Options for @c accept.
@@ -61,8 +61,8 @@ public:
     /// Event type to generate on accept.
     EventType etype;
     /** If @c true, the continuation is called back with
-	@c NET_EVENT_ACCEPT_SUCCEED
-	or @c NET_EVENT_ACCEPT_FAILED on success and failure resp.
+        @c NET_EVENT_ACCEPT_SUCCEED
+        or @c NET_EVENT_ACCEPT_FAILED on success and failure resp.
     */
     bool f_callback_on_open;
     /** Accept only on the loopback address.
@@ -87,11 +87,11 @@ public:
     uint32_t packet_tos;
 
     /** Transparency on client (user agent) connection.
-	@internal This is irrelevant at a socket level (since inbound
-	transparency must be set up when the listen socket is created)
-	but it's critical that the connection handling logic knows
-	whether the inbound (client / user agent) connection is
-	transparent.
+        @internal This is irrelevant at a socket level (since inbound
+        transparency must be set up when the listen socket is created)
+        but it's critical that the connection handling logic knows
+        whether the inbound (client / user agent) connection is
+        transparent.
     */
     bool f_inbound_transparent;
 
@@ -99,7 +99,7 @@ public:
     /// Instance is constructed with default values.
     AcceptOptions() { this->reset(); }
     /// Reset all values to defaults.
-    self& reset();
+    self &reset();
   };
 
   /**
@@ -123,10 +123,7 @@ public:
     @return Action, that can be cancelled to cancel the accept. The
       port becomes free immediately.
    */
-  inkcoreapi virtual Action * accept(
-    Continuation * cont,
-    AcceptOptions const& opt = DEFAULT_ACCEPT_OPTIONS
-  );
+  inkcoreapi virtual Action *accept(Continuation *cont, AcceptOptions const &opt = DEFAULT_ACCEPT_OPTIONS);
 
   /**
     Accepts incoming connections on port. Accept connections on port.
@@ -152,11 +149,7 @@ public:
       port becomes free immediately.
 
   */
-  virtual Action *main_accept(
-    Continuation * cont,
-    SOCKET listen_socket_in,
-    AcceptOptions const& opt = DEFAULT_ACCEPT_OPTIONS
-  );
+  virtual Action *main_accept(Continuation *cont, SOCKET listen_socket_in, AcceptOptions const &opt = DEFAULT_ACCEPT_OPTIONS);
 
   /**
     Open a NetVConnection for connection oriented I/O. Connects
@@ -179,11 +172,7 @@ public:
 
   */
 
-  inkcoreapi Action *connect_re(
-    Continuation * cont,
-    sockaddr const* addr,
-    NetVCOptions * options = NULL
-  );
+  inkcoreapi Action *connect_re(Continuation *cont, sockaddr const *addr, NetVCOptions *options = NULL);
 
   /**
     Open a NetVConnection for connection oriented I/O. This call
@@ -204,12 +193,7 @@ public:
     @see connect_re()
 
   */
-  Action *connect_s(
-    Continuation * cont,
-    sockaddr const* addr,
-    int timeout = NET_CONNECT_TIMEOUT,
-    NetVCOptions * opts = NULL
-  );
+  Action *connect_s(Continuation *cont, sockaddr const *addr, int timeout = NET_CONNECT_TIMEOUT, NetVCOptions *opts = NULL);
 
   /**
     Starts the Netprocessor. This has to be called before doing any
@@ -224,13 +208,10 @@ public:
   inkcoreapi virtual NetVConnection *allocate_vc(EThread *) = 0;
 
   /** Private constructor. */
-  NetProcessor()
-  {
-  };
+  NetProcessor(){};
 
   /** Private destructor. */
-  virtual ~ NetProcessor() {
-  };
+  virtual ~NetProcessor(){};
 
   /** This is MSS for connections we accept (client connections). */
   static int accept_mss;
@@ -255,17 +236,16 @@ public:
   static AcceptOptions const DEFAULT_ACCEPT_OPTIONS;
 
 private:
-
   /** @note Not implemented. */
-  virtual int stop()
+  virtual int
+  stop()
   {
     ink_release_assert(!"NetProcessor::stop not implemented");
     return 1;
   }
 
   NetProcessor(const NetProcessor &);
-  NetProcessor & operator =(const NetProcessor &);
-
+  NetProcessor &operator=(const NetProcessor &);
 };
 
 
@@ -280,7 +260,7 @@ private:
   @endcode
 
 */
-extern inkcoreapi NetProcessor& netProcessor;
+extern inkcoreapi NetProcessor &netProcessor;
 
 /**
   Global netProcessor singleton object for making ssl enabled net
@@ -289,6 +269,6 @@ extern inkcoreapi NetProcessor& netProcessor;
   over ssl.
 
 */
-extern inkcoreapi NetProcessor& sslNetProcessor;
+extern inkcoreapi NetProcessor &sslNetProcessor;
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_NetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetVConnection.h b/iocore/net/I_NetVConnection.h
index a8b4971..5509a35 100644
--- a/iocore/net/I_NetVConnection.h
+++ b/iocore/net/I_NetVConnection.h
@@ -33,8 +33,8 @@
 #include "I_Socks.h"
 #include <ts/apidefs.h>
 
-#define CONNECT_SUCCESS   1
-#define CONNECT_FAILURE   0
+#define CONNECT_SUCCESS 1
+#define CONNECT_FAILURE 0
 
 #define SSL_EVENT_SERVER 0
 #define SSL_EVENT_CLIENT 1
@@ -60,7 +60,7 @@ struct NetVCOptions {
   /// Values for valid IP protocols.
   enum ip_protocol_t {
     USE_TCP, ///< TCP protocol.
-    USE_UDP ///< UDP protocol.
+    USE_UDP  ///< UDP protocol.
   };
 
   /// IP (TCP or UDP) protocol to use on socket.
@@ -104,8 +104,8 @@ struct NetVCOptions {
       @see addr_binding
    */
   enum addr_bind_style {
-    ANY_ADDR, ///< Bind to any available local address (don't care, default).
-    INTF_ADDR, ///< Bind to interface address in @a local_addr.
+    ANY_ADDR,    ///< Bind to any available local address (don't care, default).
+    INTF_ADDR,   ///< Bind to interface address in @a local_addr.
     FOREIGN_ADDR ///< Bind to foreign address in @a local_addr.
   };
 
@@ -168,20 +168,19 @@ struct NetVCOptions {
   /// Reset all values to defaults.
   void reset();
 
-  void set_sock_param(int _recv_bufsize, int _send_bufsize, unsigned long _opt_flags,
-                      unsigned long _packet_mark = 0, unsigned long _packet_tos = 0);
+  void set_sock_param(int _recv_bufsize, int _send_bufsize, unsigned long _opt_flags, unsigned long _packet_mark = 0,
+                      unsigned long _packet_tos = 0);
 
-  NetVCOptions() {
-    reset();
-  }
+  NetVCOptions() { reset(); }
 
-  ~NetVCOptions() {
-  }
+  ~NetVCOptions() {}
 
   /** Set the SNI server name.
       A local copy is made of @a name.
   */
-  self& set_sni_servername(const char * name, size_t len) {
+  self &
+  set_sni_servername(const char *name, size_t len)
+  {
     IpEndpoint ip;
 
     // Literal IPv4 and IPv6 addresses are not permitted in "HostName".(rfc6066#section-3)
@@ -193,12 +192,13 @@ struct NetVCOptions {
     return *this;
   }
 
-  self& operator=(self const& that) {
+  self &operator=(self const &that)
+  {
     if (&that != this) {
       sni_servername = NULL; // release any current name.
       memcpy(this, &that, sizeof(self));
       if (that.sni_servername) {
-	sni_servername.release(); // otherwise we'll free the source string.
+        sni_servername.release(); // otherwise we'll free the source string.
         this->sni_servername = ats_strdup(that.sni_servername);
       }
     }
@@ -208,11 +208,11 @@ struct NetVCOptions {
   /// @name Debugging
   //@{
   /// Convert @a s to its string equivalent.
-  static char const* toString(addr_bind_style s);
+  static char const *toString(addr_bind_style s);
   //@}
 
 private:
-  NetVCOptions(const NetVCOptions&);
+  NetVCOptions(const NetVCOptions &);
 };
 
 /**
@@ -223,10 +223,9 @@ private:
   stream IO to be done based on a single read or write call.
 
 */
-class NetVConnection:public VConnection
+class NetVConnection : public VConnection
 {
 public:
-
   /**
      Initiates read. Thread safe, may be called when not handling
      an event from the NetVConnection, or the NetVConnection creation
@@ -251,7 +250,7 @@ public:
     @return vio
 
   */
-  virtual VIO * do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf) = 0;
+  virtual VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf) = 0;
 
   /**
     Initiates write. Thread-safe, may be called when not handling
@@ -287,7 +286,7 @@ public:
     @return vio pointer
 
   */
-  virtual VIO *do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool owner = false) = 0;
+  virtual VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner = false) = 0;
 
   /**
     Closes the vconnection. A state machine MUST call do_io_close()
@@ -339,7 +338,7 @@ public:
     @param len length of the message.
 
   */
-  virtual Action *send_OOB(Continuation * cont, char *buf, int len);
+  virtual Action *send_OOB(Continuation *cont, char *buf, int len);
 
   /**
     Cancels a scheduled send_OOB. Part of the message could have
@@ -452,7 +451,7 @@ public:
   virtual void trapWriteBufferEmpty(int event = VC_EVENT_WRITE_READY);
 
   /** Returns local sockaddr storage. */
-  sockaddr const* get_local_addr();
+  sockaddr const *get_local_addr();
 
   /** Returns local ip.
       @deprecated get_local_addr() should be used instead for AF_INET6 compatibility.
@@ -464,7 +463,7 @@ public:
   uint16_t get_local_port();
 
   /** Returns remote sockaddr storage. */
-  sockaddr const* get_remote_addr();
+  sockaddr const *get_remote_addr();
 
   /** Returns remote ip.
       @deprecated get_remote_addr() should be used instead for AF_INET6 compatibility.
@@ -484,18 +483,18 @@ public:
   // Private
   //
 
-  //The following variable used to obtain host addr when transparency
-  //is enabled by SocksProxy
+  // The following variable used to obtain host addr when transparency
+  // is enabled by SocksProxy
   SocksAddrType socks_addr;
 
   unsigned int attributes;
   EThread *thread;
 
   /// PRIVATE: The public interface is VIO::reenable()
-  virtual void reenable(VIO * vio) = 0;
+  virtual void reenable(VIO *vio) = 0;
 
   /// PRIVATE: The public interface is VIO::reenable()
-  virtual void reenable_re(VIO * vio) = 0;
+  virtual void reenable_re(VIO *vio) = 0;
 
   /// PRIVATE
   virtual ~NetVConnection() {}
@@ -521,26 +520,34 @@ public:
   virtual void set_remote_addr() = 0;
 
   // for InkAPI
-  bool get_is_internal_request() const {
+  bool
+  get_is_internal_request() const
+  {
     return is_internal_request;
   }
 
-  void set_is_internal_request(bool val = false) {
+  void
+  set_is_internal_request(bool val = false)
+  {
     is_internal_request = val;
   }
 
   /// Get the transparency state.
-  bool get_is_transparent() const {
+  bool
+  get_is_transparent() const
+  {
     return is_transparent;
   }
   /// Set the transparency state.
-  void set_is_transparent(bool state = true) {
+  void
+  set_is_transparent(bool state = true)
+  {
     is_transparent = state;
   }
 
 private:
   NetVConnection(const NetVConnection &);
-  NetVConnection & operator =(const NetVConnection &);
+  NetVConnection &operator=(const NetVConnection &);
 
 protected:
   IpEndpoint local_addr;
@@ -556,16 +563,9 @@ protected:
   int write_buffer_empty_event;
 };
 
-inline
-NetVConnection::NetVConnection():
-  VConnection(NULL),
-  attributes(0),
-  thread(NULL),
-  got_local_addr(0),
-  got_remote_addr(0),
-  is_internal_request(false),
-  is_transparent(false),
-  write_buffer_empty_event(0)
+inline NetVConnection::NetVConnection()
+  : VConnection(NULL), attributes(0), thread(NULL), got_local_addr(0), got_remote_addr(0), is_internal_request(false),
+    is_transparent(false), write_buffer_empty_event(0)
 {
   ink_zero(local_addr);
   ink_zero(remote_addr);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_SessionAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_SessionAccept.h b/iocore/net/I_SessionAccept.h
index 9ac9e2b..c6586ef 100644
--- a/iocore/net/I_SessionAccept.h
+++ b/iocore/net/I_SessionAccept.h
@@ -27,20 +27,17 @@
 #include "I_Net.h"
 #include "I_VConnection.h"
 
-class SessionAccept: public Continuation
+class SessionAccept : public Continuation
 {
 public:
-  SessionAccept(ProxyMutex *amutex) : Continuation(amutex) {
-    SET_HANDLER(&SessionAccept::mainEvent);
-  }
+  SessionAccept(ProxyMutex *amutex) : Continuation(amutex) { SET_HANDLER(&SessionAccept::mainEvent); }
 
-  ~SessionAccept() {
-  }
+  ~SessionAccept() {}
 
   virtual void accept(NetVConnection *, MIOBuffer *, IOBufferReader *) = 0;
 
 private:
-  virtual int mainEvent(int event, void * netvc) = 0;
+  virtual int mainEvent(int event, void *netvc) = 0;
 };
 
 #endif /* I_SessionAccept_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_Socks.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_Socks.h b/iocore/net/I_Socks.h
index 4dd206e..05535be 100644
--- a/iocore/net/I_Socks.h
+++ b/iocore/net/I_Socks.h
@@ -31,53 +31,43 @@
 #define SOCKS_WITH_TS
 
 
-#define SOCKS_DEFAULT_VERSION 0 //defined the configuration variable
-#define SOCKS4_VERSION  4
+#define SOCKS_DEFAULT_VERSION 0 // defined the configuration variable
+#define SOCKS4_VERSION 4
 #define SOCKS5_VERSION 5
-#define SOCKS_CONNECT  1
-#define SOCKS4_REQ_LEN  9
-#define SOCKS4_REP_LEN  8
-#define SOCKS5_REP_LEN 262      //maximum possible
+#define SOCKS_CONNECT 1
+#define SOCKS4_REQ_LEN 9
+#define SOCKS4_REP_LEN 8
+#define SOCKS5_REP_LEN 262 // maximum possible
 #define SOCKS4_REQ_GRANTED 90
 #define SOCKS4_CONN_FAILED 91
 #define SOCKS5_REQ_GRANTED 0
 #define SOCKS5_CONN_FAILED 1
 
-enum
-{
-  //For these two, we need to pick two values which are not used for any of the
+enum {
+  // For these two, we need to pick two values which are not used for any of the
   //"commands" (eg: CONNECT, BIND) in SOCKS protocols.
   NORMAL_SOCKS = 0,
   NO_SOCKS = 48
 };
 
-enum
-{
+enum {
   SOCKS_ATYPE_NONE = 0,
   SOCKS_ATYPE_IPV4 = 1,
   SOCKS_ATYPE_FQHN = 3,
-  SOCKS_ATYPE_IPV6 = 4
+  SOCKS_ATYPE_IPV6 = 4,
 };
 
-struct SocksAddrType
-{
+struct SocksAddrType {
   unsigned char type;
-  union
-  {
-    //mostly it is ipv4. in other cases we will xalloc().
+  union {
+    // mostly it is ipv4. in other cases we will xalloc().
     unsigned char ipv4[4];
     unsigned char *buf;
   } addr;
 
   void reset();
-    SocksAddrType():type(SOCKS_ATYPE_NONE)
-  {
-    addr.buf = 0;
-  }
-   ~SocksAddrType()
-  {
-    reset();
-  }
+  SocksAddrType() : type(SOCKS_ATYPE_NONE) { addr.buf = 0; }
+  ~SocksAddrType() { reset(); }
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPConnection.h b/iocore/net/I_UDPConnection.h
index 91fe2b3..3f2b588 100644
--- a/iocore/net/I_UDPConnection.h
+++ b/iocore/net/I_UDPConnection.h
@@ -42,12 +42,10 @@ class UDPPacket;
    and set up a persistent receive() operation.
  */
 
-class UDPConnection:public Continuation
+class UDPConnection : public Continuation
 {
 public:
-  virtual ~ UDPConnection()
-  {
-  };
+  virtual ~UDPConnection(){};
 
   SOCKET getFd();
   void setBinding(struct sockaddr const *);
@@ -66,7 +64,7 @@ public:
      @param c continuation to be called back
      @param p packet to be sent.
    */
-  Action *send(Continuation * c, UDPPacket * p);
+  Action *send(Continuation *c, UDPPacket *p);
 
   /**
      <p>
@@ -79,7 +77,7 @@ public:
      cancelled via this Action.
      @param c continuation to be called back
    */
-  Action *recv(Continuation * c);
+  Action *recv(Continuation *c);
 
   void Release();
   void AddRef();
@@ -87,10 +85,10 @@ public:
 
   int getPortNum(void);
 
-  int GetSendGenerationNumber();        //const
+  int GetSendGenerationNumber(); // const
   void SetLastSentPktTSSeqNum(int64_t sentSeqNum);
   int64_t cancel();
-  void setContinuation(Continuation * c);
+  void setContinuation(Continuation *c);
 
   /**
      Put socket on net queue for read/write polling.
@@ -101,7 +99,7 @@ public:
      bindToThread() automatically so that the sockets can be passed to
      other Continuations.
   */
-  void bindToThread(Continuation * c);
+  void bindToThread(Continuation *c);
 
   virtual void UDPConnection_is_abstract() = 0;
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index b2e2d9a..a3d1588 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -42,15 +42,15 @@
    You can create UDPConnections for asynchronous send/receive or call
    directly (inefficiently) into network layer.
  */
-class UDPNetProcessor:public Processor
+class UDPNetProcessor : public Processor
 {
 public:
   virtual int start(int n_upd_threads, size_t stacksize) = 0;
 
-  //this function was interanal intially.. this is required for public and
-  //interface probably should change.
-  bool CreateUDPSocket(int *resfd, sockaddr const* remote_addr, sockaddr* local_addr, int* local_addr_len,
-                       Action ** status, int send_bufsize = 0, int recv_bufsize = 0);
+  // this function was interanal intially.. this is required for public and
+  // interface probably should change.
+  bool CreateUDPSocket(int *resfd, sockaddr const *remote_addr, sockaddr *local_addr, int *local_addr_len, Action **status,
+                       int send_bufsize = 0, int recv_bufsize = 0);
 
   /**
      create UDPConnection
@@ -73,7 +73,7 @@ public:
      @return Action* Always returns ACTION_RESULT_DONE if socket was
      created successfuly, or ACTION_IO_ERROR if not.
   */
-  inkcoreapi Action *UDPBind(Continuation * c, sockaddr const* addr, int send_bufsize = 0, int recv_bufsize = 0);
+  inkcoreapi Action *UDPBind(Continuation *c, sockaddr const *addr, int send_bufsize = 0, int recv_bufsize = 0);
 
   // Regarding sendto_re, sendmsg_re, recvfrom_re:
   // * You may be called back on 'c' with completion or error status.
@@ -94,18 +94,16 @@ public:
   //   completionUtil::getHandle(cevent);
   // * You can get other info about the completed operation through use
   //   of the completionUtil class.
-  Action *sendto_re(Continuation * c, void *token, int fd,
-                    sockaddr const* toaddr, int toaddrlen, IOBufferBlock * buf, int len);
+  Action *sendto_re(Continuation *c, void *token, int fd, sockaddr const *toaddr, int toaddrlen, IOBufferBlock *buf, int len);
   // I/O buffers referenced by msg must be pinned by the caller until
   // continuation is called back.
-  Action *sendmsg_re(Continuation * c, void *token, int fd, struct msghdr *msg);
+  Action *sendmsg_re(Continuation *c, void *token, int fd, struct msghdr *msg);
 
-  Action *recvfrom_re(Continuation * c, void *token, int fd,
-                      sockaddr *fromaddr, socklen_t *fromaddrlen,
-                      IOBufferBlock * buf, int len, bool useReadCont = true, int timeout = 0);
+  Action *recvfrom_re(Continuation *c, void *token, int fd, sockaddr *fromaddr, socklen_t *fromaddrlen, IOBufferBlock *buf, int len,
+                      bool useReadCont = true, int timeout = 0);
 };
 
-inkcoreapi extern UDPNetProcessor & udpNet;
+inkcoreapi extern UDPNetProcessor &udpNet;
 
 #include "I_UDPPacket.h"
 #include "I_UDPConnection.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/I_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPPacket.h b/iocore/net/I_UDPPacket.h
index 08dfa88..2ececc1 100644
--- a/iocore/net/I_UDPPacket.h
+++ b/iocore/net/I_UDPPacket.h
@@ -42,15 +42,12 @@
  */
 class UDPPacket
 {
-
 public:
+  virtual ~UDPPacket() {}
 
-  virtual ~UDPPacket()
-  { }
-
-  virtual void free();          // fast deallocate
-  void setContinuation(Continuation * c);
-  void setConnection(UDPConnection * c);
+  virtual void free(); // fast deallocate
+  void setContinuation(Continuation *c);
+  void setConnection(UDPConnection *c);
   UDPConnection *getConnection();
   IOBufferBlock *getIOBlockChain();
   int64_t getPktLength();
@@ -60,10 +57,10 @@ public:
      @param block block chain to add.
 
    */
-  inkcoreapi void append_block(IOBufferBlock * block);
+  inkcoreapi void append_block(IOBufferBlock *block);
 
-  IpEndpoint from;    // what address came from
-  IpEndpoint to;      // what address to send to
+  IpEndpoint from; // what address came from
+  IpEndpoint to;   // what address to send to
 
   int from_size;
 
@@ -80,7 +77,7 @@ public:
    @param buf if !NULL, then len bytes copied from buf and made into packet.
    @param len # of bytes to copy from buf
  */
-extern UDPPacket *new_UDPPacket(struct sockaddr const* to, ink_hrtime when = 0, char *buf = NULL, int len = 0);
+extern UDPPacket *new_UDPPacket(struct sockaddr const *to, ink_hrtime when = 0, char *buf = NULL, int len = 0);
 /**
    Create a new packet to be sent over UDPConnection. This clones and
    makes a reference to an existing IOBufferBlock chain.
@@ -93,8 +90,7 @@ extern UDPPacket *new_UDPPacket(struct sockaddr const* to, ink_hrtime when = 0,
    @param len # of bytes to reference from block
  */
 
-TS_INLINE UDPPacket *new_UDPPacket(struct sockaddr const* to, ink_hrtime when = 0,
-                                   IOBufferBlock * block = NULL, int len = 0);
+TS_INLINE UDPPacket *new_UDPPacket(struct sockaddr const *to, ink_hrtime when = 0, IOBufferBlock *block = NULL, int len = 0);
 /**
    Create a new packet to be sent over UDPConnection.  Packet has no
    destination or data.
@@ -105,7 +101,7 @@ extern UDPPacket *new_UDPPacket();
    Create a new packet to be delivered to application.
    Internal function only
 */
-extern UDPPacket *new_incoming_UDPPacket(struct sockaddr* from, char *buf, int len);
+extern UDPPacket *new_incoming_UDPPacket(struct sockaddr *from, char *buf, int len);
 
 //@}
 #endif //__I_UDPPACKET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/Inline.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Inline.cc b/iocore/net/Inline.cc
index f8d0413..96716d6 100644
--- a/iocore/net/Inline.cc
+++ b/iocore/net/Inline.cc
@@ -28,4 +28,3 @@
 
 #define TS_INLINE
 #include "P_Net.h"
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/Net.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index 9655509..500f2af 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -48,83 +48,79 @@ register_net_stats()
   //
   // Register statistics
   //
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.net_handler_run",
-                     RECD_INT, RECP_PERSISTENT, (int) net_handler_run_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.net_handler_run", RECD_INT, RECP_PERSISTENT,
+                     (int)net_handler_run_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_handler_run_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.read_bytes",
-                     RECD_INT, RECP_PERSISTENT, (int) net_read_bytes_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.read_bytes", RECD_INT, RECP_PERSISTENT, (int)net_read_bytes_stat,
+                     RecRawStatSyncSum);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.write_bytes",
-                     RECD_INT, RECP_PERSISTENT, (int) net_write_bytes_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.write_bytes", RECD_INT, RECP_PERSISTENT, (int)net_write_bytes_stat,
+                     RecRawStatSyncSum);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.connections_currently_open",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) net_connections_currently_open_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.connections_currently_open", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)net_connections_currently_open_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_connections_currently_open_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.accepts_currently_open",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) net_accepts_currently_open_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.accepts_currently_open", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)net_accepts_currently_open_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_accepts_currently_open_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_readfromnet",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_readfromnet_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_readfromnet", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_readfromnet_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_readfromnet_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_readfromnet_afterpoll",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_readfromnet_afterpoll_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_readfromnet_afterpoll", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_readfromnet_afterpoll_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_readfromnet_afterpoll_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_read",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_read_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_read", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_read_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_read_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_read_nodata",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_read_nodata_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_read_nodata", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_read_nodata_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_read_nodata_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_writetonet",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_writetonet_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_writetonet", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_writetonet_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_writetonet_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_writetonet_afterpoll",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_writetonet_afterpoll_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_writetonet_afterpoll", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_writetonet_afterpoll_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_writetonet_afterpoll_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_write",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_write_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_write", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_write_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_write_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_write_nodata",
-                     RECD_INT, RECP_PERSISTENT, (int) net_calls_to_write_nodata_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.calls_to_write_nodata", RECD_INT, RECP_PERSISTENT,
+                     (int)net_calls_to_write_nodata_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(net_calls_to_write_nodata_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_successful",
-                     RECD_INT, RECP_PERSISTENT, (int) socks_connections_successful_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_successful", RECD_INT, RECP_PERSISTENT,
+                     (int)socks_connections_successful_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_unsuccessful",
-                     RECD_INT, RECP_PERSISTENT, (int) socks_connections_unsuccessful_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_unsuccessful", RECD_INT, RECP_PERSISTENT,
+                     (int)socks_connections_unsuccessful_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_currently_open",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) socks_connections_currently_open_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.socks.connections_currently_open", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)socks_connections_currently_open_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(socks_connections_currently_open_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.inactivity_cop_lock_acquire_failure",
-                     RECD_INT, RECP_PERSISTENT, (int) inactivity_cop_lock_acquire_failure_stat,
-                     RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.inactivity_cop_lock_acquire_failure", RECD_INT, RECP_PERSISTENT,
+                     (int)inactivity_cop_lock_acquire_failure_stat, RecRawStatSyncSum);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.dynamic_keep_alive_timeout_in_total",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) keep_alive_lru_timeout_total_stat,
-                     RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.dynamic_keep_alive_timeout_in_total", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)keep_alive_lru_timeout_total_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(keep_alive_lru_timeout_total_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.dynamic_keep_alive_timeout_in_count",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) keep_alive_lru_timeout_count_stat,
-                     RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.dynamic_keep_alive_timeout_in_count", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)keep_alive_lru_timeout_count_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(keep_alive_lru_timeout_count_stat);
 
-  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.default_inactivity_timeout_applied",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) default_inactivity_timeout_stat,
-                     RecRawStatSyncSum);
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.default_inactivity_timeout_applied", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)default_inactivity_timeout_stat, RecRawStatSyncSum);
   NET_CLEAR_DYN_STAT(default_inactivity_timeout_stat);
 }
 
@@ -137,7 +133,7 @@ ink_net_init(ModuleVersion version)
   if (!init_called) {
     // do one time stuff
     // create a stat block for NetStats
-    net_rsb = RecAllocateRawStatBlock((int) Net_Stat_Count);
+    net_rsb = RecAllocateRawStatBlock((int)Net_Stat_Count);
     configure_net();
     register_net_stats();
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/NetTest-http-server.c
----------------------------------------------------------------------
diff --git a/iocore/net/NetTest-http-server.c b/iocore/net/NetTest-http-server.c
index 4fdde30..5e17420 100644
--- a/iocore/net/NetTest-http-server.c
+++ b/iocore/net/NetTest-http-server.c
@@ -22,12 +22,10 @@
  */
 
 
-
 IOBufferBlock *resp_blk;
 int doc_len;
 
-struct NetTesterSM:public Continuation
-{
+struct NetTesterSM : public Continuation {
   VIO *read_vio;
   IOBufferReader *reader, *resp_reader;
   NetVConnection *vc;
@@ -36,7 +34,7 @@ struct NetTesterSM:public Continuation
   int req_len;
 
 
-    NetTesterSM(ProxyMutex * _mutex, NetVConnection * _vc):Continuation(_mutex)
+  NetTesterSM(ProxyMutex *_mutex, NetVConnection *_vc) : Continuation(_mutex)
   {
     MUTEX_TRY_LOCK(lock, mutex, _vc->thread);
     ink_release_assert(lock);
@@ -46,7 +44,7 @@ struct NetTesterSM:public Continuation
     req_buf = new_MIOBuffer(1);
     reader = req_buf->alloc_reader();
     read_vio = vc->do_io_read(this, INT64_MAX, req_buf);
-    //vc->set_inactivity_timeout(HRTIME_SECONDS(60));
+    // vc->set_inactivity_timeout(HRTIME_SECONDS(60));
     resp_buf = new_empty_MIOBuffer(6);
     resp_buf->append_block(resp_blk->clone());
     req_len = 0;
@@ -54,7 +52,7 @@ struct NetTesterSM:public Continuation
   }
 
 
-   ~NetTesterSM()
+  ~NetTesterSM()
   {
     req_buf->dealloc_all_readers();
     req_buf->clear();
@@ -70,7 +68,8 @@ struct NetTesterSM:public Continuation
      Proxy-Connection: Keep-Alive
    */
 
-  int handle_read(int event, void *data)
+  int
+  handle_read(int event, void *data)
   {
     int r;
     char *str;
@@ -82,18 +81,18 @@ struct NetTesterSM:public Continuation
       request[req_len] = 0;
       Debug("net_test", "%s\n", request);
       fflush(stdout);
-      //vc->set_inactivity_timeout(HRTIME_SECONDS(30));
+      // vc->set_inactivity_timeout(HRTIME_SECONDS(30));
       if (strcmp(&request[req_len - 4], "\r\n\r\n") == 0) {
         Debug("net_test", "The request header is :\n%s\n", request);
         // parse and get the doc size
         SET_HANDLER(&NetTesterSM::handle_write);
         ink_assert(doc_len == resp_reader->read_avail());
         vc->do_io_write(this, doc_len, resp_reader);
-        //vc->set_inactivity_timeout(HRTIME_SECONDS(10));
+        // vc->set_inactivity_timeout(HRTIME_SECONDS(10));
       }
       break;
     case VC_EVENT_READ_COMPLETE:
-      /* FALLSTHROUGH */
+    /* FALLSTHROUGH */
     case VC_EVENT_EOS:
       r = reader->read_avail();
       str = new char[r + 10];
@@ -108,13 +107,13 @@ struct NetTesterSM:public Continuation
       break;
     default:
       ink_release_assert(!"unknown event");
-
     }
     return EVENT_CONT;
   }
 
 
-  int handle_write(int event, Event * e)
+  int
+  handle_write(int event, Event *e)
   {
     switch (event) {
     case VC_EVENT_WRITE_READY:
@@ -133,43 +132,30 @@ struct NetTesterSM:public Continuation
     }
     return EVENT_CONT;
   }
-
-
-
 };
 
 
-struct NetTesterAccept:public Continuation
-{
-
-  NetTesterAccept(ProxyMutex * _mutex):Continuation(_mutex)
-  {
-    SET_HANDLER(&NetTesterAccept::handle_accept);
-  }
+struct NetTesterAccept : public Continuation {
+  NetTesterAccept(ProxyMutex *_mutex) : Continuation(_mutex) { SET_HANDLER(&NetTesterAccept::handle_accept); }
 
-  int handle_accept(int event, void *data)
+  int
+  handle_accept(int event, void *data)
   {
     Debug("net_test", "Accepted a connection\n");
     fflush(stdout);
-    NetVConnection *vc = (NetVConnection *) data;
+    NetVConnection *vc = (NetVConnection *)data;
     new NetTesterSM(new_ProxyMutex(), vc);
     return EVENT_CONT;
   }
-
-
 };
 
 
-
-struct Stop:public Continuation
-{
+struct Stop : public Continuation {
   Action *a;
-    Stop(ProxyMutex * m):Continuation(m)
-  {
-    SET_HANDLER(&Stop::stop);
-  }
+  Stop(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&Stop::stop); }
 
-  int stop(int event, Event * e)
+  int
+  stop(int event, Event *e)
   {
     a->cancel();
     return EVENT_DONE;
@@ -180,7 +166,9 @@ struct Stop:public Continuation
 int
 test_main()
 {
-  const char *response_hdr = "HTTP/1.0 200 OK\n" "Content-Type: text/html\n" "Content-Length: 8000\r\n\r\n";
+  const char *response_hdr = "HTTP/1.0 200 OK\n"
+                             "Content-Type: text/html\n"
+                             "Content-Length: 8000\r\n\r\n";
 
   resp_blk = new_IOBufferBlock();
   resp_blk->alloc(6);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/NetVCTest.cc
----------------------------------------------------------------------
diff --git a/iocore/net/NetVCTest.cc b/iocore/net/NetVCTest.cc
index 55844f7..4d68eba 100644
--- a/iocore/net/NetVCTest.cc
+++ b/iocore/net/NetVCTest.cc
@@ -45,70 +45,48 @@
 //
 NVC_test_def netvc_tests_def[] = {
 
-  {"basic", 2000, 2000, 2000, 2000, 50, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-  {"basic", 2000, 2000, 2000, 2000, 50, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
+  {"basic", 2000, 2000, 2000, 2000, 50, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+  {"basic", 2000, 2000, 2000, 2000, 50, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
 
-  {"basic2", 10001, 10001, 5001, 5001, 1024, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-  {"basic2", 5001, 5001, 10001, 10001, 1024, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
+  {"basic2", 10001, 10001, 5001, 5001, 1024, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+  {"basic2", 5001, 5001, 10001, 10001, 1024, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
 
-  {"large", 1000000, 1000000, 500000, 500000, 8192, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-  {"large", 500000, 500000, 1000000, 1000000, 8192, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
+  {"large", 1000000, 1000000, 500000, 500000, 8192, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+  {"large", 500000, 500000, 1000000, 1000000, 8192, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
 
   // Test large block transfers
-  {"larget", 1000000, 1000000, 500000, 500000, 40000, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-  {"larget", 500000, 500000, 1000000, 1000000, 40000, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-
-  {"eos", 4000, 4000, 10, 10, 8192, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-  {"eos", 10, 10, 6000, 6000, 8192, 10, VC_EVENT_EOS, VC_EVENT_WRITE_COMPLETE}
-  ,
-
-  {"werr", 4000, 4000, 10, 10, 129, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_ERROR}
-  ,
-  {"werr", 10, 10, 10, 10, 129, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-
-  {"itimeout", 6000, 8000, 10, 10, 512, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_INACTIVITY_TIMEOUT}
-  ,
-  {"itimeout", 10, 10, 6000, 8000, 512, 20, VC_EVENT_EOS, VC_EVENT_WRITE_COMPLETE}
-  ,
+  {"larget", 1000000, 1000000, 500000, 500000, 40000, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+  {"larget", 500000, 500000, 1000000, 1000000, 40000, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+
+  {"eos", 4000, 4000, 10, 10, 8192, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+  {"eos", 10, 10, 6000, 6000, 8192, 10, VC_EVENT_EOS, VC_EVENT_WRITE_COMPLETE},
+
+  {"werr", 4000, 4000, 10, 10, 129, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_ERROR},
+  {"werr", 10, 10, 10, 10, 129, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+
+  {"itimeout", 6000, 8000, 10, 10, 512, 10, VC_EVENT_READ_COMPLETE, VC_EVENT_INACTIVITY_TIMEOUT},
+  {"itimeout", 10, 10, 6000, 8000, 512, 20, VC_EVENT_EOS, VC_EVENT_WRITE_COMPLETE},
 
   // Test the small transfer code one byts at a time
-  {"smallt", 400, 400, 500, 500, 1, 15, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
-  {"smallt", 500, 500, 400, 400, 1, 15, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE}
-  ,
+  {"smallt", 400, 400, 500, 500, 1, 15, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
+  {"smallt", 500, 500, 400, 400, 1, 15, VC_EVENT_READ_COMPLETE, VC_EVENT_WRITE_COMPLETE},
 
   // The purpose of this test is show that stack can over flow if we move too
   //   small of blocks between the buffers.  EVENT_NONE is wild card error event
   //   since which side gets the timeout is unpredictable
-  {"overflow", 1000000, 1000000, 50, 50, 1, 20, VC_EVENT_READ_COMPLETE, EVENT_NONE}
-  ,
+  {"overflow", 1000000, 1000000, 50, 50, 1, 20, VC_EVENT_READ_COMPLETE, EVENT_NONE},
   {"overflow", 50, 50, 0, 35000, 1024, 35, EVENT_NONE, VC_EVENT_WRITE_COMPLETE}
 
 };
 const unsigned num_netvc_tests = countof(netvc_tests_def);
 
 
-NetVCTest::NetVCTest():
-Continuation(NULL),
-test_cont_type(NET_VC_TEST_ACTIVE),
-test_vc(NULL), regress(NULL), driver(NULL), read_vio(NULL),
-write_vio(NULL), read_buffer(NULL), write_buffer(NULL),
-reader_for_rbuf(NULL), reader_for_wbuf(NULL), write_bytes_to_add_per(0),
-timeout(0),
-actual_bytes_read(0), actual_bytes_sent(0), write_done(false), read_done(false),
-read_seed(0), write_seed(0), bytes_to_send(0), bytes_to_read(0),
-nbytes_read(0), nbytes_write(0), expected_read_term(0),
-expected_write_term(0), test_name(NULL), module_name(NULL), debug_tag(NULL)
+NetVCTest::NetVCTest()
+  : Continuation(NULL), test_cont_type(NET_VC_TEST_ACTIVE), test_vc(NULL), regress(NULL), driver(NULL), read_vio(NULL),
+    write_vio(NULL), read_buffer(NULL), write_buffer(NULL), reader_for_rbuf(NULL), reader_for_wbuf(NULL), write_bytes_to_add_per(0),
+    timeout(0), actual_bytes_read(0), actual_bytes_sent(0), write_done(false), read_done(false), read_seed(0), write_seed(0),
+    bytes_to_send(0), bytes_to_read(0), nbytes_read(0), nbytes_write(0), expected_read_term(0), expected_write_term(0),
+    test_name(NULL), module_name(NULL), debug_tag(NULL)
 {
 }
 
@@ -117,26 +95,24 @@ NetVCTest::~NetVCTest()
   mutex = NULL;
 
   if (read_buffer) {
-    Debug(debug_tag, "Freeing read MIOBuffer with %d blocks on %s",
-          read_buffer->max_block_count(), (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
+    Debug(debug_tag, "Freeing read MIOBuffer with %d blocks on %s", read_buffer->max_block_count(),
+          (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
     free_MIOBuffer(read_buffer);
     read_buffer = NULL;
   }
 
   if (write_buffer) {
-    Debug(debug_tag, "Freeing write MIOBuffer with %d blocks on %s",
-          write_buffer->max_block_count(), (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
+    Debug(debug_tag, "Freeing write MIOBuffer with %d blocks on %s", write_buffer->max_block_count(),
+          (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
     free_MIOBuffer(write_buffer);
     write_buffer = NULL;
   }
 }
 
 void
-NetVCTest::init_test(NetVcTestType_t c_type, NetTestDriver * driver_arg,
-                     NetVConnection * nvc, RegressionTest * robj,
-                     NVC_test_def * my_def, const char *module_name_arg, const char *debug_tag_arg)
+NetVCTest::init_test(NetVcTestType_t c_type, NetTestDriver *driver_arg, NetVConnection *nvc, RegressionTest *robj,
+                     NVC_test_def *my_def, const char *module_name_arg, const char *debug_tag_arg)
 {
-
   test_cont_type = c_type;
   driver = driver_arg;
   test_vc = nvc;
@@ -167,7 +143,6 @@ NetVCTest::init_test(NetVcTestType_t c_type, NetTestDriver * driver_arg,
 void
 NetVCTest::start_test()
 {
-
   test_vc->set_inactivity_timeout(HRTIME_SECONDS(timeout));
   test_vc->set_active_timeout(HRTIME_SECONDS(timeout + 5));
 
@@ -192,9 +167,8 @@ NetVCTest::start_test()
 
 
 int
-NetVCTest::fill_buffer(MIOBuffer * buf, uint8_t * seed, int bytes)
+NetVCTest::fill_buffer(MIOBuffer *buf, uint8_t *seed, int bytes)
 {
-
   char *space = (char *)ats_malloc(bytes);
   char *tmp = space;
   int to_add = bytes;
@@ -213,9 +187,8 @@ NetVCTest::fill_buffer(MIOBuffer * buf, uint8_t * seed, int bytes)
 }
 
 int
-NetVCTest::consume_and_check_bytes(IOBufferReader * r, uint8_t * seed)
+NetVCTest::consume_and_check_bytes(IOBufferReader *r, uint8_t *seed)
 {
-
   uint8_t *tmp, *end;
   int b_consumed = 0;
 
@@ -226,7 +199,7 @@ NetVCTest::consume_and_check_bytes(IOBufferReader * r, uint8_t * seed)
   while (r->read_avail() > 0) {
     int64_t b_avail = r->block_read_avail();
 
-    tmp = (uint8_t *) r->start();
+    tmp = (uint8_t *)r->start();
     end = tmp + b_avail;
     b_consumed = 0;
 
@@ -289,9 +262,8 @@ NetVCTest::read_finished()
 void
 NetVCTest::record_error(const char *msg)
 {
-
-  rprintf(regress, "  %s test: %s failed : %s : on %s\n",
-          module_name, test_name, msg, (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
+  rprintf(regress, "  %s test: %s failed : %s : on %s\n", module_name, test_name, msg,
+          (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
   ink_atomic_increment(&driver->errors, 1);
 
   test_vc->do_io_close();
@@ -308,9 +280,7 @@ NetVCTest::finished()
 void
 NetVCTest::write_handler(int event)
 {
-
-  Debug(debug_tag, "write_handler received event %d on %s",
-        event, (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
+  Debug(debug_tag, "write_handler received event %d on %s", event, (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
 
   switch (event) {
   case VC_EVENT_WRITE_READY:
@@ -343,9 +313,7 @@ NetVCTest::write_handler(int event)
 void
 NetVCTest::read_handler(int event)
 {
-
-  Debug(debug_tag, "read_handler received event %d on %s",
-        event, (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
+  Debug(debug_tag, "read_handler received event %d on %s", event, (test_cont_type == NET_VC_TEST_ACTIVE) ? "Active" : "Passive");
 
   switch (event) {
   case VC_EVENT_READ_READY:
@@ -389,9 +357,8 @@ NetVCTest::read_handler(int event)
 int
 NetVCTest::main_handler(int event, void *data)
 {
-
   if (event == NET_EVENT_ACCEPT) {
-    test_vc = (NetVConnection *) data;
+    test_vc = (NetVConnection *)data;
     start_test();
     return 0;
   }
@@ -408,8 +375,7 @@ NetVCTest::main_handler(int event, void *data)
 }
 
 
-NetTestDriver::NetTestDriver():
-Continuation(NULL), errors(0), r(NULL), pstatus(NULL)
+NetTestDriver::NetTestDriver() : Continuation(NULL), errors(0), r(NULL), pstatus(NULL)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/NetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/NetVConnection.cc b/iocore/net/NetVConnection.cc
index 1050a47..ae74e0b 100644
--- a/iocore/net/NetVConnection.cc
+++ b/iocore/net/NetVConnection.cc
@@ -43,4 +43,3 @@ NetVConnection::cancel_OOB()
 {
   return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/OCSPStapling.cc
----------------------------------------------------------------------
diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc
index 423eb03..2a1ef02 100644
--- a/iocore/net/OCSPStapling.cc
+++ b/iocore/net/OCSPStapling.cc
@@ -33,11 +33,10 @@
 #define MAX_STAPLING_DER 10240
 
 // Cached info stored in SSL_CTX ex_info
-struct certinfo
-{
-  unsigned char idx[20];  // Index in session cache SHA1 hash of certificate
-  OCSP_CERTID *cid; // Certificate ID for OCSP requests or NULL if ID cannot be determined
-  char *uri;  // Responder details
+struct certinfo {
+  unsigned char idx[20]; // Index in session cache SHA1 hash of certificate
+  OCSP_CERTID *cid;      // Certificate ID for OCSP requests or NULL if ID cannot be determined
+  char *uri;             // Responder details
   ink_mutex stapling_mutex;
   unsigned char resp_der[MAX_STAPLING_DER];
   unsigned int resp_derlen;
@@ -45,8 +44,8 @@ struct certinfo
   time_t expire_time;
 };
 
-void certinfo_free(void * /*parent*/, void *ptr, CRYPTO_EX_DATA * /*ad*/,
-    int /*idx*/, long /*argl*/, void * /*argp*/)
+void
+certinfo_free(void * /*parent*/, void *ptr, CRYPTO_EX_DATA * /*ad*/, int /*idx*/, long /*argl*/, void * /*argp*/)
 {
   certinfo *cinf = (certinfo *)ptr;
 
@@ -60,7 +59,8 @@ void certinfo_free(void * /*parent*/, void *ptr, CRYPTO_EX_DATA * /*ad*/,
 
 static int ssl_stapling_index = -1;
 
-void ssl_stapling_ex_init(void)
+void
+ssl_stapling_ex_init(void)
 {
   if (ssl_stapling_index != -1)
     return;
@@ -117,7 +117,7 @@ ssl_stapling_init_cert(SSL_CTX *ctx, const char *certfile)
     return false;
   }
 
-  cinf  = (certinfo *)SSL_CTX_get_ex_data(ctx, ssl_stapling_index);
+  cinf = (certinfo *)SSL_CTX_get_ex_data(ctx, ssl_stapling_index);
   if (cinf) {
     Debug("ssl", "certificate already initialized!");
     return false;
@@ -141,7 +141,7 @@ ssl_stapling_init_cert(SSL_CTX *ctx, const char *certfile)
 
   issuer = stapling_get_issuer(ctx, cert);
   if (issuer == NULL) {
-        Debug("ssl", "can not get issuer certificate!");
+    Debug("ssl", "can not get issuer certificate!");
     return false;
   }
 
@@ -154,7 +154,7 @@ ssl_stapling_init_cert(SSL_CTX *ctx, const char *certfile)
   if (aia)
     cinf->uri = sk_OPENSSL_STRING_pop(aia);
   if (!cinf->uri) {
-        Debug("ssl", "no responder URI");
+    Debug("ssl", "no responder URI");
   }
   if (aia)
     X509_email_free(aia);
@@ -226,8 +226,7 @@ stapling_check_response(certinfo *cinf, OCSP_RESPONSE *rsp)
     Error("stapling_check_response: can not parsing response");
     return SSL_TLSEXT_ERR_OK;
   }
-  if (!OCSP_resp_find_status(bs, cinf->cid, &status, &reason, &rev,
-        &thisupd, &nextupd)) {
+  if (!OCSP_resp_find_status(bs, cinf->cid, &status, &reason, &rev, &thisupd, &nextupd)) {
     // If ID not present just pass it back to client
     Error("stapling_check_response: certificate ID not present in response");
   } else {
@@ -267,9 +266,7 @@ query_responder(BIO *b, char *host, char *path, OCSP_REQUEST *req, int req_timeo
 }
 
 static OCSP_RESPONSE *
-process_responder(OCSP_REQUEST *req,
-    char *host, char *path, char *port,
-    int req_timeout)
+process_responder(OCSP_REQUEST *req, char *host, char *path, char *port, int req_timeout)
 {
   BIO *cbio = NULL;
   OCSP_RESPONSE *resp = NULL;
@@ -277,7 +274,8 @@ process_responder(OCSP_REQUEST *req,
   if (!cbio) {
     goto end;
   }
-  if (port) BIO_set_conn_port(cbio, port);
+  if (port)
+    BIO_set_conn_port(cbio, port);
 
   BIO_set_nbio(cbio, 1);
   if (BIO_do_connect(cbio) <= 0 && !BIO_should_retry(cbio)) {
@@ -367,19 +365,19 @@ ocsp_update()
     if (cc && cc->ctx) {
       ctx = cc->ctx;
       cinf = stapling_get_cert_info(ctx);
-       if (cinf) {
-         ink_mutex_acquire(&cinf->stapling_mutex);
-         current_time = time(NULL);
-         if (cinf->resp_derlen == 0 || cinf->is_expire || cinf->expire_time < current_time) {
-           ink_mutex_release(&cinf->stapling_mutex);
-           if (stapling_refresh_response(cinf, &resp)) {
-             Note("Success to refresh OCSP response for 1 certificate.");
-           } else {
-             Note("Fail to refresh OCSP response for 1 certificate.");
-           }
-         } else {
-           ink_mutex_release(&cinf->stapling_mutex);
-         }
+      if (cinf) {
+        ink_mutex_acquire(&cinf->stapling_mutex);
+        current_time = time(NULL);
+        if (cinf->resp_derlen == 0 || cinf->is_expire || cinf->expire_time < current_time) {
+          ink_mutex_release(&cinf->stapling_mutex);
+          if (stapling_refresh_response(cinf, &resp)) {
+            Note("Success to refresh OCSP response for 1 certificate.");
+          } else {
+            Note("Fail to refresh OCSP response for 1 certificate.");
+          }
+        } else {
+          ink_mutex_release(&cinf->stapling_mutex);
+        }
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_CompletionUtil.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_CompletionUtil.h b/iocore/net/P_CompletionUtil.h
index 1342758..5c4b9a4 100644
--- a/iocore/net/P_CompletionUtil.h
+++ b/iocore/net/P_CompletionUtil.h
@@ -28,18 +28,18 @@ class completionUtil
 {
 public:
   static Event *create();
-  static void destroy(Event * e);
-  static void setThread(Event * e, EThread * t);
-  static void setContinuation(Event * e, Continuation * c);
-  static void *getHandle(Event * e);
-  static void setHandle(Event * e, void *handle);
-  static void setInfo(Event * e, int fd, IOBufferBlock * buf, int actual, int errno_);
-  static void setInfo(Event * e, int fd, struct msghdr *msg, int actual, int errno_);
-  static int getBytesTransferred(Event * e);
-  static IOBufferBlock *getIOBufferBlock(Event * e);
-  static Continuation *getContinuation(Event * e);
-  static int getError(Event * e);
-  static void releaseReferences(Event * e);
+  static void destroy(Event *e);
+  static void setThread(Event *e, EThread *t);
+  static void setContinuation(Event *e, Continuation *c);
+  static void *getHandle(Event *e);
+  static void setHandle(Event *e, void *handle);
+  static void setInfo(Event *e, int fd, IOBufferBlock *buf, int actual, int errno_);
+  static void setInfo(Event *e, int fd, struct msghdr *msg, int actual, int errno_);
+  static int getBytesTransferred(Event *e);
+  static IOBufferBlock *getIOBufferBlock(Event *e);
+  static Continuation *getContinuation(Event *e);
+  static int getError(Event *e);
+  static void releaseReferences(Event *e);
 };
 
 #include "P_UnixCompletionUtil.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_Connection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Connection.h b/iocore/net/P_Connection.h
index e2fed75..84d0d70 100644
--- a/iocore/net/P_Connection.h
+++ b/iocore/net/P_Connection.h
@@ -58,31 +58,30 @@ struct NetVCOptions;
 // Defines
 //
 
-#define NON_BLOCKING_CONNECT     true
-#define BLOCKING_CONNECT         false
-#define CONNECT_WITH_TCP         true
-#define CONNECT_WITH_UDP         false
-#define NON_BLOCKING             true
-#define BLOCKING                 false
-#define BIND_RANDOM_PORT         true
-#define BIND_ANY_PORT            false
-#define ENABLE_MC_LOOPBACK       true
-#define DISABLE_MC_LOOPBACK      false
-#define BC_NO_CONNECT      	 true
-#define BC_CONNECT      	 false
-#define BC_NO_BIND      	 true
-#define BC_BIND      	 	 false
+#define NON_BLOCKING_CONNECT true
+#define BLOCKING_CONNECT false
+#define CONNECT_WITH_TCP true
+#define CONNECT_WITH_UDP false
+#define NON_BLOCKING true
+#define BLOCKING false
+#define BIND_RANDOM_PORT true
+#define BIND_ANY_PORT false
+#define ENABLE_MC_LOOPBACK true
+#define DISABLE_MC_LOOPBACK false
+#define BC_NO_CONNECT true
+#define BC_CONNECT false
+#define BC_NO_BIND true
+#define BC_BIND false
 
 ///////////////////////////////////////////////////////////////////////
 //
 // Connection
 //
 ///////////////////////////////////////////////////////////////////////
-struct Connection
-{
-  SOCKET fd; ///< Socket for connection.
-  IpEndpoint addr; ///< Associated address.
-  bool is_bound; ///< Flag for already bound to a local address.
+struct Connection {
+  SOCKET fd;         ///< Socket for connection.
+  IpEndpoint addr;   ///< Associated address.
+  bool is_bound;     ///< Flag for already bound to a local address.
   bool is_connected; ///< Flag for already connected.
   int sock_type;
 
@@ -97,9 +96,8 @@ struct Connection
       @return 0 on success, -ERRNO on failure.
       @see connect
   */
-  int open(
-	   NetVCOptions const& opt = DEFAULT_OPTIONS ///< Socket options.
-	   );
+  int open(NetVCOptions const &opt = DEFAULT_OPTIONS ///< Socket options.
+           );
 
   /** Connect the socket.
 
@@ -111,34 +109,31 @@ struct Connection
       @return 0 on success, -ERRNO on failure.
       @see open
   */
-  int connect(
-           sockaddr const* to, ///< Remote address and port.
-	   NetVCOptions const& opt = DEFAULT_OPTIONS ///< Socket options
-	   );
+  int connect(sockaddr const *to,                       ///< Remote address and port.
+              NetVCOptions const &opt = DEFAULT_OPTIONS ///< Socket options
+              );
 
 
   /// Set the internal socket address struct.
   /// @internal Used only by ICP.
-  void setRemote(
-    sockaddr const* remote_addr ///< Address and port.
-  ) {
+  void
+  setRemote(sockaddr const *remote_addr ///< Address and port.
+            )
+  {
     ats_ip_copy(&addr, remote_addr);
   }
 
-  int setup_mc_send(sockaddr const* mc_addr,
-                    sockaddr const* my_addr,
-                    bool non_blocking = NON_BLOCKING,
-                    unsigned char mc_ttl = 1, bool mc_loopback = DISABLE_MC_LOOPBACK, Continuation * c = NULL);
+  int setup_mc_send(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking = NON_BLOCKING, unsigned char mc_ttl = 1,
+                    bool mc_loopback = DISABLE_MC_LOOPBACK, Continuation *c = NULL);
 
-  int setup_mc_receive(sockaddr const* from,
-                       sockaddr const* my_addr,
-                       bool non_blocking = NON_BLOCKING, Connection * sendchan = NULL, Continuation * c = NULL);
+  int setup_mc_receive(sockaddr const *from, sockaddr const *my_addr, bool non_blocking = NON_BLOCKING, Connection *sendchan = NULL,
+                       Continuation *c = NULL);
 
-  int close();                  // 0 on success, -errno on failure
+  int close(); // 0 on success, -errno on failure
 
-  void apply_options(NetVCOptions const& opt);
+  void apply_options(NetVCOptions const &opt);
 
-  virtual ~ Connection();
+  virtual ~Connection();
   Connection();
 
   /// Default options.
@@ -153,8 +148,7 @@ protected:
 // Server
 //
 ///////////////////////////////////////////////////////////////////////
-struct Server: public Connection
-{
+struct Server : public Connection {
   /// Client side (inbound) local IP address.
   IpEndpoint accept_addr;
 
@@ -169,7 +163,7 @@ struct Server: public Connection
   //
   int proxy_listen(bool non_blocking = false);
 
-  int accept(Connection * c);
+  int accept(Connection *c);
 
   //
   // Listen on a socket. We assume the port is in host by order, but
@@ -178,19 +172,11 @@ struct Server: public Connection
   //
 
   int listen(bool non_blocking = false, int recv_bufsize = 0, int send_bufsize = 0, bool transparent = false);
-  int setup_fd_for_listen(
-    bool non_blocking = false,
-    int recv_bufsize = 0,
-    int send_bufsize = 0,
-    bool transparent = false ///< Inbound transparent.
-  );
-
-  Server()
-    : Connection()
-    , f_inbound_transparent(false)
-  {
-    ink_zero(accept_addr);
-  }
+  int setup_fd_for_listen(bool non_blocking = false, int recv_bufsize = 0, int send_bufsize = 0,
+                          bool transparent = false ///< Inbound transparent.
+                          );
+
+  Server() : Connection(), f_inbound_transparent(false) { ink_zero(accept_addr); }
 };
 
 #endif /*_Connection_h*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_InkBulkIO.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_InkBulkIO.h b/iocore/net/P_InkBulkIO.h
index 19c15c5..94b0809 100644
--- a/iocore/net/P_InkBulkIO.h
+++ b/iocore/net/P_InkBulkIO.h
@@ -35,18 +35,18 @@
  *  - the first 8 bits contain the character representing the device
  *  - bits 8-15 refer to the ioctl
  */
-#define INKBIO_IOC ('x' << 8)   /* 'x' to represent 'xx' */
+#define INKBIO_IOC ('x' << 8) /* 'x' to represent 'xx' */
 
-#define INKBIO_SEND      (INKBIO_IOC | 1)
-#define INKBIO_BALLOC    (INKBIO_IOC | 2)
+#define INKBIO_SEND (INKBIO_IOC | 1)
+#define INKBIO_BALLOC (INKBIO_IOC | 2)
 
 #define INKBIO_GET_STATS (INKBIO_IOC | 3)
 
-#define INKBIO_NOP       (INKBIO_IOC | 7)
-#define INKBIO_MEMCPY    (INKBIO_IOC | 8)
+#define INKBIO_NOP (INKBIO_IOC | 7)
+#define INKBIO_MEMCPY (INKBIO_IOC | 8)
 
 /* For ioctl's that are destined to the STREAMS module for getting at q ptrs */
-#define INKBIO_REGISTER   1024
+#define INKBIO_REGISTER 1024
 
 #define INKBIO_MAX_BLOCKS 512
 
@@ -63,14 +63,12 @@
 /*
  * Describes a block of BulkIO memory
  */
-struct InkBulkIOBlock
-{
-  void *ptr;                    /* where is it at */
+struct InkBulkIOBlock {
+  void *ptr; /* where is it at */
   uint32_t id;
 };
 
-typedef struct
-{
+typedef struct {
   uint32_t nextFreeIdx;
   uint32_t numFreeBlocks;
   uint32_t freeBlockId[INKBIO_MAX_BLOCKS];
@@ -80,19 +78,17 @@ typedef struct
 /*
  * Describes a packet to be sent.  Found after a request header in a request block
  */
-struct InkBulkIOPkt
-{
+struct InkBulkIOPkt {
   uint32_t blockID;
   /* Set only in the first fragment of a chain.  Contains the size of the packet */
   uint32_t pktsize;
   /* If the thing is a chain, the size of the fragment */
   uint16_t fragsize;
-  uint16_t inChain:1;
-  uint16_t reserved:15;
+  uint16_t inChain : 1;
+  uint16_t reserved : 15;
 };
 
-struct InkBulkIOAddrInfo
-{
+struct InkBulkIOAddrInfo {
   uint32_t ip;
   uint16_t port;
 };
@@ -102,8 +98,7 @@ struct InkBulkIOAddrInfo
  *   - sender, receiver: ip/port info.
  *   - list of InkBulkIOPkt terminated by a 0xffffffff
  */
-struct InkBulkIOSendtoRequest
-{
+struct InkBulkIOSendtoRequest {
   /* declarations are done so that things in a req. block are usually 4-byte aligned */
   uint16_t pktCount;
   struct InkBulkIOAddrInfo src;
@@ -120,39 +115,35 @@ struct InkBulkIOSendtoRequest
  *      terminate list by 0xffffffff
  */
 
-struct InkBulkIOSplitRequest
-{
+struct InkBulkIOSplitRequest {
   /* declarations are done so that things in a req. block are usually 4-byte
    * aligned */
   uint16_t recvCount;
   struct InkBulkIOAddrInfo src;
-  uint16_t perDestHeader;       /* boolean */
+  uint16_t perDestHeader; /* boolean */
 };
 
 /*
  * Describes a request header, part of a request block
  */
-struct InkBulkIORequest
-{
-  uint16_t reqType;             /* one of sendto or split */
-  union
-  {
+struct InkBulkIORequest {
+  uint16_t reqType; /* one of sendto or split */
+  union {
     struct InkBulkIOSendtoRequest sendto;
     struct InkBulkIOSplitRequest split;
   } request;
 };
 
 #define INKBIO_SENDTO_REQUEST 0x0a
-#define INKBIO_SPLIT_REQUEST  0xf1
+#define INKBIO_SPLIT_REQUEST 0xf1
 
 /*
  * Purposely, under specify the size; we need to leave space for the "terminating" packet.
  * Every block contains at least 1 request.
  */
-#define INKBIO_MAX_PKTS_PER_REQ_BLOCK ((INKBIO_PKT_SIZE_WO_UDPHDR - \
-					(sizeof(struct InkBulkIORequest) + sizeof(struct InkBulkIOPkt))) / \
-				       MAX((sizeof (struct InkBulkIORequest)), \
-					   (sizeof(struct InkBulkIOPkt))))
+#define INKBIO_MAX_PKTS_PER_REQ_BLOCK                                                              \
+  ((INKBIO_PKT_SIZE_WO_UDPHDR - (sizeof(struct InkBulkIORequest) + sizeof(struct InkBulkIOPkt))) / \
+   MAX((sizeof(struct InkBulkIORequest)), (sizeof(struct InkBulkIOPkt))))
 
 /*
  * Requests are just block-ids---the block id points to the inkbio-block
@@ -167,13 +158,15 @@ struct InkBulkIORequest
  * Leave space for 1 "NULL" block for the Address information.
  */
 
-#define INKBIO_MAX_SPLIT_WO_HDR_PER_SPLIT_BLOCK ((INKBIO_PKT_SIZE_WO_UDPHDR - \
-					(sizeof(struct InkBulkIORequest) + sizeof(struct InkBulkIOPkt) + sizeof(struct InkBulkIOAddrInfo))) / \
-					(sizeof(struct InkBulkIOAddrInfo)))
+#define INKBIO_MAX_SPLIT_WO_HDR_PER_SPLIT_BLOCK                                                           \
+  ((INKBIO_PKT_SIZE_WO_UDPHDR -                                                                           \
+    (sizeof(struct InkBulkIORequest) + sizeof(struct InkBulkIOPkt) + sizeof(struct InkBulkIOAddrInfo))) / \
+   (sizeof(struct InkBulkIOAddrInfo)))
 
-#define INKBIO_MAX_SPLIT_WITH_HDR_PER_SPLIT_BLOCK ((INKBIO_PKT_SIZE_WO_UDPHDR - \
-					(sizeof(struct InkBulkIORequest) + sizeof(struct InkBulkIOPkt) + sizeof(struct InkBulkIOAddrInfo))) / \
-					(sizeof(struct InkBulkIOPkt) + sizeof(struct InkBulkIOAddrInfo)))
+#define INKBIO_MAX_SPLIT_WITH_HDR_PER_SPLIT_BLOCK                                                         \
+  ((INKBIO_PKT_SIZE_WO_UDPHDR -                                                                           \
+    (sizeof(struct InkBulkIORequest) + sizeof(struct InkBulkIOPkt) + sizeof(struct InkBulkIOAddrInfo))) / \
+   (sizeof(struct InkBulkIOPkt) + sizeof(struct InkBulkIOAddrInfo)))
 
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_LibBulkIO.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_LibBulkIO.h b/iocore/net/P_LibBulkIO.h
index 0fe541f..6ac0270 100644
--- a/iocore/net/P_LibBulkIO.h
+++ b/iocore/net/P_LibBulkIO.h
@@ -43,8 +43,7 @@
 
 #include "P_InkBulkIO.h"
 
-struct InkBulkIOState
-{
+struct InkBulkIOState {
   int biofd;
   void *sharedBuffer;
   int sharedBufferSize;
@@ -53,15 +52,13 @@ struct InkBulkIOState
   int numBlocks;
 };
 
-struct InkBulkIOSplit
-{
+struct InkBulkIOSplit {
   char *header;
   int nbytes;
   struct InkBulkIOAddrInfo dest;
 };
 
-struct InkBulkIOAggregator
-{
+struct InkBulkIOAggregator {
   InkBulkIOAggregator()
   {
     metaReqCount = 0;
@@ -74,7 +71,6 @@ struct InkBulkIOAggregator
     reqblockInfo.ptr = NULL;
     reqblockInfo.id = 0xffffffff;
     reqblockPktPtr = NULL;
-
   };
   struct InkBulkIOBlock metablockInfo;
   // Location where the next req. block id should be stuffed in the meta block.
@@ -86,7 +82,8 @@ struct InkBulkIOAggregator
   // # of fragments in the last request.
   uint32_t lastReqFragCount;
   struct InkBulkIORequest *lastReq;
-  void ResetLastRequestInfo()
+  void
+  ResetLastRequestInfo()
   {
     lastReqFragCount = 0;
     lastReq = NULL;
@@ -94,14 +91,16 @@ struct InkBulkIOAggregator
     reqblockInfo.id = 0xffffffff;
     reqblockPktPtr = NULL;
   };
-  void ResetMetaBlockInfo()
+  void
+  ResetMetaBlockInfo()
   {
     metaReqCount = 0;
     metablockInfo.ptr = NULL;
     metablockInfo.id = 0xffffffff;
     metablockReqPtr = NULL;
   };
-  bool AppendLastRequest()
+  bool
+  AppendLastRequest()
   {
     if (metaReqCount >= INKBIO_MAX_REQS_PER_REQ_BLOCK)
       return false;
@@ -111,42 +110,44 @@ struct InkBulkIOAggregator
     metaReqCount++;
     return true;
   };
-  void TerminateMetaBlock()
+  void
+  TerminateMetaBlock()
   {
     *metablockReqPtr = 0xffffffff;
   };
-  void TerminateLastRequest()
+  void
+  TerminateLastRequest()
   {
     reqblockPktPtr->blockID = 0xffffffff;
     reqblockPktPtr->pktsize = 0xffff;
     reqblockPktPtr->inChain = 0;
     reqblockPktPtr->reserved = 0;
   };
-  void InitMetaBlock()
+  void
+  InitMetaBlock()
   {
-    metablockReqPtr = (uint32_t *) metablockInfo.ptr;
+    metablockReqPtr = (uint32_t *)metablockInfo.ptr;
     metaReqCount = 0;
   };
-  void InitSendtoReqBlock()
+  void
+  InitSendtoReqBlock()
   {
-    reqblockPktPtr = (struct InkBulkIOPkt *)
-      ((caddr_t) reqblockInfo.ptr + sizeof(InkBulkIORequest));
-    lastReq = (struct InkBulkIORequest *) reqblockInfo.ptr;
+    reqblockPktPtr = (struct InkBulkIOPkt *)((caddr_t)reqblockInfo.ptr + sizeof(InkBulkIORequest));
+    lastReq = (struct InkBulkIORequest *)reqblockInfo.ptr;
     lastReq->reqType = INKBIO_SENDTO_REQUEST;
     lastReq->request.sendto.pktCount = 0;
     lastReqFragCount = 0;
   };
-  void InitSplitReqBlock()
+  void
+  InitSplitReqBlock()
   {
-    reqblockPktPtr = (struct InkBulkIOPkt *)
-      ((caddr_t) reqblockInfo.ptr + sizeof(InkBulkIORequest));
-    lastReq = (struct InkBulkIORequest *) reqblockInfo.ptr;
+    reqblockPktPtr = (struct InkBulkIOPkt *)((caddr_t)reqblockInfo.ptr + sizeof(InkBulkIORequest));
+    lastReq = (struct InkBulkIORequest *)reqblockInfo.ptr;
     lastReq->reqType = INKBIO_SPLIT_REQUEST;
     lastReq->request.split.recvCount = 0;
     lastReq->request.split.perDestHeader = 0;
     lastReqFragCount = 0;
   };
-
 };
 
 /*
@@ -157,14 +158,13 @@ void BulkIOClose(struct InkBulkIOState *bioCookie);
 
 int BulkIOBlkAlloc(struct InkBulkIOState *bioCookie, int blkCount, struct InkBulkIOBlock *bioResult);
 
-int BulkIOAddPkt(struct InkBulkIOState *bioCookie,
-                 struct InkBulkIOAggregator *bioAggregator, UDPPacketInternal * pkt, int sourcePort);
+int BulkIOAddPkt(struct InkBulkIOState *bioCookie, struct InkBulkIOAggregator *bioAggregator, UDPPacketInternal *pkt,
+                 int sourcePort);
 
-int BulkIOSplitPkt(struct InkBulkIOState *bioCookie,
-                   struct InkBulkIOAggregator *bioAggregator, UDPPacketInternal * pkt, int sourcePort);
+int BulkIOSplitPkt(struct InkBulkIOState *bioCookie, struct InkBulkIOAggregator *bioAggregator, UDPPacketInternal *pkt,
+                   int sourcePort);
 
-int BulkIOAppendToReqBlock(struct InkBulkIOState *bioCookie,
-                           struct InkBulkIOAggregator *bioAggregator, Ptr<IOBufferBlock> pkt);
+int BulkIOAppendToReqBlock(struct InkBulkIOState *bioCookie, struct InkBulkIOAggregator *bioAggregator, Ptr<IOBufferBlock> pkt);
 
 void BulkIORequestComplete(struct InkBulkIOState *bioCookie, struct InkBulkIOAggregator *bioAggregator);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index 9ef0d5d..c80365f 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -32,8 +32,7 @@
 
 // Net Stats
 
-enum Net_Stats
-{
+enum Net_Stats {
   net_handler_run_stat,
   net_read_bytes_stat,
   net_write_bytes_stat,
@@ -59,32 +58,30 @@ enum Net_Stats
 
 struct RecRawStatBlock;
 extern RecRawStatBlock *net_rsb;
-#define SSL_HANDSHAKE_WANT_READ   6
-#define SSL_HANDSHAKE_WANT_WRITE  7
+#define SSL_HANDSHAKE_WANT_READ 6
+#define SSL_HANDSHAKE_WANT_WRITE 7
 #define SSL_HANDSHAKE_WANT_ACCEPT 8
 #define SSL_HANDSHAKE_WANT_CONNECT 9
 
-#define NET_INCREMENT_DYN_STAT(_x)  \
-RecIncrRawStatSum(net_rsb, mutex->thread_holding, (int)_x, 1)
+#define NET_INCREMENT_DYN_STAT(_x) RecIncrRawStatSum(net_rsb, mutex->thread_holding, (int)_x, 1)
 
-#define NET_DECREMENT_DYN_STAT(_x) \
-RecIncrRawStatSum(net_rsb, mutex->thread_holding, (int)_x, -1)
+#define NET_DECREMENT_DYN_STAT(_x) RecIncrRawStatSum(net_rsb, mutex->thread_holding, (int)_x, -1)
 
-#define NET_SUM_DYN_STAT(_x, _r) \
-RecIncrRawStatSum(net_rsb, mutex->thread_holding, (int)_x, _r)
+#define NET_SUM_DYN_STAT(_x, _r) RecIncrRawStatSum(net_rsb, mutex->thread_holding, (int)_x, _r)
 
-#define NET_READ_DYN_SUM(_x, _sum)  RecGetRawStatSum(net_rsb, (int)_x, &_sum)
+#define NET_READ_DYN_SUM(_x, _sum) RecGetRawStatSum(net_rsb, (int)_x, &_sum)
 
-#define NET_READ_DYN_STAT(_x, _count, _sum) do {\
-RecGetRawStatSum(net_rsb, (int)_x, &_sum);          \
-RecGetRawStatCount(net_rsb, (int)_x, &_count);         \
-} while (0)
+#define NET_READ_DYN_STAT(_x, _count, _sum)        \
+  do {                                             \
+    RecGetRawStatSum(net_rsb, (int)_x, &_sum);     \
+    RecGetRawStatCount(net_rsb, (int)_x, &_count); \
+  } while (0)
 
-#define NET_CLEAR_DYN_STAT(x) \
-do { \
-	RecSetRawStatSum(net_rsb, x, 0); \
-	RecSetRawStatCount(net_rsb, x, 0); \
-} while (0);
+#define NET_CLEAR_DYN_STAT(x)          \
+  do {                                 \
+    RecSetRawStatSum(net_rsb, x, 0);   \
+    RecSetRawStatCount(net_rsb, x, 0); \
+  } while (0);
 
 // For global access
 #define NET_SUM_GLOBAL_DYN_STAT(_x, _r) RecIncrGlobalRawStatSum(net_rsb, (_x), (_r))
@@ -109,15 +106,15 @@ do { \
 #include "P_SSLNetAccept.h"
 #include "P_SSLCertLookup.h"
 
-#undef  NET_SYSTEM_MODULE_VERSION
-#define NET_SYSTEM_MODULE_VERSION makeModuleVersion(                    \
-                                       NET_SYSTEM_MODULE_MAJOR_VERSION, \
-                                       NET_SYSTEM_MODULE_MINOR_VERSION, \
-                                       PRIVATE_MODULE_HEADER)
+#undef NET_SYSTEM_MODULE_VERSION
+#define NET_SYSTEM_MODULE_VERSION \
+  makeModuleVersion(NET_SYSTEM_MODULE_MAJOR_VERSION, NET_SYSTEM_MODULE_MINOR_VERSION, PRIVATE_MODULE_HEADER)
 
 // For very verbose iocore debugging.
 #ifndef DEBUG
-#define NetDebug if (0) dummy_debug
+#define NetDebug \
+  if (0)         \
+  dummy_debug
 #else
 #define NetDebug Debug
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_NetAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_NetAccept.h b/iocore/net/P_NetAccept.h
index 3efac3a..b0183fd 100644
--- a/iocore/net/P_NetAccept.h
+++ b/iocore/net/P_NetAccept.h
@@ -50,30 +50,26 @@ class Event;
 //   Accepts as many connections as possible, returning the number accepted
 //   or -1 to stop accepting.
 //
-typedef int (AcceptFunction) (NetAccept * na, void *e, bool blockable);
+typedef int(AcceptFunction)(NetAccept *na, void *e, bool blockable);
 typedef AcceptFunction *AcceptFunctionPtr;
 AcceptFunction net_accept;
 
 class UnixNetVConnection;
 
 // TODO fix race between cancel accept and call back
-struct NetAcceptAction:public Action, public RefCountObj
-{
+struct NetAcceptAction : public Action, public RefCountObj {
   Server *server;
 
-  void cancel(Continuation * cont = NULL) {
+  void
+  cancel(Continuation *cont = NULL)
+  {
     Action::cancel(cont);
     server->close();
   }
 
-  Continuation *operator =(Continuation * acont)
-  {
-    return Action::operator=(acont);
-  }
+  Continuation *operator=(Continuation *acont) { return Action::operator=(acont); }
 
-  ~NetAcceptAction() {
-    Debug("net_accept", "NetAcceptAction dying\n");
-  }
+  ~NetAcceptAction() { Debug("net_accept", "NetAcceptAction dying\n"); }
 };
 
 
@@ -81,8 +77,7 @@ struct NetAcceptAction:public Action, public RefCountObj
 // NetAccept
 // Handles accepting connections.
 //
-struct NetAccept:public Continuation
-{
+struct NetAccept : public Continuation {
   ink_hrtime period;
   Server server;
   void *alloc_cache;
@@ -101,26 +96,23 @@ struct NetAccept:public Continuation
   EventIO ep;
 
   virtual EventType getEtype() const;
-  virtual NetProcessor * getNetProcessor() const;
+  virtual NetProcessor *getNetProcessor() const;
 
   void init_accept_loop(const char *);
-  virtual void init_accept(EThread * t = NULL);
+  virtual void init_accept(EThread *t = NULL);
   virtual void init_accept_per_thread();
   virtual NetAccept *clone() const;
   // 0 == success
   int do_listen(bool non_blocking, bool transparent = false);
 
-  int do_blocking_accept(EThread * t);
+  int do_blocking_accept(EThread *t);
   virtual int acceptEvent(int event, void *e);
   virtual int acceptFastEvent(int event, void *e);
-  int acceptLoopEvent(int event, Event * e);
+  int acceptLoopEvent(int event, Event *e);
   void cancel();
 
   NetAccept();
-  virtual ~ NetAccept()
-  {
-    action_ = NULL;
-  };
+  virtual ~NetAccept() { action_ = NULL; };
 };
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_NetVCTest.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_NetVCTest.h b/iocore/net/P_NetVCTest.h
index 14f4ea1..bf7f9f3 100644
--- a/iocore/net/P_NetVCTest.h
+++ b/iocore/net/P_NetVCTest.h
@@ -44,15 +44,12 @@ class MIOBuffer;
 class IOBufferReader;
 
 
-
-enum NetVcTestType_t
-{
+enum NetVcTestType_t {
   NET_VC_TEST_ACTIVE,
-  NET_VC_TEST_PASSIVE
+  NET_VC_TEST_PASSIVE,
 };
 
-struct NVC_test_def
-{
+struct NVC_test_def {
   const char *test_name;
 
   int bytes_to_send;
@@ -71,21 +68,21 @@ struct NVC_test_def
 extern NVC_test_def netvc_tests_def[];
 extern const unsigned num_netvc_tests;
 
-class NetTestDriver:public Continuation
+class NetTestDriver : public Continuation
 {
 public:
   NetTestDriver();
   ~NetTestDriver();
 
   int errors;
-protected:
 
-    RegressionTest * r;
+protected:
+  RegressionTest *r;
   int *pstatus;
 };
 
 
-class NetVCTest:public Continuation
+class NetVCTest : public Continuation
 {
 public:
   NetVCTest();
@@ -97,12 +94,11 @@ public:
   void write_handler(int event);
   void cleanup();
 
-  void init_test(NetVcTestType_t n_type, NetTestDriver * driver,
-                 NetVConnection * nvc, RegressionTest * robj,
-                 NVC_test_def * my_def, const char *module_name_arg, const char *debug_tag_arg);
+  void init_test(NetVcTestType_t n_type, NetTestDriver *driver, NetVConnection *nvc, RegressionTest *robj, NVC_test_def *my_def,
+                 const char *module_name_arg, const char *debug_tag_arg);
   void start_test();
-  int fill_buffer(MIOBuffer * buf, uint8_t * seed, int bytes);
-  int consume_and_check_bytes(IOBufferReader * r, uint8_t * seed);
+  int fill_buffer(MIOBuffer *buf, uint8_t *seed, int bytes);
+  int consume_and_check_bytes(IOBufferReader *r, uint8_t *seed);
 
   void write_finished();
   void read_finished();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_NetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_NetVConnection.h b/iocore/net/P_NetVConnection.h
index b62ed54..6c9191c 100644
--- a/iocore/net/P_NetVConnection.h
+++ b/iocore/net/P_NetVConnection.h
@@ -23,7 +23,7 @@
 
 #include "I_NetVConnection.h"
 
-TS_INLINE sockaddr const*
+TS_INLINE sockaddr const *
 NetVConnection::get_remote_addr()
 {
   if (!got_remote_addr) {
@@ -36,10 +36,8 @@ NetVConnection::get_remote_addr()
 TS_INLINE in_addr_t
 NetVConnection::get_remote_ip()
 {
-  sockaddr const* addr = this->get_remote_addr();
-  return ats_is_ip4(addr)
-    ? ats_ip4_addr_cast(addr)
-    : 0;
+  sockaddr const *addr = this->get_remote_addr();
+  return ats_is_ip4(addr) ? ats_ip4_addr_cast(addr) : 0;
 }
 
 
@@ -50,16 +48,14 @@ NetVConnection::get_remote_port()
   return ats_ip_port_host_order(this->get_remote_addr());
 }
 
-TS_INLINE sockaddr const*
+TS_INLINE sockaddr const *
 NetVConnection::get_local_addr()
 {
   if (!got_local_addr) {
     set_local_addr();
-    if (
-      (ats_is_ip(&local_addr) && ats_ip_port_cast(&local_addr)) // IP and has a port.
-      || (ats_is_ip4(&local_addr) && INADDR_ANY != ats_ip4_addr_cast(&local_addr)) // IPv4
-      || (ats_is_ip6(&local_addr) && !IN6_IS_ADDR_UNSPECIFIED(&local_addr.sin6.sin6_addr))
-    ) {
+    if ((ats_is_ip(&local_addr) && ats_ip_port_cast(&local_addr))                    // IP and has a port.
+        || (ats_is_ip4(&local_addr) && INADDR_ANY != ats_ip4_addr_cast(&local_addr)) // IPv4
+        || (ats_is_ip6(&local_addr) && !IN6_IS_ADDR_UNSPECIFIED(&local_addr.sin6.sin6_addr))) {
       got_local_addr = 1;
     }
   }
@@ -69,10 +65,8 @@ NetVConnection::get_local_addr()
 TS_INLINE in_addr_t
 NetVConnection::get_local_ip()
 {
-  sockaddr const* addr = this->get_local_addr();
-  return ats_is_ip4(addr)
-    ? ats_ip4_addr_cast(addr)
-    : 0;
+  sockaddr const *addr = this->get_local_addr();
+  return ats_is_ip4(addr) ? ats_ip4_addr_cast(addr) : 0;
 }
 
 /// @return The local port in host order.


[41/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 438c66a..3d95778 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -36,13 +36,13 @@ struct EvacuationBlock;
 
 // Compilation Options
 
-#define ALTERNATES                      1
+#define ALTERNATES 1
 // #define CACHE_LOCK_FAIL_RATE         0.001
 // #define CACHE_AGG_FAIL_RATE          0.005
 // #define CACHE_INSPECTOR_PAGES
-#define MAX_CACHE_VCS_PER_THREAD        500
+#define MAX_CACHE_VCS_PER_THREAD 500
 
-#define INTEGRAL_FRAGS                  4
+#define INTEGRAL_FRAGS 4
 
 #ifdef CACHE_INSPECTOR_PAGES
 #ifdef DEBUG
@@ -53,64 +53,63 @@ struct EvacuationBlock;
 #ifdef DEBUG
 #define DDebug Debug
 #else
-#define DDebug if (0) dummy_debug
+#define DDebug \
+  if (0)       \
+  dummy_debug
 #endif
 
-#define AIO_SOFT_FAILURE                -100000
+#define AIO_SOFT_FAILURE -100000
 // retry read from writer delay
-#define WRITER_RETRY_DELAY  HRTIME_MSECONDS(50)
+#define WRITER_RETRY_DELAY HRTIME_MSECONDS(50)
 
 #ifndef CACHE_LOCK_FAIL_RATE
 #define CACHE_TRY_LOCK(_l, _m, _t) MUTEX_TRY_LOCK(_l, _m, _t)
 #else
-#define CACHE_TRY_LOCK(_l, _m, _t)                             \
-  MUTEX_TRY_LOCK(_l, _m, _t);                                  \
-  if ((uint32_t)_t->generator.random() <                         \
-     (uint32_t)(UINT_MAX *CACHE_LOCK_FAIL_RATE))                 \
-    CACHE_MUTEX_RELEASE(_l)
+#define CACHE_TRY_LOCK(_l, _m, _t)                                                    \
+  MUTEX_TRY_LOCK(_l, _m, _t);                                                         \
+  if ((uint32_t)_t->generator.random() < (uint32_t)(UINT_MAX * CACHE_LOCK_FAIL_RATE)) \
+  CACHE_MUTEX_RELEASE(_l)
 #endif
 
 
-#define VC_LOCK_RETRY_EVENT() \
-  do { \
+#define VC_LOCK_RETRY_EVENT()                                                                                         \
+  do {                                                                                                                \
     trigger = mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay), event); \
-    return EVENT_CONT; \
+    return EVENT_CONT;                                                                                                \
   } while (0)
 
-#define VC_SCHED_LOCK_RETRY() \
-  do { \
+#define VC_SCHED_LOCK_RETRY()                                                                                  \
+  do {                                                                                                         \
     trigger = mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay)); \
-    return EVENT_CONT; \
+    return EVENT_CONT;                                                                                         \
   } while (0)
 
-#define CONT_SCHED_LOCK_RETRY_RET(_c) \
-  do { \
+#define CONT_SCHED_LOCK_RETRY_RET(_c)                                                                  \
+  do {                                                                                                 \
     _c->mutex->thread_holding->schedule_in_local(_c, HRTIME_MSECONDS(cache_config_mutex_retry_delay)); \
-    return EVENT_CONT; \
+    return EVENT_CONT;                                                                                 \
   } while (0)
 
-#define CONT_SCHED_LOCK_RETRY(_c) \
-  _c->mutex->thread_holding->schedule_in_local(_c, HRTIME_MSECONDS(cache_config_mutex_retry_delay))
-
-#define VC_SCHED_WRITER_RETRY() \
-  do { \
-    ink_assert(!trigger); \
-    writer_lock_retry++; \
-    ink_hrtime _t = WRITER_RETRY_DELAY; \
-    if (writer_lock_retry > 2) \
-      _t = WRITER_RETRY_DELAY * 2; \
-    else if (writer_lock_retry > 5) \
-      _t = WRITER_RETRY_DELAY * 10; \
-    else if (writer_lock_retry > 10) \
-      _t = WRITER_RETRY_DELAY * 100; \
+#define CONT_SCHED_LOCK_RETRY(_c) _c->mutex->thread_holding->schedule_in_local(_c, HRTIME_MSECONDS(cache_config_mutex_retry_delay))
+
+#define VC_SCHED_WRITER_RETRY()                                   \
+  do {                                                            \
+    ink_assert(!trigger);                                         \
+    writer_lock_retry++;                                          \
+    ink_hrtime _t = WRITER_RETRY_DELAY;                           \
+    if (writer_lock_retry > 2)                                    \
+      _t = WRITER_RETRY_DELAY * 2;                                \
+    else if (writer_lock_retry > 5)                               \
+      _t = WRITER_RETRY_DELAY * 10;                               \
+    else if (writer_lock_retry > 10)                              \
+      _t = WRITER_RETRY_DELAY * 100;                              \
     trigger = mutex->thread_holding->schedule_in_local(this, _t); \
-    return EVENT_CONT; \
+    return EVENT_CONT;                                            \
   } while (0)
 
 
-  // cache stats definitions
-enum
-{
+// cache stats definitions
+enum {
   cache_bytes_used_stat,
   cache_bytes_total_stat,
   cache_ram_cache_bytes_stat,
@@ -170,46 +169,41 @@ enum
 
 extern RecRawStatBlock *cache_rsb;
 
-#define GLOBAL_CACHE_SET_DYN_STAT(x,y) \
-	RecSetGlobalRawStatSum(cache_rsb, (x), (y))
+#define GLOBAL_CACHE_SET_DYN_STAT(x, y) RecSetGlobalRawStatSum(cache_rsb, (x), (y))
 
-#define CACHE_SET_DYN_STAT(x,y) \
-	RecSetGlobalRawStatSum(cache_rsb, (x), (y)) \
-	RecSetGlobalRawStatSum(vol->cache_vol->vol_rsb, (x), (y))
+#define CACHE_SET_DYN_STAT(x, y) \
+  RecSetGlobalRawStatSum(cache_rsb, (x), (y)) RecSetGlobalRawStatSum(vol->cache_vol->vol_rsb, (x), (y))
 
-#define CACHE_INCREMENT_DYN_STAT(x) \
-	RecIncrRawStat(cache_rsb, mutex->thread_holding, (int) (x), 1); \
-	RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), 1);
+#define CACHE_INCREMENT_DYN_STAT(x)                              \
+  RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), 1); \
+  RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 1);
 
-#define CACHE_DECREMENT_DYN_STAT(x) \
-	RecIncrRawStat(cache_rsb, mutex->thread_holding, (int) (x), -1); \
-	RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), -1);
+#define CACHE_DECREMENT_DYN_STAT(x)                               \
+  RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), -1); \
+  RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), -1);
 
-#define CACHE_VOL_SUM_DYN_STAT(x,y) \
-        RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), (int64_t) y);
+#define CACHE_VOL_SUM_DYN_STAT(x, y) RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), (int64_t)y);
 
-#define CACHE_SUM_DYN_STAT(x, y) \
-	RecIncrRawStat(cache_rsb, mutex->thread_holding, (int) (x), (int64_t) (y)); \
-	RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int) (x), (int64_t) (y));
+#define CACHE_SUM_DYN_STAT(x, y)                                            \
+  RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), (int64_t)(y)); \
+  RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), (int64_t)(y));
 
-#define CACHE_SUM_DYN_STAT_THREAD(x, y) \
-	RecIncrRawStat(cache_rsb, this_ethread(), (int) (x), (int64_t) (y)); \
-	RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int) (x), (int64_t) (y));
+#define CACHE_SUM_DYN_STAT_THREAD(x, y)                              \
+  RecIncrRawStat(cache_rsb, this_ethread(), (int)(x), (int64_t)(y)); \
+  RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int)(x), (int64_t)(y));
 
-#define GLOBAL_CACHE_SUM_GLOBAL_DYN_STAT(x, y) \
-	RecIncrGlobalRawStatSum(cache_rsb,(x),(y))
+#define GLOBAL_CACHE_SUM_GLOBAL_DYN_STAT(x, y) RecIncrGlobalRawStatSum(cache_rsb, (x), (y))
 
 #define CACHE_SUM_GLOBAL_DYN_STAT(x, y) \
-	RecIncrGlobalRawStatSum(cache_rsb,(x),(y)) \
-	RecIncrGlobalRawStatSum(vol->cache_vol->vol_rsb,(x),(y))
+  RecIncrGlobalRawStatSum(cache_rsb, (x), (y)) RecIncrGlobalRawStatSum(vol->cache_vol->vol_rsb, (x), (y))
 
-#define CACHE_CLEAR_DYN_STAT(x) \
-do { \
-	RecSetRawStatSum(cache_rsb, (x), 0); \
-	RecSetRawStatCount(cache_rsb, (x), 0); \
-	RecSetRawStatSum(vol->cache_vol->vol_rsb, (x), 0); \
-	RecSetRawStatCount(vol->cache_vol->vol_rsb, (x), 0); \
-} while (0);
+#define CACHE_CLEAR_DYN_STAT(x)                          \
+  do {                                                   \
+    RecSetRawStatSum(cache_rsb, (x), 0);                 \
+    RecSetRawStatCount(cache_rsb, (x), 0);               \
+    RecSetRawStatSum(vol->cache_vol->vol_rsb, (x), 0);   \
+    RecSetRawStatCount(vol->cache_vol->vol_rsb, (x), 0); \
+  } while (0);
 
 // Configuration
 extern int cache_config_dir_sync_frequency;
@@ -236,8 +230,7 @@ extern int cache_config_mutex_retry_delay;
 extern int good_interim_disks;
 #endif
 // CacheVC
-struct CacheVC: public CacheVConnection
-{
+struct CacheVC : public CacheVConnection {
   CacheVC();
 
   VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf);
@@ -249,31 +242,35 @@ struct CacheVC: public CacheVConnection
   bool get_data(int i, void *data);
   bool set_data(int i, void *data);
 
-  bool is_ram_cache_hit() const
+  bool
+  is_ram_cache_hit() const
   {
     ink_assert(vio.op == VIO::READ);
     return !f.not_from_ram_cache;
   }
-  int get_header(void **ptr, int *len)
+  int
+  get_header(void **ptr, int *len)
   {
     if (first_buf.m_ptr) {
-      Doc *doc = (Doc*)first_buf->data();
+      Doc *doc = (Doc *)first_buf->data();
       *ptr = doc->hdr();
       *len = doc->hlen;
       return 0;
     } else
       return -1;
   }
-  int set_header(void *ptr, int len)
+  int
+  set_header(void *ptr, int len)
   {
     header_to_write = ptr;
     header_to_write_len = len;
     return 0;
   }
-  int get_single_data(void **ptr, int *len)
+  int
+  get_single_data(void **ptr, int *len)
   {
     if (first_buf.m_ptr) {
-      Doc *doc = (Doc*)first_buf->data();
+      Doc *doc = (Doc *)first_buf->data();
       if (doc->data_len() == doc->total_len) {
         *ptr = doc->data();
         *len = doc->data_len();
@@ -339,15 +336,18 @@ struct CacheVC: public CacheVConnection
   int scanOpenWrite(int event, Event *e);
   int scanRemoveDone(int event, Event *e);
 
-  int is_io_in_progress()
+  int
+  is_io_in_progress()
   {
     return io.aiocb.aio_fildes != AIO_NOT_IN_PROGRESS;
   }
-  void set_io_not_in_progress()
+  void
+  set_io_not_in_progress()
   {
     io.aiocb.aio_fildes = AIO_NOT_IN_PROGRESS;
   }
-  void set_agg_write_in_progress()
+  void
+  set_agg_write_in_progress()
   {
     io.aiocb.aio_fildes = AIO_AGG_WRITE_IN_PROGRESS;
   }
@@ -358,16 +358,16 @@ struct CacheVC: public CacheVConnection
   virtual int64_t get_object_size();
 #ifdef HTTP_CACHE
   virtual void set_http_info(CacheHTTPInfo *info);
-  virtual void get_http_info(CacheHTTPInfo ** info);
+  virtual void get_http_info(CacheHTTPInfo **info);
   /** Get the fragment table.
       @return The address of the start of the fragment table,
       or @c NULL if there is no fragment table.
   */
-  virtual HTTPInfo::FragOffset* get_frag_table();
+  virtual HTTPInfo::FragOffset *get_frag_table();
   /** Load alt pointers and do fixups if needed.
       @return Length of header data used for alternates.
    */
-  virtual uint32_t load_http_info(CacheHTTPInfoVector* info, struct Doc* doc, RefCountObj * block_ptr = NULL);
+  virtual uint32_t load_http_info(CacheHTTPInfoVector *info, struct Doc *doc, RefCountObj *block_ptr = NULL);
 #endif
   virtual bool is_pread_capable();
   virtual bool set_pin_in_cache(time_t time_pin);
@@ -375,8 +375,8 @@ struct CacheVC: public CacheVConnection
   virtual bool set_disk_io_priority(int priority);
   virtual int get_disk_io_priority();
 
-  // offsets from the base stat
-#define CACHE_STAT_ACTIVE  0
+// offsets from the base stat
+#define CACHE_STAT_ACTIVE 0
 #define CACHE_STAT_SUCCESS 1
 #define CACHE_STAT_FAILURE 2
 
@@ -411,7 +411,7 @@ struct CacheVC: public CacheVConnection
 
   OpenDirEntry *od;
   AIOCallbackInternal io;
-  int alternate_index;          // preferred position in vector
+  int alternate_index; // preferred position in vector
   LINK(CacheVC, opendir_link);
 #ifdef CACHE_STAT_PAGES
   LINK(CacheVC, stat_link);
@@ -426,18 +426,18 @@ struct CacheVC: public CacheVConnection
   // NOTE: NOTE: NOTE: If vio is NOT the start, then CHANGE the
   // size_to_init initialization
   VIO vio;
-  EThread *initial_thread;  // initial thread open_XX was called on
+  EThread *initial_thread; // initial thread open_XX was called on
   CacheFragType frag_type;
   CacheHTTPInfo *info;
   CacheHTTPInfoVector *write_vector;
 #ifdef HTTP_CACHE
   CacheLookupHttpConfig *params;
 #endif
-  int header_len;       // for communicating with agg_copy
-  int frag_len;         // for communicating with agg_copy
-  uint32_t write_len;     // for communicating with agg_copy
-  uint32_t agg_len;       // for communicating with aggWrite
-  uint32_t write_serial;  // serial of the final write for SYNC
+  int header_len;        // for communicating with agg_copy
+  int frag_len;          // for communicating with agg_copy
+  uint32_t write_len;    // for communicating with agg_copy
+  uint32_t agg_len;      // for communicating with aggWrite
+  uint32_t write_serial; // serial of the final write for SYNC
   Vol *vol;
   Dir *last_collision;
   Event *trigger;
@@ -448,14 +448,14 @@ struct CacheVC: public CacheVConnection
   int base_stat;
   int recursive;
   int closed;
-  uint64_t seek_to;               // pread offset
-  int64_t offset;                 // offset into 'blocks' of data to write
-  int64_t writer_offset;          // offset of the writer for reading from a writer
-  int64_t length;                 // length of data available to write
-  int64_t doc_pos;                // read position in 'buf'
-  uint64_t write_pos;             // length written
-  uint64_t total_len;             // total length written and available to write
-  uint64_t doc_len;               // total_length (of the selected alternate for HTTP)
+  uint64_t seek_to;      // pread offset
+  int64_t offset;        // offset into 'blocks' of data to write
+  int64_t writer_offset; // offset of the writer for reading from a writer
+  int64_t length;        // length of data available to write
+  int64_t doc_pos;       // read position in 'buf'
+  uint64_t write_pos;    // length written
+  uint64_t total_len;    // total length written and available to write
+  uint64_t doc_len;      // total_length (of the selected alternate for HTTP)
   uint64_t update_len;
   int fragment;
   int scan_msec_delay;
@@ -470,38 +470,36 @@ struct CacheVC: public CacheVConnection
   MigrateToInterimCache *mts;
   uint64_t dir_off;
 #endif
-  union
-  {
+  union {
     uint32_t flags;
-    struct
-    {
-      unsigned int use_first_key:1;
-      unsigned int overwrite:1; // overwrite first_key Dir if it exists
-      unsigned int close_complete:1; // WRITE_COMPLETE is final
-      unsigned int sync:1; // write to be committed to durable storage before WRITE_COMPLETE
-      unsigned int evacuator:1;
-      unsigned int single_fragment:1;
-      unsigned int evac_vector:1;
-      unsigned int lookup:1;
-      unsigned int update:1;
-      unsigned int remove:1;
-      unsigned int remove_aborted_writers:1;
-      unsigned int open_read_timeout:1; // UNUSED
-      unsigned int data_done:1;
-      unsigned int read_from_writer_called:1;
-      unsigned int not_from_ram_cache:1;        // entire object was from ram cache
-      unsigned int rewrite_resident_alt:1;
-      unsigned int readers:1;
-      unsigned int doc_from_ram_cache:1;
-      unsigned int hit_evacuate:1;
+    struct {
+      unsigned int use_first_key : 1;
+      unsigned int overwrite : 1;      // overwrite first_key Dir if it exists
+      unsigned int close_complete : 1; // WRITE_COMPLETE is final
+      unsigned int sync : 1;           // write to be committed to durable storage before WRITE_COMPLETE
+      unsigned int evacuator : 1;
+      unsigned int single_fragment : 1;
+      unsigned int evac_vector : 1;
+      unsigned int lookup : 1;
+      unsigned int update : 1;
+      unsigned int remove : 1;
+      unsigned int remove_aborted_writers : 1;
+      unsigned int open_read_timeout : 1; // UNUSED
+      unsigned int data_done : 1;
+      unsigned int read_from_writer_called : 1;
+      unsigned int not_from_ram_cache : 1; // entire object was from ram cache
+      unsigned int rewrite_resident_alt : 1;
+      unsigned int readers : 1;
+      unsigned int doc_from_ram_cache : 1;
+      unsigned int hit_evacuate : 1;
 #if TS_USE_INTERIM_CACHE == 1
-      unsigned int read_from_interim:1;
-      unsigned int write_into_interim:1;
-      unsigned int ram_fixup:1;
-      unsigned int transistor:1;
+      unsigned int read_from_interim : 1;
+      unsigned int write_into_interim : 1;
+      unsigned int ram_fixup : 1;
+      unsigned int transistor : 1;
 #endif
 #ifdef HTTP_CACHE
-      unsigned int allow_empty_doc:1; // used for cache empty http document
+      unsigned int allow_empty_doc : 1; // used for cache empty http document
 #endif
     } f;
   };
@@ -511,26 +509,26 @@ struct CacheVC: public CacheVConnection
   // BTF fix to handle objects that overlapped over two different reads,
   // this is how much we need to back up the buffer to get the start of the overlapping object.
   off_t scan_fix_buffer_offset;
-  //end region C
+  // end region C
 };
 
-#define PUSH_HANDLER(_x) do {                                           \
-    ink_assert(handler != (ContinuationHandler)(&CacheVC::dead));       \
-    save_handler = handler; handler = (ContinuationHandler)(_x);        \
-} while (0)
+#define PUSH_HANDLER(_x)                                          \
+  do {                                                            \
+    ink_assert(handler != (ContinuationHandler)(&CacheVC::dead)); \
+    save_handler = handler;                                       \
+    handler = (ContinuationHandler)(_x);                          \
+  } while (0)
 
-#define POP_HANDLER do {                                          \
+#define POP_HANDLER                                               \
+  do {                                                            \
     handler = save_handler;                                       \
     ink_assert(handler != (ContinuationHandler)(&CacheVC::dead)); \
   } while (0)
 
-struct CacheRemoveCont: public Continuation
-{
+struct CacheRemoveCont : public Continuation {
   int event_handler(int event, void *data);
 
-  CacheRemoveCont()
-    : Continuation(NULL)
-  { }
+  CacheRemoveCont() : Continuation(NULL) {}
 };
 
 
@@ -593,7 +591,7 @@ free_CacheVC(CacheVC *cont)
         }
       }
 #endif
-    }                             // else abort,cancel
+    } // else abort,cancel
   }
   ink_assert(mutex->thread_holding == this_ethread());
   if (cont->trigger)
@@ -631,7 +629,7 @@ free_CacheVC(CacheVC *cont)
   cont->alternate_index = CACHE_ALT_INDEX_DEFAULT;
   if (cont->scan_vol_map)
     ats_free(cont->scan_vol_map);
-  memset((char *) &cont->vio, 0, cont->size_to_init);
+  memset((char *)&cont->vio, 0, cont->size_to_init);
 #ifdef CACHE_STAT_PAGES
   ink_assert(!cont->stat_link.next && !cont->stat_link.prev);
 #endif
@@ -647,7 +645,7 @@ CacheVC::calluser(int event)
 {
   recursive++;
   ink_assert(!vol || this_ethread() != vol->mutex->thread_holding);
-  vio._cont->handleEvent(event, (void *) &vio);
+  vio._cont->handleEvent(event, (void *)&vio);
   recursive--;
   if (closed) {
     die();
@@ -685,7 +683,7 @@ CacheVC::do_read_call(CacheKey *akey)
   f.transistor = 0;
   f.read_from_interim = dir_ininterim(&dir);
 
-  if (!f.read_from_interim && vio.op == VIO::READ && good_interim_disks > 0){
+  if (!f.read_from_interim && vio.op == VIO::READ && good_interim_disks > 0) {
     vol->history.put_key(read_key);
     if (vol->history.is_hot(read_key) && !vol->migrate_probe(read_key, NULL) && !od) {
       f.write_into_interim = 1;
@@ -693,8 +691,7 @@ CacheVC::do_read_call(CacheKey *akey)
   }
   if (f.read_from_interim) {
     interim_vol = &vol->interim_vols[dir_get_index(&dir)];
-    if (vio.op == VIO::READ && vol_transistor_range_valid(interim_vol, &dir)
-        && !vol->migrate_probe(read_key, NULL) && !od)
+    if (vio.op == VIO::READ && vol_transistor_range_valid(interim_vol, &dir) && !vol->migrate_probe(read_key, NULL) && !od)
       f.transistor = 1;
   }
   if (f.write_into_interim || f.transistor) {
@@ -739,11 +736,11 @@ CacheVC::die()
       SET_HANDLER(&CacheVC::openWriteClose);
       if (!recursive)
         openWriteClose(EVENT_NONE, NULL);
-    }                           // else catch it at the end of openWriteWriteDone
+    } // else catch it at the end of openWriteWriteDone
     return EVENT_CONT;
   } else {
     if (is_io_in_progress())
-      save_handler = (ContinuationHandler) & CacheVC::openReadClose;
+      save_handler = (ContinuationHandler)&CacheVC::openReadClose;
     else {
       SET_HANDLER(&CacheVC::openReadClose);
       if (!recursive)
@@ -797,7 +794,8 @@ CacheVC::writer_done()
   // original writer, since we never choose a writer that started
   // after the reader. The original writer was deallocated and then
   // reallocated for the same first_key
-  for (; w && (w != write_vc || w->start_time > start_time); w = (CacheVC *) w->opendir_link.next);
+  for (; w && (w != write_vc || w->start_time > start_time); w = (CacheVC *)w->opendir_link.next)
+    ;
   if (!w)
     return true;
   return false;
@@ -823,8 +821,7 @@ Vol::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
   if (!cont->f.remove) {
     agg_error = (!cont->f.update && agg_todo_size > cache_config_agg_write_backlog);
 #ifdef CACHE_AGG_FAIL_RATE
-    agg_error = agg_error || ((uint32_t) mutex->thread_holding->generator.random() <
-                              (uint32_t) (UINT_MAX * CACHE_AGG_FAIL_RATE));
+    agg_error = agg_error || ((uint32_t)mutex->thread_holding->generator.random() < (uint32_t)(UINT_MAX * CACHE_AGG_FAIL_RATE));
 #endif
   }
   if (agg_error) {
@@ -880,8 +877,8 @@ Vol::open_read_lock(INK_MD5 *key, EThread *t)
 TS_INLINE int
 Vol::begin_read_lock(CacheVC *cont)
 {
-  // no need for evacuation as the entire document is already in memory
-#ifndef  CACHE_STAT_PAGES
+// no need for evacuation as the entire document is already in memory
+#ifndef CACHE_STAT_PAGES
   if (cont->f.single_fragment)
     return 0;
 #endif
@@ -944,8 +941,8 @@ extern uint8_t CacheKey_next_table[];
 void TS_INLINE
 next_CacheKey(CacheKey *next_key, CacheKey *key)
 {
-  uint8_t *b = (uint8_t *) next_key;
-  uint8_t *k = (uint8_t *) key;
+  uint8_t *b = (uint8_t *)next_key;
+  uint8_t *k = (uint8_t *)key;
   b[0] = CacheKey_next_table[k[0]];
   for (int i = 1; i < 16; i++)
     b[i] = CacheKey_next_table[(b[i - 1] + k[i]) & 0xFF];
@@ -954,8 +951,8 @@ extern uint8_t CacheKey_prev_table[];
 void TS_INLINE
 prev_CacheKey(CacheKey *prev_key, CacheKey *key)
 {
-  uint8_t *b = (uint8_t *) prev_key;
-  uint8_t *k = (uint8_t *) key;
+  uint8_t *b = (uint8_t *)prev_key;
+  uint8_t *k = (uint8_t *)key;
   for (int i = 15; i > 0; i--)
     b[i] = 256 + CacheKey_prev_table[k[i]] - k[i - 1];
   b[0] = CacheKey_prev_table[k[0]];
@@ -992,8 +989,8 @@ free_CacheRemoveCont(CacheRemoveCont *cache_rm)
 TS_INLINE int
 CacheRemoveCont::event_handler(int event, void *data)
 {
-  (void) event;
-  (void) data;
+  (void)event;
+  (void)data;
   free_CacheRemoveCont(this);
   return EVENT_DONE;
 }
@@ -1003,23 +1000,22 @@ int64_t cache_bytes_total(void);
 
 #ifdef DEBUG
 #define CACHE_DEBUG_INCREMENT_DYN_STAT(_x) CACHE_INCREMENT_DYN_STAT(_x)
-#define CACHE_DEBUG_SUM_DYN_STAT(_x,_y) CACHE_SUM_DYN_STAT(_x,_y)
+#define CACHE_DEBUG_SUM_DYN_STAT(_x, _y) CACHE_SUM_DYN_STAT(_x, _y)
 #else
 #define CACHE_DEBUG_INCREMENT_DYN_STAT(_x)
-#define CACHE_DEBUG_SUM_DYN_STAT(_x,_y)
+#define CACHE_DEBUG_SUM_DYN_STAT(_x, _y)
 #endif
 
 struct CacheHostRecord;
 struct Vol;
 class CacheHostTable;
 
-struct Cache
-{
+struct Cache {
   volatile int cache_read_done;
   volatile int total_good_nvol;
   volatile int total_nvol;
   volatile int ready;
-  int64_t cache_size;             //in store block size
+  int64_t cache_size; // in store block size
   CacheHostTable *hosttable;
   volatile int total_initialized_vol;
   CacheType scheme;
@@ -1027,30 +1023,22 @@ struct Cache
   int open(bool reconfigure, bool fix);
   int close();
 
-  Action *lookup(Continuation *cont, CacheKey *key, CacheFragType type, char const* hostname, int host_len);
+  Action *lookup(Continuation *cont, CacheKey *key, CacheFragType type, char const *hostname, int host_len);
   inkcoreapi Action *open_read(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int len);
-  inkcoreapi Action *open_write(Continuation *cont, CacheKey *key,
-                                CacheFragType frag_type, int options = 0,
-                                time_t pin_in_cache = (time_t) 0, char *hostname = 0, int host_len = 0);
-  inkcoreapi Action *remove(Continuation *cont, CacheKey *key,
-                            CacheFragType type = CACHE_FRAG_TYPE_HTTP,
-                            bool user_agents = true, bool link = false,
-                            char *hostname = 0, int host_len = 0);
+  inkcoreapi Action *open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type, int options = 0,
+                                time_t pin_in_cache = (time_t)0, char *hostname = 0, int host_len = 0);
+  inkcoreapi Action *remove(Continuation *cont, CacheKey *key, CacheFragType type = CACHE_FRAG_TYPE_HTTP, bool user_agents = true,
+                            bool link = false, char *hostname = 0, int host_len = 0);
   Action *scan(Continuation *cont, char *hostname = 0, int host_len = 0, int KB_per_second = 2500);
 
 #ifdef HTTP_CACHE
   Action *lookup(Continuation *cont, URL *url, CacheFragType type);
-  inkcoreapi Action *open_read(Continuation *cont, CacheKey *key,
-                               CacheHTTPHdr *request,
-                               CacheLookupHttpConfig *params, CacheFragType type, char *hostname, int host_len);
-  Action *open_read(Continuation *cont, URL *url, CacheHTTPHdr *request,
-                    CacheLookupHttpConfig *params, CacheFragType type);
-  Action *open_write(Continuation *cont, CacheKey *key,
-                     CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0,
-                     CacheKey *key1 = NULL,
-                     CacheFragType type = CACHE_FRAG_TYPE_HTTP, char *hostname = 0, int host_len = 0);
-  Action *open_write(Continuation *cont, URL *url, CacheHTTPHdr *request,
-                     CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0,
+  inkcoreapi Action *open_read(Continuation *cont, CacheKey *key, CacheHTTPHdr *request, CacheLookupHttpConfig *params,
+                               CacheFragType type, char *hostname, int host_len);
+  Action *open_read(Continuation *cont, URL *url, CacheHTTPHdr *request, CacheLookupHttpConfig *params, CacheFragType type);
+  Action *open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0,
+                     CacheKey *key1 = NULL, CacheFragType type = CACHE_FRAG_TYPE_HTTP, char *hostname = 0, int host_len = 0);
+  Action *open_write(Continuation *cont, URL *url, CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0,
                      CacheFragType type = CACHE_FRAG_TYPE_HTTP);
   static void generate_key(INK_MD5 *md5, URL *url);
 #endif
@@ -1062,12 +1050,13 @@ struct Cache
 
   int open_done();
 
-  Vol *key_to_vol(CacheKey *key, char const* hostname, int host_len);
+  Vol *key_to_vol(CacheKey *key, char const *hostname, int host_len);
 
   Cache()
-    : cache_read_done(0), total_good_nvol(0), total_nvol(0), ready(CACHE_INITIALIZING), cache_size(0),  // in store block size
+    : cache_read_done(0), total_good_nvol(0), total_nvol(0), ready(CACHE_INITIALIZING), cache_size(0), // in store block size
       hosttable(NULL), total_initialized_vol(0), scheme(CACHE_NONE_TYPE)
-    { }
+  {
+  }
 };
 
 extern Cache *theCache;
@@ -1076,14 +1065,13 @@ inkcoreapi extern Cache *caches[NUM_CACHE_FRAG_TYPES];
 
 #ifdef HTTP_CACHE
 TS_INLINE Action *
-Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request,
-                 CacheLookupHttpConfig *params, CacheFragType type)
+Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request, CacheLookupHttpConfig *params, CacheFragType type)
 {
   INK_MD5 md5;
   int len;
   url->hash_get(&md5);
   const char *hostname = url->host_get(&len);
-  return open_read(cont, &md5, request, params, type, (char *) hostname, len);
+  return open_read(cont, &md5, request, params, type, (char *)hostname, len);
 }
 
 TS_INLINE void
@@ -1093,24 +1081,24 @@ Cache::generate_key(INK_MD5 *md5, URL *url)
 }
 
 TS_INLINE Action *
-Cache::open_write(Continuation *cont, CacheURL *url, CacheHTTPHdr *request,
-                  CacheHTTPInfo *old_info, time_t pin_in_cache, CacheFragType type)
+Cache::open_write(Continuation *cont, CacheURL *url, CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache,
+                  CacheFragType type)
 {
-  (void) request;
+  (void)request;
   INK_MD5 url_md5;
   url->hash_get(&url_md5);
   int len;
   const char *hostname = url->host_get(&len);
 
-  return open_write(cont, &url_md5, old_info, pin_in_cache, NULL, type, (char *) hostname, len);
+  return open_write(cont, &url_md5, old_info, pin_in_cache, NULL, type, (char *)hostname, len);
 }
 #endif
 
 TS_INLINE unsigned int
-cache_hash(INK_MD5 & md5)
+cache_hash(INK_MD5 &md5)
 {
   uint64_t f = md5.fold();
-  unsigned int mhash = (unsigned int) (f >> 32);
+  unsigned int mhash = (unsigned int)(f >> 32);
   return mhash;
 }
 
@@ -1126,8 +1114,8 @@ cache_hash(INK_MD5 & md5)
 #endif
 
 TS_INLINE Action *
-CacheProcessor::lookup(Continuation *cont, CacheKey *key, bool cluster_cache_local ATS_UNUSED,
-                       bool local_only ATS_UNUSED, CacheFragType frag_type, char *hostname, int host_len)
+CacheProcessor::lookup(Continuation *cont, CacheKey *key, bool cluster_cache_local ATS_UNUSED, bool local_only ATS_UNUSED,
+                       CacheFragType frag_type, char *hostname, int host_len)
 {
 #ifdef CLUSTER_CACHE
   // Try to send remote, if not possible, handle locally
@@ -1142,32 +1130,28 @@ CacheProcessor::lookup(Continuation *cont, CacheKey *key, bool cluster_cache_loc
 }
 
 TS_INLINE inkcoreapi Action *
-CacheProcessor::open_read(Continuation *cont, CacheKey *key, bool cluster_cache_local ATS_UNUSED,
-                          CacheFragType frag_type, char *hostname, int host_len)
+CacheProcessor::open_read(Continuation *cont, CacheKey *key, bool cluster_cache_local ATS_UNUSED, CacheFragType frag_type,
+                          char *hostname, int host_len)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
-    return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *) 0,
-                              (CacheURL *) 0, (CacheHTTPHdr *) 0,
-                              (CacheLookupHttpConfig *) 0, key, 0, frag_type, hostname, host_len);
+    return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *)0, (CacheURL *)0, (CacheHTTPHdr *)0, (CacheLookupHttpConfig *)0,
+                              key, 0, frag_type, hostname, host_len);
   }
 #endif
   return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
 }
 
 TS_INLINE inkcoreapi Action *
-CacheProcessor::open_write(Continuation *cont, CacheKey *key, bool cluster_cache_local  ATS_UNUSED,
-                           CacheFragType frag_type, int expected_size ATS_UNUSED, int options,
-                           time_t pin_in_cache, char *hostname, int host_len)
+CacheProcessor::open_write(Continuation *cont, CacheKey *key, bool cluster_cache_local ATS_UNUSED, CacheFragType frag_type,
+                           int expected_size ATS_UNUSED, int options, time_t pin_in_cache, char *hostname, int host_len)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
     ClusterMachine *m = cluster_machine_at_depth(cache_hash(*key));
     if (m)
-      return Cluster_write(cont, expected_size, (MIOBuffer *) 0, m,
-                         key, frag_type, options, pin_in_cache,
-                         CACHE_OPEN_WRITE, key, (CacheURL *) 0,
-                         (CacheHTTPHdr *) 0, (CacheHTTPInfo *) 0, hostname, host_len);
+      return Cluster_write(cont, expected_size, (MIOBuffer *)0, m, key, frag_type, options, pin_in_cache, CACHE_OPEN_WRITE, key,
+                           (CacheURL *)0, (CacheHTTPHdr *)0, (CacheHTTPInfo *)0, hostname, host_len);
   }
 #endif
   return caches[frag_type]->open_write(cont, key, frag_type, options, pin_in_cache, hostname, host_len);
@@ -1190,25 +1174,25 @@ CacheProcessor::remove(Continuation *cont, CacheKey *key, bool cluster_cache_loc
   return caches[frag_type]->remove(cont, key, frag_type, rm_user_agents, rm_link, hostname, host_len);
 }
 
-# if 0
+#if 0
 TS_INLINE Action *
 scan(Continuation *cont, char *hostname = 0, int host_len = 0, int KB_per_second = 2500)
 {
   return caches[CACHE_FRAG_TYPE_HTTP]->scan(cont, hostname, host_len, KB_per_second);
 }
-# endif
+#endif
 
 #ifdef HTTP_CACHE
 TS_INLINE Action *
 CacheProcessor::lookup(Continuation *cont, URL *url, bool cluster_cache_local, bool local_only, CacheFragType frag_type)
 {
-  (void) local_only;
+  (void)local_only;
   INK_MD5 md5;
   url->hash_get(&md5);
   int host_len = 0;
   const char *hostname = url->host_get(&host_len);
 
-  return lookup(cont, &md5, cluster_cache_local, local_only, frag_type, (char *) hostname, host_len);
+  return lookup(cont, &md5, cluster_cache_local, local_only, frag_type, (char *)hostname, host_len);
 }
 
 #endif
@@ -1216,13 +1200,9 @@ CacheProcessor::lookup(Continuation *cont, URL *url, bool cluster_cache_local, b
 
 #ifdef CLUSTER_CACHE
 TS_INLINE Action *
-CacheProcessor::open_read_internal(int opcode,
-                                   Continuation *cont, MIOBuffer *buf,
-                                   CacheURL *url,
-                                   CacheHTTPHdr *request,
-                                   CacheLookupHttpConfig *params,
-                                   CacheKey *key,
-                                   time_t pin_in_cache, CacheFragType frag_type, char *hostname, int host_len)
+CacheProcessor::open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, CacheURL *url, CacheHTTPHdr *request,
+                                   CacheLookupHttpConfig *params, CacheKey *key, time_t pin_in_cache, CacheFragType frag_type,
+                                   char *hostname, int host_len)
 {
   INK_MD5 url_md5;
   if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
@@ -1233,11 +1213,9 @@ CacheProcessor::open_read_internal(int opcode,
   ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5));
 
   if (m) {
-    return Cluster_read(m, opcode, cont, buf, url,
-                        request, params, key, pin_in_cache, frag_type, hostname, host_len);
+    return Cluster_read(m, opcode, cont, buf, url, request, params, key, pin_in_cache, frag_type, hostname, host_len);
   } else {
-    if ((opcode == CACHE_OPEN_READ_LONG)
-        || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
+    if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
       return caches[frag_type]->open_read(cont, &url_md5, request, params, frag_type, hostname, host_len);
     } else {
       return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
@@ -1248,8 +1226,8 @@ CacheProcessor::open_read_internal(int opcode,
 
 #ifdef CLUSTER_CACHE
 TS_INLINE Action *
-CacheProcessor::link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local,
-                     CacheFragType type, char *hostname, int host_len)
+CacheProcessor::link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local, CacheFragType type, char *hostname,
+                     int host_len)
 {
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
     // Use INK_MD5 in "from" to determine target machine

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheTest.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
index 8ef83ca..f3928e9 100644
--- a/iocore/cache/P_CacheTest.h
+++ b/iocore/cache/P_CacheTest.h
@@ -31,25 +31,21 @@
 #define PINNED_DOC_TABLE_SIZE 16
 #define PINNED_DOC_TABLES 246
 
-struct PinnedDocEntry
-{
+struct PinnedDocEntry {
   CacheKey key;
   ink_time_t time;
   LINK(PinnedDocEntry, link);
 };
 
-struct PinnedDocTable: public Continuation
-{
+struct PinnedDocTable : public Continuation {
   Queue<PinnedDocEntry> bucket[PINNED_DOC_TABLE_SIZE];
 
-  void insert(CacheKey * key, ink_time_t time, int update);
-  int probe(CacheKey * key);
-  int remove(CacheKey * key);
-  int cleanup(int event, Event * e);
+  void insert(CacheKey *key, ink_time_t time, int update);
+  int probe(CacheKey *key);
+  int remove(CacheKey *key);
+  int cleanup(int event, Event *e);
 
-  PinnedDocTable():Continuation(new_ProxyMutex()) {
-    memset(bucket, 0, sizeof(Queue<PinnedDocEntry>) * PINNED_DOC_TABLE_SIZE);
-  }
+  PinnedDocTable() : Continuation(new_ProxyMutex()) { memset(bucket, 0, sizeof(Queue<PinnedDocEntry>) * PINNED_DOC_TABLE_SIZE); }
 };
 
 struct CacheTestHost {
@@ -58,8 +54,7 @@ struct CacheTestHost {
   double xprev_host_prob;
   double xnext_host_prob;
 
-  CacheTestHost():name(NULL), xlast_cachable_id(0),
-                  xprev_host_prob(0), xnext_host_prob(0) {}
+  CacheTestHost() : name(NULL), xlast_cachable_id(0), xprev_host_prob(0), xnext_host_prob(0) {}
 };
 
 struct CacheTestHeader {
@@ -96,7 +91,9 @@ struct CacheTestSM : public RegressionSM {
   int check_result(int event);
   int complete(int event);
   int event_handler(int event, void *edata);
-  void make_request() {
+  void
+  make_request()
+  {
     start_time = ink_get_hrtime();
     make_request_internal();
   }
@@ -104,13 +101,21 @@ struct CacheTestSM : public RegressionSM {
   virtual int open_read_callout();
   virtual int open_write_callout();
 
-  void cancel_timeout() {
-    if (timeout) timeout->cancel();
+  void
+  cancel_timeout()
+  {
+    if (timeout)
+      timeout->cancel();
     timeout = 0;
   }
 
   // RegressionSM API
-  void run() { MUTEX_LOCK(lock, mutex, this_ethread()); timeout = eventProcessor.schedule_imm(this); }
+  void
+  run()
+  {
+    MUTEX_LOCK(lock, mutex, this_ethread());
+    timeout = eventProcessor.schedule_imm(this);
+  }
   virtual RegressionSM *clone() = 0;
 
   CacheTestSM(RegressionTest *t);
@@ -119,13 +124,20 @@ struct CacheTestSM : public RegressionSM {
 };
 
 // It is 2010 and C++ STILL doesn't have closures, a technology of the 1950s, unbelievable
-#define CACHE_SM(_t, _sm, _f)                \
-  struct CacheTestSM__##_sm : public CacheTestSM { \
-    void make_request_internal() _f \
-    CacheTestSM__##_sm(RegressionTest *t) : CacheTestSM(t) {} \
+#define CACHE_SM(_t, _sm, _f)                                               \
+  struct CacheTestSM__##_sm : public CacheTestSM {                          \
+    void                                                                    \
+    make_request_internal() _f CacheTestSM__##_sm(RegressionTest *t)        \
+      : CacheTestSM(t)                                                      \
+    {                                                                       \
+    }                                                                       \
     CacheTestSM__##_sm(const CacheTestSM__##_sm &xsm) : CacheTestSM(xsm) {} \
-    RegressionSM *clone() { return new CacheTestSM__##_sm(*this); } \
-} _sm(_t);
+    RegressionSM *                                                          \
+    clone()                                                                 \
+    {                                                                       \
+      return new CacheTestSM__##_sm(*this);                                 \
+    }                                                                       \
+  } _sm(_t);
 
 void force_link_CacheTest();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_CacheVol.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index 53f24c4..5545992 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -25,69 +25,67 @@
 #ifndef _P_CACHE_VOL_H__
 #define _P_CACHE_VOL_H__
 
-#define CACHE_BLOCK_SHIFT               9
-#define CACHE_BLOCK_SIZE                (1<<CACHE_BLOCK_SHIFT) // 512, smallest sector size
-#define ROUND_TO_STORE_BLOCK(_x)        INK_ALIGN((_x), STORE_BLOCK_SIZE)
-#define ROUND_TO_CACHE_BLOCK(_x)        INK_ALIGN((_x), CACHE_BLOCK_SIZE)
-#define ROUND_TO_SECTOR(_p, _x)         INK_ALIGN((_x), _p->sector_size)
-#define ROUND_TO(_x, _y)                INK_ALIGN((_x), (_y))
+#define CACHE_BLOCK_SHIFT 9
+#define CACHE_BLOCK_SIZE (1 << CACHE_BLOCK_SHIFT) // 512, smallest sector size
+#define ROUND_TO_STORE_BLOCK(_x) INK_ALIGN((_x), STORE_BLOCK_SIZE)
+#define ROUND_TO_CACHE_BLOCK(_x) INK_ALIGN((_x), CACHE_BLOCK_SIZE)
+#define ROUND_TO_SECTOR(_p, _x) INK_ALIGN((_x), _p->sector_size)
+#define ROUND_TO(_x, _y) INK_ALIGN((_x), (_y))
 
 // Vol (volumes)
-#define VOL_MAGIC                      0xF1D0F00D
-#define START_BLOCKS                    16      // 8k, STORE_BLOCK_SIZE
-#define START_POS                       ((off_t)START_BLOCKS * CACHE_BLOCK_SIZE)
-#define AGG_SIZE                        (4 * 1024 * 1024) // 4MB
-#define AGG_HIGH_WATER                  (AGG_SIZE / 2) // 2MB
-#define EVACUATION_SIZE                 (2 * AGG_SIZE)  // 8MB
-#define MAX_VOL_SIZE                   ((off_t)512 * 1024 * 1024 * 1024 * 1024)
-#define STORE_BLOCKS_PER_CACHE_BLOCK    (STORE_BLOCK_SIZE / CACHE_BLOCK_SIZE)
-#define MAX_VOL_BLOCKS                 (MAX_VOL_SIZE / CACHE_BLOCK_SIZE)
-#define MAX_FRAG_SIZE                   (AGG_SIZE - sizeofDoc) // true max
-#define LEAVE_FREE                      DEFAULT_MAX_BUFFER_SIZE
-#define PIN_SCAN_EVERY                  16      // scan every 1/16 of disk
-#define VOL_HASH_TABLE_SIZE             32707
-#define VOL_HASH_EMPTY                 0xFFFF
-#define VOL_HASH_ALLOC_SIZE             (8 * 1024 * 1024)  // one chance per this unit
-#define LOOKASIDE_SIZE                  256
-#define EVACUATION_BUCKET_SIZE          (2 * EVACUATION_SIZE) // 16MB
-#define RECOVERY_SIZE                   EVACUATION_SIZE // 8MB
-#define AIO_NOT_IN_PROGRESS             0
-#define AIO_AGG_WRITE_IN_PROGRESS       -1
-#define AUTO_SIZE_RAM_CACHE             -1      // 1-1 with directory size
-#define DEFAULT_TARGET_FRAGMENT_SIZE    (1048576 - sizeofDoc) // 1MB
-
-
-#define dir_offset_evac_bucket(_o) \
-  (_o / (EVACUATION_BUCKET_SIZE / CACHE_BLOCK_SIZE))
+#define VOL_MAGIC 0xF1D0F00D
+#define START_BLOCKS 16 // 8k, STORE_BLOCK_SIZE
+#define START_POS ((off_t)START_BLOCKS * CACHE_BLOCK_SIZE)
+#define AGG_SIZE (4 * 1024 * 1024)     // 4MB
+#define AGG_HIGH_WATER (AGG_SIZE / 2)  // 2MB
+#define EVACUATION_SIZE (2 * AGG_SIZE) // 8MB
+#define MAX_VOL_SIZE ((off_t)512 * 1024 * 1024 * 1024 * 1024)
+#define STORE_BLOCKS_PER_CACHE_BLOCK (STORE_BLOCK_SIZE / CACHE_BLOCK_SIZE)
+#define MAX_VOL_BLOCKS (MAX_VOL_SIZE / CACHE_BLOCK_SIZE)
+#define MAX_FRAG_SIZE (AGG_SIZE - sizeofDoc) // true max
+#define LEAVE_FREE DEFAULT_MAX_BUFFER_SIZE
+#define PIN_SCAN_EVERY 16 // scan every 1/16 of disk
+#define VOL_HASH_TABLE_SIZE 32707
+#define VOL_HASH_EMPTY 0xFFFF
+#define VOL_HASH_ALLOC_SIZE (8 * 1024 * 1024) // one chance per this unit
+#define LOOKASIDE_SIZE 256
+#define EVACUATION_BUCKET_SIZE (2 * EVACUATION_SIZE) // 16MB
+#define RECOVERY_SIZE EVACUATION_SIZE                // 8MB
+#define AIO_NOT_IN_PROGRESS 0
+#define AIO_AGG_WRITE_IN_PROGRESS -1
+#define AUTO_SIZE_RAM_CACHE -1                             // 1-1 with directory size
+#define DEFAULT_TARGET_FRAGMENT_SIZE (1048576 - sizeofDoc) // 1MB
+
+
+#define dir_offset_evac_bucket(_o) (_o / (EVACUATION_BUCKET_SIZE / CACHE_BLOCK_SIZE))
 #define dir_evac_bucket(_e) dir_offset_evac_bucket(dir_offset(_e))
 #define offset_evac_bucket(_d, _o) \
   dir_offset_evac_bucket((offset_to_vol_offset(_d, _o)
 
 // Documents
 
-#define DOC_MAGIC                       ((uint32_t)0x5F129B13)
-#define DOC_CORRUPT                     ((uint32_t)0xDEADBABE)
-#define DOC_NO_CHECKSUM                 ((uint32_t)0xA0B0C0D0)
+#define DOC_MAGIC ((uint32_t)0x5F129B13)
+#define DOC_CORRUPT ((uint32_t)0xDEADBABE)
+#define DOC_NO_CHECKSUM ((uint32_t)0xA0B0C0D0)
 
-#define sizeofDoc (((uint32_t)(uintptr_t)&((Doc*)0)->checksum)+(uint32_t)sizeof(uint32_t))
+#define sizeofDoc (((uint32_t)(uintptr_t) & ((Doc *)0)->checksum) + (uint32_t)sizeof(uint32_t))
 
 #if TS_USE_INTERIM_CACHE == 1
-struct InterimVolHeaderFooter
-{
+struct InterimVolHeaderFooter {
   unsigned int magic;
   VersionNumber version;
   time_t create_time;
   off_t write_pos;
   off_t last_write_pos;
   off_t agg_pos;
-  uint32_t generation;            // token generation (vary), this cannot be 0
+  uint32_t generation; // token generation (vary), this cannot be 0
   uint32_t phase;
   uint32_t cycle;
   uint32_t sync_serial;
   uint32_t write_serial;
   uint32_t dirty;
   uint32_t sector_size;
-  int32_t unused;                // pad out to 8 byte boundary
+  int32_t unused; // pad out to 8 byte boundary
 };
 #endif
 
@@ -98,22 +96,21 @@ struct VolInitInfo;
 struct DiskVol;
 struct CacheVol;
 
-struct VolHeaderFooter
-{
+struct VolHeaderFooter {
   unsigned int magic;
   VersionNumber version;
   time_t create_time;
   off_t write_pos;
   off_t last_write_pos;
   off_t agg_pos;
-  uint32_t generation;            // token generation (vary), this cannot be 0
+  uint32_t generation; // token generation (vary), this cannot be 0
   uint32_t phase;
   uint32_t cycle;
   uint32_t sync_serial;
   uint32_t write_serial;
   uint32_t dirty;
   uint32_t sector_size;
-  uint32_t unused;                // pad out to 8 byte boundary
+  uint32_t unused; // pad out to 8 byte boundary
 #if TS_USE_INTERIM_CACHE == 1
   InterimVolHeaderFooter interim_header[8];
 #endif
@@ -121,24 +118,20 @@ struct VolHeaderFooter
 };
 
 // Key and Earliest key for each fragment that needs to be evacuated
-struct EvacuationKey
-{
+struct EvacuationKey {
   SLink<EvacuationKey> link;
   CryptoHash key;
   CryptoHash earliest_key;
 };
 
-struct EvacuationBlock
-{
-  union
-  {
+struct EvacuationBlock {
+  union {
     unsigned int init;
-    struct
-    {
-      unsigned int done:1;              // has been evacuated
-      unsigned int pinned:1;            // check pinning timeout
-      unsigned int evacuate_head:1;     // check pinning timeout
-      unsigned int unused:29;
+    struct {
+      unsigned int done : 1;          // has been evacuated
+      unsigned int pinned : 1;        // check pinning timeout
+      unsigned int evacuate_head : 1; // check pinning timeout
+      unsigned int unused : 29;
     } f;
   };
 
@@ -152,7 +145,7 @@ struct EvacuationBlock
 };
 
 #if TS_USE_INTERIM_CACHE == 1
-#define MIGRATE_BUCKETS                 1021
+#define MIGRATE_BUCKETS 1021
 extern int migrate_threshold;
 extern int good_interim_disks;
 
@@ -160,11 +153,11 @@ extern int good_interim_disks;
 union AccessEntry {
   uintptr_t v[2];
   struct {
-    uint32_t  next;
-    uint32_t  prev;
-    uint32_t  index;
-    uint16_t  tag;
-    int16_t  count;
+    uint32_t next;
+    uint32_t prev;
+    uint32_t index;
+    uint16_t tag;
+    int16_t count;
   } item;
 };
 
@@ -177,31 +170,37 @@ struct AccessHistory {
 
   AccessEntry *freelist;
 
-  void freeEntry(AccessEntry *entry) {
-    entry->v[0] = (uintptr_t) freelist;
+  void
+  freeEntry(AccessEntry *entry)
+  {
+    entry->v[0] = (uintptr_t)freelist;
     entry->v[1] = 0xABCD1234U;
     freelist = entry;
   }
 
-  void init(int size, int hash_size) {
+  void
+  init(int size, int hash_size)
+  {
     this->size = size;
     this->hash_size = hash_size;
     freelist = NULL;
 
-    base = (AccessEntry *) malloc(sizeof(AccessEntry) * size);
-    hash = (uint32_t *) malloc (sizeof(uint32_t) * hash_size);
+    base = (AccessEntry *)malloc(sizeof(AccessEntry) * size);
+    hash = (uint32_t *)malloc(sizeof(uint32_t) * hash_size);
 
     memset(hash, 0, sizeof(uint32_t) * hash_size);
 
     base[0].item.next = base[0].item.prev = 0;
     base[0].v[1] = 0xABCD1234UL;
     for (int i = size; --i > 0;)
-     freeEntry(&base[i]);
+      freeEntry(&base[i]);
 
     return;
   }
 
-  void remove(AccessEntry *entry) {
+  void
+  remove(AccessEntry *entry)
+  {
     if (entry == &(base[base[0].item.prev])) { // head
       base[0].item.prev = entry->item.next;
     } else {
@@ -212,12 +211,14 @@ struct AccessHistory {
     } else {
       base[entry->item.next].item.prev = entry->item.prev;
     }
-    uint32_t hash_index = (uint32_t) (entry->item.index % hash_size);
+    uint32_t hash_index = (uint32_t)(entry->item.index % hash_size);
     hash[hash_index] = 0;
   }
 
-  void enqueue(AccessEntry *entry) {
-    uint32_t hash_index = (uint32_t) (entry->item.index % hash_size);
+  void
+  enqueue(AccessEntry *entry)
+  {
+    uint32_t hash_index = (uint32_t)(entry->item.index % hash_size);
     hash[hash_index] = entry - base;
 
     entry->item.prev = 0;
@@ -228,7 +229,9 @@ struct AccessHistory {
       base[0].item.next = entry - base;
   }
 
-  AccessEntry* dequeue() {
+  AccessEntry *
+  dequeue()
+  {
     AccessEntry *tail = &base[base[0].item.next];
     if (tail != base)
       remove(tail);
@@ -236,10 +239,12 @@ struct AccessHistory {
     return tail;
   }
 
-  void set_in_progress(CryptoHash *key) {
+  void
+  set_in_progress(CryptoHash *key)
+  {
     uint32_t key_index = key->slice32(3);
     uint16_t tag = static_cast<uint16_t>(key->slice32(1));
-    unsigned int hash_index = (uint32_t) (key_index % hash_size);
+    unsigned int hash_index = (uint32_t)(key_index % hash_size);
 
     uint32_t index = hash[hash_index];
     AccessEntry *entry = &base[index];
@@ -248,10 +253,12 @@ struct AccessHistory {
     }
   }
 
-  void set_not_in_progress(CryptoHash *key) {
+  void
+  set_not_in_progress(CryptoHash *key)
+  {
     uint32_t key_index = key->slice32(3);
     uint16_t tag = static_cast<uint16_t>(key->slice32(1));
-    unsigned int hash_index = (uint32_t) (key_index % hash_size);
+    unsigned int hash_index = (uint32_t)(key_index % hash_size);
 
     uint32_t index = hash[hash_index];
     AccessEntry *entry = &base[index];
@@ -260,10 +267,12 @@ struct AccessHistory {
     }
   }
 
-  void put_key(CryptoHash *key) {
+  void
+  put_key(CryptoHash *key)
+  {
     uint32_t key_index = key->slice32(3);
     uint16_t tag = static_cast<uint16_t>(key->slice32(1));
-    unsigned int hash_index = (uint32_t) (key_index % hash_size);
+    unsigned int hash_index = (uint32_t)(key_index % hash_size);
 
     uint32_t index = hash[hash_index];
     AccessEntry *entry = &base[index];
@@ -280,7 +289,7 @@ struct AccessHistory {
           }
         } else {
           entry = freelist;
-          freelist = (AccessEntry *) entry->v[0];
+          freelist = (AccessEntry *)entry->v[0];
         }
       } else { // collation
         remove(entry);
@@ -292,7 +301,9 @@ struct AccessHistory {
     }
   }
 
-  bool remove_key(CryptoHash *key) {
+  bool
+  remove_key(CryptoHash *key)
+  {
     unsigned int hash_index = static_cast<uint32_t>(key->slice32(3) % hash_size);
     uint32_t index = hash[hash_index];
     AccessEntry *entry = &base[index];
@@ -304,27 +315,27 @@ struct AccessHistory {
     return false;
   }
 
-  bool is_hot(CryptoHash *key) {
+  bool
+  is_hot(CryptoHash *key)
+  {
     uint32_t key_index = key->slice32(3);
-    uint16_t tag = (uint16_t) key->slice32(1);
-    unsigned int hash_index = (uint32_t) (key_index % hash_size);
+    uint16_t tag = (uint16_t)key->slice32(1);
+    unsigned int hash_index = (uint32_t)(key_index % hash_size);
 
     uint32_t index = hash[hash_index];
     AccessEntry *entry = &base[index];
 
-    return (index != 0 && entry->item.tag == tag && entry->item.index == key_index
-        && entry->item.count >= migrate_threshold);
+    return (index != 0 && entry->item.tag == tag && entry->item.index == key_index && entry->item.count >= migrate_threshold);
   }
 };
 
 struct InterimCacheVol;
 
-struct MigrateToInterimCache
-{
-  MigrateToInterimCache() { }
+struct MigrateToInterimCache {
+  MigrateToInterimCache() {}
   Ptr<IOBufferData> buf;
   uint32_t agg_len;
-  CacheKey  key;
+  CacheKey key;
   Dir dir;
   InterimCacheVol *interim_vol;
   CacheVC *vc;
@@ -335,8 +346,7 @@ struct MigrateToInterimCache
   LINK(MigrateToInterimCache, hash_link);
 };
 
-struct InterimCacheVol: public Continuation
-{
+struct InterimCacheVol : public Continuation {
   ats_scoped_str hash_text;
   InterimVolHeaderFooter *header;
 
@@ -347,7 +357,7 @@ struct InterimCacheVol: public Continuation
   bool recover_wrapped;
 
   off_t scan_pos;
-  off_t skip; // start of headers
+  off_t skip;  // start of headers
   off_t start; // start of data
   off_t len;
   off_t data_blocks;
@@ -362,26 +372,34 @@ struct InterimCacheVol: public Continuation
   Queue<MigrateToInterimCache, MigrateToInterimCache::Link_link> agg;
   int64_t transistor_range_threshold;
   bool sync;
-  bool is_io_in_progress() {
+  bool
+  is_io_in_progress()
+  {
     return io.aiocb.aio_fildes != AIO_NOT_IN_PROGRESS;
   }
 
   int recover_data();
   int handle_recover_from_data(int event, void *data);
 
-  void set_io_not_in_progress() {
+  void
+  set_io_not_in_progress()
+  {
     io.aiocb.aio_fildes = AIO_NOT_IN_PROGRESS;
   }
 
   int aggWrite(int event, void *e);
   int aggWriteDone(int event, void *e);
-  uint32_t round_to_approx_size (uint32_t l) {
+  uint32_t
+  round_to_approx_size(uint32_t l)
+  {
     uint32_t ll = round_to_approx_dir_size(l);
     return INK_ALIGN(ll, disk->hw_sector_size);
   }
 
-  void init(off_t s, off_t l, CacheDisk *interim, Vol *v, InterimVolHeaderFooter *hptr) {
-    char* seed_str = interim->hash_base_string ? interim->hash_base_string : interim->path;
+  void
+  init(off_t s, off_t l, CacheDisk *interim, Vol *v, InterimVolHeaderFooter *hptr)
+  {
+    char *seed_str = interim->hash_base_string ? interim->hash_base_string : interim->path;
     const size_t hash_seed_size = strlen(seed_str);
     const size_t hash_text_size = hash_seed_size + 32;
 
@@ -401,7 +419,7 @@ struct InterimCacheVol: public Continuation
     agg_todo_size = 0;
     agg_buf_pos = 0;
 
-    agg_buffer = (char *) ats_memalign(sysconf(_SC_PAGESIZE), AGG_SIZE);
+    agg_buffer = (char *)ats_memalign(sysconf(_SC_PAGESIZE), AGG_SIZE);
     memset(agg_buffer, 0, AGG_SIZE);
     this->mutex = ((Continuation *)vol)->mutex;
   }
@@ -414,8 +432,7 @@ void dir_clean_interimvol(InterimCacheVol *d);
 
 #endif
 
-struct Vol: public Continuation
-{
+struct Vol : public Continuation {
   char *path;
   ats_scoped_str hash_text;
   CryptoHash hash_id;
@@ -430,8 +447,8 @@ struct Vol: public Continuation
   off_t recover_pos;
   off_t prev_recover_pos;
   off_t scan_pos;
-  off_t skip;               // start of headers
-  off_t start;              // start of data
+  off_t skip;  // start of headers
+  off_t start; // start of data
   off_t len;
   off_t data_blocks;
   int hit_evacuate_window;
@@ -479,7 +496,9 @@ struct Vol: public Continuation
   volatile int interim_done;
 
 
-  bool migrate_probe(CacheKey *key, MigrateToInterimCache **result) {
+  bool
+  migrate_probe(CacheKey *key, MigrateToInterimCache **result)
+  {
     uint32_t indx = key->slice32(3) % MIGRATE_BUCKETS;
     MigrateToInterimCache *m = mig_hash[indx].head;
     while (m != NULL && !(m->key == *key)) {
@@ -490,17 +509,23 @@ struct Vol: public Continuation
     return m != NULL;
   }
 
-  void set_migrate_in_progress(MigrateToInterimCache *m) {
+  void
+  set_migrate_in_progress(MigrateToInterimCache *m)
+  {
     uint32_t indx = m->key.slice32(3) % MIGRATE_BUCKETS;
     mig_hash[indx].enqueue(m);
   }
 
-  void set_migrate_failed(MigrateToInterimCache *m) {
+  void
+  set_migrate_failed(MigrateToInterimCache *m)
+  {
     uint32_t indx = m->key.slice32(3) % MIGRATE_BUCKETS;
     mig_hash[indx].remove(m);
   }
 
-  void set_migrate_done(MigrateToInterimCache *m) {
+  void
+  set_migrate_done(MigrateToInterimCache *m)
+  {
     uint32_t indx = m->key.slice32(3) % MIGRATE_BUCKETS;
     mig_hash[indx].remove(m);
     history.remove_key(&m->key);
@@ -543,11 +568,13 @@ struct Vol: public Continuation
   int dir_check(bool fix);
   int db_check(bool fix);
 
-  int is_io_in_progress()
+  int
+  is_io_in_progress()
   {
     return io.aiocb.aio_fildes != AIO_NOT_IN_PROGRESS;
   }
-  int increment_generation()
+  int
+  increment_generation()
   {
     // this is stored in the offset field of the directory (!=0)
     ink_assert(mutex->thread_holding == this_ethread());
@@ -556,7 +583,8 @@ struct Vol: public Continuation
       header->generation++;
     return header->generation;
   }
-  void set_io_not_in_progress()
+  void
+  set_io_not_in_progress()
   {
     io.aiocb.aio_fildes = AIO_NOT_IN_PROGRESS;
   }
@@ -579,33 +607,27 @@ struct Vol: public Continuation
   uint32_t round_to_approx_size(uint32_t l);
 
   Vol()
-    : Continuation(new_ProxyMutex()), path(NULL), fd(-1),
-      dir(0), buckets(0), recover_pos(0), prev_recover_pos(0), scan_pos(0), skip(0), start(0),
-      len(0), data_blocks(0), hit_evacuate_window(0), agg_todo_size(0), agg_buf_pos(0), trigger(0),
-      evacuate_size(0), disk(NULL), last_sync_serial(0), last_write_serial(0), recover_wrapped(false),
-      dir_sync_waiting(0), dir_sync_in_progress(0), writing_end_marker(0) {
+    : Continuation(new_ProxyMutex()), path(NULL), fd(-1), dir(0), buckets(0), recover_pos(0), prev_recover_pos(0), scan_pos(0),
+      skip(0), start(0), len(0), data_blocks(0), hit_evacuate_window(0), agg_todo_size(0), agg_buf_pos(0), trigger(0),
+      evacuate_size(0), disk(NULL), last_sync_serial(0), last_write_serial(0), recover_wrapped(false), dir_sync_waiting(0),
+      dir_sync_in_progress(0), writing_end_marker(0)
+  {
     open_dir.mutex = mutex;
     agg_buffer = (char *)ats_memalign(ats_pagesize(), AGG_SIZE);
     memset(agg_buffer, 0, AGG_SIZE);
     SET_HANDLER(&Vol::aggWrite);
   }
 
-  ~Vol() {
-    ats_memalign_free(agg_buffer);
-  }
+  ~Vol() { ats_memalign_free(agg_buffer); }
 };
 
-struct AIO_Callback_handler: public Continuation
-{
+struct AIO_Callback_handler : public Continuation {
   int handle_disk_failure(int event, void *data);
 
-  AIO_Callback_handler():Continuation(new_ProxyMutex()) {
-    SET_HANDLER(&AIO_Callback_handler::handle_disk_failure);
-  }
+  AIO_Callback_handler() : Continuation(new_ProxyMutex()) { SET_HANDLER(&AIO_Callback_handler::handle_disk_failure); }
 };
 
-struct CacheVol
-{
+struct CacheVol {
   int vol_number;
   int scheme;
   off_t size;
@@ -616,28 +638,25 @@ struct CacheVol
   // per volume stats
   RecRawStatBlock *vol_rsb;
 
-  CacheVol()
-    : vol_number(-1), scheme(0), size(0), num_vols(0), vols(NULL), disk_vols(0), vol_rsb(0)
-  { }
+  CacheVol() : vol_number(-1), scheme(0), size(0), num_vols(0), vols(NULL), disk_vols(0), vol_rsb(0) {}
 };
 
 // Note : hdr() needs to be 8 byte aligned.
 // If you change this, change sizeofDoc above
-struct Doc
-{
-  uint32_t magic;         // DOC_MAGIC
-  uint32_t len;           // length of this fragment (including hlen & sizeof(Doc), unrounded)
-  uint64_t total_len;     // total length of document
-  CryptoHash first_key;    ///< first key in object.
-  CryptoHash key; ///< Key for this doc.
-  uint32_t hlen; ///< Length of this header.
-  uint32_t doc_type:8;       ///< Doc type - indicates the format of this structure and its content.
-  uint32_t v_major:8;   ///< Major version number.
-  uint32_t v_minor:8; ///< Minor version number.
-  uint32_t unused:8; ///< Unused, forced to zero.
+struct Doc {
+  uint32_t magic;        // DOC_MAGIC
+  uint32_t len;          // length of this fragment (including hlen & sizeof(Doc), unrounded)
+  uint64_t total_len;    // total length of document
+  CryptoHash first_key;  ///< first key in object.
+  CryptoHash key;        ///< Key for this doc.
+  uint32_t hlen;         ///< Length of this header.
+  uint32_t doc_type : 8; ///< Doc type - indicates the format of this structure and its content.
+  uint32_t v_major : 8;  ///< Major version number.
+  uint32_t v_minor : 8;  ///< Minor version number.
+  uint32_t unused : 8;   ///< Unused, forced to zero.
   uint32_t sync_serial;
   uint32_t write_serial;
-  uint32_t pinned;        // pinned until
+  uint32_t pinned; // pinned until
   uint32_t checksum;
 
   uint32_t data_len();
@@ -660,16 +679,16 @@ extern unsigned short *vol_hash_table;
 // inline Functions
 
 TS_INLINE int
-vol_headerlen(Vol *d) {
-  return ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter) + sizeof(uint16_t) * (d->segments-1));
+vol_headerlen(Vol *d)
+{
+  return ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter) + sizeof(uint16_t) * (d->segments - 1));
 }
 
 TS_INLINE size_t
 vol_dirlen(Vol *d)
 {
-  return vol_headerlen(d) +
-    ROUND_TO_STORE_BLOCK(((size_t)d->buckets) * DIR_DEPTH * d->segments * SIZEOF_DIR) +
-    ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter));
+  return vol_headerlen(d) + ROUND_TO_STORE_BLOCK(((size_t)d->buckets) * DIR_DEPTH * d->segments * SIZEOF_DIR) +
+         ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter));
 }
 
 TS_INLINE int
@@ -679,39 +698,31 @@ vol_direntries(Vol *d)
 }
 
 #if TS_USE_INTERIM_CACHE == 1
-#define vol_out_of_phase_valid(d, e)            \
-    (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start) / CACHE_BLOCK_SIZE))
+#define vol_out_of_phase_valid(d, e) (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start) / CACHE_BLOCK_SIZE))
 
-#define vol_out_of_phase_agg_valid(d, e)        \
-    (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start + AGG_SIZE) / CACHE_BLOCK_SIZE))
+#define vol_out_of_phase_agg_valid(d, e) (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start + AGG_SIZE) / CACHE_BLOCK_SIZE))
 
-#define vol_out_of_phase_write_valid(d, e)      \
-    (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start + AGG_SIZE) / CACHE_BLOCK_SIZE))
+#define vol_out_of_phase_write_valid(d, e) (dir_offset(e) - 1 >= ((d->header->agg_pos - d->start + AGG_SIZE) / CACHE_BLOCK_SIZE))
 
-#define vol_in_phase_valid(d, e)                \
-    (dir_offset(e) - 1 < ((d->header->write_pos + d->agg_buf_pos - d->start) / CACHE_BLOCK_SIZE))
+#define vol_in_phase_valid(d, e) (dir_offset(e) - 1 < ((d->header->write_pos + d->agg_buf_pos - d->start) / CACHE_BLOCK_SIZE))
 
-#define vol_offset_to_offset(d, pos)            \
-    (d->start + pos * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE)
+#define vol_offset_to_offset(d, pos) (d->start + pos * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE)
 
-#define vol_dir_segment(d, s)                   \
-    (Dir *) (((char *) d->dir) + (s * d->buckets) * DIR_DEPTH * SIZEOF_DIR)
+#define vol_dir_segment(d, s) (Dir *)(((char *)d->dir) + (s * d->buckets) * DIR_DEPTH * SIZEOF_DIR)
 
-#define offset_to_vol_offset(d, pos)            \
-    ((pos - d->start + CACHE_BLOCK_SIZE) / CACHE_BLOCK_SIZE)
+#define offset_to_vol_offset(d, pos) ((pos - d->start + CACHE_BLOCK_SIZE) / CACHE_BLOCK_SIZE)
 
-#define vol_offset(d, e)                        \
-    ((d)->start + (off_t) ((off_t)dir_offset(e) * CACHE_BLOCK_SIZE) - CACHE_BLOCK_SIZE)
+#define vol_offset(d, e) ((d)->start + (off_t)((off_t)dir_offset(e) * CACHE_BLOCK_SIZE) - CACHE_BLOCK_SIZE)
 
-#define vol_in_phase_agg_buf_valid(d, e)        \
-    ((vol_offset(d, e) >= d->header->write_pos) && vol_offset(d, e) < (d->header->write_pos + d->agg_buf_pos))
+#define vol_in_phase_agg_buf_valid(d, e) \
+  ((vol_offset(d, e) >= d->header->write_pos) && vol_offset(d, e) < (d->header->write_pos + d->agg_buf_pos))
 
-#define vol_transistor_range_valid(d, e)    \
-  ((d->header->agg_pos + d->transistor_range_threshold < d->start + d->len) ? \
-      (vol_out_of_phase_write_valid(d, e) && \
-      (dir_offset(e) <= ((d->header->agg_pos - d->start + d->transistor_range_threshold) / CACHE_BLOCK_SIZE))) : \
-      ((dir_offset(e) <= ((d->header->agg_pos - d->start + d->transistor_range_threshold - d->len) / CACHE_BLOCK_SIZE)) || \
-          (dir_offset(e) > ((d->header->agg_pos - d->start) / CACHE_BLOCK_SIZE))))
+#define vol_transistor_range_valid(d, e)                                                                                  \
+  ((d->header->agg_pos + d->transistor_range_threshold < d->start + d->len) ?                                             \
+     (vol_out_of_phase_write_valid(d, e) &&                                                                               \
+      (dir_offset(e) <= ((d->header->agg_pos - d->start + d->transistor_range_threshold) / CACHE_BLOCK_SIZE))) :          \
+     ((dir_offset(e) <= ((d->header->agg_pos - d->start + d->transistor_range_threshold - d->len) / CACHE_BLOCK_SIZE)) || \
+      (dir_offset(e) > ((d->header->agg_pos - d->start) / CACHE_BLOCK_SIZE))))
 
 
 #else
@@ -742,7 +753,7 @@ vol_in_phase_valid(Vol *d, Dir *e)
 TS_INLINE off_t
 vol_offset(Vol *d, Dir *e)
 {
-  return d->start + (off_t) dir_offset(e) * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE;
+  return d->start + (off_t)dir_offset(e) * CACHE_BLOCK_SIZE - CACHE_BLOCK_SIZE;
 }
 
 TS_INLINE off_t
@@ -760,7 +771,7 @@ vol_offset_to_offset(Vol *d, off_t pos)
 TS_INLINE Dir *
 vol_dir_segment(Vol *d, int s)
 {
-  return (Dir *) (((char *) d->dir) + (s * d->buckets) * DIR_DEPTH * SIZEOF_DIR);
+  return (Dir *)(((char *)d->dir) + (s * d->buckets) * DIR_DEPTH * SIZEOF_DIR);
 }
 
 TS_INLINE int
@@ -773,7 +784,7 @@ vol_in_phase_agg_buf_valid(Vol *d, Dir *e)
 TS_INLINE off_t
 vol_relative_length(Vol *v, off_t start_offset)
 {
-   return (v->len + v->skip) - start_offset;
+  return (v->len + v->skip) - start_offset;
 }
 
 TS_INLINE uint32_t
@@ -797,13 +808,13 @@ Doc::single_fragment()
 TS_INLINE char *
 Doc::hdr()
 {
-  return reinterpret_cast<char*>(this) + sizeofDoc;
+  return reinterpret_cast<char *>(this) + sizeofDoc;
 }
 
 TS_INLINE char *
 Doc::data()
 {
-  return this->hdr() +  hlen;
+  return this->hdr() + hlen;
 }
 
 int vol_dir_clear(Vol *d);
@@ -872,64 +883,67 @@ Vol::within_hit_evacuate_window(Dir *xdir)
 }
 
 TS_INLINE uint32_t
-Vol::round_to_approx_size(uint32_t l) {
+Vol::round_to_approx_size(uint32_t l)
+{
   uint32_t ll = round_to_approx_dir_size(l);
   return ROUND_TO_SECTOR(this, ll);
 }
 
 #if TS_USE_INTERIM_CACHE == 1
 inline bool
-dir_valid(Vol *_d, Dir *_e) {
+dir_valid(Vol *_d, Dir *_e)
+{
   if (!dir_ininterim(_e))
-    return _d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) :
-        vol_out_of_phase_valid(_d, _e);
+    return _d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : vol_out_of_phase_valid(_d, _e);
   else {
     int idx = dir_get_index(_e);
-    if (good_interim_disks <= 0 || idx >= _d->num_interim_vols) return false;
+    if (good_interim_disks <= 0 || idx >= _d->num_interim_vols)
+      return false;
     InterimCacheVol *sv = &(_d->interim_vols[idx]);
-    return !DISK_BAD(sv->disk) ? (sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) :
-        vol_out_of_phase_valid(sv, _e)) : false;
+    return !DISK_BAD(sv->disk) ?
+             (sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) : vol_out_of_phase_valid(sv, _e)) :
+             false;
   }
 }
 
 inline bool
-dir_valid(InterimCacheVol *_d, Dir *_e) {
+dir_valid(InterimCacheVol *_d, Dir *_e)
+{
   if (!dir_ininterim(_e))
     return true;
   InterimCacheVol *sv = &(_d->vol->interim_vols[dir_get_index(_e)]);
   if (_d != sv)
     return true;
-  return !DISK_BAD(sv->disk) ? (sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) :
-      vol_out_of_phase_valid(sv, _e)) : false;
-
+  return !DISK_BAD(sv->disk) ? (sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) : vol_out_of_phase_valid(sv, _e)) :
+                               false;
 }
 
 inline bool
-dir_agg_valid(Vol *_d, Dir *_e) {
+dir_agg_valid(Vol *_d, Dir *_e)
+{
   if (!dir_ininterim(_e))
-    return _d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) :
-        vol_out_of_phase_agg_valid(_d, _e);
+    return _d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : vol_out_of_phase_agg_valid(_d, _e);
   else {
     int idx = dir_get_index(_e);
-    if(good_interim_disks <= 0 || idx >= _d->num_interim_vols) return false;
+    if (good_interim_disks <= 0 || idx >= _d->num_interim_vols)
+      return false;
     InterimCacheVol *sv = &(_d->interim_vols[idx]);
-    return sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) :
-        vol_out_of_phase_agg_valid(sv, _e);
+    return sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) : vol_out_of_phase_agg_valid(sv, _e);
   }
 }
 inline bool
-dir_write_valid(Vol *_d, Dir *_e) {
+dir_write_valid(Vol *_d, Dir *_e)
+{
   if (!dir_ininterim(_e))
-    return _d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) :
-        vol_out_of_phase_write_valid(_d, _e);
+    return _d->header->phase == dir_phase(_e) ? vol_in_phase_valid(_d, _e) : vol_out_of_phase_write_valid(_d, _e);
   else {
     InterimCacheVol *sv = &(_d->interim_vols[dir_get_index(_e)]);
-    return sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) :
-        vol_out_of_phase_write_valid(sv, _e);
+    return sv->header->phase == dir_phase(_e) ? vol_in_phase_valid(sv, _e) : vol_out_of_phase_write_valid(sv, _e);
   }
 }
 inline bool
-dir_agg_buf_valid(Vol *_d, Dir *_e) {
+dir_agg_buf_valid(Vol *_d, Dir *_e)
+{
   if (!dir_ininterim(_e))
     return _d->header->phase == dir_phase(_e) && vol_in_phase_agg_buf_valid(_d, _e);
   else {
@@ -939,7 +953,8 @@ dir_agg_buf_valid(Vol *_d, Dir *_e) {
 }
 
 inline bool
-dir_agg_buf_valid(InterimCacheVol *_d, Dir *_e) {
+dir_agg_buf_valid(InterimCacheVol *_d, Dir *_e)
+{
   return _d->header->phase == dir_phase(_e) && vol_in_phase_agg_buf_valid(_d, _e);
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/P_RamCache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_RamCache.h b/iocore/cache/P_RamCache.h
index 9a0ae68..d4350fa 100644
--- a/iocore/cache/P_RamCache.h
+++ b/iocore/cache/P_RamCache.h
@@ -31,11 +31,12 @@
 struct RamCache {
   // returns 1 on found/stored, 0 on not found/stored, if provided auxkey1 and auxkey2 must match
   virtual int get(INK_MD5 *key, Ptr<IOBufferData> *ret_data, uint32_t auxkey1 = 0, uint32_t auxkey2 = 0) = 0;
-  virtual int put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool copy = false, uint32_t auxkey1 = 0, uint32_t auxkey2 = 0) = 0;
+  virtual int put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool copy = false, uint32_t auxkey1 = 0,
+                  uint32_t auxkey2 = 0) = 0;
   virtual int fixup(INK_MD5 *key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1, uint32_t new_auxkey2) = 0;
 
   virtual void init(int64_t max_bytes, Vol *vol) = 0;
-  virtual ~RamCache() {};
+  virtual ~RamCache(){};
 };
 
 RamCache *new_RamCacheLRU();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/RamCacheCLFUS.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/RamCacheCLFUS.cc b/iocore/cache/RamCacheCLFUS.cc
index a1bfd79..6cfce51 100644
--- a/iocore/cache/RamCacheCLFUS.cc
+++ b/iocore/cache/RamCacheCLFUS.cc
@@ -34,14 +34,14 @@
 #endif
 
 #define REQUIRED_COMPRESSION 0.9 // must get to this size or declared incompressible
-#define REQUIRED_SHRINK 0.8 // must get to this size or keep orignal buffer (with padding)
-#define HISTORY_HYSTERIA 10 // extra temporary history
-#define ENTRY_OVERHEAD 256 // per-entry overhead to consider when computing cache value/size
+#define REQUIRED_SHRINK 0.8      // must get to this size or keep orignal buffer (with padding)
+#define HISTORY_HYSTERIA 10      // extra temporary history
+#define ENTRY_OVERHEAD 256       // per-entry overhead to consider when computing cache value/size
 #define LZMA_BASE_MEMLIMIT (64 * 1024 * 1024)
 //#define CHECK_ACOUNTING 1 // very expensive double checking of all sizes
 
 #define REQUEUE_HITS(_h) ((_h) ? 1 : 0)
-#define CACHE_VALUE_HITS_SIZE(_h, _s) ((float)((_h)+1) / ((_s) + ENTRY_OVERHEAD))
+#define CACHE_VALUE_HITS_SIZE(_h, _s) ((float)((_h) + 1) / ((_s) + ENTRY_OVERHEAD))
 #define CACHE_VALUE(_x) CACHE_VALUE_HITS_SIZE((_x)->hits, (_x)->size)
 
 struct RamCacheCLFUSEntry {
@@ -54,10 +54,10 @@ struct RamCacheCLFUSEntry {
   uint32_t compressed_len;
   union {
     struct {
-      uint32_t compressed:3; // compression type
-      uint32_t incompressible:1;
-      uint32_t lru:1;
-      uint32_t copy:1; // copy-in-copy-out
+      uint32_t compressed : 3; // compression type
+      uint32_t incompressible : 1;
+      uint32_t lru : 1;
+      uint32_t copy : 1; // copy-in-copy-out
     } flag_bits;
     uint32_t flags;
   };
@@ -83,7 +83,7 @@ struct RamCacheCLFUS : public RamCache {
   int64_t history;
   int ibuckets;
   int nbuckets;
-  DList(RamCacheCLFUSEntry, hash_link) *bucket;
+  DList(RamCacheCLFUSEntry, hash_link) * bucket;
   Que(RamCacheCLFUSEntry, lru_link) lru[2];
   uint16_t *seen;
   int ncompressed;
@@ -93,43 +93,43 @@ struct RamCacheCLFUS : public RamCache {
   void victimize(RamCacheCLFUSEntry *e);
   void move_compressed(RamCacheCLFUSEntry *e);
   RamCacheCLFUSEntry *destroy(RamCacheCLFUSEntry *e);
-  void requeue_victims(Que(RamCacheCLFUSEntry, lru_link) &victims);
+  void requeue_victims(Que(RamCacheCLFUSEntry, lru_link) & victims);
   void tick(); // move CLOCK on history
-  RamCacheCLFUS(): max_bytes(0), bytes(0), objects(0), vol(0), history(0), ibuckets(0), nbuckets(0), bucket(0),
-              seen(0), ncompressed(0), compressed(0) { }
+  RamCacheCLFUS()
+    : max_bytes(0), bytes(0), objects(0), vol(0), history(0), ibuckets(0), nbuckets(0), bucket(0), seen(0), ncompressed(0),
+      compressed(0)
+  {
+  }
 };
 
-class RamCacheCLFUSCompressor : public Continuation {
+class RamCacheCLFUSCompressor : public Continuation
+{
 public:
   RamCacheCLFUS *rc;
   int mainEvent(int event, Event *e);
 
-  RamCacheCLFUSCompressor(RamCacheCLFUS *arc)
-    : rc(arc)
-  {
-    SET_HANDLER(&RamCacheCLFUSCompressor::mainEvent);
-  }
+  RamCacheCLFUSCompressor(RamCacheCLFUS *arc) : rc(arc) { SET_HANDLER(&RamCacheCLFUSCompressor::mainEvent); }
 };
 
 int
 RamCacheCLFUSCompressor::mainEvent(int /* event ATS_UNUSED */, Event *e)
 {
   switch (cache_config_ram_cache_compress) {
-    default:
-      Warning("unknown RAM cache compression type: %d", cache_config_ram_cache_compress);
-    case CACHE_COMPRESSION_NONE:
-    case CACHE_COMPRESSION_FASTLZ:
-      break;
-    case CACHE_COMPRESSION_LIBZ:
-#if ! TS_HAS_LIBZ
-      Warning("libz not available for RAM cache compression");
+  default:
+    Warning("unknown RAM cache compression type: %d", cache_config_ram_cache_compress);
+  case CACHE_COMPRESSION_NONE:
+  case CACHE_COMPRESSION_FASTLZ:
+    break;
+  case CACHE_COMPRESSION_LIBZ:
+#if !TS_HAS_LIBZ
+    Warning("libz not available for RAM cache compression");
 #endif
-      break;
-    case CACHE_COMPRESSION_LIBLZMA:
-#if ! TS_HAS_LZMA
-      Warning("lzma not available for RAM cache compression");
+    break;
+  case CACHE_COMPRESSION_LIBLZMA:
+#if !TS_HAS_LZMA
+    Warning("lzma not available for RAM cache compression");
 #endif
-      break;
+    break;
   }
   if (cache_config_ram_cache_compress_percent)
     rc->compress_entries(e->ethread);
@@ -138,11 +138,9 @@ RamCacheCLFUSCompressor::mainEvent(int /* event ATS_UNUSED */, Event *e)
 
 ClassAllocator<RamCacheCLFUSEntry> ramCacheCLFUSEntryAllocator("RamCacheCLFUSEntry");
 
-static const int bucket_sizes[] = {
-  127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139,
-  524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
-  134217689, 268435399, 536870909, 1073741789, 2147483647
-};
+static const int bucket_sizes[] = {127,      251,      509,       1021,      2039,      4093,       8191,      16381,   32749,
+                                   65521,    131071,   262139,    524287,    1048573,   2097143,    4194301,   8388593, 16777213,
+                                   33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647};
 
 void
 RamCacheCLFUS::resize_hashtable()
@@ -165,7 +163,7 @@ RamCacheCLFUS::resize_hashtable()
   ats_free(seen);
   if (cache_config_ram_cache_use_seen_filter) {
     int size = bucket_sizes[ibuckets] * sizeof(uint16_t);
-    seen = (uint16_t*)ats_malloc(size);
+    seen = (uint16_t *)ats_malloc(size);
     memset(seen, 0, size);
   }
 }
@@ -184,13 +182,21 @@ RamCacheCLFUS::init(int64_t abytes, Vol *avol)
 }
 
 #ifdef CHECK_ACOUNTING
-static void check_accounting(RamCacheCLFUS *c)
+static void
+check_accounting(RamCacheCLFUS *c)
 {
   int64_t x = 0, xsize = 0, h = 0;
   RamCacheCLFUSEntry *y = c->lru[0].head;
-  while (y) { x++; xsize += y->size + ENTRY_OVERHEAD; y = y->lru_link.next; }
+  while (y) {
+    x++;
+    xsize += y->size + ENTRY_OVERHEAD;
+    y = y->lru_link.next;
+  }
   y = c->lru[1].head;
-  while (y) { h++; y = y->lru_link.next; }
+  while (y) {
+    h++;
+    y = y->lru_link.next;
+  }
   ink_assert(x == c->objects);
   ink_assert(xsize == c->bytes);
   ink_assert(h == c->history);
@@ -215,32 +221,33 @@ RamCacheCLFUS::get(INK_MD5 *key, Ptr<IOBufferData> *ret_data, uint32_t auxkey1,
       if (!e->flag_bits.lru) { // in memory
         e->hits++;
         if (e->flag_bits.compressed) {
-          b = (char*)ats_malloc(e->len);
+          b = (char *)ats_malloc(e->len);
           switch (e->flag_bits.compressed) {
-            default: goto Lfailed;
-            case CACHE_COMPRESSION_FASTLZ: {
-              int l = (int)e->len;
-              if ((l != (int)fastlz_decompress(e->data->data(), e->compressed_len, b, l)))
-                goto Lfailed;
-              break;
-            }
+          default:
+            goto Lfailed;
+          case CACHE_COMPRESSION_FASTLZ: {
+            int l = (int)e->len;
+            if ((l != (int)fastlz_decompress(e->data->data(), e->compressed_len, b, l)))
+              goto Lfailed;
+            break;
+          }
 #if TS_HAS_LIBZ
-            case CACHE_COMPRESSION_LIBZ: {
-              uLongf l = e->len;
-              if (Z_OK != uncompress((Bytef*)b, &l, (Bytef*)e->data->data(), e->compressed_len))
-                goto Lfailed;
-              break;
-            }
+          case CACHE_COMPRESSION_LIBZ: {
+            uLongf l = e->len;
+            if (Z_OK != uncompress((Bytef *)b, &l, (Bytef *)e->data->data(), e->compressed_len))
+              goto Lfailed;
+            break;
+          }
 #endif
 #if TS_HAS_LZMA
-            case CACHE_COMPRESSION_LIBLZMA: {
-              size_t l = (size_t)e->len, ipos = 0, opos = 0;
-              uint64_t memlimit = e->len * 2 + LZMA_BASE_MEMLIMIT;
-              if (LZMA_OK != lzma_stream_buffer_decode(
-                    &memlimit, 0, NULL, (uint8_t*)e->data->data(), &ipos, e->compressed_len, (uint8_t*)b, &opos, l))
-                goto Lfailed;
-              break;
-            }
+          case CACHE_COMPRESSION_LIBLZMA: {
+            size_t l = (size_t)e->len, ipos = 0, opos = 0;
+            uint64_t memlimit = e->len * 2 + LZMA_BASE_MEMLIMIT;
+            if (LZMA_OK != lzma_stream_buffer_decode(&memlimit, 0, NULL, (uint8_t *)e->data->data(), &ipos, e->compressed_len,
+                                                     (uint8_t *)b, &opos, l))
+              goto Lfailed;
+            break;
+          }
 #endif
           }
           IOBufferData *data = new_xmalloc_IOBufferData(b, e->len);
@@ -286,7 +293,9 @@ Lfailed:
   goto Lerror;
 }
 
-void RamCacheCLFUS::tick() {
+void
+RamCacheCLFUS::tick()
+{
   RamCacheCLFUSEntry *e = lru[1].dequeue();
   if (!e)
     return;
@@ -378,13 +387,20 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
       uint32_t l = 0;
       int ctype = cache_config_ram_cache_compress;
       switch (ctype) {
-        default: goto Lcontinue;
-        case CACHE_COMPRESSION_FASTLZ: l = (uint32_t)((double)e->len * 1.05 + 66); break;
+      default:
+        goto Lcontinue;
+      case CACHE_COMPRESSION_FASTLZ:
+        l = (uint32_t)((double)e->len * 1.05 + 66);
+        break;
 #if TS_HAS_LIBZ
-        case CACHE_COMPRESSION_LIBZ: l = (uint32_t)compressBound(e->len); break;
+      case CACHE_COMPRESSION_LIBZ:
+        l = (uint32_t)compressBound(e->len);
+        break;
 #endif
 #if TS_HAS_LZMA
-        case CACHE_COMPRESSION_LIBLZMA: l = e->len; break;
+      case CACHE_COMPRESSION_LIBLZMA:
+        l = e->len;
+        break;
 #endif
       }
       // store transient data for lock release
@@ -392,33 +408,35 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
       uint32_t elen = e->len;
       INK_MD5 key = e->key;
       MUTEX_UNTAKE_LOCK(vol->mutex, thread);
-      b = (char*)ats_malloc(l);
+      b = (char *)ats_malloc(l);
       bool failed = false;
       switch (ctype) {
-        default: goto Lfailed;
-        case CACHE_COMPRESSION_FASTLZ:
-          if (e->len < 16) goto Lfailed;
-          if ((l = fastlz_compress(edata->data(), elen, b)) <= 0)
-            failed = true;
-          break;
+      default:
+        goto Lfailed;
+      case CACHE_COMPRESSION_FASTLZ:
+        if (e->len < 16)
+          goto Lfailed;
+        if ((l = fastlz_compress(edata->data(), elen, b)) <= 0)
+          failed = true;
+        break;
 #if TS_HAS_LIBZ
-        case CACHE_COMPRESSION_LIBZ: {
-          uLongf ll = l;
-          if ((Z_OK != compress((Bytef*)b, &ll, (Bytef*)edata->data(), elen)))
-            failed = true;
-          l = (int)ll;
-          break;
-        }
+      case CACHE_COMPRESSION_LIBZ: {
+        uLongf ll = l;
+        if ((Z_OK != compress((Bytef *)b, &ll, (Bytef *)edata->data(), elen)))
+          failed = true;
+        l = (int)ll;
+        break;
+      }
 #endif
 #if TS_HAS_LZMA
-        case CACHE_COMPRESSION_LIBLZMA: {
-          size_t pos = 0, ll = l;
-          if (LZMA_OK != lzma_easy_buffer_encode(LZMA_PRESET_DEFAULT, LZMA_CHECK_NONE, NULL,
-                                                 (uint8_t*)edata->data(), elen, (uint8_t*)b, &pos, ll))
-            failed = true;
-          l = (int)pos;
-          break;
-        }
+      case CACHE_COMPRESSION_LIBLZMA: {
+        size_t pos = 0, ll = l;
+        if (LZMA_OK != lzma_easy_buffer_encode(LZMA_PRESET_DEFAULT, LZMA_CHECK_NONE, NULL, (uint8_t *)edata->data(), elen,
+                                               (uint8_t *)b, &pos, ll))
+          failed = true;
+        l = (int)pos;
+        break;
+      }
 #endif
       }
       MUTEX_TAKE_LOCK(vol->mutex, thread);
@@ -429,7 +447,8 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
         uint32_t i = key.slice32(3) % nbuckets;
         RamCacheCLFUSEntry *ee = bucket[i].head;
         while (ee) {
-          if (ee->key == key && ee->data == edata) break;
+          if (ee->key == key && ee->data == edata)
+            break;
           ee = ee->hash_link.next;
         }
         if (!ee || ee != e) {
@@ -443,7 +462,7 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
         goto Lfailed;
       if (l < e->len) {
         e->flag_bits.compressed = cache_config_ram_cache_compress;
-        bb = (char*)ats_malloc(l);
+        bb = (char *)ats_malloc(l);
         memcpy(bb, b, l);
         ats_free(b);
         e->compressed_len = l;
@@ -454,7 +473,7 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
       } else {
         ats_free(b);
         e->flag_bits.compressed = 0;
-        bb = (char*)ats_malloc(e->len);
+        bb = (char *)ats_malloc(e->len);
         memcpy(bb, e->data->data(), e->len);
         int64_t delta = ((int64_t)e->len) - (int64_t)e->size;
         bytes += delta;
@@ -470,11 +489,10 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
   Lfailed:
     ats_free(b);
     e->flag_bits.incompressible = 1;
-  Lcontinue:;
-    DDebug("ram_cache", "compress %X %d %d %d %d %d %d %d",
-           e->key.slice32(3), e->auxkey1, e->auxkey2,
-           e->flag_bits.incompressible, e->flag_bits.compressed,
-           e->len, e->compressed_len, ncompressed);
+  Lcontinue:
+    ;
+    DDebug("ram_cache", "compress %X %d %d %d %d %d %d %d", e->key.slice32(3), e->auxkey1, e->auxkey2, e->flag_bits.incompressible,
+           e->flag_bits.compressed, e->len, e->compressed_len, ncompressed);
     if (!e->lru_link.next)
       break;
     compressed = e->lru_link.next;
@@ -484,8 +502,7 @@ RamCacheCLFUS::compress_entries(EThread *thread, int do_at_most)
   return;
 }
 
-void
-RamCacheCLFUS::requeue_victims(Que(RamCacheCLFUSEntry, lru_link) &victims)
+void RamCacheCLFUS::requeue_victims(Que(RamCacheCLFUSEntry, lru_link) & victims)
 {
   RamCacheCLFUSEntry *victim = 0;
   while ((victim = victims.dequeue())) {
@@ -528,7 +545,7 @@ RamCacheCLFUS::put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool copy, ui
         e->size = size;
         e->data = data;
       } else {
-        char *b = (char*)ats_malloc(len);
+        char *b = (char *)ats_malloc(len);
         memcpy(b, data->data(), len);
         e->data = new_xmalloc_IOBufferData(b, len);
         e->data->_mem_type = DEFAULT_ALLOC;
@@ -584,8 +601,7 @@ RamCacheCLFUS::put(INK_MD5 *key, IOBufferData *data, uint32_t len, bool copy, ui
       if (bytes + victim->size + size > max_bytes && CACHE_VALUE(victim) > CACHE_VALUE(e)) {
         requeue_victims(victims);
         lru[1].enqueue(e);
-        DDebug("ram_cache", "put %X %d %d size %d INC %" PRId64" HISTORY",
-               key->slice32(3), auxkey1, auxkey2, e->size, e->hits);
+        DDebug("ram_cache", "put %X %d %d size %d INC %" PRId64 " HISTORY", key->slice32(3), auxkey1, auxkey2, e->size, e->hits);
         return 0;
       }
     }
@@ -621,7 +637,7 @@ Linsert:
   if (!copy)
     e->data = data;
   else {
-    char *b = (char*)ats_malloc(len);
+    char *b = (char *)ats_malloc(len);
     memcpy(b, data->data(), len);
     e->data = new_xmalloc_IOBufferData(b, len);
     e->data->_mem_type = DEFAULT_ALLOC;
@@ -655,8 +671,7 @@ Lhistory:
 }
 
 int
-RamCacheCLFUS::fixup(INK_MD5 * key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1,
-                     uint32_t new_auxkey2)
+RamCacheCLFUS::fixup(INK_MD5 *key, uint32_t old_auxkey1, uint32_t old_auxkey2, uint32_t new_auxkey1, uint32_t new_auxkey2)
 {
   if (!max_bytes)
     return 0;


[35/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterCache.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCache.h b/iocore/cluster/P_ClusterCache.h
index 5d6b0b9..37f49e1 100644
--- a/iocore/cluster/P_ClusterCache.h
+++ b/iocore/cluster/P_ClusterCache.h
@@ -62,54 +62,54 @@
 // - provides callbacks to other processors when the cluster configuration
 //   changes
 //
-#define CLUSTER_MAJOR_VERSION               3
-#define CLUSTER_MINOR_VERSION               2
+#define CLUSTER_MAJOR_VERSION 3
+#define CLUSTER_MINOR_VERSION 2
 
 // Lowest supported major/minor cluster version
-#define MIN_CLUSTER_MAJOR_VERSION	    CLUSTER_MAJOR_VERSION
-#define MIN_CLUSTER_MINOR_VERSION  	    CLUSTER_MINOR_VERSION
+#define MIN_CLUSTER_MAJOR_VERSION CLUSTER_MAJOR_VERSION
+#define MIN_CLUSTER_MINOR_VERSION CLUSTER_MINOR_VERSION
 
 
-#define DEFAULT_CLUSTER_PORT_NUMBER         0
-#define DEFAULT_NUMBER_OF_CLUSTER_THREADS   1
-#define DEFAULT_CLUSTER_HOST                ""
+#define DEFAULT_CLUSTER_PORT_NUMBER 0
+#define DEFAULT_NUMBER_OF_CLUSTER_THREADS 1
+#define DEFAULT_CLUSTER_HOST ""
 
-#define MAX_CLUSTER_SEND_LENGTH             INT_MAX
+#define MAX_CLUSTER_SEND_LENGTH INT_MAX
 
-#define CLUSTER_MAX_MACHINES                256
+#define CLUSTER_MAX_MACHINES 256
 // less than 1% disparity at 255 machines, 32707 is prime less than 2^15
-#define CLUSTER_HASH_TABLE_SIZE             32707
+#define CLUSTER_HASH_TABLE_SIZE 32707
 
 // after timeout the configuration is "dead"
-#define CLUSTER_CONFIGURATION_TIMEOUT       HRTIME_DAY
+#define CLUSTER_CONFIGURATION_TIMEOUT HRTIME_DAY
 // after zombie the configuration is deleted
-#define CLUSTER_CONFIGURATION_ZOMBIE        (HRTIME_DAY*2)
+#define CLUSTER_CONFIGURATION_ZOMBIE (HRTIME_DAY * 2)
 
 
 // the number of configurations into the past we probe for data
 // one allows a new machine to come into or fall out of the
 // cluster without loss of data.  If the data is redistributed within
 // one day, no data will be lost.
-#define CONFIGURATION_HISTORY_PROBE_DEPTH   1
+#define CONFIGURATION_HISTORY_PROBE_DEPTH 1
 
 
 // move these to a central event definition file (Event.h)
-#define CLUSTER_EVENT_CHANGE            (CLUSTER_EVENT_EVENTS_START)
-#define CLUSTER_EVENT_CONFIGURATION     (CLUSTER_EVENT_EVENTS_START+1)
-#define CLUSTER_EVENT_OPEN              (CLUSTER_EVENT_EVENTS_START+2)
-#define CLUSTER_EVENT_OPEN_EXISTS       (CLUSTER_EVENT_EVENTS_START+3)
-#define CLUSTER_EVENT_OPEN_FAILED       (CLUSTER_EVENT_EVENTS_START+4)
+#define CLUSTER_EVENT_CHANGE (CLUSTER_EVENT_EVENTS_START)
+#define CLUSTER_EVENT_CONFIGURATION (CLUSTER_EVENT_EVENTS_START + 1)
+#define CLUSTER_EVENT_OPEN (CLUSTER_EVENT_EVENTS_START + 2)
+#define CLUSTER_EVENT_OPEN_EXISTS (CLUSTER_EVENT_EVENTS_START + 3)
+#define CLUSTER_EVENT_OPEN_FAILED (CLUSTER_EVENT_EVENTS_START + 4)
 
 // internal event code
-#define CLUSTER_EVENT_STEAL_THREAD      (CLUSTER_EVENT_EVENTS_START+50)
+#define CLUSTER_EVENT_STEAL_THREAD (CLUSTER_EVENT_EVENTS_START + 50)
 
 //////////////////////////////////////////////////////////////
 // Miscellaneous byte swap routines
 //////////////////////////////////////////////////////////////
 inline void
-ats_swap16(uint16_t * d)
+ats_swap16(uint16_t *d)
 {
-  unsigned char *p = (unsigned char *) d;
+  unsigned char *p = (unsigned char *)d;
   *d = ((p[1] << 8) | p[0]);
 }
 
@@ -121,9 +121,9 @@ ats_swap16(uint16_t d)
 }
 
 inline void
-ats_swap32(uint32_t * d)
+ats_swap32(uint32_t *d)
 {
-  unsigned char *p = (unsigned char *) d;
+  unsigned char *p = (unsigned char *)d;
   *d = ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
 }
 
@@ -135,12 +135,11 @@ ats_swap32(uint32_t d)
 }
 
 inline void
-ats_swap64(uint64_t * d)
+ats_swap64(uint64_t *d)
 {
-  unsigned char *p = (unsigned char *) d;
-  *d = (((uint64_t) p[7] << 56) | ((uint64_t) p[6] << 48) |
-        ((uint64_t) p[5] << 40) | ((uint64_t) p[4] << 32) |
-        ((uint64_t) p[3] << 24) | ((uint64_t) p[2] << 16) | ((uint64_t) p[1] << 8) | (uint64_t) p[0]);
+  unsigned char *p = (unsigned char *)d;
+  *d = (((uint64_t)p[7] << 56) | ((uint64_t)p[6] << 48) | ((uint64_t)p[5] << 40) | ((uint64_t)p[4] << 32) | ((uint64_t)p[3] << 24) |
+        ((uint64_t)p[2] << 16) | ((uint64_t)p[1] << 8) | (uint64_t)p[0]);
 }
 
 inline uint64_t
@@ -152,17 +151,19 @@ ats_swap64(uint64_t d)
 
 //////////////////////////////////////////////////////////////
 
-struct ClusterConfiguration
-{
+struct ClusterConfiguration {
   int n_machines;
   ClusterMachine *machines[CLUSTER_MAX_MACHINES];
 
-  ClusterMachine *machine_hash(unsigned int hash_value)
+  ClusterMachine *
+  machine_hash(unsigned int hash_value)
   {
     return machines[hash_table[hash_value % CLUSTER_HASH_TABLE_SIZE]];
   }
 
-  ClusterMachine *find(unsigned int ip, int port = 0) {
+  ClusterMachine *
+  find(unsigned int ip, int port = 0)
+  {
     for (int i = 0; i < n_machines; i++)
       if (ip == machines[i]->ip && (!port || !machines[i]->cluster_port || machines[i]->cluster_port == port))
         return machines[i];
@@ -179,7 +180,7 @@ struct ClusterConfiguration
 };
 
 inline bool
-machine_in_vector(ClusterMachine * m, ClusterMachine ** mm, int len)
+machine_in_vector(ClusterMachine *m, ClusterMachine **mm, int len)
 {
   for (int i = 0; i < len; i++)
     if (m == mm[i])
@@ -195,14 +196,13 @@ machine_in_vector(ClusterMachine * m, ClusterMachine ** mm, int len)
 // Updates: probe_depth and past_probes.
 //
 inkcoreapi ClusterMachine *cluster_machine_at_depth(unsigned int hash, int *probe_depth = NULL,
-                                                    ClusterMachine ** past_probes = NULL);
+                                                    ClusterMachine **past_probes = NULL);
 
 //
 // Cluster
 //   A cluster of machines which act as a single cache.
 //
-struct Cluster
-{
+struct Cluster {
   //
   // Public Interface
   //
@@ -221,7 +221,8 @@ struct Cluster
   //       from the cluster.  (it is a pure function of the configuration)
   //   Thread-safe
   //
-  ClusterMachine *machine_hash(unsigned int hash_value)
+  ClusterMachine *
+  machine_hash(unsigned int hash_value)
   {
     return current_configuration()->machine_hash(hash_value);
   }
@@ -234,12 +235,13 @@ struct Cluster
   // calls cont->handleEvent(EVENT_CLUSTER_CHANGE);
   //   Thread-safe
   //
-  void cluster_change_callback(Continuation * cont);
+  void cluster_change_callback(Continuation *cont);
 
   // Return the current configuration
   //   Thread-safe
   //
-  ClusterConfiguration *current_configuration()
+  ClusterConfiguration *
+  current_configuration()
   {
     return configurations.head;
   }
@@ -248,7 +250,8 @@ struct Cluster
   // Use from within the cluster_change_callback.
   //   Thread-safe
   //
-  ClusterConfiguration *previous_configuration()
+  ClusterConfiguration *
+  previous_configuration()
   {
     return configurations.head->link.next;
   }
@@ -269,8 +272,7 @@ struct Cluster
 //   An token passed between nodes to represent a virtualized connection.
 //   (see ClusterProcessor::alloc_remote() and attach_remote() below)
 //
-struct ClusterVCToken
-{
+struct ClusterVCToken {
   //
   // Marshal this data to send the token across the cluster
   //
@@ -278,25 +280,29 @@ struct ClusterVCToken
   uint32_t ch_id;
   uint32_t sequence_number;
 
-  bool is_clear()
+  bool
+  is_clear()
   {
     return !ip_created;
   }
-  void clear()
+  void
+  clear()
   {
     ip_created = 0;
     sequence_number = 0;
   }
 
   ClusterVCToken(unsigned int aip = 0, unsigned int id = 0, unsigned int aseq = 0)
-:  ip_created(aip), ch_id(id), sequence_number(aseq) {
+    : ip_created(aip), ch_id(id), sequence_number(aseq)
+  {
   }
   //
   // Private
   //
   void alloc();
 
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     ats_swap32(&ch_id);
     ats_swap32(&sequence_number);
@@ -308,13 +314,12 @@ struct ClusterVCToken
 //   A pointer to a procedure which can be invoked accross the cluster.
 //   This must be registered.
 //
-typedef void ClusterFunction(ClusterHandler * ch, void *data, int len);
+typedef void ClusterFunction(ClusterHandler *ch, void *data, int len);
 typedef ClusterFunction *ClusterFunctionPtr;
 
 struct ClusterVConnectionBase;
 
-struct ClusterVConnState
-{
+struct ClusterVConnState {
   //
   // Private
   //
@@ -331,8 +336,7 @@ struct ClusterVConnState
   ClusterVConnState();
 };
 
-struct ClusterVConnectionBase: public CacheVConnection
-{
+struct ClusterVConnectionBase : public CacheVConnection {
   //
   // Initiate an IO operation.
   // "data" is unused.
@@ -342,15 +346,16 @@ struct ClusterVConnectionBase: public CacheVConnection
   //                creation callback.
   //
 
-  virtual VIO *do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf);
-  virtual VIO *do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool owner = false);
-  virtual void do_io_shutdown(ShutdownHowTo_t howto)
+  virtual VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf);
+  virtual VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner = false);
+  virtual void
+  do_io_shutdown(ShutdownHowTo_t howto)
   {
-    (void) howto;
+    (void)howto;
     ink_assert(!"shutdown of cluster connection");
   }
   virtual void do_io_close(int lerrno = -1);
-  virtual VIO* do_io_pread(Continuation*, int64_t, MIOBuffer*, int64_t);
+  virtual VIO *do_io_pread(Continuation *, int64_t, MIOBuffer *, int64_t);
 
   // Set the timeouts associated with this connection.
   // active_timeout is for the total elasped time of the connection.
@@ -450,10 +455,9 @@ ClusterVConnectionBase::cancel_inactivity_timeout()
 class ByteBankDescriptor
 {
 public:
-  ByteBankDescriptor()
-  {
-  }
-  IOBufferBlock *get_block()
+  ByteBankDescriptor() {}
+  IOBufferBlock *
+  get_block()
   {
     return block;
   }
@@ -465,23 +469,21 @@ public:
   LINK(ByteBankDescriptor, link);
 
 private:
-  Ptr<IOBufferBlock> block;  // holder of bank bytes
+  Ptr<IOBufferBlock> block; // holder of bank bytes
 };
 
-enum TypeVConnection
-{
+enum TypeVConnection {
   VC_NULL,
   VC_CLUSTER,
   VC_CLUSTER_READ,
   VC_CLUSTER_WRITE,
-  VC_CLUSTER_CLOSED
+  VC_CLUSTER_CLOSED,
 };
 
 //
 // ClusterVConnection
 //
-struct ClusterVConnection: public ClusterVConnectionBase
-{
+struct ClusterVConnection : public ClusterVConnectionBase {
   //
   // Public Interface (included from ClusterVConnectionBase)
   //
@@ -503,19 +505,19 @@ struct ClusterVConnection: public ClusterVConnectionBase
   // Private
   //
 
-  int startEvent(int event, Event * e);
-  int mainEvent(int event, Event * e);
+  int startEvent(int event, Event *e);
+  int mainEvent(int event, Event *e);
 
   // 0 on success -1 on failure
-  int start(EThread * t);       // New connect protocol
+  int start(EThread *t); // New connect protocol
 
   ClusterVConnection(int is_new_connect_read = 0);
   ~ClusterVConnection();
-  void free();                  // Destructor actions (we are using ClassAllocator)
+  void free(); // Destructor actions (we are using ClassAllocator)
 
   virtual void do_io_close(int lerrno = -1);
-  virtual VIO *do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf);
-  virtual VIO *do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool owner = false);
+  virtual VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf);
+  virtual VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner = false);
   virtual void reenable(VIO *vio);
 
   ClusterHandler *ch;
@@ -528,7 +530,7 @@ struct ClusterVConnection: public ClusterVConnectionBase
   //     - open_local()    caller is writer
   //     - connect_local() caller is reader
   //
-  int new_connect_read;         // Data flow direction wrt origin node
+  int new_connect_read; // Data flow direction wrt origin node
   int remote_free;
   int last_local_free;
   int channel;
@@ -549,20 +551,20 @@ struct ClusterVConnection: public ClusterVConnectionBase
   void set_type(int);
   ink_hrtime start_time;
   ink_hrtime last_activity_time;
-  Queue<ByteBankDescriptor> byte_bank_q;   // done awaiting completion
-  int n_set_data_msgs;          // # pending set_data() msgs on VC
-  int n_recv_set_data_msgs;     // # set_data() msgs received on VC
-  volatile int pending_remote_fill;     // Remote fill pending on connection
-  Ptr<IOBufferBlock> read_block;   // Hold current data for open read
-  bool remote_ram_cache_hit;    // Entire object was from remote ram cache
-  bool have_all_data;           // All data in read_block
-  int initial_data_bytes;       // bytes in open_read buffer
-  Ptr<IOBufferBlock> remote_write_block;   // Write side data for remote fill
-  void *current_cont;           // Track current continuation (debug)
-
-#define CLUSTER_IOV_NOT_OPEN               -2
-#define CLUSTER_IOV_NONE                   -1
-  int iov_map;                  // which iov?
+  Queue<ByteBankDescriptor> byte_bank_q; // done awaiting completion
+  int n_set_data_msgs;                   // # pending set_data() msgs on VC
+  int n_recv_set_data_msgs;              // # set_data() msgs received on VC
+  volatile int pending_remote_fill;      // Remote fill pending on connection
+  Ptr<IOBufferBlock> read_block;         // Hold current data for open read
+  bool remote_ram_cache_hit;             // Entire object was from remote ram cache
+  bool have_all_data;                    // All data in read_block
+  int initial_data_bytes;                // bytes in open_read buffer
+  Ptr<IOBufferBlock> remote_write_block; // Write side data for remote fill
+  void *current_cont;                    // Track current continuation (debug)
+
+#define CLUSTER_IOV_NOT_OPEN -2
+#define CLUSTER_IOV_NONE -1
+  int iov_map; // which iov?
 
   Ptr<ProxyMutex> read_locked;
   Ptr<ProxyMutex> write_locked;
@@ -582,12 +584,20 @@ struct ClusterVConnection: public ClusterVConnectionBase
   void set_remote_fill_action(Action *);
 
   // Indicates whether a cache hit was from an peering cluster cache
-  bool is_ram_cache_hit() const { return remote_ram_cache_hit; };
-  void set_ram_cache_hit(bool remote_hit) { remote_ram_cache_hit = remote_hit; }
+  bool
+  is_ram_cache_hit() const
+  {
+    return remote_ram_cache_hit;
+  };
+  void
+  set_ram_cache_hit(bool remote_hit)
+  {
+    remote_ram_cache_hit = remote_hit;
+  }
 
   // For VC(s) established via OPEN_READ, we are passed a CacheHTTPInfo
   //  in the reply.
-  virtual bool get_data(int id, void *data);    // backward compatibility
+  virtual bool get_data(int id, void *data); // backward compatibility
   virtual void get_http_info(CacheHTTPInfo **);
   virtual int64_t get_object_size();
   virtual bool is_pread_capable();
@@ -609,17 +619,16 @@ struct ClusterVConnection: public ClusterVConnectionBase
 //
 // Cluster operation options
 //
-#define CLUSTER_OPT_STEAL             0x0001    // allow thread stealing
-#define CLUSTER_OPT_IMMEDIATE         0x0002    // require immediate response
-#define CLUSTER_OPT_ALLOW_IMMEDIATE   0x0004    // allow immediate response
-#define CLUSTER_OPT_DELAY             0x0008    // require delayed response
-#define CLUSTER_OPT_CONN_READ         0x0010    // new conn read
-#define CLUSTER_OPT_CONN_WRITE        0x0020    // new conn write
-#define CLUSTER_OPT_DATA_IS_OCONTROL  0x0040    // data in OutgoingControl
-#define CLUSTER_FUNCTION_MALLOCED     -1
-
-struct ClusterRemoteDataHeader
-{
+#define CLUSTER_OPT_STEAL 0x0001            // allow thread stealing
+#define CLUSTER_OPT_IMMEDIATE 0x0002        // require immediate response
+#define CLUSTER_OPT_ALLOW_IMMEDIATE 0x0004  // allow immediate response
+#define CLUSTER_OPT_DELAY 0x0008            // require delayed response
+#define CLUSTER_OPT_CONN_READ 0x0010        // new conn read
+#define CLUSTER_OPT_CONN_WRITE 0x0020       // new conn write
+#define CLUSTER_OPT_DATA_IS_OCONTROL 0x0040 // data in OutgoingControl
+#define CLUSTER_FUNCTION_MALLOCED -1
+
+struct ClusterRemoteDataHeader {
   int32_t cluster_function;
 };
 //
@@ -627,8 +636,7 @@ struct ClusterRemoteDataHeader
 //
 class ClusterAccept;
 
-struct ClusterProcessor
-{
+struct ClusterProcessor {
   //
   // Public Interface
   //
@@ -641,36 +649,35 @@ struct ClusterProcessor
 
   int invoke_remote(ClusterHandler *ch, int cluster_fn_index, void *data, int len, int options = CLUSTER_OPT_STEAL);
 
-  int invoke_remote_data(ClusterHandler *ch, int cluster_fn_index,
-                         void *data, int data_len,
-                         IOBufferBlock * buf,
-                         int logical_channel, ClusterVCToken * token,
-                         void (*bufdata_free) (void *), void *bufdata_free_arg, int options = CLUSTER_OPT_STEAL);
+  int invoke_remote_data(ClusterHandler *ch, int cluster_fn_index, void *data, int data_len, IOBufferBlock *buf,
+                         int logical_channel, ClusterVCToken *token, void (*bufdata_free)(void *), void *bufdata_free_arg,
+                         int options = CLUSTER_OPT_STEAL);
 
   // Pass the data in as a malloc'ed block to be freed by callee
-  int invoke_remote_malloced(ClusterHandler *ch, ClusterRemoteDataHeader * data, int len /* including header */ )
+  int
+  invoke_remote_malloced(ClusterHandler *ch, ClusterRemoteDataHeader *data, int len /* including header */)
   {
     return invoke_remote(ch, CLUSTER_FUNCTION_MALLOCED, data, len);
   }
   void free_remote_data(char *data, int len);
 
-  // Allocate the local side of a remote VConnection.
-  // returns a token which can be passed to the remote side
-  // through an existing link and passed to attach_remoteVC()
-  // if CLUSTER_OPT_IMMEDIATE is set, CLUSTER_DELAYED_OPEN will not be returned
-  //
-  // Options: CLUSTER_OPT_IMMEDIATE, CLUSTER_OPT_ALLOW_IMMEDIATE
-  // Returns: pointer for CLUSTER_OPT_IMMEDIATE
-  //            or CLUSTER_DELAYED_OPEN on success,
-  //          NULL on failure
-  // calls:  cont->handleEvent( CLUSTER_EVENT_OPEN, ClusterVConnection *)
-  //         on delayed success.
-  //
-  // NOTE: the CLUSTER_EVENT_OPEN may be called before "open/connect" returns
+// Allocate the local side of a remote VConnection.
+// returns a token which can be passed to the remote side
+// through an existing link and passed to attach_remoteVC()
+// if CLUSTER_OPT_IMMEDIATE is set, CLUSTER_DELAYED_OPEN will not be returned
+//
+// Options: CLUSTER_OPT_IMMEDIATE, CLUSTER_OPT_ALLOW_IMMEDIATE
+// Returns: pointer for CLUSTER_OPT_IMMEDIATE
+//            or CLUSTER_DELAYED_OPEN on success,
+//          NULL on failure
+// calls:  cont->handleEvent( CLUSTER_EVENT_OPEN, ClusterVConnection *)
+//         on delayed success.
+//
+// NOTE: the CLUSTER_EVENT_OPEN may be called before "open/connect" returns
 
-#define CLUSTER_DELAYED_OPEN       ((ClusterVConnection*)-1)
-#define CLUSTER_NODE_DOWN          ((ClusterVConnection*)-2)
-  ClusterVConnection *open_local(Continuation * cont, ClusterMachine * mp, ClusterVCToken & token, int options = 0);
+#define CLUSTER_DELAYED_OPEN ((ClusterVConnection *)-1)
+#define CLUSTER_NODE_DOWN ((ClusterVConnection *)-2)
+  ClusterVConnection *open_local(Continuation *cont, ClusterMachine *mp, ClusterVCToken &token, int options = 0);
 
   // Get the other side of a remote VConnection which was previously
   // allocated with open.
@@ -678,7 +685,7 @@ struct ClusterProcessor
   // Options: CLUSTER_OPT_IMMEDIATE, CLUSTER_OPT_ALLOW_IMMEDIATE
   // return a pointer or CLUSTER_DELAYED_OPEN success, NULL on failure
   //
-  ClusterVConnection *connect_local(Continuation * cont, ClusterVCToken * token, int channel, int options = 0);
+  ClusterVConnection *connect_local(Continuation *cont, ClusterVCToken *token, int channel, int options = 0);
   inkcoreapi bool disable_remote_cluster_ops(ClusterMachine *);
 
   //
@@ -688,7 +695,7 @@ struct ClusterProcessor
   virtual int start();
 
   ClusterProcessor();
-  virtual ~ ClusterProcessor();
+  virtual ~ClusterProcessor();
 
   //
   // Private
@@ -699,10 +706,10 @@ struct ClusterProcessor
   void connect(char *hostname, int16_t id = -1);
   void connect(unsigned int ip, int port = 0, int16_t id = -1, bool delay = false);
   // send the list of known machines to new machine
-  void send_machine_list(ClusterMachine * m);
+  void send_machine_list(ClusterMachine *m);
   void compute_cluster_mode();
   // Internal invoke_remote interface
-  int internal_invoke_remote(ClusterHandler * m, int cluster_fn, void *data, int len, int options, void *cmsg);
+  int internal_invoke_remote(ClusterHandler *m, int cluster_fn, void *data, int len, int options, void *cmsg);
 };
 
 inkcoreapi extern ClusterProcessor clusterProcessor;
@@ -718,7 +725,7 @@ this_cluster()
 // This function should be called for all threads created to
 // accept such events by the EventProcesor.
 //
-void initialize_thread_for_cluster(EThread * thread);
+void initialize_thread_for_cluster(EThread *thread);
 
 //
 // ClusterFunction Registry
@@ -750,120 +757,120 @@ extern ClusterFunction set_channel_priority_ClusterFunction;
 extern ClusterFunction post_setchan_priority_ClusterFunction;
 extern ClusterFunction default_api_ClusterFunction;
 
-struct ClusterFunctionDescriptor
-{
-  bool fMalloced;               // the function will free the data
-  bool ClusterFunc;             // Process incoming message only
+struct ClusterFunctionDescriptor {
+  bool fMalloced;   // the function will free the data
+  bool ClusterFunc; // Process incoming message only
   //   in ET_CLUSTER thread.
-  int q_priority;               // lower is higher priority
+  int q_priority; // lower is higher priority
   ClusterFunctionPtr pfn;
-  ClusterFunctionPtr post_pfn;  // msg queue/send callout
+  ClusterFunctionPtr post_pfn; // msg queue/send callout
 };
 
-#define CLUSTER_CMSG_QUEUES		2
-#define CMSG_MAX_PRI			0
-#define CMSG_LOW_PRI			(CLUSTER_CMSG_QUEUES-1)
+#define CLUSTER_CMSG_QUEUES 2
+#define CMSG_MAX_PRI 0
+#define CMSG_LOW_PRI (CLUSTER_CMSG_QUEUES - 1)
 
 #ifndef DEFINE_CLUSTER_FUNCTIONS
 extern
 #endif
-ClusterFunctionDescriptor clusterFunction[]
+  ClusterFunctionDescriptor clusterFunction[]
 #ifdef DEFINE_CLUSTER_FUNCTIONS
-  = {
-  {false, true, CMSG_LOW_PRI, test_ClusterFunction, 0},
-  {false, true, CMSG_LOW_PRI, ping_ClusterFunction, 0},
-  {false, true, CMSG_LOW_PRI, ping_reply_ClusterFunction, 0},
-  {false, true, CMSG_LOW_PRI, machine_list_ClusterFunction, 0},
-  {false, true, CMSG_LOW_PRI, close_channel_ClusterFunction, 0},
-  {false, false, CMSG_LOW_PRI, get_hostinfo_ClusterFunction, 0},    // in HostDB.cc
-  {false, false, CMSG_LOW_PRI, put_hostinfo_ClusterFunction, 0},    // in HostDB.cc
-  {false, true, CMSG_LOW_PRI, cache_lookup_ClusterFunction, 0},    // in CacheCont.cc
-  {true, true, CMSG_LOW_PRI, cache_op_malloc_ClusterFunction, 0},
-  {false, true, CMSG_LOW_PRI, cache_op_ClusterFunction, 0},
-  {false, false, CMSG_LOW_PRI, cache_op_result_ClusterFunction, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},   // OBSOLETE
-  {false, false, CMSG_LOW_PRI, 0, 0},   // OBSOLETE
-  {false, false, CMSG_LOW_PRI, 0, 0},   // OBSOLETE
-  {false, true, CMSG_MAX_PRI, set_channel_data_ClusterFunction, post_setchan_send_ClusterFunction},
-  {false, true, CMSG_MAX_PRI, set_channel_pin_ClusterFunction, post_setchan_pin_ClusterFunction},
-  {false, true, CMSG_MAX_PRI, set_channel_priority_ClusterFunction, post_setchan_priority_ClusterFunction},
-   /********************************************
-    * RESERVED for future cluster internal use *
-    ********************************************/
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-  {false, false, CMSG_LOW_PRI, 0, 0},
-
-   /*********************************************
-    * RESERVED for Cluster RPC API use		*
-    *********************************************/
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
-  {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0}
-  // ********** ADD NEW ENTRIES ABOVE THIS LINE ************
+  =
+    {
+      {false, true, CMSG_LOW_PRI, test_ClusterFunction, 0},
+      {false, true, CMSG_LOW_PRI, ping_ClusterFunction, 0},
+      {false, true, CMSG_LOW_PRI, ping_reply_ClusterFunction, 0},
+      {false, true, CMSG_LOW_PRI, machine_list_ClusterFunction, 0},
+      {false, true, CMSG_LOW_PRI, close_channel_ClusterFunction, 0},
+      {false, false, CMSG_LOW_PRI, get_hostinfo_ClusterFunction, 0}, // in HostDB.cc
+      {false, false, CMSG_LOW_PRI, put_hostinfo_ClusterFunction, 0}, // in HostDB.cc
+      {false, true, CMSG_LOW_PRI, cache_lookup_ClusterFunction, 0},  // in CacheCont.cc
+      {true, true, CMSG_LOW_PRI, cache_op_malloc_ClusterFunction, 0},
+      {false, true, CMSG_LOW_PRI, cache_op_ClusterFunction, 0},
+      {false, false, CMSG_LOW_PRI, cache_op_result_ClusterFunction, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0}, // OBSOLETE
+      {false, false, CMSG_LOW_PRI, 0, 0}, // OBSOLETE
+      {false, false, CMSG_LOW_PRI, 0, 0}, // OBSOLETE
+      {false, true, CMSG_MAX_PRI, set_channel_data_ClusterFunction, post_setchan_send_ClusterFunction},
+      {false, true, CMSG_MAX_PRI, set_channel_pin_ClusterFunction, post_setchan_pin_ClusterFunction},
+      {false, true, CMSG_MAX_PRI, set_channel_priority_ClusterFunction, post_setchan_priority_ClusterFunction},
+      /********************************************
+       * RESERVED for future cluster internal use *
+       ********************************************/
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+      {false, false, CMSG_LOW_PRI, 0, 0},
+
+      /*********************************************
+       * RESERVED for Cluster RPC API use		*
+       *********************************************/
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
+      {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0}
+      // ********** ADD NEW ENTRIES ABOVE THIS LINE ************
 }
 #endif
 
 ;
-extern unsigned SIZE_clusterFunction;        // clusterFunction[] entries
+extern unsigned SIZE_clusterFunction; // clusterFunction[] entries
 
 //////////////////////////////////////////////////////////////
 // Map from Cluster Function code to send queue priority
@@ -881,58 +888,58 @@ ClusterFuncToQpri(int cluster_func)
 //
 // This table had better match the above list
 //
-#define TEST_CLUSTER_FUNCTION                        0
-#define PING_CLUSTER_FUNCTION                        1
-#define PING_REPLY_CLUSTER_FUNCTION                  2
-#define MACHINE_LIST_CLUSTER_FUNCTION                3
-#define CLOSE_CHANNEL_CLUSTER_FUNCTION               4
-#define GET_HOSTINFO_CLUSTER_FUNCTION                5
-#define PUT_HOSTINFO_CLUSTER_FUNCTION                6
-#define CACHE_LOOKUP_CLUSTER_FUNCTION                7
-#define CACHE_OP_MALLOCED_CLUSTER_FUNCTION           8
-#define CACHE_OP_CLUSTER_FUNCTION                    9
-#define CACHE_OP_RESULT_CLUSTER_FUNCTION             10
-#define SET_CHANNEL_DATA_CLUSTER_FUNCTION      	     14
-#define SET_CHANNEL_PIN_CLUSTER_FUNCTION      	     15
-#define SET_CHANNEL_PRIORITY_CLUSTER_FUNCTION  	     16
+#define TEST_CLUSTER_FUNCTION 0
+#define PING_CLUSTER_FUNCTION 1
+#define PING_REPLY_CLUSTER_FUNCTION 2
+#define MACHINE_LIST_CLUSTER_FUNCTION 3
+#define CLOSE_CHANNEL_CLUSTER_FUNCTION 4
+#define GET_HOSTINFO_CLUSTER_FUNCTION 5
+#define PUT_HOSTINFO_CLUSTER_FUNCTION 6
+#define CACHE_LOOKUP_CLUSTER_FUNCTION 7
+#define CACHE_OP_MALLOCED_CLUSTER_FUNCTION 8
+#define CACHE_OP_CLUSTER_FUNCTION 9
+#define CACHE_OP_RESULT_CLUSTER_FUNCTION 10
+#define SET_CHANNEL_DATA_CLUSTER_FUNCTION 14
+#define SET_CHANNEL_PIN_CLUSTER_FUNCTION 15
+#define SET_CHANNEL_PRIORITY_CLUSTER_FUNCTION 16
 
 /********************************************
  * RESERVED for future cluster internal use *
  ********************************************/
-#define INTERNAL_RESERVED1_CLUSTER_FUNCTION  	     17
-#define INTERNAL_RESERVED2_CLUSTER_FUNCTION  	     18
-#define INTERNAL_RESERVED3_CLUSTER_FUNCTION  	     19
-#define INTERNAL_RESERVED4_CLUSTER_FUNCTION  	     20
-#define INTERNAL_RESERVED5_CLUSTER_FUNCTION  	     21
-#define INTERNAL_RESERVED6_CLUSTER_FUNCTION  	     22
-#define INTERNAL_RESERVED7_CLUSTER_FUNCTION  	     23
-#define INTERNAL_RESERVED8_CLUSTER_FUNCTION  	     24
-#define INTERNAL_RESERVED9_CLUSTER_FUNCTION  	     25
-#define INTERNAL_RESERVED10_CLUSTER_FUNCTION  	     26
-#define INTERNAL_RESERVED11_CLUSTER_FUNCTION  	     27
-#define INTERNAL_RESERVED12_CLUSTER_FUNCTION  	     28
-#define INTERNAL_RESERVED13_CLUSTER_FUNCTION  	     29
-#define INTERNAL_RESERVED14_CLUSTER_FUNCTION  	     30
-#define INTERNAL_RESERVED15_CLUSTER_FUNCTION  	     31
-#define INTERNAL_RESERVED16_CLUSTER_FUNCTION  	     32
-#define INTERNAL_RESERVED17_CLUSTER_FUNCTION  	     33
-#define INTERNAL_RESERVED18_CLUSTER_FUNCTION  	     34
-#define INTERNAL_RESERVED19_CLUSTER_FUNCTION  	     35
-#define INTERNAL_RESERVED20_CLUSTER_FUNCTION  	     36
-#define INTERNAL_RESERVED21_CLUSTER_FUNCTION  	     37
-#define INTERNAL_RESERVED22_CLUSTER_FUNCTION  	     38
-#define INTERNAL_RESERVED23_CLUSTER_FUNCTION  	     39
-#define INTERNAL_RESERVED24_CLUSTER_FUNCTION  	     40
-#define INTERNAL_RESERVED25_CLUSTER_FUNCTION  	     41
-#define INTERNAL_RESERVED26_CLUSTER_FUNCTION  	     42
-#define INTERNAL_RESERVED27_CLUSTER_FUNCTION  	     43
-#define INTERNAL_RESERVED28_CLUSTER_FUNCTION  	     44
-#define INTERNAL_RESERVED29_CLUSTER_FUNCTION  	     45
-#define INTERNAL_RESERVED30_CLUSTER_FUNCTION  	     46
-#define INTERNAL_RESERVED31_CLUSTER_FUNCTION  	     47
-#define INTERNAL_RESERVED32_CLUSTER_FUNCTION  	     48
-#define INTERNAL_RESERVED33_CLUSTER_FUNCTION  	     49
-#define INTERNAL_RESERVED34_CLUSTER_FUNCTION  	     50
+#define INTERNAL_RESERVED1_CLUSTER_FUNCTION 17
+#define INTERNAL_RESERVED2_CLUSTER_FUNCTION 18
+#define INTERNAL_RESERVED3_CLUSTER_FUNCTION 19
+#define INTERNAL_RESERVED4_CLUSTER_FUNCTION 20
+#define INTERNAL_RESERVED5_CLUSTER_FUNCTION 21
+#define INTERNAL_RESERVED6_CLUSTER_FUNCTION 22
+#define INTERNAL_RESERVED7_CLUSTER_FUNCTION 23
+#define INTERNAL_RESERVED8_CLUSTER_FUNCTION 24
+#define INTERNAL_RESERVED9_CLUSTER_FUNCTION 25
+#define INTERNAL_RESERVED10_CLUSTER_FUNCTION 26
+#define INTERNAL_RESERVED11_CLUSTER_FUNCTION 27
+#define INTERNAL_RESERVED12_CLUSTER_FUNCTION 28
+#define INTERNAL_RESERVED13_CLUSTER_FUNCTION 29
+#define INTERNAL_RESERVED14_CLUSTER_FUNCTION 30
+#define INTERNAL_RESERVED15_CLUSTER_FUNCTION 31
+#define INTERNAL_RESERVED16_CLUSTER_FUNCTION 32
+#define INTERNAL_RESERVED17_CLUSTER_FUNCTION 33
+#define INTERNAL_RESERVED18_CLUSTER_FUNCTION 34
+#define INTERNAL_RESERVED19_CLUSTER_FUNCTION 35
+#define INTERNAL_RESERVED20_CLUSTER_FUNCTION 36
+#define INTERNAL_RESERVED21_CLUSTER_FUNCTION 37
+#define INTERNAL_RESERVED22_CLUSTER_FUNCTION 38
+#define INTERNAL_RESERVED23_CLUSTER_FUNCTION 39
+#define INTERNAL_RESERVED24_CLUSTER_FUNCTION 40
+#define INTERNAL_RESERVED25_CLUSTER_FUNCTION 41
+#define INTERNAL_RESERVED26_CLUSTER_FUNCTION 42
+#define INTERNAL_RESERVED27_CLUSTER_FUNCTION 43
+#define INTERNAL_RESERVED28_CLUSTER_FUNCTION 44
+#define INTERNAL_RESERVED29_CLUSTER_FUNCTION 45
+#define INTERNAL_RESERVED30_CLUSTER_FUNCTION 46
+#define INTERNAL_RESERVED31_CLUSTER_FUNCTION 47
+#define INTERNAL_RESERVED32_CLUSTER_FUNCTION 48
+#define INTERNAL_RESERVED33_CLUSTER_FUNCTION 49
+#define INTERNAL_RESERVED34_CLUSTER_FUNCTION 50
 
 /****************************************************************************
  * Cluster RPC API definitions.						    *
@@ -945,52 +952,51 @@ ClusterFuncToQpri(int cluster_func)
 /************************************************
  * RESERVED for Wireless Group			*
  ************************************************/
-#define API_F01_CLUSTER_FUNCTION  	     	     51
-#define API_F02_CLUSTER_FUNCTION  	     	     52
-#define API_F03_CLUSTER_FUNCTION  	     	     53
-#define API_F04_CLUSTER_FUNCTION  	     	     54
-#define API_F05_CLUSTER_FUNCTION  	     	     55
-#define API_F06_CLUSTER_FUNCTION  	     	     56
-#define API_F07_CLUSTER_FUNCTION  	     	     57
-#define API_F08_CLUSTER_FUNCTION  	     	     58
-#define API_F09_CLUSTER_FUNCTION  	     	     59
-#define API_F10_CLUSTER_FUNCTION  	     	     60
+#define API_F01_CLUSTER_FUNCTION 51
+#define API_F02_CLUSTER_FUNCTION 52
+#define API_F03_CLUSTER_FUNCTION 53
+#define API_F04_CLUSTER_FUNCTION 54
+#define API_F05_CLUSTER_FUNCTION 55
+#define API_F06_CLUSTER_FUNCTION 56
+#define API_F07_CLUSTER_FUNCTION 57
+#define API_F08_CLUSTER_FUNCTION 58
+#define API_F09_CLUSTER_FUNCTION 59
+#define API_F10_CLUSTER_FUNCTION 60
 
 /************************************************
  * RESERVED for future use			*
  ************************************************/
-#define API_F11_CLUSTER_FUNCTION  	     	     61
-#define API_F12_CLUSTER_FUNCTION  	     	     62
-#define API_F13_CLUSTER_FUNCTION  	     	     63
-#define API_F14_CLUSTER_FUNCTION  	     	     64
-#define API_F15_CLUSTER_FUNCTION  	     	     65
-#define API_F16_CLUSTER_FUNCTION  	     	     66
-#define API_F17_CLUSTER_FUNCTION  	     	     67
-#define API_F18_CLUSTER_FUNCTION  	     	     68
-#define API_F19_CLUSTER_FUNCTION  	     	     69
-#define API_F20_CLUSTER_FUNCTION  	     	     70
-
-#define API_F21_CLUSTER_FUNCTION  	     	     71
-#define API_F22_CLUSTER_FUNCTION  	     	     72
-#define API_F23_CLUSTER_FUNCTION  	     	     73
-#define API_F24_CLUSTER_FUNCTION  	     	     74
-#define API_F25_CLUSTER_FUNCTION  	     	     75
-#define API_F26_CLUSTER_FUNCTION  	     	     76
-#define API_F27_CLUSTER_FUNCTION  	     	     77
-#define API_F28_CLUSTER_FUNCTION  	     	     78
-#define API_F29_CLUSTER_FUNCTION  	     	     79
-#define API_F30_CLUSTER_FUNCTION  	     	     80
-
-#define API_STARECT_CLUSTER_FUNCTION		     API_F01_CLUSTER_FUNCTION
-#define API_END_CLUSTER_FUNCTION		     API_F30_CLUSTER_FUNCTION
-
-#define UNDEFINED_CLUSTER_FUNCTION                   0xFDEFFDEF
+#define API_F11_CLUSTER_FUNCTION 61
+#define API_F12_CLUSTER_FUNCTION 62
+#define API_F13_CLUSTER_FUNCTION 63
+#define API_F14_CLUSTER_FUNCTION 64
+#define API_F15_CLUSTER_FUNCTION 65
+#define API_F16_CLUSTER_FUNCTION 66
+#define API_F17_CLUSTER_FUNCTION 67
+#define API_F18_CLUSTER_FUNCTION 68
+#define API_F19_CLUSTER_FUNCTION 69
+#define API_F20_CLUSTER_FUNCTION 70
+
+#define API_F21_CLUSTER_FUNCTION 71
+#define API_F22_CLUSTER_FUNCTION 72
+#define API_F23_CLUSTER_FUNCTION 73
+#define API_F24_CLUSTER_FUNCTION 74
+#define API_F25_CLUSTER_FUNCTION 75
+#define API_F26_CLUSTER_FUNCTION 76
+#define API_F27_CLUSTER_FUNCTION 77
+#define API_F28_CLUSTER_FUNCTION 78
+#define API_F29_CLUSTER_FUNCTION 79
+#define API_F30_CLUSTER_FUNCTION 80
+
+#define API_STARECT_CLUSTER_FUNCTION API_F01_CLUSTER_FUNCTION
+#define API_END_CLUSTER_FUNCTION API_F30_CLUSTER_FUNCTION
+
+#define UNDEFINED_CLUSTER_FUNCTION 0xFDEFFDEF
 
 //////////////////////////////////////////////
 // Initial cluster connect exchange message
 //////////////////////////////////////////////
-struct ClusterHelloMessage
-{
+struct ClusterHelloMessage {
   uint16_t _NativeByteOrder;
   uint16_t _major;
   uint16_t _minor;
@@ -999,12 +1005,12 @@ struct ClusterHelloMessage
   int16_t _id;
 #ifdef LOCAL_CLUSTER_TEST_MODE
   int16_t _port;
-  char _pad[114];               // pad out to 128 bytes
+  char _pad[114]; // pad out to 128 bytes
 #else
-  char _pad[116];               // pad out to 128 bytes
+  char _pad[116]; // pad out to 128 bytes
 #endif
 
-    ClusterHelloMessage():_NativeByteOrder(1)
+  ClusterHelloMessage() : _NativeByteOrder(1)
   {
     _major = CLUSTER_MAJOR_VERSION;
     _minor = CLUSTER_MINOR_VERSION;
@@ -1012,11 +1018,13 @@ struct ClusterHelloMessage
     _min_minor = MIN_CLUSTER_MINOR_VERSION;
     memset(_pad, '\0', sizeof(_pad));
   }
-  int NativeByteOrder()
+  int
+  NativeByteOrder()
   {
     return (_NativeByteOrder == 1);
   }
-  void AdjustByteOrder()
+  void
+  AdjustByteOrder()
   {
     if (!NativeByteOrder()) {
       ats_swap16(&_major);
@@ -1030,31 +1038,30 @@ struct ClusterHelloMessage
 ///////////////////////////////////////////////////////////////////
 // Cluster message header definition.
 ///////////////////////////////////////////////////////////////////
-struct ClusterMessageHeader
-{
-  uint16_t _InNativeByteOrder;    // always non-zero
-  uint16_t _MsgVersion;           // always non-zero
+struct ClusterMessageHeader {
+  uint16_t _InNativeByteOrder; // always non-zero
+  uint16_t _MsgVersion;        // always non-zero
 
-  void _init(uint16_t msg_version)
+  void
+  _init(uint16_t msg_version)
   {
     _InNativeByteOrder = 1;
     _MsgVersion = msg_version;
   }
-  ClusterMessageHeader():_InNativeByteOrder(0), _MsgVersion(0)
-  {
-  }
-  ClusterMessageHeader(uint16_t msg_version) {
-    _init(msg_version);
-  }
-  int MsgInNativeByteOrder()
+  ClusterMessageHeader() : _InNativeByteOrder(0), _MsgVersion(0) {}
+  ClusterMessageHeader(uint16_t msg_version) { _init(msg_version); }
+  int
+  MsgInNativeByteOrder()
   {
     return (_InNativeByteOrder == 1);
   }
-  int NeedByteSwap()
+  int
+  NeedByteSwap()
   {
     return (_InNativeByteOrder != 1);
   }
-  int GetMsgVersion()
+  int
+  GetMsgVersion()
   {
     if (NeedByteSwap()) {
       return ats_swap16(_MsgVersion);
@@ -1069,42 +1076,42 @@ struct ClusterMessageHeader
 //
 // cluster_ping
 //
-typedef void (*PingReturnFunction) (ClusterHandler *, void *data, int len);
+typedef void (*PingReturnFunction)(ClusterHandler *, void *data, int len);
 
-struct PingMessage:public ClusterMessageHeader
-{
-  PingReturnFunction fn;        // Note: Pointer to a func
-  char data[1];                 // start of data
+struct PingMessage : public ClusterMessageHeader {
+  PingReturnFunction fn; // Note: Pointer to a func
+  char data[1];          // start of data
 
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    PING_MESSAGE_VERSION = MAX_VERSION
+    PING_MESSAGE_VERSION = MAX_VERSION,
   };
 
-    PingMessage(uint16_t vers = PING_MESSAGE_VERSION)
-:  ClusterMessageHeader(vers), fn(NULL) {
-    data[0] = '\0';
-  }
+  PingMessage(uint16_t vers = PING_MESSAGE_VERSION) : ClusterMessageHeader(vers), fn(NULL) { data[0] = '\0'; }
   /////////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return PING_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
     PingMessage *p = 0;
     // Maybe use offsetof here instead. /leif
-    return (uintptr_t) (&p->data[0]);
+    return (uintptr_t)(&p->data[0]);
   }
-  void init(uint16_t vers = PING_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = PING_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
-  }                             // No action, message is always reflected back
+  } // No action, message is always reflected back
   /////////////////////////////////////////////////////////////////////////////
 };
 
@@ -1115,7 +1122,7 @@ cluster_ping(ClusterHandler *ch, PingReturnFunction fn, void *data, int len)
   msg->init();
   msg->fn = fn;
   memcpy(msg->data, data, len);
-  clusterProcessor.invoke_remote(ch, PING_CLUSTER_FUNCTION, (void *) msg, (msg->sizeof_fixedlen_msg() + len));
+  clusterProcessor.invoke_remote(ch, PING_CLUSTER_FUNCTION, (void *)msg, (msg->sizeof_fixedlen_msg() + len));
 }
 
 // filled with 0's
@@ -1124,8 +1131,8 @@ extern char channel_dummy_output[DEFAULT_MAX_BUFFER_SIZE];
 //
 // Private (for testing)
 //
-ClusterConfiguration *configuration_add_machine(ClusterConfiguration * c, ClusterMachine * m);
-ClusterConfiguration *configuration_remove_machine(ClusterConfiguration * c, ClusterMachine * m);
+ClusterConfiguration *configuration_add_machine(ClusterConfiguration *c, ClusterMachine *m);
+ClusterConfiguration *configuration_remove_machine(ClusterConfiguration *c, ClusterMachine *m);
 extern bool machineClusterHash;
 extern bool boundClusterHash;
 extern bool randClusterHash;
@@ -1133,36 +1140,36 @@ extern bool randClusterHash;
 void build_cluster_hash_table(ClusterConfiguration *);
 
 inline void
-ClusterVC_enqueue_read(Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_read_link> &q, ClusterVConnectionBase * vc)
+ClusterVC_enqueue_read(Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_read_link> &q, ClusterVConnectionBase *vc)
 {
-  ClusterVConnState * cs = &vc->read;
+  ClusterVConnState *cs = &vc->read;
   ink_assert(!cs->queue);
   cs->queue = &q;
   q.enqueue(vc);
 }
 
 inline void
-ClusterVC_enqueue_write(Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_write_link> &q, ClusterVConnectionBase * vc)
+ClusterVC_enqueue_write(Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_write_link> &q, ClusterVConnectionBase *vc)
 {
-  ClusterVConnState * cs = &vc->write;
+  ClusterVConnState *cs = &vc->write;
   ink_assert(!cs->queue);
   cs->queue = &q;
   q.enqueue(vc);
 }
 
 inline void
-ClusterVC_remove_read(ClusterVConnectionBase * vc)
+ClusterVC_remove_read(ClusterVConnectionBase *vc)
 {
-  ClusterVConnState * cs = &vc->read;
+  ClusterVConnState *cs = &vc->read;
   ink_assert(cs->queue);
   ((Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_read_link> *)cs->queue)->remove(vc);
   cs->queue = NULL;
 }
 
 inline void
-ClusterVC_remove_write(ClusterVConnectionBase * vc)
+ClusterVC_remove_write(ClusterVConnectionBase *vc)
 {
-  ClusterVConnState * cs = &vc->write;
+  ClusterVConnState *cs = &vc->write;
   ink_assert(cs->queue);
   ((Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_write_link> *)cs->queue)->remove(vc);
   cs->queue = NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_ClusterCacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCacheInternal.h b/iocore/cluster/P_ClusterCacheInternal.h
index 8b62d44..503acb0 100644
--- a/iocore/cluster/P_ClusterCacheInternal.h
+++ b/iocore/cluster/P_ClusterCacheInternal.h
@@ -34,22 +34,22 @@
 //
 // Compilation Options
 //
-#define CACHE_USE_OPEN_VIO              0       // EXPERIMENTAL: not fully tested
-#define DO_REPLICATION                  0       // EXPERIMENTAL: not fully tested
+#define CACHE_USE_OPEN_VIO 0 // EXPERIMENTAL: not fully tested
+#define DO_REPLICATION 0     // EXPERIMENTAL: not fully tested
 
 //
 // Constants
 //
-#define META_DATA_FAST_ALLOC_LIMIT      1
-#define CACHE_CLUSTER_TIMEOUT           HRTIME_MSECONDS(5000)
-#define CACHE_RETRY_PERIOD              HRTIME_MSECONDS(10)
-#define REMOTE_CONNECT_HASH             (16 * 1024)
+#define META_DATA_FAST_ALLOC_LIMIT 1
+#define CACHE_CLUSTER_TIMEOUT HRTIME_MSECONDS(5000)
+#define CACHE_RETRY_PERIOD HRTIME_MSECONDS(10)
+#define REMOTE_CONNECT_HASH (16 * 1024)
 
 //
 // Macros
 //
-#define FOLDHASH(_ip,_seq) (_seq % REMOTE_CONNECT_HASH)
-#define ALIGN_DOUBLE(_p)   ((((uintptr_t) (_p)) + 7) & ~7)
+#define FOLDHASH(_ip, _seq) (_seq % REMOTE_CONNECT_HASH)
+#define ALIGN_DOUBLE(_p) ((((uintptr_t)(_p)) + 7) & ~7)
 #define ALLOCA_DOUBLE(_sz) ALIGN_DOUBLE(alloca((_sz) + 8))
 
 
@@ -60,7 +60,7 @@
 //#define TEST(_x) _x
 
 //#define TTEST(_x)
-//fprintf(stderr, _x " at: %d\n",
+// fprintf(stderr, _x " at: %d\n",
 //      ((unsigned int)(ink_get_hrtime()/HRTIME_MSECOND)) % 1000)
 #define TTEST(_x)
 
@@ -78,20 +78,18 @@ extern int ET_CLUSTER;
 // object.  Note, if the owning machine goes down the local machine
 // will be probed anyway.
 //
-#define PROBE_LOCAL_CACHE_FIRST        DO_REPLICATION
-#define PROBE_LOCAL_CACHE_LAST         false
+#define PROBE_LOCAL_CACHE_FIRST DO_REPLICATION
+#define PROBE_LOCAL_CACHE_LAST false
 
 //
 // This continuation handles all cache cluster traffic, on both
 // sides (state machine client and cache server)
 //
 struct CacheContinuation;
-typedef int (CacheContinuation::*CacheContHandler) (int, void *);
-struct CacheContinuation:public Continuation
-{
-  enum
-  {
-    MagicNo = 0x92183123
+typedef int (CacheContinuation::*CacheContHandler)(int, void *);
+struct CacheContinuation : public Continuation {
+  enum {
+    MagicNo = 0x92183123,
   };
   int magicno;
   void *callback_data;
@@ -107,11 +105,11 @@ struct CacheContinuation:public Continuation
   ClusterHandler *ch;
   VConnection *cache_vc;
   bool cache_read;
-  int result;                   // return event code
-  int result_error;             // error code associated with event
+  int result;       // return event code
+  int result_error; // error code associated with event
   ClusterVCToken token;
   unsigned int seq_number;
-  uint16_t cfl_flags;             // Request flags; see CFL_XXX defines
+  uint16_t cfl_flags; // Request flags; see CFL_XXX defines
   CacheFragType frag_type;
   int nbytes;
   unsigned int target_ip;
@@ -119,7 +117,7 @@ struct CacheContinuation:public Continuation
   bool request_purge;
   bool local_lookup_only;
   bool no_reply_message;
-  bool request_timeout;         // timeout occurred before
+  bool request_timeout; // timeout occurred before
   //   op complete
   bool expect_cache_callback;
 
@@ -132,7 +130,7 @@ struct CacheContinuation:public Continuation
 
   // setMsgBufferLen(), allocMsgBuffer() and freeMsgBuffer() data
 
-    Ptr<IOBufferData> rw_buf_msg;
+  Ptr<IOBufferData> rw_buf_msg;
   int rw_buf_msg_len;
 
   // open data
@@ -144,16 +142,16 @@ struct CacheContinuation:public Continuation
 
   // Readahead on open read specific data
 
-  int caller_buf_freebytes;     // remote bufsize for
+  int caller_buf_freebytes; // remote bufsize for
   //  initial data
   VIO *readahead_vio;
   IOBufferReader *readahead_reader;
-    Ptr<IOBufferBlock> readahead_data;
-  bool have_all_data;           // all object data in response
+  Ptr<IOBufferBlock> readahead_data;
+  bool have_all_data; // all object data in response
 
   CacheHTTPInfo cache_vc_info;
   OneWayTunnel *tunnel;
-    Ptr<ProxyMutex> tunnel_mutex;
+  Ptr<ProxyMutex> tunnel_mutex;
   CacheContinuation *tunnel_cont;
   bool tunnel_closed;
   Action *cache_action;
@@ -167,7 +165,7 @@ struct CacheContinuation:public Continuation
   CacheLookupHttpConfig *ic_params;
   CacheHTTPInfo ic_old_info;
   CacheHTTPInfo ic_new_info;
-    Ptr<IOBufferData> ic_hostname;
+  Ptr<IOBufferData> ic_hostname;
   int ic_hostname_len;
 
   // debugging
@@ -175,28 +173,30 @@ struct CacheContinuation:public Continuation
 
   int lookupEvent(int event, void *d);
   int probeLookupEvent(int event, void *d);
-  int remoteOpEvent(int event, Event * e);
+  int remoteOpEvent(int event, Event *e);
   int replyLookupEvent(int event, void *d);
-  int replyOpEvent(int event, VConnection * vc);
-  int handleReplyEvent(int event, Event * e);
-  int callbackEvent(int event, Event * e);
-  int setupVCdataRead(int event, VConnection * vc);
-  int VCdataRead(int event, VIO * target_vio);
+  int replyOpEvent(int event, VConnection *vc);
+  int handleReplyEvent(int event, Event *e);
+  int callbackEvent(int event, Event *e);
+  int setupVCdataRead(int event, VConnection *vc);
+  int VCdataRead(int event, VIO *target_vio);
   int setupReadWriteVC(int, VConnection *);
   ClusterVConnection *lookupOpenWriteVC();
   int lookupOpenWriteVCEvent(int, Event *);
-  int localVCsetupEvent(int event, ClusterVConnection * vc);
+  int localVCsetupEvent(int event, ClusterVConnection *vc);
   void insert_cache_callback_user(ClusterVConnection *, int, void *);
   int insertCallbackEvent(int, Event *);
   void callback_user(int result, void *d);
   void defer_callback_result(int result, void *d);
-  int callbackResultEvent(int event, Event * e);
+  int callbackResultEvent(int event, Event *e);
   void setupReadBufTunnel(VConnection *, VConnection *);
   int tunnelClosedEvent(int event, void *);
   int remove_and_delete(int, Event *);
 
 
-  inline void setMsgBufferLen(int l, IOBufferData * b = 0) {
+  inline void
+  setMsgBufferLen(int l, IOBufferData *b = 0)
+  {
     ink_assert(rw_buf_msg == 0);
     ink_assert(rw_buf_msg_len == 0);
 
@@ -204,12 +204,14 @@ struct CacheContinuation:public Continuation
     rw_buf_msg_len = l;
   }
 
-  inline int getMsgBufferLen()
+  inline int
+  getMsgBufferLen()
   {
     return rw_buf_msg_len;
   }
 
-  inline void allocMsgBuffer()
+  inline void
+  allocMsgBuffer()
   {
     ink_assert(rw_buf_msg == 0);
     ink_assert(rw_buf_msg_len);
@@ -220,18 +222,21 @@ struct CacheContinuation:public Continuation
     }
   }
 
-  inline char *getMsgBuffer()
+  inline char *
+  getMsgBuffer()
   {
     ink_assert(rw_buf_msg);
     return rw_buf_msg->data();
   }
 
-  inline IOBufferData *getMsgBufferIOBData()
+  inline IOBufferData *
+  getMsgBufferIOBData()
   {
     return rw_buf_msg;
   }
 
-  inline void freeMsgBuffer()
+  inline void
+  freeMsgBuffer()
   {
     if (rw_buf_msg) {
       rw_buf_msg = 0;
@@ -239,7 +244,8 @@ struct CacheContinuation:public Continuation
     }
   }
 
-  inline void free()
+  inline void
+  free()
   {
     token.clear();
 
@@ -271,52 +277,22 @@ struct CacheContinuation:public Continuation
     ic_hostname = 0;
   }
 
-CacheContinuation():
-  Continuation(NULL),
-    magicno(MagicNo),
-    callback_data(0),
-    callback_data_2(0),
-    timeout(0),
-    target_machine(0),
-    probe_depth(0),
-    start_time(0),
-    cache_read(false),
-    result(0),
-    result_error(0),
-    seq_number(0),
-    cfl_flags(0),
-    frag_type(CACHE_FRAG_TYPE_NONE),
-    nbytes(0),
-    target_ip(0),
-    request_opcode(0),
-    request_purge(false),
-    local_lookup_only(0),
-    no_reply_message(0),
-    request_timeout(0),
-    expect_cache_callback(true),
-    use_deferred_callback(0),
-    pin_in_cache(0),
-    rw_buf_msg_len(0),
-    read_cluster_vc(0),
-    write_cluster_vc(0),
-    cluster_vc_channel(0),
-    caller_buf_freebytes(0),
-    readahead_vio(0),
-    readahead_reader(0),
-    have_all_data(false),
-    cache_vc_info(),
-    tunnel(0),
-    tunnel_cont(0),
-    tunnel_closed(0),
-    lookup_open_write_vc_event(0),
-    ic_arena(),
-    ic_request(),
-    ic_response(), ic_params(0), ic_old_info(), ic_new_info(), ic_hostname_len(0), cache_op_ClusterFunction(0) {
+  CacheContinuation()
+    : Continuation(NULL), magicno(MagicNo), callback_data(0), callback_data_2(0), timeout(0), target_machine(0), probe_depth(0),
+      start_time(0), cache_read(false), result(0), result_error(0), seq_number(0), cfl_flags(0), frag_type(CACHE_FRAG_TYPE_NONE),
+      nbytes(0), target_ip(0), request_opcode(0), request_purge(false), local_lookup_only(0), no_reply_message(0),
+      request_timeout(0), expect_cache_callback(true), use_deferred_callback(0), pin_in_cache(0), rw_buf_msg_len(0),
+      read_cluster_vc(0), write_cluster_vc(0), cluster_vc_channel(0), caller_buf_freebytes(0), readahead_vio(0),
+      readahead_reader(0), have_all_data(false), cache_vc_info(), tunnel(0), tunnel_cont(0), tunnel_closed(0),
+      lookup_open_write_vc_event(0), ic_arena(), ic_request(), ic_response(), ic_params(0), ic_old_info(), ic_new_info(),
+      ic_hostname_len(0), cache_op_ClusterFunction(0)
+  {
     token.clear();
-    SET_HANDLER((CacheContHandler) & CacheContinuation::remoteOpEvent);
+    SET_HANDLER((CacheContHandler)&CacheContinuation::remoteOpEvent);
   }
 
-  inline static bool is_ClusterThread(EThread * et)
+  inline static bool
+  is_ClusterThread(EThread *et)
   {
     int etype = ET_CLUSTER;
     int i;
@@ -332,13 +308,12 @@ CacheContinuation():
   static int init();
   static CacheContinuation *cacheContAllocator_alloc();
   static void cacheContAllocator_free(CacheContinuation *);
-  inkcoreapi static Action *callback_failure(Action *, int, int, CacheContinuation * this_cc = 0);
+  inkcoreapi static Action *callback_failure(Action *, int, int, CacheContinuation *this_cc = 0);
   static Action *do_remote_lookup(Continuation *, CacheKey *, CacheContinuation *, CacheFragType, char *, int);
-  inkcoreapi static Action *do_op(Continuation *, ClusterMachine *, void *, int, char *, int,
-                                  int nbytes = -1, MIOBuffer * b = 0);
-  static int setup_local_vc(char *data, int data_len, CacheContinuation * cc, ClusterMachine * mp, Action **);
+  inkcoreapi static Action *do_op(Continuation *, ClusterMachine *, void *, int, char *, int, int nbytes = -1, MIOBuffer *b = 0);
+  static int setup_local_vc(char *data, int data_len, CacheContinuation *cc, ClusterMachine *mp, Action **);
   static void disposeOfDataBuffer(void *buf);
-  static int handleDisposeEvent(int event, CacheContinuation * cc);
+  static int handleDisposeEvent(int event, CacheContinuation *cc);
   static int32_t getObjectSize(VConnection *, int, CacheHTTPInfo *);
 };
 
@@ -348,82 +323,76 @@ CacheContinuation():
 
 // Bit definitions for cfl_flags.
 // Note: Limited to 16 bits
-#define CFL_OVERWRITE_ON_WRITE 		(1 << 1)
-#define CFL_REMOVE_USER_AGENTS 		(1 << 2)
-#define CFL_REMOVE_LINK 		(1 << 3)
-#define CFL_LOPENWRITE_HAVE_OLDINFO	(1 << 4)
-#define CFL_ALLOW_MULTIPLE_WRITES       (1 << 5)
-#define CFL_MAX 			(1 << 15)
-
-struct CacheOpArgs_General
-{
+#define CFL_OVERWRITE_ON_WRITE (1 << 1)
+#define CFL_REMOVE_USER_AGENTS (1 << 2)
+#define CFL_REMOVE_LINK (1 << 3)
+#define CFL_LOPENWRITE_HAVE_OLDINFO (1 << 4)
+#define CFL_ALLOW_MULTIPLE_WRITES (1 << 5)
+#define CFL_MAX (1 << 15)
+
+struct CacheOpArgs_General {
   INK_MD5 *url_md5;
-  time_t pin_in_cache;          // open_write() specific arg
+  time_t pin_in_cache; // open_write() specific arg
   CacheFragType frag_type;
   uint16_t cfl_flags;
 
-    CacheOpArgs_General():url_md5(NULL), pin_in_cache(0), frag_type(CACHE_FRAG_TYPE_NONE), cfl_flags(0)
-  {
-  }
+  CacheOpArgs_General() : url_md5(NULL), pin_in_cache(0), frag_type(CACHE_FRAG_TYPE_NONE), cfl_flags(0) {}
 };
 
-struct CacheOpArgs_Link
-{
+struct CacheOpArgs_Link {
   INK_MD5 *from;
   INK_MD5 *to;
-  uint16_t cfl_flags;             // see CFL_XXX defines
+  uint16_t cfl_flags; // see CFL_XXX defines
   CacheFragType frag_type;
 
-    CacheOpArgs_Link():from(NULL), to(NULL), cfl_flags(0), frag_type(CACHE_FRAG_TYPE_NONE)
-  {
-  }
+  CacheOpArgs_Link() : from(NULL), to(NULL), cfl_flags(0), frag_type(CACHE_FRAG_TYPE_NONE) {}
 };
 
-struct CacheOpArgs_Deref
-{
+struct CacheOpArgs_Deref {
   INK_MD5 *md5;
-  uint16_t cfl_flags;             // see CFL_XXX defines
+  uint16_t cfl_flags; // see CFL_XXX defines
   CacheFragType frag_type;
 
-    CacheOpArgs_Deref():md5(NULL), cfl_flags(0), frag_type(CACHE_FRAG_TYPE_NONE)
-  {
-  }
+  CacheOpArgs_Deref() : md5(NULL), cfl_flags(0), frag_type(CACHE_FRAG_TYPE_NONE) {}
 };
 
 ///////////////////////////////////
 // Over the wire message formats //
 ///////////////////////////////////
-struct CacheLookupMsg:public ClusterMessageHeader
-{
+struct CacheLookupMsg : public ClusterMessageHeader {
   INK_MD5 url_md5;
   uint32_t seq_number;
   uint32_t frag_type;
   Alias32 moi;
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    CACHE_LOOKUP_MESSAGE_VERSION = MAX_VERSION
+    CACHE_LOOKUP_MESSAGE_VERSION = MAX_VERSION,
   };
-  CacheLookupMsg(uint16_t vers = CACHE_LOOKUP_MESSAGE_VERSION):
-  ClusterMessageHeader(vers), seq_number(0), frag_type(0) {
+  CacheLookupMsg(uint16_t vers = CACHE_LOOKUP_MESSAGE_VERSION) : ClusterMessageHeader(vers), seq_number(0), frag_type(0)
+  {
     moi.u32 = 0;
   }
 
   //////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return CACHE_LOOKUP_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) ALIGN_DOUBLE(offsetof(CacheLookupMsg, moi));
+    return (int)ALIGN_DOUBLE(offsetof(CacheLookupMsg, moi));
   }
-  void init(uint16_t vers = CACHE_LOOKUP_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = CACHE_LOOKUP_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ink_release_assert(!"No byte swap for INK_MD5");
@@ -434,45 +403,49 @@ struct CacheLookupMsg:public ClusterMessageHeader
   //////////////////////////////////////////////////////////////////////////
 };
 
-struct CacheOpMsg_long:public ClusterMessageHeader
-{
+struct CacheOpMsg_long : public ClusterMessageHeader {
   uint8_t opcode;
   uint8_t frag_type;
-  uint16_t cfl_flags;             // see CFL_XXX defines
+  uint16_t cfl_flags; // see CFL_XXX defines
   INK_MD5 url_md5;
   uint32_t seq_number;
   uint32_t nbytes;
-  uint32_t data;                  // used by open_write()
-  int32_t channel;                // used by open interfaces
+  uint32_t data;   // used by open_write()
+  int32_t channel; // used by open interfaces
   ClusterVCToken token;
-  int32_t buffer_size;            // used by open read interface
+  int32_t buffer_size; // used by open read interface
   Alias32 moi;
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    CACHE_OP_LONG_MESSAGE_VERSION = MAX_VERSION
+    CACHE_OP_LONG_MESSAGE_VERSION = MAX_VERSION,
   };
-  CacheOpMsg_long(uint16_t vers = CACHE_OP_LONG_MESSAGE_VERSION):
-  ClusterMessageHeader(vers),
-    opcode(0), frag_type(0), cfl_flags(0), seq_number(0), nbytes(0), data(0), channel(0), buffer_size(0) {
+  CacheOpMsg_long(uint16_t vers = CACHE_OP_LONG_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), opcode(0), frag_type(0), cfl_flags(0), seq_number(0), nbytes(0), data(0), channel(0),
+      buffer_size(0)
+  {
     moi.u32 = 0;
   }
 
   //////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return CACHE_OP_LONG_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) ALIGN_DOUBLE(offsetof(CacheOpMsg_long, moi));
+    return (int)ALIGN_DOUBLE(offsetof(CacheOpMsg_long, moi));
   }
-  void init(uint16_t vers = CACHE_OP_LONG_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = CACHE_OP_LONG_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ink_release_assert(!"No byte swap for INK_MD5");
@@ -480,56 +453,60 @@ struct CacheOpMsg_long:public ClusterMessageHeader
       ats_swap32(&seq_number);
       ats_swap32(&nbytes);
       ats_swap32(&data);
-      ats_swap32((uint32_t *) & channel);
+      ats_swap32((uint32_t *)&channel);
       token.SwapBytes();
-      ats_swap32((uint32_t *) & buffer_size);
-      ats_swap32((uint32_t *) & frag_type);
+      ats_swap32((uint32_t *)&buffer_size);
+      ats_swap32((uint32_t *)&frag_type);
     }
   }
   //////////////////////////////////////////////////////////////////////////
 };
 
-struct CacheOpMsg_short:public ClusterMessageHeader
-{
+struct CacheOpMsg_short : public ClusterMessageHeader {
   uint8_t opcode;
-  uint8_t frag_type;              // currently used by open_write() (low level)
-  uint16_t cfl_flags;             // see CFL_XXX defines
+  uint8_t frag_type;  // currently used by open_write() (low level)
+  uint16_t cfl_flags; // see CFL_XXX defines
   INK_MD5 md5;
   uint32_t seq_number;
   uint32_t nbytes;
-  uint32_t data;                  // currently used by open_write() (low level)
-  int32_t channel;                // used by open interfaces
-  ClusterVCToken token;         // used by open interfaces
-  int32_t buffer_size;            // used by open read interface
+  uint32_t data;        // currently used by open_write() (low level)
+  int32_t channel;      // used by open interfaces
+  ClusterVCToken token; // used by open interfaces
+  int32_t buffer_size;  // used by open read interface
 
   // Variable portion of message
   Alias32 moi;
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    CACHE_OP_SHORT_MESSAGE_VERSION = MAX_VERSION
+    CACHE_OP_SHORT_MESSAGE_VERSION = MAX_VERSION,
   };
-  CacheOpMsg_short(uint16_t vers = CACHE_OP_SHORT_MESSAGE_VERSION):
-  ClusterMessageHeader(vers),
-    opcode(0), frag_type(0), cfl_flags(0), seq_number(0), nbytes(0), data(0), channel(0), buffer_size(0) {
+  CacheOpMsg_short(uint16_t vers = CACHE_OP_SHORT_MESSAGE_VERSION)
+    : ClusterMessageHeader(vers), opcode(0), frag_type(0), cfl_flags(0), seq_number(0), nbytes(0), data(0), channel(0),
+      buffer_size(0)
+  {
     moi.u32 = 0;
   }
 
   //////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return CACHE_OP_SHORT_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) ALIGN_DOUBLE(offsetof(CacheOpMsg_short, moi));
+    return (int)ALIGN_DOUBLE(offsetof(CacheOpMsg_short, moi));
   }
-  void init(uint16_t vers = CACHE_OP_SHORT_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = CACHE_OP_SHORT_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ink_release_assert(!"No byte swap for INK_MD5");
@@ -538,8 +515,8 @@ struct CacheOpMsg_short:public ClusterMessageHeader
       ats_swap32(&nbytes);
       ats_swap32(&data);
       if (opcode == CACHE_OPEN_READ) {
-        ats_swap32((uint32_t *) & buffer_size);
-        ats_swap32((uint32_t *) & channel);
+        ats_swap32((uint32_t *)&buffer_size);
+        ats_swap32((uint32_t *)&channel);
         token.SwapBytes();
       }
     }
@@ -547,39 +524,43 @@ struct CacheOpMsg_short:public ClusterMessageHeader
   //////////////////////////////////////////////////////////////////////////
 };
 
-struct CacheOpMsg_short_2:public ClusterMessageHeader
-{
+struct CacheOpMsg_short_2 : public ClusterMessageHeader {
   uint8_t opcode;
   uint8_t frag_type;
-  uint16_t cfl_flags;             // see CFL_XXX defines
+  uint16_t cfl_flags; // see CFL_XXX defines
   INK_MD5 md5_1;
   INK_MD5 md5_2;
   uint32_t seq_number;
   Alias32 moi;
-  enum
-  {
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    CACHE_OP_SHORT_2_MESSAGE_VERSION = MAX_VERSION
+    CACHE_OP_SHORT_2_MESSAGE_VERSION = MAX_VERSION,
   };
   CacheOpMsg_short_2(uint16_t vers = CACHE_OP_SHORT_2_MESSAGE_VERSION)
-    :  ClusterMessageHeader(vers), opcode(0), frag_type(0), cfl_flags(0), seq_number(0) {
+    : ClusterMessageHeader(vers), opcode(0), frag_type(0), cfl_flags(0), seq_number(0)
+  {
     moi.u32 = 0;
   }
   //////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return CACHE_OP_SHORT_2_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) ALIGN_DOUBLE(offsetof(CacheOpMsg_short_2, moi));
+    return (int)ALIGN_DOUBLE(offsetof(CacheOpMsg_short_2, moi));
   }
-  void init(uint16_t vers = CACHE_OP_SHORT_2_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = CACHE_OP_SHORT_2_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ink_release_assert(!"No byte swap for MD5_1");
@@ -591,42 +572,46 @@ struct CacheOpMsg_short_2:public ClusterMessageHeader
   //////////////////////////////////////////////////////////////////////////
 };
 
-struct CacheOpReplyMsg:public ClusterMessageHeader
-{
+struct CacheOpReplyMsg : public ClusterMessageHeader {
   uint32_t seq_number;
   int32_t result;
   ClusterVCToken token;
-  bool is_ram_cache_hit;          // Entire object was from ram cache
-  Alias32 moi;                 // Used by CACHE_OPEN_READ & CACHE_LINK reply
-  enum
-  {
+  bool is_ram_cache_hit; // Entire object was from ram cache
+  Alias32 moi;           // Used by CACHE_OPEN_READ & CACHE_LINK reply
+  enum {
     MIN_VERSION = 1,
     MAX_VERSION = 1,
-    CACHE_OP_REPLY_MESSAGE_VERSION = MAX_VERSION
+    CACHE_OP_REPLY_MESSAGE_VERSION = MAX_VERSION,
   };
   CacheOpReplyMsg(uint16_t vers = CACHE_OP_REPLY_MESSAGE_VERSION)
-    : ClusterMessageHeader(vers), seq_number(0), result(0), is_ram_cache_hit(false) {
+    : ClusterMessageHeader(vers), seq_number(0), result(0), is_ram_cache_hit(false)
+  {
     moi.u32 = 0;
   }
 
   //////////////////////////////////////////////////////////////////////////
-  static int protoToVersion(int protoMajor)
+  static int
+  protoToVersion(int protoMajor)
   {
-    (void) protoMajor;
+    (void)protoMajor;
     return CACHE_OP_REPLY_MESSAGE_VERSION;
   }
-  static int sizeof_fixedlen_msg()
+  static int
+  sizeof_fixedlen_msg()
   {
-    return (int) ALIGN_DOUBLE(offsetof(CacheOpReplyMsg, moi));
+    return (int)ALIGN_DOUBLE(offsetof(CacheOpReplyMsg, moi));
   }
-  void init(uint16_t vers = CACHE_OP_REPLY_MESSAGE_VERSION) {
+  void
+  init(uint16_t vers = CACHE_OP_REPLY_MESSAGE_VERSION)
+  {
     _init(vers);
   }
-  inline void SwapBytes()
+  inline void
+  SwapBytes()
   {
     if (NeedByteSwap()) {
       ats_swap32(&seq_number);
-      ats_swap32((uint32_t *) & result);
+      ats_swap32((uint32_t *)&result);
       token.SwapBytes();
     }
   }
@@ -643,44 +628,37 @@ inline int
 op_to_sizeof_fixedlen_msg(int op)
 {
   switch (op) {
-  case CACHE_LOOKUP_OP:
-    {
-      return CacheLookupMsg::sizeof_fixedlen_msg();
-    }
+  case CACHE_LOOKUP_OP: {
+    return CacheLookupMsg::sizeof_fixedlen_msg();
+  }
   case CACHE_OPEN_WRITE_BUFFER:
-  case CACHE_OPEN_WRITE_BUFFER_LONG:
-    {
-      ink_release_assert(!"op_to_sizeof_fixedlen_msg() op not supported");
-      return 0;
-    }
+  case CACHE_OPEN_WRITE_BUFFER_LONG: {
+    ink_release_assert(!"op_to_sizeof_fixedlen_msg() op not supported");
+    return 0;
+  }
   case CACHE_OPEN_WRITE:
   case CACHE_OPEN_READ:
-  case CACHE_OPEN_READ_BUFFER:
-    {
-      return CacheOpMsg_short::sizeof_fixedlen_msg();
-    }
+  case CACHE_OPEN_READ_BUFFER: {
+    return CacheOpMsg_short::sizeof_fixedlen_msg();
+  }
   case CACHE_OPEN_READ_LONG:
   case CACHE_OPEN_READ_BUFFER_LONG:
-  case CACHE_OPEN_WRITE_LONG:
-    {
-      return CacheOpMsg_long::sizeof_fixedlen_msg();
-    }
+  case CACHE_OPEN_WRITE_LONG: {
+    return CacheOpMsg_long::sizeof_fixedlen_msg();
+  }
   case CACHE_UPDATE:
   case CACHE_REMOVE:
-  case CACHE_DEREF:
-    {
-      return CacheOpMsg_short::sizeof_fixedlen_msg();
-    }
-  case CACHE_LINK:
-    {
-      return CacheOpMsg_short_2::sizeof_fixedlen_msg();
-    }
-  default:
-    {
-      ink_release_assert(!"op_to_sizeof_fixedlen_msg() unknown op");
-      return 0;
-    }
-  }                             // End of switch
+  case CACHE_DEREF: {
+    return CacheOpMsg_short::sizeof_fixedlen_msg();
+  }
+  case CACHE_LINK: {
+    return CacheOpMsg_short_2::sizeof_fixedlen_msg();
+  }
+  default: {
+    ink_release_assert(!"op_to_sizeof_fixedlen_msg() unknown op");
+    return 0;
+  }
+  } // End of switch
 }
 
 //////////////////////////////////////////////////////////////////////////////


[50/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_crashlog/procinfo.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_crashlog/procinfo.cc b/cmd/traffic_crashlog/procinfo.cc
index 4886530..cb15b87 100644
--- a/cmd/traffic_crashlog/procinfo.cc
+++ b/cmd/traffic_crashlog/procinfo.cc
@@ -25,7 +25,7 @@
 #include <sys/utsname.h>
 
 static int
-procfd_open(pid_t pid, const char * fname)
+procfd_open(pid_t pid, const char *fname)
 {
   char path[128];
   snprintf(path, sizeof(path), "/proc/%ld/%s", (long)pid, fname);
@@ -33,7 +33,7 @@ procfd_open(pid_t pid, const char * fname)
 }
 
 static char *
-procfd_readlink(pid_t pid, const char * fname)
+procfd_readlink(pid_t pid, const char *fname)
 {
   char path[128];
   ssize_t nbytes;
@@ -51,7 +51,7 @@ procfd_readlink(pid_t pid, const char * fname)
 }
 
 bool
-crashlog_write_regions(FILE * fp, const crashlog_target& target)
+crashlog_write_regions(FILE *fp, const crashlog_target &target)
 {
   ats_scoped_fd fd;
   textBuffer text(0);
@@ -67,7 +67,7 @@ crashlog_write_regions(FILE * fp, const crashlog_target& target)
 }
 
 bool
-crashlog_write_uname(FILE * fp, const crashlog_target&)
+crashlog_write_uname(FILE *fp, const crashlog_target &)
 {
   struct utsname uts;
 
@@ -81,7 +81,7 @@ crashlog_write_uname(FILE * fp, const crashlog_target&)
 }
 
 bool
-crashlog_write_exename(FILE * fp, const crashlog_target& target)
+crashlog_write_exename(FILE *fp, const crashlog_target &target)
 {
   ats_scoped_str str;
 
@@ -95,11 +95,11 @@ crashlog_write_exename(FILE * fp, const crashlog_target& target)
 }
 
 bool
-crashlog_write_procname(FILE * fp, const crashlog_target& target)
+crashlog_write_procname(FILE *fp, const crashlog_target &target)
 {
-  ats_scoped_fd   fd;
-  ats_scoped_str  str;
-  textBuffer      text(0);
+  ats_scoped_fd fd;
+  ats_scoped_str str;
+  textBuffer text(0);
 
   fd = procfd_open(target.pid, "comm");
   if (fd != -1) {
@@ -114,7 +114,7 @@ crashlog_write_procname(FILE * fp, const crashlog_target& target)
 }
 
 bool
-crashlog_write_datime(FILE * fp, const crashlog_target& target)
+crashlog_write_datime(FILE *fp, const crashlog_target &target)
 {
   char buf[128];
 
@@ -124,10 +124,10 @@ crashlog_write_datime(FILE * fp, const crashlog_target& target)
 }
 
 bool
-crashlog_write_procstatus(FILE * fp, const crashlog_target& target)
+crashlog_write_procstatus(FILE *fp, const crashlog_target &target)
 {
-  ats_scoped_fd   fd;
-  textBuffer      text(0);
+  ats_scoped_fd fd;
+  textBuffer text(0);
 
   fd = procfd_open(target.pid, "status");
   if (fd != -1) {
@@ -141,7 +141,7 @@ crashlog_write_procstatus(FILE * fp, const crashlog_target& target)
 }
 
 bool
-crashlog_write_backtrace(FILE * fp, const crashlog_target&)
+crashlog_write_backtrace(FILE *fp, const crashlog_target &)
 {
   TSString trace = NULL;
   TSMgmtError mgmterr;
@@ -152,7 +152,7 @@ crashlog_write_backtrace(FILE * fp, const crashlog_target&)
   // kernel locking the process information?
 
   if ((mgmterr = TSProxyBacktraceGet(0, &trace)) != TS_ERR_OKAY) {
-    char * msg = TSGetErrorMessage(mgmterr);
+    char *msg = TSGetErrorMessage(mgmterr);
     fprintf(fp, "Unable to retrieve backtrace: %s\n", msg);
     TSfree(msg);
     return false;
@@ -164,14 +164,14 @@ crashlog_write_backtrace(FILE * fp, const crashlog_target&)
 }
 
 bool
-crashlog_write_records(FILE * fp, const crashlog_target&)
+crashlog_write_records(FILE *fp, const crashlog_target &)
 {
   TSMgmtError mgmterr;
   TSList list = TSListCreate();
   bool success = false;
 
   if ((mgmterr = TSRecordGetMatchMlt(".", list)) != TS_ERR_OKAY) {
-    char * msg = TSGetErrorMessage(mgmterr);
+    char *msg = TSGetErrorMessage(mgmterr);
     fprintf(fp, "Unable to retrieve Traffic Server records: %s\n", msg);
     TSfree(msg);
     goto done;
@@ -179,9 +179,7 @@ crashlog_write_records(FILE * fp, const crashlog_target&)
 
   // If the RPC call failed, the list will be empty, so we won't print anything. Otherwise,
   // print all the results, freeing them as we go.
-  for (TSRecordEle * rec_ele = (TSRecordEle *) TSListDequeue(list); rec_ele;
-      rec_ele = (TSRecordEle *) TSListDequeue(list)) {
-
+  for (TSRecordEle *rec_ele = (TSRecordEle *)TSListDequeue(list); rec_ele; rec_ele = (TSRecordEle *)TSListDequeue(list)) {
     if (!success) {
       success = true;
       fprintf(fp, "Traffic Server Configuration Records:\n");
@@ -214,7 +212,7 @@ done:
 }
 
 bool
-crashlog_write_siginfo(FILE * fp, const crashlog_target& target)
+crashlog_write_siginfo(FILE *fp, const crashlog_target &target)
 {
   char tmp[32];
 
@@ -224,8 +222,7 @@ crashlog_write_siginfo(FILE * fp, const crashlog_target& target)
   }
 
   fprintf(fp, "Signal Status:\n");
-  fprintf(fp, LABELFMT "%d (%s)\n", "siginfo.si_signo:",
-      target.siginfo.si_signo, strsignal(target.siginfo.si_signo));
+  fprintf(fp, LABELFMT "%d (%s)\n", "siginfo.si_signo:", target.siginfo.si_signo, strsignal(target.siginfo.si_signo));
 
   snprintf(tmp, sizeof(tmp), "%ld", (long)target.siginfo.si_pid);
   fprintf(fp, LABELFMT LABELFMT, "siginfo.si_pid:", tmp);
@@ -238,17 +235,20 @@ crashlog_write_siginfo(FILE * fp, const crashlog_target& target)
   fprintf(fp, "\n");
 
   if (target.siginfo.si_code == SI_USER) {
-    fprintf(fp,  "Signal delivered by user %ld from process %ld\n",
-      (long)target.siginfo.si_uid, (long)target.siginfo.si_pid);
+    fprintf(fp, "Signal delivered by user %ld from process %ld\n", (long)target.siginfo.si_uid, (long)target.siginfo.si_pid);
     return true;
   }
 
   if (target.siginfo.si_signo == SIGSEGV) {
-    const char * msg = "Unknown error";
+    const char *msg = "Unknown error";
 
     switch (target.siginfo.si_code) {
-    case SEGV_MAPERR: msg = "No object mapped"; break;
-    case SEGV_ACCERR: msg = "Invalid permissions for mapped object"; break;
+    case SEGV_MAPERR:
+      msg = "No object mapped";
+      break;
+    case SEGV_ACCERR:
+      msg = "Invalid permissions for mapped object";
+      break;
     }
 
     fprintf(fp, "%s at address " ADDRFMT "\n", msg, ADDRCAST(target.siginfo.si_addr));
@@ -256,12 +256,18 @@ crashlog_write_siginfo(FILE * fp, const crashlog_target& target)
   }
 
   if (target.siginfo.si_signo == SIGSEGV) {
-    const char * msg = "Unknown error";
+    const char *msg = "Unknown error";
 
     switch (target.siginfo.si_code) {
-    case BUS_ADRALN: msg = "Invalid address alignment"; break;
-    case BUS_ADRERR: msg = "Nonexistent physical address"; break;
-    case BUS_OBJERR: msg = "Object-specific hardware error"; break;
+    case BUS_ADRALN:
+      msg = "Invalid address alignment";
+      break;
+    case BUS_ADRERR:
+      msg = "Nonexistent physical address";
+      break;
+    case BUS_OBJERR:
+      msg = "Object-specific hardware error";
+      break;
     }
 
     fprintf(fp, "%s at address " ADDRFMT "\n", msg, ADDRCAST(target.siginfo.si_addr));
@@ -272,7 +278,7 @@ crashlog_write_siginfo(FILE * fp, const crashlog_target& target)
 }
 
 bool
-crashlog_write_registers(FILE * fp, const crashlog_target& target)
+crashlog_write_registers(FILE *fp, const crashlog_target &target)
 {
   if (!(CRASHLOG_HAVE_THREADINFO & target.flags)) {
     fprintf(fp, "No target CPU registers\n");
@@ -281,30 +287,24 @@ crashlog_write_registers(FILE * fp, const crashlog_target& target)
 
 #if defined(__linux__) && (defined(__x86_64__) || defined(__i386__))
 
-  // x86 register names as per ucontext.h.
+// x86 register names as per ucontext.h.
 #if defined(__i386__)
 #define REGFMT "0x%08" PRIx32
 #define REGCAST(x) ((uint32_t)(x))
-  static const char * names[NGREG] = {
-    "GS", "FS", "ES", "DS", "EDI", "ESI", "EBP", "ESP",
-    "EBX", "EDX", "ECX", "EAX", "TRAPNO", "ERR", "EIP", "CS",
-    "EFL", "UESP", "SS"
-  };
+  static const char *names[NGREG] = {"GS",  "FS",  "ES",     "DS",  "EDI", "ESI", "EBP", "ESP",  "EBX", "EDX",
+                                     "ECX", "EAX", "TRAPNO", "ERR", "EIP", "CS",  "EFL", "UESP", "SS"};
 #endif
 
 #if defined(__x86_64__)
 #define REGFMT "0x%016" PRIx64
 #define REGCAST(x) ((uint64_t)(x))
-  static const char * names[NGREG] = {
-    "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15",
-    "RDI", "RSI", "RBP", "RBX", "RDX", "RAX", "RCX", "RSP",
-    "RIP", "EFL", "CSGSFS", "ERR", "TRAPNO", "OLDMASK", "CR2"
-  };
+  static const char *names[NGREG] = {"R8",  "R9",  "R10", "R11", "R12", "R13", "R14",    "R15", "RDI",    "RSI",     "RBP", "RBX",
+                                     "RDX", "RAX", "RCX", "RSP", "RIP", "EFL", "CSGSFS", "ERR", "TRAPNO", "OLDMASK", "CR2"};
 #endif
 
   fprintf(fp, "CPU Registers:\n");
   for (unsigned i = 0; i < countof(names); ++i) {
-    const char * trailer = ((i % 4) == 3) ? "\n" : " ";
+    const char *trailer = ((i % 4) == 3) ? "\n" : " ";
     fprintf(fp, "%-3s:" REGFMT "%s", names[i], REGCAST(target.ucontext.uc_mcontext.gregs[i]), trailer);
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_crashlog/traffic_crashlog.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_crashlog/traffic_crashlog.cc b/cmd/traffic_crashlog/traffic_crashlog.cc
index c459549..7c5599f 100644
--- a/cmd/traffic_crashlog/traffic_crashlog.cc
+++ b/cmd/traffic_crashlog/traffic_crashlog.cc
@@ -32,22 +32,21 @@
 static int syslog_mode = false;
 static int debug_mode = false;
 static int wait_mode = false;
-static char * host_triplet = NULL;
-static int  target_pid = getppid();
+static char *host_triplet = NULL;
+static int target_pid = getppid();
 
 // If pid_t is not sizeof(int), we will have to jiggle argument parsing.
 extern char __pid_size_static_assert[sizeof(pid_t) == sizeof(int) ? 0 : -1];
 
 static AppVersionInfo appVersionInfo;
 static const ArgumentDescription argument_descriptions[] = {
-  { "target", '-', "Target process ID", "I", &target_pid, NULL, NULL },
-  { "host", '-', "Host triplet for the process being logged", "S*", &host_triplet, NULL, NULL },
-  { "wait", '-', "Stop until signalled at startup", "F", &wait_mode, NULL, NULL },
-  { "syslog", '-', "Syslog after writing a crash log", "F", &syslog_mode, NULL, NULL },
-  { "debug", '-', "Enable debugging mode", "F", &debug_mode, NULL, NULL },
+  {"target", '-', "Target process ID", "I", &target_pid, NULL, NULL},
+  {"host", '-', "Host triplet for the process being logged", "S*", &host_triplet, NULL, NULL},
+  {"wait", '-', "Stop until signalled at startup", "F", &wait_mode, NULL, NULL},
+  {"syslog", '-', "Syslog after writing a crash log", "F", &syslog_mode, NULL, NULL},
+  {"debug", '-', "Enable debugging mode", "F", &debug_mode, NULL, NULL},
   HELP_ARGUMENT_DESCRIPTION(),
-  VERSION_ARGUMENT_DESCRIPTION()
-};
+  VERSION_ARGUMENT_DESCRIPTION()};
 
 static struct tm
 timestamp()
@@ -62,10 +61,10 @@ timestamp()
 static char *
 crashlog_name()
 {
-  char            filename[64];
-  struct tm       now = timestamp();
-  ats_scoped_str  logdir(RecConfigReadLogDir());
-  ats_scoped_str  pathname;
+  char filename[64];
+  struct tm now = timestamp();
+  ats_scoped_str logdir(RecConfigReadLogDir());
+  ats_scoped_str pathname;
 
   strftime(filename, sizeof(filename), "crash-%Y-%m-%d-%H%M%S.log", &now);
   pathname = Layout::relative_to(logdir, filename);
@@ -74,7 +73,7 @@ crashlog_name()
 }
 
 static FILE *
-crashlog_open(const char * path)
+crashlog_open(const char *path)
 {
   int fd;
 
@@ -85,15 +84,14 @@ crashlog_open(const char * path)
 int
 main(int /* argc ATS_UNUSED */, const char **argv)
 {
-  FILE * fp;
-  char * logname;
+  FILE *fp;
+  char *logname;
   TSMgmtError mgmterr;
   crashlog_target target;
 
   diags = new Diags("" /* tags */, "" /* actions */, stderr);
 
-  appVersionInfo.setup(PACKAGE_NAME, "traffic_crashlog", PACKAGE_VERSION,
-          __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
+  appVersionInfo.setup(PACKAGE_NAME, "traffic_crashlog", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
 
   // Process command line arguments and dump into variables
   process_args(&appVersionInfo, argument_descriptions, countof(argument_descriptions), argv);
@@ -138,13 +136,12 @@ main(int /* argc ATS_UNUSED */, const char **argv)
     diags->config.outputs[DL_Emergency].to_syslog = true;
   }
 
-  Note("crashlog started, target=%ld, debug=%s syslog=%s, uid=%ld euid=%ld",
-      (long)target_pid, debug_mode ? "true" : "false", syslog_mode ? "true" : "false",
-      (long)getuid(), (long)geteuid());
+  Note("crashlog started, target=%ld, debug=%s syslog=%s, uid=%ld euid=%ld", (long)target_pid, debug_mode ? "true" : "false",
+       syslog_mode ? "true" : "false", (long)getuid(), (long)geteuid());
 
   mgmterr = TSInit(NULL, (TSInitOptionT)(TS_MGMT_OPT_NO_EVENTS | TS_MGMT_OPT_NO_SOCK_TESTS));
   if (mgmterr != TS_ERR_OKAY) {
-    char * msg = TSGetErrorMessage(mgmterr);
+    char *msg = TSGetErrorMessage(mgmterr);
     Warning("failed to intialize management API: %s", msg);
     TSfree(msg);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_crashlog/traffic_crashlog.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_crashlog/traffic_crashlog.h b/cmd/traffic_crashlog/traffic_crashlog.h
index f86a285..0b066d1 100644
--- a/cmd/traffic_crashlog/traffic_crashlog.h
+++ b/cmd/traffic_crashlog/traffic_crashlog.h
@@ -49,28 +49,27 @@
 
 #define CRASHLOG_HAVE_THREADINFO 0x1u
 
-struct crashlog_target
-{
-  pid_t       pid;
-  siginfo_t   siginfo;
+struct crashlog_target {
+  pid_t pid;
+  siginfo_t siginfo;
 #if defined(__linux__)
-  ucontext_t  ucontext;
+  ucontext_t ucontext;
 #else
-  char        ucontext; // just a placeholder ...
+  char ucontext; // just a placeholder ...
 #endif
-  struct tm   timestamp;
-  unsigned    flags;
+  struct tm timestamp;
+  unsigned flags;
 };
 
-bool crashlog_write_backtrace(FILE *, const crashlog_target&);
-bool crashlog_write_regions(FILE * , const crashlog_target&);
-bool crashlog_write_exename(FILE *, const crashlog_target&);
-bool crashlog_write_uname(FILE *, const crashlog_target&);
-bool crashlog_write_datime(FILE *, const crashlog_target&);
-bool crashlog_write_procname(FILE *, const crashlog_target&);
-bool crashlog_write_procstatus(FILE *, const crashlog_target&);
-bool crashlog_write_records(FILE *, const crashlog_target&);
-bool crashlog_write_siginfo(FILE *, const crashlog_target&);
-bool crashlog_write_registers(FILE *, const crashlog_target&);
+bool crashlog_write_backtrace(FILE *, const crashlog_target &);
+bool crashlog_write_regions(FILE *, const crashlog_target &);
+bool crashlog_write_exename(FILE *, const crashlog_target &);
+bool crashlog_write_uname(FILE *, const crashlog_target &);
+bool crashlog_write_datime(FILE *, const crashlog_target &);
+bool crashlog_write_procname(FILE *, const crashlog_target &);
+bool crashlog_write_procstatus(FILE *, const crashlog_target &);
+bool crashlog_write_records(FILE *, const crashlog_target &);
+bool crashlog_write_siginfo(FILE *, const crashlog_target &);
+bool crashlog_write_registers(FILE *, const crashlog_target &);
 
 #endif /* __TRAFFIC_CRASHLOG_H__ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/alarm.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/alarm.cc b/cmd/traffic_ctl/alarm.cc
index 404069c..c341ffa 100644
--- a/cmd/traffic_ctl/alarm.cc
+++ b/cmd/traffic_ctl/alarm.cc
@@ -23,15 +23,18 @@
 
 #include "traffic_ctl.h"
 
-struct AlarmListPolicy
-{
-  typedef char * entry_type;
+struct AlarmListPolicy {
+  typedef char *entry_type;
 
-  static void free(entry_type e) {
+  static void
+  free(entry_type e)
+  {
     TSfree(e);
   }
 
-  static entry_type cast(void * ptr) {
+  static entry_type
+  cast(void *ptr)
+  {
     return (entry_type)ptr;
   }
 };
@@ -39,7 +42,7 @@ struct AlarmListPolicy
 typedef CtrlMgmtList<AlarmListPolicy> CtrlAlarmList;
 
 static int
-alarm_list(unsigned argc, const char ** argv)
+alarm_list(unsigned argc, const char **argv)
 {
   TSMgmtError error;
   CtrlAlarmList alarms;
@@ -55,7 +58,7 @@ alarm_list(unsigned argc, const char ** argv)
   }
 
   while (!alarms.empty()) {
-    char * a = alarms.next();
+    char *a = alarms.next();
     printf("%s\n", a);
     TSfree(a);
   }
@@ -64,7 +67,7 @@ alarm_list(unsigned argc, const char ** argv)
 }
 
 static int
-alarm_clear(unsigned argc, const char ** argv)
+alarm_clear(unsigned argc, const char **argv)
 {
   TSMgmtError error;
   CtrlAlarmList alarms;
@@ -82,7 +85,7 @@ alarm_clear(unsigned argc, const char ** argv)
 
   // Now resolve them all ...
   while (!alarms.empty()) {
-    char * a = alarms.next();
+    char *a = alarms.next();
 
     error = TSEventResolve(a);
     if (error != TS_ERR_OKAY) {
@@ -98,7 +101,7 @@ alarm_clear(unsigned argc, const char ** argv)
 }
 
 static int
-alarm_resolve(unsigned argc, const char ** argv)
+alarm_resolve(unsigned argc, const char **argv)
 {
   TSMgmtError error;
   CtrlAlarmList alarms;
@@ -119,16 +122,15 @@ alarm_resolve(unsigned argc, const char ** argv)
 }
 
 int
-subcommand_alarm(unsigned argc, const char ** argv)
+subcommand_alarm(unsigned argc, const char **argv)
 {
-  const subcommand commands[] =
-  {
-    { alarm_clear, "clear", "Clear all current alarms" },
-    { alarm_list, "list", "List all current alarms" },
+  const subcommand commands[] = {
+    {alarm_clear, "clear", "Clear all current alarms"},
+    {alarm_list, "list", "List all current alarms"},
 
     // Note that we separate resolve one from resolve all for the same reasons that
     // we have "metric zero" and "metric clear".
-    { alarm_resolve, "resolve", "Resolve the listed alarms" },
+    {alarm_resolve, "resolve", "Resolve the listed alarms"},
     /* XXX describe a specific alarm? */
     /* XXX raise an alarm? */
   };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/config.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/config.cc b/cmd/traffic_ctl/config.cc
index 7a4aadf..ce19f3e 100644
--- a/cmd/traffic_ctl/config.cc
+++ b/cmd/traffic_ctl/config.cc
@@ -27,28 +27,42 @@
 
 // Record data type names, indexed by TSRecordT.
 static const char *
-rec_typeof(int rec_type) {
+rec_typeof(int rec_type)
+{
   switch (rec_type) {
-  case TS_REC_INT: return "INT";
-  case TS_REC_COUNTER: return "COUNTER";
-  case TS_REC_FLOAT: return "FLOAT";
-  case TS_REC_STRING: return "STRING";
+  case TS_REC_INT:
+    return "INT";
+  case TS_REC_COUNTER:
+    return "COUNTER";
+  case TS_REC_FLOAT:
+    return "FLOAT";
+  case TS_REC_STRING:
+    return "STRING";
   case TS_REC_UNDEFINED: /* fallthru */
-  default: return "UNDEFINED";
+  default:
+    return "UNDEFINED";
   }
 }
 
 // Record type name, indexed by RecT.
 static const char *
-rec_classof(int rec_class) {
+rec_classof(int rec_class)
+{
   switch (rec_class) {
-  case RECT_CONFIG: return "standard config";
-  case RECT_LOCAL:  return "local config";
-  case RECT_PROCESS:return "process metric";
-  case RECT_NODE:   return "node metric";
-  case RECT_CLUSTER:return "cluster metric";
-  case RECT_PLUGIN: return "plugin metric";
-  default: return "undefined";
+  case RECT_CONFIG:
+    return "standard config";
+  case RECT_LOCAL:
+    return "local config";
+  case RECT_PROCESS:
+    return "process metric";
+  case RECT_NODE:
+    return "node metric";
+  case RECT_CLUSTER:
+    return "cluster metric";
+  case RECT_PLUGIN:
+    return "plugin metric";
+  default:
+    return "undefined";
   }
 }
 
@@ -57,10 +71,13 @@ static const char *
 rec_accessof(int rec_access)
 {
   switch (rec_access) {
-  case RECA_NO_ACCESS: return "no access";
-  case RECA_READ_ONLY: return "read only";
+  case RECA_NO_ACCESS:
+    return "no access";
+  case RECA_READ_ONLY:
+    return "read only";
   case RECA_NULL: /* fallthru */
-  default: return "default";
+  default:
+    return "default";
   }
 }
 
@@ -69,12 +86,17 @@ static const char *
 rec_updateof(int rec_updatetype)
 {
   switch (rec_updatetype) {
-  case RECU_DYNAMIC: return "dynamic, no restart";
-  case RECU_RESTART_TS: return "static, restart traffic_server";
-  case RECU_RESTART_TM: return "static, restart traffic_manager";
-  case RECU_RESTART_TC: return "static, full restart";
+  case RECU_DYNAMIC:
+    return "dynamic, no restart";
+  case RECU_RESTART_TS:
+    return "static, restart traffic_server";
+  case RECU_RESTART_TM:
+    return "static, restart traffic_manager";
+  case RECU_RESTART_TC:
+    return "static, full restart";
   case RECU_NULL: /* fallthru */
-  default: return "none";
+  default:
+    return "none";
   }
 }
 
@@ -83,11 +105,15 @@ static const char *
 rec_checkof(int rec_checktype)
 {
   switch (rec_checktype) {
-  case RECC_STR: return "string matching a regular expression";
-  case RECC_INT: return "integer with a specified range";
-  case RECC_IP: return "IP address";
+  case RECC_STR:
+    return "string matching a regular expression";
+  case RECC_INT:
+    return "integer with a specified range";
+  case RECC_IP:
+    return "IP address";
   case RECC_NULL: /* fallthru */
-  default: return "none";
+  default:
+    return "none";
   }
 }
 
@@ -99,7 +125,7 @@ timestr(time_t tm)
 }
 
 static void
-format_record(const CtrlMgmtRecord& record, bool recfmt)
+format_record(const CtrlMgmtRecord &record, bool recfmt)
 {
   CtrlMgmtRecordValue value(record);
 
@@ -112,11 +138,11 @@ format_record(const CtrlMgmtRecord& record, bool recfmt)
 }
 
 static int
-config_get(unsigned argc, const char ** argv)
+config_get(unsigned argc, const char **argv)
 {
   int recfmt = 0;
   const ArgumentDescription opts[] = {
-    { "records", '-', "Emit output in records.config format", "F", &recfmt, NULL, NULL },
+    {"records", '-', "Emit output in records.config format", "F", &recfmt, NULL, NULL},
   };
 
   if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments < 1) {
@@ -140,7 +166,7 @@ config_get(unsigned argc, const char ** argv)
 }
 
 static int
-config_describe(unsigned argc, const char ** argv)
+config_describe(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments < 1) {
     return CtrlCommandUsage("config describe RECORD [RECORD ...]");
@@ -183,7 +209,7 @@ config_describe(unsigned argc, const char ** argv)
 }
 
 static int
-config_set(unsigned argc, const char ** argv)
+config_set(unsigned argc, const char **argv)
 {
   TSMgmtError error;
   TSActionNeedT action;
@@ -193,7 +219,7 @@ config_set(unsigned argc, const char ** argv)
   }
 
   error = TSRecordSet(file_arguments[0], file_arguments[1], &action);
-  if (error  != TS_ERR_OKAY) {
+  if (error != TS_ERR_OKAY) {
     CtrlMgmtError(error, "failed to set %s", file_arguments[0]);
     return CTRL_EX_ERROR;
   }
@@ -218,11 +244,11 @@ config_set(unsigned argc, const char ** argv)
 }
 
 static int
-config_match(unsigned argc, const char ** argv)
+config_match(unsigned argc, const char **argv)
 {
   int recfmt = 0;
   const ArgumentDescription opts[] = {
-    { "records", '-', "Emit output in records.config format", "F", &recfmt, NULL, NULL },
+    {"records", '-', "Emit output in records.config format", "F", &recfmt, NULL, NULL},
   };
 
   if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments < 1) {
@@ -251,7 +277,7 @@ config_match(unsigned argc, const char ** argv)
 }
 
 static int
-config_reload(unsigned argc, const char ** argv)
+config_reload(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments != 0) {
     return CtrlCommandUsage("config reload");
@@ -267,7 +293,7 @@ config_reload(unsigned argc, const char ** argv)
 }
 
 static int
-config_status(unsigned argc, const char ** argv)
+config_status(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments != 0) {
     return CtrlCommandUsage("config status");
@@ -308,16 +334,15 @@ config_status(unsigned argc, const char ** argv)
 }
 
 int
-subcommand_config(unsigned argc, const char ** argv)
+subcommand_config(unsigned argc, const char **argv)
 {
-  const subcommand commands[] =
-  {
-    { config_describe, "describe", "Show detailed information about configuration values" },
-    { config_get, "get", "Get one or more configuration values" },
-    { config_match, "match", "Get configuration matching a regular expression" },
-    { config_reload, "reload", "Request a configuration reload" },
-    { config_set, "set", "Set a configuration value" },
-    { config_status, "status", "Check the configuration status" },
+  const subcommand commands[] = {
+    {config_describe, "describe", "Show detailed information about configuration values"},
+    {config_get, "get", "Get one or more configuration values"},
+    {config_match, "match", "Get configuration matching a regular expression"},
+    {config_reload, "reload", "Request a configuration reload"},
+    {config_set, "set", "Set a configuration value"},
+    {config_status, "status", "Check the configuration status"},
   };
 
   return CtrlGenericSubcommand("config", commands, countof(commands), argc, argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/metric.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/metric.cc b/cmd/traffic_ctl/metric.cc
index 4a90958..36a8b6e 100644
--- a/cmd/traffic_ctl/metric.cc
+++ b/cmd/traffic_ctl/metric.cc
@@ -24,7 +24,7 @@
 #include "traffic_ctl.h"
 
 static int
-metric_get(unsigned argc, const char ** argv)
+metric_get(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments < 1) {
     return CtrlCommandUsage("metric get METRIC [METRIC ...]", NULL, 0);
@@ -47,7 +47,7 @@ metric_get(unsigned argc, const char ** argv)
 }
 
 static int
-metric_match(unsigned argc, const char ** argv)
+metric_match(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments < 1) {
     return CtrlCommandUsage("metric match [OPTIONS] REGEX [REGEX ...]", NULL, 0);
@@ -75,13 +75,13 @@ metric_match(unsigned argc, const char ** argv)
 }
 
 static int
-metric_clear(unsigned argc, const char ** argv)
+metric_clear(unsigned argc, const char **argv)
 {
   int cluster = 0;
   TSMgmtError error;
 
   const ArgumentDescription opts[] = {
-    { "cluster", '-', "Clear cluster metrics", "F", &cluster, NULL, NULL },
+    {"cluster", '-', "Clear cluster metrics", "F", &cluster, NULL, NULL},
   };
 
   if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments != 0) {
@@ -98,13 +98,13 @@ metric_clear(unsigned argc, const char ** argv)
 }
 
 static int
-metric_zero(unsigned argc, const char ** argv)
+metric_zero(unsigned argc, const char **argv)
 {
   int cluster = 0;
   TSMgmtError error;
 
   const ArgumentDescription opts[] = {
-    { "cluster", '-', "Zero cluster metrics", "F", &cluster, NULL, NULL },
+    {"cluster", '-', "Zero cluster metrics", "F", &cluster, NULL, NULL},
   };
 
   if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments < 1) {
@@ -123,19 +123,18 @@ metric_zero(unsigned argc, const char ** argv)
 }
 
 int
-subcommand_metric(unsigned argc, const char ** argv)
+subcommand_metric(unsigned argc, const char **argv)
 {
-  const subcommand commands[] =
-  {
-    { metric_get, "get", "Get one or more metric values" },
-    { metric_clear, "clear", "Clear all metric values" },
-    { CtrlUnimplementedCommand, "describe", "Show detailed information about one or more metric values" },
-    { metric_match, "match", "Get metrics matching a regular expression" },
-    { CtrlUnimplementedCommand, "monitor", "Display the value of a metric over time" },
+  const subcommand commands[] = {
+    {metric_get, "get", "Get one or more metric values"},
+    {metric_clear, "clear", "Clear all metric values"},
+    {CtrlUnimplementedCommand, "describe", "Show detailed information about one or more metric values"},
+    {metric_match, "match", "Get metrics matching a regular expression"},
+    {CtrlUnimplementedCommand, "monitor", "Display the value of a metric over time"},
 
     // We could allow clearing all the metrics in the "clear" subcommand, but that seems error-prone. It
     // would be too easy to just expect a help message and accidentally nuke all the metrics.
-    { metric_zero, "zero", "Clear one or more metric values" },
+    {metric_zero, "zero", "Clear one or more metric values"},
   };
 
   return CtrlGenericSubcommand("metric", commands, countof(commands), argc, argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/server.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/server.cc b/cmd/traffic_ctl/server.cc
index abb6e64..70db76f 100644
--- a/cmd/traffic_ctl/server.cc
+++ b/cmd/traffic_ctl/server.cc
@@ -27,15 +27,15 @@ static int drain = 0;
 static int manager = 0;
 
 const ArgumentDescription opts[] = {
-  { "drain", '-', "Wait for client connections to drain before restarting", "F", &drain, NULL, NULL },
-  { "manager", '-', "Restart traffic_manager as well as traffic_server", "F", &manager, NULL, NULL },
+  {"drain", '-', "Wait for client connections to drain before restarting", "F", &drain, NULL, NULL},
+  {"manager", '-', "Restart traffic_manager as well as traffic_server", "F", &manager, NULL, NULL},
 };
 
 static int
-restart(unsigned argc, const char ** argv, unsigned flags)
+restart(unsigned argc, const char **argv, unsigned flags)
 {
   TSMgmtError error;
-  const char * usage = (flags & TS_RESTART_OPT_CLUSTER) ?  "cluster restart [OPTIONS]" :  "server restart [OPTIONS]";
+  const char *usage = (flags & TS_RESTART_OPT_CLUSTER) ? "cluster restart [OPTIONS]" : "server restart [OPTIONS]";
 
   if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments != 0) {
     return CtrlCommandUsage(usage, opts, countof(opts));
@@ -60,19 +60,19 @@ restart(unsigned argc, const char ** argv, unsigned flags)
 }
 
 static int
-cluster_restart(unsigned argc, const char ** argv)
+cluster_restart(unsigned argc, const char **argv)
 {
   return restart(argc, argv, TS_RESTART_OPT_CLUSTER);
 }
 
 static int
-server_restart(unsigned argc, const char ** argv)
+server_restart(unsigned argc, const char **argv)
 {
   return restart(argc, argv, TS_RESTART_OPT_NONE);
 }
 
 static int
-server_backtrace(unsigned argc, const char ** argv)
+server_backtrace(unsigned argc, const char **argv)
 {
   TSMgmtError error;
   TSString trace = NULL;
@@ -93,7 +93,7 @@ server_backtrace(unsigned argc, const char ** argv)
 }
 
 static int
-server_status(unsigned argc, const char ** argv)
+server_status(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments != 0) {
     return CtrlCommandUsage("server status");
@@ -117,25 +117,23 @@ server_status(unsigned argc, const char ** argv)
 }
 
 int
-subcommand_cluster(unsigned argc, const char ** argv)
+subcommand_cluster(unsigned argc, const char **argv)
 {
-  const subcommand commands[] =
-  {
-    { cluster_restart, "restart", "Restart the Traffic Server cluster" },
-    { CtrlUnimplementedCommand, "status", "Show the cluster status" },
+  const subcommand commands[] = {
+    {cluster_restart, "restart", "Restart the Traffic Server cluster"},
+    {CtrlUnimplementedCommand, "status", "Show the cluster status"},
   };
 
   return CtrlGenericSubcommand("cluster", commands, countof(commands), argc, argv);
 }
 
 int
-subcommand_server(unsigned argc, const char ** argv)
+subcommand_server(unsigned argc, const char **argv)
 {
-  const subcommand commands[] =
-  {
-    { server_restart, "restart", "Restart Traffic Server" },
-    { server_backtrace, "backtrace", "Show a full stack trace of the traffic_server process" },
-    { server_status, "status", "Show the proxy status" },
+  const subcommand commands[] = {
+    {server_restart, "restart", "Restart Traffic Server"},
+    {server_backtrace, "backtrace", "Show a full stack trace of the traffic_server process"},
+    {server_status, "status", "Show the proxy status"},
 
     /* XXX do the 'shutdown' and 'startup' commands make sense? */
   };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/storage.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/storage.cc b/cmd/traffic_ctl/storage.cc
index fbd6720..f5340c7 100644
--- a/cmd/traffic_ctl/storage.cc
+++ b/cmd/traffic_ctl/storage.cc
@@ -24,7 +24,7 @@
 #include "traffic_ctl.h"
 
 static int
-storage_offline(unsigned argc, const char ** argv)
+storage_offline(unsigned argc, const char **argv)
 {
   if (!CtrlProcessArguments(argc, argv, NULL, 0) || n_file_arguments == 0) {
     return CtrlCommandUsage("storage offline DEVICE [DEVICE ...]");
@@ -34,7 +34,7 @@ storage_offline(unsigned argc, const char ** argv)
     TSMgmtError error;
 
     error = TSStorageDeviceCmdOffline(file_arguments[i]);
-    if (error  != TS_ERR_OKAY) {
+    if (error != TS_ERR_OKAY) {
       CtrlMgmtError(error, "failed to take %s offline", file_arguments[0]);
       return CTRL_EX_ERROR;
     }
@@ -44,12 +44,11 @@ storage_offline(unsigned argc, const char ** argv)
 }
 
 int
-subcommand_storage(unsigned argc, const char ** argv)
+subcommand_storage(unsigned argc, const char **argv)
 {
-  const subcommand commands[] =
-  {
-    { storage_offline, "offline", "Take one or more storage volumes offline" },
-    { CtrlUnimplementedCommand, "status", "Show the storage configuration" },
+  const subcommand commands[] = {
+    {storage_offline, "offline", "Take one or more storage volumes offline"},
+    {CtrlUnimplementedCommand, "status", "Show the storage configuration"},
   };
 
   return CtrlGenericSubcommand("storage", commands, countof(commands), argc, argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/traffic_ctl.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/traffic_ctl.cc b/cmd/traffic_ctl/traffic_ctl.cc
index 2b627f5..aff4a42 100644
--- a/cmd/traffic_ctl/traffic_ctl.cc
+++ b/cmd/traffic_ctl/traffic_ctl.cc
@@ -51,23 +51,23 @@ CtrlMgmtRecord::as_int() const
 }
 
 TSMgmtError
-CtrlMgmtRecord::fetch(const char * name)
+CtrlMgmtRecord::fetch(const char *name)
 {
   return TSRecordGet(name, this->ele);
 }
 
 TSMgmtError
-CtrlMgmtRecordList::match(const char * name)
+CtrlMgmtRecordList::match(const char *name)
 {
   return TSRecordGetMatchMlt(name, this->list);
 }
 
-CtrlMgmtRecordValue::CtrlMgmtRecordValue(const CtrlMgmtRecord& rec)
+CtrlMgmtRecordValue::CtrlMgmtRecordValue(const CtrlMgmtRecord &rec)
 {
   this->init(rec.ele->rec_type, rec.ele->valueT);
 }
 
-CtrlMgmtRecordValue::CtrlMgmtRecordValue(const TSRecordEle * ele)
+CtrlMgmtRecordValue::CtrlMgmtRecordValue(const TSRecordEle *ele)
 {
   this->init(ele->rec_type, ele->valueT);
 }
@@ -112,7 +112,7 @@ CtrlMgmtRecordValue::c_str() const
 }
 
 void
-CtrlMgmtError(TSMgmtError err, const char * fmt, ...)
+CtrlMgmtError(TSMgmtError err, const char *fmt, ...)
 {
   ats_scoped_str msg(TSGetErrorMessage(err));
 
@@ -128,14 +128,13 @@ CtrlMgmtError(TSMgmtError err, const char * fmt, ...)
   } else {
     fprintf(stderr, "%s: %s\n", program_name, (const char *)msg);
   }
-
 }
 
 int
-CtrlSubcommandUsage(const char * name, const subcommand * cmds, unsigned ncmds, const ArgumentDescription * desc, unsigned ndesc)
+CtrlSubcommandUsage(const char *name, const subcommand *cmds, unsigned ncmds, const ArgumentDescription *desc, unsigned ndesc)
 {
-  const char * opt = ndesc ? "[OPTIONS]" : "";
-  const char * sep = (ndesc && name) ? " " : "";
+  const char *opt = ndesc ? "[OPTIONS]" : "";
+  const char *sep = (ndesc && name) ? " " : "";
 
   fprintf(stderr, "Usage: traffic_ctl %s%s%s CMD [ARGS ...]\n\nSubcommands:\n", name ? name : "", sep, opt);
 
@@ -151,7 +150,7 @@ CtrlSubcommandUsage(const char * name, const subcommand * cmds, unsigned ncmds,
 }
 
 int
-CtrlCommandUsage(const char * msg, const ArgumentDescription * desc, unsigned ndesc)
+CtrlCommandUsage(const char *msg, const ArgumentDescription *desc, unsigned ndesc)
 {
   fprintf(stderr, "Usage: traffic_ctl %s\n", msg);
 
@@ -163,21 +162,21 @@ CtrlCommandUsage(const char * msg, const ArgumentDescription * desc, unsigned nd
 }
 
 bool
-CtrlProcessArguments(int /* argc */, const char ** argv, const ArgumentDescription * desc, unsigned ndesc)
+CtrlProcessArguments(int /* argc */, const char **argv, const ArgumentDescription *desc, unsigned ndesc)
 {
   n_file_arguments = 0;
   return process_args_ex(&CtrlVersionInfo, desc, ndesc, argv);
 }
 
 int
-CtrlUnimplementedCommand(unsigned /* argc */, const char ** argv)
+CtrlUnimplementedCommand(unsigned /* argc */, const char **argv)
 {
   CtrlDebug("the '%s' command is not implemented", *argv);
   return CTRL_EX_UNIMPLEMENTED;
 }
 
 int
-CtrlGenericSubcommand(const char * name, const subcommand * cmds, unsigned ncmds, unsigned argc, const char ** argv)
+CtrlGenericSubcommand(const char *name, const subcommand *cmds, unsigned ncmds, unsigned argc, const char **argv)
 {
   CtrlCommandLine cmdline;
 
@@ -207,19 +206,17 @@ main(int argc, const char **argv)
   CtrlVersionInfo.setup(PACKAGE_NAME, "traffic_ctl", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
   program_name = CtrlVersionInfo.AppStr;
 
-  ArgumentDescription argument_descriptions[] = {
-    { "debug", '-', "Enable debugging output", "F", &debug, NULL, NULL },
-    HELP_ARGUMENT_DESCRIPTION(),
-    VERSION_ARGUMENT_DESCRIPTION()
-  };
+  ArgumentDescription argument_descriptions[] = {{"debug", '-', "Enable debugging output", "F", &debug, NULL, NULL},
+                                                 HELP_ARGUMENT_DESCRIPTION(),
+                                                 VERSION_ARGUMENT_DESCRIPTION()};
 
   const subcommand commands[] = {
-    { subcommand_alarm, "alarm", "Manipulate alarms" },
-    { subcommand_cluster, "cluster", "Stop, restart and examine the cluster" },
-    { subcommand_config, "config", "Manipulate configuration records" },
-    { subcommand_metric, "metric", "Manipulate performance metrics" },
-    { subcommand_server, "server", "Stop, restart and examine the server" },
-    { subcommand_storage, "storage", "Manipulate cache storage" },
+    {subcommand_alarm, "alarm", "Manipulate alarms"},
+    {subcommand_cluster, "cluster", "Stop, restart and examine the cluster"},
+    {subcommand_config, "config", "Manipulate configuration records"},
+    {subcommand_metric, "metric", "Manipulate performance metrics"},
+    {subcommand_server, "server", "Stop, restart and examine the server"},
+    {subcommand_storage, "storage", "Manipulate cache storage"},
   };
 
   diags = new Diags("" /* tags */, "" /* actions */, stderr);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_ctl/traffic_ctl.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_ctl/traffic_ctl.h b/cmd/traffic_ctl/traffic_ctl.h
index 17e7af3..b77ee40 100644
--- a/cmd/traffic_ctl/traffic_ctl.h
+++ b/cmd/traffic_ctl/traffic_ctl.h
@@ -31,44 +31,42 @@
 
 #include <vector>
 
-struct subcommand
-{
-  int (*handler) (unsigned, const char **);
-  const char * name;
-  const char * help;
+struct subcommand {
+  int (*handler)(unsigned, const char **);
+  const char *name;
+  const char *help;
 };
 
 extern AppVersionInfo CtrlVersionInfo;
 
 #define CtrlDebug(...) Debug("traffic_ctl", __VA_ARGS__)
 
-void CtrlMgmtError(TSMgmtError err, const char * fmt, ...) TS_PRINTFLIKE(2, 3);
-int CtrlSubcommandUsage(const char * name, const subcommand * cmds, unsigned ncmds, const ArgumentDescription * desc, unsigned ndesc);
-int CtrlCommandUsage(const char * msg, const ArgumentDescription * desc = NULL, unsigned ndesc = 0);
+void CtrlMgmtError(TSMgmtError err, const char *fmt, ...) TS_PRINTFLIKE(2, 3);
+int CtrlSubcommandUsage(const char *name, const subcommand *cmds, unsigned ncmds, const ArgumentDescription *desc, unsigned ndesc);
+int CtrlCommandUsage(const char *msg, const ArgumentDescription *desc = NULL, unsigned ndesc = 0);
 
-bool CtrlProcessArguments(int argc, const char ** argv, const ArgumentDescription * desc, unsigned ndesc);
-int CtrlUnimplementedCommand(unsigned argc, const char ** argv);
+bool CtrlProcessArguments(int argc, const char **argv, const ArgumentDescription *desc, unsigned ndesc);
+int CtrlUnimplementedCommand(unsigned argc, const char **argv);
 
-int CtrlGenericSubcommand(const char *, const subcommand * cmds, unsigned ncmds, unsigned argc, const char ** argv);
+int CtrlGenericSubcommand(const char *, const subcommand *cmds, unsigned ncmds, unsigned argc, const char **argv);
 
-#define CTRL_MGMT_CHECK(expr) do { \
-  TSMgmtError e = (expr); \
-  if (e != TS_ERR_OKAY) {  \
-    CtrlDebug("%s failed with status %d", #expr, e);\
-    CtrlMgmtError(e, NULL); \
-    return CTRL_EX_ERROR; \
-  } \
-} while (0)
+#define CTRL_MGMT_CHECK(expr)                          \
+  do {                                                 \
+    TSMgmtError e = (expr);                            \
+    if (e != TS_ERR_OKAY) {                            \
+      CtrlDebug("%s failed with status %d", #expr, e); \
+      CtrlMgmtError(e, NULL);                          \
+      return CTRL_EX_ERROR;                            \
+    }                                                  \
+  } while (0)
 
-struct CtrlMgmtRecord
-{
-  explicit CtrlMgmtRecord(TSRecordEle * e) : ele(e) {
-  }
+struct CtrlMgmtRecord {
+  explicit CtrlMgmtRecord(TSRecordEle *e) : ele(e) {}
 
-  CtrlMgmtRecord() : ele(TSRecordEleCreate()) {
-  }
+  CtrlMgmtRecord() : ele(TSRecordEleCreate()) {}
 
-  ~CtrlMgmtRecord() {
+  ~CtrlMgmtRecord()
+  {
     if (this->ele) {
       TSRecordEleDestroy(this->ele);
     }
@@ -76,113 +74,120 @@ struct CtrlMgmtRecord
 
   TSMgmtError fetch(const char *);
 
-  const char * name() const;
+  const char *name() const;
   TSRecordT type() const;
   int64_t as_int() const;
 
 private:
-  CtrlMgmtRecord(const CtrlMgmtRecord&); // disabled
-  CtrlMgmtRecord& operator=(const CtrlMgmtRecord&); // disabled
+  CtrlMgmtRecord(const CtrlMgmtRecord &);            // disabled
+  CtrlMgmtRecord &operator=(const CtrlMgmtRecord &); // disabled
 
-  TSRecordEle * ele;
+  TSRecordEle *ele;
 
   friend struct CtrlMgmtRecordValue;
 };
 
-struct CtrlMgmtRecordValue
-{
+struct CtrlMgmtRecordValue {
   explicit CtrlMgmtRecordValue(const TSRecordEle *);
-  explicit CtrlMgmtRecordValue(const CtrlMgmtRecord&);
+  explicit CtrlMgmtRecordValue(const CtrlMgmtRecord &);
 
   CtrlMgmtRecordValue(TSRecordT, TSRecordValueT);
-  const char * c_str() const;
+  const char *c_str() const;
 
 private:
-  CtrlMgmtRecordValue(const CtrlMgmtRecordValue&); // disabled
-  CtrlMgmtRecordValue& operator=(const CtrlMgmtRecordValue&); // disabled
+  CtrlMgmtRecordValue(const CtrlMgmtRecordValue &);            // disabled
+  CtrlMgmtRecordValue &operator=(const CtrlMgmtRecordValue &); // disabled
   void init(TSRecordT, TSRecordValueT);
 
   TSRecordT rec_type;
   union {
-    const char * str;
+    const char *str;
     char nbuf[32];
   } fmt;
 };
 
-struct CtrlMgmtRecordList
-{
-  CtrlMgmtRecordList() : list(TSListCreate()) {
-  }
+struct CtrlMgmtRecordList {
+  CtrlMgmtRecordList() : list(TSListCreate()) {}
 
-  ~CtrlMgmtRecordList() {
+  ~CtrlMgmtRecordList()
+  {
     this->clear();
     TSListDestroy(this->list);
   }
 
-  bool empty() const {
+  bool
+  empty() const
+  {
     return TSListIsEmpty(this->list);
   }
 
-  void clear() const {
+  void
+  clear() const
+  {
     while (!this->empty()) {
-        TSRecordEleDestroy((TSRecordEle *)TSListDequeue(this->list));
+      TSRecordEleDestroy((TSRecordEle *)TSListDequeue(this->list));
     }
   }
 
   // Return (ownership of) the next list entry.
-  TSRecordEle * next() {
+  TSRecordEle *
+  next()
+  {
     return (TSRecordEle *)TSListDequeue(this->list);
   }
 
   TSMgmtError match(const char *);
 
 private:
-  CtrlMgmtRecordList(const CtrlMgmtRecordList&); // disabled
-  CtrlMgmtRecordList& operator=(const CtrlMgmtRecordList&); // disabled
+  CtrlMgmtRecordList(const CtrlMgmtRecordList &);            // disabled
+  CtrlMgmtRecordList &operator=(const CtrlMgmtRecordList &); // disabled
 
   TSList list;
 };
 
-template<typename T>
-struct CtrlMgmtList
-{
-  CtrlMgmtList() : list(TSListCreate()) {
-  }
+template <typename T> struct CtrlMgmtList {
+  CtrlMgmtList() : list(TSListCreate()) {}
 
-  ~CtrlMgmtList() {
+  ~CtrlMgmtList()
+  {
     this->clear();
     TSListDestroy(this->list);
   }
 
-  bool empty() const {
+  bool
+  empty() const
+  {
     return TSListIsEmpty(this->list);
   }
 
-  void clear() const {
+  void
+  clear() const
+  {
     while (!this->empty()) {
       T::free(T::cast(TSListDequeue(this->list)));
     }
   }
 
   // Return (ownership of) the next list entry.
-  typename T::entry_type next() {
+  typename T::entry_type
+  next()
+  {
     return T::cast(TSListDequeue(this->list));
   }
 
   TSList list;
 
 private:
-  CtrlMgmtList(const CtrlMgmtList&); // disabled
-  CtrlMgmtList& operator=(const CtrlMgmtList&); // disabled
+  CtrlMgmtList(const CtrlMgmtList &);            // disabled
+  CtrlMgmtList &operator=(const CtrlMgmtList &); // disabled
 };
 
-struct CtrlCommandLine
-{
-  CtrlCommandLine() {
-    this->args.push_back(NULL);
-  }
+struct CtrlCommandLine {
+  CtrlCommandLine() { this->args.push_back(NULL); }
 
-  void init(unsigned argc, const char ** argv) {
+  void
+  init(unsigned argc, const char **argv)
+  {
     this->args.clear();
     for (unsigned i = 0; i < argc; ++i) {
       this->args.push_back(argv[i]);
@@ -192,11 +197,15 @@ struct CtrlCommandLine
     this->args.push_back(NULL);
   }
 
-  unsigned argc() {
+  unsigned
+  argc()
+  {
     return args.size() - 1;
   }
 
-  const char ** argv() {
+  const char **
+  argv()
+  {
     return &args[0];
   }
 
@@ -204,18 +213,18 @@ private:
   std::vector<const char *> args;
 };
 
-int subcommand_alarm(unsigned argc, const char ** argv);
-int subcommand_cluster(unsigned argc, const char ** argv);
-int subcommand_config(unsigned argc, const char ** argv);
-int subcommand_metric(unsigned argc, const char ** argv);
-int subcommand_server(unsigned argc, const char ** argv);
-int subcommand_storage(unsigned argc, const char ** argv);
+int subcommand_alarm(unsigned argc, const char **argv);
+int subcommand_cluster(unsigned argc, const char **argv);
+int subcommand_config(unsigned argc, const char **argv);
+int subcommand_metric(unsigned argc, const char **argv);
+int subcommand_server(unsigned argc, const char **argv);
+int subcommand_storage(unsigned argc, const char **argv);
 
 // Exit status codes, following BSD's sysexits(3)
-#define CTRL_EX_OK            0
-#define CTRL_EX_ERROR         2
+#define CTRL_EX_OK 0
+#define CTRL_EX_ERROR 2
 #define CTRL_EX_UNIMPLEMENTED 3
-#define CTRL_EX_USAGE         EX_USAGE
-#define CTRL_EX_UNAVAILABLE   69
+#define CTRL_EX_USAGE EX_USAGE
+#define CTRL_EX_UNAVAILABLE 69
 
 #endif /* _TRAFFIC_CTRL_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_layout/traffic_layout.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_layout/traffic_layout.cc b/cmd/traffic_layout/traffic_layout.cc
index 58174e2..331ded0 100644
--- a/cmd/traffic_layout/traffic_layout.cc
+++ b/cmd/traffic_layout/traffic_layout.cc
@@ -28,13 +28,10 @@
 #include "I_RecProcess.h"
 #include "RecordsConfig.h"
 
-const ArgumentDescription argument_descriptions[] = {
-  HELP_ARGUMENT_DESCRIPTION(),
-  VERSION_ARGUMENT_DESCRIPTION()
-};
+const ArgumentDescription argument_descriptions[] = {HELP_ARGUMENT_DESCRIPTION(), VERSION_ARGUMENT_DESCRIPTION()};
 
 static void
-printvar(const char * name, char * val)
+printvar(const char *name, char *val)
 {
   printf("%s: %s\n", name, val);
   ats_free(val);
@@ -45,8 +42,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
 {
   AppVersionInfo appVersionInfo;
 
-  appVersionInfo.setup(PACKAGE_NAME, "traffic_layout", PACKAGE_VERSION,
-          __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
+  appVersionInfo.setup(PACKAGE_NAME, "traffic_layout", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
 
   // Process command line arguments and dump into variables
   process_args(&appVersionInfo, argument_descriptions, countof(argument_descriptions), argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_line/traffic_line.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_line/traffic_line.cc b/cmd/traffic_line/traffic_line.cc
index 5416471..8885d22 100644
--- a/cmd/traffic_line/traffic_line.cc
+++ b/cmd/traffic_line/traffic_line.cc
@@ -110,7 +110,7 @@ handleArgInvocation()
     if (count > 0) {
       printf("Active Alarms\n");
       for (int i = 0; i < count; i++) {
-        char* name = static_cast<char *>(TSListDequeue(events));
+        char *name = static_cast<char *>(TSListDequeue(events));
         printf("  %d. %s\n", i + 1, name);
       }
     } else {
@@ -143,14 +143,14 @@ handleArgInvocation()
 
     if ((3 == len) && (0 == strncasecmp(ClearAlarms, "all", len))) {
       all = true;
-    } else  {
+    } else {
       num = strtol(ClearAlarms, NULL, 10) - 1;
       if (num <= 0)
         num = -1;
     }
 
     for (int i = 0; i < count; i++) {
-      char* name = static_cast<char*>(TSListDequeue(events));
+      char *name = static_cast<char *>(TSListDequeue(events));
 
       if (all || ((num > -1) && (num == i)) || ((strlen(name) == len) && (0 == strncasecmp(ClearAlarms, name, len)))) {
         if (TS_ERR_OKAY != TSEventResolve(name)) {
@@ -162,7 +162,7 @@ handleArgInvocation()
       }
     }
     TSListDestroy(events);
-    return (errors > 0 ? TS_ERR_FAIL: TS_ERR_OKAY);
+    return (errors > 0 ? TS_ERR_FAIL : TS_ERR_OKAY);
   } else if (ShowStatus == 1) {
     switch (TSProxyStateGet()) {
     case TS_PROXY_ON:
@@ -187,7 +187,7 @@ handleArgInvocation()
     }
 
     return err;
-  } else if (*ReadVar != '\0') {        // Handle a value read
+  } else if (*ReadVar != '\0') { // Handle a value read
     if (*SetVar != '\0' || *VarValue != '\0') {
       fprintf(stderr, "%s: Invalid Argument Combination: Can not read and set values at the same time\n", program_name);
       return TS_ERR_FAIL;
@@ -220,7 +220,7 @@ handleArgInvocation()
       TSRecordEleDestroy(rec_ele);
       return err;
     }
-  } else if (*MatchVar != '\0') {        // Handle a value read
+  } else if (*MatchVar != '\0') { // Handle a value read
     if (*SetVar != '\0' || *VarValue != '\0') {
       fprintf(stderr, "%s: Invalid Argument Combination: Can not read and set values at the same time\n", program_name);
       return TS_ERR_FAIL;
@@ -229,15 +229,14 @@ handleArgInvocation()
       TSList list = TSListCreate();
 
       if ((err = TSRecordGetMatchMlt(MatchVar, list)) != TS_ERR_OKAY) {
-        char* msg = TSGetErrorMessage(err);
+        char *msg = TSGetErrorMessage(err);
         fprintf(stderr, "%s: %s\n", program_name, msg);
         ats_free(msg);
       }
 
       // If the RPC call failed, the list will be empty, so we won't print anything. Otherwise,
       // print all the results, freeing them as we go.
-      for (TSRecordEle * rec_ele = (TSRecordEle *) TSListDequeue(list); rec_ele;
-          rec_ele = (TSRecordEle *) TSListDequeue(list)) {
+      for (TSRecordEle *rec_ele = (TSRecordEle *)TSListDequeue(list); rec_ele; rec_ele = (TSRecordEle *)TSListDequeue(list)) {
         switch (rec_ele->rec_type) {
         case TS_REC_INT:
           printf("%s %" PRId64 "\n", rec_ele->rec_name, rec_ele->valueT.int_val);
@@ -293,7 +292,7 @@ handleArgInvocation()
 
       return err;
     }
-  } else if (*VarValue != '\0') {       // We have a value but no variable to set
+  } else if (*VarValue != '\0') { // We have a value but no variable to set
     fprintf(stderr, "%s: Must specify variable to set with -s when using -v\n", program_name);
     return TS_ERR_FAIL;
   }
@@ -334,8 +333,8 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   ShowStatus = 0;
   ClearAlarms[0] = '\0';
 
-/* Argument description table used to describe how to parse command line args, */
-/* see 'ink_args.h' for meanings of the various fields */
+  /* Argument description table used to describe how to parse command line args, */
+  /* see 'ink_args.h' for meanings of the various fields */
   ArgumentDescription argument_descriptions[] = {
     {"query_deadhosts", 'q', "Query congested sites", "F", &QueryDeadhosts, NULL, NULL},
     {"read_var", 'r', "Read Variable", "S1024", &ReadVar, NULL, NULL},
@@ -360,8 +359,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
     {"backtrace", '-', "Show proxy stack backtrace", "F", &ShowBacktrace, NULL, NULL},
     {"drain", '-', "Wait for client connections to drain before restarting", "F", &DrainTraffic, NULL, NULL},
     HELP_ARGUMENT_DESCRIPTION(),
-    VERSION_ARGUMENT_DESCRIPTION()
-  };
+    VERSION_ARGUMENT_DESCRIPTION()};
 
   // Process command line arguments and dump into variables
   process_args(&appVersionInfo, argument_descriptions, countof(argument_descriptions), argv);
@@ -378,7 +376,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   TSTerminate();
 
   if (TS_ERR_OKAY != status) {
-    char * msg = TSGetErrorMessage(status);
+    char *msg = TSGetErrorMessage(status);
     if (ReadVar[0] == '\0' && SetVar[0] == '\0')
       fprintf(stderr, "error: the requested command failed: %s\n", msg);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/StatProcessor.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatProcessor.cc b/cmd/traffic_manager/StatProcessor.cc
index 3fd670e..9202aca 100644
--- a/cmd/traffic_manager/StatProcessor.cc
+++ b/cmd/traffic_manager/StatProcessor.cc
@@ -40,7 +40,7 @@ StatObjectList statObjectList;
 StatXMLTag currentTag = INVALID_TAG;
 StatObject *statObject = NULL;
 char *exprContent = NULL;
-static unsigned statCount = 0;  // global statistics object counter
+static unsigned statCount = 0; // global statistics object counter
 bool nodeVar;
 bool sumClusterVar;
 
@@ -49,13 +49,13 @@ bool sumClusterVar;
 static int
 xml_atoi(const xmlchar *nptr)
 {
-  return atoi((const char*)nptr);
+  return atoi((const char *)nptr);
 }
 
 static double
 xml_atof(const xmlchar *nptr)
 {
-  return atof((const char*)nptr);
+  return atof((const char *)nptr);
 }
 
 static int
@@ -87,46 +87,46 @@ elementStart(void * /* userData ATS_UNUSED */, const xmlchar *name, const xmlcha
     Debug(MODULE_INIT, "\nStat #: ----------------------- %d -----------------------\n", statCount);
 
     if (atts)
-     for (i = 0; atts[i]; i += 2) {
-      ink_assert(atts[i + 1]);    // Attribute comes in pairs, hopefully.
-
-      if (!xml_strcmp(atts[i], "minimum")) {
-        statObject->m_stats_min = (MgmtFloat) xml_atof(atts[i + 1]);
-        statObject->m_has_min = true;
-      } else if (!xml_strcmp(atts[i], "maximum")) {
-        statObject->m_stats_max = (MgmtFloat) xml_atof(atts[i + 1]);
-        statObject->m_has_max = true;
-      } else if (!xml_strcmp(atts[i], "interval")) {
-        statObject->m_update_interval = (ink_hrtime) xml_atoi(atts[i + 1]);
-      } else if (!xml_strcmp(atts[i], "debug")) {
-        statObject->m_debug = (atts[i + 1] && atts[i + 1][0] == '1');
+      for (i = 0; atts[i]; i += 2) {
+        ink_assert(atts[i + 1]); // Attribute comes in pairs, hopefully.
+
+        if (!xml_strcmp(atts[i], "minimum")) {
+          statObject->m_stats_min = (MgmtFloat)xml_atof(atts[i + 1]);
+          statObject->m_has_min = true;
+        } else if (!xml_strcmp(atts[i], "maximum")) {
+          statObject->m_stats_max = (MgmtFloat)xml_atof(atts[i + 1]);
+          statObject->m_has_max = true;
+        } else if (!xml_strcmp(atts[i], "interval")) {
+          statObject->m_update_interval = (ink_hrtime)xml_atoi(atts[i + 1]);
+        } else if (!xml_strcmp(atts[i], "debug")) {
+          statObject->m_debug = (atts[i + 1] && atts[i + 1][0] == '1');
+        }
+
+        Debug(MODULE_INIT, "\tDESTINTATION w/ attribute: %s -> %s\n", atts[i], atts[i + 1]);
       }
-
-      Debug(MODULE_INIT, "\tDESTINTATION w/ attribute: %s -> %s\n", atts[i], atts[i + 1]);
-    }
     break;
 
   case EXPR_TAG:
-    exprContent = (char*)ats_malloc(BUFSIZ * 10);
+    exprContent = (char *)ats_malloc(BUFSIZ * 10);
     memset(exprContent, 0, BUFSIZ * 10);
     break;
 
   case DST_TAG:
     nodeVar = true;
-    sumClusterVar = true;       // Should only be used with cluster variable
+    sumClusterVar = true; // Should only be used with cluster variable
 
     if (atts)
-     for (i = 0; atts[i]; i += 2) {
-      ink_assert(atts[i + 1]);    // Attribute comes in pairs, hopefully.
-      if (!xml_strcmp(atts[i], "scope")) {
-        nodeVar = (!xml_strcmp(atts[i + 1], "node") ? true : false);
-      } else if (!xml_strcmp(atts[i], "operation")) {
-        sumClusterVar = (!xml_strcmp(atts[i + 1], "sum") ? true : false);
+      for (i = 0; atts[i]; i += 2) {
+        ink_assert(atts[i + 1]); // Attribute comes in pairs, hopefully.
+        if (!xml_strcmp(atts[i], "scope")) {
+          nodeVar = (!xml_strcmp(atts[i + 1], "node") ? true : false);
+        } else if (!xml_strcmp(atts[i], "operation")) {
+          sumClusterVar = (!xml_strcmp(atts[i + 1], "sum") ? true : false);
+        }
+
+        Debug(MODULE_INIT, "\tDESTINTATION w/ attribute: %s -> %s\n", atts[i], atts[i + 1]);
       }
 
-      Debug(MODULE_INIT, "\tDESTINTATION w/ attribute: %s -> %s\n", atts[i], atts[i + 1]);
-    }
-
     break;
 
   case INVALID_TAG:
@@ -140,7 +140,7 @@ elementStart(void * /* userData ATS_UNUSED */, const xmlchar *name, const xmlcha
 
 
 static void
-elementEnd(void * /* userData ATS_UNUSED */, const xmlchar */* name ATS_UNUSED */)
+elementEnd(void * /* userData ATS_UNUSED */, const xmlchar * /* name ATS_UNUSED */)
 {
   switch (currentTag) {
   case STAT_TAG:
@@ -150,7 +150,7 @@ elementEnd(void * /* userData ATS_UNUSED */, const xmlchar */* name ATS_UNUSED *
 
   case EXPR_TAG:
     statObject->assignExpr(exprContent); // This hands over ownership of exprContent
-    // fall through
+  // fall through
 
   default:
     currentTag = STAT_TAG;
@@ -160,14 +160,14 @@ elementEnd(void * /* userData ATS_UNUSED */, const xmlchar */* name ATS_UNUSED *
 
 
 static void
-charDataHandler(void * /* userData ATS_UNUSED */, const xmlchar * name, int /* len ATS_UNUSED */)
+charDataHandler(void * /* userData ATS_UNUSED */, const xmlchar *name, int /* len ATS_UNUSED */)
 {
   if (currentTag != EXPR_TAG && currentTag != DST_TAG) {
     return;
   }
 
   char content[BUFSIZ * 10];
-  if (XML_extractContent((const char*)name, content, BUFSIZ * 10) == 0) {
+  if (XML_extractContent((const char *)name, content, BUFSIZ * 10) == 0) {
     return;
   }
 
@@ -180,14 +180,14 @@ charDataHandler(void * /* userData ATS_UNUSED */, const xmlchar * name, int /* l
 }
 
 
-StatProcessor::StatProcessor(FileManager * configFiles):m_lmgmt(NULL), m_overviewGenerator(NULL)
+StatProcessor::StatProcessor(FileManager *configFiles) : m_lmgmt(NULL), m_overviewGenerator(NULL)
 {
   rereadConfig(configFiles);
 }
 
 
 void
-StatProcessor::rereadConfig(FileManager * configFiles)
+StatProcessor::rereadConfig(FileManager *configFiles)
 {
   textBuffer *fileContent = NULL;
   Rollback *fileRB = NULL;
@@ -196,7 +196,7 @@ StatProcessor::rereadConfig(FileManager * configFiles)
   int fileLen;
 
   statObjectList.clean();
-  statCount = 0;                // reset statistics counter
+  statCount = 0; // reset statistics counter
 
   int ret = configFiles->getRollbackObj(STAT_CONFIG_FILE, &fileRB);
   if (!ret) {
@@ -265,9 +265,7 @@ StatProcessor::rereadConfig(FileManager * configFiles)
 
 StatProcessor::~StatProcessor()
 {
-
   Debug(MODULE_INIT, "[StatProcessor] Destructing Statistics Processor\n");
-
 }
 
 
@@ -332,9 +330,9 @@ StatProcessor::processStat()
 
   Debug(MODULE_INIT, "[StatProcessor] Processing Statistics....\n");
 
-//    setTest();
+  //    setTest();
   statObjectList.Eval();
-//    verifyTest();
+  //    verifyTest();
 
   return (result);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/StatProcessor.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatProcessor.h b/cmd/traffic_manager/StatProcessor.h
index 71dab2f..c6b3dd8 100644
--- a/cmd/traffic_manager/StatProcessor.h
+++ b/cmd/traffic_manager/StatProcessor.h
@@ -55,7 +55,7 @@ typedef XML_Char xmlchar;
 #include <libxml/SAX.h>
 typedef xmlChar xmlchar;
 #else
-# error "No XML parser - please configure expat or libxml2"
+#error "No XML parser - please configure expat or libxml2"
 #endif
 
 #include <string.h>
@@ -64,13 +64,12 @@ typedef xmlChar xmlchar;
 class StatProcessor
 {
 public:
-
-  explicit StatProcessor(FileManager * configFiles);
+  explicit StatProcessor(FileManager *configFiles);
   ~StatProcessor();
 
   // Member Fuctions
   unsigned short processStat();
-  void rereadConfig(FileManager * configFiles);
+  void rereadConfig(FileManager *configFiles);
 
   LocalManager *m_lmgmt;
   overviewPage *m_overviewGenerator;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/cmd/traffic_manager/StatType.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatType.cc b/cmd/traffic_manager/StatType.cc
index 1c51b95..87e362e 100644
--- a/cmd/traffic_manager/StatType.cc
+++ b/cmd/traffic_manager/StatType.cc
@@ -36,18 +36,15 @@
 #include "ink_hrtime.h"
 #include "WebOverview.h"
 
-bool StatError = false;         // global error flag
-bool StatDebug = false;         // global debug flag
+bool StatError = false; // global error flag
+bool StatDebug = false; // global debug flag
 
 /**
  * StatExprToken()
  * ---------------
  */
 StatExprToken::StatExprToken()
-  : m_arith_symbol('\0'),
-    m_token_name(NULL),
-    m_token_type(RECD_NULL),
-    m_sum_var(false), m_node_var(true)
+  : m_arith_symbol('\0'), m_token_name(NULL), m_token_type(RECD_NULL), m_sum_var(false), m_node_var(true)
 {
   RecDataClear(RECD_NULL, &m_token_value);
   RecDataClear(RECD_NULL, &m_token_value_max);
@@ -61,7 +58,7 @@ StatExprToken::StatExprToken()
  * ---------------------
  */
 void
-StatExprToken::copy(const StatExprToken & source)
+StatExprToken::copy(const StatExprToken &source)
 {
   m_arith_symbol = source.m_arith_symbol;
 
@@ -96,7 +93,6 @@ StatExprToken::copy(const StatExprToken & source)
 void
 StatExprToken::assignTokenName(const char *name)
 {
-
   if (isdigit(name[0])) {
     // numerical constant
     m_token_name = ats_strdup("CONSTANT");
@@ -115,19 +111,19 @@ StatExprToken::assignTokenName(const char *name)
     // assign pre-defined constant in here
     // constant will be stored as RecFloat type.
     if (!strcmp(m_token_name, "CONSTANT")) {
-      m_token_value.rec_float = (RecFloat) atof(name);
+      m_token_value.rec_float = (RecFloat)atof(name);
     } else if (!strcmp(m_token_name, "$BYTES_TO_MB_SCALE")) {
-      m_token_value.rec_float = (RecFloat) BYTES_TO_MB_SCALE;
+      m_token_value.rec_float = (RecFloat)BYTES_TO_MB_SCALE;
     } else if (!strcmp(m_token_name, "$MBIT_TO_KBIT_SCALE")) {
-      m_token_value.rec_float = (RecFloat) MBIT_TO_KBIT_SCALE;
+      m_token_value.rec_float = (RecFloat)MBIT_TO_KBIT_SCALE;
     } else if (!strcmp(m_token_name, "$SECOND_TO_MILLISECOND_SCALE")) {
-      m_token_value.rec_float = (RecFloat) SECOND_TO_MILLISECOND_SCALE;
+      m_token_value.rec_float = (RecFloat)SECOND_TO_MILLISECOND_SCALE;
     } else if (!strcmp(m_token_name, "$PCT_TO_INTPCT_SCALE")) {
-      m_token_value.rec_float = (RecFloat) PCT_TO_INTPCT_SCALE;
+      m_token_value.rec_float = (RecFloat)PCT_TO_INTPCT_SCALE;
     } else if (!strcmp(m_token_name, "$HRTIME_SECOND")) {
-      m_token_value.rec_float = (RecFloat) HRTIME_SECOND;
+      m_token_value.rec_float = (RecFloat)HRTIME_SECOND;
     } else if (!strcmp(m_token_name, "$BYTES_TO_MBIT_SCALE")) {
-      m_token_value.rec_float = (RecFloat) BYTES_TO_MBIT_SCALE;
+      m_token_value.rec_float = (RecFloat)BYTES_TO_MBIT_SCALE;
     } else {
       mgmt_log(stderr, "[StatPro] ERROR: Undefined constant: %s\n", m_token_name);
       StatError = true;
@@ -146,7 +142,8 @@ StatExprToken::assignTokenName(const char *name)
  * Do some token type conversion if necessary. Return true
  * if the token type is recognizable; false otherwise.
  */
-bool StatExprToken::assignTokenType()
+bool
+StatExprToken::assignTokenType()
 {
   ink_assert(m_token_name != NULL);
   m_token_type = varType(m_token_name);
@@ -202,13 +199,13 @@ StatExprToken::precedence()
   switch (m_arith_symbol) {
   case '(':
     return 4;
-  case '^':                    // fall through
+  case '^': // fall through
   case '!':
     return 3;
-  case '*':                    // fall through
+  case '*': // fall through
   case '/':
     return 2;
-  case '+':                    // fall through
+  case '+': // fall through
   case '-':
     return 1;
   default:
@@ -225,7 +222,8 @@ StatExprToken::precedence()
  * or larger than max, then the error value is assigned. If no
  * error value is assigned, either min. or max. is assigned.
  */
-bool StatExprToken::statVarSet(RecDataT type, RecData value)
+bool
+StatExprToken::statVarSet(RecDataT type, RecData value)
 {
   RecData converted_value;
 
@@ -274,8 +272,7 @@ bool StatExprToken::statVarSet(RecDataT type, RecData value)
 
   if (RecDataCmp(m_token_type, converted_value, m_token_value_min) < 0) {
     value = m_token_value_min;
-  }
-  else if (RecDataCmp(m_token_type, converted_value, m_token_value_max) > 0) {
+  } else if (RecDataCmp(m_token_type, converted_value, m_token_value_max) > 0) {
     value = m_token_value_max;
   }
 
@@ -284,15 +281,14 @@ bool StatExprToken::statVarSet(RecDataT type, RecData value)
 
 
 /***********************************************************************
-					    	 StatExprList
+                                                 StatExprList
  **********************************************************************/
 
 /**
  * StatExprList::StatExprList()
  * ----------------------------
  */
-StatExprList::StatExprList()
- : m_size(0)
+StatExprList::StatExprList() : m_size(0)
 {
 }
 
@@ -307,7 +303,7 @@ StatExprList::clean()
   StatExprToken *temp = NULL;
 
   while ((temp = m_tokenList.dequeue())) {
-    delete(temp);
+    delete (temp);
     m_size -= 1;
   }
   ink_assert(m_size == 0);
@@ -315,7 +311,7 @@ StatExprList::clean()
 
 
 void
-StatExprList::enqueue(StatExprToken * entry)
+StatExprList::enqueue(StatExprToken *entry)
 {
   ink_assert(entry);
   m_tokenList.enqueue(entry);
@@ -324,7 +320,7 @@ StatExprList::enqueue(StatExprToken * entry)
 
 
 void
-StatExprList::push(StatExprToken * entry)
+StatExprList::push(StatExprToken *entry)
 {
   ink_assert(entry);
   m_tokenList.push(entry);
@@ -339,7 +335,7 @@ StatExprList::dequeue()
     return NULL;
   }
   m_size -= 1;
-  return (StatExprToken *) m_tokenList.dequeue();
+  return (StatExprToken *)m_tokenList.dequeue();
 }
 
 
@@ -375,7 +371,7 @@ StatExprList::first()
 
 
 StatExprToken *
-StatExprList::next(StatExprToken * current)
+StatExprList::next(StatExprToken *current)
 {
   if (!current) {
     return NULL;
@@ -392,7 +388,7 @@ StatExprList::next(StatExprToken * current)
 void
 StatExprList::print(const char *prefix)
 {
-  for (StatExprToken * token = first(); token; token = next(token)) {
+  for (StatExprToken *token = first(); token; token = next(token)) {
     token->print(prefix);
   }
 }
@@ -411,7 +407,7 @@ StatExprList::count()
 
 
 /***********************************************************************
- 					    	     StatObject
+                                                     StatObject
  **********************************************************************/
 
 
@@ -421,32 +417,16 @@ StatExprList::count()
  */
 
 StatObject::StatObject()
- : m_id(1),
-   m_debug(false),
-   m_expr_string(NULL),
-   m_node_dest(NULL),
-   m_cluster_dest(NULL),
-   m_expression(NULL),
-   m_postfix(NULL),
-   m_last_update(-1),
-   m_current_time(-1), m_update_interval(-1),
-   m_stats_max(FLT_MAX), m_stats_min(FLT_MIN),
-   m_has_max(false), m_has_min(false), m_has_delta(false)
+  : m_id(1), m_debug(false), m_expr_string(NULL), m_node_dest(NULL), m_cluster_dest(NULL), m_expression(NULL), m_postfix(NULL),
+    m_last_update(-1), m_current_time(-1), m_update_interval(-1), m_stats_max(FLT_MAX), m_stats_min(FLT_MIN), m_has_max(false),
+    m_has_min(false), m_has_delta(false)
 {
 }
 
 
 StatObject::StatObject(unsigned identifier)
-  : m_id(identifier),
-    m_debug(false),
-    m_expr_string(NULL),
-    m_node_dest(NULL),
-    m_cluster_dest(NULL),
-    m_expression(NULL),
-    m_postfix(NULL),
-    m_last_update(-1),
-    m_current_time(-1), m_update_interval(-1),
-    m_stats_max(FLT_MAX), m_stats_min(FLT_MIN),
+  : m_id(identifier), m_debug(false), m_expr_string(NULL), m_node_dest(NULL), m_cluster_dest(NULL), m_expression(NULL),
+    m_postfix(NULL), m_last_update(-1), m_current_time(-1), m_update_interval(-1), m_stats_max(FLT_MAX), m_stats_min(FLT_MIN),
     m_has_max(false), m_has_min(false), m_has_delta(false)
 {
 }
@@ -490,14 +470,12 @@ StatObject::assignDst(const char *str, bool m_node_var, bool m_sum_var)
 
   // Set max/min value
   if (m_has_max)
-    RecDataSetFromFloat(statToken->m_token_type, &statToken->m_token_value_max,
-                        m_stats_max);
+    RecDataSetFromFloat(statToken->m_token_type, &statToken->m_token_value_max, m_stats_max);
   else
     RecDataSetMax(statToken->m_token_type, &statToken->m_token_value_max);
 
   if (m_has_min)
-    RecDataSetFromFloat(statToken->m_token_type, &statToken->m_token_value_min,
-                        m_stats_min);
+    RecDataSetFromFloat(statToken->m_token_type, &statToken->m_token_value_min, m_stats_min);
   else
     RecDataSetMin(statToken->m_token_type, &statToken->m_token_value_min);
 
@@ -536,11 +514,9 @@ StatObject::assignExpr(char *str)
   m_expression = new StatExprList();
 
   while (token) {
-
     statToken = new StatExprToken();
 
     if (isOperator(token[0])) {
-
       statToken->m_arith_symbol = token[0];
       ink_assert(statToken->m_token_name == NULL);
 
@@ -549,20 +525,17 @@ StatObject::assignExpr(char *str)
       }
 
     } else {
-
       ink_assert(statToken->m_arith_symbol == '\0');
 
       // delta
       if (token[0] == '#') {
-
-        token += 1;             // skip '#'
+        token += 1; // skip '#'
         statToken->m_token_value_delta = new StatDataSamples();
-        statToken->m_token_value_delta->previous_time = (ink_hrtime) 0;
-        statToken->m_token_value_delta->current_time = (ink_hrtime) 0;
+        statToken->m_token_value_delta->previous_time = (ink_hrtime)0;
+        statToken->m_token_value_delta->current_time = (ink_hrtime)0;
         statToken->m_token_value_delta->data_type = RECD_NULL;
         RecDataClear(RECD_NULL, &statToken->m_token_value_delta->previous_value);
         RecDataClear(RECD_NULL, &statToken->m_token_value_delta->current_value);
-
       }
 
       statToken->assignTokenName(token);
@@ -570,16 +543,13 @@ StatObject::assignExpr(char *str)
       if (StatDebug) {
         Debug(MODULE_INIT, "\toperand:  ->%s<-\n", token);
       }
-
     }
 
     token = exprTok.iterNext(&exprTok_state);
     m_expression->enqueue(statToken);
-
   }
 
   infix2postfix();
-
 }
 
 
@@ -603,7 +573,7 @@ StatObject::infix2postfix()
     curToken = m_expression->dequeue();
 
     if (!isOperator(curToken->m_arith_symbol)) {
-      //printf("I2P~: enqueue %s\n", curToken->m_token_name);
+      // printf("I2P~: enqueue %s\n", curToken->m_token_name);
       m_postfix->enqueue(curToken);
 
     } else {
@@ -612,33 +582,33 @@ StatObject::infix2postfix()
       if (curToken->m_arith_symbol == '(') {
         stack.push(curToken);
       } else if (curToken->m_arith_symbol == ')') {
-        tempToken = (StatExprToken *) stack.pop();
+        tempToken = (StatExprToken *)stack.pop();
 
         while (tempToken->m_arith_symbol != '(') {
-          //printf("I2P@: enqueue %c\n", tempToken->m_arith_symbol);
+          // printf("I2P@: enqueue %c\n", tempToken->m_arith_symbol);
           m_postfix->enqueue(tempToken);
-          tempToken = (StatExprToken *) stack.pop();
+          tempToken = (StatExprToken *)stack.pop();
         }
 
         // Free up memory for ')'
-        delete(curToken);
-        delete(tempToken);
+        delete (curToken);
+        delete (tempToken);
 
       } else {
         if (stack.count() == 0) {
           stack.push(curToken);
         } else {
-          tempToken = (StatExprToken *) stack.top();
+          tempToken = (StatExprToken *)stack.top();
 
           while ((tempToken->m_arith_symbol != '(') && (tempToken->precedence() >= curToken->precedence())) {
-            tempToken = (StatExprToken *) stack.pop();  // skip the (
-            //printf("I2P$: enqueue %c\n", tempToken->m_arith_symbol);
+            tempToken = (StatExprToken *)stack.pop(); // skip the (
+            // printf("I2P$: enqueue %c\n", tempToken->m_arith_symbol);
             m_postfix->enqueue(tempToken);
             if (stack.count() == 0) {
               break;
             }
-            tempToken = (StatExprToken *) stack.top();
-          }                     // while
+            tempToken = (StatExprToken *)stack.top();
+          } // while
 
           stack.push(curToken);
         }
@@ -647,13 +617,13 @@ StatObject::infix2postfix()
   }
 
   while (stack.count() > 0) {
-    tempToken = (StatExprToken *) stack.pop();
-    //printf("I2P?: enqueue %c\n", tempToken->m_arith_symbol);
+    tempToken = (StatExprToken *)stack.pop();
+    // printf("I2P?: enqueue %c\n", tempToken->m_arith_symbol);
     m_postfix->enqueue(tempToken);
   }
 
   // dump infix expression
-  delete(m_expression);
+  delete (m_expression);
   m_expression = NULL;
 }
 
@@ -664,7 +634,8 @@ StatObject::infix2postfix()
  *
  *
  */
-RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
+RecData
+StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
 {
   StatExprList stack;
   StatExprToken *left = NULL;
@@ -678,7 +649,7 @@ RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
 
   /* Express checkout lane -- Stat. object with on 1 source variable */
   if (m_postfix->count() == 1) {
-    StatExprToken * src = m_postfix->top();
+    StatExprToken *src = m_postfix->top();
 
     // in librecords, not all statistics are register at initialization
     // must assign proper type if it is undefined.
@@ -696,16 +667,13 @@ RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
         RecDataClear(src->m_token_type, &tempValue);
       }
     } else {
-      if (!overviewGenerator->varClusterDataFromName(src->m_token_type,
-                                                     src->m_token_name,
-                                                     &tempValue)) {
+      if (!overviewGenerator->varClusterDataFromName(src->m_token_type, src->m_token_name, &tempValue)) {
         RecDataClear(src->m_token_type, &tempValue);
       }
     }
   } else {
-
     /* standard postfix evaluation */
-    for (StatExprToken * token = m_postfix->first(); token; token = m_postfix->next(token)) {
+    for (StatExprToken *token = m_postfix->first(); token; token = m_postfix->next(token)) {
       /* carbon-copy the token. */
       curToken = new StatExprToken();
       curToken->copy(*token);
@@ -727,9 +695,9 @@ RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
         result = StatBinaryEval(left, curToken->m_arith_symbol, right, cluster);
 
         stack.push(result);
-        delete(curToken);
-        delete(left);
-        delete(right);
+        delete (curToken);
+        delete (left);
+        delete (right);
       }
     }
 
@@ -744,7 +712,6 @@ RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
   }
 
   return tempValue;
-
 }
 
 
@@ -754,7 +721,8 @@ RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
  *
  *
  */
-RecData StatObject::ClusterStatEval(RecDataT *result_type)
+RecData
+StatObject::ClusterStatEval(RecDataT *result_type)
 {
   /* Sanity check */
   ink_assert(m_cluster_dest && !m_cluster_dest->m_node_var);
@@ -765,9 +733,7 @@ RecData StatObject::ClusterStatEval(RecDataT *result_type)
   } else {
     RecData tempValue;
 
-    if (!overviewGenerator->varClusterDataFromName(m_node_dest->m_token_type,
-                                                   m_node_dest->m_token_name,
-                                                   &tempValue)) {
+    if (!overviewGenerator->varClusterDataFromName(m_node_dest->m_token_type, m_node_dest->m_token_name, &tempValue)) {
       *result_type = RECD_NULL;
       RecDataClear(*result_type, &tempValue);
     }
@@ -796,7 +762,7 @@ RecData StatObject::ClusterStatEval(RecDataT *result_type)
  *     otherwise simply set right->m_token_value with varFloatFromName.
  */
 void
-StatObject::setTokenValue(StatExprToken * token, bool cluster)
+StatObject::setTokenValue(StatExprToken *token, bool cluster)
 {
   if (token->m_token_name) {
     // it is NOT an intermediate value
@@ -811,36 +777,30 @@ StatObject::setTokenValue(StatExprToken * token, bool cluster)
       token->m_token_value.rec_int = (m_current_time - m_last_update);
       break;
 
-    case RECD_INT:             // fallthought
+    case RECD_INT: // fallthought
     case RECD_COUNTER:
     case RECD_FLOAT:
       if (cluster) {
-        if (!overviewGenerator->varClusterDataFromName(token->m_token_type,
-                                                       token->m_token_name,
-                                                       &(token->m_token_value)))
-        {
+        if (!overviewGenerator->varClusterDataFromName(token->m_token_type, token->m_token_name, &(token->m_token_value))) {
           RecDataClear(token->m_token_type, &token->m_token_value);
         }
       } else {
         if (token->m_token_value_delta) {
-          token->m_token_value =
-            token->m_token_value_delta->diff_value(token->m_token_name);
+          token->m_token_value = token->m_token_value_delta->diff_value(token->m_token_name);
         } else {
-          if (!varDataFromName(token->m_token_type, token->m_token_name,
-                               &(token->m_token_value))) {
+          if (!varDataFromName(token->m_token_type, token->m_token_name, &(token->m_token_value))) {
             RecDataClear(token->m_token_type, &token->m_token_value);
           }
-        }                       // delta?
-      }                         // cluster?
+        } // delta?
+      }   // cluster?
       break;
 
     default:
       if (StatDebug) {
-        Debug(MODULE, "Unrecognized token \"%s\" of type %d.\n",
-              token->m_token_name, token->m_token_type);
+        Debug(MODULE, "Unrecognized token \"%s\" of type %d.\n", token->m_token_name, token->m_token_type);
       }
-    }                           // switch
-  }                             // m_token_name?
+    } // switch
+  }   // m_token_name?
 }
 
 
@@ -855,15 +815,14 @@ StatObject::setTokenValue(StatExprToken * token, bool cluster)
  * - (3) cluster variable
  * - (4) an immediate value
  */
-StatExprToken *StatObject::StatBinaryEval(StatExprToken * left, char op,
-                                          StatExprToken * right, bool cluster)
+StatExprToken *
+StatObject::StatBinaryEval(StatExprToken *left, char op, StatExprToken *right, bool cluster)
 {
   RecData l, r;
   StatExprToken *result = new StatExprToken();
   result->m_token_type = RECD_INT;
 
-  if (left->m_token_type == RECD_NULL
-      && right->m_token_type == RECD_NULL) {
+  if (left->m_token_type == RECD_NULL && right->m_token_type == RECD_NULL) {
     return result;
   }
 
@@ -886,8 +845,7 @@ StatExprToken *StatObject::StatBinaryEval(StatExprToken * left, char op,
        * as result type. It's may lead to loss of precision when do
        * conversion, be careful!
        */
-      if (right->m_token_type == RECD_FLOAT
-          || right->m_token_type == RECD_CONST) {
+      if (right->m_token_type == RECD_FLOAT || right->m_token_type == RECD_CONST) {
         result->m_token_type = right->m_token_type;
       }
       break;
@@ -906,13 +864,12 @@ StatExprToken *StatObject::StatBinaryEval(StatExprToken * left, char op,
   RecDataClear(RECD_NULL, &l);
   RecDataClear(RECD_NULL, &r);
 
-  if (left->m_token_type == right->m_token_type ) {
+  if (left->m_token_type == right->m_token_type) {
     l = left->m_token_value;
     r = right->m_token_value;
   } else if (result->m_token_type != left->m_token_type) {
     if (left->m_token_type != RECD_NULL) {
-      ink_assert(result->m_token_type == RECD_FLOAT
-                 || result->m_token_type == RECD_CONST);
+      ink_assert(result->m_token_type == RECD_FLOAT || result->m_token_type == RECD_CONST);
 
       l.rec_float = (RecFloat)left->m_token_value.rec_int;
     }
@@ -921,8 +878,7 @@ StatExprToken *StatObject::StatBinaryEval(StatExprToken * left, char op,
   } else {
     l = left->m_token_value;
     if (right->m_token_type != RECD_NULL) {
-      ink_assert(result->m_token_type == RECD_FLOAT
-                 || result->m_token_type == RECD_CONST);
+      ink_assert(result->m_token_type == RECD_FLOAT || result->m_token_type == RECD_CONST);
 
       r.rec_float = (RecFloat)right->m_token_value.rec_int;
     }
@@ -979,11 +935,10 @@ StatExprToken *StatObject::StatBinaryEval(StatExprToken * left, char op,
 
 
 /***********************************************************************
- 					    	   StatObjectList
+                                                   StatObjectList
  **********************************************************************/
 
-StatObjectList::StatObjectList()
- : m_size(0)
+StatObjectList::StatObjectList() : m_size(0)
 {
 }
 
@@ -995,7 +950,7 @@ StatObjectList::clean()
 
   while ((temp = m_statList.dequeue())) {
     m_size -= 1;
-    delete(temp);
+    delete (temp);
   }
 
   ink_assert(m_size == 0);
@@ -1003,9 +958,9 @@ StatObjectList::clean()
 
 
 void
-StatObjectList::enqueue(StatObject * object)
+StatObjectList::enqueue(StatObject *object)
 {
-  for (StatExprToken * token = object->m_postfix->first(); token; token = object->m_postfix->next(token)) {
+  for (StatExprToken *token = object->m_postfix->first(); token; token = object->m_postfix->next(token)) {
     if (token->m_token_value_delta) {
       object->m_has_delta = true;
       break;
@@ -1025,7 +980,7 @@ StatObjectList::first()
 
 
 StatObject *
-StatObjectList::next(StatObject * current)
+StatObjectList::next(StatObject *current)
 {
   return (current->link).next;
 }
@@ -1049,7 +1004,7 @@ StatObjectList::Eval()
   RecDataClear(RECD_NULL, &tempValue);
   RecDataClear(RECD_NULL, &result);
 
-  for (StatObject * object = first(); object; object = next(object)) {
+  for (StatObject *object = first(); object; object = next(object)) {
     StatError = false;
     StatDebug = object->m_debug;
 
@@ -1080,13 +1035,14 @@ StatObjectList::Eval()
       delta = object->m_current_time - object->m_last_update;
 
       if (StatDebug) {
-        Debug(MODULE, "\tUPDATE:%" PRId64 " THRESHOLD:%" PRId64 ", DELTA:%" PRId64 "\n", object->m_update_interval, threshold, delta);
+        Debug(MODULE, "\tUPDATE:%" PRId64 " THRESHOLD:%" PRId64 ", DELTA:%" PRId64 "\n", object->m_update_interval, threshold,
+              delta);
       }
 
       /* Should we do the calculation? */
-      if ((delta > threshold) ||        /* sufficient elapsed time? */
-          (object->m_last_update == -1) ||      /*       first time?       */
-          (object->m_last_update > object->m_current_time)) {   /*wrapped */
+      if ((delta > threshold) ||                              /* sufficient elapsed time? */
+          (object->m_last_update == -1) ||                    /*       first time?       */
+          (object->m_last_update > object->m_current_time)) { /*wrapped */
 
         if (StatDebug) {
           if (delta > threshold) {
@@ -1101,7 +1057,6 @@ StatObjectList::Eval()
         }
 
         if (!object->m_has_delta) {
-
           if (StatDebug) {
             Debug(MODULE, "\tEVAL: Simple time-condition.\n");
           }
@@ -1123,8 +1078,7 @@ StatObjectList::Eval()
             Debug(MODULE, "\tEVAL: Complicated time-condition.\n");
           }
           // scroll old values
-          for (StatExprToken * token = object->m_postfix->first(); token; token = object->m_expression->next(token)) {
-
+          for (StatExprToken *token = object->m_postfix->first(); token; token = object->m_expression->next(token)) {
             // in librecords, not all statistics are register at initialization
             // must assign proper type if it is undefined.
             if (!isOperator(token->m_arith_symbol) && token->m_token_type == RECD_NULL) {
@@ -1132,8 +1086,7 @@ StatObjectList::Eval()
             }
 
             if (token->m_token_value_delta) {
-              if (!varDataFromName(token->m_token_type, token->m_token_name,
-                                   &tempValue)) {
+              if (!varDataFromName(token->m_token_type, token->m_token_name, &tempValue)) {
                 RecDataClear(RECD_NULL, &tempValue);
               }
 
@@ -1161,18 +1114,18 @@ StatObjectList::Eval()
               Debug(MODULE, "\tEVAL: Timer not expired, do nothing\n");
             }
           }
-        }                       /* delta? */
+        } /* delta? */
       } else {
         if (StatDebug) {
           Debug(MODULE, "\tEVAL: Timer not expired, nor 1st time, nor wrapped, SORRY!\n");
         }
-      }                         /* timed event */
+      } /* timed event */
     }
     count += 1;
-  }                             /* for */
+  } /* for */
 
   return count;
-}                               /* Eval() */
+} /* Eval() */
 
 
 /**
@@ -1183,7 +1136,7 @@ StatObjectList::Eval()
 void
 StatObjectList::print(const char *prefix)
 {
-  for (StatObject * object = first(); object; object = next(object)) {
+  for (StatObject *object = first(); object; object = next(object)) {
     if (StatDebug) {
       Debug(MODULE, "\n%sSTAT OBJECT#: %d\n", prefix, object->m_id);
     }


[38/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterConfig.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterConfig.cc b/iocore/cluster/ClusterConfig.cc
index 68bee6b..cac0014 100644
--- a/iocore/cluster/ClusterConfig.cc
+++ b/iocore/cluster/ClusterConfig.cc
@@ -32,13 +32,8 @@
 int cluster_port = DEFAULT_CLUSTER_PORT_NUMBER;
 
 ClusterAccept::ClusterAccept(int *port, int send_bufsize, int recv_bufsize)
-  : Continuation(0),
-    p_cluster_port(port),
-    socket_send_bufsize(send_bufsize),
-    socket_recv_bufsize(recv_bufsize),
-    current_cluster_port(-1),
-    accept_action(0),
-    periodic_event(0)
+  : Continuation(0), p_cluster_port(port), socket_send_bufsize(send_bufsize), socket_recv_bufsize(recv_bufsize),
+    current_cluster_port(-1), accept_action(0), periodic_event(0)
 {
   mutex = new_ProxyMutex();
   SET_HANDLER(&ClusterAccept::ClusterAcceptEvent);
@@ -86,54 +81,50 @@ int
 ClusterAccept::ClusterAcceptEvent(int event, void *data)
 {
   switch (event) {
-  case EVENT_IMMEDIATE:
-    {
-      ShutdownDelete();
-      return EVENT_DONE;
-    }
-  case EVENT_INTERVAL:
-    {
-      int cluster_port = *p_cluster_port;
-
-      if (cluster_port != current_cluster_port) {
-        // Configuration changed cluster port, redo accept on new port.
-        if (accept_action) {
-          accept_action->cancel();
-          accept_action = 0;
-        }
+  case EVENT_IMMEDIATE: {
+    ShutdownDelete();
+    return EVENT_DONE;
+  }
+  case EVENT_INTERVAL: {
+    int cluster_port = *p_cluster_port;
+
+    if (cluster_port != current_cluster_port) {
+      // Configuration changed cluster port, redo accept on new port.
+      if (accept_action) {
+        accept_action->cancel();
+        accept_action = 0;
+      }
 
-        NetProcessor::AcceptOptions opt;
-        opt.recv_bufsize = socket_recv_bufsize;
-        opt.send_bufsize = socket_send_bufsize;
-        opt.etype = ET_CLUSTER;
-        opt.local_port = cluster_port;
-        opt.ip_family = AF_INET;
-        opt.localhost_only = false;
-
-        accept_action = netProcessor.main_accept(this, NO_FD, opt);
-        if (!accept_action) {
-          Warning("Unable to accept cluster connections on port: %d", cluster_port);
-        } else {
-          current_cluster_port = cluster_port;
-        }
+      NetProcessor::AcceptOptions opt;
+      opt.recv_bufsize = socket_recv_bufsize;
+      opt.send_bufsize = socket_send_bufsize;
+      opt.etype = ET_CLUSTER;
+      opt.local_port = cluster_port;
+      opt.ip_family = AF_INET;
+      opt.localhost_only = false;
+
+      accept_action = netProcessor.main_accept(this, NO_FD, opt);
+      if (!accept_action) {
+        Warning("Unable to accept cluster connections on port: %d", cluster_port);
+      } else {
+        current_cluster_port = cluster_port;
       }
-      return EVENT_CONT;
-    }
-  case NET_EVENT_ACCEPT:
-    {
-      ClusterAcceptMachine((NetVConnection *) data);
-      return EVENT_DONE;
-    }
-  default:
-    {
-      Warning("ClusterAcceptEvent: received unknown event %d", event);
-      return EVENT_DONE;
     }
-  }                             // End of switch
+    return EVENT_CONT;
+  }
+  case NET_EVENT_ACCEPT: {
+    ClusterAcceptMachine((NetVConnection *)data);
+    return EVENT_DONE;
+  }
+  default: {
+    Warning("ClusterAcceptEvent: received unknown event %d", event);
+    return EVENT_DONE;
+  }
+  } // End of switch
 }
 
 int
-ClusterAccept::ClusterAcceptMachine(NetVConnection * NetVC)
+ClusterAccept::ClusterAcceptMachine(NetVConnection *NetVC)
 {
   // Validate remote IP address.
   unsigned int remote_ip = NetVC->get_remote_ip();
@@ -155,7 +146,7 @@ ClusterAccept::ClusterAcceptMachine(NetVConnection * NetVC)
 }
 
 static void
-make_cluster_connections(MachineList * l)
+make_cluster_connections(MachineList *l)
 {
   //
   // Connect to all new machines.
@@ -179,8 +170,7 @@ make_cluster_connections(MachineList * l)
 }
 
 int
-machine_config_change(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data,
-                      void *cookie)
+machine_config_change(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data, void *cookie)
 {
   // Handle changes to the cluster.config or machines.config
   // file.  cluster.config is the list of machines in the
@@ -189,11 +179,11 @@ machine_config_change(const char * /* name ATS_UNUSED */, RecDataT /* data_type
   // This may include front-end load redirectors, machines going
   // up or coming down etc.
   //
-  char *filename = (char *) data.rec_string;
+  char *filename = (char *)data.rec_string;
   MachineList *l = read_MachineList(filename);
   MachineList *old = NULL;
 #ifdef USE_SEPARATE_MACHINE_CONFIG
-  switch ((int) cookie) {
+  switch ((int)cookie) {
   case MACHINE_CONFIG:
     old = machines_config;
     machines_config = l;
@@ -205,7 +195,7 @@ machine_config_change(const char * /* name ATS_UNUSED */, RecDataT /* data_type
     break;
   }
 #else
-  (void) cookie;
+  (void)cookie;
   old = cluster_config;
   machines_config = l;
   cluster_config = l;
@@ -229,7 +219,7 @@ do_machine_config_change(void *d, const char *s)
 /*************************************************************************/
 // ClusterConfiguration member functions (Public Class)
 /*************************************************************************/
-ClusterConfiguration::ClusterConfiguration():n_machines(0), changed(0)
+ClusterConfiguration::ClusterConfiguration() : n_machines(0), changed(0)
 {
   memset(machines, 0, sizeof(machines));
   memset(hash_table, 0, sizeof(hash_table));
@@ -239,40 +229,39 @@ ClusterConfiguration::ClusterConfiguration():n_machines(0), changed(0)
 // ConfigurationContinuation member functions (Internal Class)
 /*************************************************************************/
 struct ConfigurationContinuation;
-typedef int (ConfigurationContinuation::*CfgContHandler) (int, void *);
-struct ConfigurationContinuation: public Continuation
-{
+typedef int (ConfigurationContinuation::*CfgContHandler)(int, void *);
+struct ConfigurationContinuation : public Continuation {
   ClusterConfiguration *c;
   ClusterConfiguration *prev;
 
   int
-  zombieEvent(int /* event ATS_UNUSED */, Event * e)
+  zombieEvent(int /* event ATS_UNUSED */, Event *e)
   {
-    prev->link.next = NULL;     // remove that next pointer
-    SET_HANDLER((CfgContHandler) & ConfigurationContinuation::dieEvent);
+    prev->link.next = NULL; // remove that next pointer
+    SET_HANDLER((CfgContHandler)&ConfigurationContinuation::dieEvent);
     e->schedule_in(CLUSTER_CONFIGURATION_ZOMBIE);
     return EVENT_CONT;
   }
 
   int
-  dieEvent(int event, Event * e)
+  dieEvent(int event, Event *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     delete c;
     delete this;
     return EVENT_DONE;
   }
 
-  ConfigurationContinuation(ClusterConfiguration * cc, ClusterConfiguration * aprev)
-    : Continuation(NULL), c(cc), prev(aprev) {
+  ConfigurationContinuation(ClusterConfiguration *cc, ClusterConfiguration *aprev) : Continuation(NULL), c(cc), prev(aprev)
+  {
     mutex = new_ProxyMutex();
-    SET_HANDLER((CfgContHandler) & ConfigurationContinuation::zombieEvent);
+    SET_HANDLER((CfgContHandler)&ConfigurationContinuation::zombieEvent);
   }
 };
 
 static void
-free_configuration(ClusterConfiguration * c, ClusterConfiguration * prev)
+free_configuration(ClusterConfiguration *c, ClusterConfiguration *prev)
 {
   //
   // Delete the configuration after a time.
@@ -286,7 +275,7 @@ free_configuration(ClusterConfiguration * c, ClusterConfiguration * prev)
 }
 
 ClusterConfiguration *
-configuration_add_machine(ClusterConfiguration * c, ClusterMachine * m)
+configuration_add_machine(ClusterConfiguration *c, ClusterMachine *m)
 {
   // Build a new cluster configuration with the new machine.
   // Machines are stored in ip sorted order.
@@ -318,7 +307,7 @@ configuration_add_machine(ClusterConfiguration * c, ClusterMachine * m)
   ink_assert(cc->n_machines < CLUSTER_MAX_MACHINES);
 
   build_cluster_hash_table(cc);
-  INK_MEMORY_BARRIER;           // commit writes before freeing old hash table
+  INK_MEMORY_BARRIER; // commit writes before freeing old hash table
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CONFIGURATION_CHANGES_STAT);
 
   free_configuration(c, cc);
@@ -326,7 +315,7 @@ configuration_add_machine(ClusterConfiguration * c, ClusterMachine * m)
 }
 
 ClusterConfiguration *
-configuration_remove_machine(ClusterConfiguration * c, ClusterMachine * m)
+configuration_remove_machine(ClusterConfiguration *c, ClusterMachine *m)
 {
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
@@ -349,7 +338,7 @@ configuration_remove_machine(ClusterConfiguration * c, ClusterMachine * m)
   cc->changed = ink_get_hrtime();
 
   build_cluster_hash_table(cc);
-  INK_MEMORY_BARRIER;           // commit writes before freeing old hash table
+  INK_MEMORY_BARRIER; // commit writes before freeing old hash table
   CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CONFIGURATION_CHANGES_STAT);
 
   free_configuration(c, cc);
@@ -365,16 +354,14 @@ configuration_remove_machine(ClusterConfiguration * c, ClusterMachine * m)
 //   owner (machine now as opposed to in the past).
 //
 ClusterMachine *
-cluster_machine_at_depth(unsigned int hash, int *pprobe_depth, ClusterMachine ** past_probes)
+cluster_machine_at_depth(unsigned int hash, int *pprobe_depth, ClusterMachine **past_probes)
 {
 #ifdef CLUSTER_TOMCAT
   if (!cache_clustering_enabled)
     return NULL;
 #endif
-  ClusterConfiguration *
-    cc = this_cluster()->current_configuration();
-  ClusterConfiguration *
-    next_cc = cc;
+  ClusterConfiguration *cc = this_cluster()->current_configuration();
+  ClusterConfiguration *next_cc = cc;
   ink_hrtime now = ink_get_hrtime();
   int fake_probe_depth = 0;
   int &probe_depth = pprobe_depth ? (*pprobe_depth) : fake_probe_depth;
@@ -413,14 +400,12 @@ cluster_machine_at_depth(unsigned int hash, int *pprobe_depth, ClusterMachine **
       continue;
     }
 
-    ClusterMachine *
-      m = cc->machine_hash(hash);
+    ClusterMachine *m = cc->machine_hash(hash);
 
     // If it is not this machine, or a machine we have done before
     // and one that is still up, try again
     //
-    bool
-      ok = !(m == this_cluster_machine() || (past_probes && machine_in_vector(m, past_probes, probe_depth)) || m->dead);
+    bool ok = !(m == this_cluster_machine() || (past_probes && machine_in_vector(m, past_probes, probe_depth)) || m->dead);
 
     // Store the all but the last probe, so that we never return
     // the same machine
@@ -431,7 +416,7 @@ cluster_machine_at_depth(unsigned int hash, int *pprobe_depth, ClusterMachine **
 
     if (!ok) {
       if (!pprobe_depth)
-        break;                  // don't go down if we don't have a depth
+        break; // don't go down if we don't have a depth
       continue;
     }
 
@@ -447,9 +432,9 @@ cluster_machine_at_depth(unsigned int hash, int *pprobe_depth, ClusterMachine **
 //   stored in the ClusterMachine structures
 //
 void
-initialize_thread_for_cluster(EThread * e)
+initialize_thread_for_cluster(EThread *e)
 {
-  (void) e;
+  (void)e;
 }
 
 /*************************************************************************/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterHandler.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterHandler.cc b/iocore/cluster/ClusterHandler.cc
index afb0156..979bc8d 100644
--- a/iocore/cluster/ClusterHandler.cc
+++ b/iocore/cluster/ClusterHandler.cc
@@ -55,15 +55,15 @@ static int dump_msgs = 0;
 // VERIFY_PETERS_DATA support code
 /////////////////////////////////////////
 #ifdef VERIFY_PETERS_DATA
-#define DO_VERIFY_PETERS_DATA(_p,_l) verify_peters_data(_p,_l)
+#define DO_VERIFY_PETERS_DATA(_p, _l) verify_peters_data(_p, _l)
 #else
-#define DO_VERIFY_PETERS_DATA(_p,_l)
+#define DO_VERIFY_PETERS_DATA(_p, _l)
 #endif
 
 void
 verify_peters_data(char *ap, int l)
 {
-  unsigned char *p = (unsigned char *) ap;
+  unsigned char *p = (unsigned char *)ap;
   for (int i = 0; i < l - 1; i++) {
     unsigned char x1 = p[i];
     unsigned char x2 = p[i + 1];
@@ -134,71 +134,22 @@ verify_peters_data(char *ap, int l)
 /*************************************************************************/
 
 ClusterHandler::ClusterHandler()
-  : net_vc(0),
-    thread(0),
-    ip(0),
-    port(0),
-    hostname(NULL),
-    machine(NULL),
-    ifd(-1),
-    id(-1),
-    dead(true),
-    downing(false),
-    active(false),
-    on_stolen_thread(false),
-    n_channels(0),
-    channels(NULL),
-    channel_data(NULL),
-    connector(false),
-    cluster_connect_state(ClusterHandler::CLCON_INITIAL),
-    needByteSwap(false),
-    configLookupFails(0),
-    cluster_periodic_event(0),
-    read(this, true),
-    write(this, false),
-    current_time(0),
-    last(0),
-    last_report(0),
-    n_since_last_report(0),
-    last_cluster_op_enable(0),
-    last_trace_dump(0),
-    clm(0),
-    disable_remote_cluster_ops(0),
-    pw_write_descriptors_built(0),
-    pw_freespace_descriptors_built(0),
-    pw_controldata_descriptors_built(0), pw_time_expired(0), started_on_stolen_thread(false), control_message_write(false)
+  : net_vc(0), thread(0), ip(0), port(0), hostname(NULL), machine(NULL), ifd(-1), id(-1), dead(true), downing(false), active(false),
+    on_stolen_thread(false), n_channels(0), channels(NULL), channel_data(NULL), connector(false),
+    cluster_connect_state(ClusterHandler::CLCON_INITIAL), needByteSwap(false), configLookupFails(0), cluster_periodic_event(0),
+    read(this, true), write(this, false), current_time(0), last(0), last_report(0), n_since_last_report(0),
+    last_cluster_op_enable(0), last_trace_dump(0), clm(0), disable_remote_cluster_ops(0), pw_write_descriptors_built(0),
+    pw_freespace_descriptors_built(0), pw_controldata_descriptors_built(0), pw_time_expired(0), started_on_stolen_thread(false),
+    control_message_write(false)
 #ifdef CLUSTER_STATS
-  ,
-    _vc_writes(0),
-    _vc_write_bytes(0),
-    _control_write_bytes(0),
-    _dw_missed_lock(0),
-    _dw_not_enabled(0),
-    _dw_wait_remote_fill(0),
-    _dw_no_active_vio(0),
-    _dw_not_enabled_or_no_write(0),
-    _dw_set_data_pending(0),
-    _dw_no_free_space(0),
-    _fw_missed_lock(0),
-    _fw_not_enabled(0),
-    _fw_wait_remote_fill(0),
-    _fw_no_active_vio(0),
-    _fw_not_enabled_or_no_read(0),
-    _process_read_calls(0),
-    _n_read_start(0),
-    _n_read_header(0),
-    _n_read_await_header(0),
-    _n_read_setup_descriptor(0),
-    _n_read_descriptor(0),
-    _n_read_await_descriptor(0),
-    _n_read_setup_data(0),
-    _n_read_data(0),
-    _n_read_await_data(0),
-    _n_read_post_complete(0),
-    _n_read_complete(0),
-    _process_write_calls(0),
-    _n_write_start(0),
-    _n_write_setup(0), _n_write_initiate(0), _n_write_await_completion(0), _n_write_post_complete(0), _n_write_complete(0)
+    ,
+    _vc_writes(0), _vc_write_bytes(0), _control_write_bytes(0), _dw_missed_lock(0), _dw_not_enabled(0), _dw_wait_remote_fill(0),
+    _dw_no_active_vio(0), _dw_not_enabled_or_no_write(0), _dw_set_data_pending(0), _dw_no_free_space(0), _fw_missed_lock(0),
+    _fw_not_enabled(0), _fw_wait_remote_fill(0), _fw_no_active_vio(0), _fw_not_enabled_or_no_read(0), _process_read_calls(0),
+    _n_read_start(0), _n_read_header(0), _n_read_await_header(0), _n_read_setup_descriptor(0), _n_read_descriptor(0),
+    _n_read_await_descriptor(0), _n_read_setup_data(0), _n_read_data(0), _n_read_await_data(0), _n_read_post_complete(0),
+    _n_read_complete(0), _process_write_calls(0), _n_write_start(0), _n_write_setup(0), _n_write_initiate(0),
+    _n_write_await_completion(0), _n_write_post_complete(0), _n_write_complete(0)
 #endif
 {
 #ifdef MSG_TRACE
@@ -207,26 +158,24 @@ ClusterHandler::ClusterHandler()
   // we need to lead by at least 1
 
   min_priority = 1;
-  SET_HANDLER((ClusterContHandler) & ClusterHandler::startClusterEvent);
+  SET_HANDLER((ClusterContHandler)&ClusterHandler::startClusterEvent);
 
   mutex = new_ProxyMutex();
   OutgoingControl oc;
   int n;
   for (n = 0; n < CLUSTER_CMSG_QUEUES; ++n) {
-    ink_atomiclist_init(&outgoing_control_al[n], "OutGoingControlQueue", (char *) &oc.link.next - (char *) &oc);
+    ink_atomiclist_init(&outgoing_control_al[n], "OutGoingControlQueue", (char *)&oc.link.next - (char *)&oc);
   }
 
   IncomingControl ic;
-  ink_atomiclist_init(&external_incoming_control,
-                      "ExternalIncomingControlQueue", (char *) &ic.link.next - (char *) &ic);
+  ink_atomiclist_init(&external_incoming_control, "ExternalIncomingControlQueue", (char *)&ic.link.next - (char *)&ic);
 
   ClusterVConnection ivc;
-  ink_atomiclist_init(&external_incoming_open_local,
-                      "ExternalIncomingOpenLocalQueue", (char *) &ivc.link.next - (char *) &ivc);
+  ink_atomiclist_init(&external_incoming_open_local, "ExternalIncomingOpenLocalQueue", (char *)&ivc.link.next - (char *)&ivc);
   ink_atomiclist_init(&read_vcs_ready, "ReadVcReadyQueue", offsetof(ClusterVConnection, ready_alink.next));
   ink_atomiclist_init(&write_vcs_ready, "WriteVcReadyQueue", offsetof(ClusterVConnection, ready_alink.next));
-  memset((char *) &callout_cont[0], 0, sizeof(callout_cont));
-  memset((char *) &callout_events[0], 0, sizeof(callout_events));
+  memset((char *)&callout_cont[0], 0, sizeof(callout_cont));
+  memset((char *)&callout_events[0], 0, sizeof(callout_events));
 }
 
 ClusterHandler::~ClusterHandler()
@@ -260,11 +209,11 @@ ClusterHandler::~ClusterHandler()
     channel_data = NULL;
   }
   if (read_vcs)
-    delete[]read_vcs;
+    delete[] read_vcs;
   read_vcs = NULL;
 
   if (write_vcs)
-    delete[]write_vcs;
+    delete[] write_vcs;
   write_vcs = NULL;
 
   if (clm) {
@@ -277,7 +226,7 @@ ClusterHandler::~ClusterHandler()
 }
 
 void
-ClusterHandler::close_ClusterVConnection(ClusterVConnection * vc)
+ClusterHandler::close_ClusterVConnection(ClusterVConnection *vc)
 {
   //
   // Close down a ClusterVConnection
@@ -315,7 +264,6 @@ ClusterHandler::close_ClusterVConnection(ClusterVConnection * vc)
   ink_assert(!vc->write_bytes_in_transit);
 
   if (((!vc->remote_closed && !vc->have_all_data) || (vc->remote_closed == FORCE_CLOSE_ON_OPEN_CHANNEL)) && vc->ch) {
-
     CloseMessage msg;
     int vers = CloseMessage::protoToVersion(vc->ch->machine->msg_proto_major);
     void *data;
@@ -326,7 +274,7 @@ ClusterHandler::close_ClusterVConnection(ClusterVConnection * vc)
       msg.status = (vc->remote_closed == FORCE_CLOSE_ON_OPEN_CHANNEL) ? FORCE_CLOSE_ON_OPEN_CHANNEL : vc->closed;
       msg.lerrno = vc->lerrno;
       msg.sequence_number = vc->token.sequence_number;
-      data = (void *) &msg;
+      data = (void *)&msg;
       len = sizeof(CloseMessage);
 
     } else {
@@ -349,41 +297,41 @@ ClusterHandler::close_ClusterVConnection(ClusterVConnection * vc)
 }
 
 inline bool
-ClusterHandler::vc_ok_write(ClusterVConnection * vc)
+ClusterHandler::vc_ok_write(ClusterVConnection *vc)
 {
-  return (((vc->closed > 0)
-           && (vc->write_list || vc->write_bytes_in_transit)) ||
+  return (((vc->closed > 0) && (vc->write_list || vc->write_bytes_in_transit)) ||
           (!vc->closed && vc->write.enabled && vc->write.vio.op == VIO::WRITE && vc->write.vio.buffer.writer()));
 }
 
 inline bool
-ClusterHandler::vc_ok_read(ClusterVConnection * vc)
+ClusterHandler::vc_ok_read(ClusterVConnection *vc)
 {
   return (!vc->closed && vc->read.vio.op == VIO::READ && vc->read.vio.buffer.writer());
 }
 
 void
-ClusterHandler::close_free_lock(ClusterVConnection * vc, ClusterVConnState * s)
+ClusterHandler::close_free_lock(ClusterVConnection *vc, ClusterVConnState *s)
 {
   Ptr<ProxyMutex> m(s->vio.mutex);
   if (s == &vc->read) {
-    if ((ProxyMutex *) vc->read_locked)
+    if ((ProxyMutex *)vc->read_locked)
       MUTEX_UNTAKE_LOCK(vc->read_locked, thread);
     vc->read_locked = NULL;
   } else {
-    if ((ProxyMutex *) vc->write_locked)
+    if ((ProxyMutex *)vc->write_locked)
       MUTEX_UNTAKE_LOCK(vc->write_locked, thread);
     vc->write_locked = NULL;
   }
   close_ClusterVConnection(vc);
 }
 
-bool ClusterHandler::build_data_vector(char *d, int len, bool read_flag)
+bool
+ClusterHandler::build_data_vector(char *d, int len, bool read_flag)
 {
   // Internal interface to general network i/o facility allowing
   // single vector read/write to static data buffer.
 
-  ClusterState & s = (read_flag ? read : write);
+  ClusterState &s = (read_flag ? read : write);
   ink_assert(d);
   ink_assert(len);
   ink_assert(s.iov);
@@ -409,7 +357,8 @@ bool ClusterHandler::build_data_vector(char *d, int len, bool read_flag)
   return true;
 }
 
-bool ClusterHandler::build_initial_vector(bool read_flag)
+bool
+ClusterHandler::build_initial_vector(bool read_flag)
 {
   //
   // Build initial read/write struct iovec and corresponding IOBufferData
@@ -447,7 +396,7 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
   // MIOBuffer      *w;
 
   ink_hrtime now = ink_get_hrtime();
-  ClusterState & s = (read_flag ? read : write);
+  ClusterState &s = (read_flag ? read : write);
   OutgoingControl *oc = s.msg.outgoing_control.head;
   IncomingControl *ic = incoming_control.head;
   int new_n_iov = 0;
@@ -512,8 +461,7 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
   //  Note: We are assuming that free space descriptors follow
   //        the data descriptors.
   //////////////////////////////////////////////////////////////
-  for (i = 0; i<(read_flag ? ((s.msg.state>= 2) ? s.msg.count : 0)
-                   : s.msg.count); i++) {
+  for (i = 0; i < (read_flag ? ((s.msg.state >= 2) ? s.msg.count : 0) : s.msg.count); i++) {
     if (s.msg.descriptor[i].type == CLUSTER_SEND_DATA) {
       ///////////////////////////////////
       // Control channel data
@@ -533,7 +481,7 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
               CLUSTER_INCREMENT_DYN_STAT(CLUSTER_SLOW_CTRL_MSGS_RECVD_STAT);
             }
             // Mark message data as invalid
-            *((uint32_t *) ic->data) = UNDEFINED_CLUSTER_FUNCTION;
+            *((uint32_t *)ic->data) = UNDEFINED_CLUSTER_FUNCTION;
             incoming_control.enqueue(ic);
           }
           s.iov[new_n_iov].iov_base = 0;
@@ -541,7 +489,7 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
           s.block[new_n_iov] = ic->get_block();
           to_do += s.iov[new_n_iov].iov_len;
           ++new_n_iov;
-          ic = (IncomingControl *) ic->link.next;
+          ic = (IncomingControl *)ic->link.next;
         } else {
           ///////////////////////
           // Outgoing Control
@@ -552,23 +500,21 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
           s.block[new_n_iov] = oc->get_block();
           to_do += s.iov[new_n_iov].iov_len;
           ++new_n_iov;
-          oc = (OutgoingControl *) oc->link.next;
+          oc = (OutgoingControl *)oc->link.next;
         }
       } else {
         ///////////////////////////////
         // User channel data
         ///////////////////////////////
-        ClusterVConnection *
-          vc = channels[s.msg.descriptor[i].channel];
+        ClusterVConnection *vc = channels[s.msg.descriptor[i].channel];
 
-        if (VALID_CHANNEL(vc) &&
-            (s.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
+        if (VALID_CHANNEL(vc) && (s.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
           if (read_flag) {
             ink_release_assert(!vc->initial_data_bytes);
             /////////////////////////////////////
             // Try to get the read VIO mutex
             /////////////////////////////////////
-            ink_release_assert(!(ProxyMutex *) vc->read_locked);
+            ink_release_assert(!(ProxyMutex *)vc->read_locked);
 #ifdef CLUSTER_TOMCAT
             if (!vc->read.vio.mutex ||
                 !MUTEX_TAKE_TRY_LOCK_FOR_SPIN(vc->read.vio.mutex, thread, vc->read.vio._cont, READ_LOCK_SPIN_COUNT))
@@ -616,21 +562,21 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
             bool remote_write_fill = (vc->pending_remote_fill && vc->remote_write_block);
             // Sanity check, assert we have the lock
             if (!remote_write_fill) {
-              ink_assert((ProxyMutex *) vc->write_locked);
+              ink_assert((ProxyMutex *)vc->write_locked);
             }
             if (vc_ok_write(vc) || remote_write_fill) {
               if (remote_write_fill) {
                 s.iov[new_n_iov].iov_base = 0;
-                ink_release_assert((int) s.msg.descriptor[i].length == bytes_IOBufferBlockList(vc->remote_write_block, 1));
+                ink_release_assert((int)s.msg.descriptor[i].length == bytes_IOBufferBlockList(vc->remote_write_block, 1));
                 s.block[new_n_iov] = vc->remote_write_block;
 
               } else {
                 s.iov[new_n_iov].iov_base = 0;
-                ink_release_assert((int) s.msg.descriptor[i].length <= vc->write_list_bytes);
+                ink_release_assert((int)s.msg.descriptor[i].length <= vc->write_list_bytes);
                 s.block[new_n_iov] = vc->write_list;
-                vc->write_list = consume_IOBufferBlockList(vc->write_list, (int) s.msg.descriptor[i].length);
-                vc->write_list_bytes -= (int) s.msg.descriptor[i].length;
-                vc->write_bytes_in_transit += (int) s.msg.descriptor[i].length;
+                vc->write_list = consume_IOBufferBlockList(vc->write_list, (int)s.msg.descriptor[i].length);
+                vc->write_list_bytes -= (int)s.msg.descriptor[i].length;
+                vc->write_bytes_in_transit += (int)s.msg.descriptor[i].length;
 
                 vc->write_list_tail = vc->write_list;
                 while (vc->write_list_tail && vc->write_list_tail->next)
@@ -680,8 +626,8 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
   s.n_iov = new_n_iov;
   return true;
 
-  // TODO: This is apparently dead code, I added the #if 0 to avoid compiler
-  // warnings, but is this really intentional??
+// TODO: This is apparently dead code, I added the #if 0 to avoid compiler
+// warnings, but is this really intentional??
 #if 0
   // Release all IOBufferBlock references.
   for (n = 0; n < MAX_TCOUNT; ++n) {
@@ -694,22 +640,23 @@ bool ClusterHandler::build_initial_vector(bool read_flag)
 #endif
 }
 
-bool ClusterHandler::get_read_locks()
+bool
+ClusterHandler::get_read_locks()
 {
   ///////////////////////////////////////////////////////////////////////
   // Reacquire locks for the request setup by build_initial_vector().
   // We are called after each read completion prior to posting completion
   ///////////////////////////////////////////////////////////////////////
-  ClusterState & s = read;
+  ClusterState &s = read;
   int i, n;
   int bytes_processed;
   int vec_bytes_remainder;
   int iov_done[MAX_TCOUNT];
 
-  memset((char *) iov_done, 0, sizeof(int) * MAX_TCOUNT);
+  memset((char *)iov_done, 0, sizeof(int) * MAX_TCOUNT);
 
   // Compute bytes transferred on a per vector basis
-  bytes_processed = s.did - s.bytes_xfered;     // not including bytes in this xfer
+  bytes_processed = s.did - s.bytes_xfered; // not including bytes in this xfer
 
   i = -1;
   for (n = 0; n < s.n_iov; ++n) {
@@ -719,7 +666,7 @@ bool ClusterHandler::get_read_locks()
     } else {
       iov_done[n] = s.iov[n].iov_len + bytes_processed;
       if (i < 0) {
-        i = n;                  // note i/o start vector
+        i = n; // note i/o start vector
 
         // Now at vector where last transfer started,
         // make considerations for the last transfer on this vector.
@@ -748,25 +695,21 @@ bool ClusterHandler::get_read_locks()
   //        the data descriptors.
 
   for (; i < s.n_iov; ++i) {
-    if ((s.msg.descriptor[i].type == CLUSTER_SEND_DATA)
-        && (s.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL)) {
-
+    if ((s.msg.descriptor[i].type == CLUSTER_SEND_DATA) && (s.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL)) {
       // Only user channels require locks
 
-      ClusterVConnection *
-        vc = channels[s.msg.descriptor[i].channel];
-      if (!VALID_CHANNEL(vc) ||
-          ((s.msg.descriptor[i].sequence_number) !=
-           CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) || !vc_ok_read(vc)) {
+      ClusterVConnection *vc = channels[s.msg.descriptor[i].channel];
+      if (!VALID_CHANNEL(vc) || ((s.msg.descriptor[i].sequence_number) != CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) ||
+          !vc_ok_read(vc)) {
         // Channel no longer valid, lock not needed since we
         //  already have a reference to the buffer
         continue;
       }
 
-      ink_assert(!(ProxyMutex *) vc->read_locked);
+      ink_assert(!(ProxyMutex *)vc->read_locked);
       vc->read_locked = vc->read.vio.mutex;
-      if (vc->byte_bank_q.head
-          || !MUTEX_TAKE_TRY_LOCK_FOR_SPIN(vc->read.vio.mutex, thread, vc->read.vio._cont, READ_LOCK_SPIN_COUNT)) {
+      if (vc->byte_bank_q.head ||
+          !MUTEX_TAKE_TRY_LOCK_FOR_SPIN(vc->read.vio.mutex, thread, vc->read.vio._cont, READ_LOCK_SPIN_COUNT)) {
         // Pending byte bank completions or lock acquire failure.
 
         vc->read_locked = NULL;
@@ -784,7 +727,7 @@ bool ClusterHandler::get_read_locks()
       int64_t read_avail = vc->read_block->read_avail();
 
       if (!vc->pending_remote_fill && read_avail) {
-        Debug("cluster_vc_xfer", "Deferred fill ch %d %p %" PRId64" bytes", vc->channel, vc, read_avail);
+        Debug("cluster_vc_xfer", "Deferred fill ch %d %p %" PRId64 " bytes", vc->channel, vc, read_avail);
 
         vc->read.vio.buffer.writer()->append_block(vc->read_block->clone());
         if (complete_channel_read(read_avail, vc)) {
@@ -793,34 +736,31 @@ bool ClusterHandler::get_read_locks()
       }
     }
   }
-  return true;                  // success
+  return true; // success
 }
 
-bool ClusterHandler::get_write_locks()
+bool
+ClusterHandler::get_write_locks()
 {
   ///////////////////////////////////////////////////////////////////////
   // Reacquire locks for the request setup by build_initial_vector().
   // We are called after the entire write completes prior to
   // posting completion.
   ///////////////////////////////////////////////////////////////////////
-  ClusterState & s = write;
+  ClusterState &s = write;
   int i;
 
   for (i = 0; i < s.msg.count; ++i) {
-    if ((s.msg.descriptor[i].type == CLUSTER_SEND_DATA)
-        && (s.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL)) {
-
+    if ((s.msg.descriptor[i].type == CLUSTER_SEND_DATA) && (s.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL)) {
       // Only user channels require locks
 
-      ClusterVConnection *
-        vc = channels[s.msg.descriptor[i].channel];
-      if (!VALID_CHANNEL(vc) ||
-          (s.msg.descriptor[i].sequence_number) != CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
+      ClusterVConnection *vc = channels[s.msg.descriptor[i].channel];
+      if (!VALID_CHANNEL(vc) || (s.msg.descriptor[i].sequence_number) != CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
         // Channel no longer valid, lock not needed since we
         //  already have a reference to the buffer
         continue;
       }
-      ink_assert(!(ProxyMutex *) vc->write_locked);
+      ink_assert(!(ProxyMutex *)vc->write_locked);
       vc->write_locked = vc->write.vio.mutex;
 #ifdef CLUSTER_TOMCAT
       if (vc->write_locked &&
@@ -861,34 +801,34 @@ ClusterHandler::process_set_data_msgs()
   // Process small control set_data messages.
   /////////////////////////////////////////////
   if (!read.msg.did_small_control_set_data) {
-    char *p = (char *) &read.msg.descriptor[read.msg.count];
+    char *p = (char *)&read.msg.descriptor[read.msg.count];
     char *endp = p + read.msg.control_bytes;
     while (p < endp) {
       if (needByteSwap) {
-        ats_swap32((uint32_t *) p);   // length
-        ats_swap32((uint32_t *) (p + sizeof(int32_t))); // function code
+        ats_swap32((uint32_t *)p);                     // length
+        ats_swap32((uint32_t *)(p + sizeof(int32_t))); // function code
       }
-      int len = *(int32_t *) p;
-      cluster_function_index = *(uint32_t *) (p + sizeof(int32_t));
+      int len = *(int32_t *)p;
+      cluster_function_index = *(uint32_t *)(p + sizeof(int32_t));
 
-      if ((cluster_function_index < (uint32_t) SIZE_clusterFunction)
-          && (cluster_function_index == SET_CHANNEL_DATA_CLUSTER_FUNCTION)) {
+      if ((cluster_function_index < (uint32_t)SIZE_clusterFunction) &&
+          (cluster_function_index == SET_CHANNEL_DATA_CLUSTER_FUNCTION)) {
         clusterFunction[SET_CHANNEL_DATA_CLUSTER_FUNCTION].pfn(this, p + (2 * sizeof(uint32_t)), len - sizeof(uint32_t));
         // Mark message as processed.
-        *((uint32_t *) (p + sizeof(uint32_t))) = ~*((uint32_t *) (p + sizeof(uint32_t)));
+        *((uint32_t *)(p + sizeof(uint32_t))) = ~*((uint32_t *)(p + sizeof(uint32_t)));
         p += (2 * sizeof(uint32_t)) + (len - sizeof(uint32_t));
-        p = (char *) DOUBLE_ALIGN(p);
+        p = (char *)DOUBLE_ALIGN(p);
       } else {
         // Reverse swap since this message will be reprocessed.
 
         if (needByteSwap) {
-          ats_swap32((uint32_t *) p); // length
-          ats_swap32((uint32_t *) (p + sizeof(int32_t)));       // function code
+          ats_swap32((uint32_t *)p);                     // length
+          ats_swap32((uint32_t *)(p + sizeof(int32_t))); // function code
         }
-        break;                  // End of set_data messages
+        break; // End of set_data messages
       }
     }
-    read.msg.control_data_offset = p - (char *) &read.msg.descriptor[read.msg.count];
+    read.msg.control_data_offset = p - (char *)&read.msg.descriptor[read.msg.count];
     read.msg.did_small_control_set_data = 1;
   }
   /////////////////////////////////////////////
@@ -899,31 +839,29 @@ ClusterHandler::process_set_data_msgs()
 
     while (ic) {
       if (needByteSwap) {
-        ats_swap32((uint32_t *) ic->data);    // function code
+        ats_swap32((uint32_t *)ic->data); // function code
       }
-      cluster_function_index = *((uint32_t *) ic->data);
-
-      if ((cluster_function_index < (uint32_t) SIZE_clusterFunction)
-          && (cluster_function_index == SET_CHANNEL_DATA_CLUSTER_FUNCTION)) {
+      cluster_function_index = *((uint32_t *)ic->data);
 
+      if ((cluster_function_index < (uint32_t)SIZE_clusterFunction) &&
+          (cluster_function_index == SET_CHANNEL_DATA_CLUSTER_FUNCTION)) {
         char *p = ic->data;
-        clusterFunction[SET_CHANNEL_DATA_CLUSTER_FUNCTION].pfn(this,
-                                                               (void *) (p + sizeof(int32_t)), ic->len - sizeof(int32_t));
+        clusterFunction[SET_CHANNEL_DATA_CLUSTER_FUNCTION].pfn(this, (void *)(p + sizeof(int32_t)), ic->len - sizeof(int32_t));
 
         // Reverse swap since this will be processed again for deallocation.
         if (needByteSwap) {
-          ats_swap32((uint32_t *) p); // length
-          ats_swap32((uint32_t *) (p + sizeof(int32_t)));       // function code
+          ats_swap32((uint32_t *)p);                     // length
+          ats_swap32((uint32_t *)(p + sizeof(int32_t))); // function code
         }
         // Mark message as processed.
         // Defer dellocation until entire read is complete.
-        *((uint32_t *) p) = ~*((uint32_t *) p);
+        *((uint32_t *)p) = ~*((uint32_t *)p);
 
-        ic = (IncomingControl *) ic->link.next;
+        ic = (IncomingControl *)ic->link.next;
       } else {
         // Reverse swap action this message will be reprocessed.
         if (needByteSwap) {
-          ats_swap32((uint32_t *) ic->data);  // function code
+          ats_swap32((uint32_t *)ic->data); // function code
         }
         break;
       }
@@ -942,8 +880,8 @@ ClusterHandler::process_small_control_msgs()
   }
 
   ink_hrtime now = ink_get_hrtime();
-  char *p = (char *) &read.msg.descriptor[read.msg.count] + read.msg.control_data_offset;
-  char *endp = (char *) &read.msg.descriptor[read.msg.count] + read.msg.control_bytes;
+  char *p = (char *)&read.msg.descriptor[read.msg.count] + read.msg.control_data_offset;
+  char *endp = (char *)&read.msg.descriptor[read.msg.count] + read.msg.control_bytes;
 
   while (p < endp) {
     /////////////////////////////////////////////////////////////////
@@ -951,15 +889,15 @@ ClusterHandler::process_small_control_msgs()
     // incoming queue for processing by callout threads.
     /////////////////////////////////////////////////////////////////
     if (needByteSwap) {
-      ats_swap32((uint32_t *) p);     // length
-      ats_swap32((uint32_t *) (p + sizeof(int32_t)));   // function code
+      ats_swap32((uint32_t *)p);                     // length
+      ats_swap32((uint32_t *)(p + sizeof(int32_t))); // function code
     }
-    int len = *(int32_t *) p;
+    int len = *(int32_t *)p;
     p += sizeof(int32_t);
-    uint32_t cluster_function_index = *(uint32_t *) p;
+    uint32_t cluster_function_index = *(uint32_t *)p;
     ink_release_assert(cluster_function_index != SET_CHANNEL_DATA_CLUSTER_FUNCTION);
 
-    if (cluster_function_index >= (uint32_t) SIZE_clusterFunction) {
+    if (cluster_function_index >= (uint32_t)SIZE_clusterFunction) {
       Warning("1Bad cluster function index (small control)");
       p += len;
 
@@ -980,11 +918,11 @@ ClusterHandler::process_small_control_msgs()
       ic->len = len;
       ic->alloc_data();
       memcpy(ic->data, p, ic->len);
-      SetHighBit(&ic->len);     // mark as small cntl
-      ink_atomiclist_push(&external_incoming_control, (void *) ic);
+      SetHighBit(&ic->len); // mark as small cntl
+      ink_atomiclist_push(&external_incoming_control, (void *)ic);
       p += len;
     }
-    p = (char *) DOUBLE_ALIGN(p);
+    p = (char *)DOUBLE_ALIGN(p);
   }
 }
 
@@ -1006,12 +944,12 @@ ClusterHandler::process_large_control_msgs()
 
   while ((ic = incoming_control.dequeue())) {
     if (needByteSwap) {
-      ats_swap32((uint32_t *) ic->data);      // function code
+      ats_swap32((uint32_t *)ic->data); // function code
     }
-    cluster_function_index = *((uint32_t *) ic->data);
+    cluster_function_index = *((uint32_t *)ic->data);
     ink_release_assert(cluster_function_index != SET_CHANNEL_DATA_CLUSTER_FUNCTION);
 
-    if (cluster_function_index == (uint32_t) ~ SET_CHANNEL_DATA_CLUSTER_FUNCTION) {
+    if (cluster_function_index == (uint32_t)~SET_CHANNEL_DATA_CLUSTER_FUNCTION) {
       // SET_CHANNEL_DATA_CLUSTER_FUNCTION already processed.
       // Just do memory deallocation.
 
@@ -1020,14 +958,13 @@ ClusterHandler::process_large_control_msgs()
       continue;
     }
 
-    if (cluster_function_index >= (uint32_t) SIZE_clusterFunction) {
+    if (cluster_function_index >= (uint32_t)SIZE_clusterFunction) {
       Warning("Bad cluster function index (large control)");
       ic->freeall();
 
     } else if (clusterFunction[cluster_function_index].ClusterFunc) {
       // Cluster message, process in ET_CLUSTER thread
-      clusterFunction[cluster_function_index].pfn(this, (void *) (ic->data + sizeof(int32_t)),
-                                                  ic->len - sizeof(int32_t));
+      clusterFunction[cluster_function_index].pfn(this, (void *)(ic->data + sizeof(int32_t)), ic->len - sizeof(int32_t));
 
       // Deallocate memory
       if (!clusterFunction[cluster_function_index].fMalloced)
@@ -1035,7 +972,7 @@ ClusterHandler::process_large_control_msgs()
 
     } else {
       // Non Cluster message, process in non ET_CLUSTER thread
-      ink_atomiclist_push(&external_incoming_control, (void *) ic);
+      ink_atomiclist_push(&external_incoming_control, (void *)ic);
     }
   }
 }
@@ -1072,7 +1009,7 @@ ClusterHandler::process_freespace_msgs()
 }
 
 void
-ClusterHandler::add_to_byte_bank(ClusterVConnection * vc)
+ClusterHandler::add_to_byte_bank(ClusterVConnection *vc)
 {
   ByteBankDescriptor *bb_desc = ByteBankDescriptor::ByteBankDescriptor_alloc(vc->read_block);
   bool pending_byte_bank_completion = vc->byte_bank_q.head ? true : false;
@@ -1110,31 +1047,29 @@ ClusterHandler::update_channels_read()
   for (i = 0; i < read.msg.count; i++) {
     if (read.msg.descriptor[i].type == CLUSTER_SEND_DATA && read.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL) {
       ClusterVConnection *vc = channels[read.msg.descriptor[i].channel];
-      if (VALID_CHANNEL(vc) &&
-          (read.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
-        vc->last_activity_time = current_time;  // note activity time
+      if (VALID_CHANNEL(vc) && (read.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
+        vc->last_activity_time = current_time; // note activity time
 
         len = read.msg.descriptor[i].length;
         if (!len) {
           continue;
         }
 
-        if (!vc->pending_remote_fill && vc_ok_read(vc)
-            && (!((ProxyMutex *) vc->read_locked) || vc->byte_bank_q.head)) {
+        if (!vc->pending_remote_fill && vc_ok_read(vc) && (!((ProxyMutex *)vc->read_locked) || vc->byte_bank_q.head)) {
           //
           // Byte bank active or unable to acquire lock on VC.
           // Move data into the byte bank and attempt delivery
           // at the next periodic event.
           //
-          vc->read_block->fill(len);    // note bytes received
+          vc->read_block->fill(len); // note bytes received
           add_to_byte_bank(vc);
 
         } else {
-          if (vc->pending_remote_fill || ((ProxyMutex *) vc->read_locked && vc_ok_read(vc))) {
-            vc->read_block->fill(len);  // note bytes received
+          if (vc->pending_remote_fill || ((ProxyMutex *)vc->read_locked && vc_ok_read(vc))) {
+            vc->read_block->fill(len); // note bytes received
             if (!vc->pending_remote_fill) {
               vc->read.vio.buffer.writer()->append_block(vc->read_block->clone());
-              vc->read_block->consume(len);     // note bytes moved to user
+              vc->read_block->consume(len); // note bytes moved to user
             }
             complete_channel_read(len, vc);
           }
@@ -1156,7 +1091,7 @@ ClusterHandler::update_channels_read()
 // for message processing which cannot be done with a ET_CLUSTER thread.
 //
 int
-ClusterHandler::process_incoming_callouts(ProxyMutex * m)
+ClusterHandler::process_incoming_callouts(ProxyMutex *m)
 {
   ProxyMutex *mutex = m;
   ink_hrtime now;
@@ -1170,13 +1105,12 @@ ClusterHandler::process_incoming_callouts(ProxyMutex * m)
   IncomingControl *ic_ext;
 
   while (true) {
-    ic_ext = (IncomingControl *)
-      ink_atomiclist_popall(&external_incoming_control);
+    ic_ext = (IncomingControl *)ink_atomiclist_popall(&external_incoming_control);
     if (!ic_ext)
       break;
 
     while (ic_ext) {
-      ic_ext_next = (IncomingControl *) ic_ext->link.next;
+      ic_ext_next = (IncomingControl *)ic_ext->link.next;
       ic_ext->link.next = NULL;
       local_incoming_control.push(ic_ext);
       ic_ext = ic_ext_next;
@@ -1191,15 +1125,15 @@ ClusterHandler::process_incoming_callouts(ProxyMutex * m)
 
       // Determine if this a small control message
       small_control_msg = IsHighBitSet(&ic->len);
-      ClearHighBit(&ic->len);   // Clear small msg flag bit
+      ClearHighBit(&ic->len); // Clear small msg flag bit
 
       if (small_control_msg) {
         int len = ic->len;
         char *p = ic->data;
-        uint32_t cluster_function_index = *(uint32_t *) p;
+        uint32_t cluster_function_index = *(uint32_t *)p;
         p += sizeof(uint32_t);
 
-        if (cluster_function_index < (uint32_t) SIZE_clusterFunction) {
+        if (cluster_function_index < (uint32_t)SIZE_clusterFunction) {
           ////////////////////////////////
           // Invoke processing function
           ////////////////////////////////
@@ -1216,17 +1150,16 @@ ClusterHandler::process_incoming_callouts(ProxyMutex * m)
 
       } else {
         ink_assert(ic->len > 4);
-        uint32_t cluster_function_index = *(uint32_t *) ic->data;
+        uint32_t cluster_function_index = *(uint32_t *)ic->data;
         bool valid_index;
 
-        if (cluster_function_index < (uint32_t) SIZE_clusterFunction) {
+        if (cluster_function_index < (uint32_t)SIZE_clusterFunction) {
           valid_index = true;
           ////////////////////////////////
           // Invoke processing function
           ////////////////////////////////
           ink_assert(!clusterFunction[cluster_function_index].ClusterFunc);
-          clusterFunction[cluster_function_index].pfn(this, (void *) (ic->data + sizeof(int32_t)),
-                                                      ic->len - sizeof(int32_t));
+          clusterFunction[cluster_function_index].pfn(this, (void *)(ic->data + sizeof(int32_t)), ic->len - sizeof(int32_t));
           now = ink_get_hrtime();
           CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_RECV_TIME_STAT, now - ic->recognized_time);
         } else {
@@ -1270,7 +1203,7 @@ ClusterHandler::update_channels_partial_read()
     if (already_read) {
       already_read -= iov_done[i];
       if (already_read < 0) {
-        iov_done[i] = -already_read;    // bytes remaining
+        iov_done[i] = -already_read; // bytes remaining
         already_read = 0;
       } else {
         iov_done[i] = 0;
@@ -1295,10 +1228,9 @@ ClusterHandler::update_channels_partial_read()
   for (i = 0; i < read.msg.count; i++) {
     if (read.msg.descriptor[i].type == CLUSTER_SEND_DATA && read.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL) {
       ClusterVConnection *vc = channels[read.msg.descriptor[i].channel];
-      if (VALID_CHANNEL(vc) &&
-          (read.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
+      if (VALID_CHANNEL(vc) && (read.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
         if (vc->pending_remote_fill || (vc_ok_read(vc) && (vc->iov_map != CLUSTER_IOV_NONE))) {
-          vc->last_activity_time = current_time;        // note activity time
+          vc->last_activity_time = current_time; // note activity time
           ClusterVConnState *s = &vc->read;
           ink_assert(vc->iov_map < read.n_iov);
           int len = iov_done[vc->iov_map];
@@ -1318,10 +1250,10 @@ ClusterHandler::update_channels_partial_read()
               read_all_large_control_msgs = 1;
             }
             iov_done[vc->iov_map] = 0;
-            vc->read_block->fill(len);  // note bytes received
+            vc->read_block->fill(len); // note bytes received
 
             if (!vc->pending_remote_fill) {
-              if ((ProxyMutex *) vc->read_locked) {
+              if ((ProxyMutex *)vc->read_locked) {
                 Debug("cluster_vc_xfer", "Partial read, credit ch %d %p %d bytes", vc->channel, vc, len);
                 s->vio.buffer.writer()->append_block(vc->read_block->clone());
                 if (complete_channel_read(len, vc)) {
@@ -1333,7 +1265,7 @@ ClusterHandler::update_channels_partial_read()
                 // into the byte bank.  Otherwise, do nothing since
                 // we will resume the read at this VC.
 
-                if (len == (int) read.msg.descriptor[i].length) {
+                if (len == (int)read.msg.descriptor[i].length) {
                   Debug("cluster_vc_xfer", "Partial read, byte bank move ch %d %p %d bytes", vc->channel, vc, len);
                   add_to_byte_bank(vc);
                 }
@@ -1343,7 +1275,7 @@ ClusterHandler::update_channels_partial_read()
               complete_channel_read(len, vc);
             }
             read.msg.descriptor[i].length -= len;
-            ink_assert(((int) read.msg.descriptor[i].length) >= 0);
+            ink_assert(((int)read.msg.descriptor[i].length) >= 0);
           }
           Debug(CL_TRACE, "partial_channel_read chan=%d len=%d", vc->channel, len);
         }
@@ -1352,7 +1284,8 @@ ClusterHandler::update_channels_partial_read()
   }
 }
 
-bool ClusterHandler::complete_channel_read(int len, ClusterVConnection * vc)
+bool
+ClusterHandler::complete_channel_read(int len, ClusterVConnection *vc)
 {
   //
   // We have processed a complete VC read request message for a channel,
@@ -1363,22 +1296,21 @@ bool ClusterHandler::complete_channel_read(int len, ClusterVConnection * vc)
   if (vc->pending_remote_fill) {
     Debug(CL_TRACE, "complete_channel_read chan=%d len=%d", vc->channel, len);
     vc->initial_data_bytes += len;
-    ++vc->pending_remote_fill;  // Note completion
+    ++vc->pending_remote_fill; // Note completion
     return (vc->closed ? false : true);
   }
 
   if (vc->closed)
-    return false;               // No action if already closed
+    return false; // No action if already closed
 
-  ink_assert((ProxyMutex *) s->vio.mutex == (ProxyMutex *) s->vio._cont->mutex);
+  ink_assert((ProxyMutex *)s->vio.mutex == (ProxyMutex *)s->vio._cont->mutex);
 
   Debug("cluster_vc_xfer", "Complete read, credit ch %d %p %d bytes", vc->channel, vc, len);
   s->vio.ndone += len;
 
   if (s->vio.ntodo() <= 0) {
     s->enabled = 0;
-    if (cluster_signal_and_update_locked(VC_EVENT_READ_COMPLETE, vc, s)
-        == EVENT_DONE)
+    if (cluster_signal_and_update_locked(VC_EVENT_READ_COMPLETE, vc, s) == EVENT_DONE)
       return false;
   } else {
     if (cluster_signal_and_update_locked(VC_EVENT_READ_READY, vc, s) == EVENT_DONE)
@@ -1401,7 +1333,7 @@ ClusterHandler::finish_delayed_reads()
   //
   ClusterVConnection *vc = NULL;
   DLL<ClusterVConnectionBase> l;
-  while ((vc = (ClusterVConnection *) delayed_reads.pop())) {
+  while ((vc = (ClusterVConnection *)delayed_reads.pop())) {
     MUTEX_TRY_LOCK_SPIN(lock, vc->read.vio.mutex, thread, READ_LOCK_SPIN_COUNT);
     if (lock.is_locked()) {
       if (vc_ok_read(vc)) {
@@ -1414,8 +1346,8 @@ ClusterHandler::finish_delayed_reads()
             //  remove our self to process another byte bank completion
             ClusterVC_remove_read(vc);
           }
-          Debug("cluster_vc_xfer",
-                "Delayed read, credit ch %d %p %" PRId64" bytes", vc->channel, vc, d->get_block()->read_avail());
+          Debug("cluster_vc_xfer", "Delayed read, credit ch %d %p %" PRId64 " bytes", vc->channel, vc,
+                d->get_block()->read_avail());
           vc->read.vio.buffer.writer()->append_block(d->get_block());
 
           if (complete_channel_read(d->get_block()->read_avail(), vc)) {
@@ -1447,17 +1379,13 @@ ClusterHandler::update_channels_written()
     if (write.msg.descriptor[i].type == CLUSTER_SEND_DATA) {
       if (write.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL) {
         ClusterVConnection *vc = channels[write.msg.descriptor[i].channel];
-        if (VALID_CHANNEL(vc) &&
-            (write.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
-
+        if (VALID_CHANNEL(vc) && (write.msg.descriptor[i].sequence_number) == CLUSTER_SEQUENCE_NUMBER(vc->token.sequence_number)) {
           if (vc->pending_remote_fill) {
-            Debug(CL_TRACE,
-                  "update_channels_written chan=%d seqno=%d len=%d",
-                  write.msg.descriptor[i].channel,
+            Debug(CL_TRACE, "update_channels_written chan=%d seqno=%d len=%d", write.msg.descriptor[i].channel,
                   write.msg.descriptor[i].sequence_number, write.msg.descriptor[i].length);
             vc->pending_remote_fill = 0;
             vc->remote_write_block = 0; // free data block
-            continue;           // ignore remote write fill VC(s)
+            continue;                   // ignore remote write fill VC(s)
           }
 
           ClusterVConnState *s = &vc->write;
@@ -1467,8 +1395,8 @@ ClusterHandler::update_channels_written()
           Debug(CL_PROTO, "(%d) data sent %d %" PRId64, write.msg.descriptor[i].channel, len, s->vio.ndone);
 
           if (vc_ok_write(vc)) {
-            vc->last_activity_time = current_time;      // note activity time
-            int64_t ndone = vc->was_closed()? 0 : s->vio.ndone;
+            vc->last_activity_time = current_time; // note activity time
+            int64_t ndone = vc->was_closed() ? 0 : s->vio.ndone;
 
             if (ndone < vc->remote_free) {
               vcs_push(vc, VC_CLUSTER_WRITE);
@@ -1497,7 +1425,7 @@ ClusterHandler::update_channels_written()
   invoke_remote_data_args *args;
   OutgoingControl *hdr_oc;
   while ((hdr_oc = write.msg.outgoing_callout.dequeue())) {
-    args = (invoke_remote_data_args *) (hdr_oc->data + sizeof(int32_t));
+    args = (invoke_remote_data_args *)(hdr_oc->data + sizeof(int32_t));
     ink_assert(args->magicno == invoke_remote_data_args::MagicNo);
 
     // Free data descriptor
@@ -1524,7 +1452,7 @@ ClusterHandler::build_write_descriptors()
   // write (struct iovec system maximum).
   //
   int count_bucket = cur_vcs;
-  int tcount = write.msg.count + 2;     // count + descriptor
+  int tcount = write.msg.count + 2; // count + descriptor
   int write_descriptors_built = 0;
   int valid;
   int list_len = 0;
@@ -1536,7 +1464,7 @@ ClusterHandler::build_write_descriptors()
   vc = (ClusterVConnection *)ink_atomiclist_popall(&write_vcs_ready);
   while (vc) {
     enter_exit(&cls_build_writes_entered, &cls_writes_exited);
-    vc_next = (ClusterVConnection *) vc->ready_alink.next;
+    vc_next = (ClusterVConnection *)vc->ready_alink.next;
     vc->ready_alink.next = NULL;
     list_len++;
     if (VC_CLUSTER_CLOSED == vc->type) {
@@ -1561,10 +1489,10 @@ ClusterHandler::build_write_descriptors()
   }
 
   tcount = write.msg.count + 2;
-  vc_next = (ClusterVConnection *) write_vcs[count_bucket].head;
+  vc_next = (ClusterVConnection *)write_vcs[count_bucket].head;
   while (vc_next) {
     vc = vc_next;
-    vc_next = (ClusterVConnection *) vc->write.link.next;
+    vc_next = (ClusterVConnection *)vc->write.link.next;
 
     if (VC_CLUSTER_CLOSED == vc->type) {
       vc->type = VC_NULL;
@@ -1579,10 +1507,8 @@ ClusterHandler::build_write_descriptors()
     if (-1 == valid) {
       vcs_push(vc, VC_CLUSTER_WRITE);
     } else if (valid) {
-      ink_assert(vc->write_locked);     // Acquired in valid_for_data_write()
-      if ((vc->remote_free > (vc->write.vio.ndone - vc->write_list_bytes))
-          && channels[vc->channel] == vc) {
-
+      ink_assert(vc->write_locked); // Acquired in valid_for_data_write()
+      if ((vc->remote_free > (vc->write.vio.ndone - vc->write_list_bytes)) && channels[vc->channel] == vc) {
         ink_assert(vc->write_list && vc->write_list_bytes);
 
         int d = write.msg.count;
@@ -1630,7 +1556,7 @@ ClusterHandler::build_freespace_descriptors()
   // in the list.
   //
   int count_bucket = cur_vcs;
-  int tcount = write.msg.count + 2;     // count + descriptor require 2 iovec(s)
+  int tcount = write.msg.count + 2; // count + descriptor require 2 iovec(s)
   int freespace_descriptors_built = 0;
   int s = 0;
   int list_len = 0;
@@ -1642,7 +1568,7 @@ ClusterHandler::build_freespace_descriptors()
   vc = (ClusterVConnection *)ink_atomiclist_popall(&read_vcs_ready);
   while (vc) {
     enter_exit(&cls_build_reads_entered, &cls_reads_exited);
-    vc_next = (ClusterVConnection *) vc->ready_alink.next;
+    vc_next = (ClusterVConnection *)vc->ready_alink.next;
     vc->ready_alink.next = NULL;
     list_len++;
     if (VC_CLUSTER_CLOSED == vc->type) {
@@ -1667,10 +1593,10 @@ ClusterHandler::build_freespace_descriptors()
   }
 
   tcount = write.msg.count + 2;
-  vc_next = (ClusterVConnection *) read_vcs[count_bucket].head;
+  vc_next = (ClusterVConnection *)read_vcs[count_bucket].head;
   while (vc_next) {
     vc = vc_next;
-    vc_next = (ClusterVConnection *) vc->read.link.next;
+    vc_next = (ClusterVConnection *)vc->read.link.next;
 
     if (VC_CLUSTER_CLOSED == vc->type) {
       vc->type = VC_NULL;
@@ -1714,9 +1640,9 @@ ClusterHandler::build_controlmsg_descriptors()
   // write (struct iovec system maximum) and for elements already
   // in the list.
   //
-  int tcount = write.msg.count + 2;     // count + descriptor require 2 iovec(s)
+  int tcount = write.msg.count + 2; // count + descriptor require 2 iovec(s)
   int control_msgs_built = 0;
-  bool compound_msg;            // msg + chan data
+  bool compound_msg; // msg + chan data
   //
   // Build descriptors for control messages
   //
@@ -1724,12 +1650,12 @@ ClusterHandler::build_controlmsg_descriptors()
   int control_bytes = 0;
   int q = 0;
 
-  while (tcount < (MAX_TCOUNT - 1)) {   // -1 to allow for compound messages
+  while (tcount < (MAX_TCOUNT - 1)) { // -1 to allow for compound messages
     c = outgoing_control[q].pop();
     if (!c) {
       // Move elements from global outgoing_control to local queue
       OutgoingControl *c_next;
-      c = (OutgoingControl *) ink_atomiclist_popall(&outgoing_control_al[q]);
+      c = (OutgoingControl *)ink_atomiclist_popall(&outgoing_control_al[q]);
       if (c == 0) {
         if (++q >= CLUSTER_CMSG_QUEUES) {
           break;
@@ -1738,7 +1664,7 @@ ClusterHandler::build_controlmsg_descriptors()
         }
       }
       while (c) {
-        c_next = (OutgoingControl *) c->link.next;
+        c_next = (OutgoingControl *)c->link.next;
         c->link.next = NULL;
         outgoing_control[q].push(c);
         c = c_next;
@@ -1746,17 +1672,17 @@ ClusterHandler::build_controlmsg_descriptors()
       continue;
 
     } else {
-      compound_msg = (*((int32_t *) c->data) == -1);      // (msg+chan data)?
+      compound_msg = (*((int32_t *)c->data) == -1); // (msg+chan data)?
     }
     if (!compound_msg && c->len <= SMALL_CONTROL_MESSAGE &&
         // check if the receiving cluster function will want to malloc'ed data
-        !clusterFunction[*(int32_t *) c->data].fMalloced && control_bytes + c->len + sizeof(int32_t) * 2 + 7 < CONTROL_DATA) {
+        !clusterFunction[*(int32_t *)c->data].fMalloced && control_bytes + c->len + sizeof(int32_t) * 2 + 7 < CONTROL_DATA) {
       write.msg.outgoing_small_control.enqueue(c);
-      control_bytes += c->len + sizeof(int32_t) * 2 + 7;  // safe approximation
+      control_bytes += c->len + sizeof(int32_t) * 2 + 7; // safe approximation
       control_msgs_built++;
 
-      if (clusterFunction[*(int32_t *) c->data].post_pfn) {
-        clusterFunction[*(int32_t *) c->data].post_pfn(this, c->data + sizeof(int32_t), c->len);
+      if (clusterFunction[*(int32_t *)c->data].post_pfn) {
+        clusterFunction[*(int32_t *)c->data].post_pfn(this, c->data + sizeof(int32_t), c->len);
       }
       continue;
     }
@@ -1765,7 +1691,7 @@ ClusterHandler::build_controlmsg_descriptors()
     //
     if (compound_msg) {
       // Extract out components of compound message.
-      invoke_remote_data_args *cmhdr = (invoke_remote_data_args *) (c->data + sizeof(int32_t));
+      invoke_remote_data_args *cmhdr = (invoke_remote_data_args *)(c->data + sizeof(int32_t));
       OutgoingControl *oc_header = c;
       OutgoingControl *oc_msg = cmhdr->msg_oc;
       OutgoingControl *oc_data = cmhdr->data_oc;
@@ -1831,7 +1757,7 @@ ClusterHandler::build_controlmsg_descriptors()
         oc_msg->freeall();
 
         // Free data descriptor
-        oc_data->free_data();   // invoke memory free callback
+        oc_data->free_data(); // invoke memory free callback
         oc_data->mutex = 0;
         oc_data->freeall();
       }
@@ -1852,8 +1778,8 @@ ClusterHandler::build_controlmsg_descriptors()
       tcount++;
       control_msgs_built++;
 
-      if (clusterFunction[*(int32_t *) c->data].post_pfn) {
-        clusterFunction[*(int32_t *) c->data].post_pfn(this, c->data + sizeof(int32_t), c->len);
+      if (clusterFunction[*(int32_t *)c->data].post_pfn) {
+        clusterFunction[*(int32_t *)c->data].post_pfn(this, c->data + sizeof(int32_t), c->len);
       }
     }
   }
@@ -1866,11 +1792,11 @@ ClusterHandler::add_small_controlmsg_descriptors()
   //
   // Move small control message data to free space after descriptors
   //
-  char *p = (char *) &write.msg.descriptor[write.msg.count];
+  char *p = (char *)&write.msg.descriptor[write.msg.count];
   OutgoingControl *c = NULL;
 
   while ((c = write.msg.outgoing_small_control.dequeue())) {
-    *(int32_t *) p = c->len;
+    *(int32_t *)p = c->len;
     p += sizeof(int32_t);
     memcpy(p, c->data, c->len);
     c->free_data();
@@ -1880,9 +1806,9 @@ ClusterHandler::add_small_controlmsg_descriptors()
     CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_SEND_TIME_STAT, now - c->submit_time);
     LOG_EVENT_TIME(c->submit_time, cluster_send_time_dist, cluster_send_events);
     c->freeall();
-    p = (char *) DOUBLE_ALIGN(p);
+    p = (char *)DOUBLE_ALIGN(p);
   }
-  write.msg.control_bytes = p - (char *) &write.msg.descriptor[write.msg.count];
+  write.msg.control_bytes = p - (char *)&write.msg.descriptor[write.msg.count];
 
 #ifdef CLUSTER_STATS
   _control_write_bytes += write.msg.control_bytes;
@@ -1891,14 +1817,13 @@ ClusterHandler::add_small_controlmsg_descriptors()
   return 1;
 }
 
-struct DestructorLock
-{
-  DestructorLock(EThread * thread)
+struct DestructorLock {
+  DestructorLock(EThread *thread)
   {
     have_lock = false;
     t = thread;
   }
-   ~DestructorLock()
+  ~DestructorLock()
   {
     if (have_lock && m) {
       Mutex_unlock(m, t);
@@ -1911,7 +1836,7 @@ struct DestructorLock
 };
 
 int
-ClusterHandler::valid_for_data_write(ClusterVConnection * vc)
+ClusterHandler::valid_for_data_write(ClusterVConnection *vc)
 {
   //
   // Determine if writes are allowed on this VC
@@ -1919,7 +1844,7 @@ ClusterHandler::valid_for_data_write(ClusterVConnection * vc)
   ClusterVConnState *s = &vc->write;
 
   ink_assert(!on_stolen_thread);
-  ink_assert((ProxyMutex *) ! vc->write_locked);
+  ink_assert((ProxyMutex *)!vc->write_locked);
 
   //
   // Attempt to get the lock, if we miss, push vc into the future
@@ -1977,7 +1902,7 @@ retry:
     if (!lock.have_lock && s->vio.mutex && s->vio._cont) {
       goto retry;
     } else {
-      // No active VIO
+// No active VIO
 #ifdef CLUSTER_STATS
       _dw_no_active_vio++;
 #endif
@@ -2025,7 +1950,7 @@ retry:
   //
   // Calculate amount writable
   //
-  MIOBufferAccessor & buf = s->vio.buffer;
+  MIOBufferAccessor &buf = s->vio.buffer;
 
   int64_t towrite = buf.reader()->read_avail();
   int64_t ntodo = s->vio.ntodo();
@@ -2061,8 +1986,7 @@ retry:
 
   if (towrite && bytes_to_fill) {
     consume_bytes = (towrite > bytes_to_fill) ? bytes_to_fill : towrite;
-    b_list = clone_IOBufferBlockList(s->vio.buffer.reader()->block,
-                                     s->vio.buffer.reader()->start_offset, consume_bytes, &b_tail);
+    b_list = clone_IOBufferBlockList(s->vio.buffer.reader()->block, s->vio.buffer.reader()->start_offset, consume_bytes, &b_tail);
     ink_assert(b_tail);
 
     // Append cloned IOBufferBlock list to VC write_list.
@@ -2095,13 +2019,13 @@ retry:
     return 1;
   } else {
     if (!write_vc_signal && buf.writer()->write_avail() && towrite != ntodo)
-       cluster_signal_and_update(VC_EVENT_WRITE_READY, vc, s);
+      cluster_signal_and_update(VC_EVENT_WRITE_READY, vc, s);
     return 0;
   }
 }
 
 int
-ClusterHandler::valid_for_freespace_write(ClusterVConnection * vc)
+ClusterHandler::valid_for_freespace_write(ClusterVConnection *vc)
 {
   //
   // Determine if freespace messages are allowed on this VC
@@ -2156,7 +2080,7 @@ retry:
     if (!lock.have_lock && s->vio.mutex && s->vio._cont) {
       goto retry;
     } else {
-      // No active VIO
+// No active VIO
 #ifdef CLUSTER_STATS
       _fw_no_active_vio++;
 #endif
@@ -2194,7 +2118,6 @@ retry:
 
   int64_t bytes_to_move = vc->initial_data_bytes;
   if (vc->read_block && bytes_to_move) {
-
     // Push initial read data into VC
 
     if (ntodo >= bytes_to_move) {
@@ -2231,8 +2154,7 @@ retry:
           return 0;
         }
       }
-      if (cluster_signal_and_update_locked(VC_EVENT_READ_READY, vc, s)
-          == EVENT_DONE)
+      if (cluster_signal_and_update_locked(VC_EVENT_READ_READY, vc, s) == EVENT_DONE)
         return false;
 
       if (s->vio.ntodo() <= 0)
@@ -2269,7 +2191,7 @@ retry:
 }
 
 void
-ClusterHandler::vcs_push(ClusterVConnection * vc, int type)
+ClusterHandler::vcs_push(ClusterVConnection *vc, int type)
 {
   if (vc->type <= VC_CLUSTER)
     vc->type = type;
@@ -2284,7 +2206,7 @@ ClusterHandler::vcs_push(ClusterVConnection * vc, int type)
 }
 
 int
-ClusterHandler::remote_close(ClusterVConnection * vc, ClusterVConnState * ns)
+ClusterHandler::remote_close(ClusterVConnection *vc, ClusterVConnState *ns)
 {
   if (ns->vio.op != VIO::NONE && !vc->closed) {
     ns->enabled = 0;
@@ -2306,17 +2228,17 @@ ClusterHandler::remote_close(ClusterVConnection * vc, ClusterVConnState * ns)
 }
 
 void
-ClusterHandler::steal_thread(EThread * t)
+ClusterHandler::steal_thread(EThread *t)
 {
   //
   // Attempt to push the control message now instead of waiting
   // for the periodic event to process it.
   //
-  if (t != thread &&            // different thread to steal
-      write.to_do <= 0 &&       // currently not trying to send data
+  if (t != thread &&      // different thread to steal
+      write.to_do <= 0 && // currently not trying to send data
       // nothing big outstanding
       !write.msg.count) {
-    mainClusterEvent(CLUSTER_EVENT_STEAL_THREAD, (Event *) t);
+    mainClusterEvent(CLUSTER_EVENT_STEAL_THREAD, (Event *)t);
   }
 }
 
@@ -2333,29 +2255,28 @@ ClusterHandler::free_locks(bool read_flag, int i)
       i = write.msg.count;
     }
   }
-  ClusterState & s = (read_flag ? read : write);
+  ClusterState &s = (read_flag ? read : write);
   for (int j = 0; j < i; j++) {
     if (s.msg.descriptor[j].type == CLUSTER_SEND_DATA && s.msg.descriptor[j].channel != CLUSTER_CONTROL_CHANNEL) {
       ClusterVConnection *vc = channels[s.msg.descriptor[j].channel];
       if (VALID_CHANNEL(vc)) {
         if (read_flag) {
-          if ((ProxyMutex *) vc->read_locked) {
+          if ((ProxyMutex *)vc->read_locked) {
             MUTEX_UNTAKE_LOCK(vc->read.vio.mutex, thread);
             vc->read_locked = NULL;
           }
         } else {
-          if ((ProxyMutex *) vc->write_locked) {
+          if ((ProxyMutex *)vc->write_locked) {
             MUTEX_UNTAKE_LOCK(vc->write_locked, thread);
             vc->write_locked = NULL;
           }
         }
       }
-    } else if (!read_flag &&
-               s.msg.descriptor[j].type == CLUSTER_SEND_FREE &&
+    } else if (!read_flag && s.msg.descriptor[j].type == CLUSTER_SEND_FREE &&
                s.msg.descriptor[j].channel != CLUSTER_CONTROL_CHANNEL) {
       ClusterVConnection *vc = channels[s.msg.descriptor[j].channel];
       if (VALID_CHANNEL(vc)) {
-        if ((ProxyMutex *) vc->read_locked) {
+        if ((ProxyMutex *)vc->read_locked) {
           MUTEX_UNTAKE_LOCK(vc->read_locked, thread);
           vc->read_locked = NULL;
         }
@@ -2401,7 +2322,7 @@ extern int CacheClusterMonitorIntervalSecs;
 // The main event for machine-machine link
 //
 int
-ClusterHandler::mainClusterEvent(int event, Event * e)
+ClusterHandler::mainClusterEvent(int event, Event *e)
 {
   // Set global time
   current_time = ink_get_hrtime();
@@ -2412,15 +2333,15 @@ ClusterHandler::mainClusterEvent(int event, Event * e)
       dump_internal_data();
     }
   }
-  //
-  // Note: The caller always acquires the ClusterHandler mutex prior
-  //       to the call.  This guarantees single threaded access in
-  //       mainClusterEvent()
-  //
+//
+// Note: The caller always acquires the ClusterHandler mutex prior
+//       to the call.  This guarantees single threaded access in
+//       mainClusterEvent()
+//
 
-  /////////////////////////////////////////////////////////////////////////
-  // If cluster interconnect is overloaded, disable remote cluster ops.
-  /////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+// If cluster interconnect is overloaded, disable remote cluster ops.
+/////////////////////////////////////////////////////////////////////////
 #ifndef DEBUG
   if (clm && ClusterLoadMonitor::cf_monitor_enabled > 0) {
 #else
@@ -2446,7 +2367,7 @@ ClusterHandler::mainClusterEvent(int event, Event * e)
   bool io_callback = (event == EVENT_IMMEDIATE);
 
   if (on_stolen_thread) {
-    thread = (EThread *) e;
+    thread = (EThread *)e;
   } else {
     if (io_callback) {
       thread = this_ethread();
@@ -2499,7 +2420,7 @@ ClusterHandler::mainClusterEvent(int event, Event * e)
     /////////////////////////////////////////
     if (!on_stolen_thread) {
       if (do_open_local_requests())
-		thread->signal_hook(thread);
+        thread->signal_hook(thread);
     }
   }
 
@@ -2513,8 +2434,7 @@ ClusterHandler::mainClusterEvent(int event, Event * e)
   return EVENT_CONT;
 }
 
-int
-ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
+int ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
 {
 #ifdef CLUSTER_STATS
   _process_read_calls++;
@@ -2528,9 +2448,8 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
   ///////////////////////////////
 
   for (;;) {
-
     switch (read.state) {
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_START:
       ///////////////////////////////////////////////
       {
@@ -2546,7 +2465,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_HEADER:
       ///////////////////////////////////////////////
       {
@@ -2561,7 +2480,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_AWAIT_HEADER:
       ///////////////////////////////////////////////
       {
@@ -2589,11 +2508,9 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
           }
         } else {
 #ifdef MSG_TRACE
-          fprintf(t_fd,
-                  "[R] seqno=%d count=%d control_bytes=%d count_check=%d dsum=%d csum=%d\n",
-                  read.sequence_number,
-                  read.msg.hdr()->count, read.msg.hdr()->control_bytes,
-                  read.msg.hdr()->count_check, read.msg.hdr()->descriptor_cksum, read.msg.hdr()->control_bytes_cksum);
+          fprintf(t_fd, "[R] seqno=%d count=%d control_bytes=%d count_check=%d dsum=%d csum=%d\n", read.sequence_number,
+                  read.msg.hdr()->count, read.msg.hdr()->control_bytes, read.msg.hdr()->count_check,
+                  read.msg.hdr()->descriptor_cksum, read.msg.hdr()->control_bytes_cksum);
           fflush(t_fd);
 #endif
           CLUSTER_SUM_DYN_STAT(CLUSTER_READ_BYTES_STAT, read.did);
@@ -2623,7 +2540,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
           break;
         }
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_SETUP_DESCRIPTOR:
       ///////////////////////////////////////////////
       {
@@ -2637,7 +2554,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_DESCRIPTOR:
       ///////////////////////////////////////////////
       {
@@ -2652,7 +2569,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_AWAIT_DESCRIPTOR:
       ///////////////////////////////////////////////
       {
@@ -2698,7 +2615,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
           break;
         }
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_SETUP_DATA:
       ///////////////////////////////////////////////
       {
@@ -2718,7 +2635,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_DATA:
       ///////////////////////////////////////////////
       {
@@ -2734,7 +2651,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_AWAIT_DATA:
       ///////////////////////////////////////////////
       {
@@ -2742,7 +2659,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         _n_read_await_data++;
 #endif
         if (!read.io_complete) {
-          return 0;             // awaiting i/o complete
+          return 0; // awaiting i/o complete
         } else {
           if (read.io_complete > 0) {
             read.state = ClusterState::READ_POST_COMPLETE;
@@ -2754,7 +2671,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_POST_COMPLETE:
       ///////////////////////////////////////////////
       {
@@ -2784,7 +2701,7 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
           break;
         }
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::READ_COMPLETE:
       ///////////////////////////////////////////////
       {
@@ -2801,17 +2718,17 @@ ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
         free_locks(CLUSTER_READ);
 
         read.state = ClusterState::READ_START;
-        break;                  // setup next read
+        break; // setup next read
       }
-      //////////////////
+    //////////////////
     default:
       //////////////////
       {
         ink_release_assert(!"ClusterHandler::process_read invalid state");
       }
 
-    }                           // end of switch
-  }                             // end of for
+    } // end of switch
+  }   // end of for
 }
 
 int
@@ -2824,9 +2741,8 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
   // Cluster write state machine
   /////////////////////////////////
   for (;;) {
-
     switch (write.state) {
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::WRITE_START:
       ///////////////////////////////////////////////
       {
@@ -2842,7 +2758,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
         write.state = ClusterState::WRITE_SETUP;
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::WRITE_SETUP:
       ///////////////////////////////////////////////
       {
@@ -2867,7 +2783,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
           if (pw_freespace_descriptors_built) {
             pw_freespace_descriptors_built = build_freespace_descriptors();
           }
-          add_small_controlmsg_descriptors();   // always last
+          add_small_controlmsg_descriptors(); // always last
         } else {
           /////////////////////////////////////////////////////////////
           // Build a write descriptor only containing control data.
@@ -2875,7 +2791,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
           pw_write_descriptors_built = 0;
           pw_freespace_descriptors_built = 0;
           pw_controldata_descriptors_built = build_controlmsg_descriptors();
-          add_small_controlmsg_descriptors();   // always last
+          add_small_controlmsg_descriptors(); // always last
         }
 
         // If nothing to write, post write completion
@@ -2887,7 +2803,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
           control_message_write = only_write_control_msgs;
         }
 
-        // Move required data into the message header
+// Move required data into the message header
 #ifdef CLUSTER_MESSAGE_CKSUM
         write.msg.descriptor_cksum = write.msg.calc_descriptor_cksum();
         write.msg.hdr()->descriptor_cksum = write.msg.descriptor_cksum;
@@ -2905,7 +2821,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
         write.state = ClusterState::WRITE_INITIATE;
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::WRITE_INITIATE:
       ///////////////////////////////////////////////
       {
@@ -2920,7 +2836,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::WRITE_AWAIT_COMPLETION:
       ///////////////////////////////////////////////
       {
@@ -2954,7 +2870,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
         }
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::WRITE_POST_COMPLETE:
       ///////////////////////////////////////////////
       {
@@ -2974,7 +2890,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
         write.state = ClusterState::WRITE_COMPLETE;
         break;
       }
-      ///////////////////////////////////////////////
+    ///////////////////////////////////////////////
     case ClusterState::WRITE_COMPLETE:
       ///////////////////////////////////////////////
       {
@@ -2990,8 +2906,8 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
           //
           pw_time_expired = (curtime - now) > CLUSTER_MAX_RUN_TIME;
 
-          if (!control_message_write && !pw_write_descriptors_built
-              && !pw_freespace_descriptors_built && !pw_controldata_descriptors_built) {
+          if (!control_message_write && !pw_write_descriptors_built && !pw_freespace_descriptors_built &&
+              !pw_controldata_descriptors_built) {
             // skip to the next bucket
             cur_vcs = (cur_vcs + 1) % CLUSTER_BUCKETS;
           }
@@ -3018,24 +2934,24 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
           }
         }
         if (pw_time_expired) {
-          return -1;            // thread run time expired
+          return -1; // thread run time expired
         } else {
           if (pw_write_descriptors_built || pw_freespace_descriptors_built || pw_controldata_descriptors_built) {
-            break;              // start another write
+            break; // start another write
           } else {
-            return 0;           // no more data to write
+            return 0; // no more data to write
           }
         }
       }
-      //////////////////
+    //////////////////
     default:
       //////////////////
       {
         ink_release_assert(!"ClusterHandler::process_write invalid state");
       }
 
-    }                           // End of switch
-  }                             // End of for
+    } // End of switch
+  }   // End of for
 }
 
 int
@@ -3059,13 +2975,12 @@ ClusterHandler::do_open_local_requests()
   // move them to the local working queue while maintaining insertion order.
   //
   while (true) {
-    cvc_ext = (ClusterVConnection *)
-      ink_atomiclist_popall(&external_incoming_open_local);
+    cvc_ext = (ClusterVConnection *)ink_atomiclist_popall(&external_incoming_open_local);
     if (cvc_ext == 0)
       break;
 
     while (cvc_ext) {
-      cvc_ext_next = (ClusterVConnection *) cvc_ext->link.next;
+      cvc_ext_next = (ClusterVConnection *)cvc_ext->link.next;
       cvc_ext->link.next = NULL;
       local_incoming_open_local.push(cvc_ext);
       cvc_ext = cvc_ext_next;
@@ -3089,7 +3004,7 @@ ClusterHandler::do_open_local_requests()
         // unable to get mutex, insert request back onto global queue.
         Debug(CL_TRACE, "do_open_local_requests() unable to acquire mutex (cvc=%p)", cvc);
         pending_request = 1;
-        ink_atomiclist_push(&external_incoming_open_local, (void *) cvc);
+        ink_atomiclist_push(&external_incoming_open_local, (void *)cvc);
       }
     }
   }


[23/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index bb46c8b..c8156e1 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -23,8 +23,8 @@
 
 #include "P_Net.h"
 
-#define STATE_VIO_OFFSET ((uintptr_t)&((NetState*)0)->vio)
-#define STATE_FROM_VIO(_x) ((NetState*)(((char*)(_x)) - STATE_VIO_OFFSET))
+#define STATE_VIO_OFFSET ((uintptr_t) & ((NetState *)0)->vio)
+#define STATE_FROM_VIO(_x) ((NetState *)(((char *)(_x)) - STATE_VIO_OFFSET))
 
 #define disable_read(_vc) (_vc)->read.enabled = 0
 #define disable_write(_vc) (_vc)->write.enabled = 0
@@ -32,7 +32,7 @@
 #define enable_write(_vc) (_vc)->write.enabled = 1
 
 #ifndef UIO_MAXIOV
-#define NET_MAX_IOV 16          // UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
+#define NET_MAX_IOV 16 // UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
 #else
 #define NET_MAX_IOV UIO_MAXIOV
 #endif
@@ -68,7 +68,7 @@ void
 net_activity(UnixNetVConnection *vc, EThread *thread)
 {
   Debug("socket", "net_activity updating inactivity %" PRId64 ", NetVC=%p", vc->inactivity_timeout_in, vc);
-  (void) thread;
+  (void)thread;
 #ifdef INACTIVITY_TIMEOUT
   if (vc->inactivity_timeout && vc->inactivity_timeout_in && vc->inactivity_timeout->ethread == thread)
     vc->inactivity_timeout->schedule_in(vc->inactivity_timeout_in);
@@ -86,7 +86,6 @@ net_activity(UnixNetVConnection *vc, EThread *thread)
   else
     vc->next_inactivity_timeout_at = 0;
 #endif
-
 }
 
 //
@@ -148,7 +147,7 @@ read_signal_and_update(int event, UnixNetVConnection *vc)
       vc->closed = 1;
       break;
     default:
-      Error ("Unexpected event %d for vc %p", event, vc);
+      Error("Unexpected event %d for vc %p", event, vc);
       ink_release_assert(0);
       break;
     }
@@ -239,7 +238,7 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
     return;
   }
 
-  MIOBufferAccessor & buf = s->vio.buffer;
+  MIOBufferAccessor &buf = s->vio.buffer;
   ink_assert(buf.writer());
 
   // if there is nothing to do, disable connection
@@ -295,7 +294,6 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
     }
     // check for errors
     if (r <= 0) {
-
       if (r == -EAGAIN || r == -ENOTCONN) {
         NET_INCREMENT_DYN_STAT(net_calls_to_read_nodata_stat);
         vc->read.triggered = 0;
@@ -397,8 +395,8 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
     if (ret == EVENT_ERROR) {
       vc->write.triggered = 0;
       write_signal_error(nh, vc, err);
-    } else if (ret == SSL_HANDSHAKE_WANT_READ || ret == SSL_HANDSHAKE_WANT_ACCEPT || ret == SSL_HANDSHAKE_WANT_CONNECT
-               || ret == SSL_HANDSHAKE_WANT_WRITE) {
+    } else if (ret == SSL_HANDSHAKE_WANT_READ || ret == SSL_HANDSHAKE_WANT_ACCEPT || ret == SSL_HANDSHAKE_WANT_CONNECT ||
+               ret == SSL_HANDSHAKE_WANT_WRITE) {
       vc->read.triggered = 0;
       nh->read_ready_list.remove(vc);
       vc->write.triggered = 0;
@@ -427,7 +425,7 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
     return;
   }
 
-  MIOBufferAccessor & buf = s->vio.buffer;
+  MIOBufferAccessor &buf = s->vio.buffer;
   ink_assert(buf.writer());
 
   // Calculate amount to write
@@ -471,15 +469,15 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
       r = total_written - wattempted + r;
   }
   // check for errors
-  if (r <= 0) {                 // if the socket was not ready,add to WaitList
+  if (r <= 0) { // if the socket was not ready,add to WaitList
     if (r == -EAGAIN || r == -ENOTCONN) {
       NET_INCREMENT_DYN_STAT(net_calls_to_write_nodata_stat);
-      if((needs & EVENTIO_WRITE) == EVENTIO_WRITE) {
+      if ((needs & EVENTIO_WRITE) == EVENTIO_WRITE) {
         vc->write.triggered = 0;
         nh->write_ready_list.remove(vc);
         write_reschedule(nh, vc);
       }
-      if((needs & EVENTIO_READ) == EVENTIO_READ) {
+      if ((needs & EVENTIO_READ) == EVENTIO_READ) {
         vc->read.triggered = 0;
         nh->read_ready_list.remove(vc);
         read_reschedule(nh, vc);
@@ -535,10 +533,10 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
       return;
     }
 
-    if((needs & EVENTIO_WRITE) == EVENTIO_WRITE) {
+    if ((needs & EVENTIO_WRITE) == EVENTIO_WRITE) {
       write_reschedule(nh, vc);
     }
-    if((needs & EVENTIO_READ) == EVENTIO_READ) {
+    if ((needs & EVENTIO_READ) == EVENTIO_READ) {
       read_reschedule(nh, vc);
     }
     return;
@@ -549,18 +547,18 @@ bool
 UnixNetVConnection::get_data(int id, void *data)
 {
   union {
-    TSVIO * vio;
-    void * data;
+    TSVIO *vio;
+    void *data;
   } ptr;
 
   ptr.data = data;
 
   switch (id) {
   case TS_API_DATA_READ_VIO:
-    *ptr.vio = (TSVIO)&this->read.vio;
+    *ptr.vio = (TSVIO) & this->read.vio;
     return true;
   case TS_API_DATA_WRITE_VIO:
-    *ptr.vio = (TSVIO)&this->write.vio;
+    *ptr.vio = (TSVIO) & this->write.vio;
     return true;
   default:
     return false;
@@ -577,7 +575,7 @@ UnixNetVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
   read.vio._cont = c;
   read.vio.nbytes = nbytes;
   read.vio.ndone = 0;
-  read.vio.vc_server = (VConnection *) this;
+  read.vio.vc_server = (VConnection *)this;
   if (buf) {
     read.vio.buffer.writer_for(buf);
     if (!read.enabled)
@@ -598,7 +596,7 @@ UnixNetVConnection::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader
   write.vio._cont = c;
   write.vio.nbytes = nbytes;
   write.vio.ndone = 0;
-  write.vio.vc_server = (VConnection *) this;
+  write.vio.vc_server = (VConnection *)this;
   if (reader) {
     ink_assert(!owner);
     write.vio.buffer.reader_for(reader);
@@ -611,7 +609,7 @@ UnixNetVConnection::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader
 }
 
 void
-UnixNetVConnection::do_io_close(int alerrno /* = -1 */ )
+UnixNetVConnection::do_io_close(int alerrno /* = -1 */)
 {
   disable_read(this);
   disable_write(this);
@@ -642,21 +640,21 @@ UnixNetVConnection::do_io_shutdown(ShutdownHowTo_t howto)
 {
   switch (howto) {
   case IO_SHUTDOWN_READ:
-    socketManager.shutdown(((UnixNetVConnection *) this)->con.fd, 0);
+    socketManager.shutdown(((UnixNetVConnection *)this)->con.fd, 0);
     disable_read(this);
     read.vio.buffer.clear();
     read.vio.nbytes = 0;
     f.shutdown = NET_VC_SHUTDOWN_READ;
     break;
   case IO_SHUTDOWN_WRITE:
-    socketManager.shutdown(((UnixNetVConnection *) this)->con.fd, 1);
+    socketManager.shutdown(((UnixNetVConnection *)this)->con.fd, 1);
     disable_write(this);
     write.vio.buffer.clear();
     write.vio.nbytes = 0;
     f.shutdown = NET_VC_SHUTDOWN_WRITE;
     break;
   case IO_SHUTDOWN_READWRITE:
-    socketManager.shutdown(((UnixNetVConnection *) this)->con.fd, 2);
+    socketManager.shutdown(((UnixNetVConnection *)this)->con.fd, 2);
     disable_read(this);
     disable_write(this);
     read.vio.buffer.clear();
@@ -684,7 +682,7 @@ OOB_callback::retry_OOB_send(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED
 void
 UnixNetVConnection::cancel_OOB()
 {
-  UnixNetVConnection *u = (UnixNetVConnection *) this;
+  UnixNetVConnection *u = (UnixNetVConnection *)this;
   if (u->oob_ptr) {
     if (u->oob_ptr->trigger) {
       u->oob_ptr->trigger->cancel_action();
@@ -698,7 +696,7 @@ UnixNetVConnection::cancel_OOB()
 Action *
 UnixNetVConnection::send_OOB(Continuation *cont, char *buf, int len)
 {
-  UnixNetVConnection *u = (UnixNetVConnection *) this;
+  UnixNetVConnection *u = (UnixNetVConnection *)this;
   ink_assert(len > 0);
   ink_assert(buf);
   ink_assert(!u->oob_ptr);
@@ -830,13 +828,11 @@ UnixNetVConnection::UnixNetVConnection()
 #else
     next_inactivity_timeout_at(0),
 #endif
-    active_timeout(NULL), nh(NULL),
-    id(0), flags(0), recursion(0), submit_time(0), oob_ptr(0),
-    from_accept_thread(false)
+    active_timeout(NULL), nh(NULL), id(0), flags(0), recursion(0), submit_time(0), oob_ptr(0), from_accept_thread(false)
 {
   memset(&local_addr, 0, sizeof local_addr);
   memset(&server_addr, 0, sizeof server_addr);
-  SET_HANDLER((NetVConnHandler) & UnixNetVConnection::startEvent);
+  SET_HANDLER((NetVConnHandler)&UnixNetVConnection::startEvent);
 }
 
 // Private methods
@@ -871,7 +867,8 @@ UnixNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
 // (SSL read does not support overlapped i/o)
 // without duplicating all the code in write_to_net.
 int64_t
-UnixNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor & buf, int &needs)
+UnixNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor &buf,
+                                          int &needs)
 {
   int64_t r = 0;
 
@@ -1003,11 +1000,11 @@ UnixNetVConnection::acceptEvent(int event, Event *e)
     return EVENT_DONE;
   }
 
-  SET_HANDLER((NetVConnHandler) & UnixNetVConnection::mainEvent);
+  SET_HANDLER((NetVConnHandler)&UnixNetVConnection::mainEvent);
 
   nh = get_NetHandler(thread);
   PollDescriptor *pd = get_PollDescriptor(thread);
-  if (ep.start(pd, this, EVENTIO_READ|EVENTIO_WRITE) < 0) {
+  if (ep.start(pd, this, EVENTIO_READ | EVENTIO_WRITE) < 0) {
     Debug("iocore_net", "acceptEvent : failed EventIO::start\n");
     close_UnixNetVConnection(this, e->ethread);
     return EVENT_DONE;
@@ -1039,9 +1036,8 @@ UnixNetVConnection::mainEvent(int event, Event *e)
   ink_assert(thread == this_ethread());
 
   MUTEX_TRY_LOCK(hlock, get_NetHandler(thread)->mutex, e->ethread);
-  MUTEX_TRY_LOCK(rlock, read.vio.mutex ? (ProxyMutex *) read.vio.mutex : (ProxyMutex *) e->ethread->mutex, e->ethread);
-  MUTEX_TRY_LOCK(wlock, write.vio.mutex ? (ProxyMutex *) write.vio.mutex :
-                 (ProxyMutex *) e->ethread->mutex, e->ethread);
+  MUTEX_TRY_LOCK(rlock, read.vio.mutex ? (ProxyMutex *)read.vio.mutex : (ProxyMutex *)e->ethread->mutex, e->ethread);
+  MUTEX_TRY_LOCK(wlock, write.vio.mutex ? (ProxyMutex *)write.vio.mutex : (ProxyMutex *)e->ethread->mutex, e->ethread);
   if (!hlock.is_locked() || !rlock.is_locked() || !wlock.is_locked() ||
       (read.vio.mutex.m_ptr && rlock.get_mutex() != read.vio.mutex.m_ptr) ||
       (write.vio.mutex.m_ptr && wlock.get_mutex() != write.vio.mutex.m_ptr)) {
@@ -1071,8 +1067,8 @@ UnixNetVConnection::mainEvent(int event, Event *e)
 #else
   if (event == EVENT_IMMEDIATE) {
     /* BZ 49408 */
-    //ink_assert(inactivity_timeout_in);
-    //ink_assert(next_inactivity_timeout_at < ink_get_hrtime());
+    // ink_assert(inactivity_timeout_in);
+    // ink_assert(next_inactivity_timeout_at < ink_get_hrtime());
     if (!inactivity_timeout_in || next_inactivity_timeout_at > ink_get_hrtime())
       return EVENT_CONT;
     signal_event = VC_EVENT_INACTIVITY_TIMEOUT;
@@ -1099,10 +1095,8 @@ UnixNetVConnection::mainEvent(int event, Event *e)
       return EVENT_DONE;
   }
 
-  if (!*signal_timeout &&
-      !*signal_timeout_at &&
-      !closed && write.vio.op == VIO::WRITE &&
-      !(f.shutdown & NET_VC_SHUTDOWN_WRITE) && reader_cont != write.vio._cont && writer_cont == write.vio._cont)
+  if (!*signal_timeout && !*signal_timeout_at && !closed && write.vio.op == VIO::WRITE && !(f.shutdown & NET_VC_SHUTDOWN_WRITE) &&
+      reader_cont != write.vio._cont && writer_cont == write.vio._cont)
     if (write_signal_and_update(signal_event, this) == EVENT_DONE)
       return EVENT_DONE;
   return EVENT_DONE;
@@ -1117,7 +1111,7 @@ UnixNetVConnection::connectUp(EThread *t, int fd)
   thread = t;
   if (check_net_throttle(CONNECT, submit_time)) {
     check_throttle_warning();
-    action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) -ENET_THROTTLING);
+    action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *)-ENET_THROTTLING);
     free(t);
     return CONNECT_FAILURE;
   }
@@ -1131,12 +1125,8 @@ UnixNetVConnection::connectUp(EThread *t, int fd)
   if (is_debug_tag_set("iocore_net")) {
     char addrbuf[INET6_ADDRSTRLEN];
     Debug("iocore_net", "connectUp:: local_addr=%s:%d [%s]\n",
-      options.local_ip.isValid()
-      ? options.local_ip.toString(addrbuf, sizeof(addrbuf))
-      : "*",
-      options.local_port,
-      NetVCOptions::toString(options.addr_binding)
-    );
+          options.local_ip.isValid() ? options.local_ip.toString(addrbuf, sizeof(addrbuf)) : "*", options.local_port,
+          NetVCOptions::toString(options.addr_binding));
   }
 
   // If this is getting called from the TS API, then we are wiring up a file descriptor
@@ -1161,7 +1151,7 @@ UnixNetVConnection::connectUp(EThread *t, int fd)
 
   // Must connect after EventIO::Start() to avoid a race condition
   // when edge triggering is used.
-  if (ep.start(get_PollDescriptor(t), this, EVENTIO_READ|EVENTIO_WRITE) < 0) {
+  if (ep.start(get_PollDescriptor(t), this, EVENTIO_READ | EVENTIO_WRITE) < 0) {
     lerrno = errno;
     Debug("iocore_net", "connectUp : Failed to add to epoll list\n");
     action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *)0); // 0 == res
@@ -1212,7 +1202,7 @@ UnixNetVConnection::free(EThread *t)
   read.vio.mutex.clear();
   write.vio.mutex.clear();
   flags = 0;
-  SET_CONTINUATION_HANDLER(this, (NetVConnHandler) & UnixNetVConnection::startEvent);
+  SET_CONTINUATION_HANDLER(this, (NetVConnHandler)&UnixNetVConnection::startEvent);
   nh = NULL;
   read.triggered = 0;
   write.triggered = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixUDPConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPConnection.cc b/iocore/net/UnixUDPConnection.cc
index 1c6d29e..318e629 100644
--- a/iocore/net/UnixUDPConnection.cc
+++ b/iocore/net/UnixUDPConnection.cc
@@ -34,7 +34,7 @@
 
 UnixUDPConnection::~UnixUDPConnection()
 {
-  UDPPacketInternal *p = (UDPPacketInternal *) ink_atomiclist_popall(&inQueue);
+  UDPPacketInternal *p = (UDPPacketInternal *)ink_atomiclist_popall(&inQueue);
 
   if (!tobedestroyed)
     tobedestroyed = 1;
@@ -64,8 +64,8 @@ UnixUDPConnection::~UnixUDPConnection()
 int
 UnixUDPConnection::callbackHandler(int event, void *data)
 {
-  (void) event;
-  (void) data;
+  (void)event;
+  (void)data;
   callbackAction = NULL;
   if (continuation == NULL)
     return EVENT_CONT;
@@ -73,11 +73,11 @@ UnixUDPConnection::callbackHandler(int event, void *data)
   if (m_errno) {
     if (!shouldDestroy())
       continuation->handleEvent(NET_EVENT_DATAGRAM_ERROR, this);
-    destroy();                  // don't destroy until after calling back with error
+    destroy(); // don't destroy until after calling back with error
     Release();
     return EVENT_CONT;
   } else {
-    UDPPacketInternal *p = (UDPPacketInternal *) ink_atomiclist_popall(&inQueue);
+    UDPPacketInternal *p = (UDPPacketInternal *)ink_atomiclist_popall(&inQueue);
     if (p) {
       Debug("udpnet", "UDPConnection::callbackHandler");
       UDPPacketInternal *pnext = NULL;
@@ -101,10 +101,10 @@ UnixUDPConnection::callbackHandler(int event, void *data)
 }
 
 void
-UDPConnection::bindToThread(Continuation * c)
+UDPConnection::bindToThread(Continuation *c)
 {
-  UnixUDPConnection *uc = (UnixUDPConnection *) this;
-  //add to new connections queue for EThread.
+  UnixUDPConnection *uc = (UnixUDPConnection *)this;
+  // add to new connections queue for EThread.
   EThread *t = eventProcessor.assign_thread(ET_UDP);
   ink_assert(t);
   ink_assert(get_UDPNetHandler(t));
@@ -116,10 +116,10 @@ UDPConnection::bindToThread(Continuation * c)
 }
 
 Action *
-UDPConnection::send(Continuation * c, UDPPacket * xp)
+UDPConnection::send(Continuation *c, UDPPacket *xp)
 {
-  UDPPacketInternal *p = (UDPPacketInternal *) xp;
-  UnixUDPConnection *conn = (UnixUDPConnection *) this;
+  UDPPacketInternal *p = (UDPPacketInternal *)xp;
+  UnixUDPConnection *conn = (UnixUDPConnection *)this;
 
   if (shouldDestroy()) {
     ink_assert(!"freeing packet sent on dead connection");
@@ -141,7 +141,7 @@ UDPConnection::send(Continuation * c, UDPPacket * xp)
 void
 UDPConnection::Release()
 {
-  UnixUDPConnection *p = (UnixUDPConnection *) this;
+  UnixUDPConnection *p = (UnixUDPConnection *)this;
 
   p->ep.stop();
 
@@ -155,4 +155,3 @@ UDPConnection::Release()
     delete this;
   }
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 5c6f48d..3fa449c 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -32,7 +32,7 @@
 #include "P_Net.h"
 #include "P_UDPNet.h"
 
-typedef int (UDPNetHandler::*UDPNetContHandler) (int, void *);
+typedef int (UDPNetHandler::*UDPNetContHandler)(int, void *);
 
 inkcoreapi ClassAllocator<UDPPacketInternal> udpPacketAllocator("udpPacketAllocator");
 EventType ET_UDP;
@@ -62,10 +62,10 @@ int G_bwGrapherFd;
 sockaddr_in6 G_bwGrapherLoc;
 
 void
-initialize_thread_for_udp_net(EThread * thread)
+initialize_thread_for_udp_net(EThread *thread)
 {
-  new((ink_dummy_for_new *) get_UDPPollCont(thread)) PollCont(thread->mutex);
-  new((ink_dummy_for_new *) get_UDPNetHandler(thread)) UDPNetHandler;
+  new ((ink_dummy_for_new *)get_UDPPollCont(thread)) PollCont(thread->mutex);
+  new ((ink_dummy_for_new *)get_UDPNetHandler(thread)) UDPNetHandler;
 
   // This variable controls how often we cleanup the cancelled packets.
   // If it is set to 0, then cleanup never occurs.
@@ -92,7 +92,7 @@ UDPNetProcessorInternal::start(int n_upd_threads, size_t stacksize)
     return -1;
 
   ET_UDP = eventProcessor.spawn_event_threads(n_upd_threads, "ET_UDP", stacksize);
-  if (ET_UDP < 0)               // Probably can't happen, maybe at some point EventType should be unsigned ?
+  if (ET_UDP < 0) // Probably can't happen, maybe at some point EventType should be unsigned ?
     return -1;
 
   pollCont_offset = eventProcessor.allocate(sizeof(PollCont));
@@ -105,9 +105,9 @@ UDPNetProcessorInternal::start(int n_upd_threads, size_t stacksize)
 }
 
 void
-UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler * nh, UDPConnection * xuc)
+UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler *nh, UDPConnection *xuc)
 {
-  UnixUDPConnection *uc = (UnixUDPConnection *) xuc;
+  UnixUDPConnection *uc = (UnixUDPConnection *)xuc;
 
   // receive packet and queue onto UDPConnection.
   // don't call back connection at this time.
@@ -121,7 +121,7 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler * nh, UDPConnection * x
     // which gets referenced by IOBufferBlock.
     char buf[65536];
     int buflen = sizeof(buf);
-    r = socketManager.recvfrom(uc->getFd(), buf, buflen, 0, (struct sockaddr *) &fromaddr, &fromlen);
+    r = socketManager.recvfrom(uc->getFd(), buf, buflen, 0, (struct sockaddr *)&fromaddr, &fromlen);
     if (r <= 0) {
       // error
       break;
@@ -148,10 +148,10 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler * nh, UDPConnection * x
 
 
 int
-UDPNetProcessorInternal::udp_callback(UDPNetHandler * nh, UDPConnection * xuc, EThread * thread)
+UDPNetProcessorInternal::udp_callback(UDPNetHandler *nh, UDPConnection *xuc, EThread *thread)
 {
-  (void) nh;
-  UnixUDPConnection *uc = (UnixUDPConnection *) xuc;
+  (void)nh;
+  UnixUDPConnection *uc = (UnixUDPConnection *)xuc;
 
   if (uc->continuation && uc->mutex) {
     MUTEX_TRY_LOCK_FOR(lock, uc->mutex, thread, uc->continuation);
@@ -172,25 +172,27 @@ UDPNetProcessorInternal::udp_callback(UDPNetHandler * nh, UDPConnection * xuc, E
 }
 
 // cheesy implementation of a asynchronous read and callback for Unix
-class UDPReadContinuation:public Continuation
+class UDPReadContinuation : public Continuation
 {
 public:
-  UDPReadContinuation(Event * completionToken);
+  UDPReadContinuation(Event *completionToken);
   UDPReadContinuation();
   ~UDPReadContinuation();
   inline void free(void);
-  inline void init_token(Event * completionToken);
-  inline void init_read(int fd, IOBufferBlock * buf, int len, struct sockaddr *fromaddr, socklen_t *fromaddrlen);
+  inline void init_token(Event *completionToken);
+  inline void init_read(int fd, IOBufferBlock *buf, int len, struct sockaddr *fromaddr, socklen_t *fromaddrlen);
 
-  void set_timer(int seconds)
+  void
+  set_timer(int seconds)
   {
     timeout_interval = HRTIME_SECONDS(seconds);
   }
 
   void cancel();
-  int readPollEvent(int event, Event * e);
+  int readPollEvent(int event, Event *e);
 
-  Action *getAction()
+  Action *
+  getAction()
   {
     return event;
   }
@@ -198,15 +200,15 @@ public:
   void setupPollDescriptor();
 
 private:
-  Event * event;                // the completion event token created
+  Event *event; // the completion event token created
   // on behalf of the client
   Ptr<IOBufferBlock> readbuf;
   int readlen;
   struct sockaddr_in6 *fromaddr;
   socklen_t *fromaddrlen;
-  int fd;                       // fd we are reading from
-  int ifd;                      // poll fd index
-  ink_hrtime period;            // polling period
+  int fd;            // fd we are reading from
+  int ifd;           // poll fd index
+  ink_hrtime period; // polling period
   ink_hrtime elapsed_time;
   ink_hrtime timeout_interval;
 };
@@ -215,9 +217,9 @@ ClassAllocator<UDPReadContinuation> udpReadContAllocator("udpReadContAllocator")
 
 #define UNINITIALIZED_EVENT_PTR (Event *)0xdeadbeef
 
-UDPReadContinuation::UDPReadContinuation(Event * completionToken)
-  : Continuation(NULL), event(completionToken), readbuf(NULL), readlen(0), fromaddrlen(0), fd(-1),
-    ifd(-1), period(0), elapsed_time(0), timeout_interval(0)
+UDPReadContinuation::UDPReadContinuation(Event *completionToken)
+  : Continuation(NULL), event(completionToken), readbuf(NULL), readlen(0), fromaddrlen(0), fd(-1), ifd(-1), period(0),
+    elapsed_time(0), timeout_interval(0)
 {
   if (completionToken->continuation)
     this->mutex = completionToken->continuation->mutex;
@@ -226,9 +228,10 @@ UDPReadContinuation::UDPReadContinuation(Event * completionToken)
 }
 
 UDPReadContinuation::UDPReadContinuation()
-  : Continuation(NULL), event(UNINITIALIZED_EVENT_PTR), readbuf(NULL), readlen(0), fromaddrlen(0), fd(-1),
-    ifd(-1), period(0), elapsed_time(0), timeout_interval(0)
-{ }
+  : Continuation(NULL), event(UNINITIALIZED_EVENT_PTR), readbuf(NULL), readlen(0), fromaddrlen(0), fd(-1), ifd(-1), period(0),
+    elapsed_time(0), timeout_interval(0)
+{
+}
 
 inline void
 UDPReadContinuation::free(void)
@@ -249,7 +252,7 @@ UDPReadContinuation::free(void)
 }
 
 inline void
-UDPReadContinuation::init_token(Event * completionToken)
+UDPReadContinuation::init_token(Event *completionToken)
 {
   if (completionToken->continuation) {
     this->mutex = completionToken->continuation->mutex;
@@ -260,7 +263,7 @@ UDPReadContinuation::init_token(Event * completionToken)
 }
 
 inline void
-UDPReadContinuation::init_read(int rfd, IOBufferBlock * buf, int len, struct sockaddr *fromaddr_, socklen_t *fromaddrlen_)
+UDPReadContinuation::init_read(int rfd, IOBufferBlock *buf, int len, struct sockaddr *fromaddr_, socklen_t *fromaddrlen_)
 {
   ink_assert(rfd >= 0 && buf != NULL && fromaddr_ != NULL && fromaddrlen_ != NULL);
   fd = rfd;
@@ -276,8 +279,7 @@ UDPReadContinuation::init_read(int rfd, IOBufferBlock * buf, int len, struct soc
 
 UDPReadContinuation::~UDPReadContinuation()
 {
-  if (event != UNINITIALIZED_EVENT_PTR)
-  {
+  if (event != UNINITIALIZED_EVENT_PTR) {
     ink_assert(event != NULL);
     completionUtil::destroy(event);
     event = NULL;
@@ -296,7 +298,7 @@ UDPReadContinuation::setupPollDescriptor()
 {
 #if TS_USE_EPOLL
   Pollfd *pfd;
-  EThread *et = (EThread *) this_thread();
+  EThread *et = (EThread *)this_thread();
   PollCont *pc = get_PollCont(et);
   if (pc->nextPollDescriptor == NULL) {
     pc->nextPollDescriptor = new PollDescriptor;
@@ -312,12 +314,12 @@ UDPReadContinuation::setupPollDescriptor()
 }
 
 int
-UDPReadContinuation::readPollEvent(int event_, Event * e)
+UDPReadContinuation::readPollEvent(int event_, Event *e)
 {
-  (void) event_;
-  (void) e;
+  (void)event_;
+  (void)e;
 
-  //PollCont *pc = get_PollCont(e->ethread);
+  // PollCont *pc = get_PollCont(e->ethread);
   Continuation *c;
 
   if (event->cancelled) {
@@ -339,9 +341,10 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
       return EVENT_DONE;
     }
   }
-  //ink_assert(ifd < 0 || event_ == EVENT_INTERVAL || (event_ == EVENT_POLL && pc->pollDescriptor->nfds > ifd && pc->pollDescriptor->pfd[ifd].fd == fd));
-  //if (ifd < 0 || event_ == EVENT_INTERVAL || (pc->pollDescriptor->pfd[ifd].revents & POLLIN)) {
-  //ink_assert(!"incomplete");
+  // ink_assert(ifd < 0 || event_ == EVENT_INTERVAL || (event_ == EVENT_POLL && pc->pollDescriptor->nfds > ifd &&
+  // pc->pollDescriptor->pfd[ifd].fd == fd));
+  // if (ifd < 0 || event_ == EVENT_INTERVAL || (pc->pollDescriptor->pfd[ifd].revents & POLLIN)) {
+  // ink_assert(!"incomplete");
   c = completionUtil::getContinuation(event);
   // do read
   socklen_t tmp_fromlen = *fromaddrlen;
@@ -363,13 +366,13 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
   } else if (rlen < 0 && rlen != -EAGAIN) {
     // signal error.
     *fromaddrlen = tmp_fromlen;
-    completionUtil::setInfo(event, fd, (IOBufferBlock *) readbuf, rlen, errno);
+    completionUtil::setInfo(event, fd, (IOBufferBlock *)readbuf, rlen, errno);
     c = completionUtil::getContinuation(event);
     // TODO: Should we deal with the return code?
     c->handleEvent(NET_EVENT_DATAGRAM_READ_ERROR, event);
     e->cancel();
     free();
-    //delete this;
+    // delete this;
     return EVENT_DONE;
   } else {
     completionUtil::setThread(event, NULL);
@@ -378,7 +381,7 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
   if (event->cancelled) {
     e->cancel();
     free();
-    //delete this;
+    // delete this;
     return EVENT_DONE;
   }
   // reestablish poll
@@ -403,13 +406,10 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
  *      return error;
  */
 Action *
-UDPNetProcessor::recvfrom_re(Continuation * cont,
-                             void *token,
-                             int fd,
-                             struct sockaddr * fromaddr, socklen_t *fromaddrlen,
-                             IOBufferBlock * buf, int len, bool useReadCont, int timeout)
+UDPNetProcessor::recvfrom_re(Continuation *cont, void *token, int fd, struct sockaddr *fromaddr, socklen_t *fromaddrlen,
+                             IOBufferBlock *buf, int len, bool useReadCont, int timeout)
 {
-  (void) useReadCont;
+  (void)useReadCont;
   ink_assert(buf->write_avail() >= len);
   int actual;
   Event *event = completionUtil::create();
@@ -451,7 +451,7 @@ UDPNetProcessor::recvfrom_re(Continuation * cont,
  *      return error
  */
 Action *
-UDPNetProcessor::sendmsg_re(Continuation * cont, void *token, int fd, struct msghdr * msg)
+UDPNetProcessor::sendmsg_re(Continuation *cont, void *token, int fd, struct msghdr *msg)
 {
   int actual;
   Event *event = completionUtil::create();
@@ -487,17 +487,17 @@ UDPNetProcessor::sendmsg_re(Continuation * cont, void *token, int fd, struct msg
  *
  */
 Action *
-UDPNetProcessor::sendto_re(Continuation * cont, void *token, int fd, struct sockaddr const* toaddr, int toaddrlen,
-                           IOBufferBlock * buf, int len)
+UDPNetProcessor::sendto_re(Continuation *cont, void *token, int fd, struct sockaddr const *toaddr, int toaddrlen,
+                           IOBufferBlock *buf, int len)
 {
-  (void) token;
+  (void)token;
   ink_assert(buf->read_avail() >= len);
   int nbytes_sent = socketManager.sendto(fd, buf->start(), len, 0, toaddr, toaddrlen);
 
   if (nbytes_sent >= 0) {
     ink_assert(nbytes_sent == len);
     buf->consume(nbytes_sent);
-    cont->handleEvent(NET_EVENT_DATAGRAM_WRITE_COMPLETE, (void *) -1);
+    cont->handleEvent(NET_EVENT_DATAGRAM_WRITE_COMPLETE, (void *)-1);
     return ACTION_RESULT_DONE;
   } else {
     cont->handleEvent(NET_EVENT_DATAGRAM_WRITE_ERROR, (void *)(intptr_t)nbytes_sent);
@@ -507,8 +507,8 @@ UDPNetProcessor::sendto_re(Continuation * cont, void *token, int fd, struct sock
 
 
 bool
-UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const* remote_addr, sockaddr* local_addr,
-                                 int *local_addr_len, Action ** status, int send_bufsize, int recv_bufsize)
+UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const *remote_addr, sockaddr *local_addr, int *local_addr_len,
+                                 Action **status, int send_bufsize, int recv_bufsize)
 {
   int res = 0, fd = -1;
 
@@ -540,23 +540,18 @@ UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const* remote_addr, sockad
   }
   *resfd = fd;
   *status = NULL;
-  Debug("udpnet", "creating a udp socket port = %d, %d---success",
-    ats_ip_port_host_order(remote_addr), ats_ip_port_host_order(local_addr)
-  );
+  Debug("udpnet", "creating a udp socket port = %d, %d---success", ats_ip_port_host_order(remote_addr),
+        ats_ip_port_host_order(local_addr));
   return true;
 SoftError:
-  Debug("udpnet", "creating a udp socket port = %d---soft failure",
-    ats_ip_port_host_order(local_addr)
-  );
+  Debug("udpnet", "creating a udp socket port = %d---soft failure", ats_ip_port_host_order(local_addr));
   if (fd != -1)
     socketManager.close(fd);
   *resfd = -1;
   *status = NULL;
   return false;
 HardError:
-  Debug("udpnet", "creating a udp socket port = %d---hard failure",
-    ats_ip_port_host_order(local_addr)
-  );
+  Debug("udpnet", "creating a udp socket port = %d---hard failure", ats_ip_port_host_order(local_addr));
   if (fd != -1)
     socketManager.close(fd);
   *resfd = -1;
@@ -566,7 +561,7 @@ HardError:
 
 
 Action *
-UDPNetProcessor::UDPBind(Continuation * cont, sockaddr const* addr, int send_bufsize, int recv_bufsize)
+UDPNetProcessor::UDPBind(Continuation *cont, sockaddr const *addr, int send_bufsize, int recv_bufsize)
 {
   int res = 0;
   int fd = -1;
@@ -584,7 +579,7 @@ UDPNetProcessor::UDPBind(Continuation * cont, sockaddr const* addr, int send_buf
   if (ats_is_ip_multicast(addr)) {
     int enable_reuseaddr = 1;
 
-    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0)) {
+    if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&enable_reuseaddr, sizeof(enable_reuseaddr)) < 0)) {
       goto Lerror;
     }
   }
@@ -621,9 +616,9 @@ Lerror:
 
 
 // send out all packets that need to be sent out as of time=now
-UDPQueue::UDPQueue()
-  : last_report(0), last_service(0), packets(0), added(0)
-{ }
+UDPQueue::UDPQueue() : last_report(0), last_service(0), packets(0), added(0)
+{
+}
 
 UDPQueue::~UDPQueue()
 {
@@ -633,16 +628,16 @@ UDPQueue::~UDPQueue()
  * Driver function that aggregates packets across cont's and sends them
  */
 void
-UDPQueue::service(UDPNetHandler * nh)
+UDPQueue::service(UDPNetHandler *nh)
 {
-  (void) nh;
+  (void)nh;
   ink_hrtime now = ink_get_hrtime_internal();
   uint64_t timeSpent = 0;
   uint64_t pktSendStartTime;
   UDPPacketInternal *p;
   ink_hrtime pktSendTime;
 
-  p = (UDPPacketInternal *) ink_atomiclist_popall(&atomicQueue);
+  p = (UDPPacketInternal *)ink_atomiclist_popall(&atomicQueue);
   if (p) {
     UDPPacketInternal *pnext = NULL;
     Queue<UDPPacketInternal> stk;
@@ -757,12 +752,12 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* pktLen ATS_UNUSED */)
   msg.msg_controllen = 0;
   msg.msg_flags = 0;
 #endif
-  msg.msg_name = (caddr_t) & p->to;
+  msg.msg_name = (caddr_t)&p->to;
   msg.msg_namelen = sizeof(p->to);
   iov_len = 0;
 
   for (b = p->chain; b != NULL; b = b->next) {
-    iov[iov_len].iov_base = (caddr_t) b->start();
+    iov[iov_len].iov_base = (caddr_t)b->start();
     iov[iov_len].iov_len = b->size();
     real_len += iov[iov_len].iov_len;
     iov_len++;
@@ -773,7 +768,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* pktLen ATS_UNUSED */)
   count = 0;
   while (1) {
     // stupid Linux problem: sendmsg can return EAGAIN
-    n =::sendmsg(p->conn->getFd(), &msg, 0);
+    n = ::sendmsg(p->conn->getFd(), &msg, 0);
     if ((n >= 0) || ((n < 0) && (errno != EAGAIN)))
       // send succeeded or some random error happened.
       break;
@@ -790,7 +785,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* pktLen ATS_UNUSED */)
 
 
 void
-UDPQueue::send(UDPPacket * p)
+UDPQueue::send(UDPPacket *p)
 {
   // XXX: maybe fastpath for immediate send?
   ink_atomiclist_push(&atomicQueue, p);
@@ -805,25 +800,25 @@ UDPNetHandler::UDPNetHandler()
   ink_atomiclist_init(&udpNewConnections, "UDP Connection queue", offsetof(UnixUDPConnection, newconn_alink.next));
   nextCheck = ink_get_hrtime_internal() + HRTIME_MSECONDS(1000);
   lastCheck = 0;
-  SET_HANDLER((UDPNetContHandler) & UDPNetHandler::startNetEvent);
+  SET_HANDLER((UDPNetContHandler)&UDPNetHandler::startNetEvent);
 }
 
 int
-UDPNetHandler::startNetEvent(int event, Event * e)
+UDPNetHandler::startNetEvent(int event, Event *e)
 {
-  (void) event;
-  SET_HANDLER((UDPNetContHandler) & UDPNetHandler::mainNetEvent);
+  (void)event;
+  SET_HANDLER((UDPNetContHandler)&UDPNetHandler::mainNetEvent);
   trigger_event = e;
   e->schedule_every(-HRTIME_MSECONDS(9));
   return EVENT_CONT;
 }
 
 int
-UDPNetHandler::mainNetEvent(int event, Event * e)
+UDPNetHandler::mainNetEvent(int event, Event *e)
 {
   ink_assert(trigger_event == e && event == EVENT_POLL);
-  (void) event;
-  (void) e;
+  (void)event;
+  (void)e;
 
   PollCont *pc = get_UDPPollCont(e->ethread);
 
@@ -837,9 +832,8 @@ UDPNetHandler::mainNetEvent(int event, Event * e)
 
   EventIO *temp_eptr = NULL;
   for (i = 0; i < pc->pollDescriptor->result; i++) {
-    temp_eptr = (EventIO*) get_ev_data(pc->pollDescriptor,i);
-    if ((get_ev_events(pc->pollDescriptor,i) & EVENTIO_READ)
-        && temp_eptr->type == EVENTIO_UDP_CONNECTION) {
+    temp_eptr = (EventIO *)get_ev_data(pc->pollDescriptor, i);
+    if ((get_ev_events(pc->pollDescriptor, i) & EVENTIO_READ) && temp_eptr->type == EVENTIO_UDP_CONNECTION) {
       uc = temp_eptr->data.uc;
       ink_assert(uc && uc->mutex && uc->continuation);
       ink_assert(uc->refcount >= 1);
@@ -850,8 +844,8 @@ UDPNetHandler::mainNetEvent(int event, Event * e)
         udpNetInternal.udp_read_from_net(this, uc);
         nread++;
       }
-    }                           //if EPOLLIN
-  }                             //end for
+    } // if EPOLLIN
+  }   // end for
 
   // remove dead UDP connections
   ink_hrtime now = ink_get_hrtime_internal();
@@ -861,8 +855,8 @@ UDPNetHandler::mainNetEvent(int event, Event * e)
       ink_assert(uc->refcount >= 1);
       next = uc->polling_link.next;
       if (uc->shouldDestroy()) {
-        //changed by YTS Team, yamsat
-        //udp_polling->remove(uc,uc->polling_link);
+        // changed by YTS Team, yamsat
+        // udp_polling->remove(uc,uc->polling_link);
         uc->Release();
       }
     }
@@ -873,7 +867,7 @@ UDPNetHandler::mainNetEvent(int event, Event * e)
   udp_callbacks.clear();
   while ((uc = q.dequeue())) {
     ink_assert(uc->mutex && uc->continuation);
-    if (udpNetInternal.udp_callback(this, uc, trigger_event->ethread)) {        // not successful
+    if (udpNetInternal.udp_callback(this, uc, trigger_event->ethread)) { // not successful
       // schedule on a thread of its own.
       ink_assert(uc->callback_link.next == NULL);
       ink_assert(uc->callback_link.prev == NULL);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/test_I_Net.cc
----------------------------------------------------------------------
diff --git a/iocore/net/test_I_Net.cc b/iocore/net/test_I_Net.cc
index 5f54f1d..70d314d 100644
--- a/iocore/net/test_I_Net.cc
+++ b/iocore/net/test_I_Net.cc
@@ -55,7 +55,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -78,19 +77,17 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -113,13 +110,13 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
+                 diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 /*
@@ -157,9 +154,9 @@ main()
   eventProcessor.start(nproc);
   RecProcessStart();
 
-  /*
-   *  Reset necessary config variables
-   */
+/*
+ *  Reset necessary config variables
+ */
 
 #ifdef USE_SOCKS
   net_config_socks_server_host = "209.131.52.54";

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/test_I_UDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/test_I_UDPNet.cc b/iocore/net/test_I_UDPNet.cc
index c3fef81..37b0952 100644
--- a/iocore/net/test_I_UDPNet.cc
+++ b/iocore/net/test_I_UDPNet.cc
@@ -27,7 +27,7 @@
 #include "I_Net.h"
 #include "List.h"
 
-//Diags stuff from test_I_Net.cc:
+// Diags stuff from test_I_Net.cc:
 Diags *diags;
 #define DIAGS_LOG_FILE "diags.log"
 
@@ -59,7 +59,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -82,19 +81,17 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -117,20 +114,20 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
+                 diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 
 /*This implements a standard Unix echo server: just send every udp packet you
   get back to where it came from*/
 
-class EchoServer:public Continuation
+class EchoServer : public Continuation
 {
   int sock_fd;
   UDPConnection *conn;
@@ -138,10 +135,7 @@ class EchoServer:public Continuation
   int handlePacket(int event, void *data);
 
 public:
-    EchoServer()
-  : Continuation(new_ProxyMutex())
-  {
-  };
+  EchoServer() : Continuation(new_ProxyMutex()){};
 
   bool Start(int port);
 };
@@ -167,25 +161,24 @@ int
 EchoServer::handlePacket(int event, void *data)
 {
   switch (event) {
-
-  case NET_EVENT_DATAGRAM_READ_READY:{
-      Queue<UDPPacket> *q = (Queue<UDPPacket> *)data;
-      UDPPacket *p;
-
-      //send what ever we get back to the client
-      while (p = q->pop()) {
-        p->m_to = p->m_from;
-        conn->send(this, p);
-      }
-      break;
+  case NET_EVENT_DATAGRAM_READ_READY: {
+    Queue<UDPPacket> *q = (Queue<UDPPacket> *)data;
+    UDPPacket *p;
+
+    // send what ever we get back to the client
+    while (p = q->pop()) {
+      p->m_to = p->m_from;
+      conn->send(this, p);
     }
+    break;
+  }
 
   case NET_EVENT_DATAGRAM_READ_ERROR:
     printf("got Read Error exiting\n");
     _exit(1);
 
   case NET_EVENT_DATAGRAM_WRITE_ERROR:
-    printf("got write error: %d\n", (int) data);
+    printf("got write error: %d\n", (int)data);
     break;
 
   default:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/test_P_Net.cc
----------------------------------------------------------------------
diff --git a/iocore/net/test_P_Net.cc b/iocore/net/test_P_Net.cc
index ba402d7..87b7736 100644
--- a/iocore/net/test_P_Net.cc
+++ b/iocore/net/test_P_Net.cc
@@ -24,14 +24,13 @@
 #include "P_Net.h"
 
 Diags *diags;
-struct NetTesterSM:public Continuation
-{
+struct NetTesterSM : public Continuation {
   VIO *read_vio;
   IOBufferReader *reader;
   NetVConnection *vc;
   MIOBuffer *buf;
 
-    NetTesterSM(ProxyMutex * _mutex, NetVConnection * _vc):Continuation(_mutex)
+  NetTesterSM(ProxyMutex *_mutex, NetVConnection *_vc) : Continuation(_mutex)
   {
     MUTEX_TRY_LOCK(lock, mutex, _vc->thread);
     ink_release_assert(lock);
@@ -43,7 +42,8 @@ struct NetTesterSM:public Continuation
   }
 
 
-  int handle_read(int event, void *data)
+  int
+  handle_read(int event, void *data)
   {
     int r;
     char *str;
@@ -56,7 +56,7 @@ struct NetTesterSM:public Continuation
       fflush(stdout);
       break;
     case VC_EVENT_READ_COMPLETE:
-      /* FALLSTHROUGH */
+    /* FALLSTHROUGH */
     case VC_EVENT_EOS:
       r = reader->read_avail();
       str = new char[r + 10];
@@ -68,38 +68,27 @@ struct NetTesterSM:public Continuation
       break;
     default:
       ink_release_assert(!"unknown event");
-
     }
     return EVENT_CONT;
   }
-
-
 };
 
 
-struct NetTesterAccept:public Continuation
-{
-
-  NetTesterAccept(ProxyMutex * _mutex):Continuation(_mutex)
-  {
-    SET_HANDLER(&NetTesterAccept::handle_accept);
-  }
+struct NetTesterAccept : public Continuation {
+  NetTesterAccept(ProxyMutex *_mutex) : Continuation(_mutex) { SET_HANDLER(&NetTesterAccept::handle_accept); }
 
-  int handle_accept(int event, void *data)
+  int
+  handle_accept(int event, void *data)
   {
     printf("Accepted a connection\n");
     fflush(stdout);
-    NetVConnection *vc = (NetVConnection *) data;
+    NetVConnection *vc = (NetVConnection *)data;
     new NetTesterSM(new_ProxyMutex(), vc);
     return EVENT_CONT;
   }
-
-
 };
 
 
-
-
 int
 main()
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/test_P_UDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/test_P_UDPNet.cc b/iocore/net/test_P_UDPNet.cc
index fc8fde8..751fe18 100644
--- a/iocore/net/test_P_UDPNet.cc
+++ b/iocore/net/test_P_UDPNet.cc
@@ -27,7 +27,7 @@
 #include "P_Net.h"
 #include "libts.h"
 
-//Diags stuff from test_I_Net.cc:
+// Diags stuff from test_I_Net.cc:
 Diags *diags;
 #define DIAGS_LOG_FILE "diags.log"
 
@@ -59,7 +59,6 @@ reconfigure_diags()
 
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
-
     c.outputs[i].to_stdout = 0;
     c.outputs[i].to_stderr = 1;
     c.outputs[i].to_syslog = 1;
@@ -82,19 +81,17 @@ reconfigure_diags()
   if (diags->base_action_tags)
     diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
 
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
+////////////////////////////////////
+// change the diags config values //
+////////////////////////////////////
 #if !defined(__GNUC__) && !defined(hpux)
   diags->config = c;
 #else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+  memcpy(((void *)&diags->config), ((void *)&c), sizeof(DiagsConfigState));
 #endif
-
 }
 
 
-
 static void
 init_diags(char *bdt, char *bat)
 {
@@ -117,20 +114,20 @@ init_diags(char *bdt, char *bat)
   if (diags_log_fp == NULL) {
     SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
 
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    diags->print(NULL, DL_Warning, NULL, &loc, "couldn't open diags log file '%s', "
+                                               "will not log to this file",
+                 diags_logpath);
   }
 
   diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
   reconfigure_diags();
-
 }
 
 
 /*This implements a standard Unix echo server: just send every udp packet you
   get back to where it came from*/
 
-class EchoServer:public Continuation
+class EchoServer : public Continuation
 {
   int sock_fd;
   UDPConnection *conn;
@@ -138,10 +135,7 @@ class EchoServer:public Continuation
   int handlePacket(int event, void *data);
 
 public:
-    EchoServer()
-  : Continuation(new_ProxyMutex())
-  {
-  };
+  EchoServer() : Continuation(new_ProxyMutex()){};
 
   bool Start(int port);
 };
@@ -167,25 +161,24 @@ int
 EchoServer::handlePacket(int event, void *data)
 {
   switch (event) {
-
-  case NET_EVENT_DATAGRAM_READ_READY:{
-      Queue<UDPPacket> *q = (Queue<UDPPacket> *)data;
-      UDPPacket *p;
-
-      //send what ever we get back to the client
-      while (p = q->pop()) {
-        p->m_to = p->m_from;
-        conn->send(this, p);
-      }
-      break;
+  case NET_EVENT_DATAGRAM_READ_READY: {
+    Queue<UDPPacket> *q = (Queue<UDPPacket> *)data;
+    UDPPacket *p;
+
+    // send what ever we get back to the client
+    while (p = q->pop()) {
+      p->m_to = p->m_from;
+      conn->send(this, p);
     }
+    break;
+  }
 
   case NET_EVENT_DATAGRAM_READ_ERROR:
     printf("got Read Error exiting\n");
     _exit(1);
 
   case NET_EVENT_DATAGRAM_WRITE_ERROR:
-    printf("got write error: %d\n", (int) data);
+    printf("got write error: %d\n", (int)data);
     break;
 
   default:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/test_certlookup.cc
----------------------------------------------------------------------
diff --git a/iocore/net/test_certlookup.cc b/iocore/net/test_certlookup.cc
index 418d06a..717f287 100644
--- a/iocore/net/test_certlookup.cc
+++ b/iocore/net/test_certlookup.cc
@@ -26,7 +26,7 @@
 #include <fstream>
 
 static IpEndpoint
-make_endpoint(const char * address)
+make_endpoint(const char *address)
 {
   IpEndpoint ip;
 
@@ -34,21 +34,21 @@ make_endpoint(const char * address)
   return ip;
 }
 
-REGRESSION_TEST(SSLCertificateLookup)(RegressionTest* t, int /* atype ATS_UNUSED */, int * pstatus)
+REGRESSION_TEST(SSLCertificateLookup)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
 {
-  TestBox       box(t, pstatus);
+  TestBox box(t, pstatus);
   SSLCertLookup lookup;
 
-  SSL_CTX * wild = SSL_CTX_new(SSLv23_server_method());
-  SSL_CTX * notwild = SSL_CTX_new(SSLv23_server_method());
-  SSL_CTX * b_notwild = SSL_CTX_new(SSLv23_server_method());
-  SSL_CTX * foo = SSL_CTX_new(SSLv23_server_method());
-  SSL_CTX * all_com = SSL_CTX_new(SSLv23_server_method());
-  SSLCertContext wild_cc (wild);
-  SSLCertContext notwild_cc (notwild);
-  SSLCertContext b_notwild_cc (b_notwild);
-  SSLCertContext foo_cc (foo);
-  SSLCertContext all_com_cc (all_com);
+  SSL_CTX *wild = SSL_CTX_new(SSLv23_server_method());
+  SSL_CTX *notwild = SSL_CTX_new(SSLv23_server_method());
+  SSL_CTX *b_notwild = SSL_CTX_new(SSLv23_server_method());
+  SSL_CTX *foo = SSL_CTX_new(SSLv23_server_method());
+  SSL_CTX *all_com = SSL_CTX_new(SSLv23_server_method());
+  SSLCertContext wild_cc(wild);
+  SSLCertContext notwild_cc(notwild);
+  SSLCertContext b_notwild_cc(b_notwild);
+  SSLCertContext foo_cc(foo);
+  SSLCertContext all_com_cc(all_com);
 
   box = REGRESSION_TEST_PASSED;
 
@@ -92,23 +92,23 @@ REGRESSION_TEST(SSLCertificateLookup)(RegressionTest* t, int /* atype ATS_UNUSED
   box.check(lookup.find("www.bar.net") == NULL, "host lookup for www.bar.net");
 }
 
-REGRESSION_TEST(SSLAddressLookup)(RegressionTest* t, int /* atype ATS_UNUSED */, int * pstatus)
+REGRESSION_TEST(SSLAddressLookup)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
 {
-  TestBox       box(t, pstatus);
+  TestBox box(t, pstatus);
   SSLCertLookup lookup;
 
   struct {
-    SSL_CTX * ip6;
-    SSL_CTX * ip6p;
-    SSL_CTX * ip4;
-    SSL_CTX * ip4p;
+    SSL_CTX *ip6;
+    SSL_CTX *ip6p;
+    SSL_CTX *ip4;
+    SSL_CTX *ip4p;
   } context;
 
   struct {
-     IpEndpoint ip6;
-     IpEndpoint ip6p;
-     IpEndpoint ip4;
-     IpEndpoint ip4p;
+    IpEndpoint ip6;
+    IpEndpoint ip6p;
+    IpEndpoint ip4;
+    IpEndpoint ip4p;
   } endpoint;
 
   context.ip6 = SSL_CTX_new(SSLv23_server_method());
@@ -130,7 +130,7 @@ REGRESSION_TEST(SSLAddressLookup)(RegressionTest* t, int /* atype ATS_UNUSED */,
   // For each combination of address with port and address without port, make sure that we find the
   // the most specific match (ie. find the context with the port if it is available) ...
 
-  box.check(lookup.insert(endpoint.ip6, ip6_cc) >= 0 , "insert IPv6 address");
+  box.check(lookup.insert(endpoint.ip6, ip6_cc) >= 0, "insert IPv6 address");
   box.check(lookup.find(endpoint.ip6)->ctx == context.ip6, "IPv6 exact match lookup");
   box.check(lookup.find(endpoint.ip6p)->ctx == context.ip6, "IPv6 exact match lookup w/ port");
 
@@ -148,7 +148,7 @@ REGRESSION_TEST(SSLAddressLookup)(RegressionTest* t, int /* atype ATS_UNUSED */,
 }
 
 static unsigned
-load_hostnames_csv(const char * fname, SSLCertLookup& lookup)
+load_hostnames_csv(const char *fname, SSLCertLookup &lookup)
 {
   std::fstream infile(fname, std::ios_base::in);
   unsigned count = 0;
@@ -157,7 +157,7 @@ load_hostnames_csv(const char * fname, SSLCertLookup& lookup)
   // with multiple names, an it's way faster to load a lot of names
   // if we don't need a new context every time.
 
-  SSL_CTX * ctx = SSL_CTX_new(SSLv23_server_method());
+  SSL_CTX *ctx = SSL_CTX_new(SSLv23_server_method());
   SSLCertContext ctx_cc(ctx);
 
   // The input should have 2 comma-separated fields; this is the format that you get when
@@ -198,12 +198,13 @@ load_hostnames_csv(const char * fname, SSLCertLookup& lookup)
 // of binary dependencies. We don't have session tickets in this test environment
 // so it's safe to do this; just a bit ugly.
 void
-SSLReleaseContext(SSL_CTX * ctx)
+SSLReleaseContext(SSL_CTX *ctx)
 {
-   SSL_CTX_free(ctx);
+  SSL_CTX_free(ctx);
 }
 
-int main(int argc, const char ** argv)
+int
+main(int argc, const char **argv)
 {
   diags = new Diags(NULL, NULL, stdout);
   res_track_memory = 1;
@@ -228,7 +229,7 @@ int main(int argc, const char ** argv)
 
   ink_freelists_dump(stdout);
 
-  // On Darwin, fail the tests if we have any memory leaks.
+// On Darwin, fail the tests if we have any memory leaks.
 #if defined(darwin)
   if (system("xcrun leaks test_certlookup") != 0) {
     RegressionTest::final_status = REGRESSION_TEST_FAILED;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/utils/I_Machine.h
----------------------------------------------------------------------
diff --git a/iocore/utils/I_Machine.h b/iocore/utils/I_Machine.h
index c2ec112..b438f62 100644
--- a/iocore/utils/I_Machine.h
+++ b/iocore/utils/I_Machine.h
@@ -49,17 +49,17 @@
 struct Machine {
   typedef Machine self; ///< Self reference type.
 
-  char *hostname;               // name of the internet host
-  int hostname_len;             // size of the string pointed to by hostname
+  char *hostname;   // name of the internet host
+  int hostname_len; // size of the string pointed to by hostname
 
-  IpEndpoint ip;      ///< Prefered IP address of the host (network order)
-  IpEndpoint ip4;     ///< IPv4 address if present.
-  IpEndpoint ip6;     ///< IPv6 address if present.
+  IpEndpoint ip;  ///< Prefered IP address of the host (network order)
+  IpEndpoint ip4; ///< IPv4 address if present.
+  IpEndpoint ip6; ///< IPv6 address if present.
 
-  ip_text_buffer ip_string;              // IP address of the host as a string.
+  ip_text_buffer ip_string; // IP address of the host as a string.
   int ip_string_len;
 
-  char ip_hex_string[TS_IP6_SIZE*2 + 1]; ///< IP address as hex string
+  char ip_hex_string[TS_IP6_SIZE * 2 + 1]; ///< IP address as hex string
   int ip_hex_string_len;
 
   ~Machine();
@@ -70,17 +70,16 @@ struct Machine {
       @note This must be called before called @c instance so that the
       singleton is not @em inadvertently default initialized.
   */
-  static self* init(
-    char const* name = 0, ///< Host name of the machine.
-    sockaddr const* addr = 0 ///< Primary IP adddress of the machine.
-  );
+  static self *init(char const *name = 0,    ///< Host name of the machine.
+                    sockaddr const *addr = 0 ///< Primary IP adddress of the machine.
+                    );
   /// @return The global instance of this class.
-  static self* instance();
+  static self *instance();
 
 protected:
-  Machine(char const* hostname, sockaddr const* addr);
+  Machine(char const *hostname, sockaddr const *addr);
 
-  static self* _instance; ///< Singleton for the class.
+  static self *_instance; ///< Singleton for the class.
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/utils/I_OneWayMultiTunnel.h
----------------------------------------------------------------------
diff --git a/iocore/utils/I_OneWayMultiTunnel.h b/iocore/utils/I_OneWayMultiTunnel.h
index 96afe3f..0be538c 100644
--- a/iocore/utils/I_OneWayMultiTunnel.h
+++ b/iocore/utils/I_OneWayMultiTunnel.h
@@ -28,13 +28,13 @@
 
  */
 
-#if !defined (_I_OneWayMultiTunnel_h_)
+#if !defined(_I_OneWayMultiTunnel_h_)
 #define _I_OneWayMultiTunnel_h_
 
 #include "I_OneWayTunnel.h"
 
 /** Maximum number which can be tunnelled too */
-#define ONE_WAY_MULTI_TUNNEL_LIMIT          4
+#define ONE_WAY_MULTI_TUNNEL_LIMIT 4
 
 /**
   A generic state machine that connects a source virtual conection to
@@ -53,8 +53,7 @@
   @see OneWayTunnel
 
 */
-struct OneWayMultiTunnel: public OneWayTunnel
-{
+struct OneWayMultiTunnel : public OneWayTunnel {
   //
   // Public Interface
   //
@@ -75,7 +74,7 @@ struct OneWayMultiTunnel: public OneWayTunnel
   */
   static void OneWayMultiTunnel_free(OneWayMultiTunnel *);
 
-    OneWayMultiTunnel();
+  OneWayMultiTunnel();
 
   // Use One of the following init functions to start the tunnel.
 
@@ -109,11 +108,10 @@ struct OneWayMultiTunnel: public OneWayTunnel
     @param water_mark for the MIOBuffer used for reading.
 
   */
-  void init(VConnection * vcSource, VConnection ** vcTargets, int n_vcTargets, Continuation * aCont = NULL, int size_estimate = 0,      // 0 == best guess
-            int64_t nbytes = TUNNEL_TILL_DONE,
-            bool asingle_buffer = true,
-            bool aclose_source = true,
-            bool aclose_target = true, Transform_fn manipulate_fn = NULL, int water_mark = 0);
+  void init(VConnection *vcSource, VConnection **vcTargets, int n_vcTargets, Continuation *aCont = NULL,
+            int size_estimate = 0, // 0 == best guess
+            int64_t nbytes = TUNNEL_TILL_DONE, bool asingle_buffer = true, bool aclose_source = true, bool aclose_target = true,
+            Transform_fn manipulate_fn = NULL, int water_mark = 0);
 
   /**
     Use this init function if both the read and the write sides have
@@ -133,7 +131,7 @@ struct OneWayMultiTunnel: public OneWayTunnel
       end. If aCont is not specified, this should be set to true.
 
   */
-  void init(Continuation * aCont, VIO * SourceVio, VIO ** TargetVios, int n_vioTargets, bool aclose_source = true,
+  void init(Continuation *aCont, VIO *SourceVio, VIO **TargetVios, int n_vioTargets, bool aclose_source = true,
             bool aclose_target = true);
 
   //
@@ -142,7 +140,7 @@ struct OneWayMultiTunnel: public OneWayTunnel
   int startEvent(int event, void *data);
 
   virtual void reenable_all();
-  virtual void close_target_vio(int result, VIO * vio = NULL);
+  virtual void close_target_vio(int result, VIO *vio = NULL);
 
   int n_vioTargets;
   VIO *vioTargets[ONE_WAY_MULTI_TUNNEL_LIMIT];

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/utils/I_OneWayTunnel.h
----------------------------------------------------------------------
diff --git a/iocore/utils/I_OneWayTunnel.h b/iocore/utils/I_OneWayTunnel.h
index 8ebaf47..479d493 100644
--- a/iocore/utils/I_OneWayTunnel.h
+++ b/iocore/utils/I_OneWayTunnel.h
@@ -28,7 +28,7 @@
 
  */
 
-#if !defined (_I_OneWayTunnel_h_)
+#if !defined(_I_OneWayTunnel_h_)
 #define _I_OneWayTunnel_h_
 
 #include "I_EventSystem.h"
@@ -39,11 +39,11 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#define TUNNEL_TILL_DONE   INT64_MAX
+#define TUNNEL_TILL_DONE INT64_MAX
 
 #define ONE_WAY_TUNNEL_CLOSE_ALL NULL
 
-typedef void (*Transform_fn) (MIOBufferAccessor & in_buf, MIOBufferAccessor & out_buf);
+typedef void (*Transform_fn)(MIOBufferAccessor &in_buf, MIOBufferAccessor &out_buf);
 
 /**
   A generic state machine that connects two virtual conections. A
@@ -62,8 +62,7 @@ typedef void (*Transform_fn) (MIOBufferAccessor & in_buf, MIOBufferAccessor & ou
   connection which it may manipulate in any manner it sees fit.
 
 */
-struct OneWayTunnel: public Continuation
-{
+struct OneWayTunnel : public Continuation {
   //
   //  Public Interface
   //
@@ -86,9 +85,9 @@ struct OneWayTunnel: public Continuation
   /** Deallocates a OneWayTunnel object. */
   static void OneWayTunnel_free(OneWayTunnel *);
 
-  static void SetupTwoWayTunnel(OneWayTunnel * east, OneWayTunnel * west);
-    OneWayTunnel();
-    virtual ~ OneWayTunnel();
+  static void SetupTwoWayTunnel(OneWayTunnel *east, OneWayTunnel *west);
+  OneWayTunnel();
+  virtual ~OneWayTunnel();
 
   // Use One of the following init functions to start the tunnel.
   /**
@@ -122,11 +121,8 @@ struct OneWayTunnel: public Continuation
     @param water_mark watermark for the MIOBuffer used for reading.
 
   */
-  void init(VConnection * vcSource, VConnection * vcTarget, Continuation * aCont = NULL, int size_estimate = 0, // 0 = best guess
-            ProxyMutex * aMutex = NULL,
-            int64_t nbytes = TUNNEL_TILL_DONE,
-            bool asingle_buffer = true,
-            bool aclose_source = true,
+  void init(VConnection *vcSource, VConnection *vcTarget, Continuation *aCont = NULL, int size_estimate = 0, // 0 = best guess
+            ProxyMutex *aMutex = NULL, int64_t nbytes = TUNNEL_TILL_DONE, bool asingle_buffer = true, bool aclose_source = true,
             bool aclose_target = true, Transform_fn manipulate_fn = NULL, int water_mark = 0);
 
   /**
@@ -152,10 +148,8 @@ struct OneWayTunnel: public Continuation
     @param aclose_target if true, the tunnel closes vcTarget at the
       end. If aCont is not specified, this should be set to true.
   */
-  void init(VConnection * vcSource,
-            VConnection * vcTarget,
-            Continuation * aCont,
-            VIO * SourceVio, IOBufferReader * reader, bool aclose_source = true, bool aclose_target = true);
+  void init(VConnection *vcSource, VConnection *vcTarget, Continuation *aCont, VIO *SourceVio, IOBufferReader *reader,
+            bool aclose_source = true, bool aclose_target = true);
 
   /**
     Use this init function if both the read and the write sides have
@@ -174,23 +168,21 @@ struct OneWayTunnel: public Continuation
       end. If aCont is not specified, this should be set to true.
 
     */
-  void init(Continuation * aCont,
-            VIO * SourceVio, VIO * TargetVio, bool aclose_source = true, bool aclose_target = true);
+  void init(Continuation *aCont, VIO *SourceVio, VIO *TargetVio, bool aclose_source = true, bool aclose_target = true);
 
   //
   // Private
   //
-    OneWayTunnel(Continuation * aCont,
-                 Transform_fn manipulate_fn = NULL, bool aclose_source = false, bool aclose_target = false);
+  OneWayTunnel(Continuation *aCont, Transform_fn manipulate_fn = NULL, bool aclose_source = false, bool aclose_target = false);
 
   int startEvent(int event, void *data);
 
-  virtual void transform(MIOBufferAccessor & in_buf, MIOBufferAccessor & out_buf);
+  virtual void transform(MIOBufferAccessor &in_buf, MIOBufferAccessor &out_buf);
 
   /** Result is -1 for any error. */
   void close_source_vio(int result);
 
-  virtual void close_target_vio(int result, VIO * vio = ONE_WAY_TUNNEL_CLOSE_ALL);
+  virtual void close_target_vio(int result, VIO *vio = ONE_WAY_TUNNEL_CLOSE_ALL);
 
   void connection_closed(int result);
 
@@ -215,9 +207,8 @@ struct OneWayTunnel: public Continuation
   bool free_vcs;
 
 private:
-    OneWayTunnel(const OneWayTunnel &);
-    OneWayTunnel & operator =(const OneWayTunnel &);
-
+  OneWayTunnel(const OneWayTunnel &);
+  OneWayTunnel &operator=(const OneWayTunnel &);
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/utils/Machine.cc
----------------------------------------------------------------------
diff --git a/iocore/utils/Machine.cc b/iocore/utils/Machine.cc
index 756d3a3..7d3ace1 100644
--- a/iocore/utils/Machine.cc
+++ b/iocore/utils/Machine.cc
@@ -25,29 +25,29 @@
 #include "I_Machine.h"
 
 #if HAVE_IFADDRS_H
-#  include <ifaddrs.h>
+#include <ifaddrs.h>
 #endif
 
 // Singleton
-Machine* Machine::_instance = NULL;
+Machine *Machine::_instance = NULL;
 
-Machine*
-Machine::instance() {
+Machine *
+Machine::instance()
+{
   ink_assert(_instance || !"Machine instance accessed before initialization");
   return Machine::_instance;
 }
 
-Machine*
-Machine::init(char const* name, sockaddr const* ip) {
+Machine *
+Machine::init(char const *name, sockaddr const *ip)
+{
   ink_assert(!_instance || !"Machine instance initialized twice.");
   Machine::_instance = new Machine(name, ip);
   return Machine::_instance;
 }
 
-Machine::Machine(char const* the_hostname, sockaddr const* addr)
-  : hostname(0), hostname_len(0)
-  , ip_string_len(0)
-  , ip_hex_string_len(0)
+Machine::Machine(char const *the_hostname, sockaddr const *addr)
+  : hostname(0), hostname_len(0), ip_string_len(0), ip_hex_string_len(0)
 {
   char localhost[1024];
   int status; // return for system calls.
@@ -58,41 +58,38 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
   ink_zero(ip4);
   ink_zero(ip6);
 
-  localhost[sizeof(localhost)-1] = 0; // ensure termination.
+  localhost[sizeof(localhost) - 1] = 0; // ensure termination.
 
   if (!ats_is_ip(addr)) {
     if (!the_hostname) {
-      ink_release_assert(!gethostname(localhost, sizeof(localhost)-1));
+      ink_release_assert(!gethostname(localhost, sizeof(localhost) - 1));
       the_hostname = localhost;
     }
     hostname = ats_strdup(the_hostname);
 
 #if HAVE_IFADDRS_H
-      ifaddrs* ifa_addrs = 0;
-      status = getifaddrs(&ifa_addrs);
+    ifaddrs *ifa_addrs = 0;
+    status = getifaddrs(&ifa_addrs);
 #else
-      int s = socket(AF_INET, SOCK_DGRAM, 0);
-      // This number is hard to determine, but needs to be much larger than
-      // you would expect. On a normal system with just two interfaces and
-      // one address / interface the return count is 120. Stack space is
-      // cheap so it's best to go big.
-      static const int N_REQ = 1024;
-      ifconf conf;
-      ifreq req[N_REQ];
-      if (0 <= s) {
-        conf.ifc_len = sizeof(req);
-        conf.ifc_req = req;
-        status = ioctl(s, SIOCGIFCONF, &conf);
-      } else {
-        status = -1;
-      }
+    int s = socket(AF_INET, SOCK_DGRAM, 0);
+    // This number is hard to determine, but needs to be much larger than
+    // you would expect. On a normal system with just two interfaces and
+    // one address / interface the return count is 120. Stack space is
+    // cheap so it's best to go big.
+    static const int N_REQ = 1024;
+    ifconf conf;
+    ifreq req[N_REQ];
+    if (0 <= s) {
+      conf.ifc_len = sizeof(req);
+      conf.ifc_req = req;
+      status = ioctl(s, SIOCGIFCONF, &conf);
+    } else {
+      status = -1;
+    }
 #endif
 
     if (0 != status) {
-      Warning("Unable to determine local host '%s' address information - %s"
-        , hostname
-        , strerror(errno)
-      );
+      Warning("Unable to determine local host '%s' address information - %s", hostname, strerror(errno));
     } else {
       // Loop through the interface addresses and prefer by type.
       enum {
@@ -102,16 +99,17 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
         PR, // Private.
         MC, // Multicast.
         GL  // Global.
-      } spot_type = NA, ip4_type = NA, ip6_type = NA;
-      sockaddr const* ifip;
+      } spot_type = NA,
+        ip4_type = NA, ip6_type = NA;
+      sockaddr const *ifip;
       unsigned int ifflags;
       for (
 #if HAVE_IFADDRS_H
-        ifaddrs* spot = ifa_addrs ; spot ; spot = spot->ifa_next
+        ifaddrs *spot = ifa_addrs; spot; spot = spot->ifa_next
 #else
-          ifreq* spot = req, *req_limit = req + (conf.ifc_len/sizeof(*req)) ; spot < req_limit ; ++spot
+        ifreq *spot = req, *req_limit = req + (conf.ifc_len / sizeof(*req)); spot < req_limit; ++spot
 #endif
-      ) {
+        ) {
 #if HAVE_IFADDRS_H
         ifip = spot->ifa_addr;
         ifflags = spot->ifa_flags;
@@ -121,16 +119,25 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
         // get the interface's flags
         struct ifreq ifr;
         ink_strlcpy(ifr.ifr_name, spot->ifr_name, IFNAMSIZ);
-        if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0)   ifflags = ifr.ifr_flags;
-        else ifflags = 0; // flags not available, default to just looking at IP
+        if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0)
+          ifflags = ifr.ifr_flags;
+        else
+          ifflags = 0; // flags not available, default to just looking at IP
 #endif
-        if (!ats_is_ip(ifip)) spot_type = NA;
-        else if (ats_is_ip_loopback(ifip) || (IFF_LOOPBACK & ifflags)) spot_type = LO;
-        else if (ats_is_ip_linklocal(ifip)) spot_type = LL;
-        else if (ats_is_ip_private(ifip)) spot_type = PR;
-        else if (ats_is_ip_multicast(ifip)) spot_type = MC;
-        else spot_type = GL;
-        if (spot_type == NA) continue; // Next!
+        if (!ats_is_ip(ifip))
+          spot_type = NA;
+        else if (ats_is_ip_loopback(ifip) || (IFF_LOOPBACK & ifflags))
+          spot_type = LO;
+        else if (ats_is_ip_linklocal(ifip))
+          spot_type = LL;
+        else if (ats_is_ip_private(ifip))
+          spot_type = PR;
+        else if (ats_is_ip_multicast(ifip))
+          spot_type = MC;
+        else
+          spot_type = GL;
+        if (spot_type == NA)
+          continue; // Next!
 
         if (ats_is_ip4(ifip)) {
           if (spot_type > ip4_type) {
@@ -155,27 +162,23 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
       else
         ats_ip_copy(&ip.sa, &ip6.sa);
     }
-#if ! HAVE_IFADDRS_H
+#if !HAVE_IFADDRS_H
     close(s);
 #endif
   } else { // address provided.
     ats_ip_copy(&ip, addr);
-    if (ats_is_ip4(addr)) ats_ip_copy(&ip4, addr);
-    else if (ats_is_ip6(addr)) ats_ip_copy(&ip6, addr);
+    if (ats_is_ip4(addr))
+      ats_ip_copy(&ip4, addr);
+    else if (ats_is_ip6(addr))
+      ats_ip_copy(&ip6, addr);
 
-    status = getnameinfo(
-      addr, ats_ip_size(addr),
-      localhost, sizeof(localhost) - 1,
-      0, 0, // do not request service info
-      0 // no flags.
-    );
+    status = getnameinfo(addr, ats_ip_size(addr), localhost, sizeof(localhost) - 1, 0, 0, // do not request service info
+                         0                                                                // no flags.
+                         );
 
     if (0 != status) {
       ip_text_buffer ipbuff;
-      Warning("Failed to find hostname for address '%s' - %s"
-        , ats_ip_ntop(addr, ipbuff, sizeof(ipbuff))
-        , gai_strerror(status)
-      );
+      Warning("Failed to find hostname for address '%s' - %s", ats_ip_ntop(addr, ipbuff, sizeof(ipbuff)), gai_strerror(status));
     } else
       hostname = ats_strdup(localhost);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/utils/OneWayMultiTunnel.cc
----------------------------------------------------------------------
diff --git a/iocore/utils/OneWayMultiTunnel.cc b/iocore/utils/OneWayMultiTunnel.cc
index 549f51d..fc28305 100644
--- a/iocore/utils/OneWayMultiTunnel.cc
+++ b/iocore/utils/OneWayMultiTunnel.cc
@@ -39,8 +39,7 @@
 
 ClassAllocator<OneWayMultiTunnel> OneWayMultiTunnelAllocator("OneWayMultiTunnelAllocator");
 
-OneWayMultiTunnel::OneWayMultiTunnel():
-OneWayTunnel(), n_vioTargets(0), source_read_previously_completed(false)
+OneWayMultiTunnel::OneWayMultiTunnel() : OneWayTunnel(), n_vioTargets(0), source_read_previously_completed(false)
 {
 }
 
@@ -51,20 +50,20 @@ OneWayMultiTunnel::OneWayMultiTunnel_alloc()
 }
 
 void
-OneWayMultiTunnel::OneWayMultiTunnel_free(OneWayMultiTunnel * pOWT)
+OneWayMultiTunnel::OneWayMultiTunnel_free(OneWayMultiTunnel *pOWT)
 {
-
   pOWT->mutex = NULL;
   OneWayMultiTunnelAllocator.free(pOWT);
 }
 
 void
-OneWayMultiTunnel::init(VConnection * vcSource, VConnection ** vcTargets, int n_vcTargets, Continuation * aCont, int size_estimate, int64_t nbytes, bool asingle_buffer,    /* = true */
-                        bool aclose_source,     /* = false */
-                        bool aclose_targets,    /* = false */
+OneWayMultiTunnel::init(VConnection *vcSource, VConnection **vcTargets, int n_vcTargets, Continuation *aCont, int size_estimate,
+                        int64_t nbytes, bool asingle_buffer, /* = true */
+                        bool aclose_source,                  /* = false */
+                        bool aclose_targets,                 /* = false */
                         Transform_fn aManipulate_fn, int water_mark)
 {
-  mutex = aCont ? (ProxyMutex *) aCont->mutex : new_ProxyMutex();
+  mutex = aCont ? (ProxyMutex *)aCont->mutex : new_ProxyMutex();
   cont = aCont;
   manipulate_fn = aManipulate_fn;
   close_source = aclose_source;
@@ -106,15 +105,15 @@ OneWayMultiTunnel::init(VConnection * vcSource, VConnection ** vcTargets, int n_
 }
 
 void
-OneWayMultiTunnel::init(Continuation * aCont,
-                        VIO * SourceVio, VIO ** TargetVios, int n_TargetVios, bool aclose_source, bool aclose_targets)
+OneWayMultiTunnel::init(Continuation *aCont, VIO *SourceVio, VIO **TargetVios, int n_TargetVios, bool aclose_source,
+                        bool aclose_targets)
 {
-
-  mutex = aCont ? (ProxyMutex *) aCont->mutex : new_ProxyMutex();
+  mutex = aCont ? (ProxyMutex *)aCont->mutex : new_ProxyMutex();
   cont = aCont;
   single_buffer = true;
   manipulate_fn = 0;
-  n_connections = n_TargetVios + 1;;
+  n_connections = n_TargetVios + 1;
+  ;
   close_source = aclose_source;
   close_target = aclose_targets;
   // The read on the source vio may have already been completed, yet
@@ -136,7 +135,6 @@ OneWayMultiTunnel::init(Continuation * aCont,
     vioTargets[i] = TargetVios[i];
     vioTargets[i]->set_continuation(this);
   }
-
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -148,7 +146,7 @@ OneWayMultiTunnel::init(Continuation * aCont,
 int
 OneWayMultiTunnel::startEvent(int event, void *data)
 {
-  VIO *vio = (VIO *) data;
+  VIO *vio = (VIO *)data;
   int ret = VC_EVENT_DONE;
   int result = 0;
 
@@ -160,15 +158,14 @@ OneWayMultiTunnel::startEvent(int event, void *data)
   // handle the event
   //
   switch (event) {
-
-  case VC_EVENT_READ_READY:{   // SunCC uses old scoping rules
-      transform(vioSource->buffer, topOutBuffer);
-      for (int i = 0; i < n_vioTargets; i++)
-        if (vioTargets[i])
-          vioTargets[i]->reenable();
-      ret = VC_EVENT_CONT;
-      break;
-    }
+  case VC_EVENT_READ_READY: { // SunCC uses old scoping rules
+    transform(vioSource->buffer, topOutBuffer);
+    for (int i = 0; i < n_vioTargets; i++)
+      if (vioTargets[i])
+        vioTargets[i]->reenable();
+    ret = VC_EVENT_CONT;
+    break;
+  }
 
   case VC_EVENT_WRITE_READY:
     if (vioSource)
@@ -186,22 +183,22 @@ OneWayMultiTunnel::startEvent(int event, void *data)
       goto Lwrite_complete;
 
   Lread_complete:
-  case VC_EVENT_READ_COMPLETE:{// SunCC uses old scoping rules
-      // set write nbytes to the current buffer size
-      //
-      for (int i = 0; i < n_vioTargets; i++)
-        if (vioTargets[i]) {
-          vioTargets[i]->nbytes = vioTargets[i]->ndone + vioTargets[i]->buffer.reader()->read_avail();
-          vioTargets[i]->reenable();
-        }
-      close_source_vio(0);
-      ret = VC_EVENT_DONE;
-      break;
-    }
+  case VC_EVENT_READ_COMPLETE: { // SunCC uses old scoping rules
+    // set write nbytes to the current buffer size
+    //
+    for (int i = 0; i < n_vioTargets; i++)
+      if (vioTargets[i]) {
+        vioTargets[i]->nbytes = vioTargets[i]->ndone + vioTargets[i]->buffer.reader()->read_avail();
+        vioTargets[i]->reenable();
+      }
+    close_source_vio(0);
+    ret = VC_EVENT_DONE;
+    break;
+  }
 
   Lwrite_complete:
   case VC_EVENT_WRITE_COMPLETE:
-    close_target_vio(0, (VIO *) data);
+    close_target_vio(0, (VIO *)data);
     if ((n_connections == 0) || (n_connections == 1 && source_read_previously_completed))
       goto Ldone;
     else if (vioSource)
@@ -230,7 +227,7 @@ OneWayMultiTunnel::startEvent(int event, void *data)
 }
 
 void
-OneWayMultiTunnel::close_target_vio(int result, VIO * vio)
+OneWayMultiTunnel::close_target_vio(int result, VIO *vio)
 {
   for (int i = 0; i < n_vioTargets; i++) {
     VIO *v = vioTargets[i];

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/utils/OneWayTunnel.cc
----------------------------------------------------------------------
diff --git a/iocore/utils/OneWayTunnel.cc b/iocore/utils/OneWayTunnel.cc
index efe5011..1be18d6 100644
--- a/iocore/utils/OneWayTunnel.cc
+++ b/iocore/utils/OneWayTunnel.cc
@@ -46,7 +46,7 @@
 ClassAllocator<OneWayTunnel> OneWayTunnelAllocator("OneWayTunnelAllocator");
 
 inline void
-transfer_data(MIOBufferAccessor & in_buf, MIOBufferAccessor & out_buf)
+transfer_data(MIOBufferAccessor &in_buf, MIOBufferAccessor &out_buf)
 {
   ink_release_assert(!"Not Implemented.");
 
@@ -62,10 +62,9 @@ transfer_data(MIOBufferAccessor & in_buf, MIOBufferAccessor & out_buf)
   out_buf.writer()->fill(n);
 }
 
-OneWayTunnel::OneWayTunnel():Continuation(0),
-vioSource(0), vioTarget(0), cont(0), manipulate_fn(0),
-n_connections(0), lerrno(0), single_buffer(0),
-close_source(0), close_target(0), tunnel_till_done(0), tunnel_peer(0), free_vcs(true)
+OneWayTunnel::OneWayTunnel()
+  : Continuation(0), vioSource(0), vioTarget(0), cont(0), manipulate_fn(0), n_connections(0), lerrno(0), single_buffer(0),
+    close_source(0), close_target(0), tunnel_till_done(0), tunnel_peer(0), free_vcs(true)
 {
 }
 
@@ -76,17 +75,16 @@ OneWayTunnel::OneWayTunnel_alloc()
 }
 
 void
-OneWayTunnel::OneWayTunnel_free(OneWayTunnel * pOWT)
+OneWayTunnel::OneWayTunnel_free(OneWayTunnel *pOWT)
 {
-
   pOWT->mutex = NULL;
   OneWayTunnelAllocator.free(pOWT);
 }
 
 void
-OneWayTunnel::SetupTwoWayTunnel(OneWayTunnel * east, OneWayTunnel * west)
+OneWayTunnel::SetupTwoWayTunnel(OneWayTunnel *east, OneWayTunnel *west)
 {
-  //make sure the both use the same mutex
+  // make sure the both use the same mutex
   ink_assert(east->mutex == west->mutex);
 
   east->tunnel_peer = west;
@@ -97,31 +95,20 @@ OneWayTunnel::~OneWayTunnel()
 {
 }
 
-OneWayTunnel::OneWayTunnel(Continuation * aCont, Transform_fn aManipulate_fn, bool aclose_source, bool aclose_target)
-:
-Continuation(aCont
-             ? (ProxyMutex *) aCont->mutex
-             : new_ProxyMutex()),
-cont(aCont),
-manipulate_fn(aManipulate_fn),
-n_connections(2),
-lerrno(0),
-single_buffer(true), close_source(aclose_source), close_target(aclose_target), tunnel_till_done(false), free_vcs(false)
+OneWayTunnel::OneWayTunnel(Continuation *aCont, Transform_fn aManipulate_fn, bool aclose_source, bool aclose_target)
+  : Continuation(aCont ? (ProxyMutex *)aCont->mutex : new_ProxyMutex()), cont(aCont), manipulate_fn(aManipulate_fn),
+    n_connections(2), lerrno(0), single_buffer(true), close_source(aclose_source), close_target(aclose_target),
+    tunnel_till_done(false), free_vcs(false)
 {
   ink_assert(!"This form of OneWayTunnel() constructor not supported");
 }
 
 void
-OneWayTunnel::init(VConnection * vcSource,
-                   VConnection * vcTarget,
-                   Continuation * aCont,
-                   int size_estimate,
-                   ProxyMutex * aMutex,
-                   int64_t nbytes,
-                   bool asingle_buffer,
-                   bool aclose_source, bool aclose_target, Transform_fn aManipulate_fn, int water_mark)
+OneWayTunnel::init(VConnection *vcSource, VConnection *vcTarget, Continuation *aCont, int size_estimate, ProxyMutex *aMutex,
+                   int64_t nbytes, bool asingle_buffer, bool aclose_source, bool aclose_target, Transform_fn aManipulate_fn,
+                   int water_mark)
 {
-  mutex = aCont ? (ProxyMutex *) aCont->mutex : (aMutex ? aMutex : new_ProxyMutex());
+  mutex = aCont ? (ProxyMutex *)aCont->mutex : (aMutex ? aMutex : new_ProxyMutex());
   cont = aMutex ? NULL : aCont;
   single_buffer = asingle_buffer;
   manipulate_fn = aManipulate_fn;
@@ -140,7 +127,7 @@ OneWayTunnel::init(VConnection * vcSource,
   else
     size_index = default_large_iobuffer_size;
 
-  Debug("one_way_tunnel", "buffer size index [%" PRId64"] [%d]\n", size_index, size_estimate);
+  Debug("one_way_tunnel", "buffer size index [%" PRId64 "] [%d]\n", size_index, size_estimate);
 
   // enqueue read request on vcSource.
   MIOBuffer *buf1 = new_MIOBuffer(size_index);
@@ -161,13 +148,11 @@ OneWayTunnel::init(VConnection * vcSource,
 }
 
 void
-OneWayTunnel::init(VConnection * vcSource,
-                   VConnection * vcTarget,
-                   Continuation * aCont,
-                   VIO * SourceVio, IOBufferReader * reader, bool aclose_source, bool aclose_target)
+OneWayTunnel::init(VConnection *vcSource, VConnection *vcTarget, Continuation *aCont, VIO *SourceVio, IOBufferReader *reader,
+                   bool aclose_source, bool aclose_target)
 {
-  (void) vcSource;
-  mutex = aCont ? (ProxyMutex *) aCont->mutex : new_ProxyMutex();
+  (void)vcSource;
+  mutex = aCont ? (ProxyMutex *)aCont->mutex : new_ProxyMutex();
   cont = aCont;
   single_buffer = true;
   manipulate_fn = 0;
@@ -191,9 +176,9 @@ OneWayTunnel::init(VConnection * vcSource,
 }
 
 void
-OneWayTunnel::init(Continuation * aCont, VIO * SourceVio, VIO * TargetVio, bool aclose_source, bool aclose_target)
+OneWayTunnel::init(Continuation *aCont, VIO *SourceVio, VIO *TargetVio, bool aclose_source, bool aclose_target)
 {
-  mutex = aCont ? (ProxyMutex *) aCont->mutex : new_ProxyMutex();
+  mutex = aCont ? (ProxyMutex *)aCont->mutex : new_ProxyMutex();
   cont = aCont;
   single_buffer = true;
   manipulate_fn = 0;
@@ -216,7 +201,7 @@ OneWayTunnel::init(Continuation * aCont, VIO * SourceVio, VIO * TargetVio, bool
 
 
 void
-OneWayTunnel::transform(MIOBufferAccessor & in_buf, MIOBufferAccessor & out_buf)
+OneWayTunnel::transform(MIOBufferAccessor &in_buf, MIOBufferAccessor &out_buf)
 {
   if (manipulate_fn)
     manipulate_fn(in_buf, out_buf);
@@ -236,7 +221,7 @@ OneWayTunnel::transform(MIOBufferAccessor & in_buf, MIOBufferAccessor & out_buf)
 int
 OneWayTunnel::startEvent(int event, void *data)
 {
-  VIO *vio = (VIO *) data;
+  VIO *vio = (VIO *)data;
   int ret = VC_EVENT_DONE;
   int result = 0;
 
@@ -251,7 +236,6 @@ OneWayTunnel::startEvent(int event, void *data)
   // handle the event
   //
   switch (event) {
-
   case ONE_WAY_TUNNEL_EVENT_PEER_CLOSE:
     /* This event is sent out by our peer */
     ink_assert(tunnel_peer);
@@ -294,14 +278,14 @@ OneWayTunnel::startEvent(int event, void *data)
 
   Lerror:
   case VC_EVENT_ERROR:
-    lerrno = ((VIO *) data)->vc_server->lerrno;
+    lerrno = ((VIO *)data)->vc_server->lerrno;
   case VC_EVENT_INACTIVITY_TIMEOUT:
   case VC_EVENT_ACTIVE_TIMEOUT:
     result = -1;
   Ldone:
   case VC_EVENT_WRITE_COMPLETE:
     if (tunnel_peer) {
-      //inform the peer:
+      // inform the peer:
       tunnel_peer->startEvent(ONE_WAY_TUNNEL_EVENT_PEER_CLOSE, data);
     }
     close_source_vio(result);
@@ -324,7 +308,6 @@ OneWayTunnel::startEvent(int event, void *data)
 void
 OneWayTunnel::close_source_vio(int result)
 {
-
   if (vioSource) {
     if (last_connection() || !single_buffer) {
       free_MIOBuffer(vioSource->buffer.writer());
@@ -339,10 +322,9 @@ OneWayTunnel::close_source_vio(int result)
 }
 
 void
-OneWayTunnel::close_target_vio(int result, VIO * vio)
+OneWayTunnel::close_target_vio(int result, VIO *vio)
 {
-
-  (void) vio;
+  (void)vio;
   if (vioTarget) {
     if (last_connection() || !single_buffer) {
       free_MIOBuffer(vioTarget->buffer.writer());


[17/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecFile.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecFile.cc b/lib/records/RecFile.cc
index 669ec59..ba254de 100644
--- a/lib/records/RecFile.cc
+++ b/lib/records/RecFile.cc
@@ -34,7 +34,7 @@ RecHandle
 RecFileOpenR(const char *file)
 {
   RecHandle h_file;
-  return ((h_file =::open(file, O_RDONLY)) < 0) ? REC_HANDLE_INVALID : h_file;
+  return ((h_file = ::open(file, O_RDONLY)) < 0) ? REC_HANDLE_INVALID : h_file;
 }
 
 //-------------------------------------------------------------------------
@@ -46,7 +46,7 @@ RecFileOpenW(const char *file)
 {
   RecHandle h_file;
 
-  if ((h_file =::open(file, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0) {
+  if ((h_file = ::open(file, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0) {
     return REC_HANDLE_INVALID;
   }
   fcntl(h_file, F_SETFD, 1);
@@ -57,7 +57,8 @@ RecFileOpenW(const char *file)
 // RecFileSync
 //-------------------------------------------------------------------------
 
-int RecFileSync(RecHandle h_file)
+int
+RecFileSync(RecHandle h_file)
 {
   return (fsync(h_file) == 0) ? REC_ERR_OKAY : REC_ERR_FAIL;
 }
@@ -79,7 +80,7 @@ RecFileClose(RecHandle h_file)
 int
 RecFileRead(RecHandle h_file, char *buf, int size, int *bytes_read)
 {
-  if ((*bytes_read =::read(h_file, buf, size)) <= 0) {
+  if ((*bytes_read = ::read(h_file, buf, size)) <= 0) {
     *bytes_read = 0;
     return REC_ERR_FAIL;
   }
@@ -93,7 +94,7 @@ RecFileRead(RecHandle h_file, char *buf, int size, int *bytes_read)
 int
 RecFileWrite(RecHandle h_file, char *buf, int size, int *bytes_written)
 {
-  if ((*bytes_written =::write(h_file, buf, size)) < 0) {
+  if ((*bytes_written = ::write(h_file, buf, size)) < 0) {
     *bytes_written = 0;
     return REC_ERR_FAIL;
   }
@@ -109,7 +110,7 @@ RecFileGetSize(RecHandle h_file)
 {
   struct stat fileStats;
   fstat(h_file, &fileStats);
-  return (int) fileStats.st_size;
+  return (int)fileStats.st_size;
 }
 
 //-------------------------------------------------------------------------
@@ -125,7 +126,6 @@ RecFileExists(const char *file)
   }
   RecFileClose(h_file);
   return REC_ERR_OKAY;
-
 }
 
 //-------------------------------------------------------------------------
@@ -135,7 +135,6 @@ RecFileExists(const char *file)
 RecHandle
 RecPipeCreate(const char *base_path, const char *name)
 {
-
   RecHandle listenfd;
   RecHandle acceptfd;
   struct sockaddr_un servaddr;
@@ -177,14 +176,14 @@ RecPipeCreate(const char *base_path, const char *name)
   ink_strlcpy(servaddr.sun_path, path, sizeof(servaddr.sun_path));
 
   int optval = 1;
-  if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *) &optval, sizeof(int)) < 0) {
+  if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(int)) < 0) {
     RecLog(DL_Warning, "[RecPipeCreate] setsockopt error\n");
     close(listenfd);
     return REC_HANDLE_INVALID;
   }
 
   servaddr_len = sizeof(servaddr.sun_family) + strlen(servaddr.sun_path);
-  if ((bind(listenfd, (struct sockaddr *) &servaddr, servaddr_len)) < 0) {
+  if ((bind(listenfd, (struct sockaddr *)&servaddr, servaddr_len)) < 0) {
     RecLog(DL_Warning, "[RecPipeCreate] bind error\n");
     close(listenfd);
     return REC_HANDLE_INVALID;
@@ -197,8 +196,7 @@ RecPipeCreate(const char *base_path, const char *name)
   }
   // block until we get a connection from the other side
   cliaddr_len = sizeof(cliaddr);
-  if ((acceptfd = accept(listenfd, (struct sockaddr *) &cliaddr,
-                         &cliaddr_len)) < 0) {
+  if ((acceptfd = accept(listenfd, (struct sockaddr *)&cliaddr, &cliaddr_len)) < 0) {
     close(listenfd);
     return REC_HANDLE_INVALID;
   }
@@ -215,7 +213,6 @@ RecPipeCreate(const char *base_path, const char *name)
 RecHandle
 RecPipeConnect(const char *base_path, const char *name)
 {
-
   RecHandle sockfd;
   struct sockaddr_un servaddr;
   int servaddr_len;
@@ -228,7 +225,7 @@ RecPipeConnect(const char *base_path, const char *name)
     return REC_HANDLE_INVALID;
   }
   // Setup Connection to LocalManager */
-  memset((char *) &servaddr, 0, sizeof(servaddr));
+  memset((char *)&servaddr, 0, sizeof(servaddr));
   servaddr.sun_family = AF_UNIX;
   ink_strlcpy(servaddr.sun_path, path, sizeof(servaddr.sun_path));
   servaddr_len = sizeof(servaddr.sun_family) + strlen(servaddr.sun_path);
@@ -244,7 +241,7 @@ RecPipeConnect(const char *base_path, const char *name)
     return REC_HANDLE_INVALID;
   }
   // blocking connect
-  if ((connect(sockfd, (struct sockaddr *) &servaddr, servaddr_len)) < 0) {
+  if ((connect(sockfd, (struct sockaddr *)&servaddr, servaddr_len)) < 0) {
     RecLog(DL_Warning, "[RecPipeConnect] connect error\n");
     close(sockfd);
     return REC_HANDLE_INVALID;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecHttp.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecHttp.cc b/lib/records/RecHttp.cc
index af72e46..2854813 100644
--- a/lib/records/RecHttp.cc
+++ b/lib/records/RecHttp.cc
@@ -21,11 +21,11 @@
   limitations under the License.
 */
 
-# include <records/I_RecCore.h>
-# include <records/I_RecHttp.h>
-# include <ts/ink_defs.h>
-# include <ts/Tokenizer.h>
-# include <strings.h>
+#include <records/I_RecCore.h>
+#include <records/I_RecHttp.h>
+#include <ts/ink_defs.h>
+#include <ts/Tokenizer.h>
+#include <strings.h>
 
 SessionProtocolNameRegistry globalSessionProtocolNameRegistry;
 
@@ -33,19 +33,19 @@ SessionProtocolNameRegistry globalSessionProtocolNameRegistry;
    These are also used for NPN setup.
 */
 
-const char * const TS_NPN_PROTOCOL_HTTP_0_9 = "http/0.9";
-const char * const TS_NPN_PROTOCOL_HTTP_1_0 = "http/1.0";
-const char * const TS_NPN_PROTOCOL_HTTP_1_1 = "http/1.1";
-const char * const TS_NPN_PROTOCOL_HTTP_2_0_14 = "h2-14"; // Last H2 interrop draft. TODO: Should be removed later
-const char * const TS_NPN_PROTOCOL_HTTP_2_0 = "h2"; // HTTP/2 over TLS
-const char * const TS_NPN_PROTOCOL_SPDY_1   = "spdy/1";   // obsolete
-const char * const TS_NPN_PROTOCOL_SPDY_2   = "spdy/2";
-const char * const TS_NPN_PROTOCOL_SPDY_3   = "spdy/3";
-const char * const TS_NPN_PROTOCOL_SPDY_3_1 = "spdy/3.1";
+const char *const TS_NPN_PROTOCOL_HTTP_0_9 = "http/0.9";
+const char *const TS_NPN_PROTOCOL_HTTP_1_0 = "http/1.0";
+const char *const TS_NPN_PROTOCOL_HTTP_1_1 = "http/1.1";
+const char *const TS_NPN_PROTOCOL_HTTP_2_0_14 = "h2-14"; // Last H2 interrop draft. TODO: Should be removed later
+const char *const TS_NPN_PROTOCOL_HTTP_2_0 = "h2";       // HTTP/2 over TLS
+const char *const TS_NPN_PROTOCOL_SPDY_1 = "spdy/1";     // obsolete
+const char *const TS_NPN_PROTOCOL_SPDY_2 = "spdy/2";
+const char *const TS_NPN_PROTOCOL_SPDY_3 = "spdy/3";
+const char *const TS_NPN_PROTOCOL_SPDY_3_1 = "spdy/3.1";
 
-const char * const TS_NPN_PROTOCOL_GROUP_HTTP = "http";
-const char * const TS_NPN_PROTOCOL_GROUP_HTTP2 = "http2";
-const char * const TS_NPN_PROTOCOL_GROUP_SPDY = "spdy";
+const char *const TS_NPN_PROTOCOL_GROUP_HTTP = "http";
+const char *const TS_NPN_PROTOCOL_GROUP_HTTP2 = "http2";
+const char *const TS_NPN_PROTOCOL_GROUP_SPDY = "spdy";
 
 // Precomputed indices for ease of use.
 int TS_NPN_PROTOCOL_INDEX_HTTP_0_9 = SessionProtocolNameRegistry::INVALID;
@@ -64,7 +64,8 @@ SessionProtocolSet HTTP2_PROTOCOL_SET;
 SessionProtocolSet DEFAULT_NON_TLS_SESSION_PROTOCOL_SET;
 SessionProtocolSet DEFAULT_TLS_SESSION_PROTOCOL_SET;
 
-void RecHttpLoadIp(char const* value_name, IpAddr& ip4, IpAddr& ip6)
+void
+RecHttpLoadIp(char const *value_name, IpAddr &ip4, IpAddr &ip6)
 {
   char value[1024];
   ip4.invalidate();
@@ -72,19 +73,23 @@ void RecHttpLoadIp(char const* value_name, IpAddr& ip4, IpAddr& ip6)
   if (REC_ERR_OKAY == RecGetRecordString(value_name, value, sizeof(value))) {
     Tokenizer tokens(", ");
     int n_addrs = tokens.Initialize(value);
-    for (int i = 0 ; i < n_addrs ; ++i ) {
-      char const* host = tokens[i];
+    for (int i = 0; i < n_addrs; ++i) {
+      char const *host = tokens[i];
       IpEndpoint tmp4, tmp6;
       // For backwards compatibility we need to support the use of host names
       // for the address to bind.
       if (0 == ats_ip_getbestaddrinfo(host, &tmp4, &tmp6)) {
         if (ats_is_ip4(&tmp4)) {
-          if (!ip4.isValid()) ip4 = tmp4;
-          else Warning("'%s' specifies more than one IPv4 address, ignoring %s.", value_name, host);
+          if (!ip4.isValid())
+            ip4 = tmp4;
+          else
+            Warning("'%s' specifies more than one IPv4 address, ignoring %s.", value_name, host);
         }
         if (ats_is_ip6(&tmp6)) {
-          if (!ip6.isValid()) ip6 = tmp6;
-          else Warning("'%s' specifies more than one IPv6 address, ignoring %s.", value_name, host);
+          if (!ip6.isValid())
+            ip6 = tmp6;
+          else
+            Warning("'%s' specifies more than one IPv6 address, ignoring %s.", value_name, host);
         }
       } else {
         Warning("'%s' has an value '%s' that is not recognized as an IP address, ignored.", value_name, host);
@@ -94,110 +99,118 @@ void RecHttpLoadIp(char const* value_name, IpAddr& ip4, IpAddr& ip6)
 }
 
 
-char const* const HttpProxyPort::DEFAULT_VALUE = "8080";
+char const *const HttpProxyPort::DEFAULT_VALUE = "8080";
 
-char const* const HttpProxyPort::PORTS_CONFIG_NAME = "proxy.config.http.server_ports";
+char const *const HttpProxyPort::PORTS_CONFIG_NAME = "proxy.config.http.server_ports";
 
 // "_PREFIX" means the option contains additional data.
 // Each has a corresponding _LEN value that is the length of the option text.
 // Options without _PREFIX are just flags with no additional data.
 
-char const* const HttpProxyPort::OPT_FD_PREFIX = "fd";
-char const* const HttpProxyPort::OPT_OUTBOUND_IP_PREFIX = "ip-out";
-char const* const HttpProxyPort::OPT_INBOUND_IP_PREFIX = "ip-in";
-char const* const HttpProxyPort::OPT_HOST_RES_PREFIX = "ip-resolve";
-char const* const HttpProxyPort::OPT_PROTO_PREFIX = "proto";
-
-char const* const HttpProxyPort::OPT_IPV6 = "ipv6";
-char const* const HttpProxyPort::OPT_IPV4 = "ipv4";
-char const* const HttpProxyPort::OPT_TRANSPARENT_INBOUND = "tr-in";
-char const* const HttpProxyPort::OPT_TRANSPARENT_OUTBOUND = "tr-out";
-char const* const HttpProxyPort::OPT_TRANSPARENT_FULL = "tr-full";
-char const* const HttpProxyPort::OPT_TRANSPARENT_PASSTHROUGH = "tr-pass";
-char const* const HttpProxyPort::OPT_SSL = "ssl";
-char const* const HttpProxyPort::OPT_PLUGIN = "plugin";
-char const* const HttpProxyPort::OPT_BLIND_TUNNEL = "blind";
-char const* const HttpProxyPort::OPT_COMPRESSED = "compressed";
+char const *const HttpProxyPort::OPT_FD_PREFIX = "fd";
+char const *const HttpProxyPort::OPT_OUTBOUND_IP_PREFIX = "ip-out";
+char const *const HttpProxyPort::OPT_INBOUND_IP_PREFIX = "ip-in";
+char const *const HttpProxyPort::OPT_HOST_RES_PREFIX = "ip-resolve";
+char const *const HttpProxyPort::OPT_PROTO_PREFIX = "proto";
+
+char const *const HttpProxyPort::OPT_IPV6 = "ipv6";
+char const *const HttpProxyPort::OPT_IPV4 = "ipv4";
+char const *const HttpProxyPort::OPT_TRANSPARENT_INBOUND = "tr-in";
+char const *const HttpProxyPort::OPT_TRANSPARENT_OUTBOUND = "tr-out";
+char const *const HttpProxyPort::OPT_TRANSPARENT_FULL = "tr-full";
+char const *const HttpProxyPort::OPT_TRANSPARENT_PASSTHROUGH = "tr-pass";
+char const *const HttpProxyPort::OPT_SSL = "ssl";
+char const *const HttpProxyPort::OPT_PLUGIN = "plugin";
+char const *const HttpProxyPort::OPT_BLIND_TUNNEL = "blind";
+char const *const HttpProxyPort::OPT_COMPRESSED = "compressed";
 
 // File local constants.
-namespace {
-  // Length values for _PREFIX options.
-  size_t const OPT_FD_PREFIX_LEN = strlen(HttpProxyPort::OPT_FD_PREFIX);
-  size_t const OPT_OUTBOUND_IP_PREFIX_LEN = strlen(HttpProxyPort::OPT_OUTBOUND_IP_PREFIX);
-  size_t const OPT_INBOUND_IP_PREFIX_LEN = strlen(HttpProxyPort::OPT_INBOUND_IP_PREFIX);
-  size_t const OPT_HOST_RES_PREFIX_LEN = strlen(HttpProxyPort::OPT_HOST_RES_PREFIX);
-  size_t const OPT_PROTO_PREFIX_LEN = strlen(HttpProxyPort::OPT_PROTO_PREFIX);
+namespace
+{
+// Length values for _PREFIX options.
+size_t const OPT_FD_PREFIX_LEN = strlen(HttpProxyPort::OPT_FD_PREFIX);
+size_t const OPT_OUTBOUND_IP_PREFIX_LEN = strlen(HttpProxyPort::OPT_OUTBOUND_IP_PREFIX);
+size_t const OPT_INBOUND_IP_PREFIX_LEN = strlen(HttpProxyPort::OPT_INBOUND_IP_PREFIX);
+size_t const OPT_HOST_RES_PREFIX_LEN = strlen(HttpProxyPort::OPT_HOST_RES_PREFIX);
+size_t const OPT_PROTO_PREFIX_LEN = strlen(HttpProxyPort::OPT_PROTO_PREFIX);
 }
 
-namespace {
+namespace
+{
 // Solaris work around. On that OS the compiler will not let me use an
 // instantiated instance of Vec<self> inside the class, even if
 // static. So we have to declare it elsewhere and then import via
 // reference. Might be a problem with Vec<> creating a fixed array
 // rather than allocating on first use (compared to std::vector<>).
-  HttpProxyPort::Group GLOBAL_DATA;
+HttpProxyPort::Group GLOBAL_DATA;
 }
-HttpProxyPort::Group& HttpProxyPort::m_global = GLOBAL_DATA;
+HttpProxyPort::Group &HttpProxyPort::m_global = GLOBAL_DATA;
 
 HttpProxyPort::HttpProxyPort()
-  : m_fd(ts::NO_FD)
-  , m_type(TRANSPORT_DEFAULT)
-  , m_port(0)
-  , m_family(AF_INET)
-  , m_inbound_transparent_p(false)
-  , m_outbound_transparent_p(false)
-  , m_transparent_passthrough(false)
+  : m_fd(ts::NO_FD), m_type(TRANSPORT_DEFAULT), m_port(0), m_family(AF_INET), m_inbound_transparent_p(false),
+    m_outbound_transparent_p(false), m_transparent_passthrough(false)
 {
   memcpy(m_host_res_preference, host_res_default_preference_order, sizeof(m_host_res_preference));
 }
 
-bool HttpProxyPort::hasSSL(Group const& ports) {
+bool
+HttpProxyPort::hasSSL(Group const &ports)
+{
   bool zret = false;
-  for ( int i = 0 , n = ports.length() ; i < n && !zret ; ++i ) {
-    if (ports[i].isSSL()) zret = true;
+  for (int i = 0, n = ports.length(); i < n && !zret; ++i) {
+    if (ports[i].isSSL())
+      zret = true;
   }
   return zret;
 }
 
-HttpProxyPort* HttpProxyPort::findHttp(Group const& ports, uint16_t family) {
+HttpProxyPort *
+HttpProxyPort::findHttp(Group const &ports, uint16_t family)
+{
   bool check_family_p = ats_is_ip(family);
-  self* zret = 0;
-  for ( int i = 0 , n = ports.length() ; i < n && !zret ; ++i ) {
-    HttpProxyPort& p = ports[i];
-    if (p.m_port && // has a valid port
-	TRANSPORT_DEFAULT == p.m_type && // is normal HTTP
-	( !check_family_p || p.m_family == family) // right address family
-	)
-      zret = &p;;
+  self *zret = 0;
+  for (int i = 0, n = ports.length(); i < n && !zret; ++i) {
+    HttpProxyPort &p = ports[i];
+    if (p.m_port &&                               // has a valid port
+        TRANSPORT_DEFAULT == p.m_type &&          // is normal HTTP
+        (!check_family_p || p.m_family == family) // right address family
+        )
+      zret = &p;
+    ;
   }
   return zret;
 }
 
-char const*
-HttpProxyPort::checkPrefix(char const* src, char const* prefix, size_t prefix_len) {
-  char const* zret = 0;
+char const *
+HttpProxyPort::checkPrefix(char const *src, char const *prefix, size_t prefix_len)
+{
+  char const *zret = 0;
   if (0 == strncasecmp(prefix, src, prefix_len)) {
     src += prefix_len;
-    if ('-' == *src || '=' == *src) ++src; // permit optional '-' or '='
+    if ('-' == *src || '=' == *src)
+      ++src; // permit optional '-' or '='
     zret = src;
   }
   return zret;
 }
 
 bool
-HttpProxyPort::loadConfig(Vec<self>& entries) {
-  char* text;
+HttpProxyPort::loadConfig(Vec<self> &entries)
+{
+  char *text;
   bool found_p;
 
   text = REC_readString(PORTS_CONFIG_NAME, &found_p);
-  if (found_p) self::loadValue(entries, text);
+  if (found_p)
+    self::loadValue(entries, text);
   ats_free(text);
 
   return 0 < entries.length();
 }
 
 bool
-HttpProxyPort::loadDefaultIfEmpty(Group& ports) {
+HttpProxyPort::loadDefaultIfEmpty(Group &ports)
+{
   if (0 == ports.length())
     self::loadValue(ports, DEFAULT_VALUE);
 
@@ -205,17 +218,20 @@ HttpProxyPort::loadDefaultIfEmpty(Group& ports) {
 }
 
 bool
-HttpProxyPort::loadValue(Vec<self>& ports, char const* text) {
+HttpProxyPort::loadValue(Vec<self> &ports, char const *text)
+{
   unsigned old_port_length = ports.length(); // remember this.
   if (text && *text) {
     Tokenizer tokens(", ");
     int n_ports = tokens.Initialize(text);
     if (n_ports > 0) {
-      for ( int p = 0 ; p < n_ports ; ++p ) {
-        char const* elt = tokens[p];
+      for (int p = 0; p < n_ports; ++p) {
+        char const *elt = tokens[p];
         HttpProxyPort entry;
-        if (entry.processOptions(elt)) ports.push_back(entry);
-        else Warning("No valid definition was found in proxy port configuration element '%s'", elt);
+        if (entry.processOptions(elt))
+          ports.push_back(entry);
+        else
+          Warning("No valid definition was found in proxy port configuration element '%s'", elt);
       }
     }
   }
@@ -223,35 +239,38 @@ HttpProxyPort::loadValue(Vec<self>& ports, char const* text) {
 }
 
 bool
-HttpProxyPort::processOptions(char const* opts) {
-  bool zret = false; // found a port?
-  bool af_set_p = false; // AF explicitly specified?
+HttpProxyPort::processOptions(char const *opts)
+{
+  bool zret = false;           // found a port?
+  bool af_set_p = false;       // AF explicitly specified?
   bool host_res_set_p = false; // Host resolution order set explicitly?
-  bool sp_set_p = false; // Session protocol set explicitly?
-  bool bracket_p = false; // found an open bracket in the input?
-  char const* value; // Temp holder for value of a prefix option.
-  IpAddr ip; // temp for loading IP addresses.
-  Vec<char*> values; // Pointers to single option values.
+  bool sp_set_p = false;       // Session protocol set explicitly?
+  bool bracket_p = false;      // found an open bracket in the input?
+  char const *value;           // Temp holder for value of a prefix option.
+  IpAddr ip;                   // temp for loading IP addresses.
+  Vec<char *> values;          // Pointers to single option values.
 
   // Make a copy we can modify safely.
   size_t opts_len = strlen(opts) + 1;
-  char* text = static_cast<char*>(alloca(opts_len));
+  char *text = static_cast<char *>(alloca(opts_len));
   memcpy(text, opts, opts_len);
 
   // Split the copy in to tokens.
-  char* token = 0;
-  for (char* spot = text ; *spot ; ++spot ) {
+  char *token = 0;
+  for (char *spot = text; *spot; ++spot) {
     if (bracket_p) {
-      if (']' == *spot) bracket_p = false;
+      if (']' == *spot)
+        bracket_p = false;
     } else if (':' == *spot) {
       *spot = 0;
       token = 0;
     } else {
-      if (! token) {
+      if (!token) {
         token = spot;
         values.push_back(token);
       }
-      if ('[' == *spot) bracket_p = true;
+      if ('[' == *spot)
+        bracket_p = true;
     }
   }
   if (bracket_p) {
@@ -259,10 +278,10 @@ HttpProxyPort::processOptions(char const* opts) {
     return zret;
   }
 
-  for ( int i = 0, n_items = values.length() ; i < n_items ; ++i) {
-    char const* item = values[i];
+  for (int i = 0, n_items = values.length(); i < n_items; ++i) {
+    char const *item = values[i];
     if (isdigit(item[0])) { // leading digit -> port value
-      char* ptr;
+      char *ptr;
       int port = strtoul(item, &ptr, 10);
       if (ptr == item) {
         // really, this shouldn't happen, since we checked for a leading digit.
@@ -274,7 +293,7 @@ HttpProxyPort::processOptions(char const* opts) {
         zret = true;
       }
     } else if (0 != (value = this->checkPrefix(item, OPT_FD_PREFIX, OPT_FD_PREFIX_LEN))) {
-      char* ptr; // tmp for syntax check.
+      char *ptr; // tmp for syntax check.
       int fd = strtoul(value, &ptr, 10);
       if (ptr == value) {
         Warning("Mangled file descriptor value '%s' in port descriptor '%s'", item, opts);
@@ -286,9 +305,7 @@ HttpProxyPort::processOptions(char const* opts) {
       if (0 == ip.load(value))
         m_inbound_ip = ip;
       else
-        Warning("Invalid IP address value '%s' in port descriptor '%s'",
-          item, opts
-        );
+        Warning("Invalid IP address value '%s' in port descriptor '%s'", item, opts);
     } else if (0 != (value = this->checkPrefix(item, OPT_OUTBOUND_IP_PREFIX, OPT_OUTBOUND_IP_PREFIX_LEN))) {
       if (0 == ip.load(value))
         this->outboundIp(ip.family()) = ip;
@@ -309,30 +326,30 @@ HttpProxyPort::processOptions(char const* opts) {
     } else if (0 == strcasecmp(OPT_PLUGIN, item)) {
       m_type = TRANSPORT_PLUGIN;
     } else if (0 == strcasecmp(OPT_TRANSPARENT_INBOUND, item)) {
-# if TS_USE_TPROXY
+#if TS_USE_TPROXY
       m_inbound_transparent_p = true;
-# else
+#else
       Warning("Transparency requested [%s] in port descriptor '%s' but TPROXY was not configured.", item, opts);
-# endif
+#endif
     } else if (0 == strcasecmp(OPT_TRANSPARENT_OUTBOUND, item)) {
-# if TS_USE_TPROXY
+#if TS_USE_TPROXY
       m_outbound_transparent_p = true;
-# else
+#else
       Warning("Transparency requested [%s] in port descriptor '%s' but TPROXY was not configured.", item, opts);
-# endif
+#endif
     } else if (0 == strcasecmp(OPT_TRANSPARENT_FULL, item)) {
-# if TS_USE_TPROXY
+#if TS_USE_TPROXY
       m_inbound_transparent_p = true;
       m_outbound_transparent_p = true;
-# else
+#else
       Warning("Transparency requested [%s] in port descriptor '%s' but TPROXY was not configured.", item, opts);
-# endif
+#endif
     } else if (0 == strcasecmp(OPT_TRANSPARENT_PASSTHROUGH, item)) {
-# if TS_USE_TPROXY
+#if TS_USE_TPROXY
       m_transparent_passthrough = true;
-# else
+#else
       Warning("Transparent pass-through requested [%s] in port descriptor '%s' but TPROXY was not configured.", item, opts);
-# endif
+#endif
     } else if (0 != (value = this->checkPrefix(item, OPT_HOST_RES_PREFIX, OPT_HOST_RES_PREFIX_LEN))) {
       this->processFamilyPreference(value);
       host_res_set_p = true;
@@ -348,7 +365,8 @@ HttpProxyPort::processOptions(char const* opts) {
 
   if (af_set_p) {
     if (in_ip_set_p && m_family != m_inbound_ip.family()) {
-      Warning("Invalid port descriptor '%s' - the inbound adddress family [%s] is not the same type as the explicit family value [%s]",
+      Warning(
+        "Invalid port descriptor '%s' - the inbound adddress family [%s] is not the same type as the explicit family value [%s]",
         opts, ats_ip_family_name(m_inbound_ip.family()), ats_ip_family_name(m_family));
       zret = false;
     }
@@ -359,15 +377,10 @@ HttpProxyPort::processOptions(char const* opts) {
   // If the port is outbound transparent only CLIENT host resolution is possible.
   if (m_outbound_transparent_p) {
     if (host_res_set_p &&
-        (m_host_res_preference[0] != HOST_RES_PREFER_CLIENT ||
-         m_host_res_preference[1] != HOST_RES_PREFER_NONE
-    )) {
+        (m_host_res_preference[0] != HOST_RES_PREFER_CLIENT || m_host_res_preference[1] != HOST_RES_PREFER_NONE)) {
       Warning("Outbound transparent port '%s' requires the IP address resolution ordering '%s,%s'. "
-              "This is set automatically and does not need to be set explicitly."
-              , opts
-              , HOST_RES_PREFERENCE_STRING[HOST_RES_PREFER_CLIENT]
-              , HOST_RES_PREFERENCE_STRING[HOST_RES_PREFER_NONE]
-        );
+              "This is set automatically and does not need to be set explicitly.",
+              opts, HOST_RES_PREFERENCE_STRING[HOST_RES_PREFER_CLIENT], HOST_RES_PREFERENCE_STRING[HOST_RES_PREFER_NONE]);
     }
     m_host_res_preference[0] = HOST_RES_PREFER_CLIENT;
     m_host_res_preference[1] = HOST_RES_PREFER_NONE;
@@ -381,34 +394,34 @@ HttpProxyPort::processOptions(char const* opts) {
 
   // Set the default session protocols.
   if (!sp_set_p)
-    m_session_protocol_preference = this->isSSL()
-      ? DEFAULT_TLS_SESSION_PROTOCOL_SET
-      : DEFAULT_NON_TLS_SESSION_PROTOCOL_SET
-      ;
+    m_session_protocol_preference = this->isSSL() ? DEFAULT_TLS_SESSION_PROTOCOL_SET : DEFAULT_NON_TLS_SESSION_PROTOCOL_SET;
 
   return zret;
 }
 
 void
-HttpProxyPort::processFamilyPreference(char const* value) {
+HttpProxyPort::processFamilyPreference(char const *value)
+{
   parse_host_res_preference(value, m_host_res_preference);
 }
 
 void
-HttpProxyPort::processSessionProtocolPreference(char const* value) {
+HttpProxyPort::processSessionProtocolPreference(char const *value)
+{
   m_session_protocol_preference.markAllOut();
   globalSessionProtocolNameRegistry.markIn(value, m_session_protocol_preference);
 }
 
 void
-SessionProtocolNameRegistry::markIn(char const* value, SessionProtocolSet& sp_set) {
+SessionProtocolNameRegistry::markIn(char const *value, SessionProtocolSet &sp_set)
+{
   int n; // # of tokens
   Tokenizer tokens(" ;|,:");
 
   n = tokens.Initialize(value);
 
-  for ( int i = 0 ; i < n ; ++i ) {
-    char const* elt = tokens[i];
+  for (int i = 0; i < n; ++i) {
+    char const *elt = tokens[i];
 
     /// Check special cases
     if (0 == strcasecmp(elt, TS_NPN_PROTOCOL_GROUP_HTTP)) {
@@ -425,79 +438,82 @@ SessionProtocolNameRegistry::markIn(char const* value, SessionProtocolSet& sp_se
 }
 
 int
-HttpProxyPort::print(char* out, size_t n) {
+HttpProxyPort::print(char *out, size_t n)
+{
   size_t zret = 0; // # of chars printed so far.
   ip_text_buffer ipb;
   bool need_colon_p = false;
 
   if (m_inbound_ip.isValid()) {
-    zret += snprintf(out+zret, n-zret, "%s=[%s]",
-      OPT_INBOUND_IP_PREFIX,
-      m_inbound_ip.toString(ipb, sizeof(ipb))
-    );
+    zret += snprintf(out + zret, n - zret, "%s=[%s]", OPT_INBOUND_IP_PREFIX, m_inbound_ip.toString(ipb, sizeof(ipb)));
     need_colon_p = true;
   }
-  if (zret >= n) return n;
+  if (zret >= n)
+    return n;
 
   if (m_outbound_ip4.isValid()) {
-    if (need_colon_p) out[zret++] = ':';
-    zret += snprintf(out+zret, n-zret, "%s=[%s]",
-      OPT_OUTBOUND_IP_PREFIX,
-      m_outbound_ip4.toString(ipb, sizeof(ipb))
-    );
+    if (need_colon_p)
+      out[zret++] = ':';
+    zret += snprintf(out + zret, n - zret, "%s=[%s]", OPT_OUTBOUND_IP_PREFIX, m_outbound_ip4.toString(ipb, sizeof(ipb)));
     need_colon_p = true;
   }
-  if (zret >= n) return n;
+  if (zret >= n)
+    return n;
 
   if (m_outbound_ip6.isValid()) {
-    if (need_colon_p) out[zret++] = ':';
-    zret += snprintf(out+zret, n-zret, "%s=[%s]",
-      OPT_OUTBOUND_IP_PREFIX,
-      m_outbound_ip6.toString(ipb, sizeof(ipb))
-    );
+    if (need_colon_p)
+      out[zret++] = ':';
+    zret += snprintf(out + zret, n - zret, "%s=[%s]", OPT_OUTBOUND_IP_PREFIX, m_outbound_ip6.toString(ipb, sizeof(ipb)));
     need_colon_p = true;
   }
-  if (zret >= n) return n;
+  if (zret >= n)
+    return n;
 
   if (0 != m_port) {
-    if (need_colon_p) out[zret++] = ':';
-    zret += snprintf(out+zret, n-zret, "%d", m_port);
+    if (need_colon_p)
+      out[zret++] = ':';
+    zret += snprintf(out + zret, n - zret, "%d", m_port);
     need_colon_p = true;
   }
-  if (zret >= n) return n;
+  if (zret >= n)
+    return n;
 
   if (ts::NO_FD != m_fd) {
-    if (need_colon_p) out[zret++] = ':';
-    zret += snprintf(out+zret, n-zret, "fd=%d", m_fd);
+    if (need_colon_p)
+      out[zret++] = ':';
+    zret += snprintf(out + zret, n - zret, "fd=%d", m_fd);
   }
-  if (zret >= n) return n;
+  if (zret >= n)
+    return n;
 
   // After this point, all of these options require other options which we've already
   // generated so all of them need a leading colon and we can stop checking for that.
 
   if (AF_INET6 == m_family)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_IPV6);
-  if (zret >= n) return n;
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_IPV6);
+  if (zret >= n)
+    return n;
 
   if (TRANSPORT_BLIND_TUNNEL == m_type)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_BLIND_TUNNEL);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_BLIND_TUNNEL);
   else if (TRANSPORT_SSL == m_type)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_SSL);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_SSL);
   else if (TRANSPORT_PLUGIN == m_type)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_PLUGIN);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_PLUGIN);
   else if (TRANSPORT_COMPRESSED == m_type)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_COMPRESSED);
-  if (zret >= n) return n;
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_COMPRESSED);
+  if (zret >= n)
+    return n;
 
   if (m_outbound_transparent_p && m_inbound_transparent_p)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_TRANSPARENT_FULL);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_TRANSPARENT_FULL);
   else if (m_inbound_transparent_p)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_TRANSPARENT_INBOUND);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_TRANSPARENT_INBOUND);
   else if (m_outbound_transparent_p)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_TRANSPARENT_OUTBOUND);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_TRANSPARENT_OUTBOUND);
 
   if (m_transparent_passthrough)
-    zret += snprintf(out+zret, n-zret, ":%s", OPT_TRANSPARENT_PASSTHROUGH);
+    zret += snprintf(out + zret, n - zret, ":%s", OPT_TRANSPARENT_PASSTHROUGH);
 
   /* Don't print the IP resolution preferences if the port is outbound
    * transparent (which means the preference order is forced) or if
@@ -505,14 +521,14 @@ HttpProxyPort::print(char* out, size_t n) {
    */
   if (!m_outbound_transparent_p &&
       0 != memcmp(m_host_res_preference, host_res_default_preference_order, sizeof(m_host_res_preference))) {
-    zret += snprintf(out+zret, n-zret, ":%s=", OPT_HOST_RES_PREFIX);
-    zret += ts_host_res_order_to_string(m_host_res_preference, out+zret, n-zret);
+    zret += snprintf(out + zret, n - zret, ":%s=", OPT_HOST_RES_PREFIX);
+    zret += ts_host_res_order_to_string(m_host_res_preference, out + zret, n - zret);
   }
 
   // session protocol options - look for condensed options first
   // first two cases are the defaults so if those match, print nothing.
   SessionProtocolSet sp_set = m_session_protocol_preference; // need to modify so copy.
-  need_colon_p = true; // for listing case, turned off if we do a special case.
+  need_colon_p = true;                                       // for listing case, turned off if we do a special case.
   if (sp_set == DEFAULT_NON_TLS_SESSION_PROTOCOL_SET && !this->isSSL()) {
     sp_set.markOut(DEFAULT_NON_TLS_SESSION_PROTOCOL_SET);
   } else if (sp_set == DEFAULT_TLS_SESSION_PROTOCOL_SET && this->isSSL()) {
@@ -521,53 +537,51 @@ HttpProxyPort::print(char* out, size_t n) {
 
   // pull out groups.
   if (sp_set.contains(HTTP_PROTOCOL_SET)) {
-    zret += snprintf(out+zret, n-zret, ":%s=%s", OPT_PROTO_PREFIX,TS_NPN_PROTOCOL_GROUP_HTTP);
+    zret += snprintf(out + zret, n - zret, ":%s=%s", OPT_PROTO_PREFIX, TS_NPN_PROTOCOL_GROUP_HTTP);
     sp_set.markOut(HTTP_PROTOCOL_SET);
     need_colon_p = false;
   }
   if (sp_set.contains(SPDY_PROTOCOL_SET)) {
     if (need_colon_p)
-      zret += snprintf(out+zret, n-zret, ":%s=", OPT_PROTO_PREFIX);
+      zret += snprintf(out + zret, n - zret, ":%s=", OPT_PROTO_PREFIX);
     else
       out[zret++] = ';';
-    zret += snprintf(out+zret, n-zret, TS_NPN_PROTOCOL_GROUP_SPDY);
+    zret += snprintf(out + zret, n - zret, TS_NPN_PROTOCOL_GROUP_SPDY);
     sp_set.markOut(SPDY_PROTOCOL_SET);
     need_colon_p = false;
   }
   if (sp_set.contains(HTTP2_PROTOCOL_SET)) {
     if (need_colon_p)
-      zret += snprintf(out+zret, n-zret, ":%s=", OPT_PROTO_PREFIX);
+      zret += snprintf(out + zret, n - zret, ":%s=", OPT_PROTO_PREFIX);
     else
       out[zret++] = ';';
-    zret += snprintf(out+zret, n-zret, "%s", TS_NPN_PROTOCOL_GROUP_HTTP2);
+    zret += snprintf(out + zret, n - zret, "%s", TS_NPN_PROTOCOL_GROUP_HTTP2);
     sp_set.markOut(HTTP2_PROTOCOL_SET);
     need_colon_p = false;
   }
   // now enumerate what's left.
   if (!sp_set.isEmpty()) {
     if (need_colon_p)
-      zret += snprintf(out+zret, n-zret, ":%s=", OPT_PROTO_PREFIX);
+      zret += snprintf(out + zret, n - zret, ":%s=", OPT_PROTO_PREFIX);
     bool sep_p = !need_colon_p;
-    for ( int k = 0 ; k < SessionProtocolSet::MAX ; ++k ) {
+    for (int k = 0; k < SessionProtocolSet::MAX; ++k) {
       if (sp_set.contains(k)) {
-        zret += snprintf(out+zret, n-zret, "%s%s", sep_p ? ";" : "", globalSessionProtocolNameRegistry.nameFor(k));
+        zret += snprintf(out + zret, n - zret, "%s%s", sep_p ? ";" : "", globalSessionProtocolNameRegistry.nameFor(k));
         sep_p = true;
       }
     }
   }
 
-  return min(zret,n);
+  return min(zret, n);
 }
 
 void
 ts_host_res_global_init()
 {
   // Global configuration values.
-  memcpy(host_res_default_preference_order,
-         HOST_RES_DEFAULT_PREFERENCE_ORDER,
-         sizeof(host_res_default_preference_order));
+  memcpy(host_res_default_preference_order, HOST_RES_DEFAULT_PREFERENCE_ORDER, sizeof(host_res_default_preference_order));
 
-  char* ip_resolve = REC_ConfigReadString("proxy.config.hostdb.ip_resolve");
+  char *ip_resolve = REC_ConfigReadString("proxy.config.hostdb.ip_resolve");
   if (ip_resolve) {
     parse_host_res_preference(ip_resolve, host_res_default_preference_order);
   }
@@ -608,22 +622,23 @@ ts_session_protocol_well_known_name_indices_init()
   DEFAULT_NON_TLS_SESSION_PROTOCOL_SET = HTTP_PROTOCOL_SET;
 }
 
-SessionProtocolNameRegistry::SessionProtocolNameRegistry()
-  : m_n(0)
+SessionProtocolNameRegistry::SessionProtocolNameRegistry() : m_n(0)
 {
   memset(m_names, 0, sizeof(m_names));
   memset(&m_flags, 0, sizeof(m_flags));
 }
 
-SessionProtocolNameRegistry::~SessionProtocolNameRegistry() {
-  for ( size_t i = 0 ; i < m_n ; ++i ) {
+SessionProtocolNameRegistry::~SessionProtocolNameRegistry()
+{
+  for (size_t i = 0; i < m_n; ++i) {
     if (m_flags[i] & F_ALLOCATED)
-      ats_free(const_cast<char*>(m_names[i])); // blech - ats_free won't take a char const*
+      ats_free(const_cast<char *>(m_names[i])); // blech - ats_free won't take a char const*
   }
 }
 
 int
-SessionProtocolNameRegistry::toIndex(char const* name) {
+SessionProtocolNameRegistry::toIndex(char const *name)
+{
   int zret = this->indexFor(name);
   if (INVALID == zret) {
     if (m_n < static_cast<size_t>(MAX)) {
@@ -638,10 +653,11 @@ SessionProtocolNameRegistry::toIndex(char const* name) {
 }
 
 int
-SessionProtocolNameRegistry::toIndexConst(char const* name) {
+SessionProtocolNameRegistry::toIndexConst(char const *name)
+{
   int zret = this->indexFor(name);
   if (INVALID == zret) {
-    if ( m_n < static_cast<size_t>(MAX)) {
+    if (m_n < static_cast<size_t>(MAX)) {
       m_names[m_n] = name;
       zret = m_n++;
     } else {
@@ -652,18 +668,17 @@ SessionProtocolNameRegistry::toIndexConst(char const* name) {
 }
 
 int
-SessionProtocolNameRegistry::indexFor(char const* name) const {
-  for ( size_t i = 0 ; i < m_n ; ++i ) {
+SessionProtocolNameRegistry::indexFor(char const *name) const
+{
+  for (size_t i = 0; i < m_n; ++i) {
     if (0 == strcasecmp(name, m_names[i]))
       return i;
   }
   return INVALID;
 }
 
-char const*
-SessionProtocolNameRegistry::nameFor(int idx) const {
-  return 0 <= idx && idx < static_cast<int>(m_n)
-    ? m_names[idx]
-    : 0
-    ;
+char const *
+SessionProtocolNameRegistry::nameFor(int idx) const
+{
+  return 0 <= idx && idx < static_cast<int>(m_n) ? m_names[idx] : 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecLocal.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecLocal.cc b/lib/records/RecLocal.cc
index 10aca66..8dc0dc3 100644
--- a/lib/records/RecLocal.cc
+++ b/lib/records/RecLocal.cc
@@ -60,10 +60,10 @@ i_am_the_record_owner(RecT rec_type)
 // sync_thr
 //-------------------------------------------------------------------------
 static void *
-sync_thr(void * data)
+sync_thr(void *data)
 {
   textBuffer *tb = new textBuffer(65536);
-  FileManager * configFiles = (FileManager *)data;
+  FileManager *configFiles = (FileManager *)data;
 
   Rollback *rb;
   bool inc_version;
@@ -83,8 +83,7 @@ sync_thr(void * data)
           }
           written = true;
         }
-      }
-      else {
+      } else {
         rb = NULL;
       }
       if (!written) {
@@ -112,7 +111,6 @@ sync_thr(void * data)
 static void *
 config_update_thr(void * /* data */)
 {
-
   while (true) {
     switch (RecExecConfigUpdateCbs(REC_LOCAL_UPDATE_REQUIRED)) {
     case RECU_RESTART_TS:
@@ -153,9 +151,10 @@ RecMessageInit()
 // RecLocalInit
 //-------------------------------------------------------------------------
 int
-RecLocalInit(Diags * _diags)
+RecLocalInit(Diags *_diags)
 {
-  static bool initialized_p = false;;
+  static bool initialized_p = false;
+  ;
 
   if (initialized_p) {
     return REC_ERR_OKAY;
@@ -208,7 +207,7 @@ RecLocalInitMessage()
 // RecLocalStart
 //-------------------------------------------------------------------------
 int
-RecLocalStart(FileManager * configFiles)
+RecLocalStart(FileManager *configFiles)
 {
   ink_thread_create(sync_thr, configFiles);
   ink_thread_create(config_update_thr, NULL);
@@ -225,9 +224,9 @@ RecRegisterManagerCb(int id, RecManagerCb _fn, void *_data)
 void
 RecSignalManager(int id, const char *, size_t)
 {
-   // Signals are messages sent across the management pipe, so by definition,
-   // you can't send a signal if you are a local process manager.
-   RecDebug(DL_Debug, "local manager dropping signal %d", id);
+  // Signals are messages sent across the management pipe, so by definition,
+  // you can't send a signal if you are a local process manager.
+  RecDebug(DL_Debug, "local manager dropping signal %d", id);
 }
 
 //-------------------------------------------------------------------------
@@ -235,7 +234,7 @@ RecSignalManager(int id, const char *, size_t)
 //-------------------------------------------------------------------------
 
 int
-RecMessageSend(RecMessage * msg)
+RecMessageSend(RecMessage *msg)
 {
   int msg_size;
 
@@ -246,9 +245,8 @@ RecMessageSend(RecMessage * msg)
   if (g_mode_type == RECM_CLIENT || g_mode_type == RECM_SERVER) {
     msg->o_end = msg->o_write;
     msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start);
-    lmgmt->signalEvent(MGMT_EVENT_LIBRECORDS, (char *) msg, msg_size);
+    lmgmt->signalEvent(MGMT_EVENT_LIBRECORDS, (char *)msg, msg_size);
   }
 
   return REC_ERR_OKAY;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecMessage.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecMessage.cc b/lib/records/RecMessage.cc
index ca8b352..0ca2eef 100644
--- a/lib/records/RecMessage.cc
+++ b/lib/records/RecMessage.cc
@@ -57,7 +57,7 @@ RecMessageAlloc(RecMessageT msg_type, int initial_size)
 //-------------------------------------------------------------------------
 
 int
-RecMessageFree(RecMessage * msg)
+RecMessageFree(RecMessage *msg)
 {
   ats_free(msg);
   return REC_ERR_OKAY;
@@ -67,7 +67,7 @@ RecMessageFree(RecMessage * msg)
 // RecMessageMarshal_Realloc
 //-------------------------------------------------------------------------
 RecMessage *
-RecMessageMarshal_Realloc(RecMessage * msg, const RecRecord * record)
+RecMessageMarshal_Realloc(RecMessage *msg, const RecRecord *record)
 {
   int msg_ele_size;
   int rec_name_len = -1;
@@ -103,49 +103,49 @@ RecMessageMarshal_Realloc(RecMessage * msg, const RecRecord * record)
   // (msg_ele_size + 7) & ~7 == 5 !!!
   // msg_ele_size = (msg_ele_size + 7) & ~7;       // 8 byte alignmenet
 
-  msg_ele_size = INK_ALIGN_DEFAULT(msg_ele_size);  // 8 byte alignmenet
+  msg_ele_size = INK_ALIGN_DEFAULT(msg_ele_size); // 8 byte alignmenet
   // get some space in our buffer
   while (msg->o_end - msg->o_write < msg_ele_size) {
     int realloc_size = (msg->o_end - msg->o_start) * 2;
     msg = (RecMessage *)ats_realloc(msg, sizeof(RecMessageHdr) + realloc_size);
     msg->o_end = msg->o_start + realloc_size;
   }
-  ele_hdr = (RecMessageEleHdr *) ((char *) msg + msg->o_write);
+  ele_hdr = (RecMessageEleHdr *)((char *)msg + msg->o_write);
   // The following memset() is pretty CPU intensive, replacing it with something
   // like the below would reduce CPU usage a fair amount. /leif.
   // *((char*)msg + msg->o_write) = 0;
-  memset((char *) msg + msg->o_write, 0, msg->o_end - msg->o_write);
+  memset((char *)msg + msg->o_write, 0, msg->o_end - msg->o_write);
   msg->o_write += msg_ele_size;
 
   // store the record
   ele_hdr->magic = REC_MESSAGE_ELE_MAGIC;
   ele_hdr->o_next = msg->o_write;
-  p = (char *) ele_hdr + sizeof(RecMessageEleHdr);
+  p = (char *)ele_hdr + sizeof(RecMessageEleHdr);
   memcpy(p, record, sizeof(RecRecord));
-  r = (RecRecord *) p;
+  r = (RecRecord *)p;
   p += sizeof(RecRecord);
   if (rec_name_len != -1) {
-    ink_assert((msg->o_end - ((uintptr_t) p - (uintptr_t) msg)) >= (uintptr_t) rec_name_len);
+    ink_assert((msg->o_end - ((uintptr_t)p - (uintptr_t)msg)) >= (uintptr_t)rec_name_len);
     memcpy(p, record->name, rec_name_len);
-    r->name = (char *) ((uintptr_t) p - (uintptr_t) r);
+    r->name = (char *)((uintptr_t)p - (uintptr_t)r);
     p += rec_name_len;
   }
   if (rec_data_str_len != -1) {
-    ink_assert((msg->o_end - ((uintptr_t) p - (uintptr_t) msg)) >= (uintptr_t) rec_data_str_len);
+    ink_assert((msg->o_end - ((uintptr_t)p - (uintptr_t)msg)) >= (uintptr_t)rec_data_str_len);
     memcpy(p, record->data.rec_string, rec_data_str_len);
-    r->data.rec_string = (char *) ((uintptr_t) p - (uintptr_t) r);
+    r->data.rec_string = (char *)((uintptr_t)p - (uintptr_t)r);
     p += rec_data_str_len;
   }
   if (rec_data_def_str_len != -1) {
-    ink_assert((msg->o_end - ((uintptr_t) p - (uintptr_t) msg)) >= (uintptr_t) rec_data_def_str_len);
+    ink_assert((msg->o_end - ((uintptr_t)p - (uintptr_t)msg)) >= (uintptr_t)rec_data_def_str_len);
     memcpy(p, record->data_default.rec_string, rec_data_def_str_len);
-    r->data_default.rec_string = (char *) ((uintptr_t) p - (uintptr_t) r);
+    r->data_default.rec_string = (char *)((uintptr_t)p - (uintptr_t)r);
     p += rec_data_def_str_len;
   }
   if (rec_cfg_chk_len != -1) {
-    ink_assert((msg->o_end - ((uintptr_t) p - (uintptr_t) msg)) >= (uintptr_t) rec_cfg_chk_len);
+    ink_assert((msg->o_end - ((uintptr_t)p - (uintptr_t)msg)) >= (uintptr_t)rec_cfg_chk_len);
     memcpy(p, record->config_meta.check_expr, rec_cfg_chk_len);
-    r->config_meta.check_expr = (char *) ((uintptr_t) p - (uintptr_t) r);
+    r->config_meta.check_expr = (char *)((uintptr_t)p - (uintptr_t)r);
   }
 
   msg->entries += 1;
@@ -158,9 +158,9 @@ RecMessageMarshal_Realloc(RecMessage * msg, const RecRecord * record)
 //-------------------------------------------------------------------------
 
 int
-RecMessageUnmarshalFirst(RecMessage * msg, RecMessageItr * itr, RecRecord ** record)
+RecMessageUnmarshalFirst(RecMessage *msg, RecMessageItr *itr, RecRecord **record)
 {
-  itr->ele_hdr = (RecMessageEleHdr *) ((char *) msg + msg->o_start);
+  itr->ele_hdr = (RecMessageEleHdr *)((char *)msg + msg->o_start);
   itr->next = 1;
 
   return RecMessageUnmarshalNext(msg, NULL, record);
@@ -171,7 +171,7 @@ RecMessageUnmarshalFirst(RecMessage * msg, RecMessageItr * itr, RecRecord ** rec
 //-------------------------------------------------------------------------
 
 int
-RecMessageUnmarshalNext(RecMessage * msg, RecMessageItr * itr, RecRecord ** record)
+RecMessageUnmarshalNext(RecMessage *msg, RecMessageItr *itr, RecRecord **record)
 {
   RecMessageEleHdr *eh;
   RecRecord *r;
@@ -180,13 +180,13 @@ RecMessageUnmarshalNext(RecMessage * msg, RecMessageItr * itr, RecRecord ** reco
     if (msg->entries == 0) {
       return REC_ERR_FAIL;
     } else {
-      eh = (RecMessageEleHdr *) ((char *) msg + msg->o_start);
+      eh = (RecMessageEleHdr *)((char *)msg + msg->o_start);
     }
   } else {
     if (itr->next >= msg->entries) {
       return REC_ERR_FAIL;
     }
-    itr->ele_hdr = (RecMessageEleHdr *) ((char *) (msg) + itr->ele_hdr->o_next);
+    itr->ele_hdr = (RecMessageEleHdr *)((char *)(msg) + itr->ele_hdr->o_next);
     itr->next += 1;
     eh = itr->ele_hdr;
   }
@@ -199,21 +199,21 @@ RecMessageUnmarshalNext(RecMessage * msg, RecMessageItr * itr, RecRecord ** reco
     return REC_ERR_FAIL;
   }
 
-  r = (RecRecord *) ((char *) eh + sizeof(RecMessageEleHdr));
+  r = (RecRecord *)((char *)eh + sizeof(RecMessageEleHdr));
 
   if (r->name) {
-    r->name = (char *) r + (intptr_t) (r->name);
+    r->name = (char *)r + (intptr_t)(r->name);
   }
   if (r->data_type == RECD_STRING) {
     if (r->data.rec_string) {
-      r->data.rec_string = (char *) r + (intptr_t) (r->data.rec_string);
+      r->data.rec_string = (char *)r + (intptr_t)(r->data.rec_string);
     }
     if (r->data_default.rec_string) {
-      r->data_default.rec_string = (char *) r + (intptr_t) (r->data_default.rec_string);
+      r->data_default.rec_string = (char *)r + (intptr_t)(r->data_default.rec_string);
     }
   }
   if (REC_TYPE_IS_CONFIG(r->rec_type) && (r->config_meta.check_expr)) {
-    r->config_meta.check_expr = (char *) r + (intptr_t) (r->config_meta.check_expr);
+    r->config_meta.check_expr = (char *)r + (intptr_t)(r->config_meta.check_expr);
   }
 
   *record = r;
@@ -244,7 +244,7 @@ RecMessageRegisterRecvCb(RecMessageRecvCb recv_cb, void *cookie)
 void *
 RecMessageRecvThis(void * /* cookie */, char *data_raw, int /* data_len */)
 {
-  RecMessage *msg = (RecMessage *) data_raw;
+  RecMessage *msg = (RecMessage *)data_raw;
   g_recv_cb(msg, msg->msg_type, g_recv_cookie);
   return NULL;
 }
@@ -264,13 +264,12 @@ RecMessageReadFromDisk(const char *fpath)
   if ((h_file = RecFileOpenR(fpath)) == REC_HANDLE_INVALID) {
     goto Lerror;
   }
-  if (RecFileRead(h_file, (char *) (&msg_hdr), sizeof(RecMessageHdr), &bytes_read) == REC_ERR_FAIL) {
+  if (RecFileRead(h_file, (char *)(&msg_hdr), sizeof(RecMessageHdr), &bytes_read) == REC_ERR_FAIL) {
     goto Lerror;
   }
   msg = (RecMessage *)ats_malloc((msg_hdr.o_end - msg_hdr.o_start) + sizeof(RecMessageHdr));
   memcpy(msg, &msg_hdr, sizeof(RecMessageHdr));
-  if (RecFileRead(h_file, (char *) (msg) + msg_hdr.o_start,
-                  msg_hdr.o_end - msg_hdr.o_start, &bytes_read) == REC_ERR_FAIL) {
+  if (RecFileRead(h_file, (char *)(msg) + msg_hdr.o_start, msg_hdr.o_end - msg_hdr.o_start, &bytes_read) == REC_ERR_FAIL) {
     goto Lerror;
   }
 
@@ -306,7 +305,7 @@ RecMessageWriteToDisk(RecMessage *msg, const char *fpath)
 
   msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start);
   if ((h_file = RecFileOpenW(fpath)) != REC_HANDLE_INVALID) {
-    if (RecFileWrite(h_file, (char *) msg, msg_size, &bytes_written) == REC_ERR_FAIL) {
+    if (RecFileWrite(h_file, (char *)msg, msg_size, &bytes_written) == REC_ERR_FAIL) {
       RecFileClose(h_file);
       return REC_ERR_FAIL;
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecMutex.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecMutex.cc b/lib/records/RecMutex.cc
index 797e285..63bdc97 100644
--- a/lib/records/RecMutex.cc
+++ b/lib/records/RecMutex.cc
@@ -25,7 +25,7 @@
 #include "I_RecMutex.h"
 
 int
-rec_mutex_init(RecMutex * m, const char *name)
+rec_mutex_init(RecMutex *m, const char *name)
 {
   m->nthread_holding = 0;
   m->thread_holding = 0;
@@ -33,7 +33,7 @@ rec_mutex_init(RecMutex * m, const char *name)
 }
 
 int
-rec_mutex_destroy(RecMutex * m)
+rec_mutex_destroy(RecMutex *m)
 {
   ink_assert(m->nthread_holding == 0);
   ink_assert(m->thread_holding == 0);
@@ -41,9 +41,8 @@ rec_mutex_destroy(RecMutex * m)
 }
 
 int
-rec_mutex_acquire(RecMutex * m)
+rec_mutex_acquire(RecMutex *m)
 {
-
   ink_thread this_thread = ink_thread_self();
 
   if (m->thread_holding != this_thread) {
@@ -56,9 +55,8 @@ rec_mutex_acquire(RecMutex * m)
 }
 
 int
-rec_mutex_release(RecMutex * m)
+rec_mutex_release(RecMutex *m)
 {
-
   if (m->nthread_holding != 0) {
     m->nthread_holding--;
     if (m->nthread_holding == 0) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecProcess.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecProcess.cc b/lib/records/RecProcess.cc
index de47227..f0c59bb 100644
--- a/lib/records/RecProcess.cc
+++ b/lib/records/RecProcess.cc
@@ -88,7 +88,8 @@ i_am_the_record_owner(RecT rec_type)
 // Simple setters for the intervals to decouple this from the proxy
 //-------------------------------------------------------------------------
 void
-RecProcess_set_raw_stat_sync_interval_ms(int ms) {
+RecProcess_set_raw_stat_sync_interval_ms(int ms)
+{
   Debug("statsproc", "g_rec_raw_stat_sync_interval_ms -> %d", ms);
   g_rec_raw_stat_sync_interval_ms = ms;
   if (raw_stat_sync_cont_event) {
@@ -97,7 +98,8 @@ RecProcess_set_raw_stat_sync_interval_ms(int ms) {
   }
 }
 void
-RecProcess_set_config_update_interval_ms(int ms) {
+RecProcess_set_config_update_interval_ms(int ms)
+{
   Debug("statsproc", "g_rec_config_update_interval_ms -> %d", ms);
   g_rec_config_update_interval_ms = ms;
   if (config_update_cont_event) {
@@ -106,7 +108,8 @@ RecProcess_set_config_update_interval_ms(int ms) {
   }
 }
 void
-RecProcess_set_remote_sync_interval_ms(int ms) {
+RecProcess_set_remote_sync_interval_ms(int ms)
+{
   Debug("statsproc", "g_rec_remote_sync_interval_ms -> %d", ms);
   g_rec_remote_sync_interval_ms = ms;
   if (sync_cont_event) {
@@ -133,13 +136,13 @@ raw_stat_get_total(RecRawStatBlock *rsb, int id, RecRawStat *total)
 
   // get thread local values
   for (i = 0; i < eventProcessor.n_ethreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
     total->sum += tlp->sum;
     total->count += tlp->count;
   }
 
   for (i = 0; i < eventProcessor.n_dthreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
     total->sum += tlp->sum;
     total->count += tlp->count;
   }
@@ -167,13 +170,13 @@ raw_stat_sync_to_global(RecRawStatBlock *rsb, int id)
 
   // sum the thread local values
   for (i = 0; i < eventProcessor.n_ethreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
     total.sum += tlp->sum;
     total.count += tlp->count;
   }
 
   for (i = 0; i < eventProcessor.n_dthreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
     total.sum += tlp->sum;
     total.count += tlp->count;
   }
@@ -191,8 +194,9 @@ raw_stat_sync_to_global(RecRawStatBlock *rsb, int id)
   delta.count = total.count - rsb->global[id]->last_count;
 
   // This is too verbose now, so leaving it out / leif
-  //Debug("stats", "raw_stat_sync_to_global(): rsb pointer:%p id:%d delta:%" PRId64 " total:%" PRId64 " last:%" PRId64 " global:%" PRId64 "\n",
-  //rsb, id, delta.sum, total.sum, rsb->global[id]->last_sum, rsb->global[id]->sum);
+  // Debug("stats", "raw_stat_sync_to_global(): rsb pointer:%p id:%d delta:%" PRId64 " total:%" PRId64 " last:%" PRId64 " global:%"
+  // PRId64 "\n",
+  // rsb, id, delta.sum, total.sum, rsb->global[id]->last_sum, rsb->global[id]->sum);
 
   // increment the global values by the delta
   ink_atomic_increment(&(rsb->global[id]->sum), delta.sum);
@@ -228,13 +232,13 @@ raw_stat_clear(RecRawStatBlock *rsb, int id)
   // reset the local stats
   RecRawStat *tlp;
   for (int i = 0; i < eventProcessor.n_ethreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
     ink_atomic_swap(&(tlp->sum), (int64_t)0);
     ink_atomic_swap(&(tlp->count), (int64_t)0);
   }
 
   for (int i = 0; i < eventProcessor.n_dthreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
     ink_atomic_swap(&(tlp->sum), (int64_t)0);
     ink_atomic_swap(&(tlp->count), (int64_t)0);
   }
@@ -261,12 +265,12 @@ raw_stat_clear_sum(RecRawStatBlock *rsb, int id)
   // reset the local stats
   RecRawStat *tlp;
   for (int i = 0; i < eventProcessor.n_ethreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
     ink_atomic_swap(&(tlp->sum), (int64_t)0);
   }
 
   for (int i = 0; i < eventProcessor.n_dthreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
     ink_atomic_swap(&(tlp->sum), (int64_t)0);
   }
 
@@ -292,12 +296,12 @@ raw_stat_clear_count(RecRawStatBlock *rsb, int id)
   // reset the local stats
   RecRawStat *tlp;
   for (int i = 0; i < eventProcessor.n_ethreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_ethreads[i]) + rsb->ethr_stat_offset)) + id;
     ink_atomic_swap(&(tlp->count), (int64_t)0);
   }
 
   for (int i = 0; i < eventProcessor.n_dthreads; i++) {
-    tlp = ((RecRawStat *) ((char *) (eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
+    tlp = ((RecRawStat *)((char *)(eventProcessor.all_dthreads[i]) + rsb->ethr_stat_offset)) + id;
     ink_atomic_swap(&(tlp->count), (int64_t)0);
   }
 
@@ -327,15 +331,11 @@ recv_message_cb__process(RecMessage *msg, RecMessageT msg_type, void *cookie)
 //-------------------------------------------------------------------------
 // raw_stat_sync_cont
 //-------------------------------------------------------------------------
-struct raw_stat_sync_cont: public Continuation
-{
-  raw_stat_sync_cont(ProxyMutex *m)
-    : Continuation(m)
-  {
-    SET_HANDLER(&raw_stat_sync_cont::exec_callbacks);
-  }
+struct raw_stat_sync_cont : public Continuation {
+  raw_stat_sync_cont(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&raw_stat_sync_cont::exec_callbacks); }
 
-  int exec_callbacks(int /* event */, Event * /* e */)
+  int
+  exec_callbacks(int /* event */, Event * /* e */)
   {
     RecExecRawStatSyncCbs();
     Debug("statsproc", "raw_stat_sync_cont() processed");
@@ -348,15 +348,11 @@ struct raw_stat_sync_cont: public Continuation
 //-------------------------------------------------------------------------
 // config_update_cont
 //-------------------------------------------------------------------------
-struct config_update_cont: public Continuation
-{
-  config_update_cont(ProxyMutex *m)
-    : Continuation(m)
-  {
-    SET_HANDLER(&config_update_cont::exec_callbacks);
-  }
+struct config_update_cont : public Continuation {
+  config_update_cont(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&config_update_cont::exec_callbacks); }
 
-  int exec_callbacks(int /* event */, Event * /* e */)
+  int
+  exec_callbacks(int /* event */, Event * /* e */)
   {
     RecExecConfigUpdateCbs(REC_PROCESS_UPDATE_REQUIRED);
     Debug("statsproc", "config_update_cont() processed");
@@ -369,18 +365,16 @@ struct config_update_cont: public Continuation
 //-------------------------------------------------------------------------
 // sync_cont
 //-------------------------------------------------------------------------
-struct sync_cont: public Continuation
-{
+struct sync_cont : public Continuation {
   textBuffer *m_tb;
 
-  sync_cont(ProxyMutex *m)
-    : Continuation(m)
+  sync_cont(ProxyMutex *m) : Continuation(m)
   {
     SET_HANDLER(&sync_cont::sync);
     m_tb = new textBuffer(65536);
   }
 
-   ~sync_cont()
+  ~sync_cont()
   {
     if (m_tb != NULL) {
       delete m_tb;
@@ -388,12 +382,13 @@ struct sync_cont: public Continuation
     }
   }
 
-  int sync(int /* event */, Event * /* e */)
+  int
+  sync(int /* event */, Event * /* e */)
   {
     send_push_message();
     RecSyncStatsFile();
     if (RecSyncConfigToTB(m_tb) == REC_ERR_OKAY) {
-        RecWriteConfigFile(m_tb);
+      RecWriteConfigFile(m_tb);
     }
     Debug("statsproc", "sync_cont() processed");
 
@@ -533,7 +528,7 @@ RecAllocateRawStatBlock(int num_stats)
   memset(rsb->global, 0, num_stats * sizeof(RecRawStat *));
   rsb->num_stats = 0;
   rsb->max_stats = num_stats;
-  ink_mutex_init(&(rsb->mutex),"net stat mutex");
+  ink_mutex_init(&(rsb->mutex), "net stat mutex");
   return rsb;
 }
 
@@ -543,7 +538,7 @@ RecAllocateRawStatBlock(int num_stats)
 //-------------------------------------------------------------------------
 int
 _RecRegisterRawStat(RecRawStatBlock *rsb, RecT rec_type, const char *name, RecDataT data_type, RecPersistT persist_type, int id,
-                   RecRawStatSyncCb sync_cb)
+                    RecRawStatSyncCb sync_cb)
 {
   Debug("stats", "RecRawStatSyncCb(%s): rsb pointer:%p id:%d\n", name, rsb, id);
 
@@ -626,7 +621,7 @@ RecRawStatSyncAvg(const char *name, RecDataT data_type, RecData *data, RecRawSta
   total.sum = rsb->global[id]->sum;
   total.count = rsb->global[id]->count;
   if (total.count != 0)
-    avg = (float) ((double) total.sum / (double) total.count);
+    avg = (float)((double)total.sum / (double)total.count);
   RecDataSetFromFloat(data_type, data, avg);
   return REC_ERR_OKAY;
 }
@@ -644,8 +639,8 @@ RecRawStatSyncHrTimeAvg(const char *name, RecDataT data_type, RecData *data, Rec
   if (total.count == 0) {
     r = 0.0f;
   } else {
-    r = (float) ((double) total.sum / (double) total.count);
-    r = r / (float) (HRTIME_SECOND);
+    r = (float)((double)total.sum / (double)total.count);
+    r = r / (float)(HRTIME_SECOND);
   }
   RecDataSetFromFloat(data_type, data, r);
   return REC_ERR_OKAY;
@@ -664,7 +659,7 @@ RecRawStatSyncIntMsecsToFloatSeconds(const char *name, RecDataT data_type, RecDa
   if (total.count == 0) {
     r = 0.0f;
   } else {
-    r = (float) ((double) total.sum / 1000);
+    r = (float)((double)total.sum / 1000);
   }
   RecDataSetFromFloat(data_type, data, r);
   return REC_ERR_OKAY;
@@ -683,8 +678,8 @@ RecRawStatSyncMHrTimeAvg(const char *name, RecDataT data_type, RecData *data, Re
   if (total.count == 0) {
     r = 0.0f;
   } else {
-    r = (float) ((double) total.sum / (double) total.count);
-    r = r / (float) (HRTIME_MSECOND);
+    r = (float)((double)total.sum / (double)total.count);
+    r = r / (float)(HRTIME_MSECOND);
   }
   RecDataSetFromFloat(data_type, data, r);
   return REC_ERR_OKAY;
@@ -695,8 +690,8 @@ RecRawStatSyncMHrTimeAvg(const char *name, RecDataT data_type, RecData *data, Re
 // RecIncrRawStatXXX
 //-------------------------------------------------------------------------
 int
-RecIncrRawStatBlock(RecRawStatBlock */* rsb ATS_UNUSED */, EThread */* ethread ATS_UNUSED */,
-                    RecRawStat */* stat_array ATS_UNUSED */)
+RecIncrRawStatBlock(RecRawStatBlock * /* rsb ATS_UNUSED */, EThread * /* ethread ATS_UNUSED */,
+                    RecRawStat * /* stat_array ATS_UNUSED */)
 {
   return REC_ERR_FAIL;
 }
@@ -722,7 +717,7 @@ RecSetRawStatCount(RecRawStatBlock *rsb, int id, int64_t data)
 }
 
 int
-RecSetRawStatBlock(RecRawStatBlock */* rsb ATS_UNUSED */, RecRawStat */* stat_array ATS_UNUSED */)
+RecSetRawStatBlock(RecRawStatBlock * /* rsb ATS_UNUSED */, RecRawStat * /* stat_array ATS_UNUSED */)
 {
   return REC_ERR_FAIL;
 }
@@ -847,7 +842,7 @@ RecRegisterRawStatSyncCb(const char *name, RecRawStatSyncCb sync_cb, RecRawStatB
   RecRecord *r;
 
   ink_rwlock_rdlock(&g_records_rwlock);
-  if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) {
+  if (ink_hash_table_lookup(g_records_ht, name, (void **)&r)) {
     rec_mutex_acquire(&(r->lock));
     if (REC_TYPE_IS_STAT(r->rec_type)) {
       if (!(r->stat_meta.sync_cb)) {
@@ -887,7 +882,7 @@ RecExecRawStatSyncCbs()
           raw_stat_clear(r->stat_meta.sync_rsb, r->stat_meta.sync_id);
           r->stat_meta.sync_rsb->global[r->stat_meta.sync_id]->version = r->version;
         } else {
-          (*(r->stat_meta.sync_cb)) (r->name, r->data_type, &(r->data), r->stat_meta.sync_rsb, r->stat_meta.sync_id);
+          (*(r->stat_meta.sync_cb))(r->name, r->data_type, &(r->data), r->stat_meta.sync_rsb, r->stat_meta.sync_id);
         }
         r->sync_required = REC_SYNC_REQUIRED;
       }
@@ -899,7 +894,7 @@ RecExecRawStatSyncCbs()
 }
 
 void
-RecSignalManager(int id, const char * msg, size_t msgsize)
+RecSignalManager(int id, const char *msg, size_t msgsize)
 {
   ink_assert(pmgmt);
   pmgmt->signalManager(id, msg, msgsize);
@@ -916,7 +911,7 @@ RecRegisterManagerCb(int _signal, RecManagerCb _fn, void *_data)
 //-------------------------------------------------------------------------
 
 int
-RecMessageSend(RecMessage * msg)
+RecMessageSend(RecMessage *msg)
 {
   int msg_size;
 
@@ -927,9 +922,8 @@ RecMessageSend(RecMessage * msg)
   if (g_mode_type == RECM_CLIENT || g_mode_type == RECM_SERVER) {
     msg->o_end = msg->o_write;
     msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start);
-    pmgmt->signalManager(MGMT_SIGNAL_LIBRECORDS, (char *) msg, msg_size);
+    pmgmt->signalManager(MGMT_SIGNAL_LIBRECORDS, (char *)msg, msg_size);
   }
 
   return REC_ERR_OKAY;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/RecUtils.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecUtils.cc b/lib/records/RecUtils.cc
index bee8eec..cd9246b 100644
--- a/lib/records/RecUtils.cc
+++ b/lib/records/RecUtils.cc
@@ -44,7 +44,7 @@ RecRecordFree(RecRecord *r)
 //-------------------------------------------------------------------------
 // RecAlloc
 //-------------------------------------------------------------------------
-RecRecord*
+RecRecord *
 RecAlloc(RecT rec_type, const char *name, RecDataT data_type)
 {
   if (g_num_records >= REC_MAX_RECORDS) {
@@ -69,7 +69,7 @@ RecAlloc(RecT rec_type, const char *name, RecDataT data_type)
 // RecDataClear
 //-------------------------------------------------------------------------
 void
-RecDataClear(RecDataT data_type, RecData * data)
+RecDataClear(RecDataT data_type, RecData *data)
 {
   if ((data_type == RECD_STRING) && (data->rec_string)) {
     ats_free(data->rec_string);
@@ -78,7 +78,7 @@ RecDataClear(RecDataT data_type, RecData * data)
 }
 
 void
-RecDataSetMax(RecDataT type, RecData * data)
+RecDataSetMax(RecDataT type, RecData *data)
 {
   switch (type) {
 #if defined(STAT_PROCESSOR)
@@ -100,7 +100,7 @@ RecDataSetMax(RecDataT type, RecData * data)
 }
 
 void
-RecDataSetMin(RecDataT type, RecData * data)
+RecDataSetMin(RecDataT type, RecData *data)
 {
   switch (type) {
 #if defined(STAT_PROCESSOR)
@@ -125,7 +125,7 @@ RecDataSetMin(RecDataT type, RecData * data)
 // RecDataSet
 //-------------------------------------------------------------------------
 bool
-RecDataSet(RecDataT data_type, RecData * data_dst, RecData * data_src)
+RecDataSet(RecDataT data_type, RecData *data_dst, RecData *data_src)
 {
   bool rec_set = false;
 
@@ -174,7 +174,6 @@ RecDataSet(RecDataT data_type, RecData * data_dst, RecData * data_src)
     ink_assert(!"Wrong RECD type!");
   }
   return rec_set;
-
 }
 
 int
@@ -320,7 +319,7 @@ RecDataDiv(RecDataT type, RecData left, RecData right)
 // RecDataSetFromInk64
 //-------------------------------------------------------------------------
 bool
-RecDataSetFromInk64(RecDataT data_type, RecData * data_dst, int64_t data_int64)
+RecDataSetFromInk64(RecDataT data_type, RecData *data_dst, int64_t data_int64)
 {
   switch (data_type) {
 #if defined(STAT_PROCESSOR)
@@ -333,17 +332,16 @@ RecDataSetFromInk64(RecDataT data_type, RecData * data_dst, int64_t data_int64)
   case RECD_CONST:
 #endif
   case RECD_FLOAT:
-    data_dst->rec_float = (float) (data_int64);
+    data_dst->rec_float = (float)(data_int64);
     break;
-  case RECD_STRING:
-    {
-      char buf[32 + 1];
+  case RECD_STRING: {
+    char buf[32 + 1];
 
-      ats_free(data_dst->rec_string);
-      snprintf(buf, 32, "%" PRId64 "", data_int64);
-      data_dst->rec_string = ats_strdup(buf);
-      break;
-    }
+    ats_free(data_dst->rec_string);
+    snprintf(buf, 32, "%" PRId64 "", data_int64);
+    data_dst->rec_string = ats_strdup(buf);
+    break;
+  }
   case RECD_COUNTER:
     data_dst->rec_counter = data_int64;
     break;
@@ -360,32 +358,31 @@ RecDataSetFromInk64(RecDataT data_type, RecData * data_dst, int64_t data_int64)
 // RecDataSetFromFloat
 //-------------------------------------------------------------------------
 bool
-RecDataSetFromFloat(RecDataT data_type, RecData * data_dst, float data_float)
+RecDataSetFromFloat(RecDataT data_type, RecData *data_dst, float data_float)
 {
   switch (data_type) {
 #if defined(STAT_PROCESSOR)
   case RECD_FX:
 #endif
   case RECD_INT:
-    data_dst->rec_int = (RecInt) data_float;
+    data_dst->rec_int = (RecInt)data_float;
     break;
 #if defined(STAT_PROCESSOR)
   case RECD_CONST:
 #endif
   case RECD_FLOAT:
-    data_dst->rec_float = (float) (data_float);
+    data_dst->rec_float = (float)(data_float);
     break;
-  case RECD_STRING:
-    {
-      char buf[32 + 1];
+  case RECD_STRING: {
+    char buf[32 + 1];
 
-      ats_free(data_dst->rec_string);
-      snprintf(buf, 32, "%f", data_float);
-      data_dst->rec_string = ats_strdup(buf);
-      break;
-    }
+    ats_free(data_dst->rec_string);
+    snprintf(buf, 32, "%f", data_float);
+    data_dst->rec_string = ats_strdup(buf);
+    break;
+  }
   case RECD_COUNTER:
-    data_dst->rec_counter = (RecCounter) data_float;
+    data_dst->rec_counter = (RecCounter)data_float;
     break;
   default:
     ink_assert(!"Unexpected RecD type");
@@ -400,7 +397,7 @@ RecDataSetFromFloat(RecDataT data_type, RecData * data_dst, float data_float)
 // RecDataSetFromString
 //-------------------------------------------------------------------------
 bool
-RecDataSetFromString(RecDataT data_type, RecData * data_dst, const char *data_string)
+RecDataSetFromString(RecDataT data_type, RecData *data_dst, const char *data_string)
 {
   bool rec_set;
   RecData data_src;
@@ -437,4 +434,3 @@ RecDataSetFromString(RecDataT data_type, RecData * data_dst, const char *data_st
 
   return rec_set;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/test_I_RecLocal.cc
----------------------------------------------------------------------
diff --git a/lib/records/test_I_RecLocal.cc b/lib/records/test_I_RecLocal.cc
index b545f92..5616f66 100644
--- a/lib/records/test_I_RecLocal.cc
+++ b/lib/records/test_I_RecLocal.cc
@@ -41,10 +41,9 @@ int g_config_update_result = 0;
 int
 cb_test_1a(const char *name, RecDataT data_type, RecData data, void *cookie)
 {
-  if ((cookie == (void *) 0x12345678) && (strcmp(data.rec_string, "cb_test_1__changed") == 0)) {
+  if ((cookie == (void *)0x12345678) && (strcmp(data.rec_string, "cb_test_1__changed") == 0)) {
     g_config_update_result++;
-    printf("    - cb_test_1(%d) name: %s, data: %s, cookie: 0x%x\n",
-           g_config_update_result, name, data.rec_string, cookie);
+    printf("    - cb_test_1(%d) name: %s, data: %s, cookie: 0x%x\n", g_config_update_result, name, data.rec_string, cookie);
   } else {
     g_config_update_result = 0;
   }
@@ -58,8 +57,8 @@ cb_test_1b(const char *name, RecDataT data_type, RecData data, void *cookie)
 }
 
 int
-cb_test_2a(const char */* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */,
-           RecData /* data ATS_UNUSED */, void */* cookie ATS_UNUSED */)
+cb_test_2a(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData /* data ATS_UNUSED */,
+           void * /* cookie ATS_UNUSED */)
 {
   g_config_update_result = -1;
   return REC_ERR_FAIL;
@@ -87,10 +86,10 @@ Test01()
   sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
 
   // Register config update callbacks
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_1", cb_test_1a, (void *) 0x12345678);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_1", cb_test_1b, (void *) 0x12345678);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_2", cb_test_2a, (void *) 0x87654321);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_2", cb_test_2b, (void *) 0x87654321);
+  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_1", cb_test_1a, (void *)0x12345678);
+  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_1", cb_test_1b, (void *)0x12345678);
+  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_2", cb_test_2a, (void *)0x87654321);
+  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_2", cb_test_2b, (void *)0x87654321);
 
   // Change proxy.config.cb_test_1
   RecSetRecordString("proxy.config.local.cb_test_1", "cb_test_1__changed");
@@ -103,7 +102,6 @@ Test01()
   } else {
     printf("    SUMMARY: FAIL (%d)\n", g_config_update_result);
   }
-
 }
 
 
@@ -121,9 +119,7 @@ cb_test_3a(const char *name, RecDataT data_type, RecData data, void *cookie)
   RecString rec_result;
   int rec_status = RecGetRecordString_Xmalloc(name, &rec_result);
 
-  if ((rec_status == REC_ERR_OKAY) &&
-      (cookie == (void *) 0x12344321) && (strcmp(rec_result, "cb_test_3__changed") == 0)) {
-
+  if ((rec_status == REC_ERR_OKAY) && (cookie == (void *)0x12344321) && (strcmp(rec_result, "cb_test_3__changed") == 0)) {
     ink_assert(strcmp(rec_result, data.rec_string) == 0);
 
     g_config_update_result++;
@@ -155,8 +151,8 @@ Test02()
   sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
 
   // Register config update callbacks
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_3", cb_test_3a, (void *) 0x12344321);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_3", cb_test_3b, (void *) 0x12344321);
+  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_3", cb_test_3a, (void *)0x12344321);
+  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_3", cb_test_3b, (void *)0x12344321);
 
   // Change proxy.config.cb_test_1
   RecSetRecordString("proxy.config.local.cb_test_3", "cb_test_3__changed");
@@ -169,7 +165,6 @@ Test02()
   } else {
     printf("    SUMMARY: FAIL (%d)\n", g_config_update_result);
   }
-
 }
 
 
@@ -200,9 +195,9 @@ main(int argc, char **argv)
   RecLocalStart();
 
   // test
-  Test01();                     // Local callbacks
-  Test02();                     // Local callbacks -- mulit-lock
-  Test03();                     // RecTree
+  Test01(); // Local callbacks
+  Test02(); // Local callbacks -- mulit-lock
+  Test03(); // RecTree
 
   while (true) {
     RecDumpRecordsHt(RECT_NULL);
@@ -210,5 +205,4 @@ main(int argc, char **argv)
   }
 
   return 0;
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/records/test_RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/lib/records/test_RecordsConfig.cc b/lib/records/test_RecordsConfig.cc
index e62e4a8..da1daa2 100644
--- a/lib/records/test_RecordsConfig.cc
+++ b/lib/records/test_RecordsConfig.cc
@@ -30,7 +30,6 @@
 void
 RecordsConfigRegister()
 {
-
   RecRegisterConfigString(RECT_CONFIG, "proxy.config.parse_test_2a", NULL, RECU_DYNAMIC, RECC_NULL, NULL);
   RecRegisterConfigString(RECT_CONFIG, "proxy.config.parse_test_2b", NULL, RECU_DYNAMIC, RECC_NULL, NULL);
   RecRegisterConfigString(RECT_CONFIG, "proxy.config.parse_test_3a", NULL, RECU_DYNAMIC, RECC_NULL, NULL);
@@ -40,12 +39,9 @@ RecordsConfigRegister()
 
   RecRegisterConfigString(RECT_CONFIG, "proxy.config.cb_test_1", "cb_test_1__original", RECU_DYNAMIC, RECC_NULL, NULL);
   RecRegisterConfigString(RECT_CONFIG, "proxy.config.cb_test_2", "cb_test_2__original", RECU_DYNAMIC, RECC_NULL, NULL);
-  RecRegisterConfigString(RECT_CONFIG, "proxy.config.local.cb_test_1", "cb_test_1__original", RECU_DYNAMIC, RECC_NULL,
-                          NULL);
-  RecRegisterConfigString(RECT_CONFIG, "proxy.config.local.cb_test_2", "cb_test_2__original", RECU_DYNAMIC, RECC_NULL,
-                          NULL);
-  RecRegisterConfigString(RECT_CONFIG, "proxy.config.local.cb_test_3", "cb_test_3__original", RECU_DYNAMIC, RECC_NULL,
-                          NULL);
+  RecRegisterConfigString(RECT_CONFIG, "proxy.config.local.cb_test_1", "cb_test_1__original", RECU_DYNAMIC, RECC_NULL, NULL);
+  RecRegisterConfigString(RECT_CONFIG, "proxy.config.local.cb_test_2", "cb_test_2__original", RECU_DYNAMIC, RECC_NULL, NULL);
+  RecRegisterConfigString(RECT_CONFIG, "proxy.config.local.cb_test_3", "cb_test_3__original", RECU_DYNAMIC, RECC_NULL, NULL);
   RecRegisterConfigInt(RECT_CONFIG, "proxy.config.link_test_1", 0, RECU_DYNAMIC, RECC_NULL, NULL);
   RecRegisterConfigFloat(RECT_CONFIG, "proxy.config.link_test_2", 0.0f, RECU_DYNAMIC, RECC_NULL, NULL);
   RecRegisterConfigCounter(RECT_CONFIG, "proxy.config.link_test_3", 0, RECU_DYNAMIC, RECC_NULL, NULL);
@@ -56,5 +52,4 @@ RecordsConfigRegister()
   RecRegisterStatInt(RECT_NODE, "proxy.node.cb_test_int", 0, RECP_NON_PERSISTENT);
   RecRegisterStatFloat(RECT_NODE, "proxy.node.cb_test_float", 0.0f, RECP_NON_PERSISTENT);
   RecRegisterStatCounter(RECT_NODE, "proxy.node.cb_test_count", 0, RECP_NON_PERSISTENT);
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Allocator.h
----------------------------------------------------------------------
diff --git a/lib/ts/Allocator.h b/lib/ts/Allocator.h
index 9f4edde..b243901 100644
--- a/lib/ts/Allocator.h
+++ b/lib/ts/Allocator.h
@@ -45,7 +45,7 @@
 #include "ink_defs.h"
 #include "ink_resource.h"
 
-#define RND16(_x)               (((_x)+15)&~15)
+#define RND16(_x) (((_x) + 15) & ~15)
 
 /** Allocator for fixed size memory blocks. */
 class Allocator
@@ -75,10 +75,7 @@ public:
     ink_freelist_free_bulk(this->fl, head, tail, num_item);
   }
 
-  Allocator()
-  {
-    fl = NULL;
-  }
+  Allocator() { fl = NULL; }
 
   /**
     Creates a new allocator.
@@ -88,8 +85,7 @@ public:
     @param chunk_size number of units to be allocated if free pool is empty.
     @param alignment of objects must be a power of 2.
   */
-  Allocator(const char *name, unsigned int element_size,
-            unsigned int chunk_size = 128, unsigned int alignment = 8)
+  Allocator(const char *name, unsigned int element_size, unsigned int chunk_size = 128, unsigned int alignment = 8)
   {
     ink_freelist_init(&fl, name, element_size, chunk_size, alignment);
   }
@@ -114,16 +110,17 @@ protected:
   copied onto the new objects. This is done for performance reasons.
 
 */
-template<class C> class ClassAllocator: public Allocator {
+template <class C> class ClassAllocator : public Allocator
+{
 public:
   /** Allocates objects of the templated type. */
-  C*
+  C *
   alloc()
   {
     void *ptr = ink_freelist_new(this->fl);
 
     memcpy(ptr, (void *)&this->proto.typeObject, sizeof(C));
-    return (C *) ptr;
+    return (C *)ptr;
   }
 
   /**
@@ -132,7 +129,7 @@ public:
     @param ptr pointer to be freed.
   */
   void
-  free(C * ptr)
+  free(C *ptr)
   {
     ink_freelist_free(this->fl, ptr);
   }
@@ -154,10 +151,10 @@ public:
     Allocate objects of the templated type via the inherited interface
     using void pointers.
   */
-  void*
+  void *
   alloc_void()
   {
-    return (void *) alloc();
+    return (void *)alloc();
   }
 
   /**
@@ -169,7 +166,7 @@ public:
   void
   free_void(void *ptr)
   {
-    free((C *) ptr);
+    free((C *)ptr);
   }
 
   /**
@@ -183,7 +180,7 @@ public:
   void
   free_void_bulk(void *head, void *tail, size_t num_item)
   {
-    free_bulk((C *) head, (C *) tail, num_item);
+    free_bulk((C *)head, (C *)tail, num_item);
   }
 
   /**
@@ -193,14 +190,12 @@ public:
     @param chunk_size number of units to be allocated if free pool is empty.
     @param alignment of objects must be a power of 2.
   */
-  ClassAllocator(const char *name, unsigned int chunk_size = 128,
-                 unsigned int alignment = 16)
+  ClassAllocator(const char *name, unsigned int chunk_size = 128, unsigned int alignment = 16)
   {
     ink_freelist_init(&this->fl, name, RND16(sizeof(C)), chunk_size, RND16(alignment));
   }
 
-  struct
-  {
+  struct {
     C typeObject;
     int64_t space_holder;
   } proto;
@@ -216,11 +211,11 @@ public:
   all of the members.
 
 */
-template<class C> class SparseClassAllocator:public ClassAllocator<C> {
+template <class C> class SparseClassAllocator : public ClassAllocator<C>
+{
 public:
-
   /** Allocates objects of the templated type. */
-  C*
+  C *
   alloc()
   {
     void *ptr = ink_freelist_new(this->fl);
@@ -228,8 +223,8 @@ public:
     if (!_instantiate) {
       memcpy(ptr, (void *)&this->proto.typeObject, sizeof(C));
     } else
-      (*_instantiate) ((C *) &this->proto.typeObject, (C *) ptr);
-    return (C *) ptr;
+      (*_instantiate)((C *)&this->proto.typeObject, (C *)ptr);
+    return (C *)ptr;
   }
 
 
@@ -242,16 +237,15 @@ public:
     @param instantiate_func
 
   */
-  SparseClassAllocator(const char *name, unsigned int chunk_size = 128,
-                       unsigned int alignment = 16,
-                       void (*instantiate_func) (C * proto, C * instance) = NULL)
+  SparseClassAllocator(const char *name, unsigned int chunk_size = 128, unsigned int alignment = 16,
+                       void (*instantiate_func)(C *proto, C *instance) = NULL)
     : ClassAllocator<C>(name, chunk_size, alignment)
   {
-    _instantiate = instantiate_func;       // NULL by default
+    _instantiate = instantiate_func; // NULL by default
   }
 
 private:
-  void (*_instantiate) (C* proto, C* instance);
+  void (*_instantiate)(C *proto, C *instance);
 };
 
-#endif  // _Allocator_h_
+#endif // _Allocator_h_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Arena.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Arena.cc b/lib/ts/Arena.cc
index 95e3cdd..6ab9bdb 100644
--- a/lib/ts/Arena.cc
+++ b/lib/ts/Arena.cc
@@ -26,8 +26,8 @@
 #include <string.h>
 
 
-#define DEFAULT_ALLOC_SIZE   1024
-#define DEFAULT_BLOCK_SIZE   (DEFAULT_ALLOC_SIZE - (sizeof (ArenaBlock) - 8))
+#define DEFAULT_ALLOC_SIZE 1024
+#define DEFAULT_BLOCK_SIZE (DEFAULT_ALLOC_SIZE - (sizeof(ArenaBlock) - 8))
 
 
 static Allocator defaultSizeArenaBlock("ArenaBlock", DEFAULT_ALLOC_SIZE);
@@ -42,7 +42,7 @@ blk_alloc(int size)
   ArenaBlock *blk;
 
   if (size == DEFAULT_BLOCK_SIZE) {
-    blk = (ArenaBlock *) defaultSizeArenaBlock.alloc_void();
+    blk = (ArenaBlock *)defaultSizeArenaBlock.alloc_void();
   } else {
     blk = (ArenaBlock *)ats_malloc(size + sizeof(ArenaBlock) - 8);
   }
@@ -58,7 +58,7 @@ blk_alloc(int size)
   -------------------------------------------------------------------------*/
 
 static inline void
-blk_free(ArenaBlock * blk)
+blk_free(ArenaBlock *blk)
 {
   int size;
 
@@ -75,16 +75,16 @@ blk_free(ArenaBlock * blk)
   -------------------------------------------------------------------------*/
 
 static void *
-block_alloc(ArenaBlock * block, size_t size, size_t alignment)
+block_alloc(ArenaBlock *block, size_t size, size_t alignment)
 {
   char *mem;
 
   mem = block->m_water_level;
-  if (((size_t) mem) & (alignment - 1)) {
-    mem += (alignment - ((size_t) mem)) & (alignment - 1);
+  if (((size_t)mem) & (alignment - 1)) {
+    mem += (alignment - ((size_t)mem)) & (alignment - 1);
   }
 
-  if ((block->m_heap_end >= mem) && (((size_t) block->m_heap_end - (size_t) mem) >= size)) {
+  if ((block->m_heap_end >= mem) && (((size_t)block->m_heap_end - (size_t)mem) >= size)) {
     block->m_water_level = mem + size;
     return mem;
   }
@@ -110,7 +110,7 @@ Arena::alloc(size_t size, size_t alignment)
     b = b->next;
   }
 
-  block_size = (unsigned int) (size * 1.5);
+  block_size = (unsigned int)(size * 1.5);
   if (block_size < DEFAULT_BLOCK_SIZE) {
     block_size = DEFAULT_BLOCK_SIZE;
   }
@@ -137,8 +137,8 @@ Arena::free(void *mem, size_t size)
       b = b->next;
     }
 
-    if (b->m_water_level == ((char *) mem + size)) {
-      b->m_water_level = (char *) mem;
+    if (b->m_water_level == ((char *)mem + size)) {
+      b->m_water_level = (char *)mem;
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Arena.h
----------------------------------------------------------------------
diff --git a/lib/ts/Arena.h b/lib/ts/Arena.h
index e3c26f5..0fda648 100644
--- a/lib/ts/Arena.h
+++ b/lib/ts/Arena.h
@@ -30,8 +30,7 @@
 #include "ink_assert.h"
 
 
-struct ArenaBlock
-{
+struct ArenaBlock {
   ArenaBlock *next;
   char *m_heap_end;
   char *m_water_level;
@@ -42,13 +41,8 @@ struct ArenaBlock
 class Arena
 {
 public:
-  Arena():m_blocks(NULL)
-  {
-  }
-   ~Arena()
-  {
-    reset();
-  }
+  Arena() : m_blocks(NULL) {}
+  ~Arena() { reset(); }
 
   inkcoreapi void *alloc(size_t size, size_t alignment = sizeof(double));
   void free(void *mem, size_t size);
@@ -60,7 +54,7 @@ public:
   inkcoreapi void reset();
 
 private:
-  ArenaBlock * m_blocks;
+  ArenaBlock *m_blocks;
 };
 
 
@@ -73,7 +67,7 @@ Arena::str_length(const char *str)
   unsigned char *s, *e;
   size_t len;
 
-  e = (unsigned char *) str;
+  e = (unsigned char *)str;
   s = e - 1;
 
   while (*s >= 128) {
@@ -120,19 +114,19 @@ Arena::str_alloc(size_t len)
     tmp /= 128;
   }
 
-  mem = (unsigned char *) alloc(size, 1);
+  mem = (unsigned char *)alloc(size, 1);
 
   mem += (size - len - 1);
   p = mem - 1;
   tmp = len;
 
   while (tmp >= 128) {
-    *p-- = (unsigned char) (255 - (tmp % 128));
+    *p-- = (unsigned char)(255 - (tmp % 128));
     tmp /= 128;
   }
-  *p = (unsigned char) tmp;
+  *p = (unsigned char)tmp;
 
-  return (char *) mem;
+  return (char *)mem;
 }
 
 /*-------------------------------------------------------------------------
@@ -144,7 +138,7 @@ Arena::str_free(char *str)
   unsigned char *p, *s, *e;
   size_t len;
 
-  e = (unsigned char *) str;
+  e = (unsigned char *)str;
   s = e - 1;
 
   while (*s >= 128) {
@@ -179,4 +173,3 @@ Arena::str_store(const char *str, size_t len)
 
 
 #endif /* __ARENA_H__ */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Bitops.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Bitops.cc b/lib/ts/Bitops.cc
index 44a9942..ee0a26f 100644
--- a/lib/ts/Bitops.cc
+++ b/lib/ts/Bitops.cc
@@ -25,39 +25,19 @@
 
 
 unsigned char bit_table[256] = {
-  0, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  7, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  8, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  7, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
-  5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
+  0, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2,
+  1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 7, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1,
+  2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 8,
+  1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1,
+  3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 7, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2,
+  1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1,
 };
 
 unsigned char bit_count_table[256] = {
-  0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
-  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-  4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
+  0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3,
+  4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4,
+  4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1,
+  2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5,
+  4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5,
+  6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Bitops.h
----------------------------------------------------------------------
diff --git a/lib/ts/Bitops.h b/lib/ts/Bitops.h
index 76ed1f0..8bf7b59 100644
--- a/lib/ts/Bitops.h
+++ b/lib/ts/Bitops.h
@@ -136,7 +136,7 @@ bitops_next_set(unsigned char *start, unsigned char *end, int offset)
     idx = bit_table[*p];
     if (idx) {
       c = *p;
-      while (idx && (idx <= (size_t) t)) {
+      while (idx && (idx <= (size_t)t)) {
         c &= ~(1 << (idx - 1));
         idx = bit_table[c];
       }
@@ -153,10 +153,10 @@ bitops_next_set(unsigned char *start, unsigned char *end, int offset)
     idx -= 1;
     idx += (p - start) * 8;
   } else {
-    idx = (size_t) - 1;
+    idx = (size_t)-1;
   }
 
-  return (int) idx;
+  return (int)idx;
 }
 
 static inline int
@@ -177,7 +177,7 @@ bitops_next_unset(unsigned char *start, unsigned char *end, int offset)
     c = ~(*p);
     idx = bit_table[c];
     if (idx) {
-      while (idx && (idx <= (size_t) t)) {
+      while (idx && (idx <= (size_t)t)) {
         c &= ~(1 << (idx - 1));
         idx = bit_table[c];
       }
@@ -194,10 +194,10 @@ bitops_next_unset(unsigned char *start, unsigned char *end, int offset)
     idx -= 1;
     idx += (p - start) * 8;
   } else {
-    idx = (size_t) - 1;
+    idx = (size_t)-1;
   }
 
-  return (int) idx;
+  return (int)idx;
 }
 
 static inline int
@@ -272,4 +272,3 @@ bitops_isset(unsigned char *val, int bit)
 }
 
 #endif /* __BITOPS_H__ */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/CompileParseRules.cc
----------------------------------------------------------------------
diff --git a/lib/ts/CompileParseRules.cc b/lib/ts/CompileParseRules.cc
index 20a10f3..53406fe 100644
--- a/lib/ts/CompileParseRules.cc
+++ b/lib/ts/CompileParseRules.cc
@@ -25,9 +25,9 @@
 
 #include "ParseRules.h"
 
-const unsigned int parseRulesCType[256] = { 0 };
-const char parseRulesCTypeToUpper[256] = { 0 };
-const char parseRulesCTypeToLower[256] = { 0 };
+const unsigned int parseRulesCType[256] = {0};
+const char parseRulesCTypeToUpper[256] = {0};
+const char parseRulesCTypeToLower[256] = {0};
 
 unsigned int tparseRulesCType[256];
 char tparseRulesCTypeToUpper[256];
@@ -130,7 +130,7 @@ main()
   for (c = 0; c < 256; c++) {
     fprintf(fp, "/* %3d (%c) */\t", c, (isprint(c) ? c : '?'));
     fprintf(fp, "0x%08X%c\t\t", tparseRulesCType[c], (c != 255 ? ',' : ' '));
-    fprintf(fp, "/* [%s] */\n", uint_to_binary((unsigned int) (tparseRulesCType[c])));
+    fprintf(fp, "/* [%s] */\n", uint_to_binary((unsigned int)(tparseRulesCType[c])));
   }
   fclose(fp);
   fp = fopen("ParseRulesCTypeToUpper", "w");


[37/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterHandlerBase.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterHandlerBase.cc b/iocore/cluster/ClusterHandlerBase.cc
index 1fec3ff..d116af0 100644
--- a/iocore/cluster/ClusterHandlerBase.cc
+++ b/iocore/cluster/ClusterHandlerBase.cc
@@ -40,14 +40,10 @@ extern int num_of_cluster_threads;
 // Incoming message continuation for periodic callout threads
 ///////////////////////////////////////////////////////////////
 
-ClusterCalloutContinuation::ClusterCalloutContinuation(struct ClusterHandler *ch)
-  :
-Continuation(0),
-_ch(ch)
+ClusterCalloutContinuation::ClusterCalloutContinuation(struct ClusterHandler *ch) : Continuation(0), _ch(ch)
 {
   mutex = new_ProxyMutex();
-  SET_HANDLER((ClstCoutContHandler)
-              & ClusterCalloutContinuation::CalloutHandler);
+  SET_HANDLER((ClstCoutContHandler)&ClusterCalloutContinuation::CalloutHandler);
 }
 
 ClusterCalloutContinuation::~ClusterCalloutContinuation()
@@ -64,8 +60,8 @@ ClusterCalloutContinuation::CalloutHandler(int /* event ATS_UNUSED */, Event * /
 /*************************************************************************/
 // ClusterControl member functions (Internal Class)
 /*************************************************************************/
-ClusterControl::ClusterControl():
-Continuation(NULL), len(0), size_index(-1), real_data(0), data(0), free_proc(0), free_proc_arg(0), iob_block(0)
+ClusterControl::ClusterControl()
+  : Continuation(NULL), len(0), size_index(-1), real_data(0), data(0), free_proc(0), free_proc_arg(0), iob_block(0)
 {
 }
 
@@ -79,25 +75,25 @@ ClusterControl::real_alloc_data(int read_access, bool align_int32_on_non_int64_b
   if ((len + DATA_HDR + sizeof(int32_t)) <= DEFAULT_MAX_BUFFER_SIZE) {
     size_index = buffer_size_to_index(len + DATA_HDR + sizeof(int32_t), MAX_BUFFER_SIZE_INDEX);
     iob_block = new_IOBufferBlock();
-    iob_block->alloc(size_index);       // aligns on 8 byte boundary
-    real_data = (int64_t *) iob_block->buf();
+    iob_block->alloc(size_index); // aligns on 8 byte boundary
+    real_data = (int64_t *)iob_block->buf();
 
     if (align_int32_on_non_int64_boundary) {
-      data = ((char *) real_data) + sizeof(int32_t) + DATA_HDR;
+      data = ((char *)real_data) + sizeof(int32_t) + DATA_HDR;
     } else {
-      data = ((char *) real_data) + DATA_HDR;
+      data = ((char *)real_data) + DATA_HDR;
     }
   } else {
     int size = sizeof(int64_t) * (((len + DATA_HDR + sizeof(int32_t) + sizeof(int64_t) - 1) / sizeof(int64_t)) + 1);
     size_index = -1;
     iob_block = new_IOBufferBlock();
     iob_block->alloc(BUFFER_SIZE_FOR_XMALLOC(size));
-    real_data = (int64_t *) iob_block->buf();
+    real_data = (int64_t *)iob_block->buf();
 
     if (align_int32_on_non_int64_boundary) {
-      data = (char *) DOUBLE_ALIGN(real_data) + sizeof(int32_t) + DATA_HDR;
+      data = (char *)DOUBLE_ALIGN(real_data) + sizeof(int32_t) + DATA_HDR;
     } else {
-      data = (char *) DOUBLE_ALIGN(real_data) + DATA_HDR;
+      data = (char *)DOUBLE_ALIGN(real_data) + DATA_HDR;
     }
     CLUSTER_INCREMENT_DYN_STAT(CLUSTER_ALLOC_DATA_NEWS_STAT);
   }
@@ -105,26 +101,26 @@ ClusterControl::real_alloc_data(int read_access, bool align_int32_on_non_int64_b
   // IOBufferBlock adjustments
   if (read_access) {
     // Make iob_block->read_avail() == len
-    iob_block->fill((char *) data - (char *) real_data);        // skip header
-    iob_block->consume((char *) data - (char *) real_data);     // skip header
+    iob_block->fill((char *)data - (char *)real_data);    // skip header
+    iob_block->consume((char *)data - (char *)real_data); // skip header
     iob_block->fill(len);
   } else {
     // Make iob_block->write_avail() == len
-    iob_block->fill((char *) data - (char *) real_data);        // skip header
-    iob_block->consume((char *) data - (char *) real_data);     // skip header
+    iob_block->fill((char *)data - (char *)real_data);    // skip header
+    iob_block->consume((char *)data - (char *)real_data); // skip header
     iob_block->_buf_end = iob_block->end() + len;
   }
 
   // Write size_index, magic number and 'this' in leading bytes
-  char *size_index_ptr = (char *) data - DATA_HDR;
+  char *size_index_ptr = (char *)data - DATA_HDR;
   *size_index_ptr = size_index;
   ++size_index_ptr;
 
-  *size_index_ptr = (char) ALLOC_DATA_MAGIC;
+  *size_index_ptr = (char)ALLOC_DATA_MAGIC;
   ++size_index_ptr;
 
-  void *val = (void *) this;
-  memcpy(size_index_ptr, (char *) &val, sizeof(void *));
+  void *val = (void *)this;
+  memcpy(size_index_ptr, (char *)&val, sizeof(void *));
 }
 
 void
@@ -133,20 +129,20 @@ ClusterControl::free_data()
   if (data && iob_block) {
     if (free_proc) {
       // Free memory via callback proc
-      (*free_proc) (free_proc_arg);
-      iob_block = 0;            // really free memory
+      (*free_proc)(free_proc_arg);
+      iob_block = 0; // really free memory
       return;
     }
     if (real_data) {
-      ink_release_assert(*(((uint8_t *) data) - DATA_HDR + 1) == (uint8_t) ALLOC_DATA_MAGIC);
-      *(((uint8_t *) data) - DATA_HDR + 1) = (uint8_t) ~ ALLOC_DATA_MAGIC;
+      ink_release_assert(*(((uint8_t *)data) - DATA_HDR + 1) == (uint8_t)ALLOC_DATA_MAGIC);
+      *(((uint8_t *)data) - DATA_HDR + 1) = (uint8_t)~ALLOC_DATA_MAGIC;
 
-      ink_release_assert(*(((char *) data) - DATA_HDR) == size_index);
+      ink_release_assert(*(((char *)data) - DATA_HDR) == size_index);
     } else {
       // malloc'ed memory, not alloced via real_alloc_data().
       // Data will be ats_free()'ed when IOBufferBlock is freed
     }
-    iob_block = 0;              // free memory
+    iob_block = 0; // free memory
   }
 }
 
@@ -159,8 +155,7 @@ IncomingControl::alloc()
   return inControlAllocator.alloc();
 }
 
-IncomingControl::IncomingControl()
-:recognized_time(0)
+IncomingControl::IncomingControl() : recognized_time(0)
 {
 }
 
@@ -180,27 +175,26 @@ OutgoingControl::alloc()
   return outControlAllocator.alloc();
 }
 
-OutgoingControl::OutgoingControl()
-:ch(NULL), submit_time(0)
+OutgoingControl::OutgoingControl() : ch(NULL), submit_time(0)
 {
 }
 
 int
-OutgoingControl::startEvent(int event, Event * e)
+OutgoingControl::startEvent(int event, Event *e)
 {
   //
   // This event handler is used by ClusterProcessor::invoke_remote()
   // to delay (CLUSTER_OPT_DELAY) the enqueuing of the control message.
   //
-  (void) event;
-  (void) e;
+  (void)event;
+  (void)e;
   // verify that the machine has not gone down
   if (!ch || !ch->thread)
     return EVENT_DONE;
 
-  int32_t cluster_fn = *(int32_t *) this->data;
+  int32_t cluster_fn = *(int32_t *)this->data;
   int32_t pri = ClusterFuncToQpri(cluster_fn);
-  ink_atomiclist_push(&ch->outgoing_control_al[pri], (void *) this);
+  ink_atomiclist_push(&ch->outgoing_control_al[pri], (void *)this);
 
   return EVENT_DONE;
 }
@@ -215,26 +209,11 @@ OutgoingControl::freeall()
 /*************************************************************************/
 // ClusterState member functions (Internal Class)
 /*************************************************************************/
-ClusterState::ClusterState(ClusterHandler * c, bool read_chan):
-Continuation(0),
-ch(c),
-read_channel(read_chan),
-do_iodone_event(false),
-n_descriptors(0),
-sequence_number(0),
-to_do(0),
-did(0),
-n_iov(0),
-io_complete(1),
-io_complete_event(0),
-v(0),
-bytes_xfered(0),
-last_ndone(0),
-total_bytes_xfered(0),
-iov(NULL),
-iob_iov(NULL),
-byte_bank(NULL),
-n_byte_bank(0), byte_bank_size(0), missed(0), missed_msg(false), read_state_t(READ_START), write_state_t(WRITE_START)
+ClusterState::ClusterState(ClusterHandler *c, bool read_chan)
+  : Continuation(0), ch(c), read_channel(read_chan), do_iodone_event(false), n_descriptors(0), sequence_number(0), to_do(0), did(0),
+    n_iov(0), io_complete(1), io_complete_event(0), v(0), bytes_xfered(0), last_ndone(0), total_bytes_xfered(0), iov(NULL),
+    iob_iov(NULL), byte_bank(NULL), n_byte_bank(0), byte_bank_size(0), missed(0), missed_msg(false), read_state_t(READ_START),
+    write_state_t(WRITE_START)
 {
   mutex = new_ProxyMutex();
   if (read_channel) {
@@ -258,23 +237,22 @@ n_byte_bank(0), byte_bank_size(0), missed(0), missed_msg(false), read_state_t(RE
   size_t pagesize = ats_pagesize();
   size = ((MAX_TCOUNT + 1) * sizeof(IOVec)) + (2 * pagesize);
   iob_iov = new_IOBufferData(BUFFER_SIZE_FOR_XMALLOC(size));
-  char *addr = (char *) align_pointer_forward(iob_iov->data(), pagesize);
+  char *addr = (char *)align_pointer_forward(iob_iov->data(), pagesize);
 
-  iov = (IOVec *) (addr + pagesize);
+  iov = (IOVec *)(addr + pagesize);
 
   ///////////////////////////////////////////////////
   // Place an invalid page in front of message data.
   ///////////////////////////////////////////////////
-  size = sizeof(ClusterMsgHeader) + (MAX_TCOUNT + 1) * sizeof(Descriptor)
-    + CONTROL_DATA + (2 * pagesize);
+  size = sizeof(ClusterMsgHeader) + (MAX_TCOUNT + 1) * sizeof(Descriptor) + CONTROL_DATA + (2 * pagesize);
   msg.iob_descriptor_block = new_IOBufferBlock();
   msg.iob_descriptor_block->alloc(BUFFER_SIZE_FOR_XMALLOC(size));
 
-  addr = (char *) align_pointer_forward(msg.iob_descriptor_block->data->data(), pagesize);
+  addr = (char *)align_pointer_forward(msg.iob_descriptor_block->data->data(), pagesize);
 
   addr = addr + pagesize;
   memset(addr, 0, size - (2 * pagesize));
-  msg.descriptor = (Descriptor *) (addr + sizeof(ClusterMsgHeader));
+  msg.descriptor = (Descriptor *)(addr + sizeof(ClusterMsgHeader));
 
   mbuf = new_empty_MIOBuffer();
 }
@@ -283,11 +261,11 @@ ClusterState::~ClusterState()
 {
   mutex = 0;
   if (iov) {
-    iob_iov = 0;                // Free memory
+    iob_iov = 0; // Free memory
   }
 
   if (msg.descriptor) {
-    msg.iob_descriptor_block = 0;       // Free memory
+    msg.iob_descriptor_block = 0; // Free memory
   }
   // Deallocate IO Core structures
   int n;
@@ -330,17 +308,17 @@ ClusterState::build_do_io_vector()
 }
 
 #ifdef CLUSTER_TOMCAT
-#define REENABLE_IO() \
+#define REENABLE_IO()                          \
   if (!ch->on_stolen_thread && !io_complete) { \
-    v->reenable_re(); \
+    v->reenable_re();                          \
   }
 
 #else // !CLUSTER_TOMCAT
 
 #ifdef CLUSTER_IMMEDIATE_NETIO
-#define REENABLE_IO() \
-  if (!io_complete) { \
-    ((NetVConnection *) v->vc_server)->reenable_re_now(v); \
+#define REENABLE_IO()                                     \
+  if (!io_complete) {                                     \
+    ((NetVConnection *)v->vc_server)->reenable_re_now(v); \
   }
 
 #else // !CLUSTER_IMMEDIATE_NETIO
@@ -360,7 +338,7 @@ ClusterState::doIO()
 #if !defined(CLUSTER_IMMEDIATE_NETIO)
   MUTEX_TRY_LOCK(lock, this->mutex, this_ethread());
   if (!lock.is_locked()) {
-    return 0;                   // unable to initiate operation
+    return 0; // unable to initiate operation
   }
 #endif
 
@@ -375,7 +353,6 @@ ClusterState::doIO()
   // Setup and initiate or resume Cluster i/o request to the NetProcessor.
   //
   if ((to_do && (io_complete_event == VC_EVENT_READ_READY)) || (io_complete_event == VC_EVENT_WRITE_READY)) {
-
     if (read_channel) {
       // Partial read case
       ink_assert(v->buffer.writer()->current_write_avail() == to_do);
@@ -425,7 +402,7 @@ ClusterState::doIO()
       REENABLE_IO();
     }
   }
-  return 1;                     // operation initiated
+  return 1; // operation initiated
 }
 
 int
@@ -433,48 +410,45 @@ ClusterState::doIO_read_event(int event, void *d)
 {
   ink_release_assert(!io_complete);
   if (!v) {
-    v = (VIO *) d;              // Immediate callback on first NetVC read
+    v = (VIO *)d; // Immediate callback on first NetVC read
   }
-  ink_assert((VIO *) d == v);
+  ink_assert((VIO *)d == v);
 
   switch (event) {
-  case VC_EVENT_READ_READY:
-    {
-      // Disable read processing
-      v->nbytes = v->ndone;
-      // fall through
+  case VC_EVENT_READ_READY: {
+    // Disable read processing
+    v->nbytes = v->ndone;
+    // fall through
+  }
+  case VC_EVENT_READ_COMPLETE: {
+    bytes_xfered = v->ndone - last_ndone;
+    if (bytes_xfered) {
+      total_bytes_xfered += bytes_xfered;
+      did += bytes_xfered;
+      to_do -= bytes_xfered;
     }
-  case VC_EVENT_READ_COMPLETE:
-    {
-      bytes_xfered = v->ndone - last_ndone;
-      if (bytes_xfered) {
-        total_bytes_xfered += bytes_xfered;
-        did += bytes_xfered;
-        to_do -= bytes_xfered;
-      }
-      last_ndone = v->ndone;
-      io_complete_event = event;
-      INK_WRITE_MEMORY_BARRIER;
+    last_ndone = v->ndone;
+    io_complete_event = event;
+    INK_WRITE_MEMORY_BARRIER;
 
-      io_complete = 1;
-      IOComplete();
+    io_complete = 1;
+    IOComplete();
 
-      break;
-    }
+    break;
+  }
   case VC_EVENT_EOS:
   case VC_EVENT_ERROR:
   case VC_EVENT_INACTIVITY_TIMEOUT:
   case VC_EVENT_ACTIVE_TIMEOUT:
-  default:
-    {
-      io_complete_event = event;
-      INK_WRITE_MEMORY_BARRIER;
+  default: {
+    io_complete_event = event;
+    INK_WRITE_MEMORY_BARRIER;
 
-      io_complete = -1;
-      IOComplete();
-      break;
-    }
-  }                             // End of switch
+    io_complete = -1;
+    IOComplete();
+    break;
+  }
+  } // End of switch
 
   return EVENT_DONE;
 }
@@ -484,66 +458,64 @@ ClusterState::doIO_write_event(int event, void *d)
 {
   ink_release_assert(!io_complete);
   if (!v) {
-    v = (VIO *) d;              // Immediate callback on first NetVC write
+    v = (VIO *)d; // Immediate callback on first NetVC write
   }
-  ink_assert((VIO *) d == v);
+  ink_assert((VIO *)d == v);
 
   switch (event) {
   case VC_EVENT_WRITE_READY:
 #ifdef CLUSTER_IMMEDIATE_NETIO
-    {
-      // Disable write processing
-      v->nbytes = v->ndone;
-      // fall through
-    }
+  {
+    // Disable write processing
+    v->nbytes = v->ndone;
+    // fall through
+  }
 #endif
-  case VC_EVENT_WRITE_COMPLETE:
-    {
-      bytes_xfered = v->ndone - last_ndone;
-      if (bytes_xfered) {
-        total_bytes_xfered += bytes_xfered;
-        did += bytes_xfered;
-        to_do -= bytes_xfered;
-      }
-      last_ndone = v->ndone;
+  case VC_EVENT_WRITE_COMPLETE: {
+    bytes_xfered = v->ndone - last_ndone;
+    if (bytes_xfered) {
+      total_bytes_xfered += bytes_xfered;
+      did += bytes_xfered;
+      to_do -= bytes_xfered;
+    }
+    last_ndone = v->ndone;
 #ifdef CLUSTER_IMMEDIATE_NETIO
+    io_complete_event = event;
+    INK_WRITE_MEMORY_BARRIER;
+
+    io_complete = 1;
+    IOComplete();
+#else
+    if (event == VC_EVENT_WRITE_COMPLETE) {
       io_complete_event = event;
       INK_WRITE_MEMORY_BARRIER;
 
       io_complete = 1;
       IOComplete();
-#else
-      if (event == VC_EVENT_WRITE_COMPLETE) {
-        io_complete_event = event;
-        INK_WRITE_MEMORY_BARRIER;
-
-        io_complete = 1;
-        IOComplete();
+    } else {
+      if (bytes_xfered) {
+        v->reenable_re(); // Immediate action
       } else {
-        if (bytes_xfered) {
-          v->reenable_re();     // Immediate action
-        } else {
-          v->reenable();
-        }
-        return EVENT_DONE;
+        v->reenable();
       }
-#endif
-      break;
+      return EVENT_DONE;
     }
+#endif
+    break;
+  }
   case VC_EVENT_EOS:
   case VC_EVENT_ERROR:
   case VC_EVENT_INACTIVITY_TIMEOUT:
   case VC_EVENT_ACTIVE_TIMEOUT:
-  default:
-    {
-      io_complete_event = event;
-      INK_WRITE_MEMORY_BARRIER;
+  default: {
+    io_complete_event = event;
+    INK_WRITE_MEMORY_BARRIER;
 
-      io_complete = -1;
-      IOComplete();
-      break;
-    }
-  }                             // End of switch
+    io_complete = -1;
+    IOComplete();
+    break;
+  }
+  } // End of switch
 
   return EVENT_DONE;
 }
@@ -559,7 +531,7 @@ ClusterState::IOComplete()
   if (do_iodone_event && !ch->mutex->thread_holding) {
     MUTEX_TRY_LOCK(lock, ch->mutex, this_ethread());
     if (lock.is_locked()) {
-      ch->handleEvent(EVENT_IMMEDIATE, (void *) 0);
+      ch->handleEvent(EVENT_IMMEDIATE, (void *)0);
     } else {
       eventProcessor.schedule_imm_signal(ch, ET_CLUSTER);
     }
@@ -567,7 +539,7 @@ ClusterState::IOComplete()
 }
 
 int
-ClusterHandler::cluster_signal_and_update(int event, ClusterVConnection * vc, ClusterVConnState * s)
+ClusterHandler::cluster_signal_and_update(int event, ClusterVConnection *vc, ClusterVConnState *s)
 {
   s->vio._cont->handleEvent(event, &s->vio);
 
@@ -583,7 +555,7 @@ ClusterHandler::cluster_signal_and_update(int event, ClusterVConnection * vc, Cl
 }
 
 int
-ClusterHandler::cluster_signal_and_update_locked(int event, ClusterVConnection * vc, ClusterVConnState * s)
+ClusterHandler::cluster_signal_and_update_locked(int event, ClusterVConnection *vc, ClusterVConnState *s)
 {
   // should assert we have s->vio.mutex
   s->vio._cont->handleEvent(event, &s->vio);
@@ -598,28 +570,28 @@ ClusterHandler::cluster_signal_and_update_locked(int event, ClusterVConnection *
 }
 
 int
-ClusterHandler::cluster_signal_error_and_update(ClusterVConnection * vc, ClusterVConnState * s, int lerrno)
+ClusterHandler::cluster_signal_error_and_update(ClusterVConnection *vc, ClusterVConnState *s, int lerrno)
 {
   s->enabled = 0;
   vc->lerrno = lerrno;
   return cluster_signal_and_update(VC_EVENT_ERROR, vc, s);
 }
 
-bool ClusterHandler::check_channel(int c)
+bool
+ClusterHandler::check_channel(int c)
 {
   //
   // Check to see that there is enough room to store channel c
   //
   while (n_channels <= c) {
-    int
-      old_channels = n_channels;
+    int old_channels = n_channels;
     if (!n_channels) {
       n_channels = MIN_CHANNELS;
     } else {
       if ((n_channels * 2) <= MAX_CHANNELS) {
         n_channels = n_channels * 2;
       } else {
-        return false;           // Limit exceeded
+        return false; // Limit exceeded
       }
     }
     // Allocate ClusterVConnection table entries
@@ -631,7 +603,7 @@ bool ClusterHandler::check_channel(int c)
     for (int i = old_channels; i < n_channels; i++) {
       if (local_channel(i)) {
         if (i > LAST_DEDICATED_CHANNEL) {
-          channels[i] = (ClusterVConnection *) 1;       // mark as invalid
+          channels[i] = (ClusterVConnection *)1; // mark as invalid
           channel_data[i] = (struct ChannelData *)ats_malloc(sizeof(struct ChannelData));
           memset(channel_data[i], 0, sizeof(struct ChannelData));
           channel_data[i]->channel_number = i;
@@ -646,11 +618,11 @@ bool ClusterHandler::check_channel(int c)
       }
     }
   }
-  return true;                  // OK
+  return true; // OK
 }
 
 int
-ClusterHandler::alloc_channel(ClusterVConnection * vc, int requested)
+ClusterHandler::alloc_channel(ClusterVConnection *vc, int requested)
 {
   //
   // Allocate a channel
@@ -664,7 +636,7 @@ ClusterHandler::alloc_channel(ClusterVConnection * vc, int requested)
       cdp = free_local_channels.dequeue();
       if (!cdp) {
         if (!check_channel(n_channels)) {
-          return -2;            // Limit exceeded
+          return -2; // Limit exceeded
         }
       } else {
         ink_assert(cdp == channel_data[cdp->channel_number]);
@@ -673,17 +645,17 @@ ClusterHandler::alloc_channel(ClusterVConnection * vc, int requested)
       }
     } while (loops--);
 
-    ink_release_assert(i != 0); // required
-    ink_release_assert(channels[i] == (ClusterVConnection *) 1);        // required
+    ink_release_assert(i != 0);                                 // required
+    ink_release_assert(channels[i] == (ClusterVConnection *)1); // required
     Debug(CL_TRACE, "alloc_channel local chan=%d VC=%p", i, vc);
 
   } else {
     if (!check_channel(i)) {
-      return -2;                // Limit exceeded
+      return -2; // Limit exceeded
     }
     if (channels[i]) {
       Debug(CL_TRACE, "alloc_channel remote inuse chan=%d VC=%p", i, vc);
-      return -1;                // channel in use
+      return -1; // channel in use
     } else {
       Debug(CL_TRACE, "alloc_channel remote chan=%d VC=%p", i, vc);
     }
@@ -694,7 +666,7 @@ ClusterHandler::alloc_channel(ClusterVConnection * vc, int requested)
 }
 
 void
-ClusterHandler::free_channel(ClusterVConnection * vc)
+ClusterHandler::free_channel(ClusterVConnection *vc)
 {
   //
   // Free a channel
@@ -702,7 +674,7 @@ ClusterHandler::free_channel(ClusterVConnection * vc)
   int i = vc->channel;
   if (i > LAST_DEDICATED_CHANNEL && channels[i] == vc) {
     if (local_channel(i)) {
-      channels[i] = (ClusterVConnection *) 1;
+      channels[i] = (ClusterVConnection *)1;
       free_local_channels.enqueue(channel_data[i]);
       Debug(CL_TRACE, "free_channel local chan=%d VC=%p", i, vc);
     } else {
@@ -721,13 +693,13 @@ ClusterHandler::machine_down()
   if (dead) {
     return EVENT_DONE;
   }
-  //
-  // Looks like this machine dropped out of the cluster.
-  // Deal with it.
-  // Fatal read/write errors on the node to node connection along
-  // with failure of the cluster membership check in the periodic event
-  // result in machine_down().
-  //
+//
+// Looks like this machine dropped out of the cluster.
+// Deal with it.
+// Fatal read/write errors on the node to node connection along
+// with failure of the cluster membership check in the periodic event
+// result in machine_down().
+//
 #ifdef LOCAL_CLUSTER_TEST_MODE
   Note("machine down %u.%u.%u.%u:%d", DOT_SEPARATED(ip), port);
 #else
@@ -759,7 +731,7 @@ ClusterHandler::machine_down()
     Debug(CL_NOTE, "cluster connect retry for %hhu.%hhu.%hhu.%hhu", DOT_SEPARATED(ip));
     clusterProcessor.connect(ip, port, id);
   }
-  return zombify();             // defer deletion of *this
+  return zombify(); // defer deletion of *this
 }
 
 int
@@ -776,7 +748,7 @@ ClusterHandler::zombify(Event * /* e ATS_UNUSED */)
   }
   clm->cancel_monitor();
 
-  SET_HANDLER((ClusterContHandler) & ClusterHandler::protoZombieEvent);
+  SET_HANDLER((ClusterContHandler)&ClusterHandler::protoZombieEvent);
   //
   // At this point, allow the caller (either process_read/write to complete)
   // prior to performing node down actions.
@@ -786,9 +758,8 @@ ClusterHandler::zombify(Event * /* e ATS_UNUSED */)
 }
 
 int
-ClusterHandler::connectClusterEvent(int event, Event * e)
+ClusterHandler::connectClusterEvent(int event, Event *e)
 {
-
   if ((event == EVENT_IMMEDIATE) || (event == EVENT_INTERVAL)) {
     //
     // Attempt connect to target node and if successful, setup the event
@@ -811,8 +782,8 @@ ClusterHandler::connectClusterEvent(int event, Event * e)
       return EVENT_DONE;
     }
     // Connect to cluster member
-    Debug(CL_NOTE, "connect_re from %u.%u.%u.%u to %u.%u.%u.%u",
-          DOT_SEPARATED(this_cluster_machine()->ip), DOT_SEPARATED(machine->ip));
+    Debug(CL_NOTE, "connect_re from %u.%u.%u.%u to %u.%u.%u.%u", DOT_SEPARATED(this_cluster_machine()->ip),
+          DOT_SEPARATED(machine->ip));
     ip = machine->ip;
 
     NetVCOptions opt;
@@ -826,16 +797,15 @@ ClusterHandler::connectClusterEvent(int event, Event * e)
     opt.local_ip = this_cluster_machine()->ip;
 
     struct sockaddr_in addr;
-    ats_ip4_set(&addr, machine->ip,
-        htons(machine->cluster_port ? machine->cluster_port : cluster_port));
+    ats_ip4_set(&addr, machine->ip, htons(machine->cluster_port ? machine->cluster_port : cluster_port));
 
     // TODO: Should we check the Action* returned here?
     netProcessor.connect_re(this, ats_ip_sa_cast(&addr), &opt);
     return EVENT_DONE;
   } else {
     if (event == NET_EVENT_OPEN) {
-      net_vc = (NetVConnection *) e;
-      SET_HANDLER((ClusterContHandler) & ClusterHandler::startClusterEvent);
+      net_vc = (NetVConnection *)e;
+      SET_HANDLER((ClusterContHandler)&ClusterHandler::startClusterEvent);
       eventProcessor.schedule_imm(this, ET_CLUSTER);
       return EVENT_DONE;
 
@@ -847,13 +817,13 @@ ClusterHandler::connectClusterEvent(int event, Event * e)
 }
 
 int
-ClusterHandler::startClusterEvent(int event, Event * e)
+ClusterHandler::startClusterEvent(int event, Event *e)
 {
   char textbuf[sizeof("255.255.255.255:65535")];
 
   // Perform the node to node connection establish protocol.
 
-  (void) event;
+  (void)event;
   ink_assert(!read_vcs);
   ink_assert(!write_vcs);
 
@@ -868,26 +838,25 @@ ClusterHandler::startClusterEvent(int event, Event * e)
   }
 
   for (;;) {
-
     switch (cluster_connect_state) {
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_INITIAL:
       ////////////////////////////////////////////////////////////////////////////
       {
         ink_release_assert(!"Invalid state [CLCON_INITIAL]");
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_SEND_MSG:
       ////////////////////////////////////////////////////////////////////////////
       {
-        // Send initial message.
+// Send initial message.
 #ifdef LOCAL_CLUSTER_TEST_MODE
         nodeClusteringVersion._port = cluster_port;
 #endif
         cluster_connect_state = ClusterHandler::CLCON_SEND_MSG_COMPLETE;
         if (connector)
           nodeClusteringVersion._id = id;
-        build_data_vector((char *) &nodeClusteringVersion, sizeof(nodeClusteringVersion), false);
+        build_data_vector((char *)&nodeClusteringVersion, sizeof(nodeClusteringVersion), false);
         if (!write.doIO()) {
           // i/o not initiated, delay and retry
           cluster_connect_state = ClusterHandler::CLCON_SEND_MSG;
@@ -896,20 +865,18 @@ ClusterHandler::startClusterEvent(int event, Event * e)
         }
         break;
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_SEND_MSG_COMPLETE:
       ////////////////////////////////////////////////////////////////////////////
       {
         if (write.io_complete) {
-          if ((write.io_complete < 0)
-              || ((size_t) write.did < sizeof(nodeClusteringVersion))) {
-            Debug(CL_NOTE, "unable to write to cluster node %u.%u.%u.%u: %d",
-                  DOT_SEPARATED(ip), write.io_complete_event);
+          if ((write.io_complete < 0) || ((size_t)write.did < sizeof(nodeClusteringVersion))) {
+            Debug(CL_NOTE, "unable to write to cluster node %u.%u.%u.%u: %d", DOT_SEPARATED(ip), write.io_complete_event);
             cluster_connect_state = ClusterHandler::CLCON_ABORT_CONNECT;
-            break;              // goto next state
+            break; // goto next state
           }
           // Write OK, await message from peer node.
-          build_data_vector((char *) &clusteringVersion, sizeof(clusteringVersion), true);
+          build_data_vector((char *)&clusteringVersion, sizeof(clusteringVersion), true);
           cluster_connect_state = ClusterHandler::CLCON_READ_MSG;
           break;
         } else {
@@ -918,7 +885,7 @@ ClusterHandler::startClusterEvent(int event, Event * e)
           return EVENT_DONE;
         }
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_READ_MSG:
       ////////////////////////////////////////////////////////////////////////////
       {
@@ -931,7 +898,7 @@ ClusterHandler::startClusterEvent(int event, Event * e)
         }
         break;
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_READ_MSG_COMPLETE:
       ////////////////////////////////////////////////////////////////////////////
       {
@@ -939,9 +906,9 @@ ClusterHandler::startClusterEvent(int event, Event * e)
           if (read.io_complete < 0) {
             // Read error, abort connect
             cluster_connect_state = ClusterHandler::CLCON_ABORT_CONNECT;
-            break;              // goto next state
+            break; // goto next state
           }
-          if ((size_t) read.did < sizeof(clusteringVersion)) {
+          if ((size_t)read.did < sizeof(clusteringVersion)) {
             // Partial read, resume read.
             cluster_connect_state = ClusterHandler::CLCON_READ_MSG;
             break;
@@ -954,7 +921,7 @@ ClusterHandler::startClusterEvent(int event, Event * e)
           return EVENT_DONE;
         }
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_VALIDATE_MSG:
       ////////////////////////////////////////////////////////////////////////////
       {
@@ -982,17 +949,17 @@ ClusterHandler::startClusterEvent(int event, Event * e)
             proto_minor = clusteringVersion._minor;
 
             if (proto_minor != nodeClusteringVersion._minor)
-              Warning("Different clustering minor versions (%d,%d) for node %u.%u.%u.%u, continuing",
-                      proto_minor, nodeClusteringVersion._minor, DOT_SEPARATED(ip));
+              Warning("Different clustering minor versions (%d,%d) for node %u.%u.%u.%u, continuing", proto_minor,
+                      nodeClusteringVersion._minor, DOT_SEPARATED(ip));
           } else {
             proto_minor = 0;
           }
 
         } else {
-          Warning("Bad cluster major version range (%d-%d) for node %u.%u.%u.%u connect failed",
-                  clusteringVersion._min_major, clusteringVersion._major, DOT_SEPARATED(ip));
+          Warning("Bad cluster major version range (%d-%d) for node %u.%u.%u.%u connect failed", clusteringVersion._min_major,
+                  clusteringVersion._major, DOT_SEPARATED(ip));
           cluster_connect_state = ClusterHandler::CLCON_ABORT_CONNECT;
-          break;                // goto next state
+          break; // goto next state
         }
 
 #ifdef LOCAL_CLUSTER_TEST_MODE
@@ -1018,152 +985,149 @@ ClusterHandler::startClusterEvent(int event, Event * e)
         }
       }
 
-    case ClusterHandler::CLCON_CONN_BIND_CLEAR:
-      {
-        UnixNetVConnection *vc = (UnixNetVConnection *)net_vc;
-        MUTEX_TRY_LOCK(lock, vc->nh->mutex, e->ethread);
-        MUTEX_TRY_LOCK(lock1, vc->mutex, e->ethread);
-        if (lock.is_locked() && lock1.is_locked()) {
-          vc->ep.stop();
-          vc->nh->open_list.remove(vc);
-          vc->thread = NULL;
-          if (vc->nh->read_ready_list.in(vc))
-            vc->nh->read_ready_list.remove(vc);
-          if (vc->nh->write_ready_list.in(vc))
-            vc->nh->write_ready_list.remove(vc);
-          if (vc->read.in_enabled_list)
-            vc->nh->read_enable_list.remove(vc);
-          if (vc->write.in_enabled_list)
-            vc->nh->write_enable_list.remove(vc);
-
-          // CLCON_CONN_BIND handle in bind vc->thread (bind thread nh)
-          cluster_connect_state = ClusterHandler::CLCON_CONN_BIND;
-          thread->schedule_in(this, CLUSTER_PERIOD);
-          return EVENT_DONE;
-        } else {
-          // CLCON_CONN_BIND_CLEAR handle in origin vc->thread (origin thread nh)
-          vc->thread->schedule_in(this, CLUSTER_PERIOD);
-          return EVENT_DONE;
-        }
+    case ClusterHandler::CLCON_CONN_BIND_CLEAR: {
+      UnixNetVConnection *vc = (UnixNetVConnection *)net_vc;
+      MUTEX_TRY_LOCK(lock, vc->nh->mutex, e->ethread);
+      MUTEX_TRY_LOCK(lock1, vc->mutex, e->ethread);
+      if (lock.is_locked() && lock1.is_locked()) {
+        vc->ep.stop();
+        vc->nh->open_list.remove(vc);
+        vc->thread = NULL;
+        if (vc->nh->read_ready_list.in(vc))
+          vc->nh->read_ready_list.remove(vc);
+        if (vc->nh->write_ready_list.in(vc))
+          vc->nh->write_ready_list.remove(vc);
+        if (vc->read.in_enabled_list)
+          vc->nh->read_enable_list.remove(vc);
+        if (vc->write.in_enabled_list)
+          vc->nh->write_enable_list.remove(vc);
+
+        // CLCON_CONN_BIND handle in bind vc->thread (bind thread nh)
+        cluster_connect_state = ClusterHandler::CLCON_CONN_BIND;
+        thread->schedule_in(this, CLUSTER_PERIOD);
+        return EVENT_DONE;
+      } else {
+        // CLCON_CONN_BIND_CLEAR handle in origin vc->thread (origin thread nh)
+        vc->thread->schedule_in(this, CLUSTER_PERIOD);
+        return EVENT_DONE;
       }
+    }
 
-    case ClusterHandler::CLCON_CONN_BIND:
-      {
-        //
-        NetHandler *nh = get_NetHandler(e->ethread);
-        UnixNetVConnection *vc = (UnixNetVConnection *)net_vc;
-        MUTEX_TRY_LOCK(lock, nh->mutex, e->ethread);
-        MUTEX_TRY_LOCK(lock1, vc->mutex, e->ethread);
-        if (lock.is_locked() && lock1.is_locked()) {
-          if (vc->read.in_enabled_list)
-            nh->read_enable_list.push(vc);
-          if (vc->write.in_enabled_list)
-            nh->write_enable_list.push(vc);
-
-          vc->nh = nh;
-          vc->thread = e->ethread;
-          PollDescriptor *pd = get_PollDescriptor(e->ethread);
-          if (vc->ep.start(pd, vc, EVENTIO_READ|EVENTIO_WRITE) < 0) {
-            cluster_connect_state = ClusterHandler::CLCON_DELETE_CONNECT;
-            break;                // goto next state
-          }
-
-          nh->open_list.enqueue(vc);
-          cluster_connect_state = ClusterHandler::CLCON_CONN_BIND_OK;
-        } else {
-          thread->schedule_in(this, CLUSTER_PERIOD);
-          return EVENT_DONE;
+    case ClusterHandler::CLCON_CONN_BIND: {
+      //
+      NetHandler *nh = get_NetHandler(e->ethread);
+      UnixNetVConnection *vc = (UnixNetVConnection *)net_vc;
+      MUTEX_TRY_LOCK(lock, nh->mutex, e->ethread);
+      MUTEX_TRY_LOCK(lock1, vc->mutex, e->ethread);
+      if (lock.is_locked() && lock1.is_locked()) {
+        if (vc->read.in_enabled_list)
+          nh->read_enable_list.push(vc);
+        if (vc->write.in_enabled_list)
+          nh->write_enable_list.push(vc);
+
+        vc->nh = nh;
+        vc->thread = e->ethread;
+        PollDescriptor *pd = get_PollDescriptor(e->ethread);
+        if (vc->ep.start(pd, vc, EVENTIO_READ | EVENTIO_WRITE) < 0) {
+          cluster_connect_state = ClusterHandler::CLCON_DELETE_CONNECT;
+          break; // goto next state
         }
+
+        nh->open_list.enqueue(vc);
+        cluster_connect_state = ClusterHandler::CLCON_CONN_BIND_OK;
+      } else {
+        thread->schedule_in(this, CLUSTER_PERIOD);
+        return EVENT_DONE;
       }
+    }
 
-    case ClusterHandler::CLCON_CONN_BIND_OK:
-      {
-        int failed = 0;
-
-        // include this node into the cluster configuration
-        MUTEX_TAKE_LOCK(the_cluster_config_mutex, this_ethread());
-        MachineList *cc = the_cluster_config();
-        if (cc && cc->find(ip, port)) {
-          ClusterConfiguration *c = this_cluster()->current_configuration();
-          ClusterMachine *m = c->find(ip, port);
-
-          if (!m) { // this first connection
-            ClusterConfiguration *cconf = configuration_add_machine(c, machine);
-            CLUSTER_INCREMENT_DYN_STAT(CLUSTER_NODES_STAT);
-            this_cluster()->configurations.push(cconf);
-          } else {
-            // close new connection if old connections is exist
-            if (id >= m->num_connections || m->clusterHandlers[id]) {
-              failed = -2;
-              MUTEX_UNTAKE_LOCK(the_cluster_config_mutex, this_ethread());
-              goto failed;
-            }
-            machine = m;
-          }
-          machine->now_connections++;
-          machine->clusterHandlers[id] = this;
-          machine->dead = false;
-          dead = false;
+    case ClusterHandler::CLCON_CONN_BIND_OK: {
+      int failed = 0;
+
+      // include this node into the cluster configuration
+      MUTEX_TAKE_LOCK(the_cluster_config_mutex, this_ethread());
+      MachineList *cc = the_cluster_config();
+      if (cc && cc->find(ip, port)) {
+        ClusterConfiguration *c = this_cluster()->current_configuration();
+        ClusterMachine *m = c->find(ip, port);
+
+        if (!m) { // this first connection
+          ClusterConfiguration *cconf = configuration_add_machine(c, machine);
+          CLUSTER_INCREMENT_DYN_STAT(CLUSTER_NODES_STAT);
+          this_cluster()->configurations.push(cconf);
         } else {
-          Debug(CL_NOTE, "cluster connect aborted, machine %u.%u.%u.%u:%d not in cluster", DOT_SEPARATED(ip), port);
-          failed = -1;
+          // close new connection if old connections is exist
+          if (id >= m->num_connections || m->clusterHandlers[id]) {
+            failed = -2;
+            MUTEX_UNTAKE_LOCK(the_cluster_config_mutex, this_ethread());
+            goto failed;
+          }
+          machine = m;
         }
-        MUTEX_UNTAKE_LOCK(the_cluster_config_mutex, this_ethread());
-failed:
-        if (failed) {
-          if (failed == -1) {
-            if (++configLookupFails <= CONFIG_LOOKUP_RETRIES) {
-              thread->schedule_in(this, CLUSTER_PERIOD);
-              return EVENT_DONE;
-            }
+        machine->now_connections++;
+        machine->clusterHandlers[id] = this;
+        machine->dead = false;
+        dead = false;
+      } else {
+        Debug(CL_NOTE, "cluster connect aborted, machine %u.%u.%u.%u:%d not in cluster", DOT_SEPARATED(ip), port);
+        failed = -1;
+      }
+      MUTEX_UNTAKE_LOCK(the_cluster_config_mutex, this_ethread());
+    failed:
+      if (failed) {
+        if (failed == -1) {
+          if (++configLookupFails <= CONFIG_LOOKUP_RETRIES) {
+            thread->schedule_in(this, CLUSTER_PERIOD);
+            return EVENT_DONE;
           }
-          cluster_connect_state = ClusterHandler::CLCON_DELETE_CONNECT;
-          break;                // goto next state
         }
+        cluster_connect_state = ClusterHandler::CLCON_DELETE_CONNECT;
+        break; // goto next state
+      }
 
-        this->needByteSwap = !clusteringVersion.NativeByteOrder();
-        machine_online_APIcallout(ip);
+      this->needByteSwap = !clusteringVersion.NativeByteOrder();
+      machine_online_APIcallout(ip);
 
-        // Signal the manager
-        snprintf(textbuf, sizeof(textbuf), "%hhu.%hhu.%hhu.%hhu:%d", DOT_SEPARATED(ip), port);
-        RecSignalManager(REC_SIGNAL_MACHINE_UP, textbuf);
+      // Signal the manager
+      snprintf(textbuf, sizeof(textbuf), "%hhu.%hhu.%hhu.%hhu:%d", DOT_SEPARATED(ip), port);
+      RecSignalManager(REC_SIGNAL_MACHINE_UP, textbuf);
 #ifdef LOCAL_CLUSTER_TEST_MODE
-        Note("machine up %hhu.%hhu.%hhu.%hhu:%d, protocol version=%d.%d",
-             DOT_SEPARATED(ip), port, clusteringVersion._major, clusteringVersion._minor);
+      Note("machine up %hhu.%hhu.%hhu.%hhu:%d, protocol version=%d.%d", DOT_SEPARATED(ip), port, clusteringVersion._major,
+           clusteringVersion._minor);
 #else
-        Note("machine up %hhu.%hhu.%hhu.%hhu:%d, protocol version=%d.%d",
-             DOT_SEPARATED(ip), id, clusteringVersion._major, clusteringVersion._minor);
+      Note("machine up %hhu.%hhu.%hhu.%hhu:%d, protocol version=%d.%d", DOT_SEPARATED(ip), id, clusteringVersion._major,
+           clusteringVersion._minor);
 #endif
 
-        read_vcs = new Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_read_link>[CLUSTER_BUCKETS];
-        write_vcs = new Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_write_link>[CLUSTER_BUCKETS];
-        SET_HANDLER((ClusterContHandler) & ClusterHandler::beginClusterEvent);
+      read_vcs = new Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_read_link>[CLUSTER_BUCKETS];
+      write_vcs = new Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_write_link>[CLUSTER_BUCKETS];
+      SET_HANDLER((ClusterContHandler)&ClusterHandler::beginClusterEvent);
 
-        // enable schedule_imm() on i/o completion (optimization)
-        read.do_iodone_event = true;
-        write.do_iodone_event = true;
+      // enable schedule_imm() on i/o completion (optimization)
+      read.do_iodone_event = true;
+      write.do_iodone_event = true;
 
-        cluster_periodic_event = thread->schedule_every(this, -CLUSTER_PERIOD);
+      cluster_periodic_event = thread->schedule_every(this, -CLUSTER_PERIOD);
 
-        // Startup the periodic events to process entries in
-        //  external_incoming_control.
+      // Startup the periodic events to process entries in
+      //  external_incoming_control.
 
-        int procs_online = ink_number_of_processors();
-        int total_callbacks = 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);
-        }
+      int procs_online = ink_number_of_processors();
+      int total_callbacks = 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);
+      }
 
-        // Start cluster interconnect load monitoring
+      // Start cluster interconnect load monitoring
 
-        if (!clm) {
-          clm = new ClusterLoadMonitor(this);
-          clm->init();
-        }
-        return EVENT_DONE;
+      if (!clm) {
+        clm = new ClusterLoadMonitor(this);
+        clm->init();
       }
-      ////////////////////////////////////////////////////////////////////////////
+      return EVENT_DONE;
+    }
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_ABORT_CONNECT:
       ////////////////////////////////////////////////////////////////////////////
       {
@@ -1173,9 +1137,9 @@ failed:
           clusterProcessor.connect(ip, port, id, true);
         }
         cluster_connect_state = ClusterHandler::CLCON_DELETE_CONNECT;
-        break;                  // goto next state
+        break; // goto next state
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     case ClusterHandler::CLCON_DELETE_CONNECT:
       ////////////////////////////////////////////////////////////////////////////
       {
@@ -1186,7 +1150,7 @@ failed:
         Debug(CL_NOTE, "Failed cluster connect, deleting");
         return EVENT_DONE;
       }
-      ////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////
     default:
       ////////////////////////////////////////////////////////////////////////////
       {
@@ -1195,38 +1159,38 @@ failed:
         return EVENT_DONE;
       }
 
-    }                           // End of switch
-  }                             // End of for
+    } // End of switch
+  }   // End of for
   return EVENT_DONE;
 }
 
 int
-ClusterHandler::beginClusterEvent(int /* event ATS_UNUSED */, Event * e)
+ClusterHandler::beginClusterEvent(int /* event ATS_UNUSED */, Event *e)
 {
-  // Establish the main periodic Cluster event
+// Establish the main periodic Cluster event
 #ifdef CLUSTER_IMMEDIATE_NETIO
   build_poll(false);
 #endif
-  SET_HANDLER((ClusterContHandler) & ClusterHandler::mainClusterEvent);
+  SET_HANDLER((ClusterContHandler)&ClusterHandler::mainClusterEvent);
   return handleEvent(EVENT_INTERVAL, e);
 }
 
 int
-ClusterHandler::zombieClusterEvent(int event, Event * e)
+ClusterHandler::zombieClusterEvent(int event, Event *e)
 {
   //
   // The ZOMBIE state is entered when the handler may still be referenced
   // by short running tasks (one scheduling quanta).  The object is delayed
   // after some unreasonably long (in comparison) time.
   //
-  (void) event;
-  (void) e;
-  delete this;                  // I am out of here
+  (void)event;
+  (void)e;
+  delete this; // I am out of here
   return EVENT_DONE;
 }
 
 int
-ClusterHandler::protoZombieEvent(int /* event ATS_UNUSED */, Event * e)
+ClusterHandler::protoZombieEvent(int /* event ATS_UNUSED */, Event *e)
 {
   //
   // Node associated with *this is declared down.
@@ -1244,9 +1208,8 @@ ClusterHandler::protoZombieEvent(int /* event ATS_UNUSED */, Event * e)
   mainClusterEvent(EVENT_INTERVAL, e);
 
   item.data = external_incoming_open_local.head.data;
-  if (TO_PTR(FREELIST_POINTER(item)) ||
-      delayed_reads.head || pw_write_descriptors_built
-      || pw_freespace_descriptors_built || pw_controldata_descriptors_built) {
+  if (TO_PTR(FREELIST_POINTER(item)) || delayed_reads.head || pw_write_descriptors_built || pw_freespace_descriptors_built ||
+      pw_controldata_descriptors_built) {
     // Operations still pending, retry later
     if (e) {
       e->schedule_in(delay);
@@ -1282,8 +1245,7 @@ ClusterHandler::protoZombieEvent(int /* event ATS_UNUSED */, Event * e)
         }
       }
       vc = channels[i];
-      if (VALID_CHANNEL(vc)
-          && !vc->closed && vc->write.vio.op == VIO::WRITE) {
+      if (VALID_CHANNEL(vc) && !vc->closed && vc->write.vio.op == VIO::WRITE) {
         MUTEX_TRY_LOCK(lock, vc->write.vio.mutex, t);
         if (lock.is_locked()) {
           cluster_signal_error_and_update(vc, &vc->write, 0);
@@ -1332,7 +1294,7 @@ ClusterHandler::protoZombieEvent(int /* event ATS_UNUSED */, Event * e)
 
   if (!failed) {
     Debug("cluster_down", "ClusterHandler zombie [%u.%u.%u.%u]", DOT_SEPARATED(ip));
-    SET_HANDLER((ClusterContHandler) & ClusterHandler::zombieClusterEvent);
+    SET_HANDLER((ClusterContHandler)&ClusterHandler::zombieClusterEvent);
     delay = NO_RACE_DELAY;
   }
   if (e) {
@@ -1357,10 +1319,8 @@ ClusterHandler::compute_active_channels()
     if (VALID_CHANNEL(vc) && (vc->iov_map != CLUSTER_IOV_NOT_OPEN)) {
       ++active_chans;
       if (dump_verbose) {
-        printf("ch[%d] vc=0x%p remote_free=%d last_local_free=%d\n", i, vc,
-               vc->remote_free, vc->last_local_free);
-        printf("  r_bytes=%d r_done=%d w_bytes=%d w_done=%d\n",
-               (int)vc->read.vio.nbytes, (int)vc->read.vio.ndone,
+        printf("ch[%d] vc=0x%p remote_free=%d last_local_free=%d\n", i, vc, vc->remote_free, vc->last_local_free);
+        printf("  r_bytes=%d r_done=%d w_bytes=%d w_done=%d\n", (int)vc->read.vio.nbytes, (int)vc->read.vio.ndone,
                (int)vc->write.vio.nbytes, (int)vc->write.vio.ndone);
       }
     }
@@ -1383,41 +1343,34 @@ ClusterHandler::dump_internal_data()
   r = snprintf(&b[n], b_size - n, "Host: %hhu.%hhu.%hhu.%hhu\n", DOT_SEPARATED(ip));
   n += r;
 
-  r = snprintf(&b[n], b_size - n,
-               "chans: %d vc_writes: %" PRId64 " write_bytes: %" PRId64 "(d)+%" PRId64 "(c)=%" PRId64 "\n",
-               compute_active_channels(),
-               _vc_writes, _vc_write_bytes, _control_write_bytes, _vc_write_bytes + _control_write_bytes);
+  r =
+    snprintf(&b[n], b_size - n, "chans: %d vc_writes: %" PRId64 " write_bytes: %" PRId64 "(d)+%" PRId64 "(c)=%" PRId64 "\n",
+             compute_active_channels(), _vc_writes, _vc_write_bytes, _control_write_bytes, _vc_write_bytes + _control_write_bytes);
 
   n += r;
-  r = snprintf(&b[n], b_size - n,
-               "dw: missed_lock: %d not_enabled: %d wait_remote_fill: %d no_active_vio: %d\n",
-               _dw_missed_lock, _dw_not_enabled, _dw_wait_remote_fill, _dw_no_active_vio);
+  r = snprintf(&b[n], b_size - n, "dw: missed_lock: %d not_enabled: %d wait_remote_fill: %d no_active_vio: %d\n", _dw_missed_lock,
+               _dw_not_enabled, _dw_wait_remote_fill, _dw_no_active_vio);
 
   n += r;
-  r = snprintf(&b[n], b_size - n,
-               "dw: not_enabled_or_no_write: %d set_data_pending: %d no_free_space: %d\n",
+  r = snprintf(&b[n], b_size - n, "dw: not_enabled_or_no_write: %d set_data_pending: %d no_free_space: %d\n",
                _dw_not_enabled_or_no_write, _dw_set_data_pending, _dw_no_free_space);
 
   n += r;
-  r = snprintf(&b[n], b_size - n,
-               "fw: missed_lock: %d not_enabled: %d wait_remote_fill: %d no_active_vio: %d\n",
-               _fw_missed_lock, _fw_not_enabled, _fw_wait_remote_fill, _fw_no_active_vio);
+  r = snprintf(&b[n], b_size - n, "fw: missed_lock: %d not_enabled: %d wait_remote_fill: %d no_active_vio: %d\n", _fw_missed_lock,
+               _fw_not_enabled, _fw_wait_remote_fill, _fw_no_active_vio);
 
   n += r;
   r = snprintf(&b[n], b_size - n, "fw: not_enabled_or_no_read: %d\n", _fw_not_enabled_or_no_read);
 
   n += r;
-  r = snprintf(&b[n], b_size - n,
-               "rd(%d): st:%d rh:%d ahd:%d sd:%d rd:%d ad:%d sda:%d rda:%d awd:%d p:%d c:%d\n",
-               _process_read_calls, _n_read_start, _n_read_header, _n_read_await_header,
-               _n_read_setup_descriptor, _n_read_descriptor, _n_read_await_descriptor,
-               _n_read_setup_data, _n_read_data, _n_read_await_data, _n_read_post_complete, _n_read_complete);
+  r = snprintf(&b[n], b_size - n, "rd(%d): st:%d rh:%d ahd:%d sd:%d rd:%d ad:%d sda:%d rda:%d awd:%d p:%d c:%d\n",
+               _process_read_calls, _n_read_start, _n_read_header, _n_read_await_header, _n_read_setup_descriptor,
+               _n_read_descriptor, _n_read_await_descriptor, _n_read_setup_data, _n_read_data, _n_read_await_data,
+               _n_read_post_complete, _n_read_complete);
 
   n += r;
-  r = snprintf(&b[n], b_size - n,
-               "wr(%d): st:%d set:%d ini:%d wait:%d post:%d comp:%d\n",
-               _process_write_calls, _n_write_start, _n_write_setup, _n_write_initiate,
-               _n_write_await_completion, _n_write_post_complete, _n_write_complete);
+  r = snprintf(&b[n], b_size - n, "wr(%d): st:%d set:%d ini:%d wait:%d post:%d comp:%d\n", _process_write_calls, _n_write_start,
+               _n_write_setup, _n_write_initiate, _n_write_await_completion, _n_write_post_complete, _n_write_complete);
 
   n += r;
   ink_release_assert((n + 1) <= BUFFER_SIZE_FOR_INDEX(MAX_IOBUFFER_SIZE));
@@ -1430,16 +1383,13 @@ ClusterHandler::dump_write_msg(int res)
 {
   // Debug support for inter cluster message trace
   Alias32 x;
-  x.u32 = (uint32_t) ((struct sockaddr_in *)(net_vc->get_remote_addr()))->sin_addr.s_addr;
+  x.u32 = (uint32_t)((struct sockaddr_in *)(net_vc->get_remote_addr()))->sin_addr.s_addr;
 
-  fprintf(stderr,
-          "[W] %hhu.%hhu.%hhu.%hhu SeqNo=%u, Cnt=%d, CntlCnt=%d Todo=%d, Res=%d\n",
-          x.byte[0], x.byte[1], x.byte[2], x.byte[3], write.sequence_number, write.msg.count, write.msg.control_bytes, write.to_do, res);
+  fprintf(stderr, "[W] %hhu.%hhu.%hhu.%hhu SeqNo=%u, Cnt=%d, CntlCnt=%d Todo=%d, Res=%d\n", x.byte[0], x.byte[1], x.byte[2],
+          x.byte[3], write.sequence_number, write.msg.count, write.msg.control_bytes, write.to_do, res);
   for (int i = 0; i < write.msg.count; ++i) {
-    fprintf(stderr, "   d[%i] Type=%d, Chan=%d, SeqNo=%d, Len=%u\n",
-            i, (write.msg.descriptor[i].type ? 1 : 0),
-            (int) write.msg.descriptor[i].channel,
-            (int) write.msg.descriptor[i].sequence_number, write.msg.descriptor[i].length);
+    fprintf(stderr, "   d[%i] Type=%d, Chan=%d, SeqNo=%d, Len=%u\n", i, (write.msg.descriptor[i].type ? 1 : 0),
+            (int)write.msg.descriptor[i].channel, (int)write.msg.descriptor[i].sequence_number, write.msg.descriptor[i].length);
   }
 }
 
@@ -1448,15 +1398,13 @@ ClusterHandler::dump_read_msg()
 {
   // Debug support for inter cluster message trace
   Alias32 x;
-  x.u32 = (uint32_t) ((struct sockaddr_in *)(net_vc->get_remote_addr()))->sin_addr.s_addr;
+  x.u32 = (uint32_t)((struct sockaddr_in *)(net_vc->get_remote_addr()))->sin_addr.s_addr;
 
-  fprintf(stderr, "[R] %hhu.%hhu.%hhu.%hhu  SeqNo=%u, Cnt=%d, CntlCnt=%d\n",
-          x.byte[0], x.byte[1], x.byte[2], x.byte[3], read.sequence_number, read.msg.count, read.msg.control_bytes);
+  fprintf(stderr, "[R] %hhu.%hhu.%hhu.%hhu  SeqNo=%u, Cnt=%d, CntlCnt=%d\n", x.byte[0], x.byte[1], x.byte[2], x.byte[3],
+          read.sequence_number, read.msg.count, read.msg.control_bytes);
   for (int i = 0; i < read.msg.count; ++i) {
-    fprintf(stderr, "   d[%i] Type=%d, Chan=%d, SeqNo=%d, Len=%u\n",
-            i, (read.msg.descriptor[i].type ? 1 : 0),
-            (int) read.msg.descriptor[i].channel,
-            (int) read.msg.descriptor[i].sequence_number, read.msg.descriptor[i].length);
+    fprintf(stderr, "   d[%i] Type=%d, Chan=%d, SeqNo=%d, Len=%u\n", i, (read.msg.descriptor[i].type ? 1 : 0),
+            (int)read.msg.descriptor[i].channel, (int)read.msg.descriptor[i].sequence_number, read.msg.descriptor[i].length);
   }
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterHash.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterHash.cc b/iocore/cluster/ClusterHash.cc
index 08dc0d1..b171f98 100644
--- a/iocore/cluster/ClusterHash.cc
+++ b/iocore/cluster/ClusterHash.cc
@@ -53,7 +53,6 @@ bool randClusterHash = false;
 // bool randClusterHash = true;
 
 
-
 //
 // Cluster Hash Table
 //
@@ -86,7 +85,7 @@ next_rnd15(unsigned int *p)
 // Overall it is roughly linear in the number of nodes.
 //
 void
-build_hash_table_machine(ClusterConfiguration * c)
+build_hash_table_machine(ClusterConfiguration *c)
 {
   int left = CLUSTER_HASH_TABLE_SIZE;
   int m = 0;
@@ -105,8 +104,7 @@ build_hash_table_machine(ClusterConfiguration * c)
   // do a little xor folding to get it into 15 bits
   //
   for (m = 0; m < c->n_machines; m++)
-    rnd[m] = (((c->machines[m]->ip >> 15) & 0x7FFF) ^ (c->machines[m]->ip & 0x7FFF))
-      ^ (c->machines[m]->ip >> 30);
+    rnd[m] = (((c->machines[m]->ip >> 15) & 0x7FFF) ^ (c->machines[m]->ip & 0x7FFF)) ^ (c->machines[m]->ip >> 30);
 
   // Initialize the table to "empty"
   //
@@ -136,7 +134,7 @@ build_hash_table_machine(ClusterConfiguration * c)
 }
 
 static void
-build_hash_table_bucket(ClusterConfiguration * c)
+build_hash_table_bucket(ClusterConfiguration *c)
 {
   int i = 0;
   unsigned int rnd[CLUSTER_HASH_TABLE_SIZE];
@@ -166,7 +164,7 @@ build_hash_table_bucket(ClusterConfiguration * c)
 }
 
 void
-build_cluster_hash_table(ClusterConfiguration * c)
+build_cluster_hash_table(ClusterConfiguration *c)
 {
   if (machineClusterHash)
     build_hash_table_machine(c);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterLib.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterLib.cc b/iocore/cluster/ClusterLib.cc
index 6ff5c27..37360fc 100644
--- a/iocore/cluster/ClusterLib.cc
+++ b/iocore/cluster/ClusterLib.cc
@@ -35,7 +35,7 @@
 // scheduling only occurs after they move into the data_bucket.
 //
 void
-cluster_schedule(ClusterHandler * ch, ClusterVConnection * vc, ClusterVConnState * ns)
+cluster_schedule(ClusterHandler *ch, ClusterVConnection *vc, ClusterVConnState *ns)
 {
   //
   // actually schedule into new bucket
@@ -52,7 +52,7 @@ cluster_schedule(ClusterHandler * ch, ClusterVConnection * vc, ClusterVConnState
 }
 
 void
-cluster_reschedule_offset(ClusterHandler * ch, ClusterVConnection * vc, ClusterVConnState * ns, int offset)
+cluster_reschedule_offset(ClusterHandler *ch, ClusterVConnection *vc, ClusterVConnState *ns, int offset)
 {
   if (ns == &vc->read) {
     if (vc->read.queue)
@@ -79,7 +79,7 @@ ClusterVCToken::alloc()
 #else
   ip_created = this_cluster_machine()->ip;
 #endif
-  sequence_number = ink_atomic_increment((int *) &cluster_sequence_number, 1);
+  sequence_number = ink_atomic_increment((int *)&cluster_sequence_number, 1);
 }
 
 ///////////////////////////////////////////
@@ -87,7 +87,7 @@ ClusterVCToken::alloc()
 ///////////////////////////////////////////
 
 IOBufferBlock *
-clone_IOBufferBlockList(IOBufferBlock * b, int start_off, int n, IOBufferBlock ** b_tail)
+clone_IOBufferBlockList(IOBufferBlock *b, int start_off, int n, IOBufferBlock **b_tail)
 {
   ////////////////////////////////////////////////////////////////
   // Create a clone list of IOBufferBlock(s) where the sum
@@ -112,7 +112,6 @@ clone_IOBufferBlockList(IOBufferBlock * b, int start_off, int n, IOBufferBlock *
       bclone->next = bsrc->clone();
       bclone = bclone->next;
     } else {
-
       // Skip bytes already processed
       if (bytes_to_skip) {
         bytes_to_skip -= bsrc->read_avail();
@@ -149,7 +148,7 @@ clone_IOBufferBlockList(IOBufferBlock * b, int start_off, int n, IOBufferBlock *
 }
 
 IOBufferBlock *
-consume_IOBufferBlockList(IOBufferBlock * b, int64_t n)
+consume_IOBufferBlockList(IOBufferBlock *b, int64_t n)
 {
   IOBufferBlock *b_remainder = 0;
   int64_t nbytes = n;
@@ -160,8 +159,8 @@ consume_IOBufferBlockList(IOBufferBlock * b, int64_t n)
       if (nbytes < 0) {
         // Consumed a partial block, clone remainder
         b_remainder = b->clone();
-        b->fill(nbytes);        // make read_avail match nbytes
-        b_remainder->consume(b->read_avail());  // clone for remaining bytes
+        b->fill(nbytes);                       // make read_avail match nbytes
+        b_remainder->consume(b->read_avail()); // clone for remaining bytes
         b_remainder->next = b->next;
         b->next = 0;
         nbytes = 0;
@@ -177,13 +176,14 @@ consume_IOBufferBlockList(IOBufferBlock * b, int64_t n)
     }
   }
   ink_release_assert(nbytes == 0);
-  return b_remainder;           // return remaining blocks
+  return b_remainder; // return remaining blocks
 }
 
 int64_t
-bytes_IOBufferBlockList(IOBufferBlock * b, int64_t read_avail_bytes)
+bytes_IOBufferBlockList(IOBufferBlock *b, int64_t read_avail_bytes)
 {
-  int64_t n = 0;;
+  int64_t n = 0;
+  ;
 
   while (b) {
     if (read_avail_bytes) {
@@ -205,19 +205,19 @@ bytes_IOBufferBlockList(IOBufferBlock * b, int64_t read_avail_bytes)
 // Test code which mimic the network slowdown
 //
 int
-partial_readv(int fd, IOVec * iov, int n_iov, int seq)
+partial_readv(int fd, IOVec *iov, int n_iov, int seq)
 {
   IOVec tiov[16];
   for (int i = 0; i < n_iov; i++)
     tiov[i] = iov[i];
   int tn_iov = n_iov;
   int rnd = seq;
-  int element = rand_r((unsigned int *) &rnd);
+  int element = rand_r((unsigned int *)&rnd);
   element = element % n_iov;
-  int byte = rand_r((unsigned int *) &rnd);
+  int byte = rand_r((unsigned int *)&rnd);
   byte = byte % iov[element].iov_len;
-  int stop = rand_r((unsigned int *) &rnd);
-  if (!(stop % 3)) {            // 33% chance
+  int stop = rand_r((unsigned int *)&rnd);
+  if (!(stop % 3)) { // 33% chance
     tn_iov = element + 1;
     tiov[element].iov_len = byte;
     if (!byte)
@@ -237,32 +237,32 @@ partial_readv(int fd, IOVec * iov, int n_iov, int seq)
 // Test code which mimic the network backing up (too little buffering)
 //
 int
-partial_writev(int fd, IOVec * iov, int n_iov, int seq)
+partial_writev(int fd, IOVec *iov, int n_iov, int seq)
 {
   int rnd = seq;
   int sum = 0;
   int i = 0;
-    for (i = 0; i < n_iov; i++) {
-      int l = iov[i].iov_len;
-      int r = rand_r((unsigned int *) &rnd);
-      if ((r >> 4) & 1) {
-        l = ((unsigned int) rand_r((unsigned int *) &rnd)) % iov[i].iov_len;
-        if (!l) {
-          l = iov[i].iov_len;
-        }
-      }
-      ink_assert(l <= iov[i].iov_len);
-      fprintf(stderr, "writing %d: [%d] &%X %d of %d\n", seq, i, iov[i].iov_base, l, iov[i].iov_len);
-      int res = socketManager.write(fd, iov[i].iov_base, l);
-      if (res < 0) {
-        return res;
-      }
-      sum += res;
-      if (res != iov[i].iov_len) {
-        return sum;
+  for (i = 0; i < n_iov; i++) {
+    int l = iov[i].iov_len;
+    int r = rand_r((unsigned int *)&rnd);
+    if ((r >> 4) & 1) {
+      l = ((unsigned int)rand_r((unsigned int *)&rnd)) % iov[i].iov_len;
+      if (!l) {
+        l = iov[i].iov_len;
       }
     }
-    return sum;
+    ink_assert(l <= iov[i].iov_len);
+    fprintf(stderr, "writing %d: [%d] &%X %d of %d\n", seq, i, iov[i].iov_base, l, iov[i].iov_len);
+    int res = socketManager.write(fd, iov[i].iov_base, l);
+    if (res < 0) {
+      return res;
+    }
+    sum += res;
+    if (res != iov[i].iov_len) {
+      return sum;
+    }
+  }
+  return sum;
 }
 #endif // TEST_PARTIAL_WRITES
 
@@ -316,9 +316,9 @@ dump_time_buckets()
 #endif // ENABLE_TIME_TRACE
 }
 
-GlobalClusterPeriodicEvent::GlobalClusterPeriodicEvent():Continuation(new_ProxyMutex())
+GlobalClusterPeriodicEvent::GlobalClusterPeriodicEvent() : Continuation(new_ProxyMutex())
 {
-  SET_HANDLER((GClusterPEHandler) & GlobalClusterPeriodicEvent::calloutEvent);
+  SET_HANDLER((GClusterPEHandler)&GlobalClusterPeriodicEvent::calloutEvent);
 }
 
 GlobalClusterPeriodicEvent::~GlobalClusterPeriodicEvent()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterLoadMonitor.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterLoadMonitor.cc b/iocore/cluster/ClusterLoadMonitor.cc
index a3a267e..6d79a0b 100644
--- a/iocore/cluster/ClusterLoadMonitor.cc
+++ b/iocore/cluster/ClusterLoadMonitor.cc
@@ -28,31 +28,20 @@
 ****************************************************************************/
 
 #include "P_Cluster.h"
-int
-  ClusterLoadMonitor::cf_monitor_enabled;
-int
-  ClusterLoadMonitor::cf_ping_message_send_msec_interval;
-int
-  ClusterLoadMonitor::cf_num_ping_response_buckets;
-int
-  ClusterLoadMonitor::cf_msecs_per_ping_response_bucket;
-int
-  ClusterLoadMonitor::cf_ping_latency_threshold_msecs;
-int
-  ClusterLoadMonitor::cf_cluster_load_compute_msec_interval;
-int
-  ClusterLoadMonitor::cf_cluster_periodic_msec_interval;
-int
-  ClusterLoadMonitor::cf_ping_history_buf_length;
-int
-  ClusterLoadMonitor::cf_cluster_load_clear_duration;
-int
-  ClusterLoadMonitor::cf_cluster_load_exceed_duration;
-
-ClusterLoadMonitor::ClusterLoadMonitor(ClusterHandler * ch)
-:Continuation(0), ch(ch), ping_history_buf_head(0),
-periodic_action(0), cluster_overloaded(0), cancel_periodic(0),
-cluster_load_msg_sequence_number(0), cluster_load_msg_start_sequence_number(0)
+int ClusterLoadMonitor::cf_monitor_enabled;
+int ClusterLoadMonitor::cf_ping_message_send_msec_interval;
+int ClusterLoadMonitor::cf_num_ping_response_buckets;
+int ClusterLoadMonitor::cf_msecs_per_ping_response_bucket;
+int ClusterLoadMonitor::cf_ping_latency_threshold_msecs;
+int ClusterLoadMonitor::cf_cluster_load_compute_msec_interval;
+int ClusterLoadMonitor::cf_cluster_periodic_msec_interval;
+int ClusterLoadMonitor::cf_ping_history_buf_length;
+int ClusterLoadMonitor::cf_cluster_load_clear_duration;
+int ClusterLoadMonitor::cf_cluster_load_exceed_duration;
+
+ClusterLoadMonitor::ClusterLoadMonitor(ClusterHandler *ch)
+  : Continuation(0), ch(ch), ping_history_buf_head(0), periodic_action(0), cluster_overloaded(0), cancel_periodic(0),
+    cluster_load_msg_sequence_number(0), cluster_load_msg_start_sequence_number(0)
 {
   mutex = this->ch->mutex;
   SET_HANDLER(&ClusterLoadMonitor::cluster_load_periodic);
@@ -69,8 +58,7 @@ cluster_load_msg_sequence_number(0), cluster_load_msg_start_sequence_number(0)
   ping_latency_threshold_msecs = cf_ping_latency_threshold_msecs ? cf_ping_latency_threshold_msecs : 500;
   Debug("cluster_monitor", "ping_latency_threshold_msecs=%d", ping_latency_threshold_msecs);
 
-  cluster_load_compute_msec_interval =
-    cf_cluster_load_compute_msec_interval ? cf_cluster_load_compute_msec_interval : 5000;
+  cluster_load_compute_msec_interval = cf_cluster_load_compute_msec_interval ? cf_cluster_load_compute_msec_interval : 5000;
   Debug("cluster_monitor", "cluster_load_compute_msec_interval=%d", cluster_load_compute_msec_interval);
 
   cluster_periodic_msec_interval = cf_cluster_periodic_msec_interval ? cf_cluster_periodic_msec_interval : 100;
@@ -87,11 +75,11 @@ cluster_load_msg_sequence_number(0), cluster_load_msg_start_sequence_number(0)
 
   int nbytes = sizeof(int) * num_ping_response_buckets;
   ping_response_buckets = (int *)ats_malloc(nbytes);
-  memset((char *) ping_response_buckets, 0, nbytes);
+  memset((char *)ping_response_buckets, 0, nbytes);
 
   nbytes = sizeof(ink_hrtime) * ping_history_buf_length;
   ping_response_history_buf = (ink_hrtime *)ats_malloc(nbytes);
-  memset((char *) ping_response_history_buf, 0, nbytes);
+  memset((char *)ping_response_history_buf, 0, nbytes);
 
   last_ping_message_sent = HRTIME_SECONDS(0);
   last_cluster_load_compute = HRTIME_SECONDS(0);
@@ -131,7 +119,8 @@ ClusterLoadMonitor::cancel_monitor()
     cancel_periodic = 1;
 }
 
-bool ClusterLoadMonitor::is_cluster_overloaded()
+bool
+ClusterLoadMonitor::is_cluster_overloaded()
 {
   return (cluster_overloaded ? true : false);
 }
@@ -191,11 +180,9 @@ ClusterLoadMonitor::compute_cluster_load()
   end = start;
 
   if (cluster_overloaded) {
-    end -= (cluster_load_clear_duration <= ping_history_buf_length ?
-            cluster_load_clear_duration : ping_history_buf_length);
+    end -= (cluster_load_clear_duration <= ping_history_buf_length ? cluster_load_clear_duration : ping_history_buf_length);
   } else {
-    end -= (cluster_load_exceed_duration <= ping_history_buf_length ?
-            cluster_load_exceed_duration : ping_history_buf_length);
+    end -= (cluster_load_exceed_duration <= ping_history_buf_length ? cluster_load_exceed_duration : ping_history_buf_length);
   }
   if (end < 0)
     end += ping_history_buf_length;
@@ -218,21 +205,19 @@ ClusterLoadMonitor::compute_cluster_load()
     if (threshold_exceeded && (threshold_clear == 0))
       cluster_overloaded = 1;
   }
-  Debug("cluster_monitor",
-        "[%u.%u.%u.%u] overload=%d, clear=%d, exceed=%d, latency=%d",
-        DOT_SEPARATED(this->ch->machine->ip), cluster_overloaded, threshold_clear, threshold_exceeded, n_bucket);
+  Debug("cluster_monitor", "[%u.%u.%u.%u] overload=%d, clear=%d, exceed=%d, latency=%d", DOT_SEPARATED(this->ch->machine->ip),
+        cluster_overloaded, threshold_clear, threshold_exceeded, n_bucket);
 }
 
 void
 ClusterLoadMonitor::note_ping_response_time(ink_hrtime response_time, int sequence_number)
 {
 #ifdef CLUSTER_TOMCAT
-  ProxyMutex *mutex = this->ch->mutex;     // hack for stats
+  ProxyMutex *mutex = this->ch->mutex; // hack for stats
 #endif
 
   CLUSTER_SUM_DYN_STAT(CLUSTER_PING_TIME_STAT, response_time);
-  int bucket = (int)
-    (response_time / HRTIME_MSECONDS(msecs_per_ping_response_bucket));
+  int bucket = (int)(response_time / HRTIME_MSECONDS(msecs_per_ping_response_bucket));
   Debug("cluster_monitor_ping", "[%u.%u.%u.%u] ping: %d %d", DOT_SEPARATED(this->ch->machine->ip), bucket, sequence_number);
 
   if (bucket >= num_ping_response_buckets)
@@ -241,14 +226,13 @@ ClusterLoadMonitor::note_ping_response_time(ink_hrtime response_time, int sequen
 }
 
 void
-ClusterLoadMonitor::recv_cluster_load_msg(cluster_load_ping_msg * m)
+ClusterLoadMonitor::recv_cluster_load_msg(cluster_load_ping_msg *m)
 {
   // We have received back our ping message.
   ink_hrtime now = ink_get_hrtime();
 
-  if ((now >= m->send_time)
-      && ((m->sequence_number >= cluster_load_msg_start_sequence_number)
-          && (m->sequence_number < cluster_load_msg_sequence_number))) {
+  if ((now >= m->send_time) &&
+      ((m->sequence_number >= cluster_load_msg_start_sequence_number) && (m->sequence_number < cluster_load_msg_sequence_number))) {
     // Valid message, note response time.
     note_ping_response_time(now - m->send_time, m->sequence_number);
   }
@@ -263,10 +247,10 @@ ClusterLoadMonitor::cluster_load_ping_rethandler(ClusterHandler *ch, void *data,
   if (ch) {
     if (len == sizeof(struct cluster_load_ping_msg)) {
       struct cluster_load_ping_msg m;
-      memcpy((void *) &m, data, len);   // unmarshal
+      memcpy((void *)&m, data, len); // unmarshal
 
-      if (m.monitor && (m.magicno == cluster_load_ping_msg::CL_MSG_MAGICNO)
-          && (m.version == cluster_load_ping_msg::CL_MSG_VERSION)) {
+      if (m.monitor && (m.magicno == cluster_load_ping_msg::CL_MSG_MAGICNO) &&
+          (m.version == cluster_load_ping_msg::CL_MSG_VERSION)) {
         m.monitor->recv_cluster_load_msg(&m);
       }
     }
@@ -282,7 +266,7 @@ ClusterLoadMonitor::send_cluster_load_msg(ink_hrtime current_time)
 
   m.sequence_number = cluster_load_msg_sequence_number++;
   m.send_time = current_time;
-  cluster_ping(ch, cluster_load_ping_rethandler, (void *) &m, sizeof(m));
+  cluster_ping(ch, cluster_load_ping_rethandler, (void *)&m, sizeof(m));
 }
 
 int

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterMachine.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterMachine.cc b/iocore/cluster/ClusterMachine.cc
index 0756579..2dee977 100644
--- a/iocore/cluster/ClusterMachine.cc
+++ b/iocore/cluster/ClusterMachine.cc
@@ -65,17 +65,8 @@ create_this_cluster_machine()
 }
 
 ClusterMachine::ClusterMachine(char *ahostname, unsigned int aip, int aport)
-  : dead(false),
-    hostname(ahostname),
-    ip(aip),
-    cluster_port(aport),
-    num_connections(0),
-    now_connections(0),
-    free_connections(0),
-    rr_count(0),
-    msg_proto_major(0),
-    msg_proto_minor(0),
-    clusterHandlers(0)
+  : dead(false), hostname(ahostname), ip(aip), cluster_port(aport), num_connections(0), now_connections(0), free_connections(0),
+    rr_count(0), msg_proto_major(0), msg_proto_minor(0), clusterHandlers(0)
 {
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
@@ -88,9 +79,9 @@ ClusterMachine::ClusterMachine(char *ahostname, unsigned int aip, int aport)
     }
     hostname = ats_strdup(ahostname);
 
-    // If we are running if the manager, it the our ip address for
-    //   clustering from the manager, so the manager can control what
-    //   interface we cluster over.  Otherwise figure it out ourselves
+// If we are running if the manager, it the our ip address for
+//   clustering from the manager, so the manager can control what
+//   interface we cluster over.  Otherwise figure it out ourselves
 #ifdef LOCAL_CLUSTER_TEST_MODE
     ip = inet_addr("127.0.0.1");
 #else
@@ -104,32 +95,29 @@ ClusterMachine::ClusterMachine(char *ahostname, unsigned int aip, int aport)
       Debug("cluster_note", "[Machine::Machine] Cluster IP addr: %s\n", clusterIP);
       ip = inet_addr(clusterIP);
     } else {
-
       ink_gethostbyname_r_data data;
       struct hostent *r = ink_gethostbyname_r(ahostname, &data);
       if (!r) {
         Warning("unable to DNS %s: %d", ahostname, data.herrno);
         ip = 0;
       } else {
-
         // lowest IP address
 
-        ip = (unsigned int) -1; // 0xFFFFFFFF
+        ip = (unsigned int)-1; // 0xFFFFFFFF
         for (int i = 0; r->h_addr_list[i]; i++)
-          if (ip > *(unsigned int *) r->h_addr_list[i])
-            ip = *(unsigned int *) r->h_addr_list[i];
-        if (ip == (unsigned int) -1)
+          if (ip > *(unsigned int *)r->h_addr_list[i])
+            ip = *(unsigned int *)r->h_addr_list[i];
+        if (ip == (unsigned int)-1)
           ip = 0;
       }
-      //ip = htonl(ip); for the alpha!
+      // ip = htonl(ip); for the alpha!
     }
 #endif // LOCAL_CLUSTER_TEST_MODE
   } else {
-
     ip = aip;
 
     ink_gethostbyaddr_r_data data;
-    struct hostent *r = ink_gethostbyaddr_r((char *) &ip, sizeof(int), AF_INET, &data);
+    struct hostent *r = ink_gethostbyaddr_r((char *)&ip, sizeof(int), AF_INET, &data);
 
     if (r == NULL) {
       Alias32 x;
@@ -147,7 +135,8 @@ ClusterMachine::ClusterMachine(char *ahostname, unsigned int aip, int aport)
   clusterHandlers = (ClusterHandler **)ats_calloc(num_connections, sizeof(ClusterHandler *));
 }
 
-ClusterHandler *ClusterMachine::pop_ClusterHandler(int no_rr)
+ClusterHandler *
+ClusterMachine::pop_ClusterHandler(int no_rr)
 {
   int find = 0;
   int64_t now = rr_count;
@@ -170,28 +159,27 @@ ClusterMachine::~ClusterMachine()
 }
 
 struct MachineTimeoutContinuation;
-typedef int (MachineTimeoutContinuation::*McTimeoutContHandler) (int, void *);
-struct MachineTimeoutContinuation: public Continuation
-{
+typedef int (MachineTimeoutContinuation::*McTimeoutContHandler)(int, void *);
+struct MachineTimeoutContinuation : public Continuation {
   ClusterMachine *m;
-  int dieEvent(int event, Event * e)
+  int
+  dieEvent(int event, Event *e)
   {
-    (void) event;
-    (void) e;
+    (void)event;
+    (void)e;
     delete m;
     delete this;
     return EVENT_DONE;
   }
 
-  MachineTimeoutContinuation(ClusterMachine * am)
-    : Continuation(NULL), m(am)
+  MachineTimeoutContinuation(ClusterMachine *am) : Continuation(NULL), m(am)
   {
-    SET_HANDLER((McTimeoutContHandler) & MachineTimeoutContinuation::dieEvent);
+    SET_HANDLER((McTimeoutContHandler)&MachineTimeoutContinuation::dieEvent);
   }
 };
 
 void
-free_ClusterMachine(ClusterMachine * m)
+free_ClusterMachine(ClusterMachine *m)
 {
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
@@ -202,7 +190,7 @@ free_ClusterMachine(ClusterMachine * m)
 }
 
 void
-free_MachineList(MachineList * l)
+free_MachineList(MachineList *l)
 {
   new_Freer(l, MACHINE_TIMEOUT);
 }
@@ -238,14 +226,14 @@ read_MachineList(const char *filename, int afd)
           goto Lfail;
         *port++ = 0;
         l->machine[i].ip = inet_addr(line);
-        if (-1 == (int) l->machine[i].ip) {
+        if (-1 == (int)l->machine[i].ip) {
           if (afd == -1) {
             Warning("read machine list failure, bad ip, line %d", ln);
             return NULL;
           } else {
             char s[256];
             snprintf(s, sizeof s, "bad ip, line %d", ln);
-            return (MachineList *) ats_strdup(s);
+            return (MachineList *)ats_strdup(s);
           }
         }
         l->machine[i].port = atoi(port);
@@ -261,7 +249,7 @@ read_MachineList(const char *filename, int afd)
         } else {
           char s[256];
           snprintf(s, sizeof s, "bad port, line %d", ln);
-          return (MachineList *) ats_strdup(s);
+          return (MachineList *)ats_strdup(s);
         }
       }
     }
@@ -277,8 +265,8 @@ read_MachineList(const char *filename, int afd)
         return NULL;
       } else
         ats_free(l);
-      return (MachineList *) ats_strdup("number of machines does not match length of list\n");
+      return (MachineList *)ats_strdup("number of machines does not match length of list\n");
     }
   }
-  return (afd != -1) ? (MachineList *) NULL : l;
+  return (afd != -1) ? (MachineList *)NULL : l;
 }


[27/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_OCSPStapling.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_OCSPStapling.h b/iocore/net/P_OCSPStapling.h
index 5d414e8..077529c 100644
--- a/iocore/net/P_OCSPStapling.h
+++ b/iocore/net/P_OCSPStapling.h
@@ -27,10 +27,10 @@
 #ifdef sk_OPENSSL_STRING_pop
 #ifdef SSL_CTX_set_tlsext_status_cb
 #define HAVE_OPENSSL_OCSP_STAPLING 1
-  void ssl_stapling_ex_init();
-  bool ssl_stapling_init_cert(SSL_CTX *ctx, const char *certfile);
-  void ocsp_update();
-  int ssl_callback_ocsp_stapling(SSL *);
+void ssl_stapling_ex_init();
+bool ssl_stapling_init_cert(SSL_CTX *ctx, const char *certfile);
+void ocsp_update();
+int ssl_callback_ocsp_stapling(SSL *);
 #endif /* SSL_CTX_set_tlsext_status_cb */
 #endif /* sk_OPENSSL_STRING_pop */
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLCertLookup.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLCertLookup.h b/iocore/net/P_SSLCertLookup.h
index 23fad46..a6c3629 100644
--- a/iocore/net/P_SSLCertLookup.h
+++ b/iocore/net/P_SSLCertLookup.h
@@ -30,15 +30,13 @@
 struct SSLConfigParams;
 struct SSLContextStorage;
 
-struct ssl_ticket_key_t
-{
+struct ssl_ticket_key_t {
   unsigned char key_name[16];
   unsigned char hmac_secret[16];
   unsigned char aes_key[16];
 };
 
-struct ssl_ticket_key_block
-{
+struct ssl_ticket_key_block {
   unsigned num_keys;
   ssl_ticket_key_t keys[];
 };
@@ -54,57 +52,57 @@ struct ssl_ticket_key_block
     there is exactly one place we can find all the @c SSL_CTX instances exactly once.
 
 */
-struct SSLCertContext
-{
+struct SSLCertContext {
   /** Special things to do instead of use a context.
       In general an option will be associated with a @c NULL context because
       the context is not used.
   */
   enum Option {
-    OPT_NONE, ///< Nothing special. Implies valid context.
+    OPT_NONE,  ///< Nothing special. Implies valid context.
     OPT_TUNNEL ///< Just tunnel, don't terminate.
   };
 
   SSLCertContext() : ctx(0), opt(OPT_NONE), keyblock(NULL) {}
-  explicit SSLCertContext(SSL_CTX* c) : ctx(c), opt(OPT_NONE), keyblock(NULL) {}
-  SSLCertContext(SSL_CTX* c, Option o) : ctx(c), opt(o), keyblock(NULL) {}
-  SSLCertContext(SSL_CTX* c, Option o, ssl_ticket_key_block *kb) : ctx(c), opt(o), keyblock(kb) {}
+  explicit SSLCertContext(SSL_CTX *c) : ctx(c), opt(OPT_NONE), keyblock(NULL) {}
+  SSLCertContext(SSL_CTX *c, Option o) : ctx(c), opt(o), keyblock(NULL) {}
+  SSLCertContext(SSL_CTX *c, Option o, ssl_ticket_key_block *kb) : ctx(c), opt(o), keyblock(kb) {}
 
-  SSL_CTX* ctx; ///< openSSL context.
-  Option opt; ///< Special handling option.
+  SSL_CTX *ctx;                   ///< openSSL context.
+  Option opt;                     ///< Special handling option.
   ssl_ticket_key_block *keyblock; ///< session keys associated with this address
-  
 };
 
-struct SSLCertLookup : public ConfigInfo
-{
-  SSLContextStorage * ssl_storage;
-  SSL_CTX *           ssl_default;
-  bool                is_valid;
+struct SSLCertLookup : public ConfigInfo {
+  SSLContextStorage *ssl_storage;
+  SSL_CTX *ssl_default;
+  bool is_valid;
 
   int insert(const char *name, SSLCertContext const &cc);
-  int insert(const IpEndpoint& address, SSLCertContext const &cc);
+  int insert(const IpEndpoint &address, SSLCertContext const &cc);
 
   /** Find certificate context by IP address.
       The IP addresses are taken from the socket @a s.
       Exact matches have priority, then wildcards. The destination address is preferred to the source address.
       @return @c A pointer to the matched context, @c NULL if no match is found.
   */
-  SSLCertContext* find(const IpEndpoint& address) const;
+  SSLCertContext *find(const IpEndpoint &address) const;
 
   /** Find certificate context by name (FQDN).
       Exact matches have priority, then wildcards. Only destination based matches are checked.
       @return @c A pointer to the matched context, @c NULL if no match is found.
   */
-  SSLCertContext* find(char const* name) const;
-
+  SSLCertContext *find(char const *name) const;
 
 
   // Return the last-resort default TLS context if there is no name or address match.
-  SSL_CTX * defaultContext() const { return ssl_default; }
+  SSL_CTX *
+  defaultContext() const
+  {
+    return ssl_default;
+  }
 
   unsigned count() const;
-  SSLCertContext * get(unsigned i) const;
+  SSLCertContext *get(unsigned i) const;
 
   SSLCertLookup();
   virtual ~SSLCertLookup();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLConfig.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLConfig.h b/iocore/net/P_SSLConfig.h
index cda2dcb..549aa28 100644
--- a/iocore/net/P_SSLConfig.h
+++ b/iocore/net/P_SSLConfig.h
@@ -47,10 +47,8 @@ struct SSLCertLookup;
 
 typedef void (*init_ssl_ctx_func)(void *, bool);
 
-struct SSLConfigParams : public ConfigInfo
-{
-  enum SSL_SESSION_CACHE_MODE
-  {
+struct SSLConfigParams : public ConfigInfo {
+  enum SSL_SESSION_CACHE_MODE {
     SSL_SESSION_CACHE_MODE_OFF = 0,
     SSL_SESSION_CACHE_MODE_SERVER_OPENSSL_IMPL = 1,
     SSL_SESSION_CACHE_MODE_SERVER_ATS_IMPL = 2
@@ -59,40 +57,40 @@ struct SSLConfigParams : public ConfigInfo
   SSLConfigParams();
   virtual ~SSLConfigParams();
 
-  char *  serverCertPathOnly;
-  char *  serverCertChainFilename;
-  char *  serverKeyPathOnly;
-  char *  serverCACertFilename;
-  char *  serverCACertPath;
-  char *  configFilePath;
-  char *  dhparamsFile;
-  char *  cipherSuite;
-  char *  client_cipherSuite;
-  int     clientCertLevel;
-  int     verify_depth;
-  int     ssl_session_cache; // SSL_SESSION_CACHE_MODE
-  int     ssl_session_cache_size;
-  int     ssl_session_cache_num_buckets;
-  int     ssl_session_cache_skip_on_contention;
-  int     ssl_session_cache_timeout;
-  int     ssl_session_cache_auto_clear;
-
-  char *  clientCertPath;
-  char *  clientKeyPath;
-  char *  clientCACertFilename;
-  char *  clientCACertPath;
-  int     clientVerify;
-  int     client_verify_depth;
-  long    ssl_ctx_options;
-  long    ssl_client_ctx_protocols;
+  char *serverCertPathOnly;
+  char *serverCertChainFilename;
+  char *serverKeyPathOnly;
+  char *serverCACertFilename;
+  char *serverCACertPath;
+  char *configFilePath;
+  char *dhparamsFile;
+  char *cipherSuite;
+  char *client_cipherSuite;
+  int clientCertLevel;
+  int verify_depth;
+  int ssl_session_cache; // SSL_SESSION_CACHE_MODE
+  int ssl_session_cache_size;
+  int ssl_session_cache_num_buckets;
+  int ssl_session_cache_skip_on_contention;
+  int ssl_session_cache_timeout;
+  int ssl_session_cache_auto_clear;
+
+  char *clientCertPath;
+  char *clientKeyPath;
+  char *clientCACertFilename;
+  char *clientCACertPath;
+  int clientVerify;
+  int client_verify_depth;
+  long ssl_ctx_options;
+  long ssl_client_ctx_protocols;
 
   static int ssl_maxrecord;
   static bool ssl_allow_client_renegotiation;
 
   static bool ssl_ocsp_enabled;
-  static int  ssl_ocsp_cache_timeout;
-  static int  ssl_ocsp_request_timeout;
-  static int  ssl_ocsp_update_period;
+  static int ssl_ocsp_cache_timeout;
+  static int ssl_ocsp_request_timeout;
+  static int ssl_ocsp_update_period;
 
   static size_t session_cache_number_buckets;
   static size_t session_cache_max_bucket_size;
@@ -110,12 +108,11 @@ struct SSLConfigParams : public ConfigInfo
 //
 /////////////////////////////////////////////////////////////
 
-struct SSLConfig
-{
+struct SSLConfig {
   static void startup();
   static void reconfigure();
-  static SSLConfigParams * acquire();
-  static void release(SSLConfigParams * params);
+  static SSLConfigParams *acquire();
+  static void release(SSLConfigParams *params);
 
   typedef ConfigProcessor::scoped_config<SSLConfig, SSLConfigParams> scoped_config;
 
@@ -123,12 +120,11 @@ private:
   static int configid;
 };
 
-struct SSLCertificateConfig
-{
+struct SSLCertificateConfig {
   static bool startup();
   static bool reconfigure();
-  static SSLCertLookup * acquire();
-  static void release(SSLCertLookup * params);
+  static SSLCertLookup *acquire();
+  static void release(SSLCertLookup *params);
 
   typedef ConfigProcessor::scoped_config<SSLCertificateConfig, SSLCertLookup> scoped_config;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLNetAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetAccept.h b/iocore/net/P_SSLNetAccept.h
index d50d7ea..1ed4280 100644
--- a/iocore/net/P_SSLNetAccept.h
+++ b/iocore/net/P_SSLNetAccept.h
@@ -36,7 +36,7 @@
 
 
  ****************************************************************************/
-#if !defined (_SSLNetAccept_h_)
+#if !defined(_SSLNetAccept_h_)
 #define _SSLNetAccept_h_
 
 #include "libts.h"
@@ -50,18 +50,14 @@ class UnixNetVConnection;
 // NetAccept
 // Handles accepting connections.
 //
-struct SSLNetAccept: public NetAccept
-{
-  virtual NetProcessor * getNetProcessor() const;
+struct SSLNetAccept : public NetAccept {
+  virtual NetProcessor *getNetProcessor() const;
   virtual EventType getEtype() const;
   virtual void init_accept_per_thread();
   virtual NetAccept *clone() const;
 
-  SSLNetAccept()
-    { };
-
-  virtual ~SSLNetAccept()
-    { };
+  SSLNetAccept(){};
 
+  virtual ~SSLNetAccept(){};
 };
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLNetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetProcessor.h b/iocore/net/P_SSLNetProcessor.h
index 2ff93d6..ec008dd 100644
--- a/iocore/net/P_SSLNetProcessor.h
+++ b/iocore/net/P_SSLNetProcessor.h
@@ -45,15 +45,17 @@ struct NetAccept;
 //  class SSLNetProcessor
 //
 //////////////////////////////////////////////////////////////////
-struct SSLNetProcessor : public UnixNetProcessor
-{
+struct SSLNetProcessor : public UnixNetProcessor {
 public:
-
   virtual int start(int no_of_ssl_threads, size_t stacksize);
 
   void cleanup(void);
 
-  SSL_CTX *getClientSSL_CTX(void) const { return client_ctx; }
+  SSL_CTX *
+  getClientSSL_CTX(void) const
+  {
+    return client_ctx;
+  }
 
   SSLNetProcessor();
   virtual ~SSLNetProcessor();
@@ -70,12 +72,12 @@ public:
   // to be upgraded to ET_SSL for SSLNetProcessor.
   virtual void upgradeEtype(EventType &etype);
 
-  virtual NetAccept * createNetAccept();
-  virtual NetVConnection * allocate_vc(EThread *t);
+  virtual NetAccept *createNetAccept();
+  virtual NetVConnection *allocate_vc(EThread *t);
 
 private:
   SSLNetProcessor(const SSLNetProcessor &);
-  SSLNetProcessor & operator =(const SSLNetProcessor &);
+  SSLNetProcessor &operator=(const SSLNetProcessor &);
 };
 
 extern SSLNetProcessor ssl_NetProcessor;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h
index c32ecd5..f458bb7 100644
--- a/iocore/net/P_SSLNetVConnection.h
+++ b/iocore/net/P_SSLNetVConnection.h
@@ -29,7 +29,7 @@
 
 
  ****************************************************************************/
-#if !defined (_SSLNetVConnection_h_)
+#if !defined(_SSLNetVConnection_h_)
 #define _SSLNetVConnection_h_
 
 #include "libts.h"
@@ -60,10 +60,10 @@
 // (another 20-60 bytes on average, depending on the negotiated ciphersuite [2]).
 // All in all: 1500 - 40 (IP) - 20 (TCP) - 40 (TCP options) - TLS overhead (60-100)
 // For larger records, the size is determined by TLS protocol record size
-#define SSL_DEF_TLS_RECORD_SIZE               1300 // 1500 - 40 (IP) - 20 (TCP) - 40 (TCP options) - TLS overhead (60-100)
-#define SSL_MAX_TLS_RECORD_SIZE              16383 // 2^14 - 1
-#define SSL_DEF_TLS_RECORD_BYTE_THRESHOLD  1000000
-#define SSL_DEF_TLS_RECORD_MSEC_THRESHOLD     1000
+#define SSL_DEF_TLS_RECORD_SIZE 1300  // 1500 - 40 (IP) - 20 (TCP) - 40 (TCP options) - TLS overhead (60-100)
+#define SSL_MAX_TLS_RECORD_SIZE 16383 // 2^14 - 1
+#define SSL_DEF_TLS_RECORD_BYTE_THRESHOLD 1000000
+#define SSL_DEF_TLS_RECORD_MSEC_THRESHOLD 1000
 
 class SSLNextProtocolSet;
 struct SSLCertLookup;
@@ -75,37 +75,43 @@ struct SSLCertLookup;
 //  A VConnection for a network socket.
 //
 //////////////////////////////////////////////////////////////////
-class SSLNetVConnection:public UnixNetVConnection
+class SSLNetVConnection : public UnixNetVConnection
 {
   typedef UnixNetVConnection super; ///< Parent type.
 public:
   virtual int sslStartHandShake(int event, int &err);
-  virtual void free(EThread * t);
-  virtual void enableRead()
+  virtual void free(EThread *t);
+  virtual void
+  enableRead()
   {
     read.enabled = 1;
     write.enabled = 1;
   };
-  virtual bool getSSLHandShakeComplete()
+  virtual bool
+  getSSLHandShakeComplete()
   {
     return sslHandShakeComplete;
   };
-  void setSSLHandShakeComplete(bool state)
+  void
+  setSSLHandShakeComplete(bool state)
   {
     sslHandShakeComplete = state;
   };
-  virtual bool getSSLClientConnection()
+  virtual bool
+  getSSLClientConnection()
   {
     return sslClientConnection;
   };
-  virtual void setSSLClientConnection(bool state)
+  virtual void
+  setSSLClientConnection(bool state)
   {
     sslClientConnection = state;
   };
   int sslServerHandShakeEvent(int &err);
   int sslClientHandShakeEvent(int &err);
-  virtual void net_read_io(NetHandler * nh, EThread * lthread);
-  virtual int64_t load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor & buf, int &needs);
+  virtual void net_read_io(NetHandler *nh, EThread *lthread);
+  virtual int64_t load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor &buf,
+                                        int &needs);
   void registerNextProtocolSet(const SSLNextProtocolSet *);
 
   ////////////////////////////////////////////////////////////
@@ -114,36 +120,43 @@ public:
   // The constructor is public just to avoid compile errors.//
   ////////////////////////////////////////////////////////////
   SSLNetVConnection();
-  virtual ~SSLNetVConnection() { }
+  virtual ~SSLNetVConnection() {}
 
   SSL *ssl;
   ink_hrtime sslHandshakeBeginTime;
   ink_hrtime sslLastWriteTime;
-  int64_t    sslTotalBytesSent;
+  int64_t sslTotalBytesSent;
 
-  static int advertise_next_protocol(SSL * ssl, const unsigned char ** out, unsigned * outlen, void *);
-  static int select_next_protocol(SSL * ssl, const unsigned char ** out, unsigned char * outlen, const unsigned char * in, unsigned inlen, void *);
+  static int advertise_next_protocol(SSL *ssl, const unsigned char **out, unsigned *outlen, void *);
+  static int select_next_protocol(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in,
+                                  unsigned inlen, void *);
 
-  Continuation * endpoint() const {
+  Continuation *
+  endpoint() const
+  {
     return npnEndpoint;
   }
 
-  bool getSSLClientRenegotiationAbort() const
+  bool
+  getSSLClientRenegotiationAbort() const
   {
     return sslClientRenegotiationAbort;
   };
 
-  void setSSLClientRenegotiationAbort(bool state)
+  void
+  setSSLClientRenegotiationAbort(bool state)
   {
     sslClientRenegotiationAbort = state;
   };
 
-  bool getTransparentPassThrough() const
+  bool
+  getTransparentPassThrough() const
   {
     return transparentPassThrough;
   };
 
-  void setTransparentPassThrough(bool val)
+  void
+  setTransparentPassThrough(bool val)
   {
     transparentPassThrough = val;
   };
@@ -152,22 +165,26 @@ public:
   using super::reenable;
 
   /// Reenable the VC after a pre-accept or SNI hook is called.
-  virtual void reenable(NetHandler* nh);
+  virtual void reenable(NetHandler *nh);
   /// Set the SSL context.
   /// @note This must be called after the SSL endpoint has been created.
-  virtual bool sslContextSet(void* ctx);
+  virtual bool sslContextSet(void *ctx);
 
   /// Set by asynchronous hooks to request a specific operation.
   TSSslVConnOp hookOpRequested;
 
   int64_t read_raw_data();
-  void initialize_handshake_buffers() {
+  void
+  initialize_handshake_buffers()
+  {
     this->handShakeBuffer = new_MIOBuffer();
     this->handShakeReader = this->handShakeBuffer->alloc_reader();
     this->handShakeHolder = this->handShakeReader->clone();
     this->handShakeBioStored = 0;
   }
-  void free_handshake_buffers() {
+  void
+  free_handshake_buffers()
+  {
     if (this->handShakeReader) {
       this->handShakeReader->dealloc();
     }
@@ -187,13 +204,11 @@ public:
 
   // Returns true if we have already called at
   // least some of the hooks
-  bool calledHooks(TSHttpHookID /* eventId */) {
-    return (this->sslHandshakeHookState != HANDSHAKE_HOOKS_PRE);
-  }
+  bool calledHooks(TSHttpHookID /* eventId */) { return (this->sslHandshakeHookState != HANDSHAKE_HOOKS_PRE); }
 
 private:
   SSLNetVConnection(const SSLNetVConnection &);
-  SSLNetVConnection & operator =(const SSLNetVConnection &);
+  SSLNetVConnection &operator=(const SSLNetVConnection &);
 
   bool sslHandShakeComplete;
   bool sslClientConnection;
@@ -207,14 +222,14 @@ private:
 
   /// The current hook.
   /// @note For @C SSL_HOOKS_INVOKE, this is the hook to invoke.
-  class APIHook* curHook;
+  class APIHook *curHook;
 
   enum {
-    SSL_HOOKS_INIT,   ///< Initial state, no hooks called yet.
-    SSL_HOOKS_INVOKE, ///< Waiting to invoke hook.
-    SSL_HOOKS_ACTIVE, ///< Hook invoked, waiting for it to complete.
+    SSL_HOOKS_INIT,     ///< Initial state, no hooks called yet.
+    SSL_HOOKS_INVOKE,   ///< Waiting to invoke hook.
+    SSL_HOOKS_ACTIVE,   ///< Hook invoked, waiting for it to complete.
     SSL_HOOKS_CONTINUE, ///< All hooks have been called and completed
-    SSL_HOOKS_DONE    ///< All hooks have been called and completed
+    SSL_HOOKS_DONE      ///< All hooks have been called and completed
   } sslPreAcceptHookState;
 
   enum SSLHandshakeHookState {
@@ -225,11 +240,11 @@ private:
     HANDSHAKE_HOOKS_DONE
   } sslHandshakeHookState;
 
-  const SSLNextProtocolSet * npnSet;
-  Continuation * npnEndpoint;
+  const SSLNextProtocolSet *npnSet;
+  Continuation *npnEndpoint;
 };
 
-typedef int (SSLNetVConnection::*SSLNetVConnHandler) (int, void *);
+typedef int (SSLNetVConnection::*SSLNetVConnHandler)(int, void *);
 
 extern ClassAllocator<SSLNetVConnection> sslNetVCAllocator;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLNextProtocolAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNextProtocolAccept.h b/iocore/net/P_SSLNextProtocolAccept.h
index 800d881..51968ce 100644
--- a/iocore/net/P_SSLNextProtocolAccept.h
+++ b/iocore/net/P_SSLNextProtocolAccept.h
@@ -31,36 +31,36 @@
 #include "P_SSLNextProtocolSet.h"
 #include "I_IOBuffer.h"
 
-class SSLNextProtocolAccept: public SessionAccept
+class SSLNextProtocolAccept : public SessionAccept
 {
 public:
   SSLNextProtocolAccept(Continuation *, bool);
   ~SSLNextProtocolAccept();
 
-  void accept(NetVConnection *, MIOBuffer *, IOBufferReader*);
+  void accept(NetVConnection *, MIOBuffer *, IOBufferReader *);
 
   // Register handler as an endpoint for the specified protocol. Neither
   // handler nor protocol are copied, so the caller must guarantee their
   // lifetime is at least as long as that of the acceptor.
-  bool registerEndpoint(const char * protocol, Continuation * handler);
+  bool registerEndpoint(const char *protocol, Continuation *handler);
 
   // Unregister the handler. Returns false if this protocol is not registered
   // or if it is not registered for the specified handler.
-  bool unregisterEndpoint(const char * protocol, Continuation * handler);
+  bool unregisterEndpoint(const char *protocol, Continuation *handler);
 
   SLINK(SSLNextProtocolAccept, link);
 
 private:
-  int mainEvent(int event, void * netvc);
-  SSLNextProtocolAccept(const SSLNextProtocolAccept &); // disabled
-  SSLNextProtocolAccept& operator =(const SSLNextProtocolAccept&); // disabled
+  int mainEvent(int event, void *netvc);
+  SSLNextProtocolAccept(const SSLNextProtocolAccept &);            // disabled
+  SSLNextProtocolAccept &operator=(const SSLNextProtocolAccept &); // disabled
 
-  MIOBuffer * buffer; // XXX do we really need this?
-  Continuation * endpoint;
+  MIOBuffer *buffer; // XXX do we really need this?
+  Continuation *endpoint;
   SSLNextProtocolSet protoset;
   bool transparent_passthrough;
 
-friend struct SSLNextProtocolTrampoline;
+  friend struct SSLNextProtocolTrampoline;
 };
 
 #endif /* P_SSLNextProtocolAccept_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLNextProtocolSet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNextProtocolSet.h b/iocore/net/P_SSLNextProtocolSet.h
index 729038a..fd38c15 100644
--- a/iocore/net/P_SSLNextProtocolSet.h
+++ b/iocore/net/P_SSLNextProtocolSet.h
@@ -37,29 +37,28 @@ public:
 
   bool registerEndpoint(const char *, Continuation *);
   bool unregisterEndpoint(const char *, Continuation *);
-  bool advertiseProtocols(const unsigned char ** out, unsigned * len) const;
+  bool advertiseProtocols(const unsigned char **out, unsigned *len) const;
 
-  Continuation * findEndpoint(const unsigned char *, unsigned) const;
+  Continuation *findEndpoint(const unsigned char *, unsigned) const;
 
-  struct NextProtocolEndpoint
-  {
+  struct NextProtocolEndpoint {
     // NOTE: the protocol and endpoint are NOT copied. The caller is
     // responsible for ensuring their lifetime.
-    NextProtocolEndpoint(const char * protocol, Continuation * endpoint);
+    NextProtocolEndpoint(const char *protocol, Continuation *endpoint);
     ~NextProtocolEndpoint();
 
-    const char * protocol;
-    Continuation * endpoint;
+    const char *protocol;
+    Continuation *endpoint;
     LINK(NextProtocolEndpoint, link);
 
     typedef DLL<NextProtocolEndpoint> list_type;
   };
 
 private:
-  SSLNextProtocolSet(const SSLNextProtocolSet&); // disabled
-  SSLNextProtocolSet& operator=(const SSLNextProtocolSet&); // disabled
+  SSLNextProtocolSet(const SSLNextProtocolSet &);            // disabled
+  SSLNextProtocolSet &operator=(const SSLNextProtocolSet &); // disabled
 
-  mutable unsigned char * npn;
+  mutable unsigned char *npn;
   mutable size_t npnsz;
 
   NextProtocolEndpoint::list_type endpoints;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_SSLUtils.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLUtils.h b/iocore/net/P_SSLUtils.h
index 6d7697c..bd7aa89 100644
--- a/iocore/net/P_SSLUtils.h
+++ b/iocore/net/P_SSLUtils.h
@@ -40,8 +40,7 @@ struct RecRawStatBlock;
 
 typedef int ssl_error_t;
 
-enum SSL_Stats
-{
+enum SSL_Stats {
   ssl_origin_server_expired_cert_stat,
   ssl_user_agent_expired_cert_stat,
   ssl_origin_server_revoked_cert_stat,
@@ -69,7 +68,7 @@ enum SSL_Stats
   ssl_total_tickets_created_stat,
   ssl_total_tickets_verified_stat,
   ssl_total_tickets_verified_old_key_stat, // verified with old key.
-  ssl_total_ticket_keys_renewed_stat, // number of keys renewed.
+  ssl_total_ticket_keys_renewed_stat,      // number of keys renewed.
   ssl_total_tickets_not_found_stat,
   ssl_total_tickets_renewed_stat,
   ssl_total_dyn_def_tls_record_count,
@@ -100,21 +99,21 @@ enum SSL_Stats
 extern RecRawStatBlock *ssl_rsb;
 
 /* Stats should only be accessed using these macros */
-#define SSL_INCREMENT_DYN_STAT(x) RecIncrRawStat(ssl_rsb, NULL, (int) x, 1)
-#define SSL_DECREMENT_DYN_STAT(x) RecIncrRawStat(ssl_rsb, NULL, (int) x, -1)
-#define SSL_SET_COUNT_DYN_STAT(x,count) RecSetRawStatCount(ssl_rsb, x, count)
-#define SSL_INCREMENT_DYN_STAT_EX(x, y) RecIncrRawStat(ssl_rsb, NULL, (int) x, y)
-#define SSL_CLEAR_DYN_STAT(x) \
-  do { \
-    RecSetRawStatSum(ssl_rsb, (x), 0); \
+#define SSL_INCREMENT_DYN_STAT(x) RecIncrRawStat(ssl_rsb, NULL, (int)x, 1)
+#define SSL_DECREMENT_DYN_STAT(x) RecIncrRawStat(ssl_rsb, NULL, (int)x, -1)
+#define SSL_SET_COUNT_DYN_STAT(x, count) RecSetRawStatCount(ssl_rsb, x, count)
+#define SSL_INCREMENT_DYN_STAT_EX(x, y) RecIncrRawStat(ssl_rsb, NULL, (int)x, y)
+#define SSL_CLEAR_DYN_STAT(x)            \
+  do {                                   \
+    RecSetRawStatSum(ssl_rsb, (x), 0);   \
     RecSetRawStatCount(ssl_rsb, (x), 0); \
   } while (0)
 
 // Create a default SSL server context.
-SSL_CTX * SSLDefaultServerContext();
+SSL_CTX *SSLDefaultServerContext();
 
 // Create and initialize a SSL client context.
-SSL_CTX * SSLInitClientContext(const SSLConfigParams * param);
+SSL_CTX *SSLInitClientContext(const SSLConfigParams *param);
 
 // Initialize the SSL library.
 void SSLInitializeLibrary();
@@ -123,55 +122,83 @@ void SSLInitializeLibrary();
 void SSLInitializeStatistics();
 
 // Release SSL_CTX and the associated data
-void SSLReleaseContext(SSL_CTX* ctx);
+void SSLReleaseContext(SSL_CTX *ctx);
 
 // Wrapper functions to SSL I/O routines
-ssl_error_t SSLWriteBuffer(SSL * ssl, const void * buf, int64_t nbytes, int64_t& nwritten);
-ssl_error_t SSLReadBuffer(SSL * ssl, void * buf, int64_t nbytes, int64_t& nread);
+ssl_error_t SSLWriteBuffer(SSL *ssl, const void *buf, int64_t nbytes, int64_t &nwritten);
+ssl_error_t SSLReadBuffer(SSL *ssl, void *buf, int64_t nbytes, int64_t &nread);
 ssl_error_t SSLAccept(SSL *ssl);
-ssl_error_t SSLConnect(SSL * ssl);
+ssl_error_t SSLConnect(SSL *ssl);
 
 // Log an SSL error.
 #define SSLError(fmt, ...) SSLDiagnostic(DiagsMakeLocation(), false, NULL, fmt, ##__VA_ARGS__)
-#define SSLErrorVC(vc,fmt, ...) SSLDiagnostic(DiagsMakeLocation(), false, (vc), fmt, ##__VA_ARGS__)
+#define SSLErrorVC(vc, fmt, ...) SSLDiagnostic(DiagsMakeLocation(), false, (vc), fmt, ##__VA_ARGS__)
 // Log a SSL diagnostic using the "ssl" diagnostic tag.
 #define SSLDebug(fmt, ...) SSLDiagnostic(DiagsMakeLocation(), true, NULL, fmt, ##__VA_ARGS__)
 #define SSLDebugVC(vc, fmt, ...) SSLDiagnostic(DiagsMakeLocation(), true, (vc), fmt, ##__VA_ARGS__)
 
 #define SSL_CLR_ERR_INCR_DYN_STAT(vc, x, fmt, ...) \
-  do { \
-    SSLDebugVC((vc), fmt, ##__VA_ARGS__); \
-    RecIncrRawStat(ssl_rsb, NULL, (int) x, 1); \
+  do {                                             \
+    SSLDebugVC((vc), fmt, ##__VA_ARGS__);          \
+    RecIncrRawStat(ssl_rsb, NULL, (int)x, 1);      \
   } while (0)
 
-void SSLDiagnostic(const SrcLoc& loc, bool debug, SSLNetVConnection * vc, const char * fmt, ...) TS_PRINTFLIKE(4, 5);
+void SSLDiagnostic(const SrcLoc &loc, bool debug, SSLNetVConnection *vc, const char *fmt, ...) TS_PRINTFLIKE(4, 5);
 
 // Return a static string name for a SSL_ERROR constant.
-const char * SSLErrorName(int ssl_error);
+const char *SSLErrorName(int ssl_error);
 
 // Log a SSL network buffer.
-void SSLDebugBufferPrint(const char * tag, const char * buffer, unsigned buflen, const char * message);
+void SSLDebugBufferPrint(const char *tag, const char *buffer, unsigned buflen, const char *message);
 
 // Load the SSL certificate configuration.
-bool SSLParseCertificateConfiguration(const SSLConfigParams * params, SSLCertLookup * lookup);
+bool SSLParseCertificateConfiguration(const SSLConfigParams *params, SSLCertLookup *lookup);
 
-namespace ssl { namespace detail {
+namespace ssl
+{
+namespace detail
+{
   struct SCOPED_X509_TRAITS {
-    typedef X509* value_type;
-    static value_type initValue() { return NULL; }
-    static bool isValid(value_type x) { return x != NULL; }
-    static void destroy(value_type x) { X509_free(x); }
+    typedef X509 *value_type;
+    static value_type
+    initValue()
+    {
+      return NULL;
+    }
+    static bool
+    isValid(value_type x)
+    {
+      return x != NULL;
+    }
+    static void
+    destroy(value_type x)
+    {
+      X509_free(x);
+    }
   };
 
   struct SCOPED_BIO_TRAITS {
-    typedef BIO* value_type;
-    static value_type initValue() { return NULL; }
-    static bool isValid(value_type x) { return x != NULL; }
-    static void destroy(value_type x) { BIO_free(x); }
+    typedef BIO *value_type;
+    static value_type
+    initValue()
+    {
+      return NULL;
+    }
+    static bool
+    isValid(value_type x)
+    {
+      return x != NULL;
+    }
+    static void
+    destroy(value_type x)
+    {
+      BIO_free(x);
+    }
   };
-/* namespace ssl */ } /* namespace detail */ }
+/* namespace ssl */ } /* namespace detail */
+}
 
-typedef ats_scoped_resource<ssl::detail::SCOPED_X509_TRAITS>  scoped_X509;
-typedef ats_scoped_resource<ssl::detail::SCOPED_BIO_TRAITS>   scoped_BIO;
+typedef ats_scoped_resource<ssl::detail::SCOPED_X509_TRAITS> scoped_X509;
+typedef ats_scoped_resource<ssl::detail::SCOPED_BIO_TRAITS> scoped_BIO;
 
 #endif /* __P_SSLUTILS_H__ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_Socks.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Socks.h b/iocore/net/P_Socks.h
index c7ad37c..aa9cacf 100644
--- a/iocore/net/P_Socks.h
+++ b/iocore/net/P_Socks.h
@@ -31,17 +31,15 @@
 #include <ts/IpMap.h>
 #endif
 
-enum
-{
-  //types of events for Socks auth handlers
+enum {
+  // types of events for Socks auth handlers
   SOCKS_AUTH_OPEN,
   SOCKS_AUTH_WRITE_COMPLETE,
   SOCKS_AUTH_READ_COMPLETE,
   SOCKS_AUTH_FILL_WRITE_BUF
 };
 
-struct socks_conf_struct
-{
+struct socks_conf_struct {
   int socks_needed;
   int server_connect_timeout;
   int socks_timeout;
@@ -52,7 +50,7 @@ struct socks_conf_struct
   int per_server_connection_attempts;
   int connection_attempts;
 
-  //the following ports are used by SocksProxy
+  // the following ports are used by SocksProxy
   int accept_enabled;
   int accept_port;
   unsigned short http_port;
@@ -65,13 +63,14 @@ struct socks_conf_struct
   IpEndpoint server_addr;
 #endif
 
-    socks_conf_struct():socks_needed(0), server_connect_timeout(0), socks_timeout(100), default_version(5),
-    user_name_n_passwd(NULL), user_name_n_passwd_len(0),
-    per_server_connection_attempts(1), connection_attempts(0), accept_enabled(0), accept_port(0), http_port(1080)
+  socks_conf_struct()
+    : socks_needed(0), server_connect_timeout(0), socks_timeout(100), default_version(5), user_name_n_passwd(NULL),
+      user_name_n_passwd_len(0), per_server_connection_attempts(1), connection_attempts(0), accept_enabled(0), accept_port(0),
+      http_port(1080)
   {
-# if !defined(SOCKS_WITH_TS)
+#if !defined(SOCKS_WITH_TS)
     memset(&server_addr, 0, sizeof(server_addr));
-# endif
+#endif
   }
 };
 
@@ -79,20 +78,20 @@ extern struct socks_conf_struct *g_socks_conf_stuff;
 
 void start_SocksProxy(int port);
 
-int loadSocksAuthInfo(int fd, socks_conf_struct * socks_stuff);
+int loadSocksAuthInfo(int fd, socks_conf_struct *socks_stuff);
 
 // umm.. the following typedef should take _its own_ type as one of the args
 // not possible with C
 // Right now just use a generic fn ptr and hide casting in an inline fn.
-typedef int (*SocksAuthHandler) (int event, unsigned char *buf, void (**h_ptr) (void));
+typedef int (*SocksAuthHandler)(int event, unsigned char *buf, void (**h_ptr)(void));
 
 TS_INLINE int
-invokeSocksAuthHandler(SocksAuthHandler & h, int arg1, unsigned char *arg2)
+invokeSocksAuthHandler(SocksAuthHandler &h, int arg1, unsigned char *arg2)
 {
-  return (h) (arg1, arg2, (void (**)(void)) (&h));
+  return (h)(arg1, arg2, (void (**)(void))(&h));
 }
 
-void loadSocksConfiguration(socks_conf_struct * socks_conf_stuff);
+void loadSocksConfiguration(socks_conf_struct *socks_conf_stuff);
 int socks5BasicAuthHandler(int event, unsigned char *p, void (**)(void));
 int socks5PasswdAuthHandler(int event, unsigned char *p, void (**)(void));
 int socks5ServerAuthHandler(int event, unsigned char *p, void (**)(void));
@@ -100,10 +99,7 @@ int socks5ServerAuthHandler(int event, unsigned char *p, void (**)(void));
 class UnixNetVConnection;
 typedef UnixNetVConnection SocksNetVC;
 
-struct SocksEntry:public Continuation
-{
-
-
+struct SocksEntry : public Continuation {
   MIOBuffer *buf;
   IOBufferReader *reader;
 
@@ -127,28 +123,28 @@ struct SocksEntry:public Continuation
   unsigned char socks_cmd;
 
 #ifdef SOCKS_WITH_TS
-  //socks server selection:
+  // socks server selection:
   ParentConfigParams *server_params;
-  HttpRequestData req_data;     //We dont use any http specific fields.
+  HttpRequestData req_data; // We dont use any http specific fields.
   ParentResult server_result;
 #endif
 
   int startEvent(int event, void *data);
   int mainEvent(int event, void *data);
   void findServer();
-  void init(ProxyMutex * m, SocksNetVC * netvc, unsigned char socks_support, unsigned char ver);
+  void init(ProxyMutex *m, SocksNetVC *netvc, unsigned char socks_support, unsigned char ver);
   void free();
 
-    SocksEntry():Continuation(NULL), netVConnection(0),
-    nattempts(0),
-    lerrno(0), timeout(0), version(5), write_done(false), auth_handler(NULL), socks_cmd(NORMAL_SOCKS)
+  SocksEntry()
+    : Continuation(NULL), netVConnection(0), nattempts(0), lerrno(0), timeout(0), version(5), write_done(false), auth_handler(NULL),
+      socks_cmd(NORMAL_SOCKS)
   {
     memset(&target_addr, 0, sizeof(target_addr));
     memset(&server_addr, 0, sizeof(server_addr));
   }
 };
 
-typedef int (SocksEntry::*SocksEntryHandler) (int, void *);
+typedef int (SocksEntry::*SocksEntryHandler)(int, void *);
 
 extern ClassAllocator<SocksEntry> socksAllocator;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index 7cc7c33..bac1a83 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -34,16 +34,15 @@
 #include "I_UDPNet.h"
 
 
-class UDPConnectionInternal:public UDPConnection
+class UDPConnectionInternal : public UDPConnection
 {
-
 public:
   UDPConnectionInternal();
-  virtual ~ UDPConnectionInternal();
+  virtual ~UDPConnectionInternal();
 
   Continuation *continuation;
-  int recvActive;               // interested in receiving
-  int refcount;               // public for assertion
+  int recvActive; // interested in receiving
+  int refcount;   // public for assertion
 
   SOCKET fd;
   IpEndpoint binding;
@@ -84,13 +83,13 @@ UDPConnectionInternal::~UDPConnectionInternal()
 TS_INLINE SOCKET
 UDPConnection::getFd()
 {
-  return ((UDPConnectionInternal *) this)->fd;
+  return ((UDPConnectionInternal *)this)->fd;
 }
 
 TS_INLINE void
-UDPConnection::setBinding(struct sockaddr const* s)
+UDPConnection::setBinding(struct sockaddr const *s)
 {
-  UDPConnectionInternal *p = (UDPConnectionInternal *) this;
+  UDPConnectionInternal *p = (UDPConnectionInternal *)this;
   ats_ip_copy(&p->binding, s);
   p->binding_valid = 1;
 }
@@ -98,7 +97,7 @@ UDPConnection::setBinding(struct sockaddr const* s)
 TS_INLINE int
 UDPConnection::getBinding(struct sockaddr *s)
 {
-  UDPConnectionInternal *p = (UDPConnectionInternal *) this;
+  UDPConnectionInternal *p = (UDPConnectionInternal *)this;
   ats_ip_copy(s, &p->binding);
   return p->binding_valid;
 }
@@ -106,31 +105,31 @@ UDPConnection::getBinding(struct sockaddr *s)
 TS_INLINE void
 UDPConnection::destroy()
 {
-  ((UDPConnectionInternal *) this)->tobedestroyed = 1;
+  ((UDPConnectionInternal *)this)->tobedestroyed = 1;
 }
 
 TS_INLINE int
 UDPConnection::shouldDestroy()
 {
-  return ((UDPConnectionInternal *) this)->tobedestroyed;
+  return ((UDPConnectionInternal *)this)->tobedestroyed;
 }
 
 TS_INLINE void
 UDPConnection::AddRef()
 {
-  ink_atomic_increment(&((UDPConnectionInternal *) this)->refcount, 1);
+  ink_atomic_increment(&((UDPConnectionInternal *)this)->refcount, 1);
 }
 
 TS_INLINE int
 UDPConnection::GetRefCount()
 {
-  return ((UDPConnectionInternal *) this)->refcount;
+  return ((UDPConnectionInternal *)this)->refcount;
 }
 
 TS_INLINE int
 UDPConnection::GetSendGenerationNumber()
 {
-  return ((UDPConnectionInternal *) this)->sendGenerationNum;
+  return ((UDPConnectionInternal *)this)->sendGenerationNum;
 }
 
 TS_INLINE int
@@ -142,7 +141,7 @@ UDPConnection::getPortNum(void)
 TS_INLINE int64_t
 UDPConnection::cancel(void)
 {
-  UDPConnectionInternal *p = (UDPConnectionInternal *) this;
+  UDPConnectionInternal *p = (UDPConnectionInternal *)this;
 
   p->sendGenerationNum++;
   p->lastPktStartTime = p->lastSentPktStartTime;
@@ -152,16 +151,16 @@ UDPConnection::cancel(void)
 TS_INLINE void
 UDPConnection::SetLastSentPktTSSeqNum(int64_t sentSeqNum)
 {
-  ((UDPConnectionInternal *) this)->lastSentPktTSSeqNum = sentSeqNum;
+  ((UDPConnectionInternal *)this)->lastSentPktTSSeqNum = sentSeqNum;
 }
 
 TS_INLINE void
-UDPConnection::setContinuation(Continuation * c)
+UDPConnection::setContinuation(Continuation *c)
 {
   // it is not safe to switch among continuations that don't share locks
   ink_assert(mutex == NULL || c->mutex == mutex);
   mutex = c->mutex;
-  ((UDPConnectionInternal *) this)->continuation = c;
+  ((UDPConnectionInternal *)this)->continuation = c;
 }
 
 #endif //__P_UDPCONNECTION_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UDPIOEvent.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPIOEvent.h b/iocore/net/P_UDPIOEvent.h
index bc5511d..4daddae 100644
--- a/iocore/net/P_UDPIOEvent.h
+++ b/iocore/net/P_UDPIOEvent.h
@@ -26,67 +26,73 @@
 // ugly -- just encapsulate the I/O result so that it can be passed
 // back to the caller via continuation handler.
 
-class UDPIOEvent:public Event
+class UDPIOEvent : public Event
 {
 public:
-  UDPIOEvent():fd(-1), err(0), m(0), handle(0), b(0), bytesTransferred(0)
-  {
-  };
-  ~UDPIOEvent() {
-  };
-  void setInfo(int fd_, IOBufferBlock * b_, int bytesTransferred_, int errno_)
+  UDPIOEvent() : fd(-1), err(0), m(0), handle(0), b(0), bytesTransferred(0){};
+  ~UDPIOEvent(){};
+  void
+  setInfo(int fd_, IOBufferBlock *b_, int bytesTransferred_, int errno_)
   {
     fd = fd_;
     b = b_;
     bytesTransferred = bytesTransferred_;
     err = errno_;
   };
-  void setInfo(int fd_, struct msghdr *m_, int bytesTransferred_, int errno_)
+  void
+  setInfo(int fd_, struct msghdr *m_, int bytesTransferred_, int errno_)
   {
     fd = fd_;
     m = m_;
     bytesTransferred = bytesTransferred_;
     err = errno_;
   };
-  void setHandle(void *v)
+  void
+  setHandle(void *v)
   {
     handle = v;
   }
-  void *getHandle()
+  void *
+  getHandle()
   {
     return handle;
   }
   void free();
-  int getBytesTransferred()
+  int
+  getBytesTransferred()
   {
     return bytesTransferred;
   }
-  IOBufferBlock *getIOBufferBlock()
+  IOBufferBlock *
+  getIOBufferBlock()
   {
     return b;
   }
-  int getError()
+  int
+  getError()
   {
     return err;
   }
-  Continuation *getContinuation()
+  Continuation *
+  getContinuation()
   {
     return continuation;
   }
-  static void free(UDPIOEvent * e);
+  static void free(UDPIOEvent *e);
+
 private:
-  void *operator  new(size_t size);     // undefined
+  void *operator new(size_t size); // undefined
   int fd;
-  int err;                      // error code
+  int err; // error code
   struct msghdr *m;
-  void *handle;                 // some extra data for the client handler
-  Ptr<IOBufferBlock> b;      // holds buffer that I/O will go to
-  int bytesTransferred;         // actual bytes transferred
+  void *handle;         // some extra data for the client handler
+  Ptr<IOBufferBlock> b; // holds buffer that I/O will go to
+  int bytesTransferred; // actual bytes transferred
 };
 
 extern ClassAllocator<UDPIOEvent> UDPIOEventAllocator;
 TS_INLINE void
-UDPIOEvent::free(UDPIOEvent * e)
+UDPIOEvent::free(UDPIOEvent *e)
 {
   e->b = NULL;
   e->mutex = NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index d159e1a..fab6b71 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -36,7 +36,7 @@ extern EventType ET_UDP;
 #include "I_UDPNet.h"
 #include "P_UDPPacket.h"
 
-//added by YTS Team, yamsat
+// added by YTS Team, yamsat
 static inline PollCont *get_UDPPollCont(EThread *);
 
 #include "P_UnixUDPConnection.h"
@@ -44,11 +44,10 @@ static inline PollCont *get_UDPPollCont(EThread *);
 
 struct UDPNetHandler;
 
-struct UDPNetProcessorInternal : public UDPNetProcessor
-{
+struct UDPNetProcessorInternal : public UDPNetProcessor {
   virtual int start(int n_udp_threads, size_t stacksize);
-  void udp_read_from_net(UDPNetHandler * nh, UDPConnection * uc);
-  int udp_callback(UDPNetHandler * nh, UDPConnection * uc, EThread * thread);
+  void udp_read_from_net(UDPNetHandler *nh, UDPConnection *uc);
+  int udp_callback(UDPNetHandler *nh, UDPConnection *uc, EThread *thread);
 
   off_t pollCont_offset;
   off_t udpNetHandler_offset;
@@ -57,7 +56,6 @@ struct UDPNetProcessorInternal : public UDPNetProcessor
 extern UDPNetProcessorInternal udpNetInternal;
 
 
-
 // 20 ms slots; 2048 slots  => 40 sec. into the future
 #define SLOT_TIME_MSEC 20
 #define SLOT_TIME HRTIME_MSECONDS(SLOT_TIME_MSEC)
@@ -65,16 +63,14 @@ extern UDPNetProcessorInternal udpNetInternal;
 
 class PacketQueue
 {
- public:
- PacketQueue()
-   : nPackets(0), now_slot(0)
-    {
-      lastPullLongTermQ = 0;
-      init();
-    }
+public:
+  PacketQueue() : nPackets(0), now_slot(0)
+  {
+    lastPullLongTermQ = 0;
+    init();
+  }
 
-  virtual ~ PacketQueue()
-    { }
+  virtual ~PacketQueue() {}
 
   int nPackets;
   ink_hrtime lastPullLongTermQ;
@@ -83,7 +79,8 @@ class PacketQueue
   ink_hrtime delivery_time[N_SLOTS];
   int now_slot;
 
-  void init(void)
+  void
+  init(void)
   {
     now_slot = 0;
     ink_hrtime now = ink_get_hrtime_internal();
@@ -96,7 +93,8 @@ class PacketQueue
     }
   }
 
-  void addPacket(UDPPacketInternal * e, ink_hrtime now = 0)
+  void
+  addPacket(UDPPacketInternal *e, ink_hrtime now = 0)
   {
     int before = 0;
     int slot;
@@ -133,14 +131,14 @@ class PacketQueue
     slot = (s + now_slot) % N_SLOTS;
 
     // so that slot+1 is still "in future".
-    ink_assert((before || delivery_time[slot] <= e->delivery_time) &&
-               (delivery_time[(slot + 1) % N_SLOTS] >= e->delivery_time));
+    ink_assert((before || delivery_time[slot] <= e->delivery_time) && (delivery_time[(slot + 1) % N_SLOTS] >= e->delivery_time));
     e->in_the_priority_queue = 1;
     e->in_heap = slot;
     bucket[slot].enqueue(e);
   }
 
-  UDPPacketInternal *firstPacket(ink_hrtime t)
+  UDPPacketInternal *
+  firstPacket(ink_hrtime t)
   {
     if (t > delivery_time[now_slot]) {
       return bucket[now_slot].head;
@@ -149,25 +147,29 @@ class PacketQueue
     }
   }
 
-  UDPPacketInternal *getFirstPacket()
+  UDPPacketInternal *
+  getFirstPacket()
   {
     nPackets--;
     return dequeue_ready(0);
   }
 
-  int size()
+  int
+  size()
   {
     ink_assert(nPackets >= 0);
     return nPackets;
   }
 
-  bool IsCancelledPacket(UDPPacketInternal * p)
+  bool
+  IsCancelledPacket(UDPPacketInternal *p)
   {
     // discard packets that'll never get sent...
     return ((p->conn->shouldDestroy()) || (p->conn->GetSendGenerationNumber() != p->reqGenerationNum));
   }
 
-  void FreeCancelledPackets(int numSlots)
+  void
+  FreeCancelledPackets(int numSlots)
   {
     UDPPacketInternal *p;
     Queue<UDPPacketInternal> tempQ;
@@ -189,7 +191,8 @@ class PacketQueue
     }
   }
 
-  void advanceNow(ink_hrtime t)
+  void
+  advanceNow(ink_hrtime t)
   {
     int s = now_slot;
     int prev;
@@ -223,13 +226,14 @@ class PacketQueue
     }
 
     if (s != now_slot)
-      Debug("udpnet-service", "Advancing by (%d slots): behind by %" PRId64 " ms",
-            s - now_slot, ink_hrtime_to_msec(t - delivery_time[now_slot]));
+      Debug("udpnet-service", "Advancing by (%d slots): behind by %" PRId64 " ms", s - now_slot,
+            ink_hrtime_to_msec(t - delivery_time[now_slot]));
     now_slot = s;
   }
 
- private:
-  void remove(UDPPacketInternal * e)
+private:
+  void
+  remove(UDPPacketInternal *e)
   {
     nPackets--;
     ink_assert(e->in_the_priority_queue);
@@ -237,10 +241,11 @@ class PacketQueue
     bucket[e->in_heap].remove(e);
   }
 
- public:
-  UDPPacketInternal *dequeue_ready(ink_hrtime t)
+public:
+  UDPPacketInternal *
+  dequeue_ready(ink_hrtime t)
   {
-    (void) t;
+    (void)t;
     UDPPacketInternal *e = bucket[now_slot].dequeue();
     if (e) {
       ink_assert(e->in_the_priority_queue);
@@ -250,12 +255,14 @@ class PacketQueue
     return e;
   }
 
-  void check_ready(ink_hrtime now)
+  void
+  check_ready(ink_hrtime now)
   {
-    (void) now;
+    (void)now;
   }
 
-  ink_hrtime earliest_timeout()
+  ink_hrtime
+  earliest_timeout()
   {
     int s = now_slot;
     for (int i = 0; i < N_SLOTS; i++) {
@@ -267,9 +274,11 @@ class PacketQueue
     return HRTIME_FOREVER;
   }
 
- private:
-  void kill_cancelled_events()
-  { }
+private:
+  void
+  kill_cancelled_events()
+  {
+  }
 };
 
 
@@ -288,20 +297,19 @@ public:
   void service(UDPNetHandler *);
 
   void SendPackets();
-  void SendUDPPacket(UDPPacketInternal * p, int32_t pktLen);
+  void SendUDPPacket(UDPPacketInternal *p, int32_t pktLen);
 
   // Interface exported to the outside world
-  void send(UDPPacket * p);
+  void send(UDPPacket *p);
 
   UDPQueue();
   ~UDPQueue();
 };
 
 
-void initialize_thread_for_udp_net(EThread * thread);
+void initialize_thread_for_udp_net(EThread *thread);
 
-struct UDPNetHandler: public Continuation
-{
+struct UDPNetHandler : public Continuation {
 public:
   // to be polled for read
   Que(UnixUDPConnection, polling_link) udp_polling;
@@ -319,21 +327,21 @@ public:
   ink_hrtime nextCheck;
   ink_hrtime lastCheck;
 
-  int startNetEvent(int event, Event * data);
-  int mainNetEvent(int event, Event * data);
+  int startNetEvent(int event, Event *data);
+  int mainNetEvent(int event, Event *data);
 
   UDPNetHandler();
 };
 
 struct PollCont;
 static inline PollCont *
-get_UDPPollCont(EThread * t)
+get_UDPPollCont(EThread *t)
 {
   return (PollCont *)ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset);
 }
 
 static inline UDPNetHandler *
-get_UDPNetHandler(EThread * t)
+get_UDPNetHandler(EThread *t)
 {
   return (UDPNetHandler *)ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index f56e0b9..d926eef 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -34,27 +34,26 @@
 
 #include "I_UDPNet.h"
 
-class UDPPacketInternal:public UDPPacket
+class UDPPacketInternal : public UDPPacket
 {
-
 public:
   UDPPacketInternal();
-  virtual ~ UDPPacketInternal();
+  virtual ~UDPPacketInternal();
 
-  void append_block_internal(IOBufferBlock * block);
+  void append_block_internal(IOBufferBlock *block);
 
   virtual void free();
 
-  SLINK(UDPPacketInternal, alink);  // atomic link
+  SLINK(UDPPacketInternal, alink); // atomic link
   // packet scheduling stuff: keep it a doubly linked list
   uint64_t pktLength;
 
   int reqGenerationNum;
-  ink_hrtime delivery_time;   // when to deliver packet
+  ink_hrtime delivery_time; // when to deliver packet
 
   Ptr<IOBufferBlock> chain;
-  Continuation *cont;         // callback on error
-  UDPConnectionInternal *conn;        // connection where packet should be sent to.
+  Continuation *cont;          // callback on error
+  UDPConnectionInternal *conn; // connection where packet should be sent to.
 
   int in_the_priority_queue;
   int in_heap;
@@ -64,8 +63,7 @@ inkcoreapi extern ClassAllocator<UDPPacketInternal> udpPacketAllocator;
 
 TS_INLINE
 UDPPacketInternal::UDPPacketInternal()
-  : pktLength(0), reqGenerationNum(0), delivery_time(0), cont(NULL),
-    conn(NULL), in_the_priority_queue(0), in_heap(0)
+  : pktLength(0), reqGenerationNum(0), delivery_time(0), cont(NULL), conn(NULL), in_the_priority_queue(0), in_heap(0)
 {
   memset(&from, '\0', sizeof(from));
   memset(&to, '\0', sizeof(to));
@@ -88,12 +86,12 @@ UDPPacketInternal::free()
 }
 
 TS_INLINE void
-UDPPacket::append_block(IOBufferBlock * block)
+UDPPacket::append_block(IOBufferBlock *block)
 {
-  UDPPacketInternal *p = (UDPPacketInternal *) this;
+  UDPPacketInternal *p = (UDPPacketInternal *)this;
 
   if (block) {
-    if (p->chain) {           // append to end
+    if (p->chain) { // append to end
       IOBufferBlock *last = p->chain;
       while (last->next != NULL) {
         last = last->next;
@@ -108,7 +106,7 @@ UDPPacket::append_block(IOBufferBlock * block)
 TS_INLINE int64_t
 UDPPacket::getPktLength()
 {
-  UDPPacketInternal *p = (UDPPacketInternal *) this;
+  UDPPacketInternal *p = (UDPPacketInternal *)this;
   IOBufferBlock *b;
 
   p->pktLength = 0;
@@ -123,17 +121,17 @@ UDPPacket::getPktLength()
 TS_INLINE void
 UDPPacket::free()
 {
-  ((UDPPacketInternal *) this)->free();
+  ((UDPPacketInternal *)this)->free();
 }
 
 TS_INLINE void
-UDPPacket::setContinuation(Continuation * c)
+UDPPacket::setContinuation(Continuation *c)
 {
-  ((UDPPacketInternal *) this)->cont = c;
+  ((UDPPacketInternal *)this)->cont = c;
 }
 
 TS_INLINE void
-UDPPacket::setConnection(UDPConnection * c)
+UDPPacket::setConnection(UDPConnection *c)
 {
   /*Code reviewed by Case Larsen.  Previously, we just had
      ink_assert(!conn).  This prevents tunneling of packets
@@ -142,7 +140,7 @@ UDPPacket::setConnection(UDPConnection * c)
      assert will prevent that.  The "if" clause enables correct
      handling of the connection ref. counts in such a scenario. */
 
-  UDPConnectionInternal *&conn = ((UDPPacketInternal *) this)->conn;
+  UDPConnectionInternal *&conn = ((UDPPacketInternal *)this)->conn;
 
   if (conn) {
     if (conn == c)
@@ -150,24 +148,24 @@ UDPPacket::setConnection(UDPConnection * c)
     conn->Release();
     conn = NULL;
   }
-  conn = (UDPConnectionInternal *) c;
+  conn = (UDPConnectionInternal *)c;
   conn->AddRef();
 }
 
 TS_INLINE IOBufferBlock *
 UDPPacket::getIOBlockChain(void)
 {
-  return ((UDPPacketInternal *) this)->chain;
+  return ((UDPPacketInternal *)this)->chain;
 }
 
 TS_INLINE UDPConnection *
 UDPPacket::getConnection(void)
 {
-  return ((UDPPacketInternal *) this)->conn;
+  return ((UDPPacketInternal *)this)->conn;
 }
 
 TS_INLINE UDPPacket *
-new_UDPPacket(struct sockaddr const* to, ink_hrtime when, char *buf, int len)
+new_UDPPacket(struct sockaddr const *to, ink_hrtime when, char *buf, int len)
 {
   UDPPacketInternal *p = udpPacketAllocator.alloc();
 
@@ -188,9 +186,9 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, char *buf, int len)
 }
 
 TS_INLINE UDPPacket *
-new_UDPPacket(struct sockaddr const* to, ink_hrtime when, IOBufferBlock * buf, int len)
+new_UDPPacket(struct sockaddr const *to, ink_hrtime when, IOBufferBlock *buf, int len)
 {
-  (void) len;
+  (void)len;
   UDPPacketInternal *p = udpPacketAllocator.alloc();
   IOBufferBlock *body;
 
@@ -208,7 +206,7 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, IOBufferBlock * buf, i
 }
 
 TS_INLINE UDPPacket *
-new_UDPPacket(struct sockaddr const* to, ink_hrtime when, Ptr<IOBufferBlock> buf)
+new_UDPPacket(struct sockaddr const *to, ink_hrtime when, Ptr<IOBufferBlock> buf)
 {
   UDPPacketInternal *p = udpPacketAllocator.alloc();
 
@@ -228,7 +226,7 @@ new_UDPPacket(ink_hrtime when, Ptr<IOBufferBlock> buf)
 }
 
 TS_INLINE UDPPacket *
-new_incoming_UDPPacket(struct sockaddr * from, char *buf, int len)
+new_incoming_UDPPacket(struct sockaddr *from, char *buf, int len)
 {
   UDPPacketInternal *p = udpPacketAllocator.alloc();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixCompletionUtil.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixCompletionUtil.h b/iocore/net/P_UnixCompletionUtil.h
index 4a7f547..e9e6235 100644
--- a/iocore/net/P_UnixCompletionUtil.h
+++ b/iocore/net/P_UnixCompletionUtil.h
@@ -35,70 +35,70 @@ completionUtil::create()
   return u;
 }
 TS_INLINE void
-completionUtil::destroy(Event * e)
+completionUtil::destroy(Event *e)
 {
   ink_assert(e != NULL);
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   UDPIOEvent::free(u);
 }
 TS_INLINE void
-completionUtil::setThread(Event * e, EThread * t)
+completionUtil::setThread(Event *e, EThread *t)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   u->ethread = t;
 }
 TS_INLINE void
-completionUtil::setContinuation(Event * e, Continuation * c)
+completionUtil::setContinuation(Event *e, Continuation *c)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
-  *(Action *) u = c;
+  UDPIOEvent *u = (UDPIOEvent *)e;
+  *(Action *)u = c;
 }
 TS_INLINE void *
-completionUtil::getHandle(Event * e)
+completionUtil::getHandle(Event *e)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   return u->getHandle();
 }
 TS_INLINE void
-completionUtil::setHandle(Event * e, void *handle)
+completionUtil::setHandle(Event *e, void *handle)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   u->setHandle(handle);
 }
 TS_INLINE void
-completionUtil::setInfo(Event * e, int fd, IOBufferBlock * buf, int actual, int errno_)
+completionUtil::setInfo(Event *e, int fd, IOBufferBlock *buf, int actual, int errno_)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   u->setInfo(fd, buf, actual, errno_);
 }
 TS_INLINE void
-completionUtil::setInfo(Event * e, int fd, struct msghdr *msg, int actual, int errno_)
+completionUtil::setInfo(Event *e, int fd, struct msghdr *msg, int actual, int errno_)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   u->setInfo(fd, msg, actual, errno_);
 }
 TS_INLINE int
-completionUtil::getBytesTransferred(Event * e)
+completionUtil::getBytesTransferred(Event *e)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   return u->getBytesTransferred();
 }
 TS_INLINE IOBufferBlock *
-completionUtil::getIOBufferBlock(Event * e)
+completionUtil::getIOBufferBlock(Event *e)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   return u->getIOBufferBlock();
 }
 TS_INLINE Continuation *
-completionUtil::getContinuation(Event * e)
+completionUtil::getContinuation(Event *e)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   return u->getContinuation();
 }
 TS_INLINE int
-completionUtil::getError(Event * e)
+completionUtil::getError(Event *e)
 {
-  UDPIOEvent *u = (UDPIOEvent *) e;
+  UDPIOEvent *u = (UDPIOEvent *)e;
   return u->getError();
 }
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index 7b8228a..3b06428 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -26,27 +26,27 @@
 
 #include "libts.h"
 
-#define USE_EDGE_TRIGGER_EPOLL  1
+#define USE_EDGE_TRIGGER_EPOLL 1
 #define USE_EDGE_TRIGGER_KQUEUE 1
-#define USE_EDGE_TRIGGER_PORT   1
+#define USE_EDGE_TRIGGER_PORT 1
 
 
-#define EVENTIO_NETACCEPT       1
-#define EVENTIO_READWRITE_VC    2
-#define EVENTIO_DNS_CONNECTION  3
-#define EVENTIO_UDP_CONNECTION  4
-#define EVENTIO_ASYNC_SIGNAL    5
+#define EVENTIO_NETACCEPT 1
+#define EVENTIO_READWRITE_VC 2
+#define EVENTIO_DNS_CONNECTION 3
+#define EVENTIO_UDP_CONNECTION 4
+#define EVENTIO_ASYNC_SIGNAL 5
 
 #if TS_USE_EPOLL
 #ifdef USE_EDGE_TRIGGER_EPOLL
 #define USE_EDGE_TRIGGER 1
-#define EVENTIO_READ (EPOLLIN|EPOLLET)
-#define EVENTIO_WRITE (EPOLLOUT|EPOLLET)
+#define EVENTIO_READ (EPOLLIN | EPOLLET)
+#define EVENTIO_WRITE (EPOLLOUT | EPOLLET)
 #else
 #define EVENTIO_READ EPOLLIN
 #define EVENTIO_WRITE EPOLLOUT
 #endif
-#define EVENTIO_ERROR (EPOLLERR|EPOLLPRI|EPOLLHUP)
+#define EVENTIO_ERROR (EPOLLERR | EPOLLPRI | EPOLLHUP)
 #endif
 
 #if TS_USE_KQUEUE
@@ -58,15 +58,15 @@
 #endif
 #define EVENTIO_READ INK_EVP_IN
 #define EVENTIO_WRITE INK_EVP_OUT
-#define EVENTIO_ERROR (0x010|0x002|0x020) // ERR PRI HUP
+#define EVENTIO_ERROR (0x010 | 0x002 | 0x020) // ERR PRI HUP
 #endif
 #if TS_USE_PORT
 #ifdef USE_EDGE_TRIGGER_PORT
 #define USE_EDGE_TRIGGER 1
 #endif
-#define EVENTIO_READ  POLLIN
+#define EVENTIO_READ POLLIN
 #define EVENTIO_WRITE POLLOUT
-#define EVENTIO_ERROR (POLLERR|POLLPRI|POLLHUP)
+#define EVENTIO_ERROR (POLLERR | POLLPRI | POLLHUP)
 #endif
 
 struct PollDescriptor;
@@ -76,16 +76,14 @@ class UnixNetVConnection;
 class UnixUDPConnection;
 struct DNSConnection;
 struct NetAccept;
-struct EventIO
-{
+struct EventIO {
   int fd;
 #if TS_USE_KQUEUE || TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER) || TS_USE_PORT
   int events;
 #endif
   EventLoop event_loop;
   int type;
-  union
-  {
+  union {
     Continuation *c;
     UnixNetVConnection *vc;
     DNSConnection *dnscon;
@@ -104,7 +102,8 @@ struct EventIO
   int refresh(int events);
   int stop();
   int close();
-  EventIO() {
+  EventIO()
+  {
     type = 0;
     data.c = 0;
   }
@@ -119,7 +118,7 @@ struct EventIO
 
 class UnixNetVConnection;
 class NetHandler;
-typedef int (NetHandler::*NetContHandler) (int, void *);
+typedef int (NetHandler::*NetContHandler)(int, void *);
 typedef unsigned int uint32;
 
 extern ink_hrtime last_throttle_warning;
@@ -139,40 +138,39 @@ extern int http_accept_port_number;
 // Design notes are in Memo.NetDesign
 //
 
-#define THROTTLE_FD_HEADROOM                      (128 + 64)    // CACHE_DB_FDS + 64
+#define THROTTLE_FD_HEADROOM (128 + 64) // CACHE_DB_FDS + 64
 
-#define TRANSIENT_ACCEPT_ERROR_MESSAGE_EVERY      HRTIME_HOURS(24)
-#define NET_RETRY_DELAY                           HRTIME_MSECONDS(10)
+#define TRANSIENT_ACCEPT_ERROR_MESSAGE_EVERY HRTIME_HOURS(24)
+#define NET_RETRY_DELAY HRTIME_MSECONDS(10)
 
 // also the 'throttle connect headroom'
-#define THROTTLE_AT_ONCE                          5
-#define EMERGENCY_THROTTLE                        16
-#define HYPER_EMERGENCY_THROTTLE                  6
+#define THROTTLE_AT_ONCE 5
+#define EMERGENCY_THROTTLE 16
+#define HYPER_EMERGENCY_THROTTLE 6
 
-#define NET_THROTTLE_ACCEPT_HEADROOM              1.1   // 10%
-#define NET_THROTTLE_CONNECT_HEADROOM             1.0   // 0%
-#define NET_THROTTLE_MESSAGE_EVERY                HRTIME_MINUTES(10)
-#define NET_PERIOD                                -HRTIME_MSECONDS(5)
-#define ACCEPT_PERIOD                             -HRTIME_MSECONDS(4)
-#define NET_THROTTLE_DELAY                        50    /* mseconds */
+#define NET_THROTTLE_ACCEPT_HEADROOM 1.1  // 10%
+#define NET_THROTTLE_CONNECT_HEADROOM 1.0 // 0%
+#define NET_THROTTLE_MESSAGE_EVERY HRTIME_MINUTES(10)
+#define NET_PERIOD -HRTIME_MSECONDS(5)
+#define ACCEPT_PERIOD -HRTIME_MSECONDS(4)
+#define NET_THROTTLE_DELAY 50 /* mseconds */
 
-#define PRINT_IP(x) ((uint8_t*)&(x))[0],((uint8_t*)&(x))[1], ((uint8_t*)&(x))[2],((uint8_t*)&(x))[3]
+#define PRINT_IP(x) ((uint8_t *)&(x))[0], ((uint8_t *)&(x))[1], ((uint8_t *)&(x))[2], ((uint8_t *)&(x))[3]
 
 
 // function prototype needed for SSLUnixNetVConnection
 unsigned int net_next_connection_number();
 
-struct PollCont:public Continuation
-{
+struct PollCont : public Continuation {
   NetHandler *net_handler;
   PollDescriptor *pollDescriptor;
   PollDescriptor *nextPollDescriptor;
   int poll_timeout;
 
-  PollCont(ProxyMutex * m, int pt = net_config_poll_timeout);
-  PollCont(ProxyMutex * m, NetHandler * nh, int pt = net_config_poll_timeout);
+  PollCont(ProxyMutex *m, int pt = net_config_poll_timeout);
+  PollCont(ProxyMutex *m, NetHandler *nh, int pt = net_config_poll_timeout);
   ~PollCont();
-  int pollEvent(int event, Event * e);
+  int pollEvent(int event, Event *e);
 };
 
 
@@ -182,7 +180,7 @@ struct PollCont:public Continuation
 // A NetHandler handles the Network IO operations.  It maintains
 // lists of operations at multiples of it's periodicity.
 //
-class NetHandler:public Continuation
+class NetHandler : public Continuation
 {
 public:
   Event *trigger_event;
@@ -198,48 +196,49 @@ public:
   time_t sec;
   int cycles;
 
-  int startNetEvent(int event, Event * data);
-  int mainNetEvent(int event, Event * data);
-  int mainNetEventExt(int event, Event * data);
+  int startNetEvent(int event, Event *data);
+  int mainNetEvent(int event, Event *data);
+  int mainNetEventExt(int event, Event *data);
   void process_enabled_list(NetHandler *);
 
   NetHandler();
 };
 
 static inline NetHandler *
-get_NetHandler(EThread * t)
+get_NetHandler(EThread *t)
 {
-  return (NetHandler *) ETHREAD_GET_PTR(t, unix_netProcessor.netHandler_offset);
+  return (NetHandler *)ETHREAD_GET_PTR(t, unix_netProcessor.netHandler_offset);
 }
 static inline PollCont *
-get_PollCont(EThread * t)
+get_PollCont(EThread *t)
 {
-  return (PollCont *) ETHREAD_GET_PTR(t, unix_netProcessor.pollCont_offset);
+  return (PollCont *)ETHREAD_GET_PTR(t, unix_netProcessor.pollCont_offset);
 }
 static inline PollDescriptor *
-get_PollDescriptor(EThread * t)
+get_PollDescriptor(EThread *t)
 {
   PollCont *p = get_PollCont(t);
   return p->pollDescriptor;
 }
 
 
-enum ThrottleType
-{ ACCEPT, CONNECT };
+enum ThrottleType {
+  ACCEPT,
+  CONNECT,
+};
 
 TS_INLINE int
 net_connections_to_throttle(ThrottleType t)
 {
-
   double headroom = t == ACCEPT ? NET_THROTTLE_ACCEPT_HEADROOM : NET_THROTTLE_CONNECT_HEADROOM;
   int64_t sval = 0;
 
   NET_READ_GLOBAL_DYN_SUM(net_connections_currently_open_stat, sval);
-  int currently_open = (int) sval;
+  int currently_open = (int)sval;
   // deal with race if we got to multiple net threads
   if (currently_open < 0)
     currently_open = 0;
-  return (int) (currently_open * headroom);
+  return (int)(currently_open * headroom);
 }
 
 TS_INLINE void
@@ -279,7 +278,6 @@ check_throttle_warning()
   if (t - last_throttle_warning > NET_THROTTLE_MESSAGE_EVERY) {
     last_throttle_warning = t;
     RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many connections, throttling");
-
   }
 }
 
@@ -295,7 +293,7 @@ check_throttle_warning()
 // will recover.
 //
 TS_INLINE int
-check_emergency_throttle(Connection & con)
+check_emergency_throttle(Connection &con)
 {
   int fd = con.fd;
   int emergency = fds_limit - EMERGENCY_THROTTLE;
@@ -315,10 +313,10 @@ check_emergency_throttle(Connection & con)
 TS_INLINE int
 change_net_connections_throttle(const char *token, RecDataT data_type, RecData value, void *data)
 {
-  (void) token;
-  (void) data_type;
-  (void) value;
-  (void) data;
+  (void)token;
+  (void)data_type;
+  (void)value;
+  (void)data;
   int throttle = fds_limit - THROTTLE_FD_HEADROOM;
   if (fds_throttle < 0)
     net_connections_throttle = throttle;
@@ -340,8 +338,8 @@ accept_error_seriousness(int res)
   switch (res) {
   case -EAGAIN:
   case -ECONNABORTED:
-  case -ECONNRESET:            // for Linux
-  case -EPIPE:                 // also for Linux
+  case -ECONNRESET: // for Linux
+  case -EPIPE:      // also for Linux
     return 1;
   case -EMFILE:
   case -ENOMEM:
@@ -389,7 +387,7 @@ check_transient_accept_error(int res)
 // Disable a UnixNetVConnection
 //
 static inline void
-read_disable(NetHandler * nh, UnixNetVConnection * vc)
+read_disable(NetHandler *nh, UnixNetVConnection *vc)
 {
 #ifdef INACTIVITY_TIMEOUT
   if (vc->inactivity_timeout) {
@@ -410,7 +408,7 @@ read_disable(NetHandler * nh, UnixNetVConnection * vc)
 }
 
 static inline void
-write_disable(NetHandler * nh, UnixNetVConnection * vc)
+write_disable(NetHandler *nh, UnixNetVConnection *vc)
 {
 #ifdef INACTIVITY_TIMEOUT
   if (vc->inactivity_timeout) {
@@ -430,34 +428,53 @@ write_disable(NetHandler * nh, UnixNetVConnection * vc)
   vc->ep.modify(-EVENTIO_WRITE);
 }
 
-TS_INLINE int EventIO::start(EventLoop l, DNSConnection *vc, int events) {
+TS_INLINE int
+EventIO::start(EventLoop l, DNSConnection *vc, int events)
+{
   type = EVENTIO_DNS_CONNECTION;
-  return start(l, vc->fd, (Continuation*)vc, events);
+  return start(l, vc->fd, (Continuation *)vc, events);
 }
-TS_INLINE int EventIO::start(EventLoop l, NetAccept *vc, int events) {
+TS_INLINE int
+EventIO::start(EventLoop l, NetAccept *vc, int events)
+{
   type = EVENTIO_NETACCEPT;
-  return start(l, vc->server.fd, (Continuation*)vc, events);
+  return start(l, vc->server.fd, (Continuation *)vc, events);
 }
-TS_INLINE int EventIO::start(EventLoop l, UnixNetVConnection *vc, int events) {
+TS_INLINE int
+EventIO::start(EventLoop l, UnixNetVConnection *vc, int events)
+{
   type = EVENTIO_READWRITE_VC;
-  return start(l, vc->con.fd, (Continuation*)vc, events);
+  return start(l, vc->con.fd, (Continuation *)vc, events);
 }
-TS_INLINE int EventIO::start(EventLoop l, UnixUDPConnection *vc, int events) {
+TS_INLINE int
+EventIO::start(EventLoop l, UnixUDPConnection *vc, int events)
+{
   type = EVENTIO_UDP_CONNECTION;
-  return start(l, vc->fd, (Continuation*)vc, events);
+  return start(l, vc->fd, (Continuation *)vc, events);
 }
-TS_INLINE int EventIO::close() {
+TS_INLINE int
+EventIO::close()
+{
   stop();
   switch (type) {
-    default: ink_assert(!"case");
-    case EVENTIO_DNS_CONNECTION: return data.dnscon->close(); break;
-    case EVENTIO_NETACCEPT: return data.na->server.close(); break;
-    case EVENTIO_READWRITE_VC: return data.vc->con.close(); break;
+  default:
+    ink_assert(!"case");
+  case EVENTIO_DNS_CONNECTION:
+    return data.dnscon->close();
+    break;
+  case EVENTIO_NETACCEPT:
+    return data.na->server.close();
+    break;
+  case EVENTIO_READWRITE_VC:
+    return data.vc->con.close();
+    break;
   }
   return -1;
 }
 
-TS_INLINE int EventIO::start(EventLoop l, int afd, Continuation *c, int e) {
+TS_INLINE int
+EventIO::start(EventLoop l, int afd, Continuation *c, int e)
+{
   data.c = c;
   fd = afd;
   event_loop = l;
@@ -476,20 +493,23 @@ TS_INLINE int EventIO::start(EventLoop l, int afd, Continuation *c, int e) {
   struct kevent ev[2];
   int n = 0;
   if (e & EVENTIO_READ)
-    EV_SET(&ev[n++], fd, EVFILT_READ, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
+    EV_SET(&ev[n++], fd, EVFILT_READ, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this);
   if (e & EVENTIO_WRITE)
-    EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
+    EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this);
   return kevent(l->kqueue_fd, &ev[0], n, NULL, 0, NULL);
 #endif
 #if TS_USE_PORT
   events = e;
   int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
-  Debug("iocore_eventio", "[EventIO::start] e(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, events, retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
+  Debug("iocore_eventio", "[EventIO::start] e(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, events, retval,
+        retval < 0 ? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
   return retval;
 #endif
 }
 
-TS_INLINE int EventIO::modify(int e) {
+TS_INLINE int
+EventIO::modify(int e)
+{
   ink_assert(event_loop);
 #if TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER)
   struct epoll_event ev;
@@ -522,9 +542,9 @@ TS_INLINE int EventIO::modify(int e) {
   } else {
     ee |= e;
     if (e & EVENTIO_READ)
-      EV_SET(&ev[n++], fd, EVFILT_READ, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
+      EV_SET(&ev[n++], fd, EVFILT_READ, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this);
     if (e & EVENTIO_WRITE)
-      EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
+      EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this);
   }
   events = ee;
   if (n)
@@ -555,7 +575,8 @@ TS_INLINE int EventIO::modify(int e) {
   if (n && ne && event_loop) {
     events = ne;
     int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
-    Debug("iocore_eventio", "[EventIO::modify] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events, retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
+    Debug("iocore_eventio", "[EventIO::modify] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events,
+          retval, retval < 0 ? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
     return retval;
   }
   return 0;
@@ -565,16 +586,18 @@ TS_INLINE int EventIO::modify(int e) {
 #endif
 }
 
-TS_INLINE int EventIO::refresh(int e) {
+TS_INLINE int
+EventIO::refresh(int e)
+{
   ink_assert(event_loop);
 #if TS_USE_KQUEUE && defined(USE_EDGE_TRIGGER)
   e = e & events;
   struct kevent ev[2];
   int n = 0;
   if (e & EVENTIO_READ)
-    EV_SET(&ev[n++], fd, EVFILT_READ, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
+    EV_SET(&ev[n++], fd, EVFILT_READ, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this);
   if (e & EVENTIO_WRITE)
-    EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
+    EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD | INK_EV_EDGE_TRIGGER, 0, 0, this);
   if (n)
     return kevent(event_loop->kqueue_fd, &ev[0], n, NULL, 0, NULL);
   else
@@ -592,8 +615,8 @@ TS_INLINE int EventIO::refresh(int e) {
     if (n && ne && event_loop) {
       events = ne;
       int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
-      Debug("iocore_eventio", "[EventIO::refresh] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)",
-            e, ne, events, retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
+      Debug("iocore_eventio", "[EventIO::refresh] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events,
+            retval, retval < 0 ? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
       return retval;
     }
   }
@@ -605,7 +628,9 @@ TS_INLINE int EventIO::refresh(int e) {
 }
 
 
-TS_INLINE int EventIO::stop() {
+TS_INLINE int
+EventIO::stop()
+{
   if (event_loop) {
     int retval = 0;
 #if TS_USE_EPOLL
@@ -616,7 +641,8 @@ TS_INLINE int EventIO::stop() {
 #endif
 #if TS_USE_PORT
     retval = port_dissociate(event_loop->port_fd, PORT_SOURCE_FD, fd);
-    Debug("iocore_eventio", "[EventIO::stop] %d[%s]=port_dissociate(%d,%d,%d)", retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd);
+    Debug("iocore_eventio", "[EventIO::stop] %d[%s]=port_dissociate(%d,%d,%d)", retval, retval < 0 ? strerror(errno) : "ok",
+          event_loop->port_fd, PORT_SOURCE_FD, fd);
 #endif
     event_loop = NULL;
     return retval;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixNetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetProcessor.h b/iocore/net/P_UnixNetProcessor.h
index 47994c1..d28bc76 100644
--- a/iocore/net/P_UnixNetProcessor.h
+++ b/iocore/net/P_UnixNetProcessor.h
@@ -33,33 +33,19 @@ class UnixNetVConnection;
 //  class UnixNetProcessor
 //
 //////////////////////////////////////////////////////////////////
-struct UnixNetProcessor:public NetProcessor
-{
+struct UnixNetProcessor : public NetProcessor {
 public:
-  virtual Action *accept_internal (
-    Continuation * cont,
-    int fd,
-    AcceptOptions const &opt
-  );
-
-  Action *connect_re_internal(
-    Continuation * cont,
-    sockaddr const* target,
-    NetVCOptions * options = NULL
-  );
-  Action *connect(
-    Continuation * cont,
-    UnixNetVConnection ** vc,
-    sockaddr const* target,
-    NetVCOptions * opt = NULL
-  );
+  virtual Action *accept_internal(Continuation *cont, int fd, AcceptOptions const &opt);
+
+  Action *connect_re_internal(Continuation *cont, sockaddr const *target, NetVCOptions *options = NULL);
+  Action *connect(Continuation *cont, UnixNetVConnection **vc, sockaddr const *target, NetVCOptions *opt = NULL);
 
   // Virtual function allows etype to be upgraded to ET_SSL for SSLNetProcessor.  Does
   // nothing for NetProcessor
-  virtual void upgradeEtype(EventType & /* etype ATS_UNUSED */) { };
+  virtual void upgradeEtype(EventType & /* etype ATS_UNUSED */){};
 
   virtual NetAccept *createNetAccept();
-  virtual NetVConnection * allocate_vc(EThread *t);
+  virtual NetVConnection *allocate_vc(EThread *t);
 
   virtual int start(int number_of_net_threads, size_t stacksize);
 
@@ -77,11 +63,8 @@ public:
 
 
 TS_INLINE Action *
-NetProcessor::connect_re(
-  Continuation * cont,
-  sockaddr const* addr,
-  NetVCOptions * opts
-) {
+NetProcessor::connect_re(Continuation *cont, sockaddr const *addr, NetVCOptions *opts)
+{
   return static_cast<UnixNetProcessor *>(this)->connect_re_internal(cont, addr, opts);
 }
 
@@ -92,7 +75,7 @@ extern UnixNetProcessor unix_netProcessor;
 // This function should be called for all threads created to
 // accept such events by the EventProcesor.
 //
-extern void initialize_thread_for_net(EThread * thread);
+extern void initialize_thread_for_net(EThread *thread);
 
 //#include "UnixNet.h"
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixNetState.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetState.h b/iocore/net/P_UnixNetState.h
index 5c1d443..efffe8f 100644
--- a/iocore/net/P_UnixNetState.h
+++ b/iocore/net/P_UnixNetState.h
@@ -37,7 +37,7 @@
 
 
  ****************************************************************************/
-#if !defined (_UnixNetState_h_)
+#if !defined(_UnixNetState_h_)
 #define _UnixNetState_h_
 
 #include "List.h"
@@ -46,8 +46,7 @@
 class Event;
 class UnixNetVConnection;
 
-struct NetState
-{
+struct NetState {
   volatile int enabled;
   VIO vio;
   Link<UnixNetVConnection> ready_link;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index eb16e02..c8ce1eb 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -70,8 +70,8 @@ NetVCOptions::reset()
 }
 
 TS_INLINE void
-NetVCOptions::set_sock_param(int _recv_bufsize, int _send_bufsize, unsigned long _opt_flags,
-                             unsigned long _packet_mark, unsigned long _packet_tos)
+NetVCOptions::set_sock_param(int _recv_bufsize, int _send_bufsize, unsigned long _opt_flags, unsigned long _packet_mark,
+                             unsigned long _packet_tos)
 {
   socket_recv_bufsize = _recv_bufsize;
   socket_send_bufsize = _send_bufsize;
@@ -80,8 +80,7 @@ NetVCOptions::set_sock_param(int _recv_bufsize, int _send_bufsize, unsigned long
   packet_tos = _packet_tos;
 }
 
-struct OOB_callback:public Continuation
-{
+struct OOB_callback : public Continuation {
   char *data;
   int length;
   Event *trigger;
@@ -89,19 +88,18 @@ struct OOB_callback:public Continuation
   Continuation *server_cont;
   int retry_OOB_send(int, Event *);
 
-    OOB_callback(ProxyMutex *m, NetVConnection *vc, Continuation *cont,
-                 char *buf, int len):Continuation(m), data(buf), length(len), trigger(0)
+  OOB_callback(ProxyMutex *m, NetVConnection *vc, Continuation *cont, char *buf, int len)
+    : Continuation(m), data(buf), length(len), trigger(0)
   {
-    server_vc = (UnixNetVConnection *) vc;
+    server_vc = (UnixNetVConnection *)vc;
     server_cont = cont;
     SET_HANDLER(&OOB_callback::retry_OOB_send);
   }
 };
 
-class UnixNetVConnection:public NetVConnection
+class UnixNetVConnection : public NetVConnection
 {
 public:
-
   virtual VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf);
   virtual VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner = false);
 
@@ -110,11 +108,27 @@ public:
   virtual Action *send_OOB(Continuation *cont, char *buf, int len);
   virtual void cancel_OOB();
 
-  virtual void setSSLHandshakeWantsRead(bool /* flag */) { return; }
-  virtual bool getSSLHandshakeWantsRead() { return false; }
-  virtual void setSSLHandshakeWantsWrite(bool /* flag */) { return; }
+  virtual void
+  setSSLHandshakeWantsRead(bool /* flag */)
+  {
+    return;
+  }
+  virtual bool
+  getSSLHandshakeWantsRead()
+  {
+    return false;
+  }
+  virtual void
+  setSSLHandshakeWantsWrite(bool /* flag */)
+  {
+    return;
+  }
 
-  virtual bool getSSLHandshakeWantsWrite() { return false; }
+  virtual bool
+  getSSLHandshakeWantsWrite()
+  {
+    return false;
+  }
 
   virtual void do_io_close(int lerrno = -1);
   virtual void do_io_shutdown(ShutdownHowTo_t howto);
@@ -144,7 +158,7 @@ public:
 
   virtual SOCKET get_socket();
 
-  virtual ~ UnixNetVConnection();
+  virtual ~UnixNetVConnection();
 
   /////////////////////////////////////////////////////////////////
   // instances of UnixNetVConnection should be allocated         //
@@ -155,10 +169,9 @@ public:
 
 private:
   UnixNetVConnection(const NetVConnection &);
-  UnixNetVConnection & operator =(const NetVConnection &);
+  UnixNetVConnection &operator=(const NetVConnection &);
 
 public:
-
   /////////////////////////
   // UNIX implementation //
   /////////////////////////
@@ -169,24 +182,31 @@ public:
   // these are not part of the pure virtual interface.  They were
   // added to reduce the amount of duplicate code in classes inherited
   // from NetVConnection (SSL).
-  virtual int sslStartHandShake(int event, int &err) {
-    (void) event;
-    (void) err;
+  virtual int
+  sslStartHandShake(int event, int &err)
+  {
+    (void)event;
+    (void)err;
     return EVENT_ERROR;
   }
-  virtual bool getSSLHandShakeComplete() {
+  virtual bool
+  getSSLHandShakeComplete()
+  {
     return (true);
   }
-  virtual bool getSSLClientConnection()
+  virtual bool
+  getSSLClientConnection()
   {
     return (false);
   }
-  virtual void setSSLClientConnection(bool state)
+  virtual void
+  setSSLClientConnection(bool state)
   {
-    (void) state;
+    (void)state;
   }
   virtual void net_read_io(NetHandler *nh, EThread *lthread);
-  virtual int64_t load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor & buf, int &needs);
+  virtual int64_t load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor &buf,
+                                        int &needs);
   void readDisable(NetHandler *nh);
   void readSignalError(NetHandler *nh, int err);
   int readSignalDone(int event, NetHandler *nh);
@@ -222,15 +242,13 @@ public:
   // amc - what is this for? Why not use remote_addr or con.addr?
   IpEndpoint server_addr; /// Server address and port.
 
-  union
-  {
+  union {
     unsigned int flags;
-#define NET_VC_SHUTDOWN_READ  1
+#define NET_VC_SHUTDOWN_READ 1
 #define NET_VC_SHUTDOWN_WRITE 2
-    struct
-    {
-      unsigned int got_local_addr:1;
-      unsigned int shutdown:2;
+    struct {
+      unsigned int got_local_addr : 1;
+      unsigned int shutdown : 2;
     } f;
   };
 
@@ -254,12 +272,12 @@ public:
   virtual int set_tcp_init_cwnd(int init_cwnd);
   virtual void apply_options();
 
-  friend void write_to_net_io(NetHandler*, UnixNetVConnection*, EThread*);
+  friend void write_to_net_io(NetHandler *, UnixNetVConnection *, EThread *);
 };
 
 extern ClassAllocator<UnixNetVConnection> netVCAllocator;
 
-typedef int (UnixNetVConnection::*NetVConnHandler) (int, void *);
+typedef int (UnixNetVConnection::*NetVConnHandler)(int, void *);
 
 
 TS_INLINE void
@@ -385,17 +403,20 @@ UnixNetVConnection::set_tcp_init_cwnd(int init_cwnd)
 #endif
 }
 
-TS_INLINE UnixNetVConnection::~UnixNetVConnection() { }
+TS_INLINE UnixNetVConnection::~UnixNetVConnection()
+{
+}
 
 TS_INLINE SOCKET
-UnixNetVConnection::get_socket() {
+UnixNetVConnection::get_socket()
+{
   return con.fd;
 }
 
 // declarations for local use (within the net module)
 
-void close_UnixNetVConnection(UnixNetVConnection * vc, EThread * t);
-void write_to_net(NetHandler * nh, UnixNetVConnection * vc, EThread * thread);
-void write_to_net_io(NetHandler * nh, UnixNetVConnection * vc, EThread * thread);
+void close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t);
+void write_to_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread);
+void write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread);
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixPollDescriptor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixPollDescriptor.h b/iocore/net/P_UnixPollDescriptor.h
index af3d9e7..88b8f38 100644
--- a/iocore/net/P_UnixPollDescriptor.h
+++ b/iocore/net/P_UnixPollDescriptor.h
@@ -34,23 +34,22 @@
 
 #if TS_USE_KQUEUE
 #include <sys/event.h>
-#define INK_EVP_IN    0x001
-#define INK_EVP_PRI   0x002
-#define INK_EVP_OUT   0x004
-#define INK_EVP_ERR   0x010
-#define INK_EVP_HUP   0x020
+#define INK_EVP_IN 0x001
+#define INK_EVP_PRI 0x002
+#define INK_EVP_OUT 0x004
+#define INK_EVP_ERR 0x010
+#define INK_EVP_HUP 0x020
 #endif
 
 #define POLL_DESCRIPTOR_SIZE 32768
 
 typedef struct pollfd Pollfd;
 
-struct PollDescriptor
-{
-  int result;                   // result of poll
+struct PollDescriptor {
+  int result; // result of poll
 #if TS_USE_EPOLL
   int epoll_fd;
-  int nfds;                     // actual number
+  int nfds; // actual number
   Pollfd pfd[POLL_DESCRIPTOR_SIZE];
   struct epoll_event ePoll_Triggered_Events[POLL_DESCRIPTOR_SIZE];
 #endif
@@ -63,26 +62,26 @@ struct PollDescriptor
 
 #if TS_USE_EPOLL
 #define get_ev_port(a) ((a)->epoll_fd)
-#define get_ev_events(a,x) ((a)->ePoll_Triggered_Events[(x)].events)
-#define get_ev_data(a,x) ((a)->ePoll_Triggered_Events[(x)].data.ptr)
-#define ev_next_event(a,x)
+#define get_ev_events(a, x) ((a)->ePoll_Triggered_Events[(x)].events)
+#define get_ev_data(a, x) ((a)->ePoll_Triggered_Events[(x)].data.ptr)
+#define ev_next_event(a, x)
 #endif
 
 #if TS_USE_KQUEUE
   struct kevent kq_Triggered_Events[POLL_DESCRIPTOR_SIZE];
-  /* we define these here as numbers, because for kqueue mapping them to a combination of
- * filters / flags is hard to do. */
+/* we define these here as numbers, because for kqueue mapping them to a combination of
+*filters / flags is hard to do. */
 #define get_ev_port(a) ((a)->kqueue_fd)
-#define get_ev_events(a,x) ((a)->kq_event_convert((a)->kq_Triggered_Events[(x)].filter, (a)->kq_Triggered_Events[(x)].flags))
-#define get_ev_data(a,x) ((a)->kq_Triggered_Events[(x)].udata)
-  int kq_event_convert(int16_t event, uint16_t flags)
+#define get_ev_events(a, x) ((a)->kq_event_convert((a)->kq_Triggered_Events[(x)].filter, (a)->kq_Triggered_Events[(x)].flags))
+#define get_ev_data(a, x) ((a)->kq_Triggered_Events[(x)].udata)
+  int
+  kq_event_convert(int16_t event, uint16_t flags)
   {
     int r = 0;
 
     if (event == EVFILT_READ) {
       r |= INK_EVP_IN;
-    }
-    else if (event == EVFILT_WRITE) {
+    } else if (event == EVFILT_WRITE) {
       r |= INK_EVP_OUT;
     }
 
@@ -91,19 +90,20 @@ struct PollDescriptor
     }
     return r;
   }
-#define ev_next_event(a,x)
+#define ev_next_event(a, x)
 #endif
 
 #if TS_USE_PORT
   port_event_t Port_Triggered_Events[POLL_DESCRIPTOR_SIZE];
 #define get_ev_port(a) ((a)->port_fd)
-#define get_ev_events(a,x) ((a)->Port_Triggered_Events[(x)].portev_events)
-#define get_ev_data(a,x) ((a)->Port_Triggered_Events[(x)].portev_user)
-#define get_ev_odata(a,x) ((a)->Port_Triggered_Events[(x)].portev_object)
-#define ev_next_event(a,x)
+#define get_ev_events(a, x) ((a)->Port_Triggered_Events[(x)].portev_events)
+#define get_ev_data(a, x) ((a)->Port_Triggered_Events[(x)].portev_user)
+#define get_ev_odata(a, x) ((a)->Port_Triggered_Events[(x)].portev_object)
+#define ev_next_event(a, x)
 #endif
 
-  Pollfd *alloc()
+  Pollfd *
+  alloc()
   {
 #if TS_USE_EPOLL
     // XXX : We need restrict max size based on definition.
@@ -115,7 +115,8 @@ struct PollDescriptor
     return 0;
 #endif
   }
-  PollDescriptor *init()
+  PollDescriptor *
+  init()
   {
     result = 0;
 #if TS_USE_EPOLL
@@ -134,9 +135,7 @@ struct PollDescriptor
 #endif
     return this;
   }
-  PollDescriptor() {
-    init();
-  }
+  PollDescriptor() { init(); }
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/P_UnixUDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixUDPConnection.h b/iocore/net/P_UnixUDPConnection.h
index 1ea5598..9f6a079 100644
--- a/iocore/net/P_UnixUDPConnection.h
+++ b/iocore/net/P_UnixUDPConnection.h
@@ -34,11 +34,11 @@
 #include "P_UDPConnection.h"
 #include "P_UDPPacket.h"
 
-class UnixUDPConnection:public UDPConnectionInternal
+class UnixUDPConnection : public UDPConnectionInternal
 {
 public:
   void init(int the_fd);
-  void setEthread(EThread * e);
+  void setEthread(EThread *e);
   void errorAndDie(int e);
   int callbackHandler(int event, void *data);
 
@@ -53,22 +53,19 @@ public:
   EventIO ep;
 
   UnixUDPConnection(int the_fd);
-  virtual ~ UnixUDPConnection();
+  virtual ~UnixUDPConnection();
+
 private:
   int m_errno;
-  virtual void UDPConnection_is_abstract() {};
+  virtual void UDPConnection_is_abstract(){};
 };
 
 TS_INLINE
-UnixUDPConnection::UnixUDPConnection(int the_fd)
-  : onCallbackQueue(0)
-  , callbackAction(NULL)
-  , ethread(NULL)
-  , m_errno(0)
+UnixUDPConnection::UnixUDPConnection(int the_fd) : onCallbackQueue(0), callbackAction(NULL), ethread(NULL), m_errno(0)
 {
   fd = the_fd;
   UDPPacketInternal p;
-  ink_atomiclist_init(&inQueue, "Incoming UDP Packet queue", (char *) &p.alink.next - (char *) &p);
+  ink_atomiclist_init(&inQueue, "Incoming UDP Packet queue", (char *)&p.alink.next - (char *)&p);
   SET_HANDLER(&UnixUDPConnection::callbackHandler);
 }
 
@@ -82,12 +79,12 @@ UnixUDPConnection::init(int the_fd)
   m_errno = 0;
 
   UDPPacketInternal p;
-  ink_atomiclist_init(&inQueue, "Incoming UDP Packet queue", (char *) &p.alink.next - (char *) &p);
+  ink_atomiclist_init(&inQueue, "Incoming UDP Packet queue", (char *)&p.alink.next - (char *)&p);
   SET_HANDLER(&UnixUDPConnection::callbackHandler);
 }
 
 TS_INLINE void
-UnixUDPConnection::setEthread(EThread * e)
+UnixUDPConnection::setEthread(EThread *e)
 {
   ethread = e;
 }
@@ -99,9 +96,9 @@ UnixUDPConnection::errorAndDie(int e)
 }
 
 TS_INLINE Action *
-UDPConnection::recv(Continuation * c)
+UDPConnection::recv(Continuation *c)
 {
-  UnixUDPConnection *p = (UnixUDPConnection *) this;
+  UnixUDPConnection *p = (UnixUDPConnection *)this;
   // register callback interest.
   p->continuation = c;
   ink_assert(c != NULL);


[15/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IntrusiveDList.h
----------------------------------------------------------------------
diff --git a/lib/ts/IntrusiveDList.h b/lib/ts/IntrusiveDList.h
index b79ab10..4f38feb 100644
--- a/lib/ts/IntrusiveDList.h
+++ b/lib/ts/IntrusiveDList.h
@@ -1,5 +1,5 @@
-# if ! defined(TS_INTRUSIVE_DOUBLE_LIST_HEADER)
-# define TS_INTRUSIVE_DOUBLE_LIST_HEADER
+#if !defined(TS_INTRUSIVE_DOUBLE_LIST_HEADER)
+#define TS_INTRUSIVE_DOUBLE_LIST_HEADER
 
 /** @file
 
@@ -43,7 +43,7 @@
  */
 
 /// FreeBSD doesn't like just declaring the tag struct we need so we have to include the file.
-# include <iterator>
+#include <iterator>
 
 /** Intrusive doubly linked list container.
 
@@ -94,53 +94,61 @@
     which seems very wrong to me.
 
   */
-template <
-  typename T, ///< Type of list element.
-  T* (T::*N), ///< Member to use for pointer to next element.
-  T* (T::*P)  ///< Member to use for pointer to previous element.
-> class IntrusiveDList {
+template <typename T, ///< Type of list element.
+          T *(T::*N), ///< Member to use for pointer to next element.
+          T *(T::*P)  ///< Member to use for pointer to previous element.
+          >
+class IntrusiveDList
+{
   friend class iterator;
+
 public:
   typedef IntrusiveDList self; ///< Self reference type.
-  typedef T element_type; ///< Type of list element.
-  /** STL style iterator for access to elements.
-   */
-  class iterator {
+  typedef T element_type;      ///< Type of list element.
+                               /** STL style iterator for access to elements.
+                                */
+  class iterator
+  {
     friend class IntrusiveDList;
+
   public:
-    typedef iterator self; ///< Self reference type.
-    typedef T value_type; ///< Referenced type for iterator.
+    typedef iterator self;       ///< Self reference type.
+    typedef T value_type;        ///< Referenced type for iterator.
     typedef int difference_type; ///< Distance type.
-    typedef T* pointer; ///< Pointer to referent.
-    typedef T& reference; ///< Reference to referent.
+    typedef T *pointer;          ///< Pointer to referent.
+    typedef T &reference;        ///< Reference to referent.
     typedef std::bidirectional_iterator_tag iterator_category;
 
     /// Default constructor.
     iterator() : _list(0), _elt(0) {}
     /// Equality test.
     /// @return @c true if @c this and @a that refer to the same object.
-    bool operator==(self const& that) const {
-      return _list == that._list && _elt == that._elt;
-    }
+    bool operator==(self const &that) const { return _list == that._list && _elt == that._elt; }
     /// Pre-increment.
     /// Move to the next element in the list.
     /// @return The iterator.
-    self& operator++() {
-      if (_elt) _elt = _elt->*N;
+    self &operator++()
+    {
+      if (_elt)
+        _elt = _elt->*N;
       return *this;
     }
     /// Pre-decrement.
     /// Move to the previous element in the list.
     /// @return The iterator.
-    self& operator--() {
-      if (_elt) _elt = _elt->*P;
-      else if (_list) _elt = _list->_tail;
+    self &operator--()
+    {
+      if (_elt)
+        _elt = _elt->*P;
+      else if (_list)
+        _elt = _list->_tail;
       return *this;
     }
     /// Post-increment.
     /// Move to the next element in the list.
     /// @return The iterator value before the increment.
-    self operator++(int) {
+    self operator++(int)
+    {
       self tmp(*this);
       ++*this;
       return tmp;
@@ -148,71 +156,88 @@ public:
     /// Post-decrement.
     /// Move to the previous element in the list.
     /// @return The iterator value before the decrement.
-    self operator--(int) {
+    self operator--(int)
+    {
       self tmp(*this);
       ++*this;
       return tmp;
     }
     /// Inequality test.
     /// @return @c true if @c this and @a do not refer to the same object.
-    bool operator!=(self const& that) const { return !(*this == that); }
+    bool operator!=(self const &that) const { return !(*this == that); }
     /// Dereference.
     /// @return A reference to the referent.
     reference operator*() { return *_elt; }
     /// Dereference.
     /// @return A pointer to the referent.
     pointer operator->() { return _elt; }
+
   protected:
-    IntrusiveDList* _list; ///< List for this iterator.
-    T* _elt; ///< Referenced element.
+    IntrusiveDList *_list; ///< List for this iterator.
+    T *_elt;               ///< Referenced element.
     /// Internal constructor for containers.
-    iterator(
-      IntrusiveDList* container, ///< Container for iteration.
-      T* elt ///< Initial referent
-    ) : _list(container), _elt(elt) {
+    iterator(IntrusiveDList *container, ///< Container for iteration.
+             T *elt                     ///< Initial referent
+             )
+      : _list(container), _elt(elt)
+    {
     }
   };
 
   /// Default constructor (empty list).
-  IntrusiveDList() : _head(0), _tail(0), _count(0) { }
+  IntrusiveDList() : _head(0), _tail(0), _count(0) {}
   /// Empty check.
   /// @return @c true if the list is empty.
-  bool isEmpty() const { return 0 == _head; }
+  bool
+  isEmpty() const
+  {
+    return 0 == _head;
+  }
   /// Add @a elt as the first element in the list.
   /// @return This container.
-  self& prepend(
-    T* elt ///< Element to add.
-  ) {
+  self &
+  prepend(T *elt ///< Element to add.
+          )
+  {
     elt->*N = _head;
     elt->*P = 0;
-    if (_head) _head->*P = elt;
+    if (_head)
+      _head->*P = elt;
     _head = elt;
-    if (! _tail) _tail = _head; // empty to non-empty transition
+    if (!_tail)
+      _tail = _head; // empty to non-empty transition
     ++_count;
     return *this;
   }
   /// Add @elt as the last element in the list.
   /// @return This container.
-  self& append(
-    T* elt ///< Element to add.
-  ) {
+  self &
+  append(T *elt ///< Element to add.
+         )
+  {
     elt->*N = 0;
     elt->*P = _tail;
-    if (_tail) _tail->*N = elt;
+    if (_tail)
+      _tail->*N = elt;
     _tail = elt;
-    if (! _head) _head = _tail; // empty to non-empty transition
+    if (!_head)
+      _head = _tail; // empty to non-empty transition
     ++_count;
     return *this;
   }
   /// Remove the first element of the list.
   /// @return A poiner to the removed item, or @c NULL if the list was empty.
-  T* takeHead() {
-    T* zret = 0;
+  T *
+  takeHead()
+  {
+    T *zret = 0;
     if (_head) {
       zret = _head;
       _head = _head->*N;
-      if (_head) _head->*P = 0;
-      else _tail = 0; // non-empty to empty transition.
+      if (_head)
+        _head->*P = 0;
+      else
+        _tail = 0;  // non-empty to empty transition.
       zret->*N = 0; // erase traces of list.
       zret->*P = 0;
       --_count;
@@ -221,13 +246,17 @@ public:
   }
   /// Remove the last element of the list.
   /// @return A poiner to the removed item, or @c NULL if the list was empty.
-  T* takeTail() {
-    T* zret = 0;
+  T *
+  takeTail()
+  {
+    T *zret = 0;
     if (_tail) {
       zret = _tail;
       _tail = _tail->*P = 0;
-      if (_tail) _tail->*N = 0;
-      else _head = 0; // non-empty to empty transition.
+      if (_tail)
+        _tail->*N = 0;
+      else
+        _head = 0;  // non-empty to empty transition.
       zret->*N = 0; // erase traces of list.
       zret->*P = 0;
       --_count;
@@ -238,16 +267,19 @@ public:
   /// The caller is responsible for ensuring @a target is in this list
   /// and @a elt is not in a list.
   /// @return This list.
-  self& insertAfter(
-    T* target, ///< Target element in list.
-    T* elt ///< Element to insert.
-  ) {
+  self &
+  insertAfter(T *target, ///< Target element in list.
+              T *elt     ///< Element to insert.
+              )
+  {
     // Should assert that !(elt->*N || elt->*P)
     elt->*N = target->*N;
     elt->*P = target;
     target->*N = elt;
-    if (elt->*N) elt->*N->*P = elt;
-    if (target == _tail) _tail = elt;
+    if (elt->*N)
+      elt->*N->*P = elt;
+    if (target == _tail)
+      _tail = elt;
     ++_count;
     return *this;
   }
@@ -255,28 +287,36 @@ public:
   /// The caller is responsible for ensuring @a target is in this list
   /// and @a elt is not in a list.
   /// @return This list.
-  self& insertBefore(
-    T* target, ///< Target element in list.
-    T* elt ///< Element to insert.
-  ) {
+  self &
+  insertBefore(T *target, ///< Target element in list.
+               T *elt     ///< Element to insert.
+               )
+  {
     // Should assert that !(elt->*N || elt->*P)
     elt->*P = target->*P;
     elt->*N = target;
     target->*P = elt;
-    if (elt->*P) elt->*P->*N = elt;
-    if (target == _head) _head = elt;
+    if (elt->*P)
+      elt->*P->*N = elt;
+    if (target == _head)
+      _head = elt;
     ++_count;
     return *this;
   }
   /// Take @a elt out of this list.
   /// @return This list.
-  self& take(
-    T* elt ///< Element to remove.
-  ) {
-    if (elt->*P) elt->*P->*N = elt->*N;
-    if (elt->*N) elt->*N->*P = elt->*P;
-    if (elt == _head) _head = elt->*N;
-    if (elt == _tail) _tail = elt->*P;
+  self &
+  take(T *elt ///< Element to remove.
+       )
+  {
+    if (elt->*P)
+      elt->*P->*N = elt->*N;
+    if (elt->*N)
+      elt->*N->*P = elt->*P;
+    if (elt == _head)
+      _head = elt->*N;
+    if (elt == _tail)
+      _tail = elt->*P;
     elt->*P = elt->*N = 0;
     --_count;
     return *this;
@@ -284,23 +324,49 @@ public:
   /// Remove all elements.
   /// @note @b No memory management is done!
   /// @return This container.
-  self& clear() { _head = _tail = 0; _count = 0; return *this; }
+  self &
+  clear()
+  {
+    _head = _tail = 0;
+    _count = 0;
+    return *this;
+  }
   /// @return Number of elements in the list.
-  size_t getCount() const { return _count; }
+  size_t
+  getCount() const
+  {
+    return _count;
+  }
 
   /// Get an iterator to the first element.
-  iterator begin() { return iterator(this, _head); }
+  iterator
+  begin()
+  {
+    return iterator(this, _head);
+  }
   /// Get an iterator to past the last element.
-  iterator end() { return iterator(this, 0); }
+  iterator
+  end()
+  {
+    return iterator(this, 0);
+  }
   /// Get the first element.
-  T* getHead() { return _head; }
+  T *
+  getHead()
+  {
+    return _head;
+  }
   /// Get the last element.
-  T* getTail() { return _tail; }
+  T *
+  getTail()
+  {
+    return _tail;
+  }
+
 protected:
-  T* _head; ///< First element in list.
-  T* _tail; ///< Last element in list.
+  T *_head;      ///< First element in list.
+  T *_tail;      ///< Last element in list.
   size_t _count; ///< # of elements in list.
 };
 
-# endif // TS_INTRUSIVE_DOUBLE_LIST_HEADER
-
+#endif // TS_INTRUSIVE_DOUBLE_LIST_HEADER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IntrusivePtrTest.cc
----------------------------------------------------------------------
diff --git a/lib/ts/IntrusivePtrTest.cc b/lib/ts/IntrusivePtrTest.cc
index d58db69..212e8d0 100644
--- a/lib/ts/IntrusivePtrTest.cc
+++ b/lib/ts/IntrusivePtrTest.cc
@@ -21,32 +21,39 @@
     limitations under the License.
 */
 
-# include <ts/IntrusivePtr.h>
-# include <ts/IntrusiveDList.h>
-# include <ts/TestBox.h>
+#include <ts/IntrusivePtr.h>
+#include <ts/IntrusiveDList.h>
+#include <ts/TestBox.h>
 
-namespace { // Hide our local defintions
+namespace
+{ // Hide our local defintions
 
 // Test class for pointers and lists.
-class A : public IntrusivePtrCounter {
+class A : public IntrusivePtrCounter
+{
 public:
   A() : _data(0) {}
-  static A*& nextPtr(A* a) { return a->_next; }
-  static A*& prevPtr(A* a) { return a->_prev; }
+  static A *&
+  nextPtr(A *a)
+  {
+    return a->_next;
+  }
+  static A *&
+  prevPtr(A *a)
+  {
+    return a->_prev;
+  }
   int _data;
-  A* _next;
-  A* _prev;
+  A *_next;
+  A *_prev;
 };
 
 // Definitions to test compilation.
-typedef IntrusivePtrQueue<
-  A,
-  IntrusivePtrLinkFunction<A, &A::nextPtr, &A::prevPtr>
-> AList;
-
+typedef IntrusivePtrQueue<A, IntrusivePtrLinkFunction<A, &A::nextPtr, &A::prevPtr> > AList;
 }
 
-REGRESSION_TEST(IntrusivePtr_Test_Basic)(RegressionTest* t, int atype, int* pstatus) {
+REGRESSION_TEST(IntrusivePtr_Test_Basic)(RegressionTest *t, int atype, int *pstatus)
+{
   IntrusivePtr<A> ptr1;
   IntrusivePtr<A> ptr2(new A);
 
@@ -66,10 +73,8 @@ REGRESSION_TEST(IntrusivePtr_Test_Basic)(RegressionTest* t, int atype, int* psta
   tb.check(ptr2->useCount() == 1, "Bad use count: expected 1 got %d", ptr2->useCount());
   alist1.prepend(ptr2);
   tb.check(ptr2->useCount() == 2, "Bad use count: expected 2 got %d", ptr2->useCount());
-  for ( AList::iterator spot = alist1.begin(), limit = alist1.end()
-          ; spot != limit
-          ; ++spot
-  ) {
-    if (spot->_data) break;
+  for (AList::iterator spot = alist1.begin(), limit = alist1.end(); spot != limit; ++spot) {
+    if (spot->_data)
+      break;
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IpMap.cc
----------------------------------------------------------------------
diff --git a/lib/ts/IpMap.cc b/lib/ts/IpMap.cc
index ce44118..67cba39 100644
--- a/lib/ts/IpMap.cc
+++ b/lib/ts/IpMap.cc
@@ -1,4 +1,4 @@
-# include "IpMap.h"
+#include "IpMap.h"
 
 /** @file
     IP address map support.
@@ -45,568 +45,610 @@
     before we had IpAddr as a type.
 */
 
-namespace ts { namespace detail {
+namespace ts
+{
+namespace detail
+{
+  // Helper functions
 
-// Helper functions
-
-inline int cmp(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) {
-  return memcmp(lhs.sin6_addr.s6_addr, rhs.sin6_addr.s6_addr, TS_IP6_SIZE);
-}
-
-/// Less than.
-inline bool operator<(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) {
-  return ts::detail::cmp(lhs, rhs) < 0;
-}
-inline bool operator<(sockaddr_in6 const* lhs, sockaddr_in6 const& rhs) {
-  return ts::detail::cmp(*lhs, rhs) < 0;
-}
-/// Less than.
-inline bool operator<(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) {
-  return ts::detail::cmp(lhs, *rhs) < 0;
-}
-/// Equality.
-inline bool operator==(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) {
-  return ts::detail::cmp(lhs, *rhs) == 0;
-}
-/// Equality.
-inline bool operator==(sockaddr_in6 const* lhs, sockaddr_in6 const& rhs) {
-  return ts::detail::cmp(*lhs, rhs) == 0;
-}
-/// Equality.
-inline bool operator==(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) {
-  return ts::detail::cmp(lhs, rhs) == 0;
-}
-/// Less than or equal.
-inline bool operator<=(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) {
-  return ts::detail::cmp(lhs, *rhs) <= 0;
-}
-/// Less than or equal.
-inline bool operator<=(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) {
-  return ts::detail::cmp(lhs, rhs) <= 0;
-}
-/// Greater than or equal.
-inline bool operator>=(sockaddr_in6 const& lhs, sockaddr_in6 const& rhs) {
-  return ts::detail::cmp(lhs, rhs) >= 0;
-}
-/// Greater than or equal.
-inline bool operator>=(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) {
-  return ts::detail::cmp(lhs, *rhs) >= 0;
-}
-/// Greater than.
-inline bool operator>(sockaddr_in6 const& lhs, sockaddr_in6 const* rhs) {
-  return ts::detail::cmp(lhs, *rhs) > 0;
-}
-
-/** Base template class for IP maps.
-    This class is templated by the @a N type which must be a subclass
-    of @c RBNode. This class carries information about the addresses stored
-    in the map. This includes the type, the common argument type, and
-    some utility methods to operate on the address.
-*/
-template <
-  typename N ///< Node type.
-> struct IpMapBase {
-  friend class ::IpMap;
-
-  typedef IpMapBase self; ///< Self reference type.
-  typedef typename N::ArgType ArgType; ///< Import type.
-  typedef typename N::Metric Metric;   ///< Import type.g482
-
-  IpMapBase() : _root(0) {}
-  ~IpMapBase() { this->clear(); }
-
-  /** Mark a range.
-      All addresses in the range [ @a min , @a max ] are marked with @a data.
-      @return This object.
-  */
-  self& mark(
-    ArgType min, ///< Minimum value in range.
-    ArgType max, ///< Maximum value in range.
-    void* data = 0     ///< Client data payload.
-  );
-  /** Unmark addresses.
-
-      All addresses in the range [ @a min , @a max ] are cleared
-      (removed from the map), no longer marked.
-
-      @return This object.
-  */
-  self& unmark(
-    ArgType min,
-    ArgType max
-  );
-
-  /** Fill addresses.
-
-      This background fills using the range. All addresses in the
-      range that are @b not present in the map are added. No
-      previously present address is changed.
-
-      @note This is useful for filling in first match tables.
-
-      @return This object.
-  */
-  self& fill(
-    ArgType min,
-    ArgType max,
-    void* data = 0
-  );
-
-  /** Test for membership.
-
-      @return @c true if the address is in the map, @c false if not.
-      If the address is in the map and @a ptr is not @c NULL, @c *ptr
-      is set to the client data for the address.
-  */
-  bool contains(
-    ArgType target, ///< Search target value.
-    void **ptr = 0 ///< Client data return.
-  ) const;
-
-  /** Remove all addresses in the map.
-
-      @note This is much faster than using @c unmark with a range of
-      all addresses.
-
-      @return This object.
-  */
-  self& clear();
-
-  /** Lower bound for @a target.  @return The node whose minimum value
-      is the largest that is not greater than @a target, or @c NULL if
-      all minimum values are larger than @a target.
-  */
-  N* lowerBound(ArgType target);
+  inline int
+  cmp(sockaddr_in6 const &lhs, sockaddr_in6 const &rhs)
+  {
+    return memcmp(lhs.sin6_addr.s6_addr, rhs.sin6_addr.s6_addr, TS_IP6_SIZE);
+  }
 
-  /** Insert @a n after @a spot.
-      Caller is responsible for ensuring that @a spot is in this container
-      and the proper location for @a n.
-  */
-  void insertAfter(
-    N* spot, ///< Node in list.
-    N* n ///< Node to insert.
-  );
-  /** Insert @a n before @a spot.
-      Caller is responsible for ensuring that @a spot is in this container
-      and the proper location for @a n.
-  */
-  void insertBefore(
-    N* spot, ///< Node in list.
-    N* n ///< Node to insert.
-  );
-  /// Add node @a n as the first node.
-  void prepend(
-    N* n
-  );
-  /// Add node @a n as the last node.
-  void append(
-    N* n
-  );
-  /// Remove a node.
-  void remove(
-    N* n ///< Node to remove.
-  );
-
-  /** Validate internal data structures.
-      @note Intended for debugging, not general client use.
+  /// Less than.
+  inline bool operator<(sockaddr_in6 const &lhs, sockaddr_in6 const &rhs) { return ts::detail::cmp(lhs, rhs) < 0; }
+  inline bool operator<(sockaddr_in6 const *lhs, sockaddr_in6 const &rhs) { return ts::detail::cmp(*lhs, rhs) < 0; }
+  /// Less than.
+  inline bool operator<(sockaddr_in6 const &lhs, sockaddr_in6 const *rhs) { return ts::detail::cmp(lhs, *rhs) < 0; }
+  /// Equality.
+  inline bool operator==(sockaddr_in6 const &lhs, sockaddr_in6 const *rhs) { return ts::detail::cmp(lhs, *rhs) == 0; }
+  /// Equality.
+  inline bool operator==(sockaddr_in6 const *lhs, sockaddr_in6 const &rhs) { return ts::detail::cmp(*lhs, rhs) == 0; }
+  /// Equality.
+  inline bool operator==(sockaddr_in6 const &lhs, sockaddr_in6 const &rhs) { return ts::detail::cmp(lhs, rhs) == 0; }
+  /// Less than or equal.
+  inline bool operator<=(sockaddr_in6 const &lhs, sockaddr_in6 const *rhs) { return ts::detail::cmp(lhs, *rhs) <= 0; }
+  /// Less than or equal.
+  inline bool operator<=(sockaddr_in6 const &lhs, sockaddr_in6 const &rhs) { return ts::detail::cmp(lhs, rhs) <= 0; }
+  /// Greater than or equal.
+  inline bool operator>=(sockaddr_in6 const &lhs, sockaddr_in6 const &rhs) { return ts::detail::cmp(lhs, rhs) >= 0; }
+  /// Greater than or equal.
+  inline bool operator>=(sockaddr_in6 const &lhs, sockaddr_in6 const *rhs) { return ts::detail::cmp(lhs, *rhs) >= 0; }
+  /// Greater than.
+  inline bool operator>(sockaddr_in6 const &lhs, sockaddr_in6 const *rhs) { return ts::detail::cmp(lhs, *rhs) > 0; }
+
+  /** Base template class for IP maps.
+      This class is templated by the @a N type which must be a subclass
+      of @c RBNode. This class carries information about the addresses stored
+      in the map. This includes the type, the common argument type, and
+      some utility methods to operate on the address.
   */
-  void validate();
-
-  /// @return The number of distinct ranges.
-  size_t getCount() const;
-
-  /// Print all spans.
-  /// @return This map.
-  self& print();
-
-  // Helper methods.
-  N* prev(RBNode* n) const { return static_cast<N*>(n->_prev); }
-  N* next(RBNode* n) const { return static_cast<N*>(n->_next); }
-  N* parent(RBNode* n) const { return static_cast<N*>(n->_parent); }
-  N* left(RBNode* n) const { return static_cast<N*>(n->_left); }
-  N* right(RBNode* n) const { return static_cast<N*>(n->_right); }
-  N* getHead() { return static_cast<N*>(_list.getHead()); }
-  N* getTail() { return static_cast<N*>(_list.getTail()); }
-
-  N* _root; ///< Root node.
-  /// In order list of nodes.
-  /// For ugly compiler reasons, this is a list of base class pointers
-  /// even though we really store @a N instances on it.
-  typedef IntrusiveDList<RBNode, &RBNode::_next, &RBNode::_prev> NodeList;
-  /// This keeps track of all allocated nodes in order.
-  /// Iteration depends on this list being maintained.
-  NodeList _list;
-};
-
-template < typename N > N*
-IpMapBase<N>::lowerBound(ArgType target) {
-  N* n = _root; // current node to test.
-  N* zret = 0; // best node so far.
-  while (n) {
-    if (target < n->_min) n = left(n);
-    else {
-      zret = n; // this is a better candidate.
-      if (n->_max < target) n = right(n);
-      else break;
+  template <typename N ///< Node type.
+            >
+  struct IpMapBase {
+    friend class ::IpMap;
+
+    typedef IpMapBase self;              ///< Self reference type.
+    typedef typename N::ArgType ArgType; ///< Import type.
+    typedef typename N::Metric Metric;   ///< Import type.g482
+
+    IpMapBase() : _root(0) {}
+    ~IpMapBase() { this->clear(); }
+
+    /** Mark a range.
+        All addresses in the range [ @a min , @a max ] are marked with @a data.
+        @return This object.
+    */
+    self &mark(ArgType min,   ///< Minimum value in range.
+               ArgType max,   ///< Maximum value in range.
+               void *data = 0 ///< Client data payload.
+               );
+    /** Unmark addresses.
+
+        All addresses in the range [ @a min , @a max ] are cleared
+        (removed from the map), no longer marked.
+
+        @return This object.
+    */
+    self &unmark(ArgType min, ArgType max);
+
+    /** Fill addresses.
+
+        This background fills using the range. All addresses in the
+        range that are @b not present in the map are added. No
+        previously present address is changed.
+
+        @note This is useful for filling in first match tables.
+
+        @return This object.
+    */
+    self &fill(ArgType min, ArgType max, void *data = 0);
+
+    /** Test for membership.
+
+        @return @c true if the address is in the map, @c false if not.
+        If the address is in the map and @a ptr is not @c NULL, @c *ptr
+        is set to the client data for the address.
+    */
+    bool contains(ArgType target, ///< Search target value.
+                  void **ptr = 0  ///< Client data return.
+                  ) const;
+
+    /** Remove all addresses in the map.
+
+        @note This is much faster than using @c unmark with a range of
+        all addresses.
+
+        @return This object.
+    */
+    self &clear();
+
+    /** Lower bound for @a target.  @return The node whose minimum value
+        is the largest that is not greater than @a target, or @c NULL if
+        all minimum values are larger than @a target.
+    */
+    N *lowerBound(ArgType target);
+
+    /** Insert @a n after @a spot.
+        Caller is responsible for ensuring that @a spot is in this container
+        and the proper location for @a n.
+    */
+    void insertAfter(N *spot, ///< Node in list.
+                     N *n     ///< Node to insert.
+                     );
+    /** Insert @a n before @a spot.
+        Caller is responsible for ensuring that @a spot is in this container
+        and the proper location for @a n.
+    */
+    void insertBefore(N *spot, ///< Node in list.
+                      N *n     ///< Node to insert.
+                      );
+    /// Add node @a n as the first node.
+    void prepend(N *n);
+    /// Add node @a n as the last node.
+    void append(N *n);
+    /// Remove a node.
+    void remove(N *n ///< Node to remove.
+                );
+
+    /** Validate internal data structures.
+        @note Intended for debugging, not general client use.
+    */
+    void validate();
+
+    /// @return The number of distinct ranges.
+    size_t getCount() const;
+
+    /// Print all spans.
+    /// @return This map.
+    self &print();
+
+    // Helper methods.
+    N *
+    prev(RBNode *n) const
+    {
+      return static_cast<N *>(n->_prev);
+    }
+    N *
+    next(RBNode *n) const
+    {
+      return static_cast<N *>(n->_next);
+    }
+    N *
+    parent(RBNode *n) const
+    {
+      return static_cast<N *>(n->_parent);
+    }
+    N *
+    left(RBNode *n) const
+    {
+      return static_cast<N *>(n->_left);
+    }
+    N *
+    right(RBNode *n) const
+    {
+      return static_cast<N *>(n->_right);
+    }
+    N *
+    getHead()
+    {
+      return static_cast<N *>(_list.getHead());
+    }
+    N *
+    getTail()
+    {
+      return static_cast<N *>(_list.getTail());
     }
-  }
-  return zret;
-}
 
-template < typename N > IpMapBase<N>&
-IpMapBase<N>::clear() {
-  // Delete everything.
-  N* n = static_cast<N*>(_list.getHead());
-  while (n) {
-    N* x = n;
-    n = next(n);
-    delete x;
+    N *_root; ///< Root node.
+    /// In order list of nodes.
+    /// For ugly compiler reasons, this is a list of base class pointers
+    /// even though we really store @a N instances on it.
+    typedef IntrusiveDList<RBNode, &RBNode::_next, &RBNode::_prev> NodeList;
+    /// This keeps track of all allocated nodes in order.
+    /// Iteration depends on this list being maintained.
+    NodeList _list;
+  };
+
+  template <typename N>
+  N *
+  IpMapBase<N>::lowerBound(ArgType target)
+  {
+    N *n = _root; // current node to test.
+    N *zret = 0;  // best node so far.
+    while (n) {
+      if (target < n->_min)
+        n = left(n);
+      else {
+        zret = n; // this is a better candidate.
+        if (n->_max < target)
+          n = right(n);
+        else
+          break;
+      }
+    }
+    return zret;
   }
-  _list.clear();
-  _root = 0;
-  return *this;
-}
 
-template < typename N > IpMapBase<N>&
-IpMapBase<N>::fill(ArgType rmin, ArgType rmax, void* payload) {
-  // Rightmost node of interest with n->_min <= min.
-  N* n = this->lowerBound(rmin);
-  N* x = 0; // New node (if any).
-  // Need copies because we will modify these.
-  Metric min = N::deref(rmin);
-  Metric max = N::deref(rmax);
-
-  // Handle cases involving a node of interest to the left of the
-  // range.
-  if (n) {
-    if (n->_min < min) {
-      Metric min_1 = min;
-      N::dec(min_1);  // dec is OK because min isn't zero.
-      if (n->_max < min_1) { // no overlap or adj.
-        n = next(n);
-      } else if (n->_max >= max) { // incoming range is covered, just discard.
-        return *this;
-      } else if (n->_data != payload) { // different payload, clip range on left.
-        min = n->_max;
-        N::inc(min);
-        n = next(n);
-      } else { // skew overlap with same payload, use node and continue.
-        x = n;
-        n = next(n);
-      }
+  template <typename N>
+  IpMapBase<N> &
+  IpMapBase<N>::clear()
+  {
+    // Delete everything.
+    N *n = static_cast<N *>(_list.getHead());
+    while (n) {
+      N *x = n;
+      n = next(n);
+      delete x;
     }
-  } else {
-    n = this->getHead();
+    _list.clear();
+    _root = 0;
+    return *this;
   }
 
-  // Work through the rest of the nodes of interest.
-  // Invariant: n->_min >= min
-
-  // Careful here -- because max_plus1 might wrap we need to use it only
-  // if we can certain it didn't. This is done by ordering the range
-  // tests so that when max_plus1 is used when we know there exists a
-  // larger value than max.
-  Metric max_plus1 = max;
-  N::inc(max_plus1);
-  /* Notes:
-     - max (and thence max_plus1) never change during the loop.
-     - we must have either x != 0 or adjust min but not both.
-  */
-  while (n) {
-    if (n->_data == payload) {
-      if (x) {
-        if (n->_max <= max) {
-          // next range is covered, so we can remove and continue.
-          this->remove(n);
-          n = next(x);
-        } else if (n->_min <= max_plus1) {
-          // Overlap or adjacent with larger max - absorb and finish.
-          x->setMax(n->_max);
-          this->remove(n);
-          return *this;
-        } else {
-          // have the space to finish off the range.
-          x->setMax(max);
+  template <typename N>
+  IpMapBase<N> &
+  IpMapBase<N>::fill(ArgType rmin, ArgType rmax, void *payload)
+  {
+    // Rightmost node of interest with n->_min <= min.
+    N *n = this->lowerBound(rmin);
+    N *x = 0; // New node (if any).
+    // Need copies because we will modify these.
+    Metric min = N::deref(rmin);
+    Metric max = N::deref(rmax);
+
+    // Handle cases involving a node of interest to the left of the
+    // range.
+    if (n) {
+      if (n->_min < min) {
+        Metric min_1 = min;
+        N::dec(min_1);         // dec is OK because min isn't zero.
+        if (n->_max < min_1) { // no overlap or adj.
+          n = next(n);
+        } else if (n->_max >= max) { // incoming range is covered, just discard.
           return *this;
-        }
-      } else { // not carrying a span.
-        if (n->_max <= max) { // next range is covered - use it.
+        } else if (n->_data != payload) { // different payload, clip range on left.
+          min = n->_max;
+          N::inc(min);
+          n = next(n);
+        } else { // skew overlap with same payload, use node and continue.
           x = n;
-          x->setMin(min);
           n = next(n);
-        } else if (n->_min <= max_plus1) {
-          n->setMin(min);
-          return *this;
-        } else { // no overlap, space to complete range.
-          this->insertBefore(n, new N(min, max, payload));
-          return *this;
         }
       }
-    } else { // different payload
-      if (x) {
-        if (max < n->_min) { // range ends before n starts, done.
-          x->setMax(max);
-          return *this;
-        } else if (max <= n->_max) { // range ends before n, done.
-          x->setMaxMinusOne(n->_min);
-          return *this;
-        } else { // n is contained in range, skip over it.
-          x->setMaxMinusOne(n->_min);
-          x = 0;
-          min = n->_max;
-          N::inc(min); // OK because n->_max maximal => next is null.
-          n = next(n);
+    } else {
+      n = this->getHead();
+    }
+
+    // Work through the rest of the nodes of interest.
+    // Invariant: n->_min >= min
+
+    // Careful here -- because max_plus1 might wrap we need to use it only
+    // if we can certain it didn't. This is done by ordering the range
+    // tests so that when max_plus1 is used when we know there exists a
+    // larger value than max.
+    Metric max_plus1 = max;
+    N::inc(max_plus1);
+    /* Notes:
+       - max (and thence max_plus1) never change during the loop.
+       - we must have either x != 0 or adjust min but not both.
+    */
+    while (n) {
+      if (n->_data == payload) {
+        if (x) {
+          if (n->_max <= max) {
+            // next range is covered, so we can remove and continue.
+            this->remove(n);
+            n = next(x);
+          } else if (n->_min <= max_plus1) {
+            // Overlap or adjacent with larger max - absorb and finish.
+            x->setMax(n->_max);
+            this->remove(n);
+            return *this;
+          } else {
+            // have the space to finish off the range.
+            x->setMax(max);
+            return *this;
+          }
+        } else {                // not carrying a span.
+          if (n->_max <= max) { // next range is covered - use it.
+            x = n;
+            x->setMin(min);
+            n = next(n);
+          } else if (n->_min <= max_plus1) {
+            n->setMin(min);
+            return *this;
+          } else { // no overlap, space to complete range.
+            this->insertBefore(n, new N(min, max, payload));
+            return *this;
+          }
         }
-      } else { // no carry node.
-        if (max < n->_min) { // entirely before next span.
-          this->insertBefore(n, new N(min, max, payload));
-          return *this;
-        } else {
-          if (min < n->_min) { // leading section, need node.
-            N* y = new N(min, n->_min, payload);
-            y->decrementMax();
-            this->insertBefore(n, y);
+      } else { // different payload
+        if (x) {
+          if (max < n->_min) { // range ends before n starts, done.
+            x->setMax(max);
+            return *this;
+          } else if (max <= n->_max) { // range ends before n, done.
+            x->setMaxMinusOne(n->_min);
+            return *this;
+          } else { // n is contained in range, skip over it.
+            x->setMaxMinusOne(n->_min);
+            x = 0;
+            min = n->_max;
+            N::inc(min); // OK because n->_max maximal => next is null.
+            n = next(n);
           }
-          if (max <= n->_max) // nothing past node
+        } else {               // no carry node.
+          if (max < n->_min) { // entirely before next span.
+            this->insertBefore(n, new N(min, max, payload));
             return *this;
-          min = n->_max;
-          N::inc(min);
-          n = next(n);
+          } else {
+            if (min < n->_min) { // leading section, need node.
+              N *y = new N(min, n->_min, payload);
+              y->decrementMax();
+              this->insertBefore(n, y);
+            }
+            if (max <= n->_max) // nothing past node
+              return *this;
+            min = n->_max;
+            N::inc(min);
+            n = next(n);
+          }
         }
       }
     }
+    // Invariant: min is larger than any existing range maximum.
+    if (x) {
+      x->setMax(max);
+    } else {
+      this->append(new N(min, max, payload));
+    }
+    return *this;
   }
-  // Invariant: min is larger than any existing range maximum.
-  if (x) {
-    x->setMax(max);
-  } else {
-    this->append(new N(min, max, payload));
-  }
-  return *this;
-}
-
-template < typename N > IpMapBase<N>&
-IpMapBase<N>::mark(ArgType min, ArgType max, void* payload) {
-  N* n = this->lowerBound(min); // current node.
-  N* x = 0; // New node, gets set if we re-use an existing one.
-  N* y = 0; // Temporary for removing and advancing.
-
-  // Several places it is handy to have max+1. Must be careful
-  // about wrapping.
-  Metric max_plus = N::deref(max);
-  N::inc(max_plus);
-
-  /* Some subtlety - for IPv6 we overload the compare operators to do
-     the right thing, but we can't overload pointer
-     comparisons. Therefore we carefully never compare pointers in
-     this logic. Only @a min and @a max can be pointers, everything
-     else is an instance or a reference. Since there's no good reason
-     to compare @a min and @a max this isn't particularly tricky, but
-     it's good to keep in mind. If we were somewhat more clever, we
-     would provide static less than and equal operators in the
-     template class @a N and convert all the comparisons to use only
-     those two via static function call.
-  */
 
-  /*  We have lots of special cases here primarily to minimize memory
-      allocation by re-using an existing node as often as possible.
-  */
-  if (n) {
-    // Watch for wrap.
-    Metric min_1 = N::deref(min);
-    N::dec(min_1);
-    if (n->_min == min) {
-      // Could be another span further left which is adjacent.
-      // Coalesce if the data is the same. min_1 is OK because
-      // if there is a previous range, min is not zero.
-      N* p = prev(n);
-      if (p && p->_data == payload && p->_max == min_1) {
-        x = p;
-        n = x; // need to back up n because frame of reference moved.
+  template <typename N>
+  IpMapBase<N> &
+  IpMapBase<N>::mark(ArgType min, ArgType max, void *payload)
+  {
+    N *n = this->lowerBound(min); // current node.
+    N *x = 0;                     // New node, gets set if we re-use an existing one.
+    N *y = 0;                     // Temporary for removing and advancing.
+
+    // Several places it is handy to have max+1. Must be careful
+    // about wrapping.
+    Metric max_plus = N::deref(max);
+    N::inc(max_plus);
+
+    /* Some subtlety - for IPv6 we overload the compare operators to do
+       the right thing, but we can't overload pointer
+       comparisons. Therefore we carefully never compare pointers in
+       this logic. Only @a min and @a max can be pointers, everything
+       else is an instance or a reference. Since there's no good reason
+       to compare @a min and @a max this isn't particularly tricky, but
+       it's good to keep in mind. If we were somewhat more clever, we
+       would provide static less than and equal operators in the
+       template class @a N and convert all the comparisons to use only
+       those two via static function call.
+    */
+
+    /*  We have lots of special cases here primarily to minimize memory
+        allocation by re-using an existing node as often as possible.
+    */
+    if (n) {
+      // Watch for wrap.
+      Metric min_1 = N::deref(min);
+      N::dec(min_1);
+      if (n->_min == min) {
+        // Could be another span further left which is adjacent.
+        // Coalesce if the data is the same. min_1 is OK because
+        // if there is a previous range, min is not zero.
+        N *p = prev(n);
+        if (p && p->_data == payload && p->_max == min_1) {
+          x = p;
+          n = x; // need to back up n because frame of reference moved.
+          x->setMax(max);
+        } else if (n->_max <= max) {
+          // Span will be subsumed by request span so it's available for use.
+          x = n;
+          x->setMax(max).setData(payload);
+        } else if (n->_data == payload) {
+          return *this; // request is covered by existing span with the same data
+        } else {
+          // request span is covered by existing span.
+          x = new N(min, max, payload); //
+          n->setMin(max_plus);          // clip existing.
+          this->insertBefore(n, x);
+          return *this;
+        }
+      } else if (n->_data == payload && n->_max >= min_1) {
+        // min_1 is safe here because n->_min < min so min is not zero.
+        x = n;
+        // If the existing span covers the requested span, we're done.
+        if (x->_max >= max)
+          return *this;
         x->setMax(max);
       } else if (n->_max <= max) {
-        // Span will be subsumed by request span so it's available for use.
-        x = n;
-        x->setMax(max).setData(payload);
-      } else if (n->_data == payload) {
-        return *this; // request is covered by existing span with the same data
+        // Can only have left skew overlap, otherwise disjoint.
+        // Clip if overlap.
+        if (n->_max >= min)
+          n->setMax(min_1);
+        else if (next(n) && n->_max <= max) {
+          // request region covers next span so we can re-use that node.
+          x = next(n);
+          x->setMin(min).setMax(max).setData(payload);
+          n = x; // this gets bumped again, which is correct.
+        }
       } else {
-        // request span is covered by existing span.
-        x = new N(min, max, payload); //
-        n->setMin(max_plus); // clip existing.
-        this->insertBefore(n, x);
-        return *this;
+        // Existing span covers new span but with a different payload.
+        // We split it, put the new span in between and we're done.
+        // max_plus is valid because n->_max > max.
+        N *r;
+        x = new N(min, max, payload);
+        r = new N(max_plus, n->_max, n->_data);
+        n->setMax(min_1);
+        this->insertAfter(n, x);
+        this->insertAfter(x, r);
+        return *this; // done.
       }
-    } else if (n->_data == payload && n->_max >= min_1) {
-      // min_1 is safe here because n->_min < min so min is not zero.
-      x = n;
-      // If the existing span covers the requested span, we're done.
-      if (x->_max >= max) return *this;
-      x->setMax(max);
-    } else if (n->_max <= max) {
-      // Can only have left skew overlap, otherwise disjoint.
-      // Clip if overlap.
-      if (n->_max >= min) n->setMax(min_1);
-      else if (next(n) && n->_max <= max) {
-        // request region covers next span so we can re-use that node.
-        x = next(n);
-        x->setMin(min).setMax(max).setData(payload);
-        n = x; // this gets bumped again, which is correct.
+      n = next(n); // lower bound span handled, move on.
+      if (!x) {
+        x = new N(min, max, payload);
+        if (n)
+          this->insertBefore(n, x);
+        else
+          this->append(x); // note that since n == 0 we'll just return.
       }
+    } else if (0 != (n = this->getHead()) &&           // at least one node in tree.
+               n->_data == payload &&                  // payload matches
+               (n->_max <= max || n->_min <= max_plus) // overlap or adj.
+               ) {
+      // Same payload with overlap, re-use.
+      x = n;
+      n = next(n);
+      x->setMin(min);
+      if (x->_max < max)
+        x->setMax(max);
     } else {
-      // Existing span covers new span but with a different payload.
-      // We split it, put the new span in between and we're done.
-      // max_plus is valid because n->_max > max.
-      N* r;
       x = new N(min, max, payload);
-      r = new N(max_plus, n->_max, n->_data);
-      n->setMax(min_1);
-      this->insertAfter(n, x);
-      this->insertAfter(x, r);
-      return *this; // done.
+      this->prepend(x);
     }
-    n = next(n); // lower bound span handled, move on.
-    if (!x) {
-      x = new N(min, max, payload);
-      if (n) this->insertBefore(n, x);
-      else this->append(x); // note that since n == 0 we'll just return.
+
+    // At this point, @a x has the node for this span and all existing spans of
+    // interest start at or past this span.
+    while (n) {
+      if (n->_max <= max) { // completely covered, drop span, continue
+        y = n;
+        n = next(n);
+        this->remove(y);
+      } else if (max_plus < n->_min) { // no overlap, done.
+        break;
+      } else if (n->_data == payload) { // skew overlap or adj., same payload
+        x->setMax(n->_max);
+        y = n;
+        n = next(n);
+        this->remove(y);
+      } else if (n->_min <= max) { // skew overlap different payload
+        n->setMin(max_plus);
+        break;
+      }
     }
-  } else if (0 != (n = this->getHead()) && // at least one node in tree.
-             n->_data == payload && // payload matches
-             (n->_max <= max || n->_min <= max_plus) // overlap or adj.
-  ) {
-    // Same payload with overlap, re-use.
-    x = n;
-    n = next(n);
-    x->setMin(min);
-    if (x->_max < max) x->setMax(max);
-  } else {
-    x = new N(min, max, payload);
-    this->prepend(x);
+
+    return *this;
   }
 
-  // At this point, @a x has the node for this span and all existing spans of
-  // interest start at or past this span.
-  while (n) {
-    if (n->_max <= max) { // completely covered, drop span, continue
-      y = n;
-      n = next(n);
-      this->remove(y);
-    } else if (max_plus < n->_min) { // no overlap, done.
-      break;
-    } else if (n->_data == payload) { // skew overlap or adj., same payload
-      x->setMax(n->_max);
-      y = n;
+  template <typename N>
+  IpMapBase<N> &
+  IpMapBase<N>::unmark(ArgType min, ArgType max)
+  {
+    N *n = this->lowerBound(min);
+    N *x; // temp for deletes.
+
+    // Need to handle special case where first span starts to the left.
+    if (n && n->_min < min) {
+      if (n->_max >= min) { // some overlap
+        if (n->_max > max) {
+          // request span is covered by existing span - split existing span.
+          x = new N(max, N::argue(n->_max), n->_data);
+          x->incrementMin();
+          n->setMaxMinusOne(N::deref(min));
+          this->insertAfter(n, x);
+          return *this; // done.
+        } else {
+          n->setMaxMinusOne(N::deref(min)); // just clip overlap.
+        }
+      } // else disjoint so just skip it.
       n = next(n);
-      this->remove(y);
-    } else if (n->_min <= max) { // skew overlap different payload
-      n->setMin(max_plus);
-      break;
     }
-  }
-
-  return *this;
-}
-
-template <typename N> IpMapBase<N>&
-IpMapBase<N>::unmark(ArgType min, ArgType max) {
-  N* n = this->lowerBound(min);
-  N* x; // temp for deletes.
-
-  // Need to handle special case where first span starts to the left.
-  if (n && n->_min < min) {
-    if (n->_max >= min) { // some overlap
-      if (n->_max > max) {
-        // request span is covered by existing span - split existing span.
-        x = new N(max, N::argue(n->_max), n->_data);
-        x->incrementMin();
-        n->setMaxMinusOne(N::deref(min));
-        this->insertAfter(n, x);
-        return *this; // done.
+    // n and all subsequent spans start at >= min.
+    while (n) {
+      x = n;
+      n = next(n);
+      if (x->_max <= max) {
+        this->remove(x);
       } else {
-        n->setMaxMinusOne(N::deref(min)); // just clip overlap.
-      }
-    } // else disjoint so just skip it.
-    n = next(n);
-  }
-  // n and all subsequent spans start at >= min.
-  while (n) {
-    x = n;
-    n = next(n);
-    if (x->_max <= max) {
-      this->remove(x);
-    } else {
-      if (x->_min <= max) { // clip overlap
-        x->setMinPlusOne(N::deref(max));
+        if (x->_min <= max) { // clip overlap
+          x->setMinPlusOne(N::deref(max));
+        }
+        break;
       }
-      break;
     }
+    return *this;
   }
-  return *this;
-}
-
-template <typename N> void
-IpMapBase<N>::insertAfter(N* spot, N* n) {
-  N* c = right(spot);
-  if (!c) spot->setChild(n, N::RIGHT);
-  else spot->_next->setChild(n, N::LEFT);
 
-  _list.insertAfter(spot, n);
-  _root = static_cast<N*>(n->rebalanceAfterInsert());
-}
-
-template <typename N> void
-IpMapBase<N>::insertBefore(N* spot, N* n) {
-  N* c = left(spot);
-  if (!c) spot->setChild(n, N::LEFT);
-  else spot->_prev->setChild(n, N::RIGHT);
+  template <typename N>
+  void
+  IpMapBase<N>::insertAfter(N *spot, N *n)
+  {
+    N *c = right(spot);
+    if (!c)
+      spot->setChild(n, N::RIGHT);
+    else
+      spot->_next->setChild(n, N::LEFT);
+
+    _list.insertAfter(spot, n);
+    _root = static_cast<N *>(n->rebalanceAfterInsert());
+  }
 
-  _list.insertBefore(spot, n);
-  _root = static_cast<N*>(n->rebalanceAfterInsert());
-}
+  template <typename N>
+  void
+  IpMapBase<N>::insertBefore(N *spot, N *n)
+  {
+    N *c = left(spot);
+    if (!c)
+      spot->setChild(n, N::LEFT);
+    else
+      spot->_prev->setChild(n, N::RIGHT);
+
+    _list.insertBefore(spot, n);
+    _root = static_cast<N *>(n->rebalanceAfterInsert());
+  }
 
-template <typename N> void
-IpMapBase<N>::prepend(N* n) {
-  if (!_root) _root = n;
-  else _root = static_cast<N*>(_list.getHead()->setChild(n, N::LEFT)->rebalanceAfterInsert());
-  _list.prepend(n);
-}
+  template <typename N>
+  void
+  IpMapBase<N>::prepend(N *n)
+  {
+    if (!_root)
+      _root = n;
+    else
+      _root = static_cast<N *>(_list.getHead()->setChild(n, N::LEFT)->rebalanceAfterInsert());
+    _list.prepend(n);
+  }
 
-template <typename N> void
-IpMapBase<N>::append(N* n) {
-  if (!_root) _root = n;
-  else _root = static_cast<N*>(_list.getTail()->setChild(n, N::RIGHT)->rebalanceAfterInsert());
-  _list.append(n);
-}
+  template <typename N>
+  void
+  IpMapBase<N>::append(N *n)
+  {
+    if (!_root)
+      _root = n;
+    else
+      _root = static_cast<N *>(_list.getTail()->setChild(n, N::RIGHT)->rebalanceAfterInsert());
+    _list.append(n);
+  }
 
-template <typename N> void
-IpMapBase<N>::remove(N* n) {
-  _root = static_cast<N*>(n->remove());
-  _list.take(n);
-  delete n;
-}
+  template <typename N>
+  void
+  IpMapBase<N>::remove(N *n)
+  {
+    _root = static_cast<N *>(n->remove());
+    _list.take(n);
+    delete n;
+  }
 
-template <typename N> bool
-IpMapBase<N>::contains(ArgType x, void** ptr) const {
-  bool zret = false;
-  N* n = _root; // current node to test.
-  while (n) {
-    if (x < n->_min) n = left(n);
-    else if (n->_max < x) n = right(n);
-    else {
-      if (ptr) *ptr = n->_data;
-      zret = true;
-      break;
+  template <typename N>
+  bool
+  IpMapBase<N>::contains(ArgType x, void **ptr) const
+  {
+    bool zret = false;
+    N *n = _root; // current node to test.
+    while (n) {
+      if (x < n->_min)
+        n = left(n);
+      else if (n->_max < x)
+        n = right(n);
+      else {
+        if (ptr)
+          *ptr = n->_data;
+        zret = true;
+        break;
+      }
     }
+    return zret;
   }
-  return zret;
-}
 
-template < typename N > size_t IpMapBase<N>::getCount() const { return _list.getCount(); }
-//----------------------------------------------------------------------------
-template <typename N> void
-IpMapBase<N>::validate() {
-# if 0
+  template <typename N>
+  size_t
+  IpMapBase<N>::getCount() const
+  {
+    return _list.getCount();
+  }
+  //----------------------------------------------------------------------------
+  template <typename N>
+  void
+  IpMapBase<N>::validate()
+  {
+#if 0
   if (_root) _root->validate();
   for ( Node* n = _list.getHead() ; n ; n = n->_next ) {
     Node* x;
@@ -619,327 +661,382 @@ IpMapBase<N>::validate() {
         std::cout << "Looped node" << std::endl;
     }
   }
-# endif
-}
+#endif
+  }
 
-template <typename N> IpMapBase<N>&
-IpMapBase<N>::print() {
-# if 0
+  template <typename N>
+  IpMapBase<N> &
+  IpMapBase<N>::print()
+  {
+#if 0
   for ( Node* n = _list.getHead() ; n ; n = n->_next ) {
     std::cout
       << n << ": " << n->_min << '-' << n->_max << " [" << n->_data << "] "
       << (n->_color == Node::BLACK ? "Black " : "Red   ") << "P=" << n->_parent << " L=" << n->_left << " R=" << n->_right
       << std::endl;
   }
-# endif
-  return *this;
-}
-
-//----------------------------------------------------------------------------
-typedef Interval<in_addr_t, in_addr_t> Ip4Span;
-
-/** Node for IPv4 map.
-    We store the address in host order in the @a _min and @a _max
-    members for performance. We store copies in the @a _sa member
-    for API compliance (which requires @c sockaddr* access).
-*/
-class Ip4Node : public IpMap::Node, protected Ip4Span {
-  friend struct IpMapBase<Ip4Node>;
-public:
-  typedef Ip4Node self; ///< Self reference type.
-
-  /// Construct with values.
-  Ip4Node(
-    ArgType min, ///< Minimum address (host order).
-    ArgType max, ///< Maximum address (host order).
-    void* data ///< Client data.
-  ) : Node(data), Ip4Span(min, max) {
-    ats_ip4_set(ats_ip_sa_cast(&_sa._min), htonl(min));
-    ats_ip4_set(ats_ip_sa_cast(&_sa._max), htonl(max));
-  }
-  /// @return The minimum value of the interval.
-  virtual sockaddr const* min() const {
-    return ats_ip_sa_cast(&_sa._min);
-  }
-  /// @return The maximum value of the interval.
-  virtual sockaddr const* max() const {
-    return ats_ip_sa_cast(&_sa._max);
-  }
-  /// Set the client data.
-  self& setData(
-    void* data ///< Client data.
-  ) {
-    _data = data;
-    return *this;
-  }
-protected:
-
-  /// Set the minimum value of the interval.
-  /// @return This interval.
-  self& setMin(
-    ArgType min ///< Minimum value (host order).
-  ) {
-    _min = min;
-    _sa._min.sin_addr.s_addr = htonl(min);
+#endif
     return *this;
   }
 
-  /// Set the maximum value of the interval.
-  /// @return This interval.
-  self& setMax(
-    ArgType max ///< Maximum value (host order).
-  ) {
-    _max = max;
-    _sa._max.sin_addr.s_addr = htonl(max);
-    return *this;
-  }
+  //----------------------------------------------------------------------------
+  typedef Interval<in_addr_t, in_addr_t> Ip4Span;
 
-  /** Set the maximum value to one less than @a max.
-      @return This object.
-  */
-  self& setMaxMinusOne(
-    ArgType max ///< One more than maximum value.
-  ) {
-    return this->setMax(max-1);
-  }
-  /** Set the minimum value to one more than @a min.
-      @return This object.
-  */
-  self& setMinPlusOne(
-    ArgType min ///< One less than minimum value.
-  ) {
-    return this->setMin(min+1);
-  }
-  /** Decremement the maximum value in place.
-      @return This object.
+  /** Node for IPv4 map.
+      We store the address in host order in the @a _min and @a _max
+      members for performance. We store copies in the @a _sa member
+      for API compliance (which requires @c sockaddr* access).
   */
-  self& decrementMax() {
-    this->setMax(_max-1);
-    return *this;
-  }
-  /** Increment the minimum value in place.
-      @return This object.
-  */
-  self& incrementMin() {
-    this->setMin(_min+1);
-    return *this;
-  }
+  class Ip4Node : public IpMap::Node, protected Ip4Span
+  {
+    friend struct IpMapBase<Ip4Node>;
+
+  public:
+    typedef Ip4Node self; ///< Self reference type.
+
+    /// Construct with values.
+    Ip4Node(ArgType min, ///< Minimum address (host order).
+            ArgType max, ///< Maximum address (host order).
+            void *data   ///< Client data.
+            )
+      : Node(data), Ip4Span(min, max)
+    {
+      ats_ip4_set(ats_ip_sa_cast(&_sa._min), htonl(min));
+      ats_ip4_set(ats_ip_sa_cast(&_sa._max), htonl(max));
+    }
+    /// @return The minimum value of the interval.
+    virtual sockaddr const *
+    min() const
+    {
+      return ats_ip_sa_cast(&_sa._min);
+    }
+    /// @return The maximum value of the interval.
+    virtual sockaddr const *
+    max() const
+    {
+      return ats_ip_sa_cast(&_sa._max);
+    }
+    /// Set the client data.
+    self &
+    setData(void *data ///< Client data.
+            )
+    {
+      _data = data;
+      return *this;
+    }
 
-  /// Increment a metric.
-  static void inc(
-    Metric& m ///< Incremented in place.
-  ) {
-    ++m;
-  }
+  protected:
+    /// Set the minimum value of the interval.
+    /// @return This interval.
+    self &
+    setMin(ArgType min ///< Minimum value (host order).
+           )
+    {
+      _min = min;
+      _sa._min.sin_addr.s_addr = htonl(min);
+      return *this;
+    }
 
-  /// Decrement a metric.
-  static void dec(
-    Metric& m ///< Decremented in place.
-  ) {
-    --m;
-  }
+    /// Set the maximum value of the interval.
+    /// @return This interval.
+    self &
+    setMax(ArgType max ///< Maximum value (host order).
+           )
+    {
+      _max = max;
+      _sa._max.sin_addr.s_addr = htonl(max);
+      return *this;
+    }
 
-  /// @return Dereferenced @a addr.
-  static Metric deref(
-    ArgType addr ///< Argument to dereference.
-  ) {
-    return addr;
-  }
+    /** Set the maximum value to one less than @a max.
+        @return This object.
+    */
+    self &
+    setMaxMinusOne(ArgType max ///< One more than maximum value.
+                   )
+    {
+      return this->setMax(max - 1);
+    }
+    /** Set the minimum value to one more than @a min.
+        @return This object.
+    */
+    self &
+    setMinPlusOne(ArgType min ///< One less than minimum value.
+                  )
+    {
+      return this->setMin(min + 1);
+    }
+    /** Decremement the maximum value in place.
+        @return This object.
+    */
+    self &
+    decrementMax()
+    {
+      this->setMax(_max - 1);
+      return *this;
+    }
+    /** Increment the minimum value in place.
+        @return This object.
+    */
+    self &
+    incrementMin()
+    {
+      this->setMin(_min + 1);
+      return *this;
+    }
 
-  /// @return The argument type for the @a metric.
-  static ArgType argue(
-    Metric const& metric
-  ) {
-    return metric;
-  }
+    /// Increment a metric.
+    static void
+    inc(Metric &m ///< Incremented in place.
+        )
+    {
+      ++m;
+    }
 
-  struct {
-    sockaddr_in _min;
-    sockaddr_in _max;
-  } _sa; ///< Addresses in API compliant form.
+    /// Decrement a metric.
+    static void
+    dec(Metric &m ///< Decremented in place.
+        )
+    {
+      --m;
+    }
 
-};
+    /// @return Dereferenced @a addr.
+    static Metric
+    deref(ArgType addr ///< Argument to dereference.
+          )
+    {
+      return addr;
+    }
 
-class Ip4Map : public IpMapBase<Ip4Node> {
-  friend class ::IpMap;
-};
+    /// @return The argument type for the @a metric.
+    static ArgType
+    argue(Metric const &metric)
+    {
+      return metric;
+    }
 
-//----------------------------------------------------------------------------
-typedef Interval<sockaddr_in6> Ip6Span;
+    struct {
+      sockaddr_in _min;
+      sockaddr_in _max;
+    } _sa; ///< Addresses in API compliant form.
+  };
 
-/** Node for IPv6 map.
-*/
-class Ip6Node : public IpMap::Node, protected Ip6Span {
-  friend struct IpMapBase<Ip6Node>;
-public:
-  typedef Ip6Node self; ///< Self reference type.
-  /// Override @c ArgType from @c Interval because the convention
-  /// is to use a pointer, not a reference.
-  typedef Metric const* ArgType;
-
-  /// Construct from pointers.
-  Ip6Node(
-    ArgType min, ///< Minimum address (network order).
-    ArgType max, ///< Maximum address (network order).
-    void* data ///< Client data.
-  ) : Node(data), Ip6Span(*min, *max) {
-  }
-  /// Construct with values.
-  Ip6Node(
-    Metric const& min, ///< Minimum address (network order).
-    Metric const& max, ///< Maximum address (network order).
-    void* data ///< Client data.
-  ) : Node(data), Ip6Span(min, max) {
-  }
-  /// @return The minimum value of the interval.
-  virtual sockaddr const* min() const {
-    return ats_ip_sa_cast(&_min);
-  }
-  /// @return The maximum value of the interval.
-  virtual sockaddr const* max() const {
-    return ats_ip_sa_cast(&_max);
-  }
-  /// Set the client data.
-  self& setData(
-    void* data ///< Client data.
-  ) {
-    _data = data;
-    return *this;
-  }
-protected:
-
-  /// Set the minimum value of the interval.
-  /// @return This interval.
-  self& setMin(
-    ArgType min ///< Minimum value (host order).
-  ) {
-    ats_ip_copy(ats_ip_sa_cast(&_min), ats_ip_sa_cast(min));
-    return *this;
-  }
+  class Ip4Map : public IpMapBase<Ip4Node>
+  {
+    friend class ::IpMap;
+  };
 
-  /// Set the minimum value of the interval.
-  /// @note Convenience overload.
-  /// @return This interval.
-  self& setMin(
-    Metric const& min ///< Minimum value (host order).
-  ) {
-    return this->setMin(&min);
-  }
+  //----------------------------------------------------------------------------
+  typedef Interval<sockaddr_in6> Ip6Span;
 
-  /// Set the maximum value of the interval.
-  /// @return This interval.
-  self& setMax(
-    ArgType max ///< Maximum value (host order).
-  ) {
-    ats_ip_copy(ats_ip_sa_cast(&_max), ats_ip_sa_cast(max));
-    return *this;
-  }
-  /// Set the maximum value of the interval.
-  /// @note Convenience overload.
-  /// @return This interval.
-  self& setMax(
-    Metric const& max ///< Maximum value (host order).
-  ) {
-    return this->setMax(&max);
-  }
-  /** Set the maximum value to one less than @a max.
-      @return This object.
-  */
-  self& setMaxMinusOne(
-    Metric const& max ///< One more than maximum value.
-  ) {
-    this->setMax(max);
-    dec(_max);
-    return *this;
-  }
-  /** Set the minimum value to one more than @a min.
-      @return This object.
-  */
-  self& setMinPlusOne(
-    Metric const& min ///< One less than minimum value.
-  ) {
-    this->setMin(min);
-    inc(_min);
-    return *this;
-  }
-  /** Decremement the maximum value in place.
-      @return This object.
-  */
-  self& decrementMax() { dec(_max); return *this; }
-  /** Increment the mininimum value in place.
-      @return This object.
+  /** Node for IPv6 map.
   */
-  self& incrementMin() { inc(_min); return *this; }
-
-  /// Increment a metric.
-  static void inc(
-    Metric& m ///< Incremented in place.
-  ) {
-    uint8_t* addr = m.sin6_addr.s6_addr;
-    uint8_t* b = addr + TS_IP6_SIZE;
-    // Ripple carry. Walk up the address incrementing until we don't
-    // have a carry.
-    do {
-      ++*--b;
-    } while (b > addr && 0 == *b);
-  }
+  class Ip6Node : public IpMap::Node, protected Ip6Span
+  {
+    friend struct IpMapBase<Ip6Node>;
+
+  public:
+    typedef Ip6Node self; ///< Self reference type.
+    /// Override @c ArgType from @c Interval because the convention
+    /// is to use a pointer, not a reference.
+    typedef Metric const *ArgType;
+
+    /// Construct from pointers.
+    Ip6Node(ArgType min, ///< Minimum address (network order).
+            ArgType max, ///< Maximum address (network order).
+            void *data   ///< Client data.
+            )
+      : Node(data), Ip6Span(*min, *max)
+    {
+    }
+    /// Construct with values.
+    Ip6Node(Metric const &min, ///< Minimum address (network order).
+            Metric const &max, ///< Maximum address (network order).
+            void *data         ///< Client data.
+            )
+      : Node(data), Ip6Span(min, max)
+    {
+    }
+    /// @return The minimum value of the interval.
+    virtual sockaddr const *
+    min() const
+    {
+      return ats_ip_sa_cast(&_min);
+    }
+    /// @return The maximum value of the interval.
+    virtual sockaddr const *
+    max() const
+    {
+      return ats_ip_sa_cast(&_max);
+    }
+    /// Set the client data.
+    self &
+    setData(void *data ///< Client data.
+            )
+    {
+      _data = data;
+      return *this;
+    }
 
-  /// Decrement a metric.
-  static void dec(
-    Metric& m ///< Decremented in place.
-  ) {
-    uint8_t* addr = m.sin6_addr.s6_addr;
-    uint8_t* b = addr + TS_IP6_SIZE;
-    // Ripple borrow. Walk up the address decrementing until we don't
-    // have a borrow.
-    do {
-      --*--b;
-    } while (b > addr && static_cast<uint8_t>(0xFF) == *b);
-  }
-  /// @return Dereferenced @a addr.
-  static Metric const& deref(
-    ArgType addr ///< Argument to dereference.
-  ) {
-    return *addr;
-  }
+  protected:
+    /// Set the minimum value of the interval.
+    /// @return This interval.
+    self &
+    setMin(ArgType min ///< Minimum value (host order).
+           )
+    {
+      ats_ip_copy(ats_ip_sa_cast(&_min), ats_ip_sa_cast(min));
+      return *this;
+    }
 
-  /// @return The argument type for the @a metric.
-  static ArgType argue(
-    Metric const& metric
-  ) {
-    return &metric;
-  }
+    /// Set the minimum value of the interval.
+    /// @note Convenience overload.
+    /// @return This interval.
+    self &
+    setMin(Metric const &min ///< Minimum value (host order).
+           )
+    {
+      return this->setMin(&min);
+    }
 
-};
+    /// Set the maximum value of the interval.
+    /// @return This interval.
+    self &
+    setMax(ArgType max ///< Maximum value (host order).
+           )
+    {
+      ats_ip_copy(ats_ip_sa_cast(&_max), ats_ip_sa_cast(max));
+      return *this;
+    }
+    /// Set the maximum value of the interval.
+    /// @note Convenience overload.
+    /// @return This interval.
+    self &
+    setMax(Metric const &max ///< Maximum value (host order).
+           )
+    {
+      return this->setMax(&max);
+    }
+    /** Set the maximum value to one less than @a max.
+        @return This object.
+    */
+    self &
+    setMaxMinusOne(Metric const &max ///< One more than maximum value.
+                   )
+    {
+      this->setMax(max);
+      dec(_max);
+      return *this;
+    }
+    /** Set the minimum value to one more than @a min.
+        @return This object.
+    */
+    self &
+    setMinPlusOne(Metric const &min ///< One less than minimum value.
+                  )
+    {
+      this->setMin(min);
+      inc(_min);
+      return *this;
+    }
+    /** Decremement the maximum value in place.
+        @return This object.
+    */
+    self &
+    decrementMax()
+    {
+      dec(_max);
+      return *this;
+    }
+    /** Increment the mininimum value in place.
+        @return This object.
+    */
+    self &
+    incrementMin()
+    {
+      inc(_min);
+      return *this;
+    }
 
-// We declare this after the helper operators and inside this namespace
-// so that the template uses these for comparisons.
+    /// Increment a metric.
+    static void
+    inc(Metric &m ///< Incremented in place.
+        )
+    {
+      uint8_t *addr = m.sin6_addr.s6_addr;
+      uint8_t *b = addr + TS_IP6_SIZE;
+      // Ripple carry. Walk up the address incrementing until we don't
+      // have a carry.
+      do {
+        ++*--b;
+      } while (b > addr && 0 == *b);
+    }
 
-class Ip6Map : public IpMapBase<Ip6Node> {
-  friend class ::IpMap;
-};
+    /// Decrement a metric.
+    static void
+    dec(Metric &m ///< Decremented in place.
+        )
+    {
+      uint8_t *addr = m.sin6_addr.s6_addr;
+      uint8_t *b = addr + TS_IP6_SIZE;
+      // Ripple borrow. Walk up the address decrementing until we don't
+      // have a borrow.
+      do {
+        --*--b;
+      } while (b > addr && static_cast<uint8_t>(0xFF) == *b);
+    }
+    /// @return Dereferenced @a addr.
+    static Metric const &
+    deref(ArgType addr ///< Argument to dereference.
+          )
+    {
+      return *addr;
+    }
+
+    /// @return The argument type for the @a metric.
+    static ArgType
+    argue(Metric const &metric)
+    {
+      return &metric;
+    }
+  };
 
-}} // end ts::detail
+  // We declare this after the helper operators and inside this namespace
+  // so that the template uses these for comparisons.
+
+  class Ip6Map : public IpMapBase<Ip6Node>
+  {
+    friend class ::IpMap;
+  };
+}
+} // end ts::detail
 //----------------------------------------------------------------------------
-IpMap::~IpMap() {
+IpMap::~IpMap()
+{
   delete _m4;
   delete _m6;
 }
 
-inline ts::detail::Ip4Map*
-IpMap::force4() {
-  if (!_m4) _m4 = new ts::detail::Ip4Map;
+inline ts::detail::Ip4Map *
+IpMap::force4()
+{
+  if (!_m4)
+    _m4 = new ts::detail::Ip4Map;
   return _m4;
 }
 
-inline ts::detail::Ip6Map*
-IpMap::force6() {
-  if (!_m6) _m6 = new ts::detail::Ip6Map;
+inline ts::detail::Ip6Map *
+IpMap::force6()
+{
+  if (!_m6)
+    _m6 = new ts::detail::Ip6Map;
   return _m6;
 }
 
 bool
-IpMap::contains(sockaddr const* target, void** ptr) const {
+IpMap::contains(sockaddr const *target, void **ptr) const
+{
   bool zret = false;
   if (AF_INET == target->sa_family) {
     zret = _m4 && _m4->contains(ntohl(ats_ip4_addr_cast(target)), ptr);
@@ -950,113 +1047,109 @@ IpMap::contains(sockaddr const* target, void** ptr) const {
 }
 
 bool
-IpMap::contains(in_addr_t target, void** ptr) const {
+IpMap::contains(in_addr_t target, void **ptr) const
+{
   return _m4 && _m4->contains(ntohl(target), ptr);
 }
 
-IpMap&
-IpMap::mark(
-  sockaddr const* min,
-  sockaddr const* max,
-  void* data
-) {
+IpMap &
+IpMap::mark(sockaddr const *min, sockaddr const *max, void *data)
+{
   ink_assert(min->sa_family == max->sa_family);
   if (AF_INET == min->sa_family) {
-    this->force4()->mark(
-      ntohl(ats_ip4_addr_cast(min)),
-      ntohl(ats_ip4_addr_cast(max)),
-      data
-    );
+    this->force4()->mark(ntohl(ats_ip4_addr_cast(min)), ntohl(ats_ip4_addr_cast(max)), data);
   } else if (AF_INET6 == min->sa_family) {
     this->force6()->mark(ats_ip6_cast(min), ats_ip6_cast(max), data);
   }
   return *this;
 }
 
-IpMap&
-IpMap::mark(in_addr_t min, in_addr_t max, void* data) {
+IpMap &
+IpMap::mark(in_addr_t min, in_addr_t max, void *data)
+{
   this->force4()->mark(ntohl(min), ntohl(max), data);
   return *this;
 }
 
-IpMap&
-IpMap::unmark(
-  sockaddr const* min,
-  sockaddr const* max
-) {
+IpMap &
+IpMap::unmark(sockaddr const *min, sockaddr const *max)
+{
   ink_assert(min->sa_family == max->sa_family);
   if (AF_INET == min->sa_family) {
     if (_m4)
-      _m4->unmark(
-        ntohl(ats_ip4_addr_cast(min)),
-        ntohl(ats_ip4_addr_cast(max))
-      );
+      _m4->unmark(ntohl(ats_ip4_addr_cast(min)), ntohl(ats_ip4_addr_cast(max)));
   } else if (AF_INET6 == min->sa_family) {
-    if (_m6) _m6->unmark(ats_ip6_cast(min), ats_ip6_cast(max));
+    if (_m6)
+      _m6->unmark(ats_ip6_cast(min), ats_ip6_cast(max));
   }
   return *this;
 }
 
-IpMap&
-IpMap::unmark(in_addr_t min, in_addr_t max) {
-  if (_m4) _m4->unmark(ntohl(min), ntohl(max));
+IpMap &
+IpMap::unmark(in_addr_t min, in_addr_t max)
+{
+  if (_m4)
+    _m4->unmark(ntohl(min), ntohl(max));
   return *this;
 }
 
-IpMap&
-IpMap::fill(
-  sockaddr const* min,
-  sockaddr const* max,
-  void* data
-) {
+IpMap &
+IpMap::fill(sockaddr const *min, sockaddr const *max, void *data)
+{
   ink_assert(min->sa_family == max->sa_family);
   if (AF_INET == min->sa_family) {
-    this->force4()->fill(
-      ntohl(ats_ip4_addr_cast(min)),
-      ntohl(ats_ip4_addr_cast(max)),
-      data
-    );
+    this->force4()->fill(ntohl(ats_ip4_addr_cast(min)), ntohl(ats_ip4_addr_cast(max)), data);
   } else if (AF_INET6 == min->sa_family) {
     this->force6()->fill(ats_ip6_cast(min), ats_ip6_cast(max), data);
   }
   return *this;
 }
 
-IpMap&
-IpMap::fill(in_addr_t min, in_addr_t max, void* data) {
+IpMap &
+IpMap::fill(in_addr_t min, in_addr_t max, void *data)
+{
   this->force4()->fill(ntohl(min), ntohl(max), data);
   return *this;
 }
 
 size_t
-IpMap::getCount() const {
+IpMap::getCount() const
+{
   size_t zret = 0;
-  if (_m4) zret += _m4->getCount();
-  if (_m6) zret += _m6->getCount();
+  if (_m4)
+    zret += _m4->getCount();
+  if (_m6)
+    zret += _m6->getCount();
   return zret;
 }
 
-IpMap&
-IpMap::clear() {
-  if (_m4) _m4->clear();
-  if (_m6) _m6->clear();
+IpMap &
+IpMap::clear()
+{
+  if (_m4)
+    _m4->clear();
+  if (_m6)
+    _m6->clear();
   return *this;
 }
 
 IpMap::iterator
-IpMap::begin() const {
-  Node* x = 0;
-  if (_m4) x = _m4->getHead();
-  if (!x && _m6) x = _m6->getHead();
+IpMap::begin() const
+{
+  Node *x = 0;
+  if (_m4)
+    x = _m4->getHead();
+  if (!x && _m6)
+    x = _m6->getHead();
   return iterator(this, x);
 }
 
-IpMap::iterator&
-IpMap::iterator::operator ++ () {
+IpMap::iterator &IpMap::iterator::operator++()
+{
   if (_node) {
     // If we go past the end of the list see if it was the v4 list
     // and if so, move to the v6 list (if it's there).
-    Node* x = static_cast<Node*>(_node->_next);
+    Node *x = static_cast<Node *>(_node->_next);
     if (!x && _tree->_m4 && _tree->_m6 && _node == _tree->_m4->getTail())
       x = _tree->_m6->getHead();
     _node = x;
@@ -1064,19 +1157,21 @@ IpMap::iterator::operator ++ () {
   return *this;
 }
 
-inline IpMap::iterator&
-IpMap::iterator::operator--() {
+inline IpMap::iterator &IpMap::iterator::operator--()
+{
   if (_node) {
     // At a node, try to back up. Handle the case where we back over the
     // start of the v6 addresses and switch to the v4, if there are any.
-    Node* x = static_cast<Node*>(_node->_prev);
+    Node *x = static_cast<Node *>(_node->_prev);
     if (!x && _tree->_m4 && _tree->_m6 && _node == _tree->_m6->getHead())
       x = _tree->_m4->getTail();
     _node = x;
   } else if (_tree) {
     // We were at the end. Back up to v6 if possible, v4 if not.
-    if (_tree->_m6) _node = _tree->_m6->getTail();
-    if (!_node && _tree->_m4) _node = _tree->_m4->getTail();
+    if (_tree->_m6)
+      _node = _tree->_m6->getTail();
+    if (!_node && _tree->_m4)
+      _node = _tree->_m4->getTail();
   }
   return *this;
 }
@@ -1084,4 +1179,3 @@ IpMap::iterator::operator--() {
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/IpMap.h
----------------------------------------------------------------------
diff --git a/lib/ts/IpMap.h b/lib/ts/IpMap.h
index 77bef62..5e15325 100644
--- a/lib/ts/IpMap.h
+++ b/lib/ts/IpMap.h
@@ -1,12 +1,12 @@
-# if ! defined(TS_IP_MAP_HEADER)
-# define TS_IP_MAP_HEADER
+#if !defined(TS_IP_MAP_HEADER)
+#define TS_IP_MAP_HEADER
 
-# include "ink_platform.h"
-# include "ink_defs.h"
-# include "RbTree.h"
-# include <ts/ink_inet.h>
-# include <ts/IntrusiveDList.h>
-# include <ts/ink_assert.h>
+#include "ink_platform.h"
+#include "ink_defs.h"
+#include "RbTree.h"
+#include <ts/ink_inet.h>
+#include <ts/IntrusiveDList.h>
+#include <ts/ink_assert.h>
 
 /** @file
 
@@ -31,33 +31,37 @@
     limitations under the License.
 */
 
-namespace ts { namespace detail {
-
+namespace ts
+{
+namespace detail
+{
   /** Interval class.
       This holds an interval based on a metric @a T along with
       client data.
   */
-  template <
-    typename T, ///< Metric for span.
-    typename A  = T const& ///< Argument type.
-  > struct Interval {
-    typedef T Metric; ///< Metric (storage) type.
+  template <typename T,            ///< Metric for span.
+            typename A = T const & ///< Argument type.
+            >
+  struct Interval {
+    typedef T Metric;  ///< Metric (storage) type.
     typedef A ArgType; ///< Type used to pass instances of @c Metric.
 
     Interval() {} ///< Default constructor.
     /// Construct with values.
-    Interval(
-      ArgType min, ///< Minimum value in span.
-      ArgType max ///< Maximum value in span.
-    ) : _min(min), _max(max) {}
+    Interval(ArgType min, ///< Minimum value in span.
+             ArgType max  ///< Maximum value in span.
+             )
+      : _min(min), _max(max)
+    {
+    }
     Metric _min; ///< Minimum value in span.
     Metric _max; ///< Maximum value in span.
   };
 
   class Ip4Map; // Forward declare.
   class Ip6Map; // Forward declare.
-
-}} // namespace ts::detail
+}
+} // namespace ts::detail
 
 /** Map from IP addresses to client data.
 
@@ -89,7 +93,8 @@ namespace ts { namespace detail {
     minimized.
 */
 
-class IpMap {
+class IpMap
+{
 public:
   typedef IpMap self; ///< Self reference type.
 
@@ -97,30 +102,38 @@ public:
 
   /** Public API for intervals in the map.
   */
-  class Node : protected ts::detail::RBNode {
+  class Node : protected ts::detail::RBNode
+  {
     friend class iterator;
     friend class IpMap;
+
   public:
     typedef Node self; ///< Self reference type.
     /// Default constructor.
     Node() : _data(0) {}
     /// Construct with @a data.
-    Node(void* data) : _data(data) {}
+    Node(void *data) : _data(data) {}
     /// @return Client data for the node.
-    virtual void* data() { return _data; }
+    virtual void *
+    data()
+    {
+      return _data;
+    }
     /// Set client data.
-    virtual self& setData(
-      void* data ///< Client data pointer to store.
-    ) {
+    virtual self &
+    setData(void *data ///< Client data pointer to store.
+            )
+    {
       _data = data;
       return *this;
     }
     /// @return Minimum value of the interval.
-    virtual sockaddr const* min() const = 0;
+    virtual sockaddr const *min() const = 0;
     /// @return Maximum value of the interval.
-    virtual sockaddr const* max() const = 0;
+    virtual sockaddr const *max() const = 0;
+
   protected:
-    void* _data; ///< Client data.
+    void *_data; ///< Client data.
   };
 
   /** Iterator over nodes / intervals.
@@ -129,105 +142,102 @@ public:
       used to create the iterator. The node passed to the constructor
       just sets the current location.
   */
-  class iterator {
+  class iterator
+  {
     friend class IpMap;
+
   public:
-    typedef iterator self; ///< Self reference type.
-    typedef Node value_type; ///< Referenced type for iterator.
+    typedef iterator self;       ///< Self reference type.
+    typedef Node value_type;     ///< Referenced type for iterator.
     typedef int difference_type; ///< Distance type.
-    typedef Node* pointer; ///< Pointer to referent.
-    typedef Node& reference; ///< Reference to referent.
+    typedef Node *pointer;       ///< Pointer to referent.
+    typedef Node &reference;     ///< Reference to referent.
     typedef std::bidirectional_iterator_tag iterator_category;
     /// Default constructor.
     iterator() : _tree(0), _node(0) {}
 
-    reference operator* () const; //!< value operator
-    pointer operator -> () const; //!< dereference operator
-    self& operator++(); //!< next node (prefix)
-    self operator++(int); //!< next node (postfix)
-    self& operator--(); ///< previous node (prefix)
-    self operator--(int); ///< next node (postfix)
+    reference operator*() const; //!< value operator
+    pointer operator->() const;  //!< dereference operator
+    self &operator++();          //!< next node (prefix)
+    self operator++(int);        //!< next node (postfix)
+    self &operator--();          ///< previous node (prefix)
+    self operator--(int);        ///< next node (postfix)
 
     /** Equality.
         @return @c true if the iterators refer to the same node.
     */
-    bool operator==(self const& that) const;
+    bool operator==(self const &that) const;
     /** Inequality.
         @return @c true if the iterators refer to different nodes.
     */
-    bool operator!=(self const& that) const { return ! (*this == that); }
+    bool operator!=(self const &that) const { return !(*this == that); }
+
   private:
     /// Construct a valid iterator.
-    iterator(IpMap const* tree, Node* node) : _tree(tree), _node(node) {}
-      IpMap const* _tree; ///< Container.
-      Node* _node; //!< Current node.
-    };
+    iterator(IpMap const *tree, Node *node) : _tree(tree), _node(node) {}
+    IpMap const *_tree; ///< Container.
+    Node *_node;        //!< Current node.
+  };
 
-  IpMap(); ///< Default constructor.
+  IpMap();  ///< Default constructor.
   ~IpMap(); ///< Destructor.
 
   /** Mark a range.
       All addresses in the range [ @a min , @a max ] are marked with @a data.
       @return This object.
   */
-  self& mark(
-    sockaddr const* min, ///< Minimum value in range.
-    sockaddr const* max, ///< Maximum value in range.
-    void* data = 0     ///< Client data payload.
-  );
+  self &mark(sockaddr const *min, ///< Minimum value in range.
+             sockaddr const *max, ///< Maximum value in range.
+             void *data = 0       ///< Client data payload.
+             );
 
   /** Mark a range.
       All addresses in the range [ @a min , @a max ] are marked with @a data.
       @note Convenience overload for IPv4 addresses.
       @return This object.
   */
-  self& mark(
-    in_addr_t min, ///< Minimum address (network order).
-    in_addr_t max, ///< Maximum address (network order).
-    void* data = 0 ///< Client data.
-  );
+  self &mark(in_addr_t min, ///< Minimum address (network order).
+             in_addr_t max, ///< Maximum address (network order).
+             void *data = 0 ///< Client data.
+             );
 
   /** Mark a range.
       All addresses in the range [ @a min , @a max ] are marked with @a data.
       @note Convenience overload for IPv4 addresses.
       @return This object.
   */
-  self& mark(
-    IpAddr const& min, ///< Minimum address (network order).
-    IpAddr const& max, ///< Maximum address (network order).
-    void* data = 0 ///< Client data.
-  );
+  self &mark(IpAddr const &min, ///< Minimum address (network order).
+             IpAddr const &max, ///< Maximum address (network order).
+             void *data = 0     ///< Client data.
+             );
 
   /** Mark an IPv4 address @a addr with @a data.
       This is equivalent to calling @c mark(addr, addr, data).
       @note Convenience overload for IPv4 addresses.
       @return This object.
   */
-  self& mark(
-    in_addr_t addr, ///< Address (network order).
-    void* data = 0 ///< Client data.
-  );
+  self &mark(in_addr_t addr, ///< Address (network order).
+             void *data = 0  ///< Client data.
+             );
 
   /** Mark a range.
       All addresses in the range [ @a min , @a max ] are marked with @a data.
       @note Convenience overload.
       @return This object.
   */
-  self& mark(
-    IpEndpoint const* min, ///< Minimum address (network order).
-    IpEndpoint const* max, ///< Maximum address (network order).
-    void* data = 0 ///< Client data.
-  );
+  self &mark(IpEndpoint const *min, ///< Minimum address (network order).
+             IpEndpoint const *max, ///< Maximum address (network order).
+             void *data = 0         ///< Client data.
+             );
 
   /** Mark an address @a addr with @a data.
       This is equivalent to calling @c mark(addr, addr, data).
       @note Convenience overload.
       @return This object.
   */
-  self& mark(
-    IpEndpoint const* addr, ///< Address (network order).
-    void* data = 0 ///< Client data.
-  );
+  self &mark(IpEndpoint const *addr, ///< Address (network order).
+             void *data = 0          ///< Client data.
+             );
 
   /** Unmark addresses.
 
@@ -236,20 +246,15 @@ public:
 
       @return This object.
   */
-  self& unmark(
-    sockaddr const* min, ///< Minimum value.
-    sockaddr const* max  ///< Maximum value.
-  );
+  self &unmark(sockaddr const *min, ///< Minimum value.
+               sockaddr const *max  ///< Maximum value.
+               );
   /// Unmark addresses (overload).
-  self& unmark(
-    IpEndpoint const* min,
-    IpEndpoint const* max
-  );
+  self &unmark(IpEndpoint const *min, IpEndpoint const *max);
   /// Unmark overload.
-  self& unmark(
-    in_addr_t min, ///< Minimum of range to unmark.
-    in_addr_t max  ///< Maximum of range to unmark.
-  );
+  self &unmark(in_addr_t min, ///< Minimum of range to unmark.
+               in_addr_t max  ///< Maximum of range to unmark.
+               );
 
   /** Fill addresses.
 
@@ -262,23 +267,11 @@ public:
 
       @return This object.
   */
-  self& fill(
-    sockaddr const* min,
-    sockaddr const* max,
-    void* data = 0
-  );
+  self &fill(sockaddr const *min, sockaddr const *max, void *data = 0);
   /// Fill addresses (overload).
-  self& fill(
-    IpEndpoint const* min,
-    IpEndpoint const* max,
-    void* data = 0
-  );
+  self &fill(IpEndpoint const *min, IpEndpoint const *max, void *data = 0);
   /// Fill addresses (overload).
-  self& fill(
-    in_addr_t min,
-    in_addr_t max,
-    void* data = 0
-  );
+  self &fill(in_addr_t min, in_addr_t max, void *data = 0);
 
   /** Test for membership.
 
@@ -286,10 +279,9 @@ public:
       If the address is in the map and @a ptr is not @c NULL, @c *ptr
       is set to the client data for the address.
   */
-  bool contains(
-    sockaddr const* target, ///< Search target (network order).
-    void **ptr = 0 ///< Client data return.
-  ) const;
+  bool contains(sockaddr const *target, ///< Search target (network order).
+                void **ptr = 0          ///< Client data return.
+                ) const;
 
   /** Test for membership.
 
@@ -299,10 +291,9 @@ public:
       If the address is in the map and @a ptr is not @c NULL, @c *ptr
       is set to the client data for the address.
   */
-  bool contains(
-    in_addr_t target, ///< Search target (network order).
-    void **ptr = 0 ///< Client data return.
-  ) const;
+  bool contains(in_addr_t target, ///< Search target (network order).
+                void **ptr = 0    ///< Client data return.
+                ) const;
 
   /** Test for membership.
 
@@ -312,10 +303,9 @@ public:
       If the address is in the map and @a ptr is not @c NULL, @c *ptr
       is set to the client data for the address.
   */
-  bool contains(
-    IpEndpoint const* target, ///< Search target (network order).
-    void **ptr = 0 ///< Client data return.
-  ) const;
+  bool contains(IpEndpoint const *target, ///< Search target (network order).
+                void **ptr = 0            ///< Client data return.
+                ) const;
 
   /** Test for membership.
 
@@ -325,17 +315,16 @@ public:
       If the address is in the map and @a ptr is not @c NULL, @c *ptr
       is set to the client data for the address.
   */
-  bool contains(
-    IpAddr const& target, ///< Search target (network order).
-    void **ptr = 0 ///< Client data return.
-  ) const;
+  bool contains(IpAddr const &target, ///< Search target (network order).
+                void **ptr = 0        ///< Client data return.
+                ) const;
 
   /** Remove all addresses from the map.
 
       @note This is much faster than @c unmark.
       @return This object.
   */
-  self& clear();
+  self &clear();
 
   /// Iterator for first element.
   iterator begin() const;
@@ -356,88 +345,105 @@ public:
 protected:
   /// Force the IPv4 map to exist.
   /// @return The IPv4 map.
-  ts::detail::Ip4Map* force4();
+  ts::detail::Ip4Map *force4();
   /// Force the IPv6 map to exist.
   /// @return The IPv6 map.
-  ts::detail::Ip6Map* force6();
-
-  ts::detail::Ip4Map* _m4; ///< Map of IPv4 addresses.
-  ts::detail::Ip6Map* _m6; ///< Map of IPv6 addresses.
+  ts::detail::Ip6Map *force6();
 
+  ts::detail::Ip4Map *_m4; ///< Map of IPv4 addresses.
+  ts::detail::Ip6Map *_m6; ///< Map of IPv6 addresses.
 };
 
-inline IpMap& IpMap::mark(in_addr_t addr, void* data) {
+inline IpMap &
+IpMap::mark(in_addr_t addr, void *data)
+{
   return this->mark(addr, addr, data);
 }
 
-inline IpMap& IpMap::mark(IpAddr const& min, IpAddr const& max, void* data) {
-  IpEndpoint x,y;
+inline IpMap &
+IpMap::mark(IpAddr const &min, IpAddr const &max, void *data)
+{
+  IpEndpoint x, y;
   x.assign(min);
   y.assign(max);
   return this->mark(&x.sa, &y.sa, data);
 }
 
-inline IpMap& IpMap::mark(IpEndpoint const* addr, void* data) {
+inline IpMap &
+IpMap::mark(IpEndpoint const *addr, void *data)
+{
   return this->mark(&addr->sa, &addr->sa, data);
 }
 
-inline IpMap& IpMap::mark(IpEndpoint const* min, IpEndpoint const* max, void* data) {
+inline IpMap &
+IpMap::mark(IpEndpoint const *min, IpEndpoint const *max, void *data)
+{
   return this->mark(&min->sa, &max->sa, data);
 }
 
-inline IpMap& IpMap::unmark(IpEndpoint const* min, IpEndpoint const* max) {
+inline IpMap &
+IpMap::unmark(IpEndpoint const *min, IpEndpoint const *max)
+{
   return this->unmark(&min->sa, &max->sa);
 }
 
-inline IpMap& IpMap::fill(IpEndpoint const* min, IpEndpoint const* max, void* data) {
+inline IpMap &
+IpMap::fill(IpEndpoint const *min, IpEndpoint const *max, void *data)
+{
   return this->fill(&min->sa, &max->sa, data);
 }
 
-inline bool IpMap::contains(IpEndpoint const* target, void** ptr) const {
+inline bool
+IpMap::contains(IpEndpoint const *target, void **ptr) const
+{
   return this->contains(&target->sa, ptr);
 }
 
 inline bool
-IpMap::contains(IpAddr const& addr, void** ptr) const {
+IpMap::contains(IpAddr const &addr, void **ptr) const
+{
   IpEndpoint ip;
   ip.assign(addr);
   return this->contains(&ip.sa, ptr);
 }
 
 inline IpMap::iterator
-IpMap::end() const {
+IpMap::end() const
+{
   return iterator(this, 0);
 }
 
-inline IpMap::iterator
-IpMap::iterator::operator ++ (int) {
+inline IpMap::iterator IpMap::iterator::operator++(int)
+{
   iterator old(*this);
   ++*this;
   return old;
 }
 
-inline IpMap::iterator
-IpMap::iterator::operator--(int) {
+inline IpMap::iterator IpMap::iterator::operator--(int)
+{
   self tmp(*this);
   --*this;
   return tmp;
 }
 
-inline bool
-IpMap::iterator::operator == (iterator const& that) const {
+inline bool IpMap::iterator::operator==(iterator const &that) const
+{
   return _tree == that._tree && _node == that._node;
 }
 
-inline IpMap::iterator::reference
-IpMap::iterator::operator * () const {
+inline IpMap::iterator::reference IpMap::iterator::operator*() const
+{
   return *_node;
 }
 
-inline IpMap::iterator::pointer
-IpMap::iterator::operator -> () const {
+inline IpMap::iterator::pointer IpMap::iterator::operator->() const
+{
   return _node;
 }
 
-inline IpMap::IpMap() : _m4(0), _m6(0) {}
+inline IpMap::IpMap() : _m4(0), _m6(0)
+{
+}
 
-# endif // TS_IP_MAP_HEADER
+#endif // TS_IP_MAP_HEADER


[09/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_auth_api.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_auth_api.h b/lib/ts/ink_auth_api.h
index 9fca069..bec81b8 100644
--- a/lib/ts/ink_auth_api.h
+++ b/lib/ts/ink_auth_api.h
@@ -29,8 +29,7 @@
 
 #include "ink_defs.h"
 
-typedef union
-{
+typedef union {
   uint64_t u64[2];
   uint32_t u32[4];
   uint16_t u16[8];
@@ -40,81 +39,41 @@ typedef union
 class INK_AUTH_SEED
 {
 public:
-  const void *data() const
+  const void *
+  data() const
   {
     return m_data;
   }
-  unsigned length() const
+  unsigned
+  length() const
   {
     return m_length;
   }
 
-  inline INK_AUTH_SEED(const void *x, unsigned ln)
-  {
-    init(x, ln);
-  }
+  inline INK_AUTH_SEED(const void *x, unsigned ln) { init(x, ln); }
 
-  inline INK_AUTH_SEED(const uint8_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const uint16_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const uint32_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const uint64_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const int8_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const int16_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const int32_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
-  inline INK_AUTH_SEED(const int64_t & x)
-  {
-    init((const void *) &x, sizeof(x));
-  }
+  inline INK_AUTH_SEED(const uint8_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const uint16_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const uint32_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const uint64_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const int8_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const int16_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const int32_t &x) { init((const void *)&x, sizeof(x)); }
+  inline INK_AUTH_SEED(const int64_t &x) { init((const void *)&x, sizeof(x)); }
 
-  inline INK_AUTH_SEED(const INK_AUTH_TOKEN & x)
-  {
-    init((const void *) &(x.u8[0]), sizeof(x.u8));
-  }
+  inline INK_AUTH_SEED(const INK_AUTH_TOKEN &x) { init((const void *)&(x.u8[0]), sizeof(x.u8)); }
 
-  inline INK_AUTH_SEED(const char *str)
-  {
-    init((const void *) str, strlen((const char *) str));
-  }
+  inline INK_AUTH_SEED(const char *str) { init((const void *)str, strlen((const char *)str)); }
 
-  inline INK_AUTH_SEED(const char *str, unsigned ln)
-  {
-    init((const void *) str, ln);
-  }
+  inline INK_AUTH_SEED(const char *str, unsigned ln) { init((const void *)str, ln); }
 
-  inline INK_AUTH_SEED(const unsigned char *str)
-  {
-    init((const void *) str, strlen((const char *) str));
-  }
+  inline INK_AUTH_SEED(const unsigned char *str) { init((const void *)str, strlen((const char *)str)); }
 
-  inline INK_AUTH_SEED(const unsigned char *str, unsigned ln)
-  {
-    init((const void *) str, ln);
-  }
+  inline INK_AUTH_SEED(const unsigned char *str, unsigned ln) { init((const void *)str, ln); }
 
 protected:
-
-  void init(const void *d, unsigned l)
+  void
+  init(const void *d, unsigned l)
   {
     m_data = d;
     m_length = l;
@@ -125,98 +84,94 @@ protected:
 };
 
 
-void ink_make_token(INK_AUTH_TOKEN * tok, const INK_AUTH_TOKEN & mask, const INK_AUTH_SEED * const *seeds, int slen);
+void ink_make_token(INK_AUTH_TOKEN *tok, const INK_AUTH_TOKEN &mask, const INK_AUTH_SEED *const *seeds, int slen);
 
-uint32_t ink_make_token32(uint32_t mask, const INK_AUTH_SEED * const *seeds, int slen);
-uint64_t ink_make_token64(uint64_t mask, const INK_AUTH_SEED * const *seeds, int slen);
+uint32_t ink_make_token32(uint32_t mask, const INK_AUTH_SEED *const *seeds, int slen);
+uint64_t ink_make_token64(uint64_t mask, const INK_AUTH_SEED *const *seeds, int slen);
 
 uint32_t ink_get_rand();
 
-#define INK_TOKENS_EQUAL(m,t1,t2) ((((t1)^(t2))&(~(m))) == 0)
+#define INK_TOKENS_EQUAL(m, t1, t2) ((((t1) ^ (t2)) & (~(m))) == 0)
 
 //
 // Helper functions - wiil create INK_AUTH_SEEDs from base types on fly
 //
 inline uint32_t
-ink_make_token32(uint32_t mask, const INK_AUTH_SEED & s1)
+ink_make_token32(uint32_t mask, const INK_AUTH_SEED &s1)
 {
-  const INK_AUTH_SEED *s[] = { &s1 };
+  const INK_AUTH_SEED *s[] = {&s1};
   return ink_make_token32(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint32_t
-ink_make_token32(uint32_t mask, const INK_AUTH_SEED & s1, const INK_AUTH_SEED & s2)
+ink_make_token32(uint32_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2};
   return ink_make_token32(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint32_t
-ink_make_token32(uint32_t mask, const INK_AUTH_SEED & s1, const INK_AUTH_SEED & s2, const INK_AUTH_SEED & s3)
+ink_make_token32(uint32_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2, const INK_AUTH_SEED &s3)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2, &s3 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2, &s3};
   return ink_make_token32(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint32_t
-ink_make_token32(uint32_t mask,
-                 const INK_AUTH_SEED & s1, const INK_AUTH_SEED & s2, const INK_AUTH_SEED & s3, const INK_AUTH_SEED & s4)
+ink_make_token32(uint32_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2, const INK_AUTH_SEED &s3, const INK_AUTH_SEED &s4)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2, &s3, &s4 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2, &s3, &s4};
   return ink_make_token32(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint32_t
-ink_make_token32(uint32_t mask,
-                 const INK_AUTH_SEED & s1,
-                 const INK_AUTH_SEED & s2, const INK_AUTH_SEED & s3, const INK_AUTH_SEED & s4, const INK_AUTH_SEED & s5)
+ink_make_token32(uint32_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2, const INK_AUTH_SEED &s3, const INK_AUTH_SEED &s4,
+                 const INK_AUTH_SEED &s5)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2, &s3, &s4, &s5 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2, &s3, &s4, &s5};
   return ink_make_token32(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint64_t
-ink_make_token64(uint64_t mask, const INK_AUTH_SEED & s1)
+ink_make_token64(uint64_t mask, const INK_AUTH_SEED &s1)
 {
-  const INK_AUTH_SEED *s[] = { &s1 };
+  const INK_AUTH_SEED *s[] = {&s1};
   return ink_make_token64(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint64_t
-ink_make_token64(uint64_t mask, const INK_AUTH_SEED & s1, const INK_AUTH_SEED & s2)
+ink_make_token64(uint64_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2};
   return ink_make_token64(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint64_t
-ink_make_token64(uint64_t mask, const INK_AUTH_SEED & s1, const INK_AUTH_SEED & s2, const INK_AUTH_SEED & s3)
+ink_make_token64(uint64_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2, const INK_AUTH_SEED &s3)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2, &s3 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2, &s3};
   return ink_make_token64(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint64_t
-ink_make_token64(uint64_t mask,
-                 const INK_AUTH_SEED & s1, const INK_AUTH_SEED & s2, const INK_AUTH_SEED & s3, const INK_AUTH_SEED & s4)
+ink_make_token64(uint64_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2, const INK_AUTH_SEED &s3, const INK_AUTH_SEED &s4)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2, &s3, &s4 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2, &s3, &s4};
   return ink_make_token64(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline uint64_t
-ink_make_token64(uint64_t mask,
-                 const INK_AUTH_SEED & s1,
-                 const INK_AUTH_SEED & s2, const INK_AUTH_SEED & s3, const INK_AUTH_SEED & s4, const INK_AUTH_SEED & s5)
+ink_make_token64(uint64_t mask, const INK_AUTH_SEED &s1, const INK_AUTH_SEED &s2, const INK_AUTH_SEED &s3, const INK_AUTH_SEED &s4,
+                 const INK_AUTH_SEED &s5)
 {
-  const INK_AUTH_SEED *s[] = { &s1, &s2, &s3, &s4, &s5 };
+  const INK_AUTH_SEED *s[] = {&s1, &s2, &s3, &s4, &s5};
   return ink_make_token64(mask, s, sizeof(s) / sizeof(*s));
 }
 
 inline int64_t
 INK_AUTH_MAKE_INT_64(uint32_t h, uint32_t l)
 {
-  return int64_t((((uint64_t) h) << 32) + (uint32_t) l);
+  return int64_t((((uint64_t)h) << 32) + (uint32_t)l);
 }
 
 inline int64_t

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_base64.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_base64.cc b/lib/ts/ink_base64.cc
index ee87324..7a67ad1 100644
--- a/lib/ts/ink_base64.cc
+++ b/lib/ts/ink_base64.cc
@@ -108,18 +108,14 @@ ats_base64_encode(const char *inBuffer, size_t inBufferSize, char *outBuffer, si
 
 /* Converts a printable character to it's six bit representation */
 const unsigned char printableToSixBit[256] = {
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 62, 64, 63,
-  52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 63, 64, 26, 27,
-  28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-};
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 62, 64, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
+  64, 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 63,
+  64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64};
 
 bool
 ats_base64_decode(const char *inBuffer, size_t inBufferSize, unsigned char *outBuffer, size_t outBufSize, size_t *length)
@@ -139,9 +135,9 @@ ats_base64_decode(const char *inBuffer, size_t inBufferSize, unsigned char *outB
     ++inBytes;
 
   for (size_t i = 0; i < inBytes; i += 4) {
-    buf[0] = (unsigned char) (DECODE(inBuffer[0]) << 2 | DECODE(inBuffer[1]) >> 4);
-    buf[1] = (unsigned char) (DECODE(inBuffer[1]) << 4 | DECODE(inBuffer[2]) >> 2);
-    buf[2] = (unsigned char) (DECODE(inBuffer[2]) << 6 | DECODE(inBuffer[3]));
+    buf[0] = (unsigned char)(DECODE(inBuffer[0]) << 2 | DECODE(inBuffer[1]) >> 4);
+    buf[1] = (unsigned char)(DECODE(inBuffer[1]) << 4 | DECODE(inBuffer[2]) >> 2);
+    buf[2] = (unsigned char)(DECODE(inBuffer[2]) << 6 | DECODE(inBuffer[3]));
 
     buf += 3;
     inBuffer += 4;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_cap.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_cap.cc b/lib/ts/ink_cap.cc
index a27d64e..569e3f8 100644
--- a/lib/ts/ink_cap.cc
+++ b/lib/ts/ink_cap.cc
@@ -21,10 +21,10 @@
     limitations under the License.
 */
 
-# include "ink_config.h"
-# include "Diags.h"
-# include "ink_cap.h"
-# include "ink_thread.h"
+#include "ink_config.h"
+#include "Diags.h"
+#include "ink_cap.h"
+#include "ink_thread.h"
 
 #include <grp.h>
 
@@ -40,58 +40,51 @@
 // and if it does, it is likely that some fundamental security assumption has been violated. In that case
 // it is dangerous to continue.
 
-# if !TS_USE_POSIX_CAP
+#if !TS_USE_POSIX_CAP
 ink_mutex ElevateAccess::lock = INK_MUTEX_INIT;
 #endif
 
-#define DEBUG_CREDENTIALS(tag)  do { \
-  if (is_debug_tag_set(tag)) { \
-    uid_t uid = -1, euid = -1, suid = -1; \
-    gid_t gid = -1, egid = -1, sgid = -1; \
-    getresuid(&uid, &euid, &suid); \
-    getresgid(&gid, &egid, &sgid); \
-    Debug(tag, "uid=%ld, gid=%ld, euid=%ld, egid=%ld, suid=%ld, sgid=%ld", \
-        static_cast<long>(uid), \
-        static_cast<long>(gid), \
-        static_cast<long>(euid), \
-        static_cast<long>(egid), \
-        static_cast<long>(suid), \
-        static_cast<long>(sgid) ); \
-  } \
-} while (0)
+#define DEBUG_CREDENTIALS(tag)                                                                                               \
+  do {                                                                                                                       \
+    if (is_debug_tag_set(tag)) {                                                                                             \
+      uid_t uid = -1, euid = -1, suid = -1;                                                                                  \
+      gid_t gid = -1, egid = -1, sgid = -1;                                                                                  \
+      getresuid(&uid, &euid, &suid);                                                                                         \
+      getresgid(&gid, &egid, &sgid);                                                                                         \
+      Debug(tag, "uid=%ld, gid=%ld, euid=%ld, egid=%ld, suid=%ld, sgid=%ld", static_cast<long>(uid), static_cast<long>(gid), \
+            static_cast<long>(euid), static_cast<long>(egid), static_cast<long>(suid), static_cast<long>(sgid));             \
+    }                                                                                                                        \
+  } while (0)
 
 #if TS_USE_POSIX_CAP
 
-#define DEBUG_PRIVILEGES(tag)  do { \
-  if (is_debug_tag_set(tag)) { \
-    cap_t caps = cap_get_proc(); \
-    char* caps_text = cap_to_text(caps, NULL); \
-    Debug(tag, "caps='%s', core=%s, death signal=%d, thread=0x%llx", \
-        caps_text, \
-        is_dumpable(), \
-        death_signal(), \
-        (unsigned long long)pthread_self() ); \
-    cap_free(caps_text); \
-    cap_free(caps); \
-  } \
-} while (0)
+#define DEBUG_PRIVILEGES(tag)                                                                                    \
+  do {                                                                                                           \
+    if (is_debug_tag_set(tag)) {                                                                                 \
+      cap_t caps = cap_get_proc();                                                                               \
+      char *caps_text = cap_to_text(caps, NULL);                                                                 \
+      Debug(tag, "caps='%s', core=%s, death signal=%d, thread=0x%llx", caps_text, is_dumpable(), death_signal(), \
+            (unsigned long long)pthread_self());                                                                 \
+      cap_free(caps_text);                                                                                       \
+      cap_free(caps);                                                                                            \
+    }                                                                                                            \
+  } while (0)
 
 #else /* TS_USE_POSIX_CAP */
 
-#define DEBUG_PRIVILEGES(tag)  do { \
-  if (is_debug_tag_set(tag)) { \
-    Debug(tag, "caps='', core=%s, death signal=%d, thread=0x%llx", \
-        is_dumpable(), \
-        death_signal(), \
-        (unsigned long long)pthread_self() ); \
-  } \
-} while(0)
+#define DEBUG_PRIVILEGES(tag)                                                                       \
+  do {                                                                                              \
+    if (is_debug_tag_set(tag)) {                                                                    \
+      Debug(tag, "caps='', core=%s, death signal=%d, thread=0x%llx", is_dumpable(), death_signal(), \
+            (unsigned long long)pthread_self());                                                    \
+    }                                                                                               \
+  } while (0)
 
 #endif /* TS_USE_POSIX_CAP */
 
 #if !HAVE_GETRESUID
 static int
-getresuid(uid_t * uid, uid_t * euid, uid_t * suid)
+getresuid(uid_t *uid, uid_t *euid, uid_t *suid)
 {
   *uid = getuid();
   *euid = geteuid();
@@ -101,7 +94,7 @@ getresuid(uid_t * uid, uid_t * euid, uid_t * suid)
 
 #if !HAVE_GETRESGID
 static int
-getresgid(gid_t * gid, gid_t * egid, gid_t * sgid)
+getresgid(gid_t *gid, gid_t *egid, gid_t *sgid)
 {
   *gid = getgid();
   *egid = getegid();
@@ -145,14 +138,14 @@ death_signal()
 }
 
 void
-DebugCapabilities(char const* tag)
+DebugCapabilities(char const *tag)
 {
   DEBUG_CREDENTIALS(tag);
   DEBUG_PRIVILEGES(tag);
 }
 
 static void
-impersonate(const struct passwd * pwd, ImpersonationLevel level)
+impersonate(const struct passwd *pwd, ImpersonationLevel level)
 {
   int deathsig = death_signal();
   bool dumpable = false;
@@ -207,9 +200,9 @@ impersonate(const struct passwd * pwd, ImpersonationLevel level)
 void
 ImpersonateUserID(uid_t uid, ImpersonationLevel level)
 {
-  struct passwd * pwd;
-  struct passwd   pbuf;
-  char            buf[max_passwd_size()];
+  struct passwd *pwd;
+  struct passwd pbuf;
+  char buf[max_passwd_size()];
 
   if (getpwuid_r(uid, &pbuf, buf, sizeof(buf), &pwd) != 0) {
     Fatal("missing password database entry for UID %ld: %s", (long)uid, strerror(errno));
@@ -224,11 +217,11 @@ ImpersonateUserID(uid_t uid, ImpersonationLevel level)
 }
 
 void
-ImpersonateUser(const char * user, ImpersonationLevel level)
+ImpersonateUser(const char *user, ImpersonationLevel level)
 {
-  struct passwd * pwd;
-  struct passwd   pbuf;
-  char            buf[max_passwd_size()];
+  struct passwd *pwd;
+  struct passwd pbuf;
+  char buf[max_passwd_size()];
 
   if (*user == '#') {
     // Numeric user notation.
@@ -254,9 +247,9 @@ bool
 PreserveCapabilities()
 {
   int zret = 0;
-# if TS_USE_POSIX_CAP
+#if TS_USE_POSIX_CAP
   zret = prctl(PR_SET_KEEPCAPS, 1);
-# endif
+#endif
   Debug("privileges", "[PreserveCapabilities] zret : %d\n", zret);
   return zret == 0;
 }
@@ -266,19 +259,19 @@ bool
 RestrictCapabilities()
 {
   int zret = 0; // return value.
-# if TS_USE_POSIX_CAP
-    cap_t caps = cap_init(); // start with nothing.
-    // Capabilities we need.
-    cap_value_t perm_list[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_IPC_LOCK, CAP_DAC_OVERRIDE};
-    static int const PERM_CAP_COUNT = sizeof(perm_list)/sizeof(*perm_list);
-    cap_value_t eff_list[] = { CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_IPC_LOCK};
-    static int const EFF_CAP_COUNT = sizeof(eff_list)/sizeof(*eff_list);
-
-    cap_set_flag(caps, CAP_PERMITTED, PERM_CAP_COUNT, perm_list, CAP_SET);
-    cap_set_flag(caps, CAP_EFFECTIVE, EFF_CAP_COUNT, eff_list, CAP_SET);
-    zret = cap_set_proc(caps);
-    cap_free(caps);
-#  endif
+#if TS_USE_POSIX_CAP
+  cap_t caps = cap_init(); // start with nothing.
+  // Capabilities we need.
+  cap_value_t perm_list[] = {CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_IPC_LOCK, CAP_DAC_OVERRIDE};
+  static int const PERM_CAP_COUNT = sizeof(perm_list) / sizeof(*perm_list);
+  cap_value_t eff_list[] = {CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_IPC_LOCK};
+  static int const EFF_CAP_COUNT = sizeof(eff_list) / sizeof(*eff_list);
+
+  cap_set_flag(caps, CAP_PERMITTED, PERM_CAP_COUNT, perm_list, CAP_SET);
+  cap_set_flag(caps, CAP_EFFECTIVE, EFF_CAP_COUNT, eff_list, CAP_SET);
+  zret = cap_set_proc(caps);
+  cap_free(caps);
+#endif
   Debug("privileges", "[RestrictCapabilities] zret : %d\n", zret);
   return zret == 0;
 }
@@ -288,7 +281,7 @@ EnableCoreFile(bool flag)
 {
   int zret = 0;
 
-# if defined(PR_SET_DUMPABLE)
+#if defined(PR_SET_DUMPABLE)
   int state = flag ? 1 : 0;
   if (0 > (zret = prctl(PR_SET_DUMPABLE, state, 0, 0, 0))) {
     Warning("Unable to set PR_DUMPABLE : %s", strerror(errno));
@@ -296,7 +289,7 @@ EnableCoreFile(bool flag)
     zret = ENOSYS; // best guess
     Warning("Call to set PR_DUMPABLE was ineffective");
   }
-# endif  // linux check
+#endif // linux check
 
   Debug("privileges", "[EnableCoreFile] zret : %d\n", zret);
   return zret == 0;
@@ -359,8 +352,7 @@ elevateFileAccess(unsigned level, bool state)
 }
 #endif
 
-ElevateAccess::ElevateAccess(const bool state, unsigned lvl)
-  : elevated(false), saved_uid(geteuid()), level(lvl)
+ElevateAccess::ElevateAccess(const bool state, unsigned lvl) : elevated(false), saved_uid(geteuid()), level(lvl)
 {
   // XXX Squash a clang [-Wunused-private-field] warning. The right solution is probably to extract
   // the capabilities into a policy class.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_cap.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_cap.h b/lib/ts/ink_cap.h
index f763316..7cef1cc 100644
--- a/lib/ts/ink_cap.h
+++ b/lib/ts/ink_cap.h
@@ -21,14 +21,13 @@
   limitations under the License.
 
  */
-#if !defined (_ink_cap_h_)
+#if !defined(_ink_cap_h_)
 #define _ink_cap_h_
 #include "ink_mutex.h"
 
 /// Generate a debug message with the current capabilities for the process.
-extern void DebugCapabilities(
-  char const* tag ///< Debug message tag.
-);
+extern void DebugCapabilities(char const *tag ///< Debug message tag.
+                              );
 /// Set capabilities to persist across change of user id.
 /// @return true on success
 extern bool PreserveCapabilities();
@@ -40,26 +39,25 @@ extern bool RestrictCapabilities();
     @a flag sets whether core files are enabled on crash.
     @return true on success
  */
-extern bool EnableCoreFile(
-  bool flag ///< New enable state.
-);
+extern bool EnableCoreFile(bool flag ///< New enable state.
+                           );
 
 void EnableDeathSignal(int signum);
 
 enum ImpersonationLevel {
-  IMPERSONATE_EFFECTIVE,  // Set the effective credential set.
-  IMPERSONATE_PERMANENT   // Set the real credential (permanently).
+  IMPERSONATE_EFFECTIVE, // Set the effective credential set.
+  IMPERSONATE_PERMANENT  // Set the real credential (permanently).
 };
 
-void ImpersonateUser(const char * user, ImpersonationLevel level);
+void ImpersonateUser(const char *user, ImpersonationLevel level);
 void ImpersonateUserID(uid_t user, ImpersonationLevel level);
 
-class ElevateAccess {
+class ElevateAccess
+{
 public:
-
   typedef enum {
-    FILE_PRIVILEGE  = 0x1u, // Access filesystem objects with privilege
-    TRACE_PRIVILEGE = 0x2u  // Trace other processes with privilege
+    FILE_PRIVILEGE = 0x1u, // Access filesystem objects with privilege
+    TRACE_PRIVILEGE = 0x2u // Trace other processes with privilege
   } privilege_level;
 
   ElevateAccess(const bool state, unsigned level = FILE_PRIVILEGE);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_code.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_code.cc b/lib/ts/ink_code.cc
index 9d17a44..e099b9c 100644
--- a/lib/ts/ink_code.cc
+++ b/lib/ts/ink_code.cc
@@ -30,17 +30,20 @@
 
 ats::CryptoHash const ats::CRYPTO_HASH_ZERO; // default constructed is correct.
 
-MD5Context::MD5Context() {
+MD5Context::MD5Context()
+{
   MD5_Init(&_ctx);
 }
 
 bool
-MD5Context::update(void const* data, int length) {
+MD5Context::update(void const *data, int length)
+{
   return 0 != MD5_Update(&_ctx, data, length);
 }
 
 bool
-MD5Context::finalize(CryptoHash& hash) {
+MD5Context::finalize(CryptoHash &hash)
+{
   return 0 != MD5_Final(hash.u8, &_ctx);
 }
 
@@ -48,7 +51,8 @@ MD5Context::finalize(CryptoHash& hash) {
   @brief Wrapper around MD5_Init
 */
 int
-ink_code_incr_md5_init(INK_DIGEST_CTX * context) {
+ink_code_incr_md5_init(INK_DIGEST_CTX *context)
+{
   return MD5_Init(context);
 }
 
@@ -56,7 +60,8 @@ ink_code_incr_md5_init(INK_DIGEST_CTX * context) {
   @brief Wrapper around MD5_Update
 */
 int
-ink_code_incr_md5_update(INK_DIGEST_CTX * context, const char *input, int input_length) {
+ink_code_incr_md5_update(INK_DIGEST_CTX *context, const char *input, int input_length)
+{
   return MD5_Update(context, input, input_length);
 }
 
@@ -64,8 +69,9 @@ ink_code_incr_md5_update(INK_DIGEST_CTX * context, const char *input, int input_
   @brief Wrapper around MD5_Final
 */
 int
-ink_code_incr_md5_final(char *sixteen_byte_hash_pointer, INK_DIGEST_CTX * context) {
-  return MD5_Final((unsigned char*)sixteen_byte_hash_pointer, context);
+ink_code_incr_md5_final(char *sixteen_byte_hash_pointer, INK_DIGEST_CTX *context)
+{
+  return MD5_Final((unsigned char *)sixteen_byte_hash_pointer, context);
 }
 
 /**
@@ -74,7 +80,7 @@ ink_code_incr_md5_final(char *sixteen_byte_hash_pointer, INK_DIGEST_CTX * contex
   @return always returns 0, maybe some error checking should be done
 */
 int
-ink_code_md5(unsigned char const* input, int input_length, unsigned char *sixteen_byte_hash_pointer)
+ink_code_md5(unsigned char const *input, int input_length, unsigned char *sixteen_byte_hash_pointer)
 {
   MD5_CTX context;
 
@@ -110,7 +116,7 @@ ink_code_md5_stringify(char *dest33, const size_t destSize, const char *md5)
   }
   ink_assert(dest33[32] == '\0');
   return (dest33);
-}                               /* End ink_code_stringify_md5(const char *md5) */
+} /* End ink_code_stringify_md5(const char *md5) */
 
 /**
   @brief Converts a MD5 to a null-terminated string
@@ -126,12 +132,12 @@ ink_code_md5_stringify(char *dest33, const size_t destSize, const char *md5)
 */
 /* reentrant version */
 char *
-ink_code_to_hex_str(char *dest33, uint8_t const* hash)
+ink_code_to_hex_str(char *dest33, uint8_t const *hash)
 {
   int i;
   char *d;
 
-  static char hex_digits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+  static char hex_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 
   d = dest33;
   for (i = 0; i < 16; i += 4) {
@@ -148,4 +154,3 @@ ink_code_to_hex_str(char *dest33, uint8_t const* hash)
   *d = '\0';
   return (dest33);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_code.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_code.h b/lib/ts/ink_code.h
index ee492f6..5d71cab 100644
--- a/lib/ts/ink_code.h
+++ b/lib/ts/ink_code.h
@@ -22,7 +22,7 @@
  */
 
 #ifndef _ink_code_h_
-#define	_ink_code_h_
+#define _ink_code_h_
 
 #include "ink_apidefs.h"
 #include <openssl/md5.h>
@@ -35,11 +35,11 @@ typedef MD5_CTX INK_DIGEST_CTX;
   Wrappers around the MD5 functions, all of this should be depericated and just use the functions directly
 */
 
-inkcoreapi int ink_code_md5(unsigned char const* input, int input_length, unsigned char *sixteen_byte_hash_pointer);
+inkcoreapi int ink_code_md5(unsigned char const *input, int input_length, unsigned char *sixteen_byte_hash_pointer);
 inkcoreapi char *ink_code_md5_stringify(char *dest33, const size_t destSize, const char *md5);
-inkcoreapi char *ink_code_to_hex_str(char *dest33, uint8_t const* md5);
+inkcoreapi char *ink_code_to_hex_str(char *dest33, uint8_t const *md5);
 
-inkcoreapi int ink_code_incr_md5_init(INK_DIGEST_CTX * context);
-inkcoreapi int ink_code_incr_md5_update(INK_DIGEST_CTX * context, const char *input, int input_length);
-inkcoreapi int ink_code_incr_md5_final(char *sixteen_byte_hash_pointer, INK_DIGEST_CTX * context);
+inkcoreapi int ink_code_incr_md5_init(INK_DIGEST_CTX *context);
+inkcoreapi int ink_code_incr_md5_update(INK_DIGEST_CTX *context, const char *input, int input_length);
+inkcoreapi int ink_code_incr_md5_final(char *sixteen_byte_hash_pointer, INK_DIGEST_CTX *context);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_defs.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_defs.cc b/lib/ts/ink_defs.cc
index b9ba1b1..3deb389 100644
--- a/lib/ts/ink_defs.cc
+++ b/lib/ts/ink_defs.cc
@@ -37,7 +37,7 @@
 #endif
 #if defined(linux)
 #include <sys/utsname.h>
-#endif      /* MAGIC_EDITING_TAG */
+#endif /* MAGIC_EDITING_TAG */
 
 int off = 0;
 int on = 1;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_defs.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_defs.h b/lib/ts/ink_defs.h
index 8a23d04..d162a8e 100644
--- a/lib/ts/ink_defs.h
+++ b/lib/ts/ink_defs.h
@@ -22,7 +22,7 @@
  */
 
 #ifndef _ink_defs_h
-#define	_ink_defs_h
+#define _ink_defs_h
 
 
 #include "ink_config.h"
@@ -30,22 +30,22 @@
 #include <sys/mman.h>
 
 #ifdef HAVE_STDINT_H
-# include <stdint.h>
+#include <stdint.h>
 #else
 // TODO: Add "standard" int types?
 #endif
 
 #ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
+#include <inttypes.h>
 #else
 // TODO: add PRI*64 stuff?
 #endif
 
 #ifndef INT64_MIN
 #define INT64_MAX (9223372036854775807LL)
-#define INT64_MIN (-INT64_MAX -1LL)
+#define INT64_MIN (-INT64_MAX - 1LL)
 #define INT32_MAX (2147483647)
-#define INT32_MIN (-2147483647-1)
+#define INT32_MIN (-2147483647 - 1)
 #endif
 
 #define POSIX_THREAD
@@ -73,67 +73,74 @@
 // Need to use this to avoid problems when calling variadic functions
 // with many arguments. In such cases, a raw '0' or NULL can be
 // interpreted as 32 bits
-#define NULL_PTR static_cast<void*>(0)
+#define NULL_PTR static_cast<void *>(0)
 
 // Determine the element count for an array.
 #ifdef __cplusplus
-template<typename T, unsigned N>
+template <typename T, unsigned N>
 static inline unsigned
-countof(const T (&)[N]) {
+countof(const T(&)[N])
+{
   return N;
 }
 #else
-#  define countof(x) ((unsigned)(sizeof(x)/sizeof((x)[0])))
+#define countof(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
 #endif
 
-#define SOCKOPT_ON ((char*)&on)
-#define SOCKOPT_OFF ((char*)&off)
+#define SOCKOPT_ON ((char *)&on)
+#define SOCKOPT_OFF ((char *)&off)
 
 #ifndef ABS
-#define ABS(x) (((x) < 0) ? ( - (x)) : (x))
+#define ABS(x) (((x) < 0) ? (-(x)) : (x))
 #endif
 
 #ifndef MAX
-#define MAX(x,y) (((x) >= (y)) ? (x) : (y))
+#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
 #endif
 
 #ifndef MIN
-#define MIN(x,y) (((x) <= (y)) ? (x) : (y))
+#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
 #endif
 
 #ifdef __cplusplus
 // We can't use #define for min and max because it will conflict with
 // other declarations of min and max functions.  This conflict
 // occurs with STL
-template<class T> T min(const T a, const T b)
+template <class T>
+T
+min(const T a, const T b)
 {
   return a < b ? a : b;
 }
 
-template<class T> T max(const T a, const T b)
+template <class T>
+T
+max(const T a, const T b)
 {
   return a > b ? a : b;
 }
 #endif
 
-#define ATS_UNUSED __attribute__ ((unused))
-#define ATS_WARN_IF_UNUSED __attribute__ ((warn_unused_result))
-#define	ATS_UNUSED_RETURN(x)	if (x) {}
+#define ATS_UNUSED __attribute__((unused))
+#define ATS_WARN_IF_UNUSED __attribute__((warn_unused_result))
+#define ATS_UNUSED_RETURN(x) \
+  if (x) {                   \
+  }
 
 #ifndef likely
-#define likely(x)	__builtin_expect (!!(x), 1)
+#define likely(x) __builtin_expect(!!(x), 1)
 #endif
 #ifndef unlikely
-#define unlikely(x)	__builtin_expect (!!(x), 0)
+#define unlikely(x) __builtin_expect(!!(x), 0)
 #endif
 
 
 #if TS_USE_HWLOC
-#  include <hwloc.h>
+#include <hwloc.h>
 #endif
 
 #ifndef ROUNDUP
-#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
+#define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y))
 #endif
 
 #if defined(MAP_NORESERVE)
@@ -162,8 +169,9 @@ hwloc_topology_t ink_get_topology();
 /** Constants.
  */
 #ifdef __cplusplus
-namespace ts {
-  static const int NO_FD = -1; ///< No or invalid file descriptor.
+namespace ts
+{
+static const int NO_FD = -1; ///< No or invalid file descriptor.
 }
 #endif
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_error.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_error.cc b/lib/ts/ink_error.cc
index 06b9c7d..da4f432 100644
--- a/lib/ts/ink_error.cc
+++ b/lib/ts/ink_error.cc
@@ -27,7 +27,7 @@
 #include "ink_stack_trace.h"
 
 #include <syslog.h>
-#include <signal.h>    /* MAGIC_EDITING_TAG */
+#include <signal.h> /* MAGIC_EDITING_TAG */
 
 static void ink_die_die_die() TS_NORETURN;
 
@@ -51,7 +51,7 @@ ink_die_die_die()
 
 */
 void
-ink_fatal_va(const char * fmt, va_list ap)
+ink_fatal_va(const char *fmt, va_list ap)
 {
   char msg[1024];
   const size_t len = sizeof("FATAL: ") - 1;
@@ -87,11 +87,11 @@ ink_pfatal(const char *message_format, ...)
   char extended_format[4096], message[4096];
 
   int errsav = errno;
-  const char * errno_string = strerror(errsav);
+  const char *errno_string = strerror(errsav);
 
   va_start(ap, message_format);
-  snprintf(extended_format, sizeof(extended_format) - 1, "FATAL: %s <last errno = %d (%s)>",
-           message_format, errsav, (errno_string == NULL ? "unknown" : errno_string));
+  snprintf(extended_format, sizeof(extended_format) - 1, "FATAL: %s <last errno = %d (%s)>", message_format, errsav,
+           (errno_string == NULL ? "unknown" : errno_string));
   extended_format[sizeof(extended_format) - 1] = 0;
   vsnprintf(message, sizeof(message) - 1, extended_format, ap);
   message[sizeof(message) - 1] = 0;
@@ -137,8 +137,8 @@ ink_pwarning(const char *message_format, ...)
 
   va_start(ap, message_format);
   errno_string = strerror(errno);
-  snprintf(extended_format, sizeof(extended_format) - 1, "WARNING: %s <last errno = %d (%s)>",
-           message_format, errno, (errno_string == NULL ? "unknown" : errno_string));
+  snprintf(extended_format, sizeof(extended_format) - 1, "WARNING: %s <last errno = %d (%s)>", message_format, errno,
+           (errno_string == NULL ? "unknown" : errno_string));
   extended_format[sizeof(extended_format) - 1] = 0;
   vsnprintf(message, sizeof(message) - 1, extended_format, ap);
   message[sizeof(message) - 1] = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_error.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_error.h b/lib/ts/ink_error.h
index cd96d41..aa6f8d8 100644
--- a/lib/ts/ink_error.h
+++ b/lib/ts/ink_error.h
@@ -30,7 +30,7 @@
  ****************************************************************************/
 
 #ifndef _ink_error_h_
-#define	_ink_error_h_
+#define _ink_error_h_
 
 #include <stdarg.h>
 #include "ink_platform.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_exception.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_exception.h b/lib/ts/ink_exception.h
index 85b5d12..2a091f7 100644
--- a/lib/ts/ink_exception.h
+++ b/lib/ts/ink_exception.h
@@ -36,36 +36,36 @@ class Exception
 {
 };
 
-class OSException:public Exception
+class OSException : public Exception
 {
 };
 
-class IOException:public OSException
+class IOException : public OSException
 {
 };
 
-class FileOpenException:public IOException
+class FileOpenException : public IOException
 {
 };
-class FileStatException:public IOException
+class FileStatException : public IOException
 {
 };
-class FileSeekException:public IOException
+class FileSeekException : public IOException
 {
 };
-class FileReadException:public IOException
+class FileReadException : public IOException
 {
 };
-class FileWriteException:public IOException
+class FileWriteException : public IOException
 {
 };
-class FileCloseException:public IOException
+class FileCloseException : public IOException
 {
 };
 
-class MemoryMapException:public OSException
+class MemoryMapException : public OSException
 {
 };
-class MemoryUnmapException:public OSException
+class MemoryUnmapException : public OSException
 {
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_file.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_file.cc b/lib/ts/ink_file.cc
index 0294482..b810ba6 100644
--- a/lib/ts/ink_file.cc
+++ b/lib/ts/ink_file.cc
@@ -46,31 +46,30 @@
 #endif
 
 #if HAVE_LINUX_HDREG_H
-#include <linux/hdreg.h>        /* for struct hd_geometry */
+#include <linux/hdreg.h> /* for struct hd_geometry */
 #endif
 
 #if HAVE_LINUX_FS_H
-#include <linux/fs.h>           /* for BLKGETSIZE.  sys/mount.h is another candidate */
+#include <linux/fs.h> /* for BLKGETSIZE.  sys/mount.h is another candidate */
 #endif
 
 typedef union {
-  uint64_t  u64;
-  uint32_t  u32;
-  off_t     off;
+  uint64_t u64;
+  uint32_t u32;
+  off_t off;
 } ioctl_arg_t;
 
 int
-ink_fputln(FILE * stream, const char *s)
+ink_fputln(FILE *stream, const char *s)
 {
   if (stream && s) {
     int rc = fputs(s, stream);
     if (rc > 0)
       rc += fputc('\n', stream);
     return rc;
-  }
-  else
+  } else
     return -EINVAL;
-}                               /* End ink_fgets */
+} /* End ink_fgets */
 
 /*---------------------------------------------------------------------------*
 
@@ -98,22 +97,22 @@ ink_file_fd_readline(int fd, int bufsz, char *buf)
   int i = 0;
 
   if (bufsz < 2)
-    return (-EINVAL);           /* bufsz must by >= 2 */
+    return (-EINVAL); /* bufsz must by >= 2 */
 
-  while (i < bufsz - 1) {       /* leave 1 byte for NUL */
-    int n = read(fd, &c, 1);    /* read 1 byte */
+  while (i < bufsz - 1) {    /* leave 1 byte for NUL */
+    int n = read(fd, &c, 1); /* read 1 byte */
     if (n == 0)
-      break;                    /* EOF */
+      break; /* EOF */
     if (n < 0)
-      return (n);               /* error */
-    buf[i++] = c;               /* store in buffer */
+      return (n); /* error */
+    buf[i++] = c; /* store in buffer */
     if (c == '\n')
-      break;                    /* stop if stored a LF */
+      break; /* stop if stored a LF */
   }
 
-  buf[i] = '\0';                /* NUL terminate buffer */
-  return (i);                   /* number of bytes read */
-}                               /* End ink_file_fd_readline */
+  buf[i] = '\0'; /* NUL terminate buffer */
+  return (i);    /* number of bytes read */
+} /* End ink_file_fd_readline */
 
 /* Write until NUL */
 int
@@ -121,11 +120,11 @@ ink_file_fd_writestring(int fd, const char *buf)
 {
   int len, i = 0;
 
-  if (buf && (len = strlen(buf)) > 0 && (i = (int) write(fd, buf, (size_t) len) != len))
+  if (buf && (len = strlen(buf)) > 0 && (i = (int)write(fd, buf, (size_t)len) != len))
     i = -1;
 
-  return i;                     /* return chars written */
-}                               /* End ink_file_fd_writestring */
+  return i; /* return chars written */
+} /* End ink_file_fd_writestring */
 
 int
 ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *addpath, int flags)
@@ -158,8 +157,7 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
     //
     if (!rootpath && !(flags & INK_FILEPATH_NOTABOVEROOT))
       rootpath = "";
-  }
-  else {
+  } else {
     // If INK_FILEPATH_NOTABSOLUTE is specified, the caller
     // requires a relative result.  If the rootpath is
     // ommitted, we do not retrieve the working path,
@@ -169,7 +167,7 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
       if (!rootpath)
         rootpath = "";
       else if (rootpath[0] == '/')
-        return EISDIR; //APR_EABSOLUTE;
+        return EISDIR; // APR_EABSOLUTE;
     }
   }
   if (!rootpath) {
@@ -187,7 +185,7 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
                                           // root, and at end, plus trailing
                                           // null
   if (maxlen > (size_t)pathsz) {
-    return E2BIG; //APR_ENAMETOOLONG;
+    return E2BIG; // APR_ENAMETOOLONG;
   }
   if (addpath[0] == '/') {
     // Ignore the given root path, strip off leading
@@ -199,12 +197,11 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
       ++addpath;
     path[0] = '/';
     pathlen = 1;
-  }
-  else {
+  } else {
     // If both paths are relative, fail early
     //
     if (rootpath[0] != '/' && (flags & INK_FILEPATH_NOTRELATIVE))
-      return EBADF; //APR_ERELATIVE;
+      return EBADF; // APR_ERELATIVE;
 
     // Base the result path on the rootpath
     //
@@ -231,32 +228,27 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
     if (seglen == 0 || (seglen == 1 && addpath[0] == '.')) {
       // noop segment (/ or ./) so skip it
       //
-    }
-    else if (seglen == 2 && addpath[0] == '.' && addpath[1] == '.') {
+    } else if (seglen == 2 && addpath[0] == '.' && addpath[1] == '.') {
       // backpath (../)
       if (pathlen == 1 && path[0] == '/') {
         // Attempt to move above root.  Always die if the
         // INK_FILEPATH_SECUREROOTTEST flag is specified.
         //
         if (flags & INK_FILEPATH_SECUREROOTTEST) {
-          return EACCES; //APR_EABOVEROOT;
+          return EACCES; // APR_EABOVEROOT;
         }
 
         // Otherwise this is simply a noop, above root is root.
         // Flag that rootpath was entirely replaced.
         //
         keptlen = 0;
-      }
-      else if (pathlen == 0
-               || (pathlen == 3
-               && !memcmp(path + pathlen - 3, "../", 3))
-               || (pathlen  > 3
-               && !memcmp(path + pathlen - 4, "/../", 4))) {
+      } else if (pathlen == 0 || (pathlen == 3 && !memcmp(path + pathlen - 3, "../", 3)) ||
+                 (pathlen > 3 && !memcmp(path + pathlen - 4, "/../", 4))) {
         // Path is already backpathed or empty, if the
         // INK_FILEPATH_SECUREROOTTEST.was given die now.
         //
         if (flags & INK_FILEPATH_SECUREROOTTEST) {
-          return EACCES; //APR_EABOVEROOT;
+          return EACCES; // APR_EABOVEROOT;
         }
 
         // Otherwise append another backpath, including
@@ -264,12 +256,11 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
         //
         memcpy(path + pathlen, "../", *next ? 3 : 2);
         pathlen += *next ? 3 : 2;
-      }
-      else {
+      } else {
         // otherwise crop the prior segment
         //
         do {
-            --pathlen;
+          --pathlen;
         } while (pathlen && path[pathlen - 1] != '/');
       }
 
@@ -278,14 +269,13 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
       //
       if (pathlen < keptlen) {
         if (flags & INK_FILEPATH_SECUREROOTTEST) {
-          return EACCES; //APR_EABOVEROOT;
+          return EACCES; // APR_EABOVEROOT;
         }
         keptlen = pathlen;
       }
-    }
-    else {
-        // An actual segment, append it to the destination path
-        //
+    } else {
+      // An actual segment, append it to the destination path
+      //
       if (*next) {
         seglen++;
       }
@@ -319,11 +309,10 @@ ink_filepath_merge(char *path, int pathsz, const char *rootpath, const char *add
   //
   if ((flags & INK_FILEPATH_NOTABOVEROOT) && keptlen < rootlen) {
     if (strncmp(rootpath, path, rootlen)) {
-      return EACCES; //APR_EABOVEROOT;
+      return EACCES; // APR_EABOVEROOT;
     }
-    if (rootpath[rootlen - 1] != '/'
-        && path[rootlen] && path[rootlen] != '/') {
-      return EACCES; //APR_EABOVEROOT;
+    if (rootpath[rootlen - 1] != '/' && path[rootlen] && path[rootlen] != '/') {
+      return EACCES; // APR_EABOVEROOT;
     }
   }
 
@@ -352,7 +341,7 @@ ink_filepath_make(char *path, int pathsz, const char *rootpath, const char *addp
     return 0;
   }
   rootlen = strlen(rootpath);
-  maxlen  = strlen(addpath) + 2;
+  maxlen = strlen(addpath) + 2;
   if (maxlen > (size_t)pathsz) {
     *path = '\0';
     return (int)maxlen;
@@ -376,8 +365,8 @@ ink_file_fd_zerofill(int fd, off_t size)
     return errno;
   }
 
-  // ZFS does not implement posix_fallocate() and fails with EINVAL. As a general workaround,
-  // just fall back to ftrucate if the preallocation fails.
+// ZFS does not implement posix_fallocate() and fails with EINVAL. As a general workaround,
+// just fall back to ftrucate if the preallocation fails.
 #if HAVE_POSIX_FALLOCATE
   if (posix_fallocate(fd, 0, size) == 0) {
     return 0;
@@ -392,7 +381,7 @@ ink_file_fd_zerofill(int fd, off_t size)
 }
 
 bool
-ink_file_is_directory(const char * path)
+ink_file_is_directory(const char *path)
 {
   struct stat sbuf;
 
@@ -429,18 +418,17 @@ ink_file_is_mmappable(mode_t st_mode)
 #endif
 
   return false;
-
 }
 
 bool
-ink_file_get_geometry(int fd ATS_UNUSED, ink_device_geometry& geometry)
+ink_file_get_geometry(int fd ATS_UNUSED, ink_device_geometry &geometry)
 {
   ink_zero(geometry);
 
 #if defined(freebsd) || defined(darwin) || defined(openbsd)
   ioctl_arg_t arg ATS_UNUSED;
 
-  // These IOCTLs are standard across the BSD family; Darwin has a different set though.
+// These IOCTLs are standard across the BSD family; Darwin has a different set though.
 #if defined(DIOCGMEDIASIZE)
   if (ioctl(fd, DIOCGMEDIASIZE, &arg.off) == 0) {
     geometry.totalsz = arg.off;
@@ -506,7 +494,7 @@ ink_file_get_geometry(int fd ATS_UNUSED, ink_device_geometry& geometry)
 }
 
 size_t
-ink_file_namemax(const char * path)
+ink_file_namemax(const char *path)
 {
   long namemax = pathconf(path, _PC_NAME_MAX);
   if (namemax > 0) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_file.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_file.h b/lib/ts/ink_file.h
index 41f3f96..fa4e161 100644
--- a/lib/ts/ink_file.h
+++ b/lib/ts/ink_file.h
@@ -30,7 +30,7 @@
  ****************************************************************************/
 
 #ifndef _ink_file_h_
-#define	_ink_file_h_
+#define _ink_file_h_
 
 #include "ink_config.h"
 
@@ -59,39 +59,37 @@
 
 // Cause ink_filepath_merge to fail if addpath is above rootpath
 //
-#define INK_FILEPATH_NOTABOVEROOT   0x01
+#define INK_FILEPATH_NOTABOVEROOT 0x01
 // internal: Only meaningful with INK_FILEPATH_NOTABOVEROOT
 #define INK_FILEPATH_SECUREROOTTEST 0x02
 // Cause ink_filepath_merge to fail if addpath is above rootpath,
 // even given a rootpath /foo/bar and an addpath ../bar/bash
 //
-#define INK_FILEPATH_SECUREROOT     0x03
+#define INK_FILEPATH_SECUREROOT 0x03
 // Fail ink_filepath_merge if the merged path is relative
-#define INK_FILEPATH_NOTRELATIVE    0x04
+#define INK_FILEPATH_NOTRELATIVE 0x04
 // Fail ink_filepath_merge if the merged path is absolute
-#define INK_FILEPATH_NOTABSOLUTE    0x08
+#define INK_FILEPATH_NOTABSOLUTE 0x08
 // Return the file system's native path format (e.g. path delimiters
 // of ':' on MacOS9, '\' on Win32, etc.)
-#define INK_FILEPATH_NATIVE         0x10
+#define INK_FILEPATH_NATIVE 0x10
 // Resolve the true case of existing directories and file elements
 // of addpath, (resolving any aliases on Win32) and append a proper
 // trailing slash if a directory
 //
-#define INK_FILEPATH_TRUENAME       0x20
+#define INK_FILEPATH_TRUENAME 0x20
 
 int ink_fputln(FILE *stream, const char *s);
 int ink_file_fd_readline(int fd, int bufsize, char *buf);
 int ink_file_fd_writestring(int fd, const char *buf);
-int ink_filepath_merge(char *buf, int bufsz, const char *rootpath,
-                       const char *addpath, int flags = INK_FILEPATH_TRUENAME);
+int ink_filepath_merge(char *buf, int bufsz, const char *rootpath, const char *addpath, int flags = INK_FILEPATH_TRUENAME);
 /**
  Add addpath to the rootpath prepending slash if rootpath
  is not NULL and doesn't end with the slash already and put the
  result into path buffer. If the buffer is too small to hold the
  resulting string, required size is returned. On success zero is returned
  */
-int ink_filepath_make(char *path, int pathsz, const char *rootpath,
-                      const char *addpath);
+int ink_filepath_make(char *path, int pathsz, const char *rootpath, const char *addpath);
 
 /**
  Resize and zero-fill the given file.
@@ -102,34 +100,35 @@ int ink_file_fd_zerofill(int fd, off_t size);
 /**
  Return true if the path is a directory.
  */
-bool ink_file_is_directory(const char * path);
+bool ink_file_is_directory(const char *path);
 
 /**
  Return true if this file type can be mmap(2)'ed.
  */
 bool ink_file_is_mmappable(mode_t st_mode);
 
-struct ink_device_geometry
-{
-  uint64_t  totalsz;  // Total device size in bytes.
-  unsigned  blocksz;  // Preferred I/O block size.
-  unsigned  alignsz;  // Block device alignment in bytes. Only relevant with stacked block devices.
+struct ink_device_geometry {
+  uint64_t totalsz; // Total device size in bytes.
+  unsigned blocksz; // Preferred I/O block size.
+  unsigned alignsz; // Block device alignment in bytes. Only relevant with stacked block devices.
 };
 
-bool ink_file_get_geometry(int fd, ink_device_geometry& geometry);
+bool ink_file_get_geometry(int fd, ink_device_geometry &geometry);
 
 // Return the value of pathconf(path, _PC_NAME_MAX), or the closest approximation.
-size_t ink_file_namemax(const char * path);
+size_t ink_file_namemax(const char *path);
 
 // Is the given path "."?
 static inline bool
-isdot(const char * path) {
+isdot(const char *path)
+{
   return path[0] == '.' && path[1] == '\0';
 }
 
 // Is the given path ".."?
 static inline bool
-isdotdot(const char * path) {
+isdotdot(const char *path)
+{
   return path[0] == '.' && path[1] == '.' && path[2] == '\0';
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_hash_table.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_hash_table.cc b/lib/ts/ink_hash_table.cc
index e76a500..3ba691b 100644
--- a/lib/ts/ink_hash_table.cc
+++ b/lib/ts/ink_hash_table.cc
@@ -58,7 +58,7 @@ ink_hash_table_create(InkHashTableKeyType key_type)
   Tcl_HashTable *tcl_ht_ptr;
   int tcl_key_type;
 
-  tcl_ht_ptr = (Tcl_HashTable*)ats_malloc(sizeof(Tcl_HashTable));
+  tcl_ht_ptr = (Tcl_HashTable *)ats_malloc(sizeof(Tcl_HashTable));
 
   if (key_type == InkHashTableKeyType_String)
     tcl_key_type = TCL_STRING_KEYS;
@@ -69,9 +69,9 @@ ink_hash_table_create(InkHashTableKeyType key_type)
 
   Tcl_InitHashTable(tcl_ht_ptr, tcl_key_type);
 
-  ht_ptr = (InkHashTable *) tcl_ht_ptr;
+  ht_ptr = (InkHashTable *)tcl_ht_ptr;
   return (ht_ptr);
-}                               /* End ink_hash_table_create */
+} /* End ink_hash_table_create */
 
 
 /*---------------------------------------------------------------------------*
@@ -83,15 +83,15 @@ ink_hash_table_create(InkHashTableKeyType key_type)
  *---------------------------------------------------------------------------*/
 
 InkHashTable *
-ink_hash_table_destroy(InkHashTable * ht_ptr)
+ink_hash_table_destroy(InkHashTable *ht_ptr)
 {
   Tcl_HashTable *tcl_ht_ptr;
 
-  tcl_ht_ptr = (Tcl_HashTable *) ht_ptr;
+  tcl_ht_ptr = (Tcl_HashTable *)ht_ptr;
   Tcl_DeleteHashTable(tcl_ht_ptr);
   ats_free(tcl_ht_ptr);
-  return (InkHashTable *) 0;
-}                               /* End ink_hash_table_destroy */
+  return (InkHashTable *)0;
+} /* End ink_hash_table_destroy */
 
 
 /*---------------------------------------------------------------------------*
@@ -105,7 +105,7 @@ ink_hash_table_destroy(InkHashTable * ht_ptr)
  *---------------------------------------------------------------------------*/
 
 static int
-_ink_hash_table_free_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * e)
+_ink_hash_table_free_entry_value(InkHashTable *ht_ptr, InkHashTableEntry *e)
 {
   InkHashTableValue value;
 
@@ -115,11 +115,11 @@ _ink_hash_table_free_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * e)
   }
 
   return (0);
-}                               /* End _ink_hash_table_free_entry_value */
+} /* End _ink_hash_table_free_entry_value */
 
 
 static int
-_ink_hash_table_xfree_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * e)
+_ink_hash_table_xfree_entry_value(InkHashTable *ht_ptr, InkHashTableEntry *e)
 {
   InkHashTableValue value;
 
@@ -129,23 +129,23 @@ _ink_hash_table_xfree_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * e)
   }
 
   return (0);
-}                               /* End _ink_hash_table_xfree_entry_value */
+} /* End _ink_hash_table_xfree_entry_value */
 
 InkHashTable *
-ink_hash_table_destroy_and_free_values(InkHashTable * ht_ptr)
+ink_hash_table_destroy_and_free_values(InkHashTable *ht_ptr)
 {
   ink_hash_table_map(ht_ptr, _ink_hash_table_free_entry_value);
   ink_hash_table_destroy(ht_ptr);
-  return (InkHashTable *) 0;
-}                               /* End ink_hash_table_destroy_and_free_values */
+  return (InkHashTable *)0;
+} /* End ink_hash_table_destroy_and_free_values */
 
 InkHashTable *
-ink_hash_table_destroy_and_xfree_values(InkHashTable * ht_ptr)
+ink_hash_table_destroy_and_xfree_values(InkHashTable *ht_ptr)
 {
   ink_hash_table_map(ht_ptr, _ink_hash_table_xfree_entry_value);
   ink_hash_table_destroy(ht_ptr);
-  return (InkHashTable *) 0;
-}                               /* End ink_hash_table_destroy_and_xfree_values */
+  return (InkHashTable *)0;
+} /* End ink_hash_table_destroy_and_xfree_values */
 
 
 /*---------------------------------------------------------------------------*
@@ -158,19 +158,19 @@ ink_hash_table_destroy_and_xfree_values(InkHashTable * ht_ptr)
  *---------------------------------------------------------------------------*/
 
 int
-ink_hash_table_isbound(InkHashTable * ht_ptr, const char *key)
+ink_hash_table_isbound(InkHashTable *ht_ptr, const char *key)
 {
   InkHashTableEntry *he_ptr;
 
   he_ptr = ink_hash_table_lookup_entry(ht_ptr, key);
   return ((he_ptr == NULL) ? 0 : 1);
-}                               /* End ink_hash_table_isbound */
+} /* End ink_hash_table_isbound */
 
 
 /*---------------------------------------------------------------------------*
   int ink_hash_table_lookup(InkHashTable *ht_ptr,
-		            InkHashTableKey key,
-			    InkHashTableValue *value_ptr)
+                            InkHashTableKey key,
+                            InkHashTableValue *value_ptr)
 
   This routine takes a hash table <ht_ptr>, a key <key>, and stores the
   value bound to the key by reference through <value_ptr>.  If no binding is
@@ -179,7 +179,7 @@ ink_hash_table_isbound(InkHashTable * ht_ptr, const char *key)
  *---------------------------------------------------------------------------*/
 
 int
-ink_hash_table_lookup(InkHashTable *ht_ptr, const char* key, InkHashTableValue *value_ptr)
+ink_hash_table_lookup(InkHashTable *ht_ptr, const char *key, InkHashTableValue *value_ptr)
 {
   InkHashTableEntry *he_ptr;
   InkHashTableValue value;
@@ -191,7 +191,7 @@ ink_hash_table_lookup(InkHashTable *ht_ptr, const char* key, InkHashTableValue *
   value = ink_hash_table_entry_value(ht_ptr, he_ptr);
   *value_ptr = value;
   return (1);
-}                               /* End ink_hash_table_lookup */
+} /* End ink_hash_table_lookup */
 
 
 /*---------------------------------------------------------------------------*
@@ -205,14 +205,14 @@ ink_hash_table_lookup(InkHashTable *ht_ptr, const char* key, InkHashTableValue *
  *---------------------------------------------------------------------------*/
 
 int
-ink_hash_table_delete(InkHashTable * ht_ptr, const char *key)
+ink_hash_table_delete(InkHashTable *ht_ptr, const char *key)
 {
   char *tcl_key;
   Tcl_HashTable *tcl_ht_ptr;
   Tcl_HashEntry *tcl_he_ptr;
 
-  tcl_key = (char *) key;
-  tcl_ht_ptr = (Tcl_HashTable *) ht_ptr;
+  tcl_key = (char *)key;
+  tcl_ht_ptr = (Tcl_HashTable *)ht_ptr;
   tcl_he_ptr = Tcl_FindHashEntry(tcl_ht_ptr, tcl_key);
 
   if (!tcl_he_ptr)
@@ -220,13 +220,13 @@ ink_hash_table_delete(InkHashTable * ht_ptr, const char *key)
   Tcl_DeleteHashEntry(tcl_he_ptr);
 
   return (1);
-}                               /* End ink_hash_table_delete */
+} /* End ink_hash_table_delete */
 
 
 /*---------------------------------------------------------------------------*
 
   InkHashTableEntry *ink_hash_table_lookup_entry(InkHashTable *ht_ptr,
-  						 InkHashTableKey key)
+                                                 InkHashTableKey key)
 
   This routine takes a hash table <ht_ptr> and a key <key>, and returns the
   entry matching the key, or NULL otherwise.
@@ -234,25 +234,25 @@ ink_hash_table_delete(InkHashTable * ht_ptr, const char *key)
  *---------------------------------------------------------------------------*/
 
 InkHashTableEntry *
-ink_hash_table_lookup_entry(InkHashTable * ht_ptr, const char* key)
+ink_hash_table_lookup_entry(InkHashTable *ht_ptr, const char *key)
 {
   Tcl_HashTable *tcl_ht_ptr;
   Tcl_HashEntry *tcl_he_ptr;
   InkHashTableEntry *he_ptr;
 
-  tcl_ht_ptr = (Tcl_HashTable *) ht_ptr;
+  tcl_ht_ptr = (Tcl_HashTable *)ht_ptr;
   tcl_he_ptr = Tcl_FindHashEntry(tcl_ht_ptr, key);
-  he_ptr = (InkHashTableEntry *) tcl_he_ptr;
+  he_ptr = (InkHashTableEntry *)tcl_he_ptr;
 
   return (he_ptr);
-}                               /* End ink_hash_table_lookup_entry */
+} /* End ink_hash_table_lookup_entry */
 
 
 /*---------------------------------------------------------------------------*
 
   InkHashTableEntry *ink_hash_table_get_entry(InkHashTable *ht_ptr,
-					      InkHashTableKey key,
-					      int *new_value)
+                                              InkHashTableKey key,
+                                              int *new_value)
 
   This routine takes a hash table <ht_ptr> and a key <key>, and returns the
   entry matching the key, or creates, binds, and returns a new entry.
@@ -266,22 +266,22 @@ ink_hash_table_get_entry(InkHashTable *ht_ptr, const char *key, int *new_value)
   Tcl_HashTable *tcl_ht_ptr;
   Tcl_HashEntry *tcl_he_ptr;
 
-  tcl_ht_ptr = (Tcl_HashTable *) ht_ptr;
+  tcl_ht_ptr = (Tcl_HashTable *)ht_ptr;
   tcl_he_ptr = Tcl_CreateHashEntry(tcl_ht_ptr, key, new_value);
 
   if (tcl_he_ptr == NULL) {
     ink_fatal("%s: Tcl_CreateHashEntry returned NULL", "ink_hash_table_get_entry");
   }
 
-  return ((InkHashTableEntry *) tcl_he_ptr);
-}                               /* End ink_hash_table_get_entry */
+  return ((InkHashTableEntry *)tcl_he_ptr);
+} /* End ink_hash_table_get_entry */
 
 
 /*---------------------------------------------------------------------------*
 
   void ink_hash_table_set_entry(InkHashTable *ht_ptr,
-				InkHashTableEntry *he_ptr,
-				InkHashTableValue value)
+                                InkHashTableEntry *he_ptr,
+                                InkHashTableValue value)
 
   This routine takes a hash table <ht_ptr>, a hash table entry <he_ptr>,
   and changes the value field of the entry to <value>.
@@ -289,23 +289,23 @@ ink_hash_table_get_entry(InkHashTable *ht_ptr, const char *key, int *new_value)
  *---------------------------------------------------------------------------*/
 
 void
-ink_hash_table_set_entry(InkHashTable * ht_ptr, InkHashTableEntry * he_ptr, InkHashTableValue value)
+ink_hash_table_set_entry(InkHashTable *ht_ptr, InkHashTableEntry *he_ptr, InkHashTableValue value)
 {
-  (void) ht_ptr;
+  (void)ht_ptr;
   ClientData tcl_value;
   Tcl_HashEntry *tcl_he_ptr;
 
-  tcl_value = (ClientData) value;
-  tcl_he_ptr = (Tcl_HashEntry *) he_ptr;
+  tcl_value = (ClientData)value;
+  tcl_he_ptr = (Tcl_HashEntry *)he_ptr;
   Tcl_SetHashValue(tcl_he_ptr, tcl_value);
-}                               /* End ink_hash_table_set_entry */
+} /* End ink_hash_table_set_entry */
 
 
 /*---------------------------------------------------------------------------*
 
   void ink_hash_table_insert(InkHashTable *ht_ptr,
-			     InkHashTableKey key,
-			     InkHashTableValue value)
+                             InkHashTableKey key,
+                             InkHashTableValue value)
 
   This routine takes a hash table <ht_ptr>, a key <key>, and binds the value
   <value> to the key, replacing any previous binding, if any.
@@ -313,14 +313,14 @@ ink_hash_table_set_entry(InkHashTable * ht_ptr, InkHashTableEntry * he_ptr, InkH
  *---------------------------------------------------------------------------*/
 
 void
-ink_hash_table_insert(InkHashTable * ht_ptr, const char *key, InkHashTableValue value)
+ink_hash_table_insert(InkHashTable *ht_ptr, const char *key, InkHashTableValue value)
 {
   int new_value;
   InkHashTableEntry *he_ptr;
 
   he_ptr = ink_hash_table_get_entry(ht_ptr, key, &new_value);
   ink_hash_table_set_entry(ht_ptr, he_ptr, value);
-}                               /* End ink_hash_table_insert */
+} /* End ink_hash_table_insert */
 
 
 /*---------------------------------------------------------------------------*
@@ -334,24 +334,24 @@ ink_hash_table_insert(InkHashTable * ht_ptr, const char *key, InkHashTableValue
  *---------------------------------------------------------------------------*/
 
 void
-ink_hash_table_map(InkHashTable * ht_ptr, InkHashTableEntryFunction map)
+ink_hash_table_map(InkHashTable *ht_ptr, InkHashTableEntryFunction map)
 {
   int retcode;
   InkHashTableEntry *e;
   InkHashTableIteratorState state;
 
   for (e = ink_hash_table_iterator_first(ht_ptr, &state); e != NULL; e = ink_hash_table_iterator_next(ht_ptr, &state)) {
-    retcode = (*map) (ht_ptr, e);
+    retcode = (*map)(ht_ptr, e);
     if (retcode != 0)
       break;
   }
-}                               /* End ink_hash_table_map */
+} /* End ink_hash_table_map */
 
 
 /*---------------------------------------------------------------------------*
 
   InkHashTableKey ink_hash_table_entry_key(InkHashTable *ht_ptr,
-			                   InkHashTableEntry *entry_ptr)
+                                           InkHashTableEntry *entry_ptr)
 
   This routine takes a hash table <ht_ptr> and a pointer to a hash table
   entry <entry_ptr>, and returns the key portion of the entry.
@@ -359,19 +359,19 @@ ink_hash_table_map(InkHashTable * ht_ptr, InkHashTableEntryFunction map)
  *---------------------------------------------------------------------------*/
 
 InkHashTableKey
-ink_hash_table_entry_key(InkHashTable * ht_ptr, InkHashTableEntry * entry_ptr)
+ink_hash_table_entry_key(InkHashTable *ht_ptr, InkHashTableEntry *entry_ptr)
 {
   char *tcl_key;
 
-  tcl_key = (char*) Tcl_GetHashKey((Tcl_HashTable *) ht_ptr, (Tcl_HashEntry *) entry_ptr);
-  return ((InkHashTableKey) tcl_key);
-}                               /* End ink_hash_table_entry_key */
+  tcl_key = (char *)Tcl_GetHashKey((Tcl_HashTable *)ht_ptr, (Tcl_HashEntry *)entry_ptr);
+  return ((InkHashTableKey)tcl_key);
+} /* End ink_hash_table_entry_key */
 
 
 /*---------------------------------------------------------------------------*
 
   InkHashTableValue ink_hash_table_entry_value(InkHashTable *ht_ptr,
-			                       InkHashTableEntry *entry_ptr)
+                                               InkHashTableEntry *entry_ptr)
 
   This routine takes a hash table <ht_ptr> and a pointer to a hash table
   entry <entry_ptr>, and returns the value portion of the entry.
@@ -379,15 +379,14 @@ ink_hash_table_entry_key(InkHashTable * ht_ptr, InkHashTableEntry * entry_ptr)
  *---------------------------------------------------------------------------*/
 
 InkHashTableValue
-ink_hash_table_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * entry_ptr)
+ink_hash_table_entry_value(InkHashTable *ht_ptr, InkHashTableEntry *entry_ptr)
 {
-  (void) ht_ptr;
+  (void)ht_ptr;
   ClientData tcl_value;
 
-  tcl_value = Tcl_GetHashValue((Tcl_HashEntry *) entry_ptr);
-  return ((InkHashTableValue) tcl_value);
-}                               /* End ink_hash_table_entry_value */
-
+  tcl_value = Tcl_GetHashValue((Tcl_HashEntry *)entry_ptr);
+  return ((InkHashTableValue)tcl_value);
+} /* End ink_hash_table_entry_value */
 
 
 /*---------------------------------------------------------------------------*
@@ -401,7 +400,7 @@ ink_hash_table_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * entry_ptr)
  *---------------------------------------------------------------------------*/
 
 static int
-DumpStringEntry(InkHashTable * ht_ptr, InkHashTableEntry * e)
+DumpStringEntry(InkHashTable *ht_ptr, InkHashTableEntry *e)
 {
   InkHashTableKey key;
   InkHashTableValue value;
@@ -409,23 +408,23 @@ DumpStringEntry(InkHashTable * ht_ptr, InkHashTableEntry * e)
   key = ink_hash_table_entry_key(ht_ptr, e);
   value = ink_hash_table_entry_value(ht_ptr, e);
 
-  fprintf(stderr, "key = '%s', value = '%s'\n", (char *) key, (char *) value);
+  fprintf(stderr, "key = '%s', value = '%s'\n", (char *)key, (char *)value);
 
   return (0);
 }
 
 
 void
-ink_hash_table_dump_strings(InkHashTable * ht_ptr)
+ink_hash_table_dump_strings(InkHashTable *ht_ptr)
 {
   ink_hash_table_map(ht_ptr, DumpStringEntry);
-}                               /* End ink_hash_table_dump_strings */
+} /* End ink_hash_table_dump_strings */
 
 
 /*---------------------------------------------------------------------------*
 
   void ink_hash_table_replace_string(InkHashTable *ht_ptr,
-				     char *string_key, char *string_value)
+                                     char *string_key, char *string_value)
 
   This conveninece routine is intended for hash tables with keys of type
   InkHashTableKeyType_String, and values being dynamically allocated strings.
@@ -435,7 +434,7 @@ ink_hash_table_dump_strings(InkHashTable * ht_ptr)
  *---------------------------------------------------------------------------*/
 
 void
-ink_hash_table_replace_string(InkHashTable * ht_ptr, char *string_key, char *string_value)
+ink_hash_table_replace_string(InkHashTable *ht_ptr, char *string_key, char *string_value)
 {
   int new_value;
   char *old_str;
@@ -447,12 +446,12 @@ ink_hash_table_replace_string(InkHashTable * ht_ptr, char *string_key, char *str
    * still dealing with pointers, and we aren't loosing any bits.
    */
 
-  he_ptr = ink_hash_table_get_entry(ht_ptr, (InkHashTableKey) string_key, &new_value);
+  he_ptr = ink_hash_table_get_entry(ht_ptr, (InkHashTableKey)string_key, &new_value);
   if (new_value == 0) {
-    old_str = (char *) ink_hash_table_entry_value(ht_ptr, he_ptr);
+    old_str = (char *)ink_hash_table_entry_value(ht_ptr, he_ptr);
     if (old_str)
       ats_free(old_str);
   }
 
   ink_hash_table_set_entry(ht_ptr, he_ptr, (InkHashTableValue)(ats_strdup(string_value)));
-}                               /* End ink_hash_table_replace_string */
+} /* End ink_hash_table_replace_string */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_hash_table.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_hash_table.h b/lib/ts/ink_hash_table.h
index ec3dc56..2894858 100644
--- a/lib/ts/ink_hash_table.h
+++ b/lib/ts/ink_hash_table.h
@@ -31,12 +31,11 @@
  ****************************************************************************/
 
 #ifndef _ink_hash_table_h_
-#define	_ink_hash_table_h_
+#define _ink_hash_table_h_
 
 #ifdef __cplusplus
-extern "C"
-{
-#endif                          /* __cplusplus */
+extern "C" {
+#endif /* __cplusplus */
 #include "ink_apidefs.h"
 
 /*===========================================================================*
@@ -47,19 +46,20 @@ extern "C"
 
 #include <tcl.h>
 
-  typedef Tcl_HashTable InkHashTable;
-  typedef Tcl_HashEntry InkHashTableEntry;
-  typedef char *InkHashTableKey;
-  typedef ClientData InkHashTableValue;
-  typedef Tcl_HashSearch InkHashTableIteratorState;
+typedef Tcl_HashTable InkHashTable;
+typedef Tcl_HashEntry InkHashTableEntry;
+typedef char *InkHashTableKey;
+typedef ClientData InkHashTableValue;
+typedef Tcl_HashSearch InkHashTableIteratorState;
 
-  typedef int (*InkHashTableEntryFunction) (InkHashTable * ht, InkHashTableEntry * entry);
+typedef int (*InkHashTableEntryFunction)(InkHashTable *ht, InkHashTableEntry *entry);
 
-  /* Types of InkHashTable Keys */
+/* Types of InkHashTable Keys */
 
-  typedef enum
-  { InkHashTableKeyType_String, InkHashTableKeyType_Word }
-  InkHashTableKeyType;
+typedef enum {
+  InkHashTableKeyType_String,
+  InkHashTableKeyType_Word,
+} InkHashTableKeyType;
 
 /*===========================================================================*
 
@@ -67,29 +67,29 @@ extern "C"
 
  *===========================================================================*/
 
-  InkHashTable *ink_hash_table_create(InkHashTableKeyType key_type);
-  InkHashTable *ink_hash_table_destroy(InkHashTable * ht_ptr);
-  InkHashTable *ink_hash_table_destroy_and_free_values(InkHashTable * ht_ptr);
-  InkHashTable *ink_hash_table_destroy_and_xfree_values(InkHashTable * ht_ptr);
-  inkcoreapi int ink_hash_table_isbound(InkHashTable * ht_ptr, const char *key);
-  inkcoreapi int ink_hash_table_lookup(InkHashTable * ht_ptr, const char *key, InkHashTableValue * value_ptr);
-  inkcoreapi int ink_hash_table_delete(InkHashTable * ht_ptr, const char *key);
-  InkHashTableEntry *ink_hash_table_lookup_entry(InkHashTable * ht_ptr, const char *key);
-  InkHashTableEntry *ink_hash_table_get_entry(InkHashTable * ht_ptr, const char *key, int *new_value);
-  void ink_hash_table_set_entry(InkHashTable * ht_ptr, InkHashTableEntry * he_ptr, InkHashTableValue value);
-  inkcoreapi void ink_hash_table_insert(InkHashTable * ht_ptr, const char *key, InkHashTableValue value);
-  void ink_hash_table_map(InkHashTable * ht_ptr, InkHashTableEntryFunction map);
-  InkHashTableKey ink_hash_table_entry_key(InkHashTable * ht_ptr, InkHashTableEntry * entry_ptr);
-  inkcoreapi InkHashTableValue ink_hash_table_entry_value(InkHashTable * ht_ptr, InkHashTableEntry * entry_ptr);
-  void ink_hash_table_dump_strings(InkHashTable * ht_ptr);
-  void ink_hash_table_replace_string(InkHashTable * ht_ptr, InkHashTableKey key, char *str);
+InkHashTable *ink_hash_table_create(InkHashTableKeyType key_type);
+InkHashTable *ink_hash_table_destroy(InkHashTable *ht_ptr);
+InkHashTable *ink_hash_table_destroy_and_free_values(InkHashTable *ht_ptr);
+InkHashTable *ink_hash_table_destroy_and_xfree_values(InkHashTable *ht_ptr);
+inkcoreapi int ink_hash_table_isbound(InkHashTable *ht_ptr, const char *key);
+inkcoreapi int ink_hash_table_lookup(InkHashTable *ht_ptr, const char *key, InkHashTableValue *value_ptr);
+inkcoreapi int ink_hash_table_delete(InkHashTable *ht_ptr, const char *key);
+InkHashTableEntry *ink_hash_table_lookup_entry(InkHashTable *ht_ptr, const char *key);
+InkHashTableEntry *ink_hash_table_get_entry(InkHashTable *ht_ptr, const char *key, int *new_value);
+void ink_hash_table_set_entry(InkHashTable *ht_ptr, InkHashTableEntry *he_ptr, InkHashTableValue value);
+inkcoreapi void ink_hash_table_insert(InkHashTable *ht_ptr, const char *key, InkHashTableValue value);
+void ink_hash_table_map(InkHashTable *ht_ptr, InkHashTableEntryFunction map);
+InkHashTableKey ink_hash_table_entry_key(InkHashTable *ht_ptr, InkHashTableEntry *entry_ptr);
+inkcoreapi InkHashTableValue ink_hash_table_entry_value(InkHashTable *ht_ptr, InkHashTableEntry *entry_ptr);
+void ink_hash_table_dump_strings(InkHashTable *ht_ptr);
+void ink_hash_table_replace_string(InkHashTable *ht_ptr, InkHashTableKey key, char *str);
 
 /* inline functions declarations */
 
 /*---------------------------------------------------------------------------*
 
   InkHashTableEntry *ink_hash_table_iterator_first
-	(InkHashTable *ht_ptr, InkHashTableIteratorState *state_ptr)
+        (InkHashTable *ht_ptr, InkHashTableIteratorState *state_ptr)
 
   This routine takes a hash table <ht_ptr>, creates some iterator state
   stored through <state_ptr>, and returns a pointer to the first hash table
@@ -98,28 +98,28 @@ extern "C"
 
  *---------------------------------------------------------------------------*/
 
-  static inline InkHashTableEntry *ink_hash_table_iterator_first
-    (InkHashTable * ht_ptr, InkHashTableIteratorState * state_ptr)
-  {
-    Tcl_HashTable *tcl_ht_ptr;
-    Tcl_HashSearch *tcl_search_state_ptr;
-    Tcl_HashEntry *tcl_he_ptr;
-    InkHashTableEntry *he_ptr;
+static inline InkHashTableEntry *
+ink_hash_table_iterator_first(InkHashTable *ht_ptr, InkHashTableIteratorState *state_ptr)
+{
+  Tcl_HashTable *tcl_ht_ptr;
+  Tcl_HashSearch *tcl_search_state_ptr;
+  Tcl_HashEntry *tcl_he_ptr;
+  InkHashTableEntry *he_ptr;
 
-      tcl_ht_ptr = (Tcl_HashTable *) ht_ptr;
-      tcl_search_state_ptr = (Tcl_HashSearch *) state_ptr;
+  tcl_ht_ptr = (Tcl_HashTable *)ht_ptr;
+  tcl_search_state_ptr = (Tcl_HashSearch *)state_ptr;
 
-      tcl_he_ptr = Tcl_FirstHashEntry(tcl_ht_ptr, tcl_search_state_ptr);
-      he_ptr = (InkHashTableEntry *) tcl_he_ptr;
+  tcl_he_ptr = Tcl_FirstHashEntry(tcl_ht_ptr, tcl_search_state_ptr);
+  he_ptr = (InkHashTableEntry *)tcl_he_ptr;
 
-      return (he_ptr);
-  }                             /* End ink_hash_table_iterator_first */
+  return (he_ptr);
+} /* End ink_hash_table_iterator_first */
 
 
 /*---------------------------------------------------------------------------*
 
   InkHashTableEntry *ink_hash_table_iterator_next(InkHashTable *ht_ptr,
-					          InkHashTableIteratorState *state_ptr)
+                                                  InkHashTableIteratorState *state_ptr)
 
   This routine takes a hash table <ht_ptr> and a pointer to iterator state
   initialized by a previous call to InkHashTableIteratorFirst(), and returns
@@ -127,21 +127,21 @@ extern "C"
 
  *---------------------------------------------------------------------------*/
 
-  static inline InkHashTableEntry *ink_hash_table_iterator_next(InkHashTable * ht_ptr,
-                                                                InkHashTableIteratorState * state_ptr)
-  {
-    (void) ht_ptr;
-    Tcl_HashSearch *tcl_search_state_ptr;
-    Tcl_HashEntry *tcl_he_ptr;
-    InkHashTableEntry *he_ptr;
+static inline InkHashTableEntry *
+ink_hash_table_iterator_next(InkHashTable *ht_ptr, InkHashTableIteratorState *state_ptr)
+{
+  (void)ht_ptr;
+  Tcl_HashSearch *tcl_search_state_ptr;
+  Tcl_HashEntry *tcl_he_ptr;
+  InkHashTableEntry *he_ptr;
 
-    tcl_search_state_ptr = (Tcl_HashSearch *) state_ptr;
+  tcl_search_state_ptr = (Tcl_HashSearch *)state_ptr;
 
-    tcl_he_ptr = Tcl_NextHashEntry(tcl_search_state_ptr);
-    he_ptr = (InkHashTableEntry *) tcl_he_ptr;
+  tcl_he_ptr = Tcl_NextHashEntry(tcl_search_state_ptr);
+  he_ptr = (InkHashTableEntry *)tcl_he_ptr;
 
-    return (he_ptr);
-  }                             /* End ink_hash_table_iterator_next */
+  return (he_ptr);
+} /* End ink_hash_table_iterator_next */
 
 #ifdef __cplusplus
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_hrtime.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_hrtime.cc b/lib/ts/ink_hrtime.cc
index 6d2870b..1da8d24 100644
--- a/lib/ts/ink_hrtime.cc
+++ b/lib/ts/ink_hrtime.cc
@@ -56,7 +56,7 @@ int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_
     out_buf = &buf[buf_size - 1];
   }
 
-  unsigned int num_chars = 1;   // includes eos
+  unsigned int num_chars = 1; // includes eos
   *out_buf-- = 0;
 
   if (val < 0) {
@@ -65,11 +65,11 @@ int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_
   }
 
   if (val < 10) {
-    *out_buf-- = '0' + (char) val;
+    *out_buf-- = '0' + (char)val;
     ++num_chars;
   } else {
     do {
-      *out_buf-- = (char) (val % 10) + '0';
+      *out_buf-- = (char)(val % 10) + '0';
       val /= 10;
       ++num_chars;
     } while (val);
@@ -99,14 +99,15 @@ int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_
         *--out_buf = pad_char;
         break;
       default:
-        for (unsigned int i = 0; i < num_padding; ++i, *--out_buf = pad_char);
+        for (unsigned int i = 0; i < num_padding; ++i, *--out_buf = pad_char)
+          ;
       }
       num_chars += num_padding;
     }
     // add minus sign if padding character is 0
     if (negative && pad_char == '0') {
       if (num_padding) {
-        *out_buf = '-';         // overwrite padding
+        *out_buf = '-'; // overwrite padding
       } else {
         *--out_buf = '-';
         ++num_chars;
@@ -154,13 +155,13 @@ squid_timestamp_to_buf(char *buf, unsigned int buf_size, long timestamp_sec, lon
   char ATS_UNUSED *ts_ms = int64_to_str(&tmp_buf[tmp_buf_size - 4], 4, ms, &num_chars_ms, 4, '0');
   ink_assert(ts_ms && num_chars_ms == 4);
 
-  unsigned int chars_to_write = num_chars_s + 3;        // no eos
+  unsigned int chars_to_write = num_chars_s + 3; // no eos
 
   if (buf_size >= chars_to_write) {
     memcpy(buf, ts_s, chars_to_write);
     res = chars_to_write;
   } else {
-    res = -((int) chars_to_write);
+    res = -((int)chars_to_write);
   }
 
   return res;
@@ -171,11 +172,11 @@ uint32_t
 init_hrtime_TCS()
 {
   int freqlen = sizeof(hrtime_freq);
-  if (sysctlbyname("machdep.tsc_freq", &hrtime_freq, (size_t *) & freqlen, NULL, 0) < 0) {
+  if (sysctlbyname("machdep.tsc_freq", &hrtime_freq, (size_t *)&freqlen, NULL, 0) < 0) {
     perror("sysctl: machdep.tsc_freq");
     exit(1);
   }
-  hrtime_freq_float = (double) 1000000000 / (double) hrtime_freq;
+  hrtime_freq_float = (double)1000000000 / (double)hrtime_freq;
   return hrtime_freq;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/ink_hrtime.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_hrtime.h b/lib/ts/ink_hrtime.h
index 8fb3300..e1db113 100644
--- a/lib/ts/ink_hrtime.h
+++ b/lib/ts/ink_hrtime.h
@@ -28,7 +28,7 @@
   This file contains code supporting the Inktomi high-resolution timer.
 **************************************************************************/
 
-#if !defined (_ink_hrtime_h_)
+#if !defined(_ink_hrtime_h_)
 #define _ink_hrtime_h_
 
 #include "ink_config.h"
@@ -39,7 +39,8 @@
 typedef int64_t ink_hrtime;
 
 int squid_timestamp_to_buf(char *buf, unsigned int buf_size, long timestamp_sec, long timestamp_usec);
-char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars, unsigned int req_width=0, char pad_char='0');
+char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars, unsigned int req_width = 0,
+                   char pad_char = '0');
 
 //////////////////////////////////////////////////////////////////////////////
 //
@@ -54,14 +55,14 @@ static inline ink_hrtime
 hrtime_rdtsc()
 {
   ink_hrtime rv;
-  asm volatile (".byte 0x0f, 0x31":"=A" (rv));
+  asm volatile(".byte 0x0f, 0x31" : "=A"(rv));
   return (rv);
 }
 static inline uint64_t
 get_hrtime_rdtsc()
 {
   // do it fixed point if you have better hardware support
-  return (uint64_t) (hrtime_freq_float * hrtime_rdtsc());
+  return (uint64_t)(hrtime_freq_float * hrtime_rdtsc());
 }
 #endif
 
@@ -71,20 +72,20 @@ get_hrtime_rdtsc()
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#define HRTIME_FOREVER  (10*HRTIME_DECADE)
-#define HRTIME_DECADE   (10*HRTIME_YEAR)
-#define HRTIME_YEAR     (365*HRTIME_DAY+HRTIME_DAY/4)
-#define HRTIME_WEEK     (7*HRTIME_DAY)
-#define HRTIME_DAY      (24*HRTIME_HOUR)
-#define HRTIME_HOUR     (60*HRTIME_MINUTE)
-#define HRTIME_MINUTE   (60*HRTIME_SECOND)
-#define HRTIME_SECOND   (1000*HRTIME_MSECOND)
-#define HRTIME_MSECOND  (1000*HRTIME_USECOND)
-#define HRTIME_USECOND  (1000*HRTIME_NSECOND)
-#define HRTIME_NSECOND	(1LL)
-
-#define HRTIME_APPROX_SECONDS(_x) ((_x)>>30)    // off by 7.3%
-#define HRTIME_APPROX_FACTOR      (((float)(1<<30))/(((float)HRTIME_SECOND)))
+#define HRTIME_FOREVER (10 * HRTIME_DECADE)
+#define HRTIME_DECADE (10 * HRTIME_YEAR)
+#define HRTIME_YEAR (365 * HRTIME_DAY + HRTIME_DAY / 4)
+#define HRTIME_WEEK (7 * HRTIME_DAY)
+#define HRTIME_DAY (24 * HRTIME_HOUR)
+#define HRTIME_HOUR (60 * HRTIME_MINUTE)
+#define HRTIME_MINUTE (60 * HRTIME_SECOND)
+#define HRTIME_SECOND (1000 * HRTIME_MSECOND)
+#define HRTIME_MSECOND (1000 * HRTIME_USECOND)
+#define HRTIME_USECOND (1000 * HRTIME_NSECOND)
+#define HRTIME_NSECOND (1LL)
+
+#define HRTIME_APPROX_SECONDS(_x) ((_x) >> 30) // off by 7.3%
+#define HRTIME_APPROX_FACTOR (((float)(1 << 30)) / (((float)HRTIME_SECOND)))
 
 //////////////////////////////////////////////////////////////////////////////
 //
@@ -94,12 +95,12 @@ get_hrtime_rdtsc()
 
 // simple macros
 
-#define HRTIME_YEARS(_x)    ((_x)*HRTIME_YEAR)
-#define HRTIME_WEEKS(_x)    ((_x)*HRTIME_WEEK)
-#define HRTIME_DAYS(_x)     ((_x)*HRTIME_DAY)
-#define HRTIME_HOURS(_x)    ((_x)*HRTIME_HOUR)
-#define HRTIME_MINUTES(_x)  ((_x)*HRTIME_MINUTE)
-#define HRTIME_SECONDS(_x)  ((_x)*HRTIME_SECOND)
+#define HRTIME_YEARS(_x) ((_x)*HRTIME_YEAR)
+#define HRTIME_WEEKS(_x) ((_x)*HRTIME_WEEK)
+#define HRTIME_DAYS(_x) ((_x)*HRTIME_DAY)
+#define HRTIME_HOURS(_x) ((_x)*HRTIME_HOUR)
+#define HRTIME_MINUTES(_x) ((_x)*HRTIME_MINUTE)
+#define HRTIME_SECONDS(_x) ((_x)*HRTIME_SECOND)
 #define HRTIME_MSECONDS(_x) ((_x)*HRTIME_MSECOND)
 #define HRTIME_USECONDS(_x) ((_x)*HRTIME_USECOND)
 #define HRTIME_NSECONDS(_x) ((_x)*HRTIME_NSECOND)
@@ -148,13 +149,13 @@ ink_hrtime_from_nsec(unsigned int nsec)
 }
 
 static inline ink_hrtime
-ink_hrtime_from_timespec(const struct timespec * ts)
+ink_hrtime_from_timespec(const struct timespec *ts)
 {
   return ink_hrtime_from_sec(ts->tv_sec) + ink_hrtime_from_nsec(ts->tv_nsec);
 }
 
 static inline ink_hrtime
-ink_hrtime_from_timeval(const struct timeval * tv)
+ink_hrtime_from_timeval(const struct timeval *tv)
 {
   return ink_hrtime_from_sec(tv->tv_sec) + ink_hrtime_from_usec(tv->tv_usec);
 }
@@ -168,42 +169,42 @@ ink_hrtime_from_timeval(const struct timeval * tv)
 static inline ink_hrtime
 ink_hrtime_to_years(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_YEAR));
+  return ((ink_hrtime)(t / HRTIME_YEAR));
 }
 static inline ink_hrtime
 ink_hrtime_to_weeks(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_WEEK));
+  return ((ink_hrtime)(t / HRTIME_WEEK));
 }
 static inline ink_hrtime
 ink_hrtime_to_days(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_DAY));
+  return ((ink_hrtime)(t / HRTIME_DAY));
 }
 static inline ink_hrtime
 ink_hrtime_to_mins(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_MINUTE));
+  return ((ink_hrtime)(t / HRTIME_MINUTE));
 }
 static inline ink_hrtime
 ink_hrtime_to_sec(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_SECOND));
+  return ((ink_hrtime)(t / HRTIME_SECOND));
 }
 static inline ink_hrtime
 ink_hrtime_to_msec(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_MSECOND));
+  return ((ink_hrtime)(t / HRTIME_MSECOND));
 }
 static inline ink_hrtime
 ink_hrtime_to_usec(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_USECOND));
+  return ((ink_hrtime)(t / HRTIME_USECOND));
 }
 static inline ink_hrtime
 ink_hrtime_to_nsec(ink_hrtime t)
 {
-  return ((ink_hrtime) (t / HRTIME_NSECOND));
+  return ((ink_hrtime)(t / HRTIME_NSECOND));
 }
 
 static inline struct timespec
@@ -247,7 +248,7 @@ ink_hrtime_to_timeval2(ink_hrtime t, struct timeval *tv)
 static inline ink_hrtime
 ink_get_hrtime_internal()
 {
-#if defined (USE_TIME_STAMP_COUNTER_HRTIME)
+#if defined(USE_TIME_STAMP_COUNTER_HRTIME)
   return get_hrtime_rdtsc();
 #elif defined(freebsd)
   timespec ts;
@@ -277,7 +278,6 @@ ink_get_based_hrtime_internal()
 }
 
 
-
 static inline struct timeval
 ink_gettimeofday()
 {
@@ -293,13 +293,13 @@ ink_gethrtimeofday(struct timeval *tp, void *)
 static inline int
 ink_time()
 {
-  return (int) ink_hrtime_to_sec(ink_get_based_hrtime_internal());
+  return (int)ink_hrtime_to_sec(ink_get_based_hrtime_internal());
 }
 
 static inline int
 ink_hrtime_diff_msec(ink_hrtime t1, ink_hrtime t2)
 {
-  return (int) ink_hrtime_to_msec(t1 - t2);
+  return (int)ink_hrtime_to_msec(t1 - t2);
 }
 
 static inline ink_hrtime


[45/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheDir.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index dde499a..779c16b 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -26,24 +26,27 @@
 
 // #define LOOP_CHECK_MODE 1
 #ifdef LOOP_CHECK_MODE
-#define DIR_LOOP_THRESHOLD	      1000
+#define DIR_LOOP_THRESHOLD 1000
 #endif
 #include "ink_stack_trace.h"
 
-#define CACHE_INC_DIR_USED(_m) do { \
-ProxyMutex *mutex = _m; \
-CACHE_INCREMENT_DYN_STAT(cache_direntries_used_stat); \
-} while (0) \
+#define CACHE_INC_DIR_USED(_m)                            \
+  do {                                                    \
+    ProxyMutex *mutex = _m;                               \
+    CACHE_INCREMENT_DYN_STAT(cache_direntries_used_stat); \
+  } while (0)
 
-#define CACHE_DEC_DIR_USED(_m) do { \
-ProxyMutex *mutex = _m; \
-CACHE_DECREMENT_DYN_STAT(cache_direntries_used_stat); \
-} while (0) \
+#define CACHE_DEC_DIR_USED(_m)                            \
+  do {                                                    \
+    ProxyMutex *mutex = _m;                               \
+    CACHE_DECREMENT_DYN_STAT(cache_direntries_used_stat); \
+  } while (0)
 
-#define CACHE_INC_DIR_COLLISIONS(_m) do {\
-ProxyMutex *mutex = _m; \
-CACHE_INCREMENT_DYN_STAT(cache_directory_collision_count_stat); \
-} while (0);
+#define CACHE_INC_DIR_COLLISIONS(_m)                                \
+  do {                                                              \
+    ProxyMutex *mutex = _m;                                         \
+    CACHE_INCREMENT_DYN_STAT(cache_directory_collision_count_stat); \
+  } while (0);
 
 
 // Globals
@@ -83,8 +86,7 @@ OpenDir::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
     }
     return 0;
   }
-  OpenDirEntry *od = THREAD_ALLOC(openDirEntryAllocator,
-                                  cont->mutex->thread_holding);
+  OpenDirEntry *od = THREAD_ALLOC(openDirEntryAllocator, cont->mutex->thread_holding);
   od->readers.head = NULL;
   od->writers.push(cont);
   od->num_writers = 1;
@@ -193,7 +195,7 @@ dir_bucket_loop_check(Dir *start_dir, Dir *seg)
       return 1;
 
     if (p2 == p1)
-      return 0;                 // we have a loop
+      return 0; // we have a loop
   }
   return 1;
 }
@@ -272,9 +274,12 @@ check_dir(Vol *d)
     Dir *seg = dir_segment(s, d);
     for (i = 0; i < d->buckets; i++) {
       Dir *b = dir_bucket(i, seg);
-      if (!(dir_bucket_length(b, s, d) >= 0)) return 0;
-      if (!(!dir_next(b) || dir_offset(b))) return 0;
-      if (!(dir_bucket_loop_check(b, seg))) return 0;
+      if (!(dir_bucket_length(b, s, d) >= 0))
+        return 0;
+      if (!(!dir_next(b) || dir_offset(b)))
+        return 0;
+      if (!(dir_bucket_loop_check(b, seg)))
+        return 0;
     }
   }
   return 1;
@@ -341,8 +346,8 @@ dir_clean_bucket(Dir *b, int s, Vol *vol)
 #endif
     if (!dir_valid(vol, e) || !dir_offset(e)) {
       if (is_debug_tag_set("dir_clean"))
-        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l %d",
-              e, dir_tag(e), dir_offset(e), b, p, dir_bucket_length(b, s, vol));
+        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l %d", e, dir_tag(e), dir_offset(e), b, p,
+              dir_bucket_length(b, s, vol));
       if (dir_offset(e))
         CACHE_DEC_DIR_USED(vol->mutex);
       e = dir_delete_entry(e, p, s, vol);
@@ -384,7 +389,7 @@ interim_dir_clean_bucket(Dir *b, int s, Vol *vol, int offset)
     }
     p = e;
     e = next_dir(e, seg);
-  } while(e);
+  } while (e);
 }
 
 void
@@ -416,8 +421,8 @@ dir_clean_bucket(Dir *b, int s, InterimCacheVol *d)
 #endif
     if (!dir_valid(d, e) || !dir_offset(e)) {
       if (is_debug_tag_set("dir_clean"))
-        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l %d",
-              e, dir_tag(e), dir_offset(e), b, p, dir_bucket_length(b, s, vol));
+        Debug("dir_clean", "cleaning %p tag %X boffset %" PRId64 " b %p p %p l %d", e, dir_tag(e), dir_offset(e), b, p,
+              dir_bucket_length(b, s, vol));
       if (dir_offset(e))
         CACHE_DEC_DIR_USED(vol->mutex);
       e = dir_delete_entry(e, p, s, vol);
@@ -452,10 +457,10 @@ dir_clean_range_interimvol(off_t start, off_t end, InterimCacheVol *svol)
 
   for (int i = 0; i < vol->buckets * DIR_DEPTH * vol->segments; i++) {
     Dir *e = dir_index(vol, i);
-    if (dir_ininterim(e) && dir_get_index(e) == offset && !dir_token(e) &&
-            dir_offset(e) >= (int64_t)start && dir_offset(e) < (int64_t)end) {
+    if (dir_ininterim(e) && dir_get_index(e) == offset && !dir_token(e) && dir_offset(e) >= (int64_t)start &&
+        dir_offset(e) < (int64_t)end) {
       CACHE_DEC_DIR_USED(vol->mutex);
-      dir_set_offset(e, 0);     // delete
+      dir_set_offset(e, 0); // delete
     }
   }
 
@@ -470,7 +475,7 @@ dir_clear_range(off_t start, off_t end, Vol *vol)
     Dir *e = dir_index(vol, i);
     if (!dir_token(e) && dir_offset(e) >= (int64_t)start && dir_offset(e) < (int64_t)end) {
       CACHE_DEC_DIR_USED(vol->mutex);
-      dir_set_offset(e, 0);     // delete
+      dir_set_offset(e, 0); // delete
     }
   }
   dir_clean_vol(vol);
@@ -503,7 +508,7 @@ freelist_clean(int s, Vol *vol)
       Dir *e = dir_bucket_row(b, l);
       if (dir_head(e) && !(n++ % 10)) {
         CACHE_DEC_DIR_USED(vol->mutex);
-        dir_set_offset(e, 0);   // delete
+        dir_set_offset(e, 0); // delete
       }
     }
   }
@@ -570,7 +575,7 @@ dir_segment_accounted(int s, Vol *d, int offby, int *f, int *u, int *et, int *v,
   if (av)
     *av = agg_valid;
   if (as)
-    *as = used ? (int) (agg_size / used) : 0;
+    *as = used ? (int)(agg_size / used) : 0;
   ink_assert(d->buckets * DIR_DEPTH - (free + used + empty) <= offby);
   return d->buckets * DIR_DEPTH - (free + used + empty) <= offby;
 }
@@ -588,7 +593,7 @@ dir_free_entry(Dir *e, int s, Vol *d)
 }
 
 int
-dir_probe(CacheKey *key, Vol *d, Dir *result, Dir ** last_collision)
+dir_probe(CacheKey *key, Vol *d, Dir *result, Dir **last_collision)
 {
   ink_assert(d->mutex->thread_holding == this_ethread());
   int s = key->slice32(0) % d->segments;
@@ -624,14 +629,15 @@ Lagain:
           goto Lcont;
         }
         if (dir_valid(d, e)) {
-          DDebug("dir_probe_hit", "found %X %X vol %d bucket %d boffset %" PRId64 "", key->slice32(0), key->slice32(1), d->fd, b, dir_offset(e));
+          DDebug("dir_probe_hit", "found %X %X vol %d bucket %d boffset %" PRId64 "", key->slice32(0), key->slice32(1), d->fd, b,
+                 dir_offset(e));
           dir_assign(result, e);
           *last_collision = e;
 #if !TS_USE_INTERIM_CACHE
           ink_assert(dir_offset(e) * CACHE_BLOCK_SIZE < d->len);
 #endif
           return 1;
-        } else {                // delete the invalid entry
+        } else { // delete the invalid entry
           CACHE_DEC_DIR_USED(d->mutex);
           e = dir_delete_entry(e, p, s, d);
           continue;
@@ -642,7 +648,7 @@ Lagain:
       p = e;
       e = next_dir(e, seg);
     } while (e);
-  if (collision) {              // last collision no longer in the list, retry
+  if (collision) { // last collision no longer in the list, retry
     DDebug("cache_stats", "Incrementing dir collisions");
     CACHE_INC_DIR_COLLISIONS(d->mutex);
     collision = NULL;
@@ -706,9 +712,8 @@ Lfill:
   dir_set_tag(e, key->slice32(2));
   ink_assert(vol_offset(d, e) < (d->skip + d->len));
 #endif
-  DDebug("dir_insert",
-        "insert %p %X into vol %d bucket %d at %p tag %X %X boffset %" PRId64 "",
-         e, key->slice32(0), d->fd, bi, e, key->slice32(1), dir_tag(e), dir_offset(e));
+  DDebug("dir_insert", "insert %p %X into vol %d bucket %d at %p tag %X %X boffset %" PRId64 "", e, key->slice32(0), d->fd, bi, e,
+         key->slice32(1), dir_tag(e), dir_offset(e));
   CHECK_DIR(d);
   d->header->dirty = 1;
   CACHE_INC_DIR_USED(d->mutex);
@@ -733,7 +738,7 @@ dir_overwrite(CacheKey *key, Vol *d, Dir *dir, Dir *overwrite, bool must_overwri
   Vol *vol = d;
   CHECK_DIR(d);
 
-  ink_assert((unsigned int) dir_approx_size(dir) <= (unsigned int) (MAX_FRAG_SIZE + sizeofDoc));        // XXX - size should be unsigned
+  ink_assert((unsigned int)dir_approx_size(dir) <= (unsigned int)(MAX_FRAG_SIZE + sizeofDoc)); // XXX - size should be unsigned
 Lagain:
   // find entry to overwrite
   e = b;
@@ -784,9 +789,8 @@ Lfill:
   dir_assign_data(e, dir);
   dir_set_tag(e, t);
   ink_assert(vol_offset(d, e) < d->skip + d->len);
-  DDebug("dir_overwrite",
-        "overwrite %p %X into vol %d bucket %d at %p tag %X %X boffset %" PRId64 "",
-         e, key->slice32(0), d->fd, bi, e, t, dir_tag(e), dir_offset(e));
+  DDebug("dir_overwrite", "overwrite %p %X into vol %d bucket %d at %p tag %X %X boffset %" PRId64 "", e, key->slice32(0), d->fd,
+         bi, e, t, dir_tag(e), dir_offset(e));
   CHECK_DIR(d);
   d->header->dirty = 1;
   return res;
@@ -836,7 +840,7 @@ dir_delete(CacheKey *key, Vol *d, Dir *del)
 // Lookaside Cache
 
 int
-dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock ** eblock)
+dir_lookaside_probe(CacheKey *key, Vol *d, Dir *result, EvacuationBlock **eblock)
 {
   ink_assert(d->mutex->thread_holding == this_ethread());
   int i = key->slice32(3) % LOOKASIDE_SIZE;
@@ -861,7 +865,8 @@ int
 dir_lookaside_insert(EvacuationBlock *eblock, Vol *d, Dir *to)
 {
   CacheKey *key = &eblock->evac_frags.earliest_key;
-  DDebug("dir_lookaside", "insert %X %X, offset %d phase %d", key->slice32(0), key->slice32(1), (int) dir_offset(to), (int) dir_phase(to));
+  DDebug("dir_lookaside", "insert %X %X, offset %d phase %d", key->slice32(0), key->slice32(1), (int)dir_offset(to),
+         (int)dir_phase(to));
   ink_assert(d->mutex->thread_holding == this_ethread());
   int i = key->slice32(3) % LOOKASIDE_SIZE;
   EvacuationBlock *b = new_EvacuationBlock(d->mutex->thread_holding);
@@ -884,8 +889,8 @@ dir_lookaside_fixup(CacheKey *key, Vol *d)
   while (b) {
     if (b->evac_frags.key == *key) {
       int res = dir_overwrite(key, d, &b->new_dir, &b->dir, false);
-      DDebug("dir_lookaside", "fixup %X %X offset %" PRId64" phase %d %d",
-            key->slice32(0), key->slice32(1), dir_offset(&b->new_dir), dir_phase(&b->new_dir), res);
+      DDebug("dir_lookaside", "fixup %X %X offset %" PRId64 " phase %d %d", key->slice32(0), key->slice32(1),
+             dir_offset(&b->new_dir), dir_phase(&b->new_dir), res);
 #if TS_USE_INTERIM_CACHE == 1
       int64_t o = dir_get_offset(&b->dir), n = dir_get_offset(&b->new_dir);
 #else
@@ -911,8 +916,8 @@ dir_lookaside_cleanup(Vol *d)
     while (b) {
       if (!dir_valid(d, &b->new_dir)) {
         EvacuationBlock *nb = b->link.next;
-        DDebug("dir_lookaside", "cleanup %X %X cleaned up",
-              b->evac_frags.earliest_key.slice32(0), b->evac_frags.earliest_key.slice32(1));
+        DDebug("dir_lookaside", "cleanup %X %X cleaned up", b->evac_frags.earliest_key.slice32(0),
+               b->evac_frags.earliest_key.slice32(1));
         d->lookaside[i].remove(b);
         free_CacheVC(b->earliest_evacuator);
         free_EvacuationBlock(b, d->mutex->thread_holding);
@@ -920,7 +925,8 @@ dir_lookaside_cleanup(Vol *d)
         goto Lagain;
       }
       b = b->link.next;
-    Lagain:;
+    Lagain:
+      ;
     }
   }
 }
@@ -933,8 +939,8 @@ dir_lookaside_remove(CacheKey *key, Vol *d)
   EvacuationBlock *b = d->lookaside[i].head;
   while (b) {
     if (b->evac_frags.key == *key) {
-      DDebug("dir_lookaside", "remove %X %X offset %" PRId64" phase %d",
-            key->slice32(0), key->slice32(1), dir_offset(&b->new_dir), dir_phase(&b->new_dir));
+      DDebug("dir_lookaside", "remove %X %X offset %" PRId64 " phase %d", key->slice32(0), key->slice32(1), dir_offset(&b->new_dir),
+             dir_phase(&b->new_dir));
       d->lookaside[i].remove(b);
       free_EvacuationBlock(b, d->mutex->thread_holding);
       return;
@@ -1006,7 +1012,7 @@ sync_cache_dir_on_shutdown(void)
   char *buf = NULL;
   size_t buflen = 0;
 
-  EThread *t = (EThread *) 0xdeadbeef;
+  EThread *t = (EThread *)0xdeadbeef;
   for (int i = 0; i < gnvol; i++) {
     // the process is going down, do a blocking call
     // dont release the volume's lock, there could
@@ -1037,8 +1043,7 @@ sync_cache_dir_on_shutdown(void)
       // set write limit
       d->header->agg_pos = d->header->write_pos + d->agg_buf_pos;
 
-      int r = pwrite(d->fd, d->agg_buffer, d->agg_buf_pos,
-                     d->header->write_pos);
+      int r = pwrite(d->fd, d->agg_buffer, d->agg_buf_pos, d->header->write_pos);
       if (r != d->agg_buf_pos) {
         ink_assert(!"flusing agg buffer failed");
         continue;
@@ -1104,7 +1109,6 @@ sync_cache_dir_on_shutdown(void)
 }
 
 
-
 int
 CacheSync::mainEvent(int event, Event *e)
 {
@@ -1129,7 +1133,7 @@ Lrestart:
     return EVENT_CONT;
   }
 
-  Vol* vol = gvol[vol_idx]; // must be named "vol" to make STAT macros work.
+  Vol *vol = gvol[vol_idx]; // must be named "vol" to make STAT macros work.
 
   if (event == AIO_EVENT_DONE) {
     // AIO Thread
@@ -1150,7 +1154,8 @@ Lrestart:
       return EVENT_CONT;
     }
 
-    if (!vol->dir_sync_in_progress) start_time = ink_get_hrtime();
+    if (!vol->dir_sync_in_progress)
+      start_time = ink_get_hrtime();
 
     // recompute hit_evacuate_window
     vol->hit_evacuate_window = (vol->data_blocks * cache_config_hit_evacuate_percent) / 100;
@@ -1200,7 +1205,7 @@ Lrestart:
       vol->footer->sync_serial = vol->header->sync_serial;
 #if TS_USE_INTERIM_CACHE == 1
       for (int j = 0; j < vol->num_interim_vols; j++) {
-          vol->interim_vols[j].header->sync_serial = vol->header->sync_serial;
+        vol->interim_vols[j].header->sync_serial = vol->header->sync_serial;
       }
 #endif
       CHECK_DIR(d);
@@ -1247,11 +1252,10 @@ Ldone:
 //
 
 #define HIST_DEPTH 8
-int
-Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this parameter ?
+int Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this parameter ?
 {
-  int hist[HIST_DEPTH + 1] = { 0 };
-  int *shist = (int*)ats_malloc(segments * sizeof(int));
+  int hist[HIST_DEPTH + 1] = {0};
+  int *shist = (int *)ats_malloc(segments * sizeof(int));
   memset(shist, 0, segments * sizeof(int));
   int j;
   int stale = 0, full = 0, empty = 0;
@@ -1298,21 +1302,24 @@ Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this para
   for (j = 0; j < HIST_DEPTH; j++) {
     printf("%8d ", hist[j]);
     if ((j % 4 == 3))
-      printf("\n" "                           ");
+      printf("\n"
+             "                           ");
   }
   printf("\n");
   printf("        Segment Fullness:  ");
   for (j = 0; j < segments; j++) {
     printf("%5d ", shist[j]);
     if ((j % 5 == 4))
-      printf("\n" "                           ");
+      printf("\n"
+             "                           ");
   }
   printf("\n");
   printf("        Freelist Fullness: ");
   for (j = 0; j < segments; j++) {
     printf("%5d ", dir_freelist_length(this, j));
     if ((j % 5 == 4))
-      printf("\n" "                           ");
+      printf("\n"
+             "                           ");
   }
   printf("\n");
   ats_free(shist);
@@ -1325,74 +1332,30 @@ Vol::dir_check(bool /* fix ATS_UNUSED */) // TODO: we should eliminate this para
 
 // permutation table
 uint8_t CacheKey_next_table[256] = {
-  21, 53, 167, 51, 255, 126, 241, 151,
-  115, 66, 155, 174, 226, 215, 80, 188,
-  12, 95, 8, 24, 162, 201, 46, 104,
-  79, 172, 39, 68, 56, 144, 142, 217,
-  101, 62, 14, 108, 120, 90, 61, 47,
-  132, 199, 110, 166, 83, 125, 57, 65,
-  19, 130, 148, 116, 228, 189, 170, 1,
-  71, 0, 252, 184, 168, 177, 88, 229,
-  242, 237, 183, 55, 13, 212, 240, 81,
-  211, 74, 195, 205, 147, 93, 30, 87,
-  86, 63, 135, 102, 233, 106, 118, 163,
-  107, 10, 243, 136, 160, 119, 43, 161,
-  206, 141, 203, 78, 175, 36, 37, 140,
-  224, 197, 185, 196, 248, 84, 122, 73,
-  152, 157, 18, 225, 219, 145, 45, 2,
-  171, 249, 173, 32, 143, 137, 69, 41,
-  35, 89, 33, 98, 179, 214, 114, 231,
-  251, 123, 180, 194, 29, 3, 178, 31,
-  192, 164, 15, 234, 26, 230, 91, 156,
-  5, 16, 23, 244, 58, 50, 4, 67,
-  134, 165, 60, 235, 250, 7, 138, 216,
-  49, 139, 191, 154, 11, 52, 239, 59,
-  111, 245, 9, 64, 25, 129, 247, 232,
-  190, 246, 109, 22, 112, 210, 221, 181,
-  92, 169, 48, 100, 193, 77, 103, 133,
-  70, 220, 207, 223, 176, 204, 76, 186,
-  200, 208, 158, 182, 227, 222, 131, 38,
-  187, 238, 6, 34, 253, 128, 146, 44,
-  94, 127, 105, 153, 113, 20, 27, 124,
-  159, 17, 72, 218, 96, 149, 213, 42,
-  28, 254, 202, 40, 117, 82, 97, 209,
-  54, 236, 121, 75, 85, 150, 99, 198,
+  21,  53,  167, 51,  255, 126, 241, 151, 115, 66,  155, 174, 226, 215, 80,  188, 12,  95,  8,   24,  162, 201, 46,  104, 79,  172,
+  39,  68,  56,  144, 142, 217, 101, 62,  14,  108, 120, 90,  61,  47,  132, 199, 110, 166, 83,  125, 57,  65,  19,  130, 148, 116,
+  228, 189, 170, 1,   71,  0,   252, 184, 168, 177, 88,  229, 242, 237, 183, 55,  13,  212, 240, 81,  211, 74,  195, 205, 147, 93,
+  30,  87,  86,  63,  135, 102, 233, 106, 118, 163, 107, 10,  243, 136, 160, 119, 43,  161, 206, 141, 203, 78,  175, 36,  37,  140,
+  224, 197, 185, 196, 248, 84,  122, 73,  152, 157, 18,  225, 219, 145, 45,  2,   171, 249, 173, 32,  143, 137, 69,  41,  35,  89,
+  33,  98,  179, 214, 114, 231, 251, 123, 180, 194, 29,  3,   178, 31,  192, 164, 15,  234, 26,  230, 91,  156, 5,   16,  23,  244,
+  58,  50,  4,   67,  134, 165, 60,  235, 250, 7,   138, 216, 49,  139, 191, 154, 11,  52,  239, 59,  111, 245, 9,   64,  25,  129,
+  247, 232, 190, 246, 109, 22,  112, 210, 221, 181, 92,  169, 48,  100, 193, 77,  103, 133, 70,  220, 207, 223, 176, 204, 76,  186,
+  200, 208, 158, 182, 227, 222, 131, 38,  187, 238, 6,   34,  253, 128, 146, 44,  94,  127, 105, 153, 113, 20,  27,  124, 159, 17,
+  72,  218, 96,  149, 213, 42,  28,  254, 202, 40,  117, 82,  97,  209, 54,  236, 121, 75,  85,  150, 99,  198,
 };
 
 // permutation table
 uint8_t CacheKey_prev_table[256] = {
-  57, 55, 119, 141, 158, 152, 218, 165,
-  18, 178, 89, 172, 16, 68, 34, 146,
-  153, 233, 114, 48, 229, 0, 187, 154,
-  19, 180, 148, 230, 240, 140, 78, 143,
-  123, 130, 219, 128, 101, 102, 215, 26,
-  243, 127, 239, 94, 223, 118, 22, 39,
-  194, 168, 157, 3, 173, 1, 248, 67,
-  28, 46, 156, 175, 162, 38, 33, 81,
-  179, 47, 9, 159, 27, 126, 200, 56,
-  234, 111, 73, 251, 206, 197, 99, 24,
-  14, 71, 245, 44, 109, 252, 80, 79,
-  62, 129, 37, 150, 192, 77, 224, 17,
-  236, 246, 131, 254, 195, 32, 83, 198,
-  23, 226, 85, 88, 35, 186, 42, 176,
-  188, 228, 134, 8, 51, 244, 86, 93,
-  36, 250, 110, 137, 231, 45, 5, 225,
-  221, 181, 49, 214, 40, 199, 160, 82,
-  91, 125, 166, 169, 103, 97, 30, 124,
-  29, 117, 222, 76, 50, 237, 253, 7,
-  112, 227, 171, 10, 151, 113, 210, 232,
-  92, 95, 20, 87, 145, 161, 43, 2,
-  60, 193, 54, 120, 25, 122, 11, 100,
-  204, 61, 142, 132, 138, 191, 211, 66,
-  59, 106, 207, 216, 15, 53, 184, 170,
-  144, 196, 139, 74, 107, 105, 255, 41,
-  208, 21, 242, 98, 205, 75, 96, 202,
-  209, 247, 189, 72, 69, 238, 133, 13,
-  167, 31, 235, 116, 201, 190, 213, 203,
-  104, 115, 12, 212, 52, 63, 149, 135,
-  183, 84, 147, 163, 249, 65, 217, 174,
-  70, 6, 64, 90, 155, 177, 185, 182,
-  108, 121, 164, 136, 58, 220, 241, 4,
+  57,  55,  119, 141, 158, 152, 218, 165, 18,  178, 89,  172, 16,  68,  34,  146, 153, 233, 114, 48,  229, 0,   187, 154, 19,  180,
+  148, 230, 240, 140, 78,  143, 123, 130, 219, 128, 101, 102, 215, 26,  243, 127, 239, 94,  223, 118, 22,  39,  194, 168, 157, 3,
+  173, 1,   248, 67,  28,  46,  156, 175, 162, 38,  33,  81,  179, 47,  9,   159, 27,  126, 200, 56,  234, 111, 73,  251, 206, 197,
+  99,  24,  14,  71,  245, 44,  109, 252, 80,  79,  62,  129, 37,  150, 192, 77,  224, 17,  236, 246, 131, 254, 195, 32,  83,  198,
+  23,  226, 85,  88,  35,  186, 42,  176, 188, 228, 134, 8,   51,  244, 86,  93,  36,  250, 110, 137, 231, 45,  5,   225, 221, 181,
+  49,  214, 40,  199, 160, 82,  91,  125, 166, 169, 103, 97,  30,  124, 29,  117, 222, 76,  50,  237, 253, 7,   112, 227, 171, 10,
+  151, 113, 210, 232, 92,  95,  20,  87,  145, 161, 43,  2,   60,  193, 54,  120, 25,  122, 11,  100, 204, 61,  142, 132, 138, 191,
+  211, 66,  59,  106, 207, 216, 15,  53,  184, 170, 144, 196, 139, 74,  107, 105, 255, 41,  208, 21,  242, 98,  205, 75,  96,  202,
+  209, 247, 189, 72,  69,  238, 133, 13,  167, 31,  235, 116, 201, 190, 213, 203, 104, 115, 12,  212, 52,  63,  149, 135, 183, 84,
+  147, 163, 249, 65,  217, 174, 70,  6,   64,  90,  155, 177, 185, 182, 108, 121, 164, 136, 58,  220, 241, 4,
 };
 
 //
@@ -1408,7 +1371,7 @@ regress_rand_init(unsigned int i)
 void
 regress_rand_CacheKey(CacheKey *key)
 {
-  unsigned int *x = (unsigned int *) key;
+  unsigned int *x = (unsigned int *)key;
   for (int i = 0; i < 4; i++)
     x[i] = next_rand(&regress_rand_seed);
 }
@@ -1417,7 +1380,7 @@ void
 dir_corrupt_bucket(Dir *b, int s, Vol *d)
 {
   // coverity[dont_call]
-  int l = ((int) (dir_bucket_length(b, s, d) * drand48()));
+  int l = ((int)(dir_bucket_length(b, s, d) * drand48()));
   Dir *e = b;
   Dir *seg = dir_segment(s, d);
   for (int i = 0; i < l; i++) {
@@ -1427,7 +1390,8 @@ dir_corrupt_bucket(Dir *b, int s, Vol *d)
   dir_set_next(e, dir_to_offset(e, seg));
 }
 
-EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, int /* atype ATS_UNUSED */, int *status) {
+EXCLUSIVE_REGRESSION_TEST(Cache_dir)(RegressionTest *t, int /* atype ATS_UNUSED */, int *status)
+{
   ink_hrtime ttime;
   int ret = REGRESSION_TEST_PASSED;
 
@@ -1470,7 +1434,7 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, int /* atype ATS_UNUSED
     inserted++;
   }
   rprintf(t, "inserted: %d\n", inserted);
-  if ((unsigned int) (inserted - free) > 1)
+  if ((unsigned int)(inserted - free) > 1)
     ret = REGRESSION_TEST_FAILED;
 
   // test delete
@@ -1481,7 +1445,7 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, int /* atype ATS_UNUSED
   dir_clean_segment(s, d);
   int newfree = dir_freelist_length(d, s);
   rprintf(t, "newfree: %d\n", newfree);
-  if ((unsigned int) (newfree - free) > 1)
+  if ((unsigned int)(newfree - free) > 1)
     ret = REGRESSION_TEST_FAILED;
 
   // test insert-delete
@@ -1493,10 +1457,10 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, int /* atype ATS_UNUSED
     dir_insert(&key, d, &dir);
   }
   uint64_t us = (ink_get_hrtime_internal() - ttime) / HRTIME_USECOND;
-  //On windows us is sometimes 0. I don't know why.
-  //printout the insert rate only if its not 0
+  // On windows us is sometimes 0. I don't know why.
+  // printout the insert rate only if its not 0
   if (us)
-    rprintf(t, "insert rate = %d / second\n", (int) ((newfree * (uint64_t) 1000000) / us));
+    rprintf(t, "insert rate = %d / second\n", (int)((newfree * (uint64_t)1000000) / us));
   regress_rand_init(13);
   ttime = ink_get_hrtime_internal();
   for (i = 0; i < newfree; i++) {
@@ -1506,10 +1470,10 @@ EXCLUSIVE_REGRESSION_TEST(Cache_dir) (RegressionTest *t, int /* atype ATS_UNUSED
       ret = REGRESSION_TEST_FAILED;
   }
   us = (ink_get_hrtime_internal() - ttime) / HRTIME_USECOND;
-  //On windows us is sometimes 0. I don't know why.
-  //printout the probe rate only if its not 0
+  // On windows us is sometimes 0. I don't know why.
+  // printout the probe rate only if its not 0
   if (us)
-    rprintf(t, "probe rate = %d / second\n", (int) ((newfree * (uint64_t) 1000000) / us));
+    rprintf(t, "probe rate = %d / second\n", (int)((newfree * (uint64_t)1000000) / us));
 
 
   for (int c = 0; c < vol_direntries(d) * 0.75; c++) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheDisk.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDisk.cc b/iocore/cache/CacheDisk.cc
index b2ed592..0372d8d 100644
--- a/iocore/cache/CacheDisk.cc
+++ b/iocore/cache/CacheDisk.cc
@@ -63,7 +63,7 @@ CacheDisk::open(char *s, off_t blocks, off_t askip, int ahw_sector_size, int fil
 
   SET_HANDLER(&CacheDisk::openStart);
   io.aiocb.aio_offset = skip;
-  io.aiocb.aio_buf = (char *) header;
+  io.aiocb.aio_buf = (char *)header;
   io.aiocb.aio_nbytes = header_len;
   io.thread = AIO_CALLBACK_THREAD_ANY;
   ink_aio_read(&io);
@@ -74,7 +74,7 @@ CacheDisk::~CacheDisk()
 {
   if (path) {
     ats_free(path);
-    for (int i = 0; i < (int) header->num_volumes; i++) {
+    for (int i = 0; i < (int)header->num_volumes; i++) {
       DiskVolBlockQueue *q = NULL;
       while (disk_vols[i] && (q = (disk_vols[i]->dpb_queue.pop()))) {
         delete q;
@@ -110,11 +110,11 @@ CacheDisk::clearDone(int event, void * /* data ATS_UNUSED */)
 {
   ink_assert(event == AIO_EVENT_DONE);
 
-  if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+  if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
     Warning("Could not clear disk header for disk %s: declaring disk bad", path);
     SET_DISK_BAD(this);
   }
-//  update_header();
+  //  update_header();
 
   SET_HANDLER(&CacheDisk::openDone);
   return openDone(EVENT_IMMEDIATE, 0);
@@ -125,7 +125,7 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED */)
 {
   ink_assert(event == AIO_EVENT_DONE);
 
-  if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+  if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
     Warning("could not read disk header for disk %s: declaring disk bad", path);
     SET_DISK_BAD(this);
     SET_HANDLER(&CacheDisk::openDone);
@@ -133,7 +133,7 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED */)
   }
 
   if (header->magic != DISK_HEADER_MAGIC || header->num_blocks != static_cast<uint64_t>(len)) {
-    uint64_t delta_3_2 =  skip - (skip >> STORE_BLOCK_SHIFT); // block count change from 3.2
+    uint64_t delta_3_2 = skip - (skip >> STORE_BLOCK_SHIFT); // block count change from 3.2
     if (static_cast<uint64_t>(len) == header->num_blocks + delta_3_2) {
       header->num_blocks += delta_3_2;
       // Only recover the space if there is a single stripe on this disk. The stripe space allocation logic can fail if
@@ -142,8 +142,8 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED */)
       // stripe isn't the short one, the split will be different this time.
       // Further - the size is encoded in to the disk hash so if the size changes, the data is effectively lost anyway.
       // So no space recovery.
-//      if (header->num_diskvol_blks == 1)
-//        header->vol_info[0].len += delta_3_2;
+      //      if (header->num_diskvol_blks == 1)
+      //        header->vol_info[0].len += delta_3_2;
     } else {
       Warning("disk header different for disk %s: clearing the disk", path);
       SET_HANDLER(&CacheDisk::clearDone);
@@ -189,7 +189,7 @@ CacheDisk::syncDone(int event, void * /* data ATS_UNUSED */)
 {
   ink_assert(event == AIO_EVENT_DONE);
 
-  if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) {
+  if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
     Warning("Error writing disk header for disk %s:disk bad", path);
     SET_DISK_BAD(this);
     return EVENT_DONE;
@@ -215,7 +215,7 @@ CacheDisk::create_volume(int number, off_t size_in_blocks, int scheme)
   size_in_blocks = (size_in_blocks <= max_blocks) ? size_in_blocks : max_blocks;
 
   int blocks_per_vol = VOL_BLOCK_SIZE / STORE_BLOCK_SIZE;
-//  ink_assert(!(size_in_blocks % blocks_per_vol));
+  //  ink_assert(!(size_in_blocks % blocks_per_vol));
   DiskVolBlock *p = 0;
   for (; q; q = q->link.next) {
     if ((off_t)q->b->len >= size_in_blocks) {
@@ -236,7 +236,7 @@ CacheDisk::create_volume(int number, off_t size_in_blocks, int scheme)
     q = closest_match;
     p = q->b;
     q->new_block = 1;
-    ink_assert(size_in_blocks > (off_t) p->len);
+    ink_assert(size_in_blocks > (off_t)p->len);
     /* allocate in 128 megabyte chunks. The Remaining space should
        be thrown away */
     size_in_blocks = (p->len - (p->len % blocks_per_vol));
@@ -253,7 +253,7 @@ CacheDisk::create_volume(int number, off_t size_in_blocks, int scheme)
     DiskVolBlock *dpb = &header->vol_info[header->num_diskvol_blks];
     *dpb = *p;
     dpb->len -= size_in_blocks;
-    dpb->offset += ((off_t) size_in_blocks * STORE_BLOCK_SIZE);
+    dpb->offset += ((off_t)size_in_blocks * STORE_BLOCK_SIZE);
 
     DiskVolBlockQueue *new_q = new DiskVolBlockQueue();
     new_q->b = dpb;
@@ -299,7 +299,6 @@ CacheDisk::delete_volume(int number)
   unsigned int i;
   for (i = 0; i < header->num_volumes; i++) {
     if (disk_vols[i]->vol_number == number) {
-
       DiskVolBlockQueue *q;
       for (q = disk_vols[i]->dpb_queue.head; q;) {
         DiskVolBlock *p = q->b;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheHosting.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
index ad65061..6faa100 100644
--- a/iocore/cache/CacheHosting.cc
+++ b/iocore/cache/CacheHosting.cc
@@ -26,28 +26,21 @@
 
 extern int gndisks;
 
-matcher_tags CacheHosting_tags = {
-  "hostname", "domain"
-};
+matcher_tags CacheHosting_tags = {"hostname", "domain"};
 
 /*************************************************************
  *   Begin class HostMatcher
  *************************************************************/
 
-CacheHostMatcher::CacheHostMatcher(const char * name, CacheType typ):
-data_array(NULL),
-array_len(-1),
-num_el(-1),
-type(typ)
+CacheHostMatcher::CacheHostMatcher(const char *name, CacheType typ) : data_array(NULL), array_len(-1), num_el(-1), type(typ)
 {
   host_lookup = new HostLookup(name);
 }
 
 CacheHostMatcher::~CacheHostMatcher()
 {
-
   delete host_lookup;
-  delete[]data_array;
+  delete[] data_array;
 }
 
 //
@@ -59,7 +52,6 @@ CacheHostMatcher::~CacheHostMatcher()
 void
 CacheHostMatcher::Print()
 {
-
   printf("\tHost/Domain Matcher with %d elements\n", num_el);
   host_lookup->Print(PrintFunc);
 }
@@ -73,7 +65,7 @@ CacheHostMatcher::Print()
 void
 CacheHostMatcher::PrintFunc(void *opaque_data)
 {
-  CacheHostRecord *d = (CacheHostRecord *) opaque_data;
+  CacheHostRecord *d = (CacheHostRecord *)opaque_data;
   d->Print();
 }
 
@@ -101,9 +93,8 @@ CacheHostMatcher::AllocateSpace(int num_entries)
 //    arg hostname
 //
 void
-CacheHostMatcher::Match(char const* rdata, int rlen, CacheHostResult * result)
+CacheHostMatcher::Match(char const *rdata, int rlen, CacheHostResult *result)
 {
-
   void *opaque_ptr;
   CacheHostRecord *data_ptr;
   bool r;
@@ -125,7 +116,7 @@ CacheHostMatcher::Match(char const* rdata, int rlen, CacheHostResult * result)
 
   while (r == true) {
     ink_assert(opaque_ptr != NULL);
-    data_ptr = (CacheHostRecord *) opaque_ptr;
+    data_ptr = (CacheHostRecord *)opaque_ptr;
     data_ptr->UpdateMatch(result, data);
 
     r = host_lookup->MatchNext(&s, &opaque_ptr);
@@ -141,9 +132,8 @@ CacheHostMatcher::Match(char const* rdata, int rlen, CacheHostResult * result)
 //
 
 void
-CacheHostMatcher::NewEntry(matcher_line * line_info)
+CacheHostMatcher::NewEntry(matcher_line *line_info)
 {
-
   CacheHostRecord *cur_d;
   int errNo;
   char *match_data;
@@ -187,7 +177,7 @@ CacheHostMatcher::NewEntry(matcher_line * line_info)
  *   End class HostMatcher
  *************************************************************/
 
-CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
+CacheHostTable::CacheHostTable(Cache *c, CacheType typ)
 {
   ats_scoped_str config_path;
 
@@ -196,7 +186,8 @@ CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
 
   type = typ;
   cache = c;
-  matcher_name = "[CacheHosting]";;
+  matcher_name = "[CacheHosting]";
+  ;
   hostMatch = NULL;
 
   config_path = RecConfigReadConfigPath("proxy.config.cache.hosting_filename");
@@ -207,7 +198,6 @@ CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
 
 CacheHostTable::~CacheHostTable()
 {
-
   if (hostMatch != NULL) {
     delete hostMatch;
   }
@@ -233,9 +223,8 @@ CacheHostTable::Print()
 //   Queries each table for the Result*
 //
 void
-CacheHostTable::Match(char const* rdata, int rlen, CacheHostResult * result)
+CacheHostTable::Match(char const *rdata, int rlen, CacheHostResult *result)
 {
-
   hostMatch->Match(rdata, rlen, result);
 }
 
@@ -243,7 +232,7 @@ int
 CacheHostTable::config_callback(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */,
                                 RecData /* data ATS_UNUSED */, void *cookie)
 {
-  CacheHostTable **ppt = (CacheHostTable **) cookie;
+  CacheHostTable **ppt = (CacheHostTable **)cookie;
   eventProcessor.schedule_imm(new CacheHostTableConfig(ppt));
   return 0;
 }
@@ -256,7 +245,7 @@ int fstat_wrapper(int fd, struct stat *s);
 //      from it
 //
 int
-CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_buf)
+CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_buf)
 {
   // Table build locals
   Tokenizer bufTok("\n");
@@ -284,7 +273,6 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b
   // First get the number of entries
   tmp = bufTok.iterFirst(&i_state);
   while (tmp != NULL) {
-
     line_num++;
 
     // skip all blank spaces at beginning of line
@@ -293,16 +281,14 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b
     }
 
     if (*tmp != '#' && *tmp != '\0') {
-
       current = (matcher_line *)ats_malloc(sizeof(matcher_line));
-      errPtr = parseConfigLine((char *) tmp, current, config_tags);
+      errPtr = parseConfigLine((char *)tmp, current, config_tags);
 
       if (errPtr != NULL) {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : %s",
-                 matcher_name, config_file_path, line_num, errPtr);
+        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : %s", matcher_name, config_file_path,
+                         line_num, errPtr);
         ats_free(current);
       } else {
-
         // Line parsed ok.  Figure out what the destination
         //  type is and link it into our list
         numEntries++;
@@ -355,7 +341,6 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b
   while (current != NULL) {
     second_pass++;
     if ((current->type == MATCH_DOMAIN) || (current->type == MATCH_HOST)) {
-
       char *match_data = current->line[1][current->dest_entry];
       ink_assert(match_data != NULL);
 
@@ -380,8 +365,8 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b
         hostMatch->NewEntry(current);
       }
     } else {
-      RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry with unknown type at line %d",
-               matcher_name, config_file_path, current->line_num);
+      RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry with unknown type at line %d", matcher_name,
+                       config_file_path, current->line_num);
     }
 
     // Deallocate the parsing structure
@@ -393,8 +378,8 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b
   if (!generic_rec_initd) {
     const char *cache_type = (type == CACHE_HTTP_TYPE) ? "http" : "mixt";
     RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-             "No Volumes specified for Generic Hostnames for %s documents: %s cache will be disabled", cache_type,
-             cache_type);
+                     "No Volumes specified for Generic Hostnames for %s documents: %s cache will be disabled", cache_type,
+                     cache_type);
   }
 
   ink_assert(second_pass == numEntries);
@@ -406,7 +391,7 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b
 }
 
 int
-CacheHostTable::BuildTable(const char * config_file_path)
+CacheHostTable::BuildTable(const char *config_file_path)
 {
   char *file_buf;
   int ret;
@@ -427,7 +412,6 @@ CacheHostTable::BuildTable(const char * config_file_path)
 int
 CacheHostRecord::Init(CacheType typ)
 {
-
   int i, j;
   extern Queue<CacheVol> cp_list;
   extern int cp_list_len;
@@ -465,7 +449,7 @@ CacheHostRecord::Init(CacheType typ)
 }
 
 int
-CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
+CacheHostRecord::Init(matcher_line *line_info, CacheType typ)
 {
   int i, j;
   extern Queue<CacheVol> cp_list;
@@ -495,19 +479,17 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
           s++;
           if (!(*s)) {
             const char *errptr = "A volume number expected";
-            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                         "%s discarding %s entry at line %d :%s",
-                         "[CacheHosting]", config_file, line_info->line_num, errptr);
+            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d :%s", "[CacheHosting]", config_file,
+                             line_info->line_num, errptr);
             if (val != NULL) {
               ats_free(val);
             }
             return -1;
           }
         }
-        if ((*s<'0') || (*s> '9')) {
-          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                       "%s discarding %s entry at line %d : bad token [%c]",
-                       "[CacheHosting]", config_file, line_info->line_num, *s);
+        if ((*s < '0') || (*s > '9')) {
+          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad token [%c]", "[CacheHosting]",
+                           config_file, line_info->line_num, *s);
           if (val != NULL) {
             ats_free(val);
           }
@@ -531,9 +513,8 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
             if (cachep->vol_number == volume_number) {
               is_vol_present = 1;
               if (cachep->scheme == type) {
-                Debug("cache_hosting",
-                      "Host Record: %p, Volume: %d, size: %ld",
-                      this, volume_number, (long)(cachep->size * STORE_BLOCK_SIZE));
+                Debug("cache_hosting", "Host Record: %p, Volume: %d, size: %ld", this, volume_number,
+                      (long)(cachep->size * STORE_BLOCK_SIZE));
                 cp[num_cachevols] = cachep;
                 num_cachevols++;
                 num_vols += cachep->num_vols;
@@ -542,9 +523,8 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
             }
           }
           if (!is_vol_present) {
-            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                         "%s discarding %s entry at line %d : bad volume number [%d]",
-                         "[CacheHosting]", config_file, line_info->line_num, volume_number);
+            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad volume number [%d]",
+                             "[CacheHosting]", config_file, line_info->line_num, volume_number);
             if (val != NULL) {
               ats_free(val);
             }
@@ -562,16 +542,14 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
       break;
     }
 
-    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                 "%s discarding %s entry at line %d : bad token [%s]",
-                 "[CacheHosting]", config_file, line_info->line_num, label);
+    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad token [%s]", "[CacheHosting]", config_file,
+                     line_info->line_num, label);
     return -1;
   }
 
   if (i == MATCHER_MAX_TOKENS) {
-    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                 "%s discarding %s entry at line %d : No volumes specified",
-                 "[CacheHosting]", config_file, line_info->line_num);
+    RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : No volumes specified", "[CacheHosting]",
+                     config_file, line_info->line_num);
     return -1;
   }
 
@@ -593,7 +571,7 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ)
 }
 
 void
-CacheHostRecord::UpdateMatch(CacheHostResult * r, char * /* rd ATS_UNUSED */)
+CacheHostRecord::UpdateMatch(CacheHostResult *r, char * /* rd ATS_UNUSED */)
 {
   r->record = this;
 }
@@ -604,7 +582,6 @@ CacheHostRecord::Print()
 }
 
 
-
 void
 ConfigVolumes::read_config_file()
 {
@@ -628,25 +605,24 @@ ConfigVolumes::read_config_file()
 void
 ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
 {
-
 #define PAIR_ZERO 0
 #define PAIR_ONE 1
 #define PAIR_TWO 2
 #define DONE 3
 #define INK_ERROR -1
 
-#define INK_ERROR_VOLUME -2  //added by YTS Team, yamsat for bug id 59632
-// Table build locals
+#define INK_ERROR_VOLUME -2 // added by YTS Team, yamsat for bug id 59632
+  // Table build locals
   Tokenizer bufTok("\n");
   tok_iter_state i_state;
   const char *tmp;
   char *end;
   char *line_end = NULL;
   int line_num = 0;
-  int total = 0;                //added by YTS Team, yamsat for bug id 59632
+  int total = 0; // added by YTS Team, yamsat for bug id 59632
 
   char volume_seen[256];
-  int state = 0;                //changed by YTS Team, yamsat for bug id 59632
+  int state = 0; // changed by YTS Team, yamsat for bug id 59632
   int volume_number = 0;
   CacheType scheme = CACHE_NONE_TYPE;
   int size = 0;
@@ -695,8 +671,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
           num_http_volumes++;
         else
           num_stream_volumes++;
-        Debug("cache_hosting",
-              "added volume=%d, scheme=%d, size=%d percent=%d\n", volume_number, scheme, size, in_percent);
+        Debug("cache_hosting", "added volume=%d, scheme=%d, size=%d percent=%d\n", volume_number, scheme, size, in_percent);
         break;
       }
 
@@ -705,13 +680,13 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
           break;
       } else {
         if (!(*tmp)) {
-          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : Unexpected end of line",
-                   matcher_name, config_file_path, line_num);
+          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : Unexpected end of line", matcher_name,
+                           config_file_path, line_num);
           break;
         }
       }
 
-      end = (char *) tmp;
+      end = (char *)tmp;
       while (*end && !isspace(*end))
         end++;
 
@@ -723,7 +698,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
       }
       char *eq_sign;
 
-      eq_sign = (char *) strchr(tmp, '=');
+      eq_sign = (char *)strchr(tmp, '=');
       if (!eq_sign) {
         state = INK_ERROR;
       } else
@@ -735,20 +710,20 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
           state = INK_ERROR;
           break;
         }
-        tmp += 7;              //size of string volume including null
+        tmp += 7; // size of string volume including null
         volume_number = atoi(tmp);
 
-        if (volume_number<1 || volume_number> 255 || volume_seen[volume_number]) {
+        if (volume_number < 1 || volume_number > 255 || volume_seen[volume_number]) {
           const char *err;
 
-          if (volume_number<1 || volume_number> 255) {
+          if (volume_number < 1 || volume_number > 255) {
             err = "Bad Volume Number";
           } else {
             err = "Volume Already Specified";
           }
 
-          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : %s [%d]",
-                   matcher_name, config_file_path, line_num, err, volume_number);
+          RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : %s [%d]", matcher_name, config_file_path,
+                           line_num, err, volume_number);
           state = INK_ERROR;
           break;
         }
@@ -764,7 +739,7 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
           state = INK_ERROR;
           break;
         }
-        tmp += 7;               //size of string scheme including null
+        tmp += 7; // size of string scheme including null
 
         if (!strcasecmp(tmp, "http")) {
           tmp += 4;
@@ -793,30 +768,28 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
           tmp++;
 
         if (*tmp == '%') {
-          //added by YTS Team, yamsat for bug id 59632
+          // added by YTS Team, yamsat for bug id 59632
           total += size;
           if (size > 100 || total > 100) {
             state = INK_ERROR_VOLUME;
-            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR,
-                             "Total volume size added upto more than 100 percent, No volumes created");
+            RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "Total volume size added upto more than 100 percent, No volumes created");
             break;
           }
-          //ends here
+          // ends here
           in_percent = 1;
           tmp++;
         } else
           in_percent = 0;
         state = DONE;
         break;
-
       }
 
       if (state == INK_ERROR || *tmp) {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : Invalid token [%s]",
-                 matcher_name, config_file_path, line_num, tmp);
+        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : Invalid token [%s]", matcher_name,
+                         config_file_path, line_num, tmp);
         break;
       }
-      //added by YTS Team, yamsat for bug id 59632
+      // added by YTS Team, yamsat for bug id 59632
       if (state == INK_ERROR_VOLUME || *tmp) {
         RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "Total volume size added upto more than 100 percent,No volumes created");
         break;
@@ -832,10 +805,9 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf)
 }
 
 
-
 /* Test the cache volumeing with different configurations */
 #define MEGS_128 (128 * 1024 * 1024)
-#define ROUND_TO_VOL_SIZE(_x) (((_x) + (MEGS_128 - 1)) &~ (MEGS_128 - 1))
+#define ROUND_TO_VOL_SIZE(_x) (((_x) + (MEGS_128 - 1)) & ~(MEGS_128 - 1))
 extern CacheDisk **gdisks;
 extern Queue<CacheVol> cp_list;
 extern int cp_list_len;
@@ -851,14 +823,15 @@ int saved_cp_list_len;
 ConfigVolumes saved_config_volumes;
 int saved_gnvol;
 
-int ClearConfigVol(ConfigVolumes * configp);
+int ClearConfigVol(ConfigVolumes *configp);
 int ClearCacheVolList(Queue<CacheVol> *cpl, int len);
-int create_config(RegressionTest * t, int i);
-int execute_and_verify(RegressionTest * t);
+int create_config(RegressionTest *t, int i);
+int execute_and_verify(RegressionTest *t);
 void save_state();
 void restore_state();
 
-EXCLUSIVE_REGRESSION_TEST(Cache_vol) (RegressionTest * t, int /* atype ATS_UNUSED */, int *status) {
+EXCLUSIVE_REGRESSION_TEST(Cache_vol)(RegressionTest *t, int /* atype ATS_UNUSED */, int *status)
+{
   save_state();
   srand48(time(NULL));
   *status = REGRESSION_TEST_PASSED;
@@ -874,7 +847,7 @@ EXCLUSIVE_REGRESSION_TEST(Cache_vol) (RegressionTest * t, int /* atype ATS_UNUSE
 }
 
 int
-create_config(RegressionTest * t, int num)
+create_config(RegressionTest *t, int num)
 {
   int i = 0;
   int vol_num = 1;
@@ -903,117 +876,110 @@ create_config(RegressionTest * t, int num)
         config_volumes.num_volumes++;
         config_volumes.num_http_volumes++;
       }
-
     }
     rprintf(t, "%d 128 Megabyte Volumes\n", vol_num - 1);
     break;
 
-  case 1:
-    {
-      for (i = 0; i < gndisks; i++) {
-        gdisks[i]->delete_all_volumes();
-      }
+  case 1: {
+    for (i = 0; i < gndisks; i++) {
+      gdisks[i]->delete_all_volumes();
+    }
 
-      // calculate the total free space
-      off_t total_space = 0;
-      for (i = 0; i < gndisks; i++) {
-        off_t vol_blocks = gdisks[i]->num_usable_blocks;
-        /* round down the blocks to the nearest
-           multiple of STORE_BLOCKS_PER_VOL */
-        vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL)
-          * STORE_BLOCKS_PER_VOL;
-        total_space += vol_blocks;
-      }
+    // calculate the total free space
+    off_t total_space = 0;
+    for (i = 0; i < gndisks; i++) {
+      off_t vol_blocks = gdisks[i]->num_usable_blocks;
+      /* round down the blocks to the nearest
+         multiple of STORE_BLOCKS_PER_VOL */
+      vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL) * STORE_BLOCKS_PER_VOL;
+      total_space += vol_blocks;
+    }
 
-      // make sure we have atleast 1280 M bytes
-      if (total_space<(10 << 27)>> STORE_BLOCK_SHIFT) {
-        rprintf(t, "Not enough space for 10 volume\n");
-        return 0;
-      }
+    // make sure we have atleast 1280 M bytes
+    if (total_space<(10 << 27)>> STORE_BLOCK_SHIFT) {
+      rprintf(t, "Not enough space for 10 volume\n");
+      return 0;
+    }
 
-      vol_num = 1;
-      rprintf(t, "Cleared  disk\n");
-      for (i = 0; i < 10; i++) {
-        ConfigVol *cp = new ConfigVol();
-        cp->number = vol_num++;
-        cp->scheme = CACHE_HTTP_TYPE;
-        cp->size = 10;
-        cp->percent = 10;
-        cp->in_percent = 1;
-        cp->cachep = 0;
-        config_volumes.cp_queue.enqueue(cp);
-        config_volumes.num_volumes++;
-        config_volumes.num_http_volumes++;
-      }
-      rprintf(t, "10 volume, 10 percent each\n");
+    vol_num = 1;
+    rprintf(t, "Cleared  disk\n");
+    for (i = 0; i < 10; i++) {
+      ConfigVol *cp = new ConfigVol();
+      cp->number = vol_num++;
+      cp->scheme = CACHE_HTTP_TYPE;
+      cp->size = 10;
+      cp->percent = 10;
+      cp->in_percent = 1;
+      cp->cachep = 0;
+      config_volumes.cp_queue.enqueue(cp);
+      config_volumes.num_volumes++;
+      config_volumes.num_http_volumes++;
     }
-    break;
+    rprintf(t, "10 volume, 10 percent each\n");
+  } break;
 
   case 2:
   case 3:
 
-    {
-      /* calculate the total disk space */
-      InkRand *gen = &this_ethread()->generator;
-      off_t total_space = 0;
-      vol_num = 1;
+  {
+    /* calculate the total disk space */
+    InkRand *gen = &this_ethread()->generator;
+    off_t total_space = 0;
+    vol_num = 1;
+    if (num == 2) {
+      rprintf(t, "Random Volumes after clearing the disks\n");
+    } else {
+      rprintf(t, "Random Volumes without clearing the disks\n");
+    }
+
+    for (i = 0; i < gndisks; i++) {
+      off_t vol_blocks = gdisks[i]->num_usable_blocks;
+      /* round down the blocks to the nearest
+         multiple of STORE_BLOCKS_PER_VOL */
+      vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL) * STORE_BLOCKS_PER_VOL;
+      total_space += vol_blocks;
+
       if (num == 2) {
-        rprintf(t, "Random Volumes after clearing the disks\n");
+        gdisks[i]->delete_all_volumes();
       } else {
-        rprintf(t, "Random Volumes without clearing the disks\n");
+        gdisks[i]->cleared = 0;
       }
-
-      for (i = 0; i < gndisks; i++) {
-        off_t vol_blocks = gdisks[i]->num_usable_blocks;
-        /* round down the blocks to the nearest
-           multiple of STORE_BLOCKS_PER_VOL */
-        vol_blocks = (vol_blocks / STORE_BLOCKS_PER_VOL)
-          * STORE_BLOCKS_PER_VOL;
-        total_space += vol_blocks;
-
-        if (num == 2) {
-          gdisks[i]->delete_all_volumes();
-        } else {
-          gdisks[i]->cleared = 0;
-        }
+    }
+    while (total_space > 0) {
+      if (vol_num > 255)
+        break;
+      off_t modu = MAX_VOL_SIZE;
+      if (total_space < (MAX_VOL_SIZE >> STORE_BLOCK_SHIFT)) {
+        modu = total_space * STORE_BLOCK_SIZE;
       }
-      while (total_space > 0) {
-        if (vol_num > 255)
-          break;
-        off_t modu = MAX_VOL_SIZE;
-        if (total_space<(MAX_VOL_SIZE>> STORE_BLOCK_SHIFT)) {
-          modu = total_space * STORE_BLOCK_SIZE;
-        }
 
-        off_t random_size = (gen->random() % modu) + 1;
-        /* convert to 128 megs multiple */
-        CacheType scheme = (random_size % 2) ? CACHE_HTTP_TYPE : CACHE_RTSP_TYPE;
-        random_size = ROUND_TO_VOL_SIZE(random_size);
-        off_t blocks = random_size / STORE_BLOCK_SIZE;
-        ink_assert(blocks <= (int) total_space);
-        total_space -= blocks;
-
-        ConfigVol *cp = new ConfigVol();
-
-        cp->number = vol_num++;
-        cp->scheme = scheme;
-        cp->size = random_size >> 20;
-        cp->percent = 0;
-        cp->in_percent = 0;
-        cp->cachep = 0;
-        config_volumes.cp_queue.enqueue(cp);
-        config_volumes.num_volumes++;
-        if (cp->scheme == CACHE_HTTP_TYPE) {
-          config_volumes.num_http_volumes++;
-          rprintf(t, "volume=%d scheme=http size=%d\n", cp->number, cp->size);
-        } else {
-          config_volumes.num_stream_volumes++;
-          rprintf(t, "volume=%d scheme=rtsp size=%d\n", cp->number, cp->size);
-
-        }
+      off_t random_size = (gen->random() % modu) + 1;
+      /* convert to 128 megs multiple */
+      CacheType scheme = (random_size % 2) ? CACHE_HTTP_TYPE : CACHE_RTSP_TYPE;
+      random_size = ROUND_TO_VOL_SIZE(random_size);
+      off_t blocks = random_size / STORE_BLOCK_SIZE;
+      ink_assert(blocks <= (int)total_space);
+      total_space -= blocks;
+
+      ConfigVol *cp = new ConfigVol();
+
+      cp->number = vol_num++;
+      cp->scheme = scheme;
+      cp->size = random_size >> 20;
+      cp->percent = 0;
+      cp->in_percent = 0;
+      cp->cachep = 0;
+      config_volumes.cp_queue.enqueue(cp);
+      config_volumes.num_volumes++;
+      if (cp->scheme == CACHE_HTTP_TYPE) {
+        config_volumes.num_http_volumes++;
+        rprintf(t, "volume=%d scheme=http size=%d\n", cp->number, cp->size);
+      } else {
+        config_volumes.num_stream_volumes++;
+        rprintf(t, "volume=%d scheme=rtsp size=%d\n", cp->number, cp->size);
       }
     }
-    break;
+  } break;
 
   default:
     return 1;
@@ -1022,7 +988,7 @@ create_config(RegressionTest * t, int num)
 }
 
 int
-execute_and_verify(RegressionTest * t)
+execute_and_verify(RegressionTest *t)
 {
   cplist_init();
   cplist_reconfigure();
@@ -1041,8 +1007,7 @@ execute_and_verify(RegressionTest * t)
     cachep = cp_list.head;
     while (cachep) {
       if (cachep->vol_number == cp->number) {
-        if ((cachep->scheme != cp->scheme) ||
-            (cachep->size != (cp->size << (20 - STORE_BLOCK_SHIFT))) || (cachep != cp->cachep)) {
+        if ((cachep->scheme != cp->scheme) || (cachep->size != (cp->size << (20 - STORE_BLOCK_SHIFT))) || (cachep != cp->cachep)) {
           rprintf(t, "Configuration and Actual volumes don't match\n");
           return REGRESSION_TEST_FAILED;
         }
@@ -1095,16 +1060,13 @@ execute_and_verify(RegressionTest * t)
   for (int i = 0; i < gndisks; i++) {
     CacheDisk *d = gdisks[i];
     if (is_debug_tag_set("cache_hosting")) {
-
-      Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64,
-            i, d->header->num_diskvol_blks, d->free_space);
-      for (int j = 0; j < (int) d->header->num_volumes; j++) {
-
+      Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64, i, d->header->num_diskvol_blks, d->free_space);
+      for (int j = 0; j < (int)d->header->num_volumes; j++) {
         Debug("cache_hosting", "\tVol: %d Size: %" PRIu64, d->disk_vols[j]->vol_number, d->disk_vols[j]->size);
       }
-      for (int j = 0; j < (int) d->header->num_diskvol_blks; j++) {
-        Debug("cache_hosting", "\tBlock No: %d Size: %" PRIu64" Free: %u",
-              d->header->vol_info[j].number, d->header->vol_info[j].len, d->header->vol_info[j].free);
+      for (int j = 0; j < (int)d->header->num_diskvol_blks; j++) {
+        Debug("cache_hosting", "\tBlock No: %d Size: %" PRIu64 " Free: %u", d->header->vol_info[j].number,
+              d->header->vol_info[j].len, d->header->vol_info[j].free);
       }
     }
   }
@@ -1112,9 +1074,8 @@ execute_and_verify(RegressionTest * t)
 }
 
 int
-ClearConfigVol(ConfigVolumes * configp)
+ClearConfigVol(ConfigVolumes *configp)
 {
-
   int i = 0;
   ConfigVol *cp = NULL;
   while ((cp = configp->cp_queue.dequeue())) {
@@ -1134,13 +1095,12 @@ ClearConfigVol(ConfigVolumes * configp)
 int
 ClearCacheVolList(Queue<CacheVol> *cpl, int len)
 {
-
   int i = 0;
   CacheVol *cp = NULL;
   while ((cp = cpl->dequeue())) {
     ats_free(cp->disk_vols);
     ats_free(cp->vols);
-    delete(cp);
+    delete (cp);
     i++;
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheHttp.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHttp.cc b/iocore/cache/CacheHttp.cc
index 6bcc4fc..3d7dfba 100644
--- a/iocore/cache/CacheHttp.cc
+++ b/iocore/cache/CacheHttp.cc
@@ -34,8 +34,7 @@ static vec_info default_vec_info;
 #ifdef HTTP_CACHE
 static CacheHTTPInfo default_http_info;
 
-CacheHTTPInfoVector::CacheHTTPInfoVector()
-:magic(NULL), data(&default_vec_info, 4), xcount(0)
+CacheHTTPInfoVector::CacheHTTPInfoVector() : magic(NULL), data(&default_vec_info, 4), xcount(0)
 {
 }
 
@@ -57,7 +56,7 @@ CacheHTTPInfoVector::~CacheHTTPInfoVector()
   -------------------------------------------------------------------------*/
 
 int
-CacheHTTPInfoVector::insert(CacheHTTPInfo * info, int index)
+CacheHTTPInfoVector::insert(CacheHTTPInfo *info, int index)
 {
   if (index == CACHE_ALT_INDEX_DEFAULT)
     index = xcount++;
@@ -71,7 +70,7 @@ CacheHTTPInfoVector::insert(CacheHTTPInfo * info, int index)
 
 
 void
-CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo * r)
+CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo *r)
 {
   int i;
 
@@ -153,8 +152,7 @@ CacheHTTPInfoVector::print(char *buffer, size_t buf_size, bool temps)
       }
 
       if (temps || !(data[i].alternate.object_key_get() == zero_key)) {
-        snprintf(p, buf_size, "[%d %s]", data[i].alternate.id_get(),
-                     CacheKey(data[i].alternate.object_key_get()).toHexStr(buf));
+        snprintf(p, buf_size, "[%d %s]", data[i].alternate.id_get(), CacheKey(data[i].alternate.object_key_get()).toHexStr(buf));
         tmp = strlen(p);
         p += tmp;
         buf_size -= tmp;
@@ -186,7 +184,7 @@ CacheHTTPInfoVector::marshal(char *buf, int length)
   char *start = buf;
   int count = 0;
 
-  ink_assert(!(((intptr_t) buf) & 3));      // buf must be aligned
+  ink_assert(!(((intptr_t)buf) & 3)); // buf must be aligned
 
   for (int i = 0; i < xcount; i++) {
     int tmp = data[i].alternate.marshal(buf, length);
@@ -202,37 +200,36 @@ CacheHTTPInfoVector::marshal(char *buf, int length)
 }
 
 int
-CacheHTTPInfoVector::unmarshal(const char *buf, int length, RefCountObj * block_ptr)
+CacheHTTPInfoVector::unmarshal(const char *buf, int length, RefCountObj *block_ptr)
 {
-  ink_assert(!(((intptr_t) buf) & 3));      // buf must be aligned
+  ink_assert(!(((intptr_t)buf) & 3)); // buf must be aligned
 
   const char *start = buf;
   CacheHTTPInfo info;
   xcount = 0;
 
-  while (length - (buf - start) > (int) sizeof(HTTPCacheAlt)) {
-
-    int tmp = HTTPInfo::unmarshal((char *) buf, length - (buf - start), block_ptr);
+  while (length - (buf - start) > (int)sizeof(HTTPCacheAlt)) {
+    int tmp = HTTPInfo::unmarshal((char *)buf, length - (buf - start), block_ptr);
     if (tmp < 0) {
       return -1;
     }
-    info.m_alt = (HTTPCacheAlt *) buf;
+    info.m_alt = (HTTPCacheAlt *)buf;
     buf += tmp;
 
     data(xcount).alternate = info;
     xcount++;
   }
 
-  return ((caddr_t) buf - (caddr_t) start);
+  return ((caddr_t)buf - (caddr_t)start);
 }
 
 
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 uint32_t
-CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj * block_ptr)
+CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj *block_ptr)
 {
-  ink_assert(!(((intptr_t) buf) & 3));      // buf must be aligned
+  ink_assert(!(((intptr_t)buf) & 3)); // buf must be aligned
 
   const char *start = buf;
   CacheHTTPInfo info;
@@ -240,12 +237,11 @@ CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj * bloc
 
   vector_buf = block_ptr;
 
-  while (length - (buf - start) > (int) sizeof(HTTPCacheAlt)) {
-
-    int tmp = info.get_handle((char *) buf, length - (buf - start));
+  while (length - (buf - start) > (int)sizeof(HTTPCacheAlt)) {
+    int tmp = info.get_handle((char *)buf, length - (buf - start));
     if (tmp < 0) {
       ink_assert(!"CacheHTTPInfoVector::unmarshal get_handle() failed");
-      return (uint32_t) -1;
+      return (uint32_t)-1;
     }
     buf += tmp;
 
@@ -253,13 +249,12 @@ CacheHTTPInfoVector::get_handles(const char *buf, int length, RefCountObj * bloc
     xcount++;
   }
 
-  return ((caddr_t) buf - (caddr_t) start);
+  return ((caddr_t)buf - (caddr_t)start);
 }
 
-#else //HTTP_CACHE
+#else // HTTP_CACHE
 
-CacheHTTPInfoVector::CacheHTTPInfoVector()
-:data(&default_vec_info, 4), xcount(0)
+CacheHTTPInfoVector::CacheHTTPInfoVector() : data(&default_vec_info, 4), xcount(0)
 {
 }
 
@@ -274,7 +269,7 @@ CacheHTTPInfoVector::~CacheHTTPInfoVector()
   -------------------------------------------------------------------------*/
 
 int
-CacheHTTPInfoVector::insert(CacheHTTPInfo */* info ATS_UNUSED */, int index)
+CacheHTTPInfoVector::insert(CacheHTTPInfo * /* info ATS_UNUSED */, int index)
 {
   ink_assert(0);
   return index;
@@ -285,7 +280,7 @@ CacheHTTPInfoVector::insert(CacheHTTPInfo */* info ATS_UNUSED */, int index)
 
 
 void
-CacheHTTPInfoVector::detach(int /* idx ATS_UNUSED */, CacheHTTPInfo */* r ATS_UNUSED */)
+CacheHTTPInfoVector::detach(int /* idx ATS_UNUSED */, CacheHTTPInfo * /* r ATS_UNUSED */)
 {
   ink_assert(0);
 }
@@ -311,7 +306,7 @@ CacheHTTPInfoVector::clear(bool /* destroy ATS_UNUSED */)
   -------------------------------------------------------------------------*/
 
 void
-CacheHTTPInfoVector::print(char */* buffer ATS_UNUSED */, size_t /* buf_size ATS_UNUSED */, bool /* temps ATS_UNUSED */)
+CacheHTTPInfoVector::print(char * /* buffer ATS_UNUSED */, size_t /* buf_size ATS_UNUSED */, bool /* temps ATS_UNUSED */)
 {
   ink_assert(0);
 }
@@ -329,14 +324,15 @@ CacheHTTPInfoVector::marshal_length()
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 int
-CacheHTTPInfoVector::marshal(char */* buf ATS_UNUSED */, int length)
+CacheHTTPInfoVector::marshal(char * /* buf ATS_UNUSED */, int length)
 {
   ink_assert(0);
   return length;
 }
 
 int
-CacheHTTPInfoVector::unmarshal(const char */* buf ATS_UNUSED */, int /* length ATS_UNUSED */, RefCountObj */* block_ptr ATS_UNUSED */)
+CacheHTTPInfoVector::unmarshal(const char * /* buf ATS_UNUSED */, int /* length ATS_UNUSED */,
+                               RefCountObj * /* block_ptr ATS_UNUSED */)
 {
   ink_assert(0);
   return 0;
@@ -346,10 +342,11 @@ CacheHTTPInfoVector::unmarshal(const char */* buf ATS_UNUSED */, int /* length A
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 uint32_t
-CacheHTTPInfoVector::get_handles(const char */* buf ATS_UNUSED */, int /* length ATS_UNUSED */, RefCountObj */* block_ptr ATS_UNUSED */)
+CacheHTTPInfoVector::get_handles(const char * /* buf ATS_UNUSED */, int /* length ATS_UNUSED */,
+                                 RefCountObj * /* block_ptr ATS_UNUSED */)
 {
   ink_assert(0);
   return 0;
 }
 
-#endif //HTTP_CACHE
+#endif // HTTP_CACHE

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cache/CacheLink.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheLink.cc b/iocore/cache/CacheLink.cc
index cbd03ad..feb3846 100644
--- a/iocore/cache/CacheLink.cc
+++ b/iocore/cache/CacheLink.cc
@@ -24,9 +24,8 @@
 #include "P_Cache.h"
 
 Action *
-Cache::link(Continuation * cont, CacheKey * from, CacheKey * to, CacheFragType type, char *hostname, int host_len)
+Cache::link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType type, char *hostname, int host_len)
 {
-
   if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_LINK_FAILED, 0);
     return ACTION_RESULT_DONE;
@@ -36,14 +35,14 @@ Cache::link(Continuation * cont, CacheKey * from, CacheKey * to, CacheFragType t
 
   CacheVC *c = new_CacheVC(cont);
   c->vol = key_to_vol(from, hostname, host_len);
-  c->write_len = sizeof(*to);   // so that the earliest_key will be used
+  c->write_len = sizeof(*to); // so that the earliest_key will be used
   c->f.use_first_key = 1;
   c->first_key = *from;
   c->earliest_key = *to;
 
   c->buf = new_IOBufferData(BUFFER_SIZE_INDEX_512);
 #ifdef DEBUG
-  Doc *doc = (Doc *) c->buf->data();
+  Doc *doc = (Doc *)c->buf->data();
   memcpy(doc->data(), to, sizeof(*to)); // doublecheck
 #endif
 
@@ -72,9 +71,8 @@ Ldone:
 }
 
 Action *
-Cache::deref(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int host_len)
+Cache::deref(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int host_len)
 {
-
   if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_DEREF_FAILED, 0);
     return ACTION_RESULT_DONE;
@@ -90,7 +88,7 @@ Cache::deref(Continuation * cont, CacheKey * key, CacheFragType type, char *host
     MUTEX_TRY_LOCK(lock, vol->mutex, cont->mutex->thread_holding);
     if (lock.is_locked()) {
       if (!dir_probe(key, vol, &result, &last_collision)) {
-        cont->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *) -ECACHE_NO_DOC);
+        cont->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *)-ECACHE_NO_DOC);
         return ACTION_RESULT_DONE;
       }
     }
@@ -107,9 +105,12 @@ Cache::deref(Continuation * cont, CacheKey * key, CacheFragType type, char *host
     }
 
     switch (c->do_read_call(&c->key)) {
-      case EVENT_DONE: return ACTION_RESULT_DONE;
-      case EVENT_RETURN: goto Lcallreturn;
-      default: return &c->_action;
+    case EVENT_DONE:
+      return ACTION_RESULT_DONE;
+    case EVENT_RETURN:
+      goto Lcallreturn;
+    default:
+      return &c->_action;
     }
   }
 Lcallreturn:
@@ -130,36 +131,36 @@ CacheVC::derefRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     return free_CacheVC(this);
   if (!buf)
     goto Lcollision;
-  if ((int) io.aio_result != (int) io.aiocb.aio_nbytes)
+  if ((int)io.aio_result != (int)io.aiocb.aio_nbytes)
     goto Ldone;
   if (!dir_agg_valid(vol, &dir)) {
     last_collision = NULL;
     goto Lcollision;
   }
-  doc = (Doc *) buf->data();
+  doc = (Doc *)buf->data();
   if (!(doc->first_key == key))
     goto Lcollision;
 #ifdef DEBUG
   ink_assert(!memcmp(doc->data(), &doc->key, sizeof(doc->key)));
 #endif
-  _action.continuation->handleEvent(CACHE_EVENT_DEREF, (void *) &doc->key);
+  _action.continuation->handleEvent(CACHE_EVENT_DEREF, (void *)&doc->key);
   return free_CacheVC(this);
 
-Lcollision:{
-    CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
-    if (!lock.is_locked()) {
-      mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay));
-      return EVENT_CONT;
-    }
-    if (dir_probe(&key, vol, &dir, &last_collision)) {
-      int ret = do_read_call(&first_key);
-      if (ret == EVENT_RETURN)
-        goto Lcallreturn;
-      return ret;
-    }
+Lcollision : {
+  CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
+  if (!lock.is_locked()) {
+    mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay));
+    return EVENT_CONT;
   }
+  if (dir_probe(&key, vol, &dir, &last_collision)) {
+    int ret = do_read_call(&first_key);
+    if (ret == EVENT_RETURN)
+      goto Lcallreturn;
+    return ret;
+  }
+}
 Ldone:
-  _action.continuation->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *) -ECACHE_NO_DOC);
+  _action.continuation->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *)-ECACHE_NO_DOC);
   return free_CacheVC(this);
 Lcallreturn:
   return handleEvent(AIO_EVENT_DONE, 0); // hopefully a tail call


[36/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterProcessor.cc b/iocore/cluster/ClusterProcessor.cc
index d205d43..843c30a 100644
--- a/iocore/cluster/ClusterProcessor.cc
+++ b/iocore/cluster/ClusterProcessor.cc
@@ -39,7 +39,7 @@ ClusterProcessor clusterProcessor;
 RecRawStatBlock *cluster_rsb = NULL;
 int ET_CLUSTER;
 
-ClusterProcessor::ClusterProcessor():accept_handler(NULL), this_cluster(NULL)
+ClusterProcessor::ClusterProcessor() : accept_handler(NULL), this_cluster(NULL)
 {
 }
 
@@ -52,8 +52,7 @@ ClusterProcessor::~ClusterProcessor()
 }
 
 int
-ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
-                                         void *data, int len, int options, void *cmsg)
+ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn, void *data, int len, int options, void *cmsg)
 {
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
@@ -67,18 +66,17 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
   bool malloced = (cluster_fn == CLUSTER_FUNCTION_MALLOCED);
   OutgoingControl *c;
 
-  if (!ch || (!malloced && !((unsigned int) cluster_fn < (uint32_t) SIZE_clusterFunction))) {
+  if (!ch || (!malloced && !((unsigned int)cluster_fn < (uint32_t)SIZE_clusterFunction))) {
     // Invalid message or node is down, free message data
     if (cmsg) {
-      invoke_remote_data_args *args = (invoke_remote_data_args *)
-        (((OutgoingControl *) cmsg)->data + sizeof(int32_t));
+      invoke_remote_data_args *args = (invoke_remote_data_args *)(((OutgoingControl *)cmsg)->data + sizeof(int32_t));
       ink_assert(args->magicno == invoke_remote_data_args::MagicNo);
 
       args->data_oc->freeall();
-      ((OutgoingControl *) cmsg)->freeall();
+      ((OutgoingControl *)cmsg)->freeall();
     }
     if (data_in_ocntl) {
-      c = *((OutgoingControl **) ((char *) data - sizeof(OutgoingControl *)));
+      c = *((OutgoingControl **)((char *)data - sizeof(OutgoingControl *)));
       c->freeall();
     }
     if (malloced) {
@@ -88,7 +86,7 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
   }
 
   if (data_in_ocntl) {
-    c = *((OutgoingControl **) ((char *) data - sizeof(OutgoingControl *)));
+    c = *((OutgoingControl **)((char *)data - sizeof(OutgoingControl *)));
   } else {
     c = OutgoingControl::alloc();
   }
@@ -96,7 +94,7 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
   c->submit_time = ink_get_hrtime();
 
   if (malloced) {
-    c->set_data((char *) data, len);
+    c->set_data((char *)data, len);
   } else {
     if (!data_in_ocntl) {
       c->len = len + sizeof(int32_t);
@@ -105,23 +103,22 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
     if (!c->fast_data()) {
       CLUSTER_INCREMENT_DYN_STAT(CLUSTER_SLOW_CTRL_MSGS_SENT_STAT);
     }
-    *(int32_t *) c->data = cluster_fn;
+    *(int32_t *)c->data = cluster_fn;
     if (!data_in_ocntl) {
       memcpy(c->data + sizeof(int32_t), data, len);
     }
   }
 
-  SET_CONTINUATION_HANDLER(c, (OutgoingCtrlHandler) & OutgoingControl::startEvent);
+  SET_CONTINUATION_HANDLER(c, (OutgoingCtrlHandler)&OutgoingControl::startEvent);
 
   /////////////////////////////////////
   // Compound message adjustments
   /////////////////////////////////////
   if (cmsg) {
-    invoke_remote_data_args *args = (invoke_remote_data_args *)
-      (((OutgoingControl *) cmsg)->data + sizeof(int32_t));
+    invoke_remote_data_args *args = (invoke_remote_data_args *)(((OutgoingControl *)cmsg)->data + sizeof(int32_t));
     ink_assert(args->magicno == invoke_remote_data_args::MagicNo);
     args->msg_oc = c;
-    c = (OutgoingControl *) cmsg;
+    c = (OutgoingControl *)cmsg;
   }
 #ifndef CLUSTER_THREAD_STEALING
   delay = true;
@@ -130,13 +127,13 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
     EThread *tt = this_ethread();
     {
       int q = ClusterFuncToQpri(cluster_fn);
-      ink_atomiclist_push(&ch->outgoing_control_al[q], (void *) c);
+      ink_atomiclist_push(&ch->outgoing_control_al[q], (void *)c);
 
       MUTEX_TRY_LOCK(lock, ch->mutex, tt);
       if (!lock.is_locked()) {
-		if(ch->thread && ch->thread->signal_hook)
-		  ch->thread->signal_hook(ch->thread);
-		return 1;
+        if (ch->thread && ch->thread->signal_hook)
+          ch->thread->signal_hook(ch->thread);
+        return 1;
       }
       if (steal)
         ch->steal_thread(tt);
@@ -152,19 +149,17 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn,
 int
 ClusterProcessor::invoke_remote(ClusterHandler *ch, int cluster_fn, void *data, int len, int options)
 {
-  return internal_invoke_remote(ch, cluster_fn, data, len, options, (void *) NULL);
+  return internal_invoke_remote(ch, cluster_fn, data, len, options, (void *)NULL);
 }
 
 int
-ClusterProcessor::invoke_remote_data(ClusterHandler *ch, int cluster_fn,
-                                     void *data, int data_len,
-                                     IOBufferBlock * buf,
-                                     int dest_channel, ClusterVCToken * token,
-                                     void (*bufdata_free_proc) (void *), void *bufdata_free_proc_arg, int options)
+ClusterProcessor::invoke_remote_data(ClusterHandler *ch, int cluster_fn, void *data, int data_len, IOBufferBlock *buf,
+                                     int dest_channel, ClusterVCToken *token, void (*bufdata_free_proc)(void *),
+                                     void *bufdata_free_proc_arg, int options)
 {
   if (!buf) {
     // No buffer data, translate this into a invoke_remote() request
-    return internal_invoke_remote(ch, cluster_fn, data, data_len, options, (void *) NULL);
+    return internal_invoke_remote(ch, cluster_fn, data, data_len, options, (void *)NULL);
   }
   ink_assert(data);
   ink_assert(data_len);
@@ -192,20 +187,20 @@ ClusterProcessor::invoke_remote_data(ClusterHandler *ch, int cluster_fn,
   chdr->submit_time = ink_get_hrtime();
   chdr->len = sizeof(int32_t) + sizeof(mh);
   chdr->alloc_data();
-  *(int32_t *) chdr->data = -1;   // always -1 for compound message
-  memcpy(chdr->data + sizeof(int32_t), (char *) &mh, sizeof(mh));
+  *(int32_t *)chdr->data = -1; // always -1 for compound message
+  memcpy(chdr->data + sizeof(int32_t), (char *)&mh, sizeof(mh));
 
-  return internal_invoke_remote(ch, cluster_fn, data, data_len, options, (void *) chdr);
+  return internal_invoke_remote(ch, cluster_fn, data, data_len, options, (void *)chdr);
 }
 
 // TODO: Why pass in the length here if not used ?
 void
 ClusterProcessor::free_remote_data(char *p, int /* l ATS_UNUSED */)
 {
-  char *d = p - sizeof(int32_t);  // reset to ptr to function code
+  char *d = p - sizeof(int32_t); // reset to ptr to function code
   int data_hdr = ClusterControl::DATA_HDR;
 
-  ink_release_assert(*((uint8_t *) (d - data_hdr + 1)) == (uint8_t) ALLOC_DATA_MAGIC);
+  ink_release_assert(*((uint8_t *)(d - data_hdr + 1)) == (uint8_t)ALLOC_DATA_MAGIC);
   unsigned char size_index = *(d - data_hdr);
   if (!(size_index & 0x80)) {
     ink_release_assert(size_index <= (DEFAULT_BUFFER_SIZES - 1));
@@ -216,7 +211,7 @@ ClusterProcessor::free_remote_data(char *p, int /* l ATS_UNUSED */)
   // Extract 'this' pointer
 
   ClusterControl *ccl;
-  memcpy((char *) &ccl, (d - data_hdr + 2), sizeof(void *));
+  memcpy((char *)&ccl, (d - data_hdr + 2), sizeof(void *));
   ink_assert(ccl->valid_alloc_data());
 
   // Deallocate control structure and data
@@ -225,7 +220,7 @@ ClusterProcessor::free_remote_data(char *p, int /* l ATS_UNUSED */)
 }
 
 ClusterVConnection *
-ClusterProcessor::open_local(Continuation * cont, ClusterMachine */* m ATS_UNUSED */, ClusterVCToken & token, int options)
+ClusterProcessor::open_local(Continuation *cont, ClusterMachine * /* m ATS_UNUSED */, ClusterVCToken &token, int options)
 {
   //
   //  New connect protocol.
@@ -265,9 +260,9 @@ ClusterProcessor::open_local(Continuation * cont, ClusterMachine */* m ATS_UNUSE
       return NULL;
     }
     vc->action_ = cont;
-    ink_atomiclist_push(&ch->external_incoming_open_local, (void *) vc);
-	if(ch->thread && ch->thread->signal_hook)
-	  ch->thread->signal_hook(ch->thread);
+    ink_atomiclist_push(&ch->external_incoming_open_local, (void *)vc);
+    if (ch->thread && ch->thread->signal_hook)
+      ch->thread->signal_hook(ch->thread);
     return CLUSTER_DELAYED_OPEN;
 
 #ifdef CLUSTER_THREAD_STEALING
@@ -287,7 +282,7 @@ ClusterProcessor::open_local(Continuation * cont, ClusterMachine */* m ATS_UNUSE
 }
 
 ClusterVConnection *
-ClusterProcessor::connect_local(Continuation * cont, ClusterVCToken * token, int channel, int options)
+ClusterProcessor::connect_local(Continuation *cont, ClusterVCToken *token, int channel, int options)
 {
   //
   // Establish VC connection initiated by remote node on the local node
@@ -353,7 +348,8 @@ ClusterProcessor::connect_local(Continuation * cont, ClusterVCToken * token, int
 #endif
 }
 
-bool ClusterProcessor::disable_remote_cluster_ops(ClusterMachine * m)
+bool
+ClusterProcessor::disable_remote_cluster_ops(ClusterMachine *m)
 {
   ClusterHandler *ch = m->pop_ClusterHandler(1);
   if (ch) {
@@ -368,8 +364,7 @@ bool ClusterProcessor::disable_remote_cluster_ops(ClusterMachine * m)
 ////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////
 
-GlobalClusterPeriodicEvent *
-  PeriodicClusterEvent;
+GlobalClusterPeriodicEvent *PeriodicClusterEvent;
 
 #ifdef CLUSTER_TOMCAT
 extern int cache_clustering_enabled;
@@ -389,288 +384,220 @@ int RPC_only_CacheCluster = 0;
 int
 ClusterProcessor::init()
 {
-  cluster_rsb = RecAllocateRawStatBlock((int) cluster_stat_count);
+  cluster_rsb = RecAllocateRawStatBlock((int)cluster_stat_count);
   //
   // Statistics callbacks
   //
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_open",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CONNECTIONS_OPEN_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_open", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CONNECTIONS_OPEN_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CONNECTIONS_OPEN_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_opened",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CONNECTIONS_OPENNED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_opened", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CONNECTIONS_OPENNED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CONNECTIONS_OPENNED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_closed",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CON_TOTAL_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_closed", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CON_TOTAL_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CON_TOTAL_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.slow_ctrl_msgs_sent",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_SLOW_CTRL_MSGS_SENT_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.slow_ctrl_msgs_sent", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_SLOW_CTRL_MSGS_SENT_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_SLOW_CTRL_MSGS_SENT_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_read_locked",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CONNECTIONS_READ_LOCKED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_read_locked", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CONNECTIONS_READ_LOCKED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CONNECTIONS_READ_LOCKED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_write_locked",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CONNECTIONS_WRITE_LOCKED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_write_locked", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CONNECTIONS_WRITE_LOCKED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CONNECTIONS_WRITE_LOCKED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.reads",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_READ_BYTES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.reads", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_READ_BYTES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_READ_BYTES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.read_bytes",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_READ_BYTES_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.read_bytes", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_READ_BYTES_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_READ_BYTES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.writes",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_WRITE_BYTES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.writes", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_WRITE_BYTES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_WRITE_BYTES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.write_bytes",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_WRITE_BYTES_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.write_bytes", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_WRITE_BYTES_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_WRITE_BYTES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.control_messages_sent",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CTRL_MSGS_SEND_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.control_messages_sent", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CTRL_MSGS_SEND_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CTRL_MSGS_SEND_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.control_messages_received",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CTRL_MSGS_RECV_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.control_messages_received", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CTRL_MSGS_RECV_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CTRL_MSGS_RECV_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.op_delayed_for_lock",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_OP_DELAYED_FOR_LOCK_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.op_delayed_for_lock", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_OP_DELAYED_FOR_LOCK_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_OP_DELAYED_FOR_LOCK_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_bumped",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CONNECTIONS_BUMPED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_bumped", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CONNECTIONS_BUMPED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CONNECTIONS_BUMPED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.net_backup",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_NET_BACKUP_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.net_backup", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_NET_BACKUP_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_NET_BACKUP_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.nodes",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_NODES_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.nodes", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_NODES_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_NODES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.machines_allocated",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_MACHINES_ALLOCATED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.machines_allocated", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_MACHINES_ALLOCATED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_MACHINES_ALLOCATED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.machines_freed",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_MACHINES_FREED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.machines_freed", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_MACHINES_FREED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_MACHINES_FREED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.configuration_changes",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CONFIGURATION_CHANGES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.configuration_changes", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CONFIGURATION_CHANGES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CONFIGURATION_CHANGES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.delayed_reads",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_DELAYED_READS_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.delayed_reads", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_DELAYED_READS_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_DELAYED_READS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.byte_bank_used",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_BYTE_BANK_USED_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.byte_bank_used", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_BYTE_BANK_USED_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_BYTE_BANK_USED_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.alloc_data_news",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_ALLOC_DATA_NEWS_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.alloc_data_news", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_ALLOC_DATA_NEWS_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_ALLOC_DATA_NEWS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.write_bb_mallocs",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_WRITE_BB_MALLOCS_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.write_bb_mallocs", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_WRITE_BB_MALLOCS_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_WRITE_BB_MALLOCS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.partial_reads",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_PARTIAL_READS_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.partial_reads", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_PARTIAL_READS_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_PARTIAL_READS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.partial_writes",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_PARTIAL_WRITES_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.partial_writes", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_PARTIAL_WRITES_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_PARTIAL_WRITES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.cache_outstanding",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CACHE_OUTSTANDING_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.cache_outstanding", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_OUTSTANDING_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_OUTSTANDING_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.remote_op_timeouts",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_REMOTE_OP_TIMEOUTS_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.remote_op_timeouts", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_REMOTE_OP_TIMEOUTS_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_REMOTE_OP_TIMEOUTS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.remote_op_reply_timeouts",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_REMOTE_OP_REPLY_TIMEOUTS_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.remote_op_reply_timeouts", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_REMOTE_OP_REPLY_TIMEOUTS_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_REMOTE_OP_REPLY_TIMEOUTS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.chan_inuse",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CHAN_INUSE_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.chan_inuse", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CHAN_INUSE_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CHAN_INUSE_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.open_delays",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_OPEN_DELAY_TIME_STAT, RecRawStatSyncSum);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.open_delays", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_OPEN_DELAY_TIME_STAT, RecRawStatSyncSum);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_OPEN_DELAY_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.connections_avg_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_CON_TOTAL_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.connections_avg_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CON_TOTAL_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CON_TOTAL_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.control_messages_avg_send_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_CTRL_MSGS_SEND_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.control_messages_avg_send_time", RECD_FLOAT,
+                     RECP_NON_PERSISTENT, (int)CLUSTER_CTRL_MSGS_SEND_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CTRL_MSGS_SEND_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.control_messages_avg_receive_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_CTRL_MSGS_RECV_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.control_messages_avg_receive_time", RECD_FLOAT,
+                     RECP_NON_PERSISTENT, (int)CLUSTER_CTRL_MSGS_RECV_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CTRL_MSGS_RECV_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.open_delay_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_OPEN_DELAY_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.open_delay_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_OPEN_DELAY_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_OPEN_DELAY_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.cache_callback_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_CACHE_CALLBACK_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.cache_callback_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_CALLBACK_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_CALLBACK_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.rmt_cache_callback_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT,
-                     (int) CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.rmt_cache_callback_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.lkrmt_cache_callback_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT,
-                     (int) CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.lkrmt_cache_callback_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.local_connection_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT,
-                     (int) CLUSTER_LOCAL_CONNECTION_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.local_connection_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_LOCAL_CONNECTION_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_LOCAL_CONNECTION_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.remote_connection_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT,
-                     (int) CLUSTER_REMOTE_CONNECTION_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.remote_connection_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_REMOTE_CONNECTION_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_REMOTE_CONNECTION_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.rdmsg_assemble_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_RDMSG_ASSEMBLE_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.rdmsg_assemble_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_RDMSG_ASSEMBLE_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_RDMSG_ASSEMBLE_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.cluster_ping_time",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) CLUSTER_PING_TIME_STAT, RecRawStatSyncHrTimeAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.cluster_ping_time", RECD_FLOAT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_PING_TIME_STAT, RecRawStatSyncHrTimeAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_PING_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.cache_callbacks",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CACHE_CALLBACK_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.cache_callbacks", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_CALLBACK_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_CALLBACK_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.rmt_cache_callbacks",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.rmt_cache_callbacks", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.lkrmt_cache_callbacks",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.lkrmt_cache_callbacks", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.local_connections_closed",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_LOCAL_CONNECTION_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.local_connections_closed", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_LOCAL_CONNECTION_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_LOCAL_CONNECTION_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.remote_connections_closed",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_REMOTE_CONNECTION_TIME_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.remote_connections_closed", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_REMOTE_CONNECTION_TIME_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_REMOTE_CONNECTION_TIME_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.setdata_no_clustervc",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) cluster_setdata_no_CLUSTERVC_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.setdata_no_clustervc", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)cluster_setdata_no_CLUSTERVC_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(cluster_setdata_no_CLUSTERVC_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.setdata_no_tunnel",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_SETDATA_NO_TUNNEL_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.setdata_no_tunnel", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_SETDATA_NO_TUNNEL_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_SETDATA_NO_TUNNEL_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.setdata_no_cachevc",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_SETDATA_NO_CACHEVC_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.setdata_no_cachevc", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_SETDATA_NO_CACHEVC_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_SETDATA_NO_CACHEVC_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.setdata_no_cluster",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) cluster_setdata_no_CLUSTER_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.setdata_no_cluster", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)cluster_setdata_no_CLUSTER_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(cluster_setdata_no_CLUSTER_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_write_stall",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_WRITE_STALL_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_write_stall", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_WRITE_STALL_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_WRITE_STALL_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.no_remote_space",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_NO_REMOTE_SPACE_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.no_remote_space", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_NO_REMOTE_SPACE_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_NO_REMOTE_SPACE_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.level1_bank",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_LEVEL1_BANK_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.level1_bank", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_LEVEL1_BANK_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_LEVEL1_BANK_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.multilevel_bank",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_MULTILEVEL_BANK_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.multilevel_bank", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_MULTILEVEL_BANK_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_MULTILEVEL_BANK_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_insert_lock_misses",
-                     RECD_INT, RECP_NON_PERSISTENT,
-                     (int) CLUSTER_VC_CACHE_INSERT_LOCK_MISSES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_insert_lock_misses", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_INSERT_LOCK_MISSES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_INSERT_LOCK_MISSES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_inserts",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_CACHE_INSERTS_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_inserts", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_INSERTS_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_INSERTS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_lookup_lock_misses",
-                     RECD_INT, RECP_NON_PERSISTENT,
-                     (int) CLUSTER_VC_CACHE_LOOKUP_LOCK_MISSES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_lookup_lock_misses", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_LOOKUP_LOCK_MISSES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_LOOKUP_LOCK_MISSES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_lookup_hits",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_CACHE_LOOKUP_HITS_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_lookup_hits", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_LOOKUP_HITS_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_LOOKUP_HITS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_lookup_misses",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_CACHE_LOOKUP_MISSES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_lookup_misses", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_LOOKUP_MISSES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_LOOKUP_MISSES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_scans",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_CACHE_SCANS_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_scans", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_SCANS_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_SCANS_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_scan_lock_misses",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_CACHE_SCAN_LOCK_MISSES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_scan_lock_misses", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_SCAN_LOCK_MISSES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_SCAN_LOCK_MISSES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_cache_purges",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_CACHE_PURGES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_cache_purges", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_CACHE_PURGES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_CACHE_PURGES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.write_lock_misses",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_WRITE_LOCK_MISSES_STAT, RecRawStatSyncCount);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.write_lock_misses", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_WRITE_LOCK_MISSES_STAT, RecRawStatSyncCount);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_WRITE_LOCK_MISSES_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_read_list_len",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_READ_LIST_LEN_STAT, RecRawStatSyncAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_read_list_len", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_READ_LIST_LEN_STAT, RecRawStatSyncAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_READ_LIST_LEN_STAT);
-  RecRegisterRawStat(cluster_rsb, RECT_PROCESS,
-                     "proxy.process.cluster.vc_write_list_len",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) CLUSTER_VC_WRITE_LIST_LEN_STAT, RecRawStatSyncAvg);
+  RecRegisterRawStat(cluster_rsb, RECT_PROCESS, "proxy.process.cluster.vc_write_list_len", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)CLUSTER_VC_WRITE_LIST_LEN_STAT, RecRawStatSyncAvg);
   CLUSTER_CLEAR_DYN_STAT(CLUSTER_VC_WRITE_LIST_LEN_STAT);
-  CLUSTER_CLEAR_DYN_STAT(CLUSTER_NODES_STAT);   // clear sum and count
+  CLUSTER_CLEAR_DYN_STAT(CLUSTER_NODES_STAT); // clear sum and count
   // INKqa08033: win2k: ui: cluster warning light on
   // Used to call CLUSTER_INCREMENT_DYN_STAT here; switch to SUM_GLOBAL_DYN_STAT
-  CLUSTER_SUM_GLOBAL_DYN_STAT(CLUSTER_NODES_STAT, 1);   // one node in cluster, ME
+  CLUSTER_SUM_GLOBAL_DYN_STAT(CLUSTER_NODES_STAT, 1); // one node in cluster, ME
 
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_monitor_enabled, "proxy.config.cluster.load_monitor_enabled");
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_ping_message_send_msec_interval, "proxy.config.cluster.ping_send_interval_msecs");
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_num_ping_response_buckets, "proxy.config.cluster.ping_response_buckets");
-  REC_ReadConfigInteger(ClusterLoadMonitor::cf_msecs_per_ping_response_bucket, "proxy.config.cluster.msecs_per_ping_response_bucket");
+  REC_ReadConfigInteger(ClusterLoadMonitor::cf_msecs_per_ping_response_bucket,
+                        "proxy.config.cluster.msecs_per_ping_response_bucket");
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_ping_latency_threshold_msecs, "proxy.config.cluster.ping_latency_threshold_msecs");
-  REC_ReadConfigInteger(ClusterLoadMonitor::cf_cluster_load_compute_msec_interval, "proxy.config.cluster.load_compute_interval_msecs");
-  REC_ReadConfigInteger(ClusterLoadMonitor::cf_cluster_periodic_msec_interval, "proxy.config.cluster.periodic_timer_interval_msecs");
+  REC_ReadConfigInteger(ClusterLoadMonitor::cf_cluster_load_compute_msec_interval,
+                        "proxy.config.cluster.load_compute_interval_msecs");
+  REC_ReadConfigInteger(ClusterLoadMonitor::cf_cluster_periodic_msec_interval,
+                        "proxy.config.cluster.periodic_timer_interval_msecs");
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_ping_history_buf_length, "proxy.config.cluster.ping_history_buf_length");
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_cluster_load_clear_duration, "proxy.config.cluster.cluster_load_clear_duration");
   REC_ReadConfigInteger(ClusterLoadMonitor::cf_cluster_load_exceed_duration, "proxy.config.cluster.cluster_load_exceed_duration");
@@ -747,12 +674,12 @@ ClusterProcessor::start()
     for (int i = 0; i < eventProcessor.n_threads_for_type[ET_CLUSTER]; i++) {
       initialize_thread_for_net(eventProcessor.eventthread[ET_CLUSTER][i]);
     }
-    REC_RegisterConfigUpdateFunc("proxy.config.cluster.cluster_configuration", machine_config_change, (void *) CLUSTER_CONFIG);
-    do_machine_config_change((void *) CLUSTER_CONFIG, "proxy.config.cluster.cluster_configuration");
-    // TODO: Remove this?
+    REC_RegisterConfigUpdateFunc("proxy.config.cluster.cluster_configuration", machine_config_change, (void *)CLUSTER_CONFIG);
+    do_machine_config_change((void *)CLUSTER_CONFIG, "proxy.config.cluster.cluster_configuration");
+// TODO: Remove this?
 #ifdef USE_SEPARATE_MACHINE_CONFIG
-    REC_RegisterConfigUpdateFunc("proxy.config.cluster.machine_configuration", machine_config_change, (void *) MACHINE_CONFIG);
-    do_machine_config_change((void *) MACHINE_CONFIG, "proxy.config.cluster.machine_configuration");
+    REC_RegisterConfigUpdateFunc("proxy.config.cluster.machine_configuration", machine_config_change, (void *)MACHINE_CONFIG);
+    do_machine_config_change((void *)MACHINE_CONFIG, "proxy.config.cluster.machine_configuration");
 #endif
 
     accept_handler = new ClusterAccept(&cluster_port, cluster_receive_buffer_size, cluster_send_buffer_size);
@@ -768,7 +695,7 @@ ClusterProcessor::connect(char *hostname, int16_t id)
   // Construct a cluster link to the given machine
   //
   ClusterHandler *ch = new ClusterHandler;
-  SET_CONTINUATION_HANDLER(ch, (ClusterContHandler) & ClusterHandler::connectClusterEvent);
+  SET_CONTINUATION_HANDLER(ch, (ClusterContHandler)&ClusterHandler::connectClusterEvent);
   ch->hostname = ats_strdup(hostname);
   ch->connector = true;
   ch->id = id;
@@ -782,7 +709,7 @@ ClusterProcessor::connect(unsigned int ip, int port, int16_t id, bool delay)
   // Construct a cluster link to the given machine
   //
   ClusterHandler *ch = new ClusterHandler;
-  SET_CONTINUATION_HANDLER(ch, (ClusterContHandler) & ClusterHandler::connectClusterEvent);
+  SET_CONTINUATION_HANDLER(ch, (ClusterContHandler)&ClusterHandler::connectClusterEvent);
   ch->ip = ip;
   ch->port = port;
   ch->connector = true;
@@ -794,7 +721,7 @@ ClusterProcessor::connect(unsigned int ip, int port, int16_t id, bool delay)
 }
 
 void
-ClusterProcessor::send_machine_list(ClusterMachine * m)
+ClusterProcessor::send_machine_list(ClusterMachine *m)
 {
   //
   // In testing mode, cluster nodes automagically connect to all
@@ -816,7 +743,7 @@ ClusterProcessor::send_machine_list(ClusterMachine * m)
       n++;
     }
     msg->n_ip = n;
-    data = (void *) msg;
+    data = (void *)msg;
     len = msg->sizeof_fixedlen_msg() + (n * sizeof(uint32_t));
 
   } else {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterRPC.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterRPC.cc b/iocore/cluster/ClusterRPC.cc
index 043f082..40632c5 100644
--- a/iocore/cluster/ClusterRPC.cc
+++ b/iocore/cluster/ClusterRPC.cc
@@ -48,18 +48,18 @@ ping_reply_ClusterFunction(ClusterHandler *ch, void *data, int len)
   //
   // Pass back the data.
   //
-  PingMessage *msg = (PingMessage *) data;
+  PingMessage *msg = (PingMessage *)data;
   msg->fn(ch, msg->data, (len - msg->sizeof_fixedlen_msg()));
 }
 
 void
-machine_list_ClusterFunction(ClusterHandler * from, void *data, int len)
+machine_list_ClusterFunction(ClusterHandler *from, void *data, int len)
 {
-  (void) from;
-  ClusterMessageHeader *mh = (ClusterMessageHeader *) data;
-  MachineListMessage *m = (MachineListMessage *) data;
+  (void)from;
+  ClusterMessageHeader *mh = (ClusterMessageHeader *)data;
+  MachineListMessage *m = (MachineListMessage *)data;
 
-  if (mh->GetMsgVersion() != MachineListMessage::MACHINE_LIST_MESSAGE_VERSION) {        ////////////////////////////////////////////////
+  if (mh->GetMsgVersion() != MachineListMessage::MACHINE_LIST_MESSAGE_VERSION) { ////////////////////////////////////////////////
     // Convert from old to current message format
     ////////////////////////////////////////////////
     ink_release_assert(!"machine_list_ClusterFunction() bad msg version");
@@ -95,10 +95,10 @@ machine_list_ClusterFunction(ClusterHandler * from, void *data, int len)
 void
 close_channel_ClusterFunction(ClusterHandler *ch, void *data, int len)
 {
-  ClusterMessageHeader *mh = (ClusterMessageHeader *) data;
-  CloseMessage *m = (CloseMessage *) data;
+  ClusterMessageHeader *mh = (ClusterMessageHeader *)data;
+  CloseMessage *m = (CloseMessage *)data;
 
-  if (mh->GetMsgVersion() != CloseMessage::CLOSE_CHAN_MESSAGE_VERSION) {        ////////////////////////////////////////////////
+  if (mh->GetMsgVersion() != CloseMessage::CLOSE_CHAN_MESSAGE_VERSION) { ////////////////////////////////////////////////
     // Convert from old to current message format
     ////////////////////////////////////////////////
     ink_release_assert(!"close_channel_ClusterFunction() bad msg version");
@@ -109,7 +109,7 @@ close_channel_ClusterFunction(ClusterHandler *ch, void *data, int len)
   //
   // Close the remote side of a VC connection (remote node is originator)
   //
-  ink_assert(len >= (int) sizeof(CloseMessage));
+  ink_assert(len >= (int)sizeof(CloseMessage));
   if (!ch || !ch->channels)
     return;
   ClusterVConnection *vc = ch->channels[m->channel];
@@ -131,27 +131,25 @@ test_ClusterFunction(ClusterHandler *ch, void *data, int len)
 }
 
 CacheVC *
-ChannelToCacheWriteVC(ClusterHandler * ch, int channel, uint32_t channel_seqno, ClusterVConnection ** cluster_vc)
+ChannelToCacheWriteVC(ClusterHandler *ch, int channel, uint32_t channel_seqno, ClusterVConnection **cluster_vc)
 {
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
 
   ClusterVConnection *cvc = ch->channels[channel];
-  if (!VALID_CHANNEL(cvc)
-      || (channel_seqno != cvc->token.sequence_number)
-      || (cvc->read.vio.op != VIO::READ)) {
+  if (!VALID_CHANNEL(cvc) || (channel_seqno != cvc->token.sequence_number) || (cvc->read.vio.op != VIO::READ)) {
     CLUSTER_INCREMENT_DYN_STAT(cluster_setdata_no_CLUSTERVC_STAT);
     return NULL;
   }
   // Tunneling from cluster to cache (remote write).
   // Get cache VC pointer.
 
-  OneWayTunnel *owt = (OneWayTunnel *) cvc->read.vio._cont;
+  OneWayTunnel *owt = (OneWayTunnel *)cvc->read.vio._cont;
   if (!owt) {
     CLUSTER_INCREMENT_DYN_STAT(CLUSTER_SETDATA_NO_TUNNEL_STAT);
     return NULL;
   }
-  CacheVC *cache_vc = (CacheVC *) owt->vioTarget->vc_server;
+  CacheVC *cache_vc = (CacheVC *)owt->vioTarget->vc_server;
   if (!cache_vc) {
     CLUSTER_INCREMENT_DYN_STAT(CLUSTER_SETDATA_NO_CACHEVC_STAT);
     return NULL;
@@ -176,14 +174,15 @@ set_channel_data_ClusterFunction(ClusterHandler *ch, void *tdata, int tlen)
   ic->len = tlen;
   ic->alloc_data();
 
-  data = ic->data + sizeof(int32_t);      // free_remote_data expects d+sizeof(int32_t)
+  data = ic->data + sizeof(int32_t); // free_remote_data expects d+sizeof(int32_t)
   memcpy(data, tdata, tlen);
   len = tlen;
 
-  ClusterMessageHeader *mh = (ClusterMessageHeader *) data;
-  SetChanDataMessage *m = (SetChanDataMessage *) data;
+  ClusterMessageHeader *mh = (ClusterMessageHeader *)data;
+  SetChanDataMessage *m = (SetChanDataMessage *)data;
 
-  if (mh->GetMsgVersion() != SetChanDataMessage::SET_CHANNEL_DATA_MESSAGE_VERSION) {    ////////////////////////////////////////////////
+  if (mh->GetMsgVersion() !=
+      SetChanDataMessage::SET_CHANNEL_DATA_MESSAGE_VERSION) { ////////////////////////////////////////////////
     // Convert from old to current message format
     ////////////////////////////////////////////////
     ink_release_assert(!"set_channel_data_ClusterFunction() bad msg version");
@@ -202,27 +201,25 @@ set_channel_data_ClusterFunction(ClusterHandler *ch, void *tdata, int tlen)
     }
     // Unmarshal data.
     switch (m->data_type) {
-    case CACHE_DATA_HTTP_INFO:
-      {
-        char *p = (char *) m + SetChanDataMessage::sizeof_fixedlen_msg();
-
-        IOBufferBlock *block_ref = ic->get_block();
-        res = HTTPInfo::unmarshal(p, len, block_ref);
-        ink_assert(res > 0);
-
-        CacheHTTPInfo h;
-        h.get_handle((char *) &m->data[0], len);
-        h.set_buffer_reference(block_ref);
-        cache_vc->set_http_info(&h);
-        ic->freeall();
-        break;
-      }
-    default:
-      {
-        ink_release_assert(!"set_channel_data_ClusterFunction bad CacheDataType");
-      }
-    }                           // End of switch
-    ++cvc->n_recv_set_data_msgs;        // note received messages
+    case CACHE_DATA_HTTP_INFO: {
+      char *p = (char *)m + SetChanDataMessage::sizeof_fixedlen_msg();
+
+      IOBufferBlock *block_ref = ic->get_block();
+      res = HTTPInfo::unmarshal(p, len, block_ref);
+      ink_assert(res > 0);
+
+      CacheHTTPInfo h;
+      h.get_handle((char *)&m->data[0], len);
+      h.set_buffer_reference(block_ref);
+      cache_vc->set_http_info(&h);
+      ic->freeall();
+      break;
+    }
+    default: {
+      ink_release_assert(!"set_channel_data_ClusterFunction bad CacheDataType");
+    }
+    }                            // End of switch
+    ++cvc->n_recv_set_data_msgs; // note received messages
 
   } else {
     ic->freeall();
@@ -241,7 +238,7 @@ post_setchan_send_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS
   // Decrement Cluster VC n_set_data_msgs to allow transmission of
   // initial open_write data after (n_set_data_msgs == 0).
 
-  SetChanDataMessage *m = (SetChanDataMessage *) data;
+  SetChanDataMessage *m = (SetChanDataMessage *)data;
   ClusterVConnection *cvc;
 
   if (ch) {
@@ -260,15 +257,15 @@ void
 set_channel_pin_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED */)
 {
   // This isn't used. /leif
-  //EThread *thread = this_ethread();
-  //ProxyMutex *mutex = thread->mutex;
+  // EThread *thread = this_ethread();
+  // ProxyMutex *mutex = thread->mutex;
 
   // We are called on the ET_CLUSTER thread.
 
-  ClusterMessageHeader *mh = (ClusterMessageHeader *) data;
-  SetChanPinMessage *m = (SetChanPinMessage *) data;
+  ClusterMessageHeader *mh = (ClusterMessageHeader *)data;
+  SetChanPinMessage *m = (SetChanPinMessage *)data;
 
-  if (mh->GetMsgVersion() != SetChanPinMessage::SET_CHANNEL_PIN_MESSAGE_VERSION) {      ////////////////////////////////////////////////
+  if (mh->GetMsgVersion() != SetChanPinMessage::SET_CHANNEL_PIN_MESSAGE_VERSION) { ////////////////////////////////////////////////
     // Convert from old to current message format
     ////////////////////////////////////////////////
     ink_release_assert(!"set_channel_pin_ClusterFunction() bad msg version");
@@ -277,7 +274,7 @@ set_channel_pin_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_U
   if (m->NeedByteSwap())
     m->SwapBytes();
 
-  ClusterVConnection *cvc = NULL;       // Just to make GCC happy
+  ClusterVConnection *cvc = NULL; // Just to make GCC happy
   CacheVC *cache_vc;
 
   if (ch != 0) {
@@ -286,7 +283,7 @@ set_channel_pin_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_U
       cache_vc->set_pin_in_cache(m->pin_time);
     }
     // cvc is always set in ChannelToCacheWriteVC, so need to check it
-    ++cvc->n_recv_set_data_msgs;        // note received messages
+    ++cvc->n_recv_set_data_msgs; // note received messages
   }
 }
 
@@ -301,7 +298,7 @@ post_setchan_pin_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_
   // Decrement Cluster VC n_set_data_msgs to allow transmission of
   // initial open_write data after (n_set_data_msgs == 0).
 
-  SetChanPinMessage *m = (SetChanPinMessage *) data;
+  SetChanPinMessage *m = (SetChanPinMessage *)data;
   ClusterVConnection *cvc;
 
   if (ch) {
@@ -320,15 +317,16 @@ void
 set_channel_priority_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUSED */)
 {
   // This isn't used.
-  //EThread *thread = this_ethread();
-  //ProxyMutex *mutex = thread->mutex;
+  // EThread *thread = this_ethread();
+  // ProxyMutex *mutex = thread->mutex;
 
   // We are called on the ET_CLUSTER thread.
 
-  ClusterMessageHeader *mh = (ClusterMessageHeader *) data;
-  SetChanPriorityMessage *m = (SetChanPriorityMessage *) data;
+  ClusterMessageHeader *mh = (ClusterMessageHeader *)data;
+  SetChanPriorityMessage *m = (SetChanPriorityMessage *)data;
 
-  if (mh->GetMsgVersion() != SetChanPriorityMessage::SET_CHANNEL_PRIORITY_MESSAGE_VERSION) {    ////////////////////////////////////////////////
+  if (mh->GetMsgVersion() !=
+      SetChanPriorityMessage::SET_CHANNEL_PRIORITY_MESSAGE_VERSION) { ////////////////////////////////////////////////
     // Convert from old to current message format
     ////////////////////////////////////////////////
     ink_release_assert(!"set_channel_priority_ClusterFunction() bad msg version");
@@ -336,7 +334,7 @@ set_channel_priority_ClusterFunction(ClusterHandler *ch, void *data, int /* len
   if (m->NeedByteSwap())
     m->SwapBytes();
 
-  ClusterVConnection *cvc = NULL;       // Just to make GCC happy
+  ClusterVConnection *cvc = NULL; // Just to make GCC happy
   CacheVC *cache_vc;
 
   if (ch != 0) {
@@ -345,7 +343,7 @@ set_channel_priority_ClusterFunction(ClusterHandler *ch, void *data, int /* len
       cache_vc->set_disk_io_priority(m->disk_priority);
     }
     // cvc is always set in ChannelToCacheWriteVC, so need to check it
-    ++cvc->n_recv_set_data_msgs;        // note received messages
+    ++cvc->n_recv_set_data_msgs; // note received messages
   }
 }
 
@@ -361,7 +359,7 @@ post_setchan_priority_ClusterFunction(ClusterHandler *ch, void *data, int /* len
   // Decrement Cluster VC n_set_data_msgs to allow transmission of
   // initial open_write data after (n_set_data_msgs == 0).
 
-  SetChanPriorityMessage *m = (SetChanPriorityMessage *) data;
+  SetChanPriorityMessage *m = (SetChanPriorityMessage *)data;
   ClusterVConnection *cvc;
 
   if (ch) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/ClusterVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterVConnection.cc b/iocore/cluster/ClusterVConnection.cc
index c2c53ac..7a3185e 100644
--- a/iocore/cluster/ClusterVConnection.cc
+++ b/iocore/cluster/ClusterVConnection.cc
@@ -32,7 +32,7 @@ ClassAllocator<ClusterVConnection> clusterVCAllocator("clusterVCAllocator");
 ClassAllocator<ByteBankDescriptor> byteBankAllocator("byteBankAllocator");
 
 ByteBankDescriptor *
-ByteBankDescriptor::ByteBankDescriptor_alloc(IOBufferBlock * iob)
+ByteBankDescriptor::ByteBankDescriptor_alloc(IOBufferBlock *iob)
 {
   ByteBankDescriptor *b = byteBankAllocator.alloc();
   b->block = iob;
@@ -40,14 +40,14 @@ ByteBankDescriptor::ByteBankDescriptor_alloc(IOBufferBlock * iob)
 }
 
 void
-ByteBankDescriptor::ByteBankDescriptor_free(ByteBankDescriptor * b)
+ByteBankDescriptor::ByteBankDescriptor_free(ByteBankDescriptor *b)
 {
   b->block = 0;
   byteBankAllocator.free(b);
 }
 
 void
-clusterVCAllocator_free(ClusterVConnection * vc)
+clusterVCAllocator_free(ClusterVConnection *vc)
 {
   vc->mutex = 0;
   vc->action_ = 0;
@@ -59,22 +59,21 @@ clusterVCAllocator_free(ClusterVConnection * vc)
   clusterVCAllocator.free(vc);
 }
 
-ClusterVConnState::ClusterVConnState():enabled(0), priority(1), vio(VIO::NONE), queue(0), ifd(-1), delay_timeout(NULL)
+ClusterVConnState::ClusterVConnState() : enabled(0), priority(1), vio(VIO::NONE), queue(0), ifd(-1), delay_timeout(NULL)
 {
 }
 
-ClusterVConnectionBase::ClusterVConnectionBase():
-thread(0), closed(0), inactivity_timeout_in(0), active_timeout_in(0), inactivity_timeout(NULL), active_timeout(NULL)
+ClusterVConnectionBase::ClusterVConnectionBase()
+  : thread(0), closed(0), inactivity_timeout_in(0), active_timeout_in(0), inactivity_timeout(NULL), active_timeout(NULL)
 {
 }
 
 #ifdef DEBUG
-int
-  ClusterVConnectionBase::enable_debug_trace = 0;
+int ClusterVConnectionBase::enable_debug_trace = 0;
 #endif
 
 VIO *
-ClusterVConnectionBase::do_io_read(Continuation * acont, int64_t anbytes, MIOBuffer * abuffer)
+ClusterVConnectionBase::do_io_read(Continuation *acont, int64_t anbytes, MIOBuffer *abuffer)
 {
   ink_assert(!closed);
   read.vio.buffer.writer_for(abuffer);
@@ -82,10 +81,10 @@ ClusterVConnectionBase::do_io_read(Continuation * acont, int64_t anbytes, MIOBuf
   read.vio.set_continuation(acont);
   read.vio.nbytes = anbytes;
   read.vio.ndone = 0;
-  read.vio.vc_server = (VConnection *) this;
+  read.vio.vc_server = (VConnection *)this;
   read.enabled = 1;
 
-  ClusterVConnection *cvc = (ClusterVConnection *) this;
+  ClusterVConnection *cvc = (ClusterVConnection *)this;
   Debug("cluster_vc_xfer", "do_io_read [%s] chan %d", "", cvc->channel);
   return &read.vio;
 }
@@ -119,7 +118,7 @@ ClusterVConnection::get_single_data(void ** /* ptr ATS_UNUSED */, int * /* len A
 }
 
 VIO *
-ClusterVConnectionBase::do_io_write(Continuation * acont, int64_t anbytes, IOBufferReader * abuffer, bool owner)
+ClusterVConnectionBase::do_io_write(Continuation *acont, int64_t anbytes, IOBufferReader *abuffer, bool owner)
 {
   ink_assert(!closed);
   ink_assert(!owner);
@@ -128,7 +127,7 @@ ClusterVConnectionBase::do_io_write(Continuation * acont, int64_t anbytes, IOBuf
   write.vio.set_continuation(acont);
   write.vio.nbytes = anbytes;
   write.vio.ndone = 0;
-  write.vio.vc_server = (VConnection *) this;
+  write.vio.vc_server = (VConnection *)this;
   write.enabled = 1;
 
   return &write.vio;
@@ -162,7 +161,7 @@ ClusterVConnection::reenable(VIO *vio)
 }
 
 void
-ClusterVConnectionBase::reenable(VIO * vio)
+ClusterVConnectionBase::reenable(VIO *vio)
 {
   ink_assert(!closed);
   if (vio == &read.vio) {
@@ -183,45 +182,23 @@ ClusterVConnectionBase::reenable(VIO * vio)
 }
 
 void
-ClusterVConnectionBase::reenable_re(VIO * vio)
+ClusterVConnectionBase::reenable_re(VIO *vio)
 {
   reenable(vio);
 }
 
 ClusterVConnection::ClusterVConnection(int is_new_connect_read)
-  :  ch(NULL),
-     new_connect_read(is_new_connect_read),
-     remote_free(0),
-     last_local_free(0),
-     channel(0),
-     close_disabled(0),
-     remote_closed(0),
-     remote_close_disabled(1),
-     remote_lerrno(0),
-     in_vcs(0),
-     type(0),
-     start_time(0),
-     last_activity_time(0),
-     n_set_data_msgs(0),
-     n_recv_set_data_msgs(0),
-     pending_remote_fill(0),
-     remote_ram_cache_hit(0),
-     have_all_data(0),
-     initial_data_bytes(0),
-     current_cont(0),
-     iov_map(CLUSTER_IOV_NOT_OPEN),
-     write_list_tail(0),
-     write_list_bytes(0),
-     write_bytes_in_transit(0),
-     alternate(),
-     time_pin(0),
-     disk_io_priority(0)
+  : ch(NULL), new_connect_read(is_new_connect_read), remote_free(0), last_local_free(0), channel(0), close_disabled(0),
+    remote_closed(0), remote_close_disabled(1), remote_lerrno(0), in_vcs(0), type(0), start_time(0), last_activity_time(0),
+    n_set_data_msgs(0), n_recv_set_data_msgs(0), pending_remote_fill(0), remote_ram_cache_hit(0), have_all_data(0),
+    initial_data_bytes(0), current_cont(0), iov_map(CLUSTER_IOV_NOT_OPEN), write_list_tail(0), write_list_bytes(0),
+    write_bytes_in_transit(0), alternate(), time_pin(0), disk_io_priority(0)
 {
 #ifdef DEBUG
   read.vio.buffer.name = "ClusterVConnection.read";
   write.vio.buffer.name = "ClusterVConnection.write";
 #endif
-  SET_HANDLER((ClusterVConnHandler) & ClusterVConnection::startEvent);
+  SET_HANDLER((ClusterVConnHandler)&ClusterVConnection::startEvent);
 }
 
 ClusterVConnection::~ClusterVConnection()
@@ -249,7 +226,7 @@ ClusterVConnection::free()
 }
 
 VIO *
-ClusterVConnection::do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf)
+ClusterVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
 {
   if (type == VC_CLUSTER)
     type = VC_CLUSTER_READ;
@@ -259,7 +236,7 @@ ClusterVConnection::do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf
 }
 
 VIO *
-ClusterVConnection::do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool owner)
+ClusterVConnection::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
 {
   if (type == VC_CLUSTER)
     type = VC_CLUSTER_WRITE;
@@ -283,27 +260,27 @@ ClusterVConnection::do_io_close(int alerrno)
 }
 
 int
-ClusterVConnection::startEvent(int event, Event * e)
+ClusterVConnection::startEvent(int event, Event *e)
 {
   //
   // Safe to call with e == NULL from the same thread.
   //
-  (void) event;
-  start(e ? e->ethread : (EThread *) NULL);
+  (void)event;
+  start(e ? e->ethread : (EThread *)NULL);
   return EVENT_DONE;
 }
 
 int
-ClusterVConnection::mainEvent(int event, Event * e)
+ClusterVConnection::mainEvent(int event, Event *e)
 {
-  (void) event;
-  (void) e;
+  (void)event;
+  (void)e;
   ink_assert(!"unexpected event");
   return EVENT_DONE;
 }
 
 int
-ClusterVConnection::start(EThread * t)
+ClusterVConnection::start(EThread *t)
 {
   //
   //  New channel connect protocol.  Establish VC locally and send the
@@ -352,7 +329,7 @@ ClusterVConnection::start(EThread * t)
     }
     if (!ch) {
       if (action_.continuation) {
-        action_.continuation->handleEvent(CLUSTER_EVENT_OPEN_FAILED, (void *) -ECLUSTER_NO_MACHINE);
+        action_.continuation->handleEvent(CLUSTER_EVENT_OPEN_FAILED, (void *)-ECLUSTER_NO_MACHINE);
         clusterVCAllocator_free(this);
         return EVENT_DONE;
       } else {
@@ -365,7 +342,7 @@ ClusterVConnection::start(EThread * t)
     channel = ch->alloc_channel(this);
     if (channel < 0) {
       if (action_.continuation) {
-        action_.continuation->handleEvent(CLUSTER_EVENT_OPEN_FAILED, (void *) -ECLUSTER_NOMORE_CHANNELS);
+        action_.continuation->handleEvent(CLUSTER_EVENT_OPEN_FAILED, (void *)-ECLUSTER_NOMORE_CHANNELS);
         clusterVCAllocator_free(this);
         return EVENT_DONE;
       } else {
@@ -385,7 +362,7 @@ ClusterVConnection::start(EThread * t)
     if ((status = ch->alloc_channel(this, channel)) < 0) {
       Debug(CL_TRACE, "VC start alloc remote failed chan=%d VC=%p", channel, this);
       clusterVCAllocator_free(this);
-      return status;            // Channel active or no more channels
+      return status; // Channel active or no more channels
     } else {
       Debug(CL_TRACE, "VC start alloc remote chan=%d VC=%p", channel, this);
       if (new_connect_read)
@@ -435,7 +412,8 @@ ClusterVConnection::allow_remote_close()
   remote_close_disabled = 0;
 }
 
-bool ClusterVConnection::schedule_write()
+bool
+ClusterVConnection::schedule_write()
 {
   //
   // Schedule write if we have all data or current write data is
@@ -476,27 +454,25 @@ ClusterVConnection::set_type(int options)
 }
 
 // Overide functions in base class VConnection.
-bool ClusterVConnection::get_data(int id, void * /* data ATS_UNUSED */)
+bool
+ClusterVConnection::get_data(int id, void * /* data ATS_UNUSED */)
 {
   switch (id) {
-  case CACHE_DATA_HTTP_INFO:
-    {
-      ink_release_assert(!"ClusterVConnection::get_data CACHE_DATA_HTTP_INFO not supported");
-    }
-  case CACHE_DATA_KEY:
-    {
-      ink_release_assert(!"ClusterVConnection::get_data CACHE_DATA_KEY not supported");
-    }
-  default:
-    {
-      ink_release_assert(!"ClusterVConnection::get_data invalid id");
-    }
+  case CACHE_DATA_HTTP_INFO: {
+    ink_release_assert(!"ClusterVConnection::get_data CACHE_DATA_HTTP_INFO not supported");
+  }
+  case CACHE_DATA_KEY: {
+    ink_release_assert(!"ClusterVConnection::get_data CACHE_DATA_KEY not supported");
+  }
+  default: {
+    ink_release_assert(!"ClusterVConnection::get_data invalid id");
+  }
   }
   return false;
 }
 
 void
-ClusterVConnection::get_http_info(CacheHTTPInfo ** info)
+ClusterVConnection::get_http_info(CacheHTTPInfo **info)
 {
   *info = &alternate;
 }
@@ -514,7 +490,7 @@ ClusterVConnection::is_pread_capable()
 }
 
 void
-ClusterVConnection::set_http_info(CacheHTTPInfo * d)
+ClusterVConnection::set_http_info(CacheHTTPInfo *d)
 {
   int flen, len;
   void *data;
@@ -529,9 +505,9 @@ ClusterVConnection::set_http_info(CacheHTTPInfo * d)
   // Cache semantics dictate that set_http_info() be established prior
   // to transferring any data on the ClusterVConnection.
   //
-  ink_release_assert(this->write.vio.op == VIO::NONE);  // not true if do_io()
+  ink_release_assert(this->write.vio.op == VIO::NONE); // not true if do_io()
   //   already done
-  ink_release_assert(this->read.vio.op == VIO::NONE);   // should always be true
+  ink_release_assert(this->read.vio.op == VIO::NONE); // should always be true
 
   int vers = SetChanDataMessage::protoToVersion(ch->machine->msg_proto_major);
   if (vers == SetChanDataMessage::SET_CHANNEL_DATA_MESSAGE_VERSION) {
@@ -547,12 +523,12 @@ ClusterVConnection::set_http_info(CacheHTTPInfo * d)
 
   CacheHTTPInfo *r = d;
   len = r->marshal_length();
-  data = (void *) ALLOCA_DOUBLE(flen + len);
-  memcpy((char *) data, (char *) &msg, sizeof(msg));
-  m = (SetChanDataMessage *) data;
+  data = (void *)ALLOCA_DOUBLE(flen + len);
+  memcpy((char *)data, (char *)&msg, sizeof(msg));
+  m = (SetChanDataMessage *)data;
   m->data_type = CACHE_DATA_HTTP_INFO;
 
-  char *p = (char *) m + flen;
+  char *p = (char *)m + flen;
   res = r->marshal(p, len);
   if (res < 0) {
     r->destroy();
@@ -569,7 +545,8 @@ ClusterVConnection::set_http_info(CacheHTTPInfo * d)
   clusterProcessor.invoke_remote(ch, SET_CHANNEL_DATA_CLUSTER_FUNCTION, data, flen + len);
 }
 
-bool ClusterVConnection::set_pin_in_cache(time_t t)
+bool
+ClusterVConnection::set_pin_in_cache(time_t t)
 {
   SetChanPinMessage msg;
 
@@ -578,9 +555,9 @@ bool ClusterVConnection::set_pin_in_cache(time_t t)
   // open_write() ClusterVConnection.  It is only allowed after a
   // successful open_write() and prior to issuing the do_io(VIO::WRITE).
   //
-  ink_release_assert(this->write.vio.op == VIO::NONE);  // not true if do_io()
+  ink_release_assert(this->write.vio.op == VIO::NONE); // not true if do_io()
   //   already done
-  ink_release_assert(this->read.vio.op == VIO::NONE);   // should always be true
+  ink_release_assert(this->read.vio.op == VIO::NONE); // should always be true
   time_pin = t;
 
   int vers = SetChanPinMessage::protoToVersion(ch->machine->msg_proto_major);
@@ -591,7 +568,8 @@ bool ClusterVConnection::set_pin_in_cache(time_t t)
     //////////////////////////////////////////////////////////////
     // Create the specified down rev version of this message
     //////////////////////////////////////////////////////////////
-    ink_release_assert(!"ClusterVConnection::set_pin_in_cache() bad msg " "version");
+    ink_release_assert(!"ClusterVConnection::set_pin_in_cache() bad msg "
+                        "version");
   }
   msg.channel = channel;
   msg.sequence_number = token.sequence_number;
@@ -600,16 +578,18 @@ bool ClusterVConnection::set_pin_in_cache(time_t t)
   // note pending set_data() msgs on VC.
   ink_atomic_increment(&n_set_data_msgs, 1);
 
-  clusterProcessor.invoke_remote(ch, SET_CHANNEL_PIN_CLUSTER_FUNCTION, (char *) &msg, sizeof(msg));
+  clusterProcessor.invoke_remote(ch, SET_CHANNEL_PIN_CLUSTER_FUNCTION, (char *)&msg, sizeof(msg));
   return true;
 }
 
-time_t ClusterVConnection::get_pin_in_cache()
+time_t
+ClusterVConnection::get_pin_in_cache()
 {
   return time_pin;
 }
 
-bool ClusterVConnection::set_disk_io_priority(int priority)
+bool
+ClusterVConnection::set_disk_io_priority(int priority)
 {
   SetChanPriorityMessage msg;
 
@@ -618,9 +598,9 @@ bool ClusterVConnection::set_disk_io_priority(int priority)
   // open_write() ClusterVConnection.  It is only allowed after a
   // successful open_write() and prior to issuing the do_io(VIO::WRITE).
   //
-  ink_release_assert(this->write.vio.op == VIO::NONE);  // not true if do_io()
+  ink_release_assert(this->write.vio.op == VIO::NONE); // not true if do_io()
   //   already done
-  ink_release_assert(this->read.vio.op == VIO::NONE);   // should always be true
+  ink_release_assert(this->read.vio.op == VIO::NONE); // should always be true
   disk_io_priority = priority;
 
   int vers = SetChanPriorityMessage::protoToVersion(ch->machine->msg_proto_major);
@@ -631,7 +611,8 @@ bool ClusterVConnection::set_disk_io_priority(int priority)
     //////////////////////////////////////////////////////////////
     // Create the specified down rev version of this message
     //////////////////////////////////////////////////////////////
-    ink_release_assert(!"ClusterVConnection::set_disk_io_priority() bad msg " "version");
+    ink_release_assert(!"ClusterVConnection::set_disk_io_priority() bad msg "
+                        "version");
   }
   msg.channel = channel;
   msg.sequence_number = token.sequence_number;
@@ -640,7 +621,7 @@ bool ClusterVConnection::set_disk_io_priority(int priority)
   // note pending set_data() msgs on VC.
   ink_atomic_increment(&n_set_data_msgs, 1);
 
-  clusterProcessor.invoke_remote(ch, SET_CHANNEL_PRIORITY_CLUSTER_FUNCTION, (char *) &msg, sizeof(msg));
+  clusterProcessor.invoke_remote(ch, SET_CHANNEL_PRIORITY_CLUSTER_FUNCTION, (char *)&msg, sizeof(msg));
   return true;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/cluster/P_Cluster.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_Cluster.h b/iocore/cluster/P_Cluster.h
index aa3d6a5..0376f63 100644
--- a/iocore/cluster/P_Cluster.h
+++ b/iocore/cluster/P_Cluster.h
@@ -47,17 +47,16 @@
 #include "P_TimeTrace.h"
 
 
-#define ECLUSTER_NO_VC                    (CLUSTER_ERRNO+0)
-#define ECLUSTER_NO_MACHINE               (CLUSTER_ERRNO+1)
-#define ECLUSTER_OP_TIMEOUT               (CLUSTER_ERRNO+2)
-#define ECLUSTER_ORB_DATA_READ            (CLUSTER_ERRNO+3)
-#define ECLUSTER_ORB_EIO                  (CLUSTER_ERRNO+4)
-#define ECLUSTER_CHANNEL_INUSE            (CLUSTER_ERRNO+5)
-#define ECLUSTER_NOMORE_CHANNELS          (CLUSTER_ERRNO+6)
+#define ECLUSTER_NO_VC (CLUSTER_ERRNO + 0)
+#define ECLUSTER_NO_MACHINE (CLUSTER_ERRNO + 1)
+#define ECLUSTER_OP_TIMEOUT (CLUSTER_ERRNO + 2)
+#define ECLUSTER_ORB_DATA_READ (CLUSTER_ERRNO + 3)
+#define ECLUSTER_ORB_EIO (CLUSTER_ERRNO + 4)
+#define ECLUSTER_CHANNEL_INUSE (CLUSTER_ERRNO + 5)
+#define ECLUSTER_NOMORE_CHANNELS (CLUSTER_ERRNO + 6)
 
 int init_clusterprocessor(void);
-enum
-{
+enum {
   CLUSTER_CONNECTIONS_OPEN_STAT,
   CLUSTER_CONNECTIONS_OPENNED_STAT,
   CLUSTER_CON_TOTAL_TIME_STAT,
@@ -124,19 +123,15 @@ enum
 };
 
 extern RecRawStatBlock *cluster_rsb;
-#define CLUSTER_INCREMENT_DYN_STAT(x) \
-	RecIncrRawStat(cluster_rsb, mutex->thread_holding, (int) x, 1);
-#define CLUSTER_DECREMENT_DYN_STAT(x) \
-	RecIncrRawStat(cluster_rsb, mutex->thread_holding, (int) x, -1);
-#define CLUSTER_SUM_DYN_STAT(x, y) \
-	RecIncrRawStat(cluster_rsb, mutex->thread_holding, (int) x, y);
-#define CLUSTER_SUM_GLOBAL_DYN_STAT(x, y) \
-	RecIncrGlobalRawStatSum(cluster_rsb,x,y)
-#define CLUSTER_CLEAR_DYN_STAT(x) \
-do { \
-	RecSetRawStatSum(cluster_rsb, x, 0); \
-	RecSetRawStatCount(cluster_rsb, x, 0); \
-} while (0);
+#define CLUSTER_INCREMENT_DYN_STAT(x) RecIncrRawStat(cluster_rsb, mutex->thread_holding, (int)x, 1);
+#define CLUSTER_DECREMENT_DYN_STAT(x) RecIncrRawStat(cluster_rsb, mutex->thread_holding, (int)x, -1);
+#define CLUSTER_SUM_DYN_STAT(x, y) RecIncrRawStat(cluster_rsb, mutex->thread_holding, (int)x, y);
+#define CLUSTER_SUM_GLOBAL_DYN_STAT(x, y) RecIncrGlobalRawStatSum(cluster_rsb, x, y)
+#define CLUSTER_CLEAR_DYN_STAT(x)          \
+  do {                                     \
+    RecSetRawStatSum(cluster_rsb, x, 0);   \
+    RecSetRawStatCount(cluster_rsb, x, 0); \
+  } while (0);
 
 
 #endif


[25/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 2a240dd..b813aee 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -57,20 +57,20 @@
 #endif
 
 // ssl_multicert.config field names:
-#define SSL_IP_TAG            "dest_ip"
-#define SSL_CERT_TAG          "ssl_cert_name"
-#define SSL_PRIVATE_KEY_TAG   "ssl_key_name"
-#define SSL_CA_TAG            "ssl_ca_name"
-#define SSL_ACTION_TAG        "action"
+#define SSL_IP_TAG "dest_ip"
+#define SSL_CERT_TAG "ssl_cert_name"
+#define SSL_PRIVATE_KEY_TAG "ssl_key_name"
+#define SSL_CA_TAG "ssl_ca_name"
+#define SSL_ACTION_TAG "action"
 #define SSL_ACTION_TUNNEL_TAG "tunnel"
 #define SSL_SESSION_TICKET_ENABLED "ssl_ticket_enabled"
 #define SSL_SESSION_TICKET_KEY_FILE_TAG "ticket_key_name"
-#define SSL_KEY_DIALOG        "ssl_key_dialog"
+#define SSL_KEY_DIALOG "ssl_key_dialog"
 #define SSL_CERT_SEPARATE_DELIM ','
 
 // openssl version must be 0.9.4 or greater
 #if (OPENSSL_VERSION_NUMBER < 0x00090400L)
-# error Traffic Server requires an OpenSSL library version 0.9.4 or greater
+#error Traffic Server requires an OpenSSL library version 0.9.4 or greater
 #endif
 
 #ifndef evp_md_func
@@ -82,25 +82,23 @@
 #endif
 
 #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) // openssl returns a const SSL_METHOD
-typedef const SSL_METHOD * ink_ssl_method_t;
+typedef const SSL_METHOD *ink_ssl_method_t;
 #else
-typedef SSL_METHOD * ink_ssl_method_t;
+typedef SSL_METHOD *ink_ssl_method_t;
 #endif
 
 // gather user provided settings from ssl_multicert.config in to a single struct
-struct ssl_user_config
-{
-  ssl_user_config ()
-    : session_ticket_enabled(1), opt(SSLCertContext::OPT_NONE)
-  { }
-
-  int session_ticket_enabled;  // ssl_ticket_enabled - session ticket enabled
-  ats_scoped_str addr;   // dest_ip - IPv[64] address to match
-  ats_scoped_str cert;   // ssl_cert_name - certificate
-  ats_scoped_str first_cert; // the first certificate name when multiple cert files are in 'ssl_cert_name'
-  ats_scoped_str ca;     // ssl_ca_name - CA public certificate
-  ats_scoped_str key;    // ssl_key_name - Private key
-  ats_scoped_str ticket_key_filename; // ticket_key_name - session key file. [key_name (16Byte) + HMAC_secret (16Byte) + AES_key (16Byte)]
+struct ssl_user_config {
+  ssl_user_config() : session_ticket_enabled(1), opt(SSLCertContext::OPT_NONE) {}
+
+  int session_ticket_enabled; // ssl_ticket_enabled - session ticket enabled
+  ats_scoped_str addr;        // dest_ip - IPv[64] address to match
+  ats_scoped_str cert;        // ssl_cert_name - certificate
+  ats_scoped_str first_cert;  // the first certificate name when multiple cert files are in 'ssl_cert_name'
+  ats_scoped_str ca;          // ssl_ca_name - CA public certificate
+  ats_scoped_str key;         // ssl_key_name - Private key
+  ats_scoped_str
+    ticket_key_filename; // ticket_key_name - session key file. [key_name (16Byte) + HMAC_secret (16Byte) + AES_key (16Byte)]
   ats_scoped_str dialog; // ssl_key_dialog - Private key dialog
   SSLCertContext::Option opt;
 };
@@ -136,7 +134,7 @@ ticket_block_free(void *ptr)
 static ssl_ticket_key_block *
 ticket_block_alloc(unsigned count)
 {
-  ssl_ticket_key_block * ptr;
+  ssl_ticket_key_block *ptr;
   size_t nbytes = sizeof(ssl_ticket_key_block) + count * sizeof(ssl_ticket_key_t);
 
   ptr = (ssl_ticket_key_block *)ats_malloc(nbytes);
@@ -180,7 +178,7 @@ SSL_locking_callback(int mode, int type, const char * /* file ATS_UNUSED */, int
 }
 
 static bool
-SSL_CTX_add_extra_chain_cert_file(SSL_CTX * ctx, const char * chainfile)
+SSL_CTX_add_extra_chain_cert_file(SSL_CTX *ctx, const char *chainfile)
 {
   X509 *cert;
   scoped_BIO bio(BIO_new_file(chainfile, "r"));
@@ -204,7 +202,7 @@ SSL_CTX_add_extra_chain_cert_file(SSL_CTX * ctx, const char * chainfile)
 }
 
 
-static SSL_SESSION*
+static SSL_SESSION *
 ssl_get_cached_session(SSL *ssl, unsigned char *id, int len, int *copy)
 {
   SSLSessionID sid(id, len);
@@ -264,24 +262,23 @@ ssl_rm_cached_session(SSL_CTX *ctx, SSL_SESSION *sess)
 }
 
 #if TS_USE_TLS_SNI
-int 
-set_context_cert(SSL *ssl) 
+int
+set_context_cert(SSL *ssl)
 {
-  SSL_CTX *           ctx = NULL;
-  SSLCertContext *    cc = NULL;
+  SSL_CTX *ctx = NULL;
+  SSLCertContext *cc = NULL;
   SSLCertLookup *lookup = SSLCertificateConfig::acquire();
-  const char *        servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  const char *servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
   bool found = true;
   int retval = 1;
 
-  Debug("ssl", "set_context_cert ssl=%p server=%s handshake_complete=%d", ssl, servername,
-    netvc->getSSLHandShakeComplete());
+  Debug("ssl", "set_context_cert ssl=%p server=%s handshake_complete=%d", ssl, servername, netvc->getSSLHandShakeComplete());
 
   // catch the client renegotiation early on
   if (SSLConfigParams::ssl_allow_client_renegotiation == false && netvc->getSSLHandShakeComplete()) {
     Debug("ssl", "set_context_cert trying to renegotiate from the client");
-    retval = 0; // Error 
+    retval = 0; // Error
     goto done;
   }
 
@@ -290,7 +287,8 @@ set_context_cert(SSL *ssl)
   // already made a best effort to find the best match.
   if (likely(servername)) {
     cc = lookup->find((char *)servername);
-    if (cc && cc->ctx) ctx = cc->ctx;
+    if (cc && cc->ctx)
+      ctx = cc->ctx;
     if (cc && SSLCertContext::OPT_TUNNEL == cc->opt && netvc->get_is_transparent()) {
       netvc->attributes = HttpProxyPort::TRANSPORT_BLIND_TUNNEL;
       netvc->setSSLHandShakeComplete(true);
@@ -306,7 +304,8 @@ set_context_cert(SSL *ssl)
 
     safe_getsockname(netvc->get_socket(), &ip.sa, &namelen);
     cc = lookup->find(ip);
-    if (cc && cc->ctx) ctx = cc->ctx;
+    if (cc && cc->ctx)
+      ctx = cc->ctx;
   }
 
   if (ctx != NULL) {
@@ -333,22 +332,22 @@ done:
 
 // Use the certificate callback for openssl 1.0.2 and greater
 // otherwise use the SNI callback
-#if TS_USE_CERT_CB 
+#if TS_USE_CERT_CB
 /**
  * Called before either the server or the client certificate is used
  * Return 1 on success, 0 on error, or -1 to pause
  */
 static int
-ssl_cert_callback(SSL * ssl, void * /*arg*/)
+ssl_cert_callback(SSL *ssl, void * /*arg*/)
 {
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
   bool reenabled;
-  int retval =  1;
+  int retval = 1;
 
   // Do the common certificate lookup only once.  If we pause
   // and restart processing, do not execute the common logic again
   if (!netvc->calledHooks(TS_SSL_CERT_HOOK)) {
-    retval = set_context_cert(ssl); 
+    retval = set_context_cert(ssl);
     if (retval != 1) {
       return retval;
     }
@@ -358,7 +357,7 @@ ssl_cert_callback(SSL * ssl, void * /*arg*/)
   reenabled = netvc->callHooks(TS_SSL_CERT_HOOK);
   // If it did not re-enable, return the code to
   // stop the accept processing
-  if (!reenabled){
+  if (!reenabled) {
     retval = -1; // Pause
   }
 
@@ -367,16 +366,16 @@ ssl_cert_callback(SSL * ssl, void * /*arg*/)
 }
 #else
 static int
-ssl_servername_callback(SSL * ssl, int * /* ad */, void * /*arg*/)
+ssl_servername_callback(SSL *ssl, int * /* ad */, void * /*arg*/)
 {
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
   bool reenabled;
   int retval = 1;
 
   // Do the common certificate lookup only once.  If we pause
   // and restart processing, do not execute the common logic again
   if (!netvc->calledHooks(TS_SSL_CERT_HOOK)) {
-    retval = set_context_cert(ssl); 
+    retval = set_context_cert(ssl);
     if (retval != 1) {
       goto done;
     }
@@ -386,7 +385,7 @@ ssl_servername_callback(SSL * ssl, int * /* ad */, void * /*arg*/)
   reenabled = netvc->callHooks(TS_SSL_SNI_HOOK);
   // If it did not re-enable, return the code to
   // stop the accept processing
-  if (!reenabled){
+  if (!reenabled) {
     retval = -1;
   }
 
@@ -417,72 +416,54 @@ done:
 #endif /* TS_USE_TLS_SNI */
 
 /* Build 2048-bit MODP Group with 256-bit Prime Order Subgroup from RFC 5114 */
-static DH *get_dh2048()
+static DH *
+get_dh2048()
 {
-    static const unsigned char dh2048_p[] = {
-        0x87, 0xA8, 0xE6, 0x1D, 0xB4, 0xB6, 0x66, 0x3C, 0xFF, 0xBB, 0xD1, 0x9C,
-        0x65, 0x19, 0x59, 0x99, 0x8C, 0xEE, 0xF6, 0x08, 0x66, 0x0D, 0xD0, 0xF2,
-        0x5D, 0x2C, 0xEE, 0xD4, 0x43, 0x5E, 0x3B, 0x00, 0xE0, 0x0D, 0xF8, 0xF1,
-        0xD6, 0x19, 0x57, 0xD4, 0xFA, 0xF7, 0xDF, 0x45, 0x61, 0xB2, 0xAA, 0x30,
-        0x16, 0xC3, 0xD9, 0x11, 0x34, 0x09, 0x6F, 0xAA, 0x3B, 0xF4, 0x29, 0x6D,
-        0x83, 0x0E, 0x9A, 0x7C, 0x20, 0x9E, 0x0C, 0x64, 0x97, 0x51, 0x7A, 0xBD,
-        0x5A, 0x8A, 0x9D, 0x30, 0x6B, 0xCF, 0x67, 0xED, 0x91, 0xF9, 0xE6, 0x72,
-        0x5B, 0x47, 0x58, 0xC0, 0x22, 0xE0, 0xB1, 0xEF, 0x42, 0x75, 0xBF, 0x7B,
-        0x6C, 0x5B, 0xFC, 0x11, 0xD4, 0x5F, 0x90, 0x88, 0xB9, 0x41, 0xF5, 0x4E,
-        0xB1, 0xE5, 0x9B, 0xB8, 0xBC, 0x39, 0xA0, 0xBF, 0x12, 0x30, 0x7F, 0x5C,
-        0x4F, 0xDB, 0x70, 0xC5, 0x81, 0xB2, 0x3F, 0x76, 0xB6, 0x3A, 0xCA, 0xE1,
-        0xCA, 0xA6, 0xB7, 0x90, 0x2D, 0x52, 0x52, 0x67, 0x35, 0x48, 0x8A, 0x0E,
-        0xF1, 0x3C, 0x6D, 0x9A, 0x51, 0xBF, 0xA4, 0xAB, 0x3A, 0xD8, 0x34, 0x77,
-        0x96, 0x52, 0x4D, 0x8E, 0xF6, 0xA1, 0x67, 0xB5, 0xA4, 0x18, 0x25, 0xD9,
-        0x67, 0xE1, 0x44, 0xE5, 0x14, 0x05, 0x64, 0x25, 0x1C, 0xCA, 0xCB, 0x83,
-        0xE6, 0xB4, 0x86, 0xF6, 0xB3, 0xCA, 0x3F, 0x79, 0x71, 0x50, 0x60, 0x26,
-        0xC0, 0xB8, 0x57, 0xF6, 0x89, 0x96, 0x28, 0x56, 0xDE, 0xD4, 0x01, 0x0A,
-        0xBD, 0x0B, 0xE6, 0x21, 0xC3, 0xA3, 0x96, 0x0A, 0x54, 0xE7, 0x10, 0xC3,
-        0x75, 0xF2, 0x63, 0x75, 0xD7, 0x01, 0x41, 0x03, 0xA4, 0xB5, 0x43, 0x30,
-        0xC1, 0x98, 0xAF, 0x12, 0x61, 0x16, 0xD2, 0x27, 0x6E, 0x11, 0x71, 0x5F,
-        0x69, 0x38, 0x77, 0xFA, 0xD7, 0xEF, 0x09, 0xCA, 0xDB, 0x09, 0x4A, 0xE9,
-        0x1E, 0x1A, 0x15, 0x97
-        };
-    static const unsigned char dh2048_g[] = {
-        0x3F, 0xB3, 0x2C, 0x9B, 0x73, 0x13, 0x4D, 0x0B, 0x2E, 0x77, 0x50, 0x66,
-        0x60, 0xED, 0xBD, 0x48, 0x4C, 0xA7, 0xB1, 0x8F, 0x21, 0xEF, 0x20, 0x54,
-        0x07, 0xF4, 0x79, 0x3A, 0x1A, 0x0B, 0xA1, 0x25, 0x10, 0xDB, 0xC1, 0x50,
-        0x77, 0xBE, 0x46, 0x3F, 0xFF, 0x4F, 0xED, 0x4A, 0xAC, 0x0B, 0xB5, 0x55,
-        0xBE, 0x3A, 0x6C, 0x1B, 0x0C, 0x6B, 0x47, 0xB1, 0xBC, 0x37, 0x73, 0xBF,
-        0x7E, 0x8C, 0x6F, 0x62, 0x90, 0x12, 0x28, 0xF8, 0xC2, 0x8C, 0xBB, 0x18,
-        0xA5, 0x5A, 0xE3, 0x13, 0x41, 0x00, 0x0A, 0x65, 0x01, 0x96, 0xF9, 0x31,
-        0xC7, 0x7A, 0x57, 0xF2, 0xDD, 0xF4, 0x63, 0xE5, 0xE9, 0xEC, 0x14, 0x4B,
-        0x77, 0x7D, 0xE6, 0x2A, 0xAA, 0xB8, 0xA8, 0x62, 0x8A, 0xC3, 0x76, 0xD2,
-        0x82, 0xD6, 0xED, 0x38, 0x64, 0xE6, 0x79, 0x82, 0x42, 0x8E, 0xBC, 0x83,
-        0x1D, 0x14, 0x34, 0x8F, 0x6F, 0x2F, 0x91, 0x93, 0xB5, 0x04, 0x5A, 0xF2,
-        0x76, 0x71, 0x64, 0xE1, 0xDF, 0xC9, 0x67, 0xC1, 0xFB, 0x3F, 0x2E, 0x55,
-        0xA4, 0xBD, 0x1B, 0xFF, 0xE8, 0x3B, 0x9C, 0x80, 0xD0, 0x52, 0xB9, 0x85,
-        0xD1, 0x82, 0xEA, 0x0A, 0xDB, 0x2A, 0x3B, 0x73, 0x13, 0xD3, 0xFE, 0x14,
-        0xC8, 0x48, 0x4B, 0x1E, 0x05, 0x25, 0x88, 0xB9, 0xB7, 0xD2, 0xBB, 0xD2,
-        0xDF, 0x01, 0x61, 0x99, 0xEC, 0xD0, 0x6E, 0x15, 0x57, 0xCD, 0x09, 0x15,
-        0xB3, 0x35, 0x3B, 0xBB, 0x64, 0xE0, 0xEC, 0x37, 0x7F, 0xD0, 0x28, 0x37,
-        0x0D, 0xF9, 0x2B, 0x52, 0xC7, 0x89, 0x14, 0x28, 0xCD, 0xC6, 0x7E, 0xB6,
-        0x18, 0x4B, 0x52, 0x3D, 0x1D, 0xB2, 0x46, 0xC3, 0x2F, 0x63, 0x07, 0x84,
-        0x90, 0xF0, 0x0E, 0xF8, 0xD6, 0x47, 0xD1, 0x48, 0xD4, 0x79, 0x54, 0x51,
-        0x5E, 0x23, 0x27, 0xCF, 0xEF, 0x98, 0xC5, 0x82, 0x66, 0x4B, 0x4C, 0x0F,
-        0x6C, 0xC4, 0x16, 0x59
-    };
-    DH *dh;
-
-    if ((dh = DH_new()) == NULL) return(NULL);
-    dh->p = BN_bin2bn(dh2048_p, sizeof(dh2048_p), NULL);
-    dh->g = BN_bin2bn(dh2048_g, sizeof(dh2048_g), NULL);
-    if ((dh->p == NULL) || (dh->g == NULL)) {
-        DH_free(dh);
-        return(NULL);
-    }
-    return(dh);
+  static const unsigned char dh2048_p[] = {
+    0x87, 0xA8, 0xE6, 0x1D, 0xB4, 0xB6, 0x66, 0x3C, 0xFF, 0xBB, 0xD1, 0x9C, 0x65, 0x19, 0x59, 0x99, 0x8C, 0xEE, 0xF6, 0x08,
+    0x66, 0x0D, 0xD0, 0xF2, 0x5D, 0x2C, 0xEE, 0xD4, 0x43, 0x5E, 0x3B, 0x00, 0xE0, 0x0D, 0xF8, 0xF1, 0xD6, 0x19, 0x57, 0xD4,
+    0xFA, 0xF7, 0xDF, 0x45, 0x61, 0xB2, 0xAA, 0x30, 0x16, 0xC3, 0xD9, 0x11, 0x34, 0x09, 0x6F, 0xAA, 0x3B, 0xF4, 0x29, 0x6D,
+    0x83, 0x0E, 0x9A, 0x7C, 0x20, 0x9E, 0x0C, 0x64, 0x97, 0x51, 0x7A, 0xBD, 0x5A, 0x8A, 0x9D, 0x30, 0x6B, 0xCF, 0x67, 0xED,
+    0x91, 0xF9, 0xE6, 0x72, 0x5B, 0x47, 0x58, 0xC0, 0x22, 0xE0, 0xB1, 0xEF, 0x42, 0x75, 0xBF, 0x7B, 0x6C, 0x5B, 0xFC, 0x11,
+    0xD4, 0x5F, 0x90, 0x88, 0xB9, 0x41, 0xF5, 0x4E, 0xB1, 0xE5, 0x9B, 0xB8, 0xBC, 0x39, 0xA0, 0xBF, 0x12, 0x30, 0x7F, 0x5C,
+    0x4F, 0xDB, 0x70, 0xC5, 0x81, 0xB2, 0x3F, 0x76, 0xB6, 0x3A, 0xCA, 0xE1, 0xCA, 0xA6, 0xB7, 0x90, 0x2D, 0x52, 0x52, 0x67,
+    0x35, 0x48, 0x8A, 0x0E, 0xF1, 0x3C, 0x6D, 0x9A, 0x51, 0xBF, 0xA4, 0xAB, 0x3A, 0xD8, 0x34, 0x77, 0x96, 0x52, 0x4D, 0x8E,
+    0xF6, 0xA1, 0x67, 0xB5, 0xA4, 0x18, 0x25, 0xD9, 0x67, 0xE1, 0x44, 0xE5, 0x14, 0x05, 0x64, 0x25, 0x1C, 0xCA, 0xCB, 0x83,
+    0xE6, 0xB4, 0x86, 0xF6, 0xB3, 0xCA, 0x3F, 0x79, 0x71, 0x50, 0x60, 0x26, 0xC0, 0xB8, 0x57, 0xF6, 0x89, 0x96, 0x28, 0x56,
+    0xDE, 0xD4, 0x01, 0x0A, 0xBD, 0x0B, 0xE6, 0x21, 0xC3, 0xA3, 0x96, 0x0A, 0x54, 0xE7, 0x10, 0xC3, 0x75, 0xF2, 0x63, 0x75,
+    0xD7, 0x01, 0x41, 0x03, 0xA4, 0xB5, 0x43, 0x30, 0xC1, 0x98, 0xAF, 0x12, 0x61, 0x16, 0xD2, 0x27, 0x6E, 0x11, 0x71, 0x5F,
+    0x69, 0x38, 0x77, 0xFA, 0xD7, 0xEF, 0x09, 0xCA, 0xDB, 0x09, 0x4A, 0xE9, 0x1E, 0x1A, 0x15, 0x97};
+  static const unsigned char dh2048_g[] = {
+    0x3F, 0xB3, 0x2C, 0x9B, 0x73, 0x13, 0x4D, 0x0B, 0x2E, 0x77, 0x50, 0x66, 0x60, 0xED, 0xBD, 0x48, 0x4C, 0xA7, 0xB1, 0x8F,
+    0x21, 0xEF, 0x20, 0x54, 0x07, 0xF4, 0x79, 0x3A, 0x1A, 0x0B, 0xA1, 0x25, 0x10, 0xDB, 0xC1, 0x50, 0x77, 0xBE, 0x46, 0x3F,
+    0xFF, 0x4F, 0xED, 0x4A, 0xAC, 0x0B, 0xB5, 0x55, 0xBE, 0x3A, 0x6C, 0x1B, 0x0C, 0x6B, 0x47, 0xB1, 0xBC, 0x37, 0x73, 0xBF,
+    0x7E, 0x8C, 0x6F, 0x62, 0x90, 0x12, 0x28, 0xF8, 0xC2, 0x8C, 0xBB, 0x18, 0xA5, 0x5A, 0xE3, 0x13, 0x41, 0x00, 0x0A, 0x65,
+    0x01, 0x96, 0xF9, 0x31, 0xC7, 0x7A, 0x57, 0xF2, 0xDD, 0xF4, 0x63, 0xE5, 0xE9, 0xEC, 0x14, 0x4B, 0x77, 0x7D, 0xE6, 0x2A,
+    0xAA, 0xB8, 0xA8, 0x62, 0x8A, 0xC3, 0x76, 0xD2, 0x82, 0xD6, 0xED, 0x38, 0x64, 0xE6, 0x79, 0x82, 0x42, 0x8E, 0xBC, 0x83,
+    0x1D, 0x14, 0x34, 0x8F, 0x6F, 0x2F, 0x91, 0x93, 0xB5, 0x04, 0x5A, 0xF2, 0x76, 0x71, 0x64, 0xE1, 0xDF, 0xC9, 0x67, 0xC1,
+    0xFB, 0x3F, 0x2E, 0x55, 0xA4, 0xBD, 0x1B, 0xFF, 0xE8, 0x3B, 0x9C, 0x80, 0xD0, 0x52, 0xB9, 0x85, 0xD1, 0x82, 0xEA, 0x0A,
+    0xDB, 0x2A, 0x3B, 0x73, 0x13, 0xD3, 0xFE, 0x14, 0xC8, 0x48, 0x4B, 0x1E, 0x05, 0x25, 0x88, 0xB9, 0xB7, 0xD2, 0xBB, 0xD2,
+    0xDF, 0x01, 0x61, 0x99, 0xEC, 0xD0, 0x6E, 0x15, 0x57, 0xCD, 0x09, 0x15, 0xB3, 0x35, 0x3B, 0xBB, 0x64, 0xE0, 0xEC, 0x37,
+    0x7F, 0xD0, 0x28, 0x37, 0x0D, 0xF9, 0x2B, 0x52, 0xC7, 0x89, 0x14, 0x28, 0xCD, 0xC6, 0x7E, 0xB6, 0x18, 0x4B, 0x52, 0x3D,
+    0x1D, 0xB2, 0x46, 0xC3, 0x2F, 0x63, 0x07, 0x84, 0x90, 0xF0, 0x0E, 0xF8, 0xD6, 0x47, 0xD1, 0x48, 0xD4, 0x79, 0x54, 0x51,
+    0x5E, 0x23, 0x27, 0xCF, 0xEF, 0x98, 0xC5, 0x82, 0x66, 0x4B, 0x4C, 0x0F, 0x6C, 0xC4, 0x16, 0x59};
+  DH *dh;
+
+  if ((dh = DH_new()) == NULL)
+    return (NULL);
+  dh->p = BN_bin2bn(dh2048_p, sizeof(dh2048_p), NULL);
+  dh->g = BN_bin2bn(dh2048_g, sizeof(dh2048_g), NULL);
+  if ((dh->p == NULL) || (dh->g == NULL)) {
+    DH_free(dh);
+    return (NULL);
+  }
+  return (dh);
 }
 
 static SSL_CTX *
-ssl_context_enable_dhe(const char * dhparams_file, SSL_CTX * ctx)
+ssl_context_enable_dhe(const char *dhparams_file, SSL_CTX *ctx)
 {
-  DH * server_dh;
+  DH *server_dh;
 
   if (dhparams_file) {
     scoped_BIO bio(BIO_new_file(dhparams_file, "r"));
@@ -496,8 +477,7 @@ ssl_context_enable_dhe(const char * dhparams_file, SSL_CTX * ctx)
     return NULL;
   }
 
-  if (!SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE) ||
-      !SSL_CTX_set_tmp_dh(ctx, server_dh)) {
+  if (!SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE) || !SSL_CTX_set_tmp_dh(ctx, server_dh)) {
     DH_free(server_dh);
     Error("failed to configure SSL DH");
     return NULL;
@@ -509,14 +489,14 @@ ssl_context_enable_dhe(const char * dhparams_file, SSL_CTX * ctx)
 }
 
 static SSL_CTX *
-ssl_context_enable_ecdh(SSL_CTX * ctx)
+ssl_context_enable_ecdh(SSL_CTX *ctx)
 {
 #if TS_USE_TLS_ECKEY
 
 #if defined(SSL_CTRL_SET_ECDH_AUTO)
   SSL_CTX_set_ecdh_auto(ctx, 1);
 #elif defined(HAVE_EC_KEY_NEW_BY_CURVE_NAME) && defined(NID_X9_62_prime256v1)
-  EC_KEY * ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
+  EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
 
   if (ecdh) {
     SSL_CTX_set_tmp_ecdh(ctx, ecdh);
@@ -529,13 +509,13 @@ ssl_context_enable_ecdh(SSL_CTX * ctx)
 }
 
 static ssl_ticket_key_block *
-ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
+ssl_context_enable_tickets(SSL_CTX *ctx, const char *ticket_key_path)
 {
 #if HAVE_OPENSSL_SESSION_TICKETS
-  ats_scoped_str      ticket_key_data;
-  int                 ticket_key_len;
-  unsigned            num_ticket_keys;
-  ssl_ticket_key_block * keyblock = NULL;
+  ats_scoped_str ticket_key_data;
+  int ticket_key_len;
+  unsigned num_ticket_keys;
+  ssl_ticket_key_block *keyblock = NULL;
 
   if (ticket_key_path != NULL) {
     ticket_key_data = readIntoBuffer(ticket_key_path, __func__, &ticket_key_len);
@@ -544,11 +524,11 @@ ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
       goto fail;
     }
   } else {
-     // Generate a random ticket key
-     ticket_key_len = 48;
-     ticket_key_data = (char *)ats_malloc(ticket_key_len);
-     char *tmp_ptr = ticket_key_data;
-     RAND_bytes(reinterpret_cast<unsigned char *>(tmp_ptr), ticket_key_len);
+    // Generate a random ticket key
+    ticket_key_len = 48;
+    ticket_key_data = (char *)ats_malloc(ticket_key_len);
+    char *tmp_ptr = ticket_key_data;
+    RAND_bytes(reinterpret_cast<unsigned char *>(tmp_ptr), ticket_key_len);
   }
 
   num_ticket_keys = ticket_key_len / sizeof(ssl_ticket_key_t);
@@ -567,10 +547,11 @@ ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
   // Slurp all the keys in the ticket key file. We will encrypt with the first key, and decrypt
   // with any key (for rotation purposes).
   for (unsigned i = 0; i < num_ticket_keys; ++i) {
-    const char * data = (const char *)ticket_key_data + (i * sizeof(ssl_ticket_key_t));
+    const char *data = (const char *)ticket_key_data + (i * sizeof(ssl_ticket_key_t));
     memcpy(keyblock->keys[i].key_name, data, sizeof(ssl_ticket_key_t::key_name));
     memcpy(keyblock->keys[i].hmac_secret, data + sizeof(ssl_ticket_key_t::key_name), sizeof(ssl_ticket_key_t::hmac_secret));
-    memcpy(keyblock->keys[i].aes_key, data + sizeof(ssl_ticket_key_t::key_name) + sizeof(ssl_ticket_key_t::hmac_secret), sizeof(ssl_ticket_key_t::aes_key));
+    memcpy(keyblock->keys[i].aes_key, data + sizeof(ssl_ticket_key_t::key_name) + sizeof(ssl_ticket_key_t::hmac_secret),
+           sizeof(ssl_ticket_key_t::aes_key));
   }
 
   // Setting the callback can only fail if OpenSSL does not recognize the
@@ -588,44 +569,49 @@ fail:
   ticket_block_free(keyblock);
   return NULL;
 
-#else /* !HAVE_OPENSSL_SESSION_TICKETS */
+#else  /* !HAVE_OPENSSL_SESSION_TICKETS */
   (void)ticket_key_path;
   return NULL;
 #endif /* HAVE_OPENSSL_SESSION_TICKETS */
 }
 
-struct passphrase_cb_userdata
-{
-  const SSLConfigParams * _configParams;
-  const char * _serverDialog;
-  const char * _serverCert;
-  const char * _serverKey;
+struct passphrase_cb_userdata {
+  const SSLConfigParams *_configParams;
+  const char *_serverDialog;
+  const char *_serverCert;
+  const char *_serverKey;
 
-  passphrase_cb_userdata(const SSLConfigParams *params,const char *dialog, const char *cert, const char *key)
+  passphrase_cb_userdata(const SSLConfigParams *params, const char *dialog, const char *cert, const char *key)
     : _configParams(params), _serverDialog(dialog), _serverCert(cert), _serverKey(key)
-  {}
+  {
+  }
 };
 
 // RAII implementation for struct termios
-struct ssl_termios : public  termios
-{
-  ssl_termios(int fd) {
+struct ssl_termios : public termios {
+  ssl_termios(int fd)
+  {
     _fd = -1;
     // populate base class data
     if (tcgetattr(fd, this) == 0) { // success
-       _fd = fd;
+      _fd = fd;
     }
     // save our copy
     _initialAttr = *this;
   }
 
-  ~ssl_termios() {
+  ~ssl_termios()
+  {
     if (_fd != -1) {
       tcsetattr(_fd, 0, &_initialAttr);
     }
   }
 
-  bool ok() const { return (_fd != -1); }
+  bool
+  ok() const
+  {
+    return (_fd != -1);
+  }
 
 private:
   int _fd;
@@ -633,7 +619,7 @@ private:
 };
 
 static int
-ssl_getpassword(const char* prompt, char* buffer, int size)
+ssl_getpassword(const char *prompt, char *buffer, int size)
 {
   fprintf(stdout, "%s", prompt);
 
@@ -645,8 +631,8 @@ ssl_getpassword(const char* prompt, char* buffer, int size)
   }
 
   tty_attr.c_lflag &= ~ICANON; // no buffer, no backspace
-  tty_attr.c_lflag &= ~ECHO; // no echo
-  tty_attr.c_lflag &= ~ISIG; // no signal for ctrl-c
+  tty_attr.c_lflag &= ~ECHO;   // no echo
+  tty_attr.c_lflag &= ~ISIG;   // no signal for ctrl-c
 
   if (tcsetattr(STDIN_FILENO, 0, &tty_attr) < 0) {
     return -1;
@@ -677,7 +663,7 @@ ssl_private_key_passphrase_callback_exec(char *buf, int size, int rwflag, void *
   }
 
   *buf = 0;
-  passphrase_cb_userdata *ud = static_cast<passphrase_cb_userdata *> (userdata);
+  passphrase_cb_userdata *ud = static_cast<passphrase_cb_userdata *>(userdata);
 
   Debug("ssl", "ssl_private_key_passphrase_callback_exec rwflag=%d serverDialog=%s", rwflag, ud->_serverDialog);
 
@@ -696,7 +682,7 @@ ssl_private_key_passphrase_callback_exec(char *buf, int size, int rwflag, void *
         }
       }
       pclose(f);
-    } else {// popen failed
+    } else { // popen failed
       Error("could not open dialog '%s' - %s", ud->_serverDialog, strerror(errno));
     }
   }
@@ -711,7 +697,7 @@ ssl_private_key_passphrase_callback_builtin(char *buf, int size, int rwflag, voi
   }
 
   *buf = 0;
-  passphrase_cb_userdata *ud = static_cast<passphrase_cb_userdata *> (userdata);
+  passphrase_cb_userdata *ud = static_cast<passphrase_cb_userdata *>(userdata);
 
   Debug("ssl", "ssl_private_key_passphrase_callback rwflag=%d serverDialog=%s", rwflag, ud->_serverDialog);
 
@@ -747,7 +733,8 @@ ssl_private_key_validate_exec(const char *cmdLine)
   char *cmdLineCopy = ats_strdup(cmdLine);
   char *ptr = cmdLineCopy;
 
-  while (*ptr && !isspace(*ptr)) ++ptr;
+  while (*ptr && !isspace(*ptr))
+    ++ptr;
   *ptr = 0;
   if (access(cmdLineCopy, X_OK) != -1) {
     bReturn = true;
@@ -797,7 +784,7 @@ SSLInitializeLibrary()
     SSL_load_error_strings();
     SSL_library_init();
 
-    mutex_buf = (pthread_mutex_t *) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
+    mutex_buf = (pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
 
     for (int i = 0; i < CRYPTO_num_locks(); i++) {
       pthread_mutex_init(&mutex_buf[i], NULL);
@@ -824,165 +811,122 @@ SSLInitializeLibrary()
 void
 SSLInitializeStatistics()
 {
-  SSL_CTX *               ctx;
-  SSL *                   ssl;
-  STACK_OF(SSL_CIPHER) *  ciphers;
+  SSL_CTX *ctx;
+  SSL *ssl;
+  STACK_OF(SSL_CIPHER) * ciphers;
 
   // Allocate SSL statistics block.
-  ssl_rsb = RecAllocateRawStatBlock((int) Ssl_Stat_Count);
+  ssl_rsb = RecAllocateRawStatBlock((int)Ssl_Stat_Count);
   ink_assert(ssl_rsb != NULL);
 
   // SSL client errors.
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_other_errors",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_other_errors_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_expired_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_expired_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_revoked_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_revoked_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_unknown_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_unknown_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_cert_verify_failed",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_cert_verify_failed_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_bad_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_bad_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_decryption_failed",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_decryption_failed_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_wrong_version",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_wrong_version_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_unknown_ca",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_user_agent_unknown_ca_stat,
-                     RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_other_errors", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_other_errors_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_expired_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_expired_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_revoked_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_revoked_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_unknown_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_unknown_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_cert_verify_failed", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_cert_verify_failed_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_bad_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_bad_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_decryption_failed", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_decryption_failed_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_wrong_version", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_wrong_version_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_unknown_ca", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_user_agent_unknown_ca_stat, RecRawStatSyncSum);
 
   // Polled SSL context statistics.
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_sessions",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) ssl_user_agent_sessions_stat,
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_sessions", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)ssl_user_agent_sessions_stat,
                      SSLRecRawStatSyncCount); //<- only use this fn once
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_session_hit",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) ssl_user_agent_session_hit_stat,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_session_miss",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) ssl_user_agent_session_miss_stat,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_session_timeout",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) ssl_user_agent_session_timeout_stat,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_session_hit", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)ssl_user_agent_session_hit_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_session_miss", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)ssl_user_agent_session_miss_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.user_agent_session_timeout", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)ssl_user_agent_session_timeout_stat, RecRawStatSyncCount);
 
   // SSL server errors.
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_other_errors",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_other_errors_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_expired_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_expired_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_revoked_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_revoked_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_unknown_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_unknown_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_cert_verify_failed",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_cert_verify_failed_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_bad_cert",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_bad_cert_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_decryption_failed",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_decryption_failed_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_wrong_version",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_wrong_version_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_unknown_ca",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_origin_server_unknown_ca_stat,
-                     RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_other_errors", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_other_errors_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_expired_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_expired_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_revoked_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_revoked_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_unknown_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_unknown_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_cert_verify_failed", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_cert_verify_failed_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_bad_cert", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_bad_cert_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_decryption_failed", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_decryption_failed_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_wrong_version", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_wrong_version_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.origin_server_unknown_ca", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_origin_server_unknown_ca_stat, RecRawStatSyncSum);
 
   // SSL handshake time
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_handshake_time",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_handshake_time_stat,
-                     RecRawStatSyncSum);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_success_handshake_count",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_success_handshake_count_in_stat,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_success_handshake_count_out",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_success_handshake_count_out_stat,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_handshake_time", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_handshake_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_success_handshake_count", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_success_handshake_count_in_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_success_handshake_count_out", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_success_handshake_count_out_stat, RecRawStatSyncCount);
 
   // TLS tickets
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_created",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_tickets_created_stat,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_verified",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_tickets_verified_stat,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_not_found",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_tickets_not_found_stat,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_created", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_tickets_created_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_verified", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_tickets_verified_stat, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_not_found", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_tickets_not_found_stat, RecRawStatSyncCount);
   // TODO: ticket renewal is not used right now.
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_renewed",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_tickets_renewed_stat,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_renewed", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_tickets_renewed_stat, RecRawStatSyncCount);
   // The number of session tickets verified with an "old" key.
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_verified_old_key",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_tickets_verified_old_key_stat,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_tickets_verified_old_key", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_tickets_verified_old_key_stat, RecRawStatSyncCount);
   // The number of ticket keys renewed.
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_ticket_keys_renewed",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_total_ticket_keys_renewed_stat,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.total_ticket_keys_renewed", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_total_ticket_keys_renewed_stat, RecRawStatSyncCount);
 
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_hit",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_session_cache_hit,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_hit", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_session_cache_hit, RecRawStatSyncCount);
 
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_new_session",
-                       RECD_INT, RECP_PERSISTENT, (int) ssl_session_cache_new_session,
-                       RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_new_session", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_session_cache_new_session, RecRawStatSyncCount);
 
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_miss",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_session_cache_miss,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_miss", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_session_cache_miss, RecRawStatSyncCount);
 
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_eviction",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_session_cache_eviction,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_eviction", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_session_cache_eviction, RecRawStatSyncCount);
 
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_lock_contention",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_session_cache_lock_contention,
-                     RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_session_cache_lock_contention", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_session_cache_lock_contention, RecRawStatSyncCount);
 
   /* error stats */
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_want_write",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_want_write,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_want_read",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_want_read,
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_want_write", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_error_want_write, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_want_read", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_error_want_read, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_want_x509_lookup", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_error_want_x509_lookup, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_syscall", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_error_syscall, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_read_eos", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_error_read_eos, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_zero_return", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_error_zero_return, RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_ssl", RECD_INT, RECP_PERSISTENT, (int)ssl_error_ssl,
                      RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_want_x509_lookup",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_want_x509_lookup,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_syscall",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_syscall,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_read_eos",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_read_eos,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_zero_return",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_zero_return,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_error_ssl",
-                     RECD_INT, RECP_PERSISTENT, (int) ssl_error_ssl,
-                     RecRawStatSyncCount);
-  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_sni_name_set_failure",
-                       RECD_INT, RECP_PERSISTENT, (int) ssl_sni_name_set_failure,
-                       RecRawStatSyncCount);
+  RecRegisterRawStat(ssl_rsb, RECT_PROCESS, "proxy.process.ssl.ssl_sni_name_set_failure", RECD_INT, RECP_PERSISTENT,
+                     (int)ssl_sni_name_set_failure, RecRawStatSyncCount);
 
   // Get and register the SSL cipher stats. Note that we are using the default SSL context to obtain
   // the cipher list. This means that the set of ciphers is fixed by the build configuration and not
@@ -997,26 +941,24 @@ SSLInitializeStatistics()
   ciphers = SSL_get_ciphers(ssl);
 
   for (int index = 0; index < sk_SSL_CIPHER_num(ciphers); index++) {
-    SSL_CIPHER * cipher = sk_SSL_CIPHER_value(ciphers, index);
-    const char * cipherName = SSL_CIPHER_get_name(cipher);
-    std::string  statName = "proxy.process.ssl.cipher.user_agent." + std::string(cipherName);
+    SSL_CIPHER *cipher = sk_SSL_CIPHER_value(ciphers, index);
+    const char *cipherName = SSL_CIPHER_get_name(cipher);
+    std::string statName = "proxy.process.ssl.cipher.user_agent." + std::string(cipherName);
 
     // If room in allocated space ...
     if ((ssl_cipher_stats_start + index) > ssl_cipher_stats_end) {
       // Too many ciphers, increase ssl_cipher_stats_end.
-      SSLError("too many ciphers to register metric '%s', increase SSL_Stats::ssl_cipher_stats_end",
-               statName.c_str());
+      SSLError("too many ciphers to register metric '%s', increase SSL_Stats::ssl_cipher_stats_end", statName.c_str());
       continue;
     }
 
     // If not already registered ...
     if (!ink_hash_table_isbound(ssl_cipher_name_table, cipherName)) {
-      ink_hash_table_insert(ssl_cipher_name_table, cipherName, (void *)(intptr_t) (ssl_cipher_stats_start + index));
+      ink_hash_table_insert(ssl_cipher_name_table, cipherName, (void *)(intptr_t)(ssl_cipher_stats_start + index));
       // Register as non-persistent since the order/index is dependent upon configuration.
-      RecRegisterRawStat(ssl_rsb, RECT_PROCESS, statName.c_str(),
-                         RECD_INT, RECP_NON_PERSISTENT, (int) ssl_cipher_stats_start + index,
-                         RecRawStatSyncSum);
-      SSL_CLEAR_DYN_STAT((int) ssl_cipher_stats_start + index);
+      RecRegisterRawStat(ssl_rsb, RECT_PROCESS, statName.c_str(), RECD_INT, RECP_NON_PERSISTENT,
+                         (int)ssl_cipher_stats_start + index, RecRawStatSyncSum);
+      SSL_CLEAR_DYN_STAT((int)ssl_cipher_stats_start + index);
       Debug("ssl", "registering SSL cipher metric '%s'", statName.c_str());
     }
   }
@@ -1119,7 +1061,7 @@ increment_ssl_server_error(unsigned long err)
 }
 
 void
-SSLDiagnostic(const SrcLoc& loc, bool debug, SSLNetVConnection * vc, const char * fmt, ...)
+SSLDiagnostic(const SrcLoc &loc, bool debug, SSLNetVConnection *vc, const char *fmt, ...)
 {
   unsigned long l;
   char buf[256];
@@ -1127,7 +1069,7 @@ SSLDiagnostic(const SrcLoc& loc, bool debug, SSLNetVConnection * vc, const char
   int line, flags;
   unsigned long es;
   va_list ap;
-  ip_text_buffer ip_buf =  { '\0' };
+  ip_text_buffer ip_buf = {'\0'};
 
   if (vc) {
     ats_ip_ntop(vc->get_remote_addr(), ip_buf, sizeof(ip_buf));
@@ -1137,16 +1079,14 @@ SSLDiagnostic(const SrcLoc& loc, bool debug, SSLNetVConnection * vc, const char
   while ((l = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) {
     if (debug) {
       if (unlikely(diags->on())) {
-        diags->log("ssl", DL_Debug, loc.file, loc.func, loc.line,
-            "SSL::%lu:%s:%s:%d%s%s%s%s", es, ERR_error_string(l, buf), file, line,
-          (flags & ERR_TXT_STRING) ? ":" : "", (flags & ERR_TXT_STRING) ? data : "",
-          vc ? ": peer address is " : "", ip_buf);
+        diags->log("ssl", DL_Debug, loc.file, loc.func, loc.line, "SSL::%lu:%s:%s:%d%s%s%s%s", es, ERR_error_string(l, buf), file,
+                   line, (flags & ERR_TXT_STRING) ? ":" : "", (flags & ERR_TXT_STRING) ? data : "", vc ? ": peer address is " : "",
+                   ip_buf);
       }
     } else {
-      diags->error(DL_Error, loc.file, loc.func, loc.line,
-          "SSL::%lu:%s:%s:%d%s%s%s%s", es, ERR_error_string(l, buf), file, line,
-          (flags & ERR_TXT_STRING) ? ":" : "", (flags & ERR_TXT_STRING) ? data : "",
-          vc ? ": peer address is " : "", ip_buf);
+      diags->error(DL_Error, loc.file, loc.func, loc.line, "SSL::%lu:%s:%s:%d%s%s%s%s", es, ERR_error_string(l, buf), file, line,
+                   (flags & ERR_TXT_STRING) ? ":" : "", (flags & ERR_TXT_STRING) ? data : "", vc ? ": peer address is " : "",
+                   ip_buf);
     }
 
     // Tally desired stats (only client/server connection stats, not init
@@ -1168,23 +1108,14 @@ SSLDiagnostic(const SrcLoc& loc, bool debug, SSLNetVConnection * vc, const char
     diags->error_va(DL_Error, loc.file, loc.func, loc.line, fmt, ap);
   }
   va_end(ap);
-
 }
 
 const char *
 SSLErrorName(int ssl_error)
 {
-  static const char * names[] =  {
-    "SSL_ERROR_NONE",
-    "SSL_ERROR_SSL",
-    "SSL_ERROR_WANT_READ",
-    "SSL_ERROR_WANT_WRITE",
-    "SSL_ERROR_WANT_X509_LOOKUP",
-    "SSL_ERROR_SYSCALL",
-    "SSL_ERROR_ZERO_RETURN",
-    "SSL_ERROR_WANT_CONNECT",
-    "SSL_ERROR_WANT_ACCEPT"
-  };
+  static const char *names[] = {"SSL_ERROR_NONE", "SSL_ERROR_SSL", "SSL_ERROR_WANT_READ", "SSL_ERROR_WANT_WRITE",
+                                "SSL_ERROR_WANT_X509_LOOKUP", "SSL_ERROR_SYSCALL", "SSL_ERROR_ZERO_RETURN",
+                                "SSL_ERROR_WANT_CONNECT", "SSL_ERROR_WANT_ACCEPT"};
 
   if (ssl_error < 0 || ssl_error >= (int)countof(names)) {
     return "unknown SSL error";
@@ -1194,7 +1125,7 @@ SSLErrorName(int ssl_error)
 }
 
 void
-SSLDebugBufferPrint(const char * tag, const char * buffer, unsigned buflen, const char * message)
+SSLDebugBufferPrint(const char *tag, const char *buffer, unsigned buflen, const char *message)
 {
   if (is_debug_tag_set(tag)) {
     if (message != NULL) {
@@ -1217,22 +1148,18 @@ SSLDefaultServerContext()
 }
 
 static bool
-SSLPrivateKeyHandler(
-    SSL_CTX * ctx,
-    const SSLConfigParams * params,
-    const ats_scoped_str& completeServerCertPath,
-    const char * keyPath)
+SSLPrivateKeyHandler(SSL_CTX *ctx, const SSLConfigParams *params, const ats_scoped_str &completeServerCertPath, const char *keyPath)
 {
   if (!keyPath) {
     // assume private key is contained in cert obtained from multicert file.
     if (!SSL_CTX_use_PrivateKey_file(ctx, completeServerCertPath, SSL_FILETYPE_PEM)) {
-      SSLError("failed to load server private key from %s", (const char *) completeServerCertPath);
+      SSLError("failed to load server private key from %s", (const char *)completeServerCertPath);
       return false;
     }
   } else if (params->serverKeyPathOnly != NULL) {
     ats_scoped_str completeServerKeyPath(Layout::get()->relative_to(params->serverKeyPathOnly, keyPath));
     if (!SSL_CTX_use_PrivateKey_file(ctx, completeServerKeyPath, SSL_FILETYPE_PEM)) {
-      SSLError("failed to load server private key from %s", (const char *) completeServerKeyPath);
+      SSLError("failed to load server private key from %s", (const char *)completeServerKeyPath);
       return false;
     }
   } else {
@@ -1249,21 +1176,22 @@ SSLPrivateKeyHandler(
 }
 
 SSL_CTX *
-SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & sslMultCertSettings)
+SSLInitServerContext(const SSLConfigParams *params, const ssl_user_config &sslMultCertSettings)
 {
-  int         server_verify_client;
-  ats_scoped_str  completeServerCertPath;
-  SSL_CTX *   ctx = SSLDefaultServerContext();
+  int server_verify_client;
+  ats_scoped_str completeServerCertPath;
+  SSL_CTX *ctx = SSLDefaultServerContext();
   EVP_MD_CTX digest;
-  STACK_OF(X509_NAME) *ca_list;
+  STACK_OF(X509_NAME) * ca_list;
   unsigned char hash_buf[EVP_MAX_MD_SIZE];
   unsigned int hash_len = 0;
-  char const* setting_cert = sslMultCertSettings.cert.get();
+  char const *setting_cert = sslMultCertSettings.cert.get();
 
   // disable selected protocols
   SSL_CTX_set_options(ctx, params->ssl_ctx_options);
 
-  Debug("ssl.session_cache", "ssl context=%p: using session cache options, enabled=%d, size=%d, num_buckets=%d, skip_on_contention=%d, timeout=%d, auto_clear=%d",
+  Debug("ssl.session_cache", "ssl context=%p: using session cache options, enabled=%d, size=%d, num_buckets=%d, "
+                             "skip_on_contention=%d, timeout=%d, auto_clear=%d",
         ctx, params->ssl_session_cache, params->ssl_session_cache_size, params->ssl_session_cache_num_buckets,
         params->ssl_session_cache_skip_on_contention, params->ssl_session_cache_timeout, params->ssl_session_cache_auto_clear);
 
@@ -1296,7 +1224,7 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
     SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_INTERNAL | additional_cache_flags);
 
     break;
-    }
+  }
   }
 
 #ifdef SSL_MODE_RELEASE_BUFFERS
@@ -1316,12 +1244,12 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
   passphrase_cb_userdata ud(params, sslMultCertSettings.dialog, sslMultCertSettings.first_cert, sslMultCertSettings.key);
 
   if (sslMultCertSettings.dialog) {
-    pem_password_cb * passwd_cb = NULL;
+    pem_password_cb *passwd_cb = NULL;
     if (strncmp(sslMultCertSettings.dialog, "exec:", 5) == 0) {
       ud._serverDialog = &sslMultCertSettings.dialog[5];
       // validate the exec program
       if (!ssl_private_key_validate_exec(ud._serverDialog)) {
-        SSLError("failed to access '%s' pass phrase program: %s", (const char *) ud._serverDialog, strerror(errno));
+        SSLError("failed to access '%s' pass phrase program: %s", (const char *)ud._serverDialog, strerror(errno));
         goto fail;
       }
       passwd_cb = ssl_private_key_passphrase_callback_exec;
@@ -1340,18 +1268,18 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
     SimpleTokenizer key_tok((sslMultCertSettings.key ? (const char *)sslMultCertSettings.key : ""), SSL_CERT_SEPARATE_DELIM);
 
     if (sslMultCertSettings.key && cert_tok.getNumTokensRemaining() != key_tok.getNumTokensRemaining()) {
-        Error("the number of certificates in ssl_cert_name and ssl_key_name doesn't match");
-        goto fail;
+      Error("the number of certificates in ssl_cert_name and ssl_key_name doesn't match");
+      goto fail;
     }
 
-    for (const char * certname = cert_tok.getNext(); certname; certname = cert_tok.getNext()) {
+    for (const char *certname = cert_tok.getNext(); certname; certname = cert_tok.getNext()) {
       completeServerCertPath = Layout::relative_to(params->serverCertPathOnly, certname);
       if (SSL_CTX_use_certificate_chain_file(ctx, completeServerCertPath) <= 0) {
         SSLError("failed to load certificate chain from %s", (const char *)completeServerCertPath);
         goto fail;
       }
 
-      const char * keyPath = key_tok.getNext();
+      const char *keyPath = key_tok.getNext();
       if (!SSLPrivateKeyHandler(ctx, params, completeServerCertPath, keyPath)) {
         goto fail;
       }
@@ -1361,7 +1289,7 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
     if (params->serverCertChainFilename) {
       ats_scoped_str completeServerCertChainPath(Layout::relative_to(params->serverCertPathOnly, params->serverCertChainFilename));
       if (!SSL_CTX_add_extra_chain_cert_file(ctx, completeServerCertChainPath)) {
-        SSLError("failed to load global certificate chain from %s", (const char *) completeServerCertChainPath);
+        SSLError("failed to load global certificate chain from %s", (const char *)completeServerCertChainPath);
         goto fail;
       }
     }
@@ -1370,7 +1298,7 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
     if (sslMultCertSettings.ca) {
       ats_scoped_str completeServerCertChainPath(Layout::relative_to(params->serverCertPathOnly, sslMultCertSettings.ca));
       if (!SSL_CTX_add_extra_chain_cert_file(ctx, completeServerCertChainPath)) {
-        SSLError("failed to load certificate chain from %s", (const char *) completeServerCertChainPath);
+        SSLError("failed to load certificate chain from %s", (const char *)completeServerCertChainPath);
         goto fail;
       }
     }
@@ -1397,7 +1325,6 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
   }
 
   if (params->clientCertLevel != 0) {
-
     if (params->serverCACertFilename != NULL && params->serverCACertPath != NULL) {
       if ((!SSL_CTX_load_verify_locations(ctx, params->serverCACertFilename, params->serverCACertPath)) ||
           (!SSL_CTX_set_default_verify_paths(ctx))) {
@@ -1424,41 +1351,41 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
   EVP_MD_CTX_init(&digest);
 
   if (EVP_DigestInit_ex(&digest, evp_md_func, NULL) == 0) {
-   SSLError("EVP_DigestInit_ex failed");
-   goto fail;
+    SSLError("EVP_DigestInit_ex failed");
+    goto fail;
   }
 
   Debug("ssl", "Using '%s' in hash for session id context", sslMultCertSettings.cert.get());
 
   if (NULL != setting_cert) {
     if (EVP_DigestUpdate(&digest, sslMultCertSettings.cert, strlen(setting_cert)) == 0) {
-     SSLError("EVP_DigestUpdate failed");
-     goto fail;
+      SSLError("EVP_DigestUpdate failed");
+      goto fail;
     }
   }
 
   if (ca_list != NULL) {
-   size_t num_certs = sk_X509_NAME_num(ca_list);
+    size_t num_certs = sk_X509_NAME_num(ca_list);
 
-   for (size_t i = 0; i < num_certs; i++) {
-     X509_NAME *name = sk_X509_NAME_value(ca_list, i);
-     if (X509_NAME_digest(name, evp_md_func, hash_buf /* borrow our final hash buffer. */, &hash_len) == 0 ||
-         EVP_DigestUpdate(&digest, hash_buf, hash_len) == 0) {
-       SSLError("Adding X509 name to digest failed");
-       goto fail;
-     }
-   }
+    for (size_t i = 0; i < num_certs; i++) {
+      X509_NAME *name = sk_X509_NAME_value(ca_list, i);
+      if (X509_NAME_digest(name, evp_md_func, hash_buf /* borrow our final hash buffer. */, &hash_len) == 0 ||
+          EVP_DigestUpdate(&digest, hash_buf, hash_len) == 0) {
+        SSLError("Adding X509 name to digest failed");
+        goto fail;
+      }
+    }
   }
 
   if (EVP_DigestFinal_ex(&digest, hash_buf, &hash_len) == 0) {
-   SSLError("EVP_DigestFinal_ex failed");
-   goto fail;
+    SSLError("EVP_DigestFinal_ex failed");
+    goto fail;
   }
 
   EVP_MD_CTX_cleanup(&digest);
   if (SSL_CTX_set_session_id_context(ctx, hash_buf, hash_len) == 0) {
-   SSLError("SSL_CTX_set_session_id_context failed");
-   goto fail;
+    SSLError("SSL_CTX_set_session_id_context failed");
+    goto fail;
   }
 
   if (params->cipherSuite != NULL) {
@@ -1467,30 +1394,31 @@ SSLInitServerContext(const SSLConfigParams * params, const ssl_user_config & ssl
       goto fail;
     }
   }
-#define SSL_CLEAR_PW_REFERENCES(UD,CTX) { \
-  memset(static_cast<void *>(&UD),0,sizeof(UD));\
-  SSL_CTX_set_default_passwd_cb(CTX, NULL);\
-  SSL_CTX_set_default_passwd_cb_userdata(CTX, NULL);\
+#define SSL_CLEAR_PW_REFERENCES(UD, CTX)               \
+  {                                                    \
+    memset(static_cast<void *>(&UD), 0, sizeof(UD));   \
+    SSL_CTX_set_default_passwd_cb(CTX, NULL);          \
+    SSL_CTX_set_default_passwd_cb_userdata(CTX, NULL); \
   }
-  SSL_CLEAR_PW_REFERENCES(ud,ctx)
+  SSL_CLEAR_PW_REFERENCES(ud, ctx)
   if (params->dhparamsFile != NULL && !ssl_context_enable_dhe(params->dhparamsFile, ctx)) {
     goto fail;
   }
   return ssl_context_enable_ecdh(ctx);
 
 fail:
-  SSL_CLEAR_PW_REFERENCES(ud,ctx)
+  SSL_CLEAR_PW_REFERENCES(ud, ctx)
   SSL_CTX_free(ctx);
 
   return NULL;
 }
 
 SSL_CTX *
-SSLInitClientContext(const SSLConfigParams * params)
+SSLInitClientContext(const SSLConfigParams *params)
 {
   ink_ssl_method_t meth = NULL;
-  SSL_CTX * client_ctx = NULL;
-  char * clientKeyPtr = NULL;
+  SSL_CTX *client_ctx = NULL;
+  char *clientKeyPtr = NULL;
 
   // Note that we do not call RAND_seed() explicitly here, we depend on OpenSSL
   // to do the seeding of the PRNG for us. This is the case for all platforms that
@@ -1535,8 +1463,7 @@ SSLInitClientContext(const SSLConfigParams * params)
     }
 
     if (!SSL_CTX_check_private_key(client_ctx)) {
-      SSLError("client private key (%s) does not match the certificate public key (%s)",
-          clientKeyPtr, params->clientCertPath);
+      SSLError("client private key (%s) does not match the certificate public key (%s)", clientKeyPtr, params->clientCertPath);
       goto fail;
     }
   }
@@ -1550,8 +1477,8 @@ SSLInitClientContext(const SSLConfigParams * params)
 
     if (params->clientCACertFilename != NULL && params->clientCACertPath != NULL) {
       if (!SSL_CTX_load_verify_locations(client_ctx, params->clientCACertFilename, params->clientCACertPath)) {
-        SSLError("invalid client CA Certificate file (%s) or CA Certificate path (%s)",
-            params->clientCACertFilename, params->clientCACertPath);
+        SSLError("invalid client CA Certificate file (%s) or CA Certificate path (%s)", params->clientCACertFilename,
+                 params->clientCACertPath);
         goto fail;
       }
     }
@@ -1574,13 +1501,11 @@ fail:
 }
 
 static char *
-asn1_strdup(ASN1_STRING * s)
+asn1_strdup(ASN1_STRING *s)
 {
   // Make sure we have an 8-bit encoding.
-  ink_assert(ASN1_STRING_type(s) == V_ASN1_IA5STRING ||
-    ASN1_STRING_type(s) == V_ASN1_UTF8STRING ||
-    ASN1_STRING_type(s) == V_ASN1_PRINTABLESTRING ||
-    ASN1_STRING_type(s) == V_ASN1_T61STRING);
+  ink_assert(ASN1_STRING_type(s) == V_ASN1_IA5STRING || ASN1_STRING_type(s) == V_ASN1_UTF8STRING ||
+             ASN1_STRING_type(s) == V_ASN1_PRINTABLESTRING || ASN1_STRING_type(s) == V_ASN1_T61STRING);
 
   return ats_strndup((const char *)ASN1_STRING_data(s), ASN1_STRING_length(s));
 }
@@ -1589,16 +1514,16 @@ asn1_strdup(ASN1_STRING * s)
 // table aliases for subject CN and subjectAltNames DNS without wildcard,
 // insert trie aliases for those with wildcard.
 static bool
-ssl_index_certificate(SSLCertLookup * lookup, SSLCertContext const& cc, const char * certfile)
+ssl_index_certificate(SSLCertLookup *lookup, SSLCertContext const &cc, const char *certfile)
 {
-  X509_NAME *   subject = NULL;
-  X509 *        cert;
-  scoped_BIO    bio(BIO_new_file(certfile, "r"));
+  X509_NAME *subject = NULL;
+  X509 *cert;
+  scoped_BIO bio(BIO_new_file(certfile, "r"));
   bool inserted = false;
 
   cert = PEM_read_bio_X509_AUX(bio.get(), NULL, NULL, NULL);
   if (NULL == cert) {
-    Error("Failed to load certificate from file %s", certfile); 
+    Error("Failed to load certificate from file %s", certfile);
     lookup->is_valid = false;
     return false;
   }
@@ -1614,30 +1539,32 @@ ssl_index_certificate(SSLCertLookup * lookup, SSLCertContext const& cc, const ch
         break;
       }
 
-      X509_NAME_ENTRY * e = X509_NAME_get_entry(subject, pos);
-      ASN1_STRING * cn = X509_NAME_ENTRY_get_data(e);
+      X509_NAME_ENTRY *e = X509_NAME_get_entry(subject, pos);
+      ASN1_STRING *cn = X509_NAME_ENTRY_get_data(e);
       subj_name = asn1_strdup(cn);
 
-      Debug("ssl", "mapping '%s' to certificate %s", (const char *) subj_name, certfile);
-      if (lookup->insert(subj_name, cc) >= 0) inserted = true;
+      Debug("ssl", "mapping '%s' to certificate %s", (const char *)subj_name, certfile);
+      if (lookup->insert(subj_name, cc) >= 0)
+        inserted = true;
     }
   }
 
 #if HAVE_OPENSSL_TS_H
   // Traverse the subjectAltNames (if any) and insert additional keys for the SSL context.
-  GENERAL_NAMES * names = (GENERAL_NAMES *) X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
+  GENERAL_NAMES *names = (GENERAL_NAMES *)X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
   if (names) {
     unsigned count = sk_GENERAL_NAME_num(names);
     for (unsigned i = 0; i < count; ++i) {
-      GENERAL_NAME * name;
+      GENERAL_NAME *name;
 
       name = sk_GENERAL_NAME_value(names, i);
       if (name->type == GEN_DNS) {
         ats_scoped_str dns(asn1_strdup(name->d.dNSName));
         // only try to insert if the alternate name is not the main name
         if (strcmp(dns, subj_name) != 0) {
-          Debug("ssl", "mapping '%s' to certificate %s", (const char *) dns, certfile);
-          if (lookup->insert(dns, cc) >= 0) inserted = true;
+          Debug("ssl", "mapping '%s' to certificate %s", (const char *)dns, certfile);
+          if (lookup->insert(dns, cc) >= 0)
+            inserted = true;
         }
       }
     }
@@ -1656,7 +1583,7 @@ static void
 ssl_callback_info(const SSL *ssl, int where, int ret)
 {
   Debug("ssl", "ssl_callback_info ssl: %p where: %d ret: %d", ssl, where, ret);
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
 
   if ((where & SSL_CB_ACCEPT_LOOP) && netvc->getSSLHandShakeComplete() == true &&
       SSLConfigParams::ssl_allow_client_renegotiation == false) {
@@ -1669,9 +1596,9 @@ ssl_callback_info(const SSL *ssl, int where, int ret)
   }
   if (where & SSL_CB_HANDSHAKE_DONE) {
     // handshake is complete
-    const SSL_CIPHER * cipher = SSL_get_current_cipher(ssl);
+    const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
     if (cipher) {
-      const char * cipherName = SSL_CIPHER_get_name(cipher);
+      const char *cipherName = SSL_CIPHER_get_name(cipher);
       // lookup index of stat by name and incr count
       InkHashTableValue data;
       if (ink_hash_table_lookup(ssl_cipher_name_table, cipherName, &data)) {
@@ -1681,11 +1608,12 @@ ssl_callback_info(const SSL *ssl, int where, int ret)
   }
 }
 
-static void 
-ssl_set_handshake_callbacks(SSL_CTX *ctx) {
+static void
+ssl_set_handshake_callbacks(SSL_CTX *ctx)
+{
 #if TS_USE_TLS_SNI
-  // Make sure the callbacks are set 
-#if TS_USE_CERT_CB 
+// Make sure the callbacks are set
+#if TS_USE_CERT_CB
   SSL_CTX_set_cert_cb(ctx, ssl_cert_callback, NULL);
 #else
   SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_callback);
@@ -1694,14 +1622,11 @@ ssl_set_handshake_callbacks(SSL_CTX *ctx) {
 }
 
 static SSL_CTX *
-ssl_store_ssl_context(
-    const SSLConfigParams * params,
-    SSLCertLookup *         lookup,
-    const ssl_user_config & sslMultCertSettings)
+ssl_store_ssl_context(const SSLConfigParams *params, SSLCertLookup *lookup, const ssl_user_config &sslMultCertSettings)
 {
-  SSL_CTX *   ctx = SSLInitServerContext(params, sslMultCertSettings);
-  ats_scoped_str  certpath;
-  ats_scoped_str  session_key_path;
+  SSL_CTX *ctx = SSLInitServerContext(params, sslMultCertSettings);
+  ats_scoped_str certpath;
+  ats_scoped_str session_key_path;
   ssl_ticket_key_block *keyblock = NULL;
   bool inserted = false;
 
@@ -1710,7 +1635,7 @@ ssl_store_ssl_context(
     return ctx;
   }
 
-  // The certificate callbacks are set by the caller only 
+  // The certificate callbacks are set by the caller only
   // for the default certificate
 
   SSL_CTX_set_info_callback(ctx, ssl_callback_info);
@@ -1732,8 +1657,7 @@ ssl_store_ssl_context(
   if (sslMultCertSettings.session_ticket_enabled != 0 && sslMultCertSettings.ticket_key_filename) {
     ats_scoped_str ticket_key_path(Layout::relative_to(params->serverCertPathOnly, sslMultCertSettings.ticket_key_filename));
     keyblock = ssl_context_enable_tickets(ctx, ticket_key_path);
-  }
-  else if (sslMultCertSettings.session_ticket_enabled != 0) {
+  } else if (sslMultCertSettings.session_ticket_enabled != 0) {
     keyblock = ssl_context_enable_tickets(ctx, NULL);
   }
 
@@ -1791,7 +1715,7 @@ ssl_store_ssl_context(
   Debug("ssl", "importing SNI names from %s", (const char *)certpath);
   if (certpath != NULL && ssl_index_certificate(lookup, SSLCertContext(ctx, sslMultCertSettings.opt), certpath)) {
     inserted = true;
-  } 
+  }
 
   if (inserted) {
     if (SSLConfigParams::init_ssl_ctx_cb) {
@@ -1813,11 +1737,11 @@ ssl_store_ssl_context(
 }
 
 static bool
-ssl_extract_certificate(const matcher_line * line_info, ssl_user_config & sslMultCertSettings)
+ssl_extract_certificate(const matcher_line *line_info, ssl_user_config &sslMultCertSettings)
 {
   for (int i = 0; i < MATCHER_MAX_TOKENS; ++i) {
-    const char * label;
-    const char * value;
+    const char *label;
+    const char *value;
 
     label = line_info->line[0][i];
     value = line_info->line[1][i];
@@ -1856,8 +1780,7 @@ ssl_extract_certificate(const matcher_line * line_info, ssl_user_config & sslMul
     if (strcasecmp(label, SSL_ACTION_TAG) == 0) {
       if (strcasecmp(SSL_ACTION_TUNNEL_TAG, value) == 0) {
         sslMultCertSettings.opt = SSLCertContext::OPT_TUNNEL;
-      }
-      else {
+      } else {
         Error("Unrecognized action for " SSL_ACTION_TAG);
         return false;
       }
@@ -1868,9 +1791,9 @@ ssl_extract_certificate(const matcher_line * line_info, ssl_user_config & sslMul
     return false;
   } else {
     SimpleTokenizer cert_tok(sslMultCertSettings.cert, SSL_CERT_SEPARATE_DELIM);
-    const char * first_cert = cert_tok.getNext();
+    const char *first_cert = cert_tok.getNext();
     if (first_cert) {
-        sslMultCertSettings.first_cert = ats_strdup(first_cert);
+      sslMultCertSettings.first_cert = ats_strdup(first_cert);
     }
   }
 
@@ -1878,17 +1801,15 @@ ssl_extract_certificate(const matcher_line * line_info, ssl_user_config & sslMul
 }
 
 bool
-SSLParseCertificateConfiguration(const SSLConfigParams * params, SSLCertLookup * lookup)
+SSLParseCertificateConfiguration(const SSLConfigParams *params, SSLCertLookup *lookup)
 {
-  char *      tok_state = NULL;
-  char *      line = NULL;
-  ats_scoped_str  file_buf;
-  unsigned    line_num = 0;
+  char *tok_state = NULL;
+  char *line = NULL;
+  ats_scoped_str file_buf;
+  unsigned line_num = 0;
   matcher_line line_info;
 
-  const matcher_tags sslCertTags = {
-    NULL, NULL, NULL, NULL, NULL, NULL, false
-  };
+  const matcher_tags sslCertTags = {NULL, NULL, NULL, NULL, NULL, NULL, false};
 
   Note("loading SSL certificate configuration from %s", params->configFilePath);
 
@@ -1906,11 +1827,10 @@ SSLParseCertificateConfiguration(const SSLConfigParams * params, SSLCertLookup *
   uint32_t elevate_setting = 0;
   REC_ReadConfigInteger(elevate_setting, "proxy.config.ssl.cert.load_elevated");
   ElevateAccess elevate_access(elevate_setting != 0); // destructor will demote for us
-#endif /* TS_USE_POSIX_CAP */
+#endif                                                /* TS_USE_POSIX_CAP */
 
   line = tokLine(file_buf, &tok_state);
   while (line != NULL) {
-
     line_num++;
 
     // skip all blank spaces at beginning of line
@@ -1920,19 +1840,18 @@ SSLParseCertificateConfiguration(const SSLConfigParams * params, SSLCertLookup *
 
     if (*line != '\0' && *line != '#') {
       ssl_user_config sslMultiCertSettings;
-      const char * errPtr;
+      const char *errPtr;
 
       errPtr = parseConfigLine(line, &line_info, &sslCertTags);
 
       if (errPtr != NULL) {
-        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: discarding %s entry at line %d: %s",
-                     __func__, params->configFilePath, line_num, errPtr);
+        RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: discarding %s entry at line %d: %s", __func__, params->configFilePath,
+                         line_num, errPtr);
       } else {
         if (ssl_extract_certificate(&line_info, sslMultiCertSettings)) {
           ssl_store_ssl_context(params, lookup, sslMultiCertSettings);
-        } 
+        }
       }
-
     }
 
     line = tokLine(NULL, &tok_state);
@@ -1955,8 +1874,7 @@ SSLParseCertificateConfiguration(const SSLConfigParams * params, SSLCertLookup *
 #if HAVE_OPENSSL_SESSION_TICKETS
 
 static void
-session_ticket_free(void * /*parent*/, void * ptr, CRYPTO_EX_DATA * /*ad*/,
-    int /*idx*/, long /*argl*/, void * /*argp*/)
+session_ticket_free(void * /*parent*/, void *ptr, CRYPTO_EX_DATA * /*ad*/, int /*idx*/, long /*argl*/, void * /*argp*/)
 {
   ticket_block_free((struct ssl_ticket_key_block *)ptr);
 }
@@ -1967,11 +1885,11 @@ session_ticket_free(void * /*parent*/, void * ptr, CRYPTO_EX_DATA * /*ad*/,
  * a mechanism to present the ticket back to the server.
  * */
 static int
-ssl_callback_session_ticket(SSL * ssl, unsigned char * keyname, unsigned char * iv, EVP_CIPHER_CTX * cipher_ctx,
-                            HMAC_CTX * hctx, int enc)
+ssl_callback_session_ticket(SSL *ssl, unsigned char *keyname, unsigned char *iv, EVP_CIPHER_CTX *cipher_ctx, HMAC_CTX *hctx,
+                            int enc)
 {
   SSLCertLookup *lookup = SSLCertificateConfig::acquire();
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
 
   // Get the IP address to look up the keyblock
   IpEndpoint ip;
@@ -1985,7 +1903,7 @@ ssl_callback_session_ticket(SSL * ssl, unsigned char * keyname, unsigned char *
   if (cc == NULL || cc->keyblock == NULL) {
     // No, key specified.  Must fail out at this point.
     // Alternatively we could generate a random key
-    return -1; 
+    return -1;
   }
   ssl_ticket_key_block *keyblock = cc->keyblock;
 
@@ -2029,13 +1947,13 @@ ssl_callback_session_ticket(SSL * ssl, unsigned char * keyname, unsigned char *
 #endif /* HAVE_OPENSSL_SESSION_TICKETS */
 
 void
-SSLReleaseContext(SSL_CTX * ctx)
+SSLReleaseContext(SSL_CTX *ctx)
 {
   SSL_CTX_free(ctx);
 }
 
 ssl_error_t
-SSLWriteBuffer(SSL * ssl, const void * buf, int64_t nbytes, int64_t& nwritten)
+SSLWriteBuffer(SSL *ssl, const void *buf, int64_t nbytes, int64_t &nwritten)
 {
   nwritten = 0;
 
@@ -2063,7 +1981,7 @@ SSLWriteBuffer(SSL * ssl, const void * buf, int64_t nbytes, int64_t& nwritten)
 }
 
 ssl_error_t
-SSLReadBuffer(SSL * ssl, void * buf, int64_t nbytes, int64_t& nread)
+SSLReadBuffer(SSL *ssl, void *buf, int64_t nbytes, int64_t &nread)
 {
   nread = 0;
 
@@ -2088,7 +2006,7 @@ SSLReadBuffer(SSL * ssl, void * buf, int64_t nbytes, int64_t& nread)
 }
 
 ssl_error_t
-SSLAccept(SSL * ssl)
+SSLAccept(SSL *ssl)
 {
   ERR_clear_error();
   int ret = SSL_accept(ssl);
@@ -2107,7 +2025,7 @@ SSLAccept(SSL * ssl)
 }
 
 ssl_error_t
-SSLConnect(SSL * ssl)
+SSLConnect(SSL *ssl)
 {
   ERR_clear_error();
   int ret = SSL_connect(ssl);
@@ -2115,12 +2033,12 @@ SSLConnect(SSL * ssl)
     return SSL_ERROR_NONE;
   }
   int ssl_error = SSL_get_error(ssl, ret);
-   if (ssl_error == SSL_ERROR_SSL) {
-     char buf[512];
-     unsigned long e = ERR_peek_last_error();
-     ERR_error_string_n(e, buf, sizeof(buf));
-     Debug("ssl.error.connect", "SSL connect returned %d, ssl_error=%d, ERR_get_error=%ld (%s)", ret, ssl_error, e, buf);
-   }
-
-   return ssl_error;
+  if (ssl_error == SSL_ERROR_SSL) {
+    char buf[512];
+    unsigned long e = ERR_peek_last_error();
+    ERR_error_string_n(e, buf, sizeof(buf));
+    Debug("ssl.error.connect", "SSL connect returned %d, ssl_error=%d, ERR_get_error=%ld (%s)", ret, ssl_error, e, buf);
+  }
+
+  return ssl_error;
 }


[26/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLCertLookup.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc
index 84caa6e..28755ba 100644
--- a/iocore/net/SSLCertLookup.cc
+++ b/iocore/net/SSLCertLookup.cc
@@ -32,14 +32,10 @@
 #include "Trie.h"
 #include "ts/TestBox.h"
 
-struct SSLAddressLookupKey
-{
-  explicit
-  SSLAddressLookupKey(const IpEndpoint& ip) : sep(0)
+struct SSLAddressLookupKey {
+  explicit SSLAddressLookupKey(const IpEndpoint &ip) : sep(0)
   {
-    static const char hextab[16] = {
-      '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
-    };
+    static const char hextab[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
 
     int nbytes;
     uint16_t port = ntohs(ip.port());
@@ -51,73 +47,93 @@ struct SSLAddressLookupKey
     if (port) {
       sep = nbytes;
       key[nbytes++] = '.';
-      key[nbytes++] = hextab[ (port >> 12) & 0x000F ];
-      key[nbytes++] = hextab[ (port >>  8) & 0x000F ];
-      key[nbytes++] = hextab[ (port >>  4) & 0x000F ];
-      key[nbytes++] = hextab[ (port      ) & 0x000F ];
+      key[nbytes++] = hextab[(port >> 12) & 0x000F];
+      key[nbytes++] = hextab[(port >> 8) & 0x000F];
+      key[nbytes++] = hextab[(port >> 4) & 0x000F];
+      key[nbytes++] = hextab[(port)&0x000F];
     }
     key[nbytes++] = 0;
   }
 
-  const char * get() const { return key; }
-  void split() { key[sep] = '\0'; }
-  void unsplit() { key[sep] = '.'; }
+  const char *
+  get() const
+  {
+    return key;
+  }
+  void
+  split()
+  {
+    key[sep] = '\0';
+  }
+  void
+  unsplit()
+  {
+    key[sep] = '.';
+  }
 
 private:
   char key[(TS_IP6_SIZE * 2) /* hex addr */ + 1 /* dot */ + 4 /* port */ + 1 /* NULL */];
   unsigned char sep; // offset of address/port separator
 };
 
-struct SSLContextStorage
-{
+struct SSLContextStorage {
 public:
   SSLContextStorage();
   ~SSLContextStorage();
 
   /// Add a cert context to storage
   /// @return The @a host_store index or -1 on error.
-  int insert(const char * name, SSLCertContext const& cc);
+  int insert(const char *name, SSLCertContext const &cc);
 
   /// Add a cert context to storage.
   /// @a idx must be a value returned by a previous call to insert.
   /// This creates an alias, a different @a name referring to the same
   /// cert context.
   /// @return @a idx
-  int insert(const char * name, int idx);
-  SSLCertContext* lookup(const char * name) const;
-  unsigned count() const { return this->ctx_store.length(); }
-  SSLCertContext* get(unsigned i) const { return &this->ctx_store[i]; }
+  int insert(const char *name, int idx);
+  SSLCertContext *lookup(const char *name) const;
+  unsigned
+  count() const
+  {
+    return this->ctx_store.length();
+  }
+  SSLCertContext *
+  get(unsigned i) const
+  {
+    return &this->ctx_store[i];
+  }
 
 private:
   /** A struct that can be stored a @c Trie.
       It contains the index of the real certificate and the
       linkage required by @c Trie.
   */
-  struct ContextRef
-  {
-    ContextRef(): idx(-1) {}
+  struct ContextRef {
+    ContextRef() : idx(-1) {}
     explicit ContextRef(int n) : idx(n) {}
-    void Print() const { Debug("ssl", "Item=%p SSL_CTX=#%d", this, idx); }
-    int idx; ///< Index in the context store.
+    void
+    Print() const
+    {
+      Debug("ssl", "Item=%p SSL_CTX=#%d", this, idx);
+    }
+    int idx;                ///< Index in the context store.
     LINK(ContextRef, link); ///< Require by @c Trie
   };
 
   /// Items tored by wildcard name
-  Trie<ContextRef>  wildcards;
+  Trie<ContextRef> wildcards;
   /// Contexts stored by IP address or FQDN
-  InkHashTable *  hostnames;
+  InkHashTable *hostnames;
   /// List for cleanup.
   /// Exactly one pointer to each SSL context is stored here.
-  Vec<SSLCertContext>  ctx_store;
+  Vec<SSLCertContext> ctx_store;
 
   /// Add a context to the clean up list.
   /// @return The index of the added context.
-  int store(SSLCertContext const& cc);
-
+  int store(SSLCertContext const &cc);
 };
 
-SSLCertLookup::SSLCertLookup()
-  : ssl_storage(new SSLContextStorage()), ssl_default(NULL), is_valid(true)
+SSLCertLookup::SSLCertLookup() : ssl_storage(new SSLContextStorage()), ssl_default(NULL), is_valid(true)
 {
 }
 
@@ -127,15 +143,15 @@ SSLCertLookup::~SSLCertLookup()
 }
 
 SSLCertContext *
-SSLCertLookup::find(const char * address) const
+SSLCertLookup::find(const char *address) const
 {
   return this->ssl_storage->lookup(address);
 }
 
 SSLCertContext *
-SSLCertLookup::find(const IpEndpoint& address) const
+SSLCertLookup::find(const IpEndpoint &address) const
 {
-  SSLCertContext * cc;
+  SSLCertContext *cc;
   SSLAddressLookupKey key(address);
 
   // First try the full address.
@@ -159,7 +175,7 @@ SSLCertLookup::insert(const char *name, SSLCertContext const &cc)
 }
 
 int
-SSLCertLookup::insert(const IpEndpoint& address, SSLCertContext const &cc)
+SSLCertLookup::insert(const IpEndpoint &address, SSLCertContext const &cc)
 {
   SSLAddressLookupKey key(address);
   return this->ssl_storage->insert(key.get(), cc);
@@ -177,18 +193,19 @@ SSLCertLookup::get(unsigned i) const
   return ssl_storage->get(i);
 }
 
-struct ats_wildcard_matcher
-{
-  ats_wildcard_matcher() {
+struct ats_wildcard_matcher {
+  ats_wildcard_matcher()
+  {
     if (regex.compile("^\\*\\.[^\\*.]+") != 0) {
       Fatal("failed to compile TLS wildcard matching regex");
     }
   }
 
-  ~ats_wildcard_matcher() {
-  }
+  ~ats_wildcard_matcher() {}
 
-  bool match(const char * hostname) const {
+  bool
+  match(const char *hostname) const
+  {
     return regex.match(hostname) != -1;
   }
 
@@ -197,10 +214,10 @@ private:
 };
 
 static char *
-reverse_dns_name(const char * hostname, char (&reversed)[TS_MAX_HOST_NAME_LEN+1])
+reverse_dns_name(const char *hostname, char(&reversed)[TS_MAX_HOST_NAME_LEN + 1])
 {
-  char * ptr = reversed + sizeof(reversed);
-  const char * part = hostname;
+  char *ptr = reversed + sizeof(reversed);
+  const char *part = hostname;
 
   *(--ptr) = '\0'; // NUL-terminate
 
@@ -227,13 +244,12 @@ reverse_dns_name(const char * hostname, char (&reversed)[TS_MAX_HOST_NAME_LEN+1]
   return ptr;
 }
 
-SSLContextStorage::SSLContextStorage()
-  :wildcards(), hostnames(ink_hash_table_create(InkHashTableKeyType_String))
+SSLContextStorage::SSLContextStorage() : wildcards(), hostnames(ink_hash_table_create(InkHashTableKeyType_String))
 {
 }
 
 bool
-SSLCtxCompare(SSLCertContext const & cc1, SSLCertContext const & cc2)
+SSLCtxCompare(SSLCertContext const &cc1, SSLCertContext const &cc2)
 {
   // Either they are both real ctx pointers and cc1 has the smaller pointer
   // Or only cc2 has a non-null pointer
@@ -257,7 +273,7 @@ SSLContextStorage::~SSLContextStorage()
 }
 
 int
-SSLContextStorage::store(SSLCertContext const& cc)
+SSLContextStorage::store(SSLCertContext const &cc)
 {
   int idx = this->ctx_store.length();
   this->ctx_store.add(cc);
@@ -265,16 +281,17 @@ SSLContextStorage::store(SSLCertContext const& cc)
 }
 
 int
-SSLContextStorage::insert(const char* name, SSLCertContext const& cc)
+SSLContextStorage::insert(const char *name, SSLCertContext const &cc)
 {
   int idx = this->store(cc);
   idx = this->insert(name, idx);
-  if (idx < 0) this->ctx_store.drop();
+  if (idx < 0)
+    this->ctx_store.drop();
   return idx;
 }
 
 int
-SSLContextStorage::insert(const char* name, int idx)
+SSLContextStorage::insert(const char *name, int idx)
 {
   ats_wildcard_matcher wildcard;
   bool inserted = false;
@@ -283,7 +300,7 @@ SSLContextStorage::insert(const char* name, int idx)
     // We turn wildcards into the reverse DNS form, then insert them into the trie
     // so that we can do a longest match lookup.
     char namebuf[TS_MAX_HOST_NAME_LEN + 1];
-    char * reversed;
+    char *reversed;
     ats_scoped_obj<ContextRef> ref;
 
     reversed = reverse_dns_name(name + 1, namebuf);
@@ -296,7 +313,7 @@ SSLContextStorage::insert(const char* name, int idx)
     int ref_idx = (*ref).idx;
     inserted = this->wildcards.Insert(reversed, ref, 0 /* rank */, -1 /* keylen */);
     if (!inserted) {
-      ContextRef * found;
+      ContextRef *found;
 
       // We fail to insert, so the longest wildcard match search should return the full match value.
       found = this->wildcards.Search(reversed);
@@ -304,16 +321,16 @@ SSLContextStorage::insert(const char* name, int idx)
       // Otherwise we cannot detect and recover from a double insert
       // into the references array
       if (found != NULL) {
-        Warning("previously indexed wildcard certificate for '%s' as '%s', cannot index it with SSL_CTX #%d now",
-            name, reversed, idx);
+        Warning("previously indexed wildcard certificate for '%s' as '%s', cannot index it with SSL_CTX #%d now", name, reversed,
+                idx);
       }
       idx = -1;
     } else {
       ref.release(); // it's the hands of the Trie now, forget it and move on.
     }
 
-    Debug("ssl", "%s wildcard certificate for '%s' as '%s' with SSL_CTX %p [%d]",
-      idx >= 0 ? "index" : "failed to index", name, reversed, this->ctx_store[ref_idx].ctx, ref_idx);
+    Debug("ssl", "%s wildcard certificate for '%s' as '%s' with SSL_CTX %p [%d]", idx >= 0 ? "index" : "failed to index", name,
+          reversed, this->ctx_store[ref_idx].ctx, ref_idx);
   } else {
     InkHashTableValue value;
 
@@ -321,16 +338,15 @@ SSLContextStorage::insert(const char* name, int idx)
       Warning("previously indexed '%s' with SSL_CTX %p, cannot index it with SSL_CTX #%d now", name, value, idx);
       idx = -1;
     } else {
-      ink_hash_table_insert(this->hostnames, name, reinterpret_cast<void*>(static_cast<intptr_t>(idx)));
-      Debug("ssl", "indexed '%s' with SSL_CTX %p [%d]",
-        name, this->ctx_store[idx].ctx, idx);
+      ink_hash_table_insert(this->hostnames, name, reinterpret_cast<void *>(static_cast<intptr_t>(idx)));
+      Debug("ssl", "indexed '%s' with SSL_CTX %p [%d]", name, this->ctx_store[idx].ctx, idx);
     }
   }
   return idx;
 }
 
 SSLCertContext *
-SSLContextStorage::lookup(const char * name) const
+SSLContextStorage::lookup(const char *name) const
 {
   InkHashTableValue value;
 
@@ -340,8 +356,8 @@ SSLContextStorage::lookup(const char * name) const
 
   if (!this->wildcards.Empty()) {
     char namebuf[TS_MAX_HOST_NAME_LEN + 1];
-    char * reversed;
-    ContextRef * ref;
+    char *reversed;
+    ContextRef *ref;
 
     reversed = reverse_dns_name(name, namebuf);
     if (!reversed) {
@@ -361,7 +377,7 @@ SSLContextStorage::lookup(const char * name) const
 
 #if TS_HAS_TESTS
 
-REGRESSION_TEST(SSLWildcardMatch)(RegressionTest * t, int /* atype ATS_UNUSED */, int * pstatus)
+REGRESSION_TEST(SSLWildcardMatch)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
 {
   TestBox box(t, pstatus);
   ats_wildcard_matcher wildcard;
@@ -375,7 +391,7 @@ REGRESSION_TEST(SSLWildcardMatch)(RegressionTest * t, int /* atype ATS_UNUSED */
   box.check(wildcard.match("") == false, "'' is not a wildcard");
 }
 
-REGRESSION_TEST(SSLReverseHostname)(RegressionTest * t, int /* atype ATS_UNUSED */, int * pstatus)
+REGRESSION_TEST(SSLReverseHostname)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
 {
   TestBox box(t, pstatus);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLConfig.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLConfig.cc b/iocore/net/SSLConfig.cc
index 627ccd2..acd8c19 100644
--- a/iocore/net/SSLConfig.cc
+++ b/iocore/net/SSLConfig.cc
@@ -54,30 +54,20 @@ size_t SSLConfigParams::session_cache_max_bucket_size = 100;
 
 init_ssl_ctx_func SSLConfigParams::init_ssl_ctx_cb = NULL;
 
-static ConfigUpdateHandler<SSLCertificateConfig> * sslCertUpdate;
+static ConfigUpdateHandler<SSLCertificateConfig> *sslCertUpdate;
 
 SSLConfigParams::SSLConfigParams()
 {
-  serverCertPathOnly =
-    serverCertChainFilename =
-    configFilePath =
-    serverCACertFilename =
-    serverCACertPath =
-    clientCertPath =
-    clientKeyPath =
-    clientCACertFilename =
-    clientCACertPath =
-    cipherSuite =
-    client_cipherSuite =
-    dhparamsFile =
-    serverKeyPathOnly = NULL;
+  serverCertPathOnly = serverCertChainFilename = configFilePath = serverCACertFilename = serverCACertPath = clientCertPath =
+    clientKeyPath = clientCACertFilename = clientCACertPath = cipherSuite = client_cipherSuite = dhparamsFile = serverKeyPathOnly =
+      NULL;
 
   clientCertLevel = client_verify_depth = verify_depth = clientVerify = 0;
 
   ssl_ctx_options = 0;
   ssl_client_ctx_protocols = 0;
   ssl_session_cache = SSL_SESSION_CACHE_MODE_SERVER_ATS_IMPL;
-  ssl_session_cache_size = 1024*100;
+  ssl_session_cache_size = 1024 * 100;
   ssl_session_cache_num_buckets = 1024; // Sessions per bucket is ceil(ssl_session_cache_size / ssl_session_cache_num_buckets)
   ssl_session_cache_skip_on_contention = 0;
   ssl_session_cache_timeout = 0;
@@ -123,7 +113,7 @@ set_paths_helper(const char *path, const char *filename, char **final_path, char
   if (final_path) {
     if (path && path[0] != '/') {
       *final_path = RecConfigReadPrefixPath(NULL, path);
-    } else if (!path || path[0] == '\0'){
+    } else if (!path || path[0] == '\0') {
       *final_path = RecConfigReadConfigDir();
     } else {
       *final_path = ats_strdup(path);
@@ -133,7 +123,6 @@ set_paths_helper(const char *path, const char *filename, char **final_path, char
   if (final_filename) {
     *final_filename = filename ? Layout::get()->relative_to(path, filename) : NULL;
   }
-
 }
 
 void
@@ -182,7 +171,7 @@ SSLConfigParams::initialize()
   if (!client_ssl_options)
     ssl_client_ctx_protocols |= SSL_OP_NO_TLSv1;
 
-  // These are not available in all versions of OpenSSL (e.g. CentOS6). Also see http://s.apache.org/TS-2355.
+// These are not available in all versions of OpenSSL (e.g. CentOS6). Also see http://s.apache.org/TS-2355.
 #ifdef SSL_OP_NO_TLSv1_1
   REC_ReadConfigInteger(options, "proxy.config.ssl.TLSv1_1");
   if (!options)
@@ -218,7 +207,7 @@ SSLConfigParams::initialize()
 #endif
   }
 
-  // Enable ephemeral DH parameters for the case where we use a cipher with DH forward security.
+// Enable ephemeral DH parameters for the case where we use a cipher with DH forward security.
 #ifdef SSL_OP_SINGLE_DH_USE
   ssl_ctx_options |= SSL_OP_SINGLE_DH_USE;
 #endif
@@ -230,8 +219,8 @@ SSLConfigParams::initialize()
   // Enable all SSL compatibility workarounds.
   ssl_ctx_options |= SSL_OP_ALL;
 
-  // According to OpenSSL source, applications must enable this if they support the Server Name extension. Since
-  // we do, then we ought to enable this. Httpd also enables this unconditionally.
+// According to OpenSSL source, applications must enable this if they support the Server Name extension. Since
+// we do, then we ought to enable this. Httpd also enables this unconditionally.
 #ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
   ssl_ctx_options |= SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION;
 #endif
@@ -257,13 +246,11 @@ SSLConfigParams::initialize()
   REC_ReadConfigInteger(ssl_session_cache, "proxy.config.ssl.session_cache");
   REC_ReadConfigInteger(ssl_session_cache_size, "proxy.config.ssl.session_cache.size");
   REC_ReadConfigInteger(ssl_session_cache_num_buckets, "proxy.config.ssl.session_cache.num_buckets");
-  REC_ReadConfigInteger(ssl_session_cache_skip_on_contention,
-                        "proxy.config.ssl.session_cache.skip_cache_on_bucket_contention");
+  REC_ReadConfigInteger(ssl_session_cache_skip_on_contention, "proxy.config.ssl.session_cache.skip_cache_on_bucket_contention");
   REC_ReadConfigInteger(ssl_session_cache_timeout, "proxy.config.ssl.session_cache.timeout");
   REC_ReadConfigInteger(ssl_session_cache_auto_clear, "proxy.config.ssl.session_cache.auto_clear");
 
-  SSLConfigParams::session_cache_max_bucket_size = (size_t)ceil((double)ssl_session_cache_size /
-                                                                ssl_session_cache_num_buckets);
+  SSLConfigParams::session_cache_max_bucket_size = (size_t)ceil((double)ssl_session_cache_size / ssl_session_cache_num_buckets);
   SSLConfigParams::session_cache_skip_on_lock_contention = ssl_session_cache_skip_on_contention;
   SSLConfigParams::session_cache_number_buckets = ssl_session_cache_num_buckets;
 
@@ -316,18 +303,18 @@ SSLConfig::reconfigure()
 {
   SSLConfigParams *params;
   params = new SSLConfigParams;
-  params->initialize();         // re-read configuration
+  params->initialize(); // re-read configuration
   configid = configProcessor.set(configid, params);
 }
 
 SSLConfigParams *
 SSLConfig::acquire()
 {
-  return ((SSLConfigParams *) configProcessor.get(configid));
+  return ((SSLConfigParams *)configProcessor.get(configid));
 }
 
 void
-SSLConfig::release(SSLConfigParams * params)
+SSLConfig::release(SSLConfigParams *params)
 {
   configProcessor.release(configid, params);
 }
@@ -353,7 +340,7 @@ SSLCertificateConfig::reconfigure()
 {
   bool retStatus = true;
   SSLConfig::scoped_config params;
-  SSLCertLookup * lookup = new SSLCertLookup();
+  SSLCertLookup *lookup = new SSLCertLookup();
 
   // Test SSL certificate loading startup. With large numbers of certificates, reloading can take time, so delay
   // twice the healthcheck period to simulate a loading a large certificate set.
@@ -381,8 +368,7 @@ SSLCertificateConfig::acquire()
 }
 
 void
-SSLCertificateConfig::release(SSLCertLookup * lookup)
+SSLCertificateConfig::release(SSLCertLookup *lookup)
 {
   configProcessor.release(configid, lookup);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetAccept.cc b/iocore/net/SSLNetAccept.cc
index 9f5b196..b4017be 100644
--- a/iocore/net/SSLNetAccept.cc
+++ b/iocore/net/SSLNetAccept.cc
@@ -22,7 +22,7 @@
 #include "ink_config.h"
 #include "P_Net.h"
 
-typedef int (SSLNetAccept::*SSLNetAcceptHandler) (int, void *);
+typedef int (SSLNetAccept::*SSLNetAcceptHandler)(int, void *);
 
 // Virtual function allows the correct
 // etype to be used in NetAccept functions (ET_SSL
@@ -48,9 +48,9 @@ SSLNetAccept::init_accept_per_thread()
   if (do_listen(NON_BLOCKING))
     return;
   if (accept_fn == net_accept)
-    SET_HANDLER((SSLNetAcceptHandler) & SSLNetAccept::acceptFastEvent);
+    SET_HANDLER((SSLNetAcceptHandler)&SSLNetAccept::acceptFastEvent);
   else
-    SET_HANDLER((SSLNetAcceptHandler) & SSLNetAccept::acceptEvent);
+    SET_HANDLER((SSLNetAcceptHandler)&SSLNetAccept::acceptEvent);
   period = ACCEPT_PERIOD;
   n = eventProcessor.n_threads_for_type[SSLNetProcessor::ET_SSL];
   for (i = 0; i < n; i++) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetProcessor.cc b/iocore/net/SSLNetProcessor.cc
index 761487c..f52611a 100644
--- a/iocore/net/SSLNetProcessor.cc
+++ b/iocore/net/SSLNetProcessor.cc
@@ -31,24 +31,21 @@
 // Global Data
 //
 
-SSLNetProcessor   ssl_NetProcessor;
-NetProcessor&     sslNetProcessor = ssl_NetProcessor;
-EventType         SSLNetProcessor::ET_SSL;
+SSLNetProcessor ssl_NetProcessor;
+NetProcessor &sslNetProcessor = ssl_NetProcessor;
+EventType SSLNetProcessor::ET_SSL;
 
 #ifdef HAVE_OPENSSL_OCSP_STAPLING
-struct OCSPContinuation:public Continuation
-{
-  int mainEvent(int /* event ATS_UNUSED */, Event* /* e ATS_UNUSED */)
+struct OCSPContinuation : public Continuation {
+  int
+  mainEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   {
     ocsp_update();
 
     return EVENT_CONT;
   }
 
-  OCSPContinuation():Continuation(new_ProxyMutex())
-  {
-    SET_HANDLER(&OCSPContinuation::mainEvent);
-  }
+  OCSPContinuation() : Continuation(new_ProxyMutex()) { SET_HANDLER(&OCSPContinuation::mainEvent); }
 };
 #endif /* HAVE_OPENSSL_OCSP_STAPLING */
 
@@ -68,7 +65,8 @@ SSLNetProcessor::start(int number_of_ssl_threads, size_t stacksize)
   SSLInitializeLibrary();
   SSLConfig::startup();
 
-  if (!SSLCertificateConfig::startup()) return -1;
+  if (!SSLCertificateConfig::startup())
+    return -1;
 
   // Acquire a SSLConfigParams instance *after* we start SSL up.
   SSLConfig::scoped_config params;
@@ -112,13 +110,13 @@ SSLNetProcessor::start(int number_of_ssl_threads, size_t stacksize)
 NetAccept *
 SSLNetProcessor::createNetAccept()
 {
-  return (NetAccept *) new SSLNetAccept;
+  return (NetAccept *)new SSLNetAccept;
 }
 
 // Virtual function allows etype to be upgraded to ET_SSL for SSLNetProcessor.  Does
 // nothing for NetProcessor
 void
-SSLNetProcessor::upgradeEtype(EventType & etype)
+SSLNetProcessor::upgradeEtype(EventType &etype)
 {
   if (etype == ET_NET) {
     etype = ET_SSL;
@@ -141,8 +139,7 @@ SSLNetProcessor::allocate_vc(EThread *t)
   return vc;
 }
 
-SSLNetProcessor::SSLNetProcessor()
-  : client_ctx(NULL)
+SSLNetProcessor::SSLNetProcessor() : client_ctx(NULL)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 168a9f8..3d58072 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -25,102 +25,107 @@
 #include "P_Net.h"
 #include "P_SSLNextProtocolSet.h"
 #include "P_SSLUtils.h"
-#include "InkAPIInternal.h"	// Added to include the ssl_hook definitions
+#include "InkAPIInternal.h" // Added to include the ssl_hook definitions
 
 // Defined in SSLInternal.c, should probably make a separate include
 // file for this at some point
 void SSL_set_rbio(SSLNetVConnection *sslvc, BIO *rbio);
 
-#define SSL_READ_ERROR_NONE	  0
-#define SSL_READ_ERROR		  1
-#define SSL_READ_READY		  2
-#define SSL_READ_COMPLETE	  3
-#define SSL_READ_WOULD_BLOCK      4
-#define SSL_READ_EOS		  5
-#define SSL_HANDSHAKE_WANT_READ   6
-#define SSL_HANDSHAKE_WANT_WRITE  7
+#define SSL_READ_ERROR_NONE 0
+#define SSL_READ_ERROR 1
+#define SSL_READ_READY 2
+#define SSL_READ_COMPLETE 3
+#define SSL_READ_WOULD_BLOCK 4
+#define SSL_READ_EOS 5
+#define SSL_HANDSHAKE_WANT_READ 6
+#define SSL_HANDSHAKE_WANT_WRITE 7
 #define SSL_HANDSHAKE_WANT_ACCEPT 8
 #define SSL_HANDSHAKE_WANT_CONNECT 9
-#define SSL_WRITE_WOULD_BLOCK     10
-#define SSL_WAIT_FOR_HOOK         11
+#define SSL_WRITE_WOULD_BLOCK 10
+#define SSL_WAIT_FOR_HOOK 11
 
 #ifndef UIO_MAXIOV
-#define NET_MAX_IOV 16          // UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
+#define NET_MAX_IOV 16 // UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
 #else
 #define NET_MAX_IOV UIO_MAXIOV
 #endif
 
 ClassAllocator<SSLNetVConnection> sslNetVCAllocator("sslNetVCAllocator");
 
-namespace {
-  /// Callback to get two locks.
-  /// The lock for this continuation, and for the target continuation.
-  class ContWrapper : public Continuation
+namespace
+{
+/// Callback to get two locks.
+/// The lock for this continuation, and for the target continuation.
+class ContWrapper : public Continuation
+{
+public:
+  /** Constructor.
+      This takes the secondary @a mutex and the @a target continuation
+      to invoke, along with the arguments for that invocation.
+  */
+  ContWrapper(ProxyMutex *mutex ///< Mutex for this continuation (primary lock).
+              ,
+              Continuation *target ///< "Real" continuation we want to call.
+              ,
+              int eventId = EVENT_IMMEDIATE ///< Event ID for invocation of @a target.
+              ,
+              void *edata = 0 ///< Data for invocation of @a target.
+              )
+    : Continuation(mutex), _target(target), _eventId(eventId), _edata(edata)
   {
-  public:
-    /** Constructor.
-        This takes the secondary @a mutex and the @a target continuation
-        to invoke, along with the arguments for that invocation.
-    */
-    ContWrapper(
-      ProxyMutex* mutex ///< Mutex for this continuation (primary lock).
-      , Continuation* target ///< "Real" continuation we want to call.
-      , int eventId = EVENT_IMMEDIATE ///< Event ID for invocation of @a target.
-      , void* edata = 0 ///< Data for invocation of @a target.
-      )
-      : Continuation(mutex)
-      , _target(target)
-      , _eventId(eventId)
-      , _edata(edata)
-    {
-      SET_HANDLER(&ContWrapper::event_handler);
-    }
+    SET_HANDLER(&ContWrapper::event_handler);
+  }
 
-    /// Required event handler method.
-    int event_handler(int, void*)
-    {
-      EThread* eth = this_ethread();
-
-      MUTEX_TRY_LOCK(lock, _target->mutex, eth);
-      if (lock.is_locked()) { // got the target lock, we can proceed.
-        _target->handleEvent(_eventId, _edata);
-        delete this;
-      } else { // can't get both locks, try again.
-        eventProcessor.schedule_imm(this, ET_NET);
-      }
-      return 0;
+  /// Required event handler method.
+  int
+  event_handler(int, void *)
+  {
+    EThread *eth = this_ethread();
+
+    MUTEX_TRY_LOCK(lock, _target->mutex, eth);
+    if (lock.is_locked()) { // got the target lock, we can proceed.
+      _target->handleEvent(_eventId, _edata);
+      delete this;
+    } else { // can't get both locks, try again.
+      eventProcessor.schedule_imm(this, ET_NET);
     }
+    return 0;
+  }
 
-    /** Convenience static method.
-
-        This lets a client make one call and not have to (accurately)
-        copy the invocation logic embedded here. We duplicate it near
-        by textually so it is easier to keep in sync.
-
-        This takes the same arguments as the constructor but, if the
-        lock can be obtained immediately, does not construct an
-        instance but simply calls the @a target.
-    */
-    static void wrap(
-      ProxyMutex* mutex ///< Mutex for this continuation (primary lock).
-      , Continuation* target ///< "Real" continuation we want to call.
-      , int eventId = EVENT_IMMEDIATE ///< Event ID for invocation of @a target.
-      , void* edata = 0 ///< Data for invocation of @a target.
-      ) {
-      EThread* eth = this_ethread();
-      MUTEX_TRY_LOCK(lock, target->mutex, eth);
-      if (lock.is_locked()) {
-        target->handleEvent(eventId, edata);
-      } else {
-        eventProcessor.schedule_imm(new ContWrapper(mutex, target, eventId, edata), ET_NET);
-      }
+  /** Convenience static method.
+
+      This lets a client make one call and not have to (accurately)
+      copy the invocation logic embedded here. We duplicate it near
+      by textually so it is easier to keep in sync.
+
+      This takes the same arguments as the constructor but, if the
+      lock can be obtained immediately, does not construct an
+      instance but simply calls the @a target.
+  */
+  static void
+  wrap(ProxyMutex *mutex ///< Mutex for this continuation (primary lock).
+       ,
+       Continuation *target ///< "Real" continuation we want to call.
+       ,
+       int eventId = EVENT_IMMEDIATE ///< Event ID for invocation of @a target.
+       ,
+       void *edata = 0 ///< Data for invocation of @a target.
+       )
+  {
+    EThread *eth = this_ethread();
+    MUTEX_TRY_LOCK(lock, target->mutex, eth);
+    if (lock.is_locked()) {
+      target->handleEvent(eventId, edata);
+    } else {
+      eventProcessor.schedule_imm(new ContWrapper(mutex, target, eventId, edata), ET_NET);
     }
+  }
 
-  private:
-    Continuation* _target; ///< Continuation to invoke.
-    int _eventId; ///< with this event
-    void* _edata; ///< and this data
-  };
+private:
+  Continuation *_target; ///< Continuation to invoke.
+  int _eventId;          ///< with this event
+  void *_edata;          ///< and this data
+};
 }
 
 //
@@ -128,9 +133,9 @@ namespace {
 //
 
 static SSL *
-make_ssl_connection(SSL_CTX * ctx, SSLNetVConnection * netvc)
+make_ssl_connection(SSL_CTX *ctx, SSLNetVConnection *netvc)
 {
-  SSL * ssl;
+  SSL *ssl;
 
   if (likely(ssl = SSL_new(ctx))) {
     netvc->ssl = ssl;
@@ -153,9 +158,9 @@ make_ssl_connection(SSL_CTX * ctx, SSLNetVConnection * netvc)
 }
 
 static void
-debug_certificate_name(const char * msg, X509_NAME * name)
+debug_certificate_name(const char *msg, X509_NAME *name)
 {
-  BIO * bio;
+  BIO *bio;
 
   if (name == NULL) {
     return;
@@ -168,7 +173,7 @@ debug_certificate_name(const char * msg, X509_NAME * name)
 
   if (X509_NAME_print_ex(bio, name, 0 /* indent */, XN_FLAG_ONELINE) > 0) {
     long len;
-    char * ptr;
+    char *ptr;
     len = BIO_get_mem_data(bio, &ptr);
     Debug("ssl", "%s %.*s", msg, (int)len, ptr);
   }
@@ -177,10 +182,10 @@ debug_certificate_name(const char * msg, X509_NAME * name)
 }
 
 static int
-ssl_read_from_net(SSLNetVConnection * sslvc, EThread * lthread, int64_t &ret)
+ssl_read_from_net(SSLNetVConnection *sslvc, EThread *lthread, int64_t &ret)
 {
   NetState *s = &sslvc->read;
-  MIOBufferAccessor & buf = s->vio.buffer;
+  MIOBufferAccessor &buf = s->vio.buffer;
   IOBufferBlock *b = buf.writer()->first_write_block();
   int event = SSL_READ_ERROR_NONE;
   int64_t bytes_read;
@@ -196,7 +201,7 @@ ssl_read_from_net(SSLNetVConnection * sslvc, EThread * lthread, int64_t &ret)
     int64_t offset = 0;
     // while can be replaced with if - need to test what works faster with openssl
     while (block_write_avail > 0) {
-      sslErr = SSLReadBuffer (sslvc->ssl, b->end() + offset, block_write_avail, nread);
+      sslErr = SSLReadBuffer(sslvc->ssl, b->end() + offset, block_write_avail, nread);
 
       Debug("ssl", "[SSL_NetVConnection::ssl_read_from_net] nread=%d", (int)nread);
 
@@ -241,7 +246,7 @@ ssl_read_from_net(SSLNetVConnection * sslvc, EThread * lthread, int64_t &ret)
         } else {
           // then EOF observed, treat it as EOS
           event = SSL_READ_EOS;
-          //Error("[SSL_NetVConnection::ssl_read_from_net] SSL_ERROR_SYSCALL, EOF observed violating SSL protocol");
+          // Error("[SSL_NetVConnection::ssl_read_from_net] SSL_ERROR_SYSCALL, EOF observed violating SSL protocol");
         }
         break;
       case SSL_ERROR_ZERO_RETURN:
@@ -255,10 +260,10 @@ ssl_read_from_net(SSLNetVConnection * sslvc, EThread * lthread, int64_t &ret)
         ret = errno;
         SSL_CLR_ERR_INCR_DYN_STAT(sslvc, ssl_error_ssl, "[SSL_NetVConnection::ssl_read_from_net]: errno=%d", errno);
         break;
-      }                         // switch
+      } // switch
       break;
-    }                           // while( block_write_avail > 0 )
-  }                             // for ( bytes_read = 0; (b != 0); b = b->next)
+    } // while( block_write_avail > 0 )
+  }   // for ( bytes_read = 0; (b != 0); b = b->next)
 
   if (bytes_read > 0) {
     Debug("ssl", "[SSL_NetVConnection::ssl_read_from_net] bytes_read=%" PRId64, bytes_read);
@@ -273,16 +278,15 @@ ssl_read_from_net(SSLNetVConnection * sslvc, EThread * lthread, int64_t &ret)
     } else {
       event = SSL_READ_READY;
     }
-  } else                        // if( bytes_read > 0 )
+  } else // if( bytes_read > 0 )
   {
-#if defined (_DEBUG)
+#if defined(_DEBUG)
     if (bytes_read == 0) {
       Debug("ssl", "[SSL_NetVConnection::ssl_read_from_net] bytes_read == 0");
     }
 #endif
   }
   return (event);
-
 }
 
 /**
@@ -341,7 +345,6 @@ SSLNetVConnection::read_raw_data()
     }
     // check for errors
     if (r <= 0) {
-
       if (r == -EAGAIN || r == -ENOTCONN) {
         NET_INCREMENT_DYN_STAT(net_calls_to_read_nodata_stat);
         return r;
@@ -355,7 +358,6 @@ SSLNetVConnection::read_raw_data()
     NET_SUM_DYN_STAT(net_read_bytes_stat, r);
 
     this->handShakeBuffer->fill(r);
-
   }
 
   char *start = this->handShakeReader->start();
@@ -372,7 +374,7 @@ SSLNetVConnection::read_raw_data()
 }
 
 
-//changed by YTS Team, yamsat
+// changed by YTS Team, yamsat
 void
 SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
 {
@@ -427,11 +429,10 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
           this->handShakeReader->consume(this->handShakeBioStored);
           this->handShakeBioStored = 0;
         }
-      }
-      else {
+      } else {
         // Now in blind tunnel. Set things up to read what is in the buffer
         // Must send the READ_COMPLETE here before considering
-        // forwarding on the handshake buffer, so the 
+        // forwarding on the handshake buffer, so the
         // SSLNextProtocolTrampoline has a chance to do its
         // thing before forwarding the buffers.
         this->readSignalDone(VC_EVENT_READ_COMPLETE, nh);
@@ -505,17 +506,16 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
     // Check out if there is anything left in the current bio
     if (!BIO_eof(SSL_get_rbio(this->ssl))) {
       // Still data remaining in the current BIO block
-    }
-    else {
-      // Consume what SSL has read so far.  
+    } else {
+      // Consume what SSL has read so far.
       this->handShakeReader->consume(this->handShakeBioStored);
-      
+
       // If we are empty now, switch over
       if (this->handShakeReader->read_avail() <= 0) {
         // Switch the read bio over to a socket bio
         SSL_set_rfd(this->ssl, this->get_socket());
         this->free_handshake_buffers();
-      } else { 
+      } else {
         // Setup the next iobuffer block to drain
         char *start = this->handShakeReader->start();
         char *end = this->handShakeReader->end();
@@ -526,7 +526,7 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
         BIO *rbio = BIO_new_mem_buf(start, this->handShakeBioStored);
         BIO_set_mem_eof_return(rbio, -1);
         SSL_set_rbio(this, rbio);
-      } 
+      }
     }
   }
   // Otherwise, we already replaced the buffer bio with a socket bio
@@ -580,7 +580,8 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
     break;
 
   case SSL_READ_EOS:
-    // close the connection if we have SSL_READ_EOS, this is the return value from ssl_read_from_net() if we get an SSL_ERROR_ZERO_RETURN from SSL_get_error()
+    // close the connection if we have SSL_READ_EOS, this is the return value from ssl_read_from_net() if we get an
+    // SSL_ERROR_ZERO_RETURN from SSL_get_error()
     // SSL_ERROR_ZERO_RETURN means that the origin server closed the SSL connection
     read.triggered = 0;
     readSignalDone(VC_EVENT_EOS, nh);
@@ -601,12 +602,12 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread)
     Debug("ssl", "read_from_net, read finished - read error");
     break;
   }
-
 }
 
 
 int64_t
-SSLNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor & buf, int &needs)
+SSLNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, int64_t &total_written, MIOBufferAccessor &buf,
+                                         int &needs)
 {
   ProxyMutex *mutex = this_ethread()->mutex;
   int64_t r = 0;
@@ -628,7 +629,8 @@ SSLNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, i
       // reset sslTotalBytesSent upon inactivity for SSL_DEF_TLS_RECORD_MSEC_THRESHOLD
       sslTotalBytesSent = 0;
     }
-    Debug("ssl", "SSLNetVConnection::loadBufferAndCallWrite, now %" PRId64 ",lastwrite %" PRId64 " ,msec_since_last_write %d", now, sslLastWriteTime, msec_since_last_write);
+    Debug("ssl", "SSLNetVConnection::loadBufferAndCallWrite, now %" PRId64 ",lastwrite %" PRId64 " ,msec_since_last_write %d", now,
+          sslLastWriteTime, msec_since_last_write);
   }
 
   if (HttpProxyPort::TRANSPORT_BLIND_TUNNEL == this->attributes) {
@@ -676,22 +678,23 @@ SSLNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, i
 
     wattempted = l;
     total_written += l;
-    Debug("ssl", "SSLNetVConnection::loadBufferAndCallWrite, before SSLWriteBuffer, l=%" PRId64", towrite=%" PRId64", b=%p",
-          l, towrite, b);
+    Debug("ssl", "SSLNetVConnection::loadBufferAndCallWrite, before SSLWriteBuffer, l=%" PRId64 ", towrite=%" PRId64 ", b=%p", l,
+          towrite, b);
     err = SSLWriteBuffer(ssl, b->start() + offset, l, r);
 
     if (r == l) {
       wattempted = total_written;
     }
     if (l == orig_l) {
-        // on to the next block
-        offset = 0;
-        b = b->next;
+      // on to the next block
+      offset = 0;
+      b = b->next;
     } else {
-        offset += l;
+      offset += l;
     }
 
-    Debug("ssl", "SSLNetVConnection::loadBufferAndCallWrite,Number of bytes written=%" PRId64" , total=%" PRId64"", r, total_written);
+    Debug("ssl", "SSLNetVConnection::loadBufferAndCallWrite,Number of bytes written=%" PRId64 " , total=%" PRId64 "", r,
+          total_written);
     NET_INCREMENT_DYN_STAT(net_calls_to_write_stat);
   } while (r == l && total_written < towrite && b);
 
@@ -735,7 +738,7 @@ SSLNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, i
       SSL_INCREMENT_DYN_STAT(ssl_error_syscall);
       Debug("ssl.error", "SSL_write-SSL_ERROR_SYSCALL");
       break;
-      // end of stream
+    // end of stream
     case SSL_ERROR_ZERO_RETURN:
       r = -errno;
       SSL_INCREMENT_DYN_STAT(ssl_error_zero_return);
@@ -751,28 +754,17 @@ SSLNetVConnection::load_buffer_and_write(int64_t towrite, int64_t &wattempted, i
   }
 }
 
-SSLNetVConnection::SSLNetVConnection():
-  ssl(NULL),
-  sslHandshakeBeginTime(0),
-  sslLastWriteTime(0),
-  sslTotalBytesSent(0),
-  hookOpRequested(TS_SSL_HOOK_OP_DEFAULT),
-  sslHandShakeComplete(false),
-  sslClientConnection(false),
-  sslClientRenegotiationAbort(false),
-  handShakeBuffer(NULL),
-  handShakeHolder(NULL),
-  handShakeReader(NULL),
-  handShakeBioStored(0),
-  sslPreAcceptHookState(SSL_HOOKS_INIT),
-  sslHandshakeHookState(HANDSHAKE_HOOKS_PRE),
-  npnSet(NULL),
-  npnEndpoint(NULL)
+SSLNetVConnection::SSLNetVConnection()
+  : ssl(NULL), sslHandshakeBeginTime(0), sslLastWriteTime(0), sslTotalBytesSent(0), hookOpRequested(TS_SSL_HOOK_OP_DEFAULT),
+    sslHandShakeComplete(false), sslClientConnection(false), sslClientRenegotiationAbort(false), handShakeBuffer(NULL),
+    handShakeHolder(NULL), handShakeReader(NULL), handShakeBioStored(0), sslPreAcceptHookState(SSL_HOOKS_INIT),
+    sslHandshakeHookState(HANDSHAKE_HOOKS_PRE), npnSet(NULL), npnEndpoint(NULL)
 {
 }
 
 void
-SSLNetVConnection::free(EThread * t) {
+SSLNetVConnection::free(EThread *t)
+{
   NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, -1);
   got_remote_addr = 0;
   got_local_addr = 0;
@@ -780,7 +772,7 @@ SSLNetVConnection::free(EThread * t) {
   write.vio.mutex.clear();
   this->mutex.clear();
   flags = 0;
-  SET_CONTINUATION_HANDLER(this, (SSLNetVConnHandler) & SSLNetVConnection::startEvent);
+  SET_CONTINUATION_HANDLER(this, (SSLNetVConnHandler)&SSLNetVConnection::startEvent);
   nh = NULL;
   read.triggered = 0;
   write.triggered = 0;
@@ -805,7 +797,7 @@ SSLNetVConnection::free(EThread * t) {
   curHook = 0;
   hookOpRequested = TS_SSL_HOOK_OP_DEFAULT;
   npnSet = NULL;
-  npnEndpoint= NULL;
+  npnEndpoint = NULL;
   free_handshake_buffers();
 
   if (from_accept_thread) {
@@ -818,7 +810,6 @@ SSLNetVConnection::free(EThread * t) {
 int
 SSLNetVConnection::sslStartHandShake(int event, int &err)
 {
-
   switch (event) {
   case SSL_EVENT_SERVER:
     if (this->ssl == NULL) {
@@ -880,7 +871,6 @@ SSLNetVConnection::sslStartHandShake(int event, int &err)
     ink_assert(0);
     return EVENT_ERROR;
   }
-
 }
 
 int
@@ -905,12 +895,12 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
         return SSL_WAIT_FOR_HOOK;
       }
     } else { // waiting for hook to complete
-      /* A note on waiting for the hook. I believe that because this logic
-         cannot proceed as long as a hook is outstanding, the underlying VC
-         can't go stale. If that can happen for some reason, we'll need to be
-         more clever and provide some sort of cancel mechanism. I have a trap
-         in SSLNetVConnection::free to check for this.
-      */
+             /* A note on waiting for the hook. I believe that because this logic
+                cannot proceed as long as a hook is outstanding, the underlying VC
+                can't go stale. If that can happen for some reason, we'll need to be
+                more clever and provide some sort of cancel mechanism. I have a trap
+                in SSLNetVConnection::free to check for this.
+             */
       return SSL_WAIT_FOR_HOOK;
     }
   }
@@ -945,10 +935,10 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
 
   if (ssl_error != SSL_ERROR_NONE) {
     err = errno;
-    SSLDebugVC(this,"SSL handshake error: %s (%d), errno=%d", SSLErrorName(ssl_error), ssl_error, err);
+    SSLDebugVC(this, "SSL handshake error: %s (%d), errno=%d", SSLErrorName(ssl_error), ssl_error, err);
 
     // start a blind tunnel if tr-pass is set and data does not look like ClientHello
-    char* buf = handShakeBuffer->buf();
+    char *buf = handShakeBuffer->buf();
     if (getTransparentPassThrough() && buf && *buf != SSL_OP_HANDSHAKE) {
       SSLDebugVC(this, "Data does not look like SSL handshake, starting blind tunnel");
       this->attributes = HttpProxyPort::TRANSPORT_BLIND_TUNNEL;
@@ -960,7 +950,7 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
   switch (ssl_error) {
   case SSL_ERROR_NONE:
     if (is_debug_tag_set("ssl")) {
-      X509 * cert = SSL_get_peer_certificate(ssl);
+      X509 *cert = SSL_get_peer_certificate(ssl);
 
       Debug("ssl", "SSL server handshake completed successfully");
       if (cert) {
@@ -981,13 +971,13 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
     }
 
     {
-      const unsigned char * proto = NULL;
+      const unsigned char *proto = NULL;
       unsigned len = 0;
 
-      // If it's possible to negotiate both NPN and ALPN, then ALPN
-      // is preferred since it is the server's preference.  The server
-      // preference would not be meaningful if we let the client
-      // preference have priority.
+// If it's possible to negotiate both NPN and ALPN, then ALPN
+// is preferred since it is the server's preference.  The server
+// preference would not be meaningful if we let the client
+// preference have priority.
 
 #if TS_USE_TLS_ALPN
       SSL_get0_alpn_selected(ssl, &proto, &len);
@@ -1030,7 +1020,7 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
 
 // This value is only defined in openssl has been patched to
 // enable the sni callback to break out of the SSL_accept processing
-#ifdef SSL_ERROR_WANT_SNI_RESOLVE 
+#ifdef SSL_ERROR_WANT_SNI_RESOLVE
   case SSL_ERROR_WANT_X509_LOOKUP:
     return EVENT_CONT;
   case SSL_ERROR_WANT_SNI_RESOLVE:
@@ -1038,13 +1028,11 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
   case SSL_ERROR_WANT_X509_LOOKUP:
 #endif
 #if defined(SSL_ERROR_WANT_SNI_RESOLVE) || defined(SSL_ERROR_WANT_X509_LOOKUP)
-    if (this->attributes == HttpProxyPort::TRANSPORT_BLIND_TUNNEL ||
-        TS_SSL_HOOK_OP_TUNNEL == hookOpRequested) {
+    if (this->attributes == HttpProxyPort::TRANSPORT_BLIND_TUNNEL || TS_SSL_HOOK_OP_TUNNEL == hookOpRequested) {
       this->attributes = HttpProxyPort::TRANSPORT_BLIND_TUNNEL;
       sslHandShakeComplete = 0;
       return EVENT_CONT;
-    }
-    else {
+    } else {
       //  Stopping for some other reason, perhaps loading certificate
       return SSL_WAIT_FOR_HOOK;
     }
@@ -1055,13 +1043,12 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
 
   case SSL_ERROR_SSL:
     SSL_CLR_ERR_INCR_DYN_STAT(this, ssl_error_ssl, "SSLNetVConnection::sslServerHandShakeEvent, SSL_ERROR_SSL errno=%d", errno);
-    // fall through
+  // fall through
   case SSL_ERROR_ZERO_RETURN:
   case SSL_ERROR_SYSCALL:
   default:
     return EVENT_ERROR;
   }
-
 }
 
 
@@ -1073,7 +1060,7 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
     if (SSL_set_tlsext_host_name(ssl, options.sni_servername)) {
       Debug("ssl", "using SNI name '%s' for client handshake", options.sni_servername.get());
     } else {
-      Debug("ssl.error","failed to set SNI name '%s' for client handshake", options.sni_servername.get());
+      Debug("ssl.error", "failed to set SNI name '%s' for client handshake", options.sni_servername.get());
       SSL_INCREMENT_DYN_STAT(ssl_sni_name_set_failure);
     }
   }
@@ -1083,7 +1070,7 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
   switch (ssl_error) {
   case SSL_ERROR_NONE:
     if (is_debug_tag_set("ssl")) {
-      X509 * cert = SSL_get_peer_certificate(ssl);
+      X509 *cert = SSL_get_peer_certificate(ssl);
 
       Debug("ssl", "SSL client handshake completed successfully");
       // if the handshake is complete and write is enabled reschedule the write
@@ -1140,14 +1127,12 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
     SSL_CLR_ERR_INCR_DYN_STAT(this, ssl_error_ssl, "SSLNetVConnection::sslClientHandShakeEvent, SSL_ERROR_SSL errno=%d", errno);
     return EVENT_ERROR;
     break;
-
   }
   return EVENT_CONT;
-
 }
 
 void
-SSLNetVConnection::registerNextProtocolSet(const SSLNextProtocolSet * s)
+SSLNetVConnection::registerNextProtocolSet(const SSLNextProtocolSet *s)
 {
   ink_release_assert(this->npnSet == NULL);
   this->npnSet = s;
@@ -1157,10 +1142,9 @@ SSLNetVConnection::registerNextProtocolSet(const SSLNextProtocolSet * s)
 // allows the client to select a preferred protocol, so all we have
 // to do here is tell them what out protocol set is.
 int
-SSLNetVConnection::advertise_next_protocol(SSL *ssl, const unsigned char **out, unsigned int *outlen,
-                                           void * /*arg ATS_UNUSED */)
+SSLNetVConnection::advertise_next_protocol(SSL *ssl, const unsigned char **out, unsigned int *outlen, void * /*arg ATS_UNUSED */)
 {
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
 
   ink_release_assert(netvc != NULL);
 
@@ -1175,17 +1159,18 @@ SSLNetVConnection::advertise_next_protocol(SSL *ssl, const unsigned char **out,
 // ALPN TLS extension callback. Given the client's set of offered
 // protocols, we have to select a protocol to use for this session.
 int
-SSLNetVConnection::select_next_protocol(SSL * ssl, const unsigned char ** out, unsigned char * outlen, const unsigned char * in ATS_UNUSED, unsigned inlen ATS_UNUSED, void *)
+SSLNetVConnection::select_next_protocol(SSL *ssl, const unsigned char **out, unsigned char *outlen,
+                                        const unsigned char *in ATS_UNUSED, unsigned inlen ATS_UNUSED, void *)
 {
-  SSLNetVConnection * netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
-  const unsigned char * npn = NULL;
+  SSLNetVConnection *netvc = (SSLNetVConnection *)SSL_get_app_data(ssl);
+  const unsigned char *npn = NULL;
   unsigned npnsz = 0;
 
   ink_release_assert(netvc != NULL);
 
   if (netvc->npnSet && netvc->npnSet->advertiseProtocols(&npn, &npnsz)) {
-    // SSL_select_next_proto chooses the first server-offered protocol that appears in the clients protocol set, ie. the
-    // server selects the protocol. This is a n^2 search, so it's preferable to keep the protocol set short.
+// SSL_select_next_proto chooses the first server-offered protocol that appears in the clients protocol set, ie. the
+// server selects the protocol. This is a n^2 search, so it's preferable to keep the protocol set short.
 
 #if HAVE_SSL_SELECT_NEXT_PROTO
     if (SSL_select_next_proto((unsigned char **)out, outlen, npn, npnsz, in, inlen) == OPENSSL_NPN_NEGOTIATED) {
@@ -1201,7 +1186,8 @@ SSLNetVConnection::select_next_protocol(SSL * ssl, const unsigned char ** out, u
 }
 
 void
-SSLNetVConnection::reenable(NetHandler* nh) {
+SSLNetVConnection::reenable(NetHandler *nh)
+{
   if (this->sslPreAcceptHookState != SSL_HOOKS_DONE) {
     this->sslPreAcceptHookState = SSL_HOOKS_INVOKE;
     this->readReschedule(nh);
@@ -1215,7 +1201,7 @@ SSLNetVConnection::reenable(NetHandler* nh) {
     // here in the reenable.
     if (curHook != NULL) {
       curHook = curHook->next();
-      if (curHook != NULL) { 
+      if (curHook != NULL) {
         // Invoke the hook
         curHook->invoke(TS_SSL_CERT_HOOK, this);
       }
@@ -1229,11 +1215,12 @@ SSLNetVConnection::reenable(NetHandler* nh) {
 
 
 bool
-SSLNetVConnection::sslContextSet(void* ctx) {
+SSLNetVConnection::sslContextSet(void *ctx)
+{
 #if TS_USE_TLS_SNI
   bool zret = true;
   if (ssl)
-    SSL_set_SSL_CTX(ssl, static_cast<SSL_CTX*>(ctx));
+    SSL_set_SSL_CTX(ssl, static_cast<SSL_CTX *>(ctx));
   else
     zret = false;
 #else
@@ -1245,7 +1232,7 @@ SSLNetVConnection::sslContextSet(void* ctx) {
 bool
 SSLNetVConnection::callHooks(TSHttpHookID eventId)
 {
-  // Only dealing with the SNI/CERT hook so far. 
+  // Only dealing with the SNI/CERT hook so far.
   // TS_SSL_SNI_HOOK and TS_SSL_CERT_HOOK are the same value
   ink_assert(eventId == TS_SSL_CERT_HOOK);
 
@@ -1261,8 +1248,7 @@ SSLNetVConnection::callHooks(TSHttpHookID eventId)
     } else {
       curHook = ssl_hooks->get(TS_SSL_CERT_INTERNAL_HOOK);
     }
-  } 
-  else {
+  } else {
     // Not in the right state, or no plugins registered for this hook
     // reenable and continue
     return true;
@@ -1279,5 +1265,3 @@ SSLNetVConnection::callHooks(TSHttpHookID eventId)
   this->sslHandshakeHookState = holdState;
   return reenabled;
 }
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLNextProtocolAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolAccept.cc b/iocore/net/SSLNextProtocolAccept.cc
index 9dce31c..ad347f2 100644
--- a/iocore/net/SSLNextProtocolAccept.cc
+++ b/iocore/net/SSLNextProtocolAccept.cc
@@ -24,10 +24,10 @@
 #include "P_SSLNextProtocolAccept.h"
 
 static void
-send_plugin_event(Continuation * plugin, int event, void * edata)
+send_plugin_event(Continuation *plugin, int event, void *edata)
 {
   if (plugin->mutex) {
-    EThread * thread(this_ethread());
+    EThread *thread(this_ethread());
     MUTEX_TAKE_LOCK(plugin->mutex, thread);
     plugin->handleEvent(event, edata);
     MUTEX_UNTAKE_LOCK(plugin->mutex, thread);
@@ -37,11 +37,11 @@ send_plugin_event(Continuation * plugin, int event, void * edata)
 }
 
 static SSLNetVConnection *
-ssl_netvc_cast(int event, void * edata)
+ssl_netvc_cast(int event, void *edata)
 {
   union {
-    VIO * vio;
-    NetVConnection * vc;
+    VIO *vio;
+    NetVConnection *vc;
   } ptr;
 
   switch (event) {
@@ -63,20 +63,18 @@ ssl_netvc_cast(int event, void * edata)
 // NPN extension. The Continuation that receives the read event *must* have a mutex, but we don't want to take a global
 // lock across the handshake, so we make a trampoline to bounce the event from the SSL acceptor to the ultimate session
 // acceptor.
-struct SSLNextProtocolTrampoline : public Continuation
-{
-  explicit
-  SSLNextProtocolTrampoline(const SSLNextProtocolAccept * npn, ProxyMutex* mutex)
-    : Continuation(mutex), npnParent(npn)
+struct SSLNextProtocolTrampoline : public Continuation {
+  explicit SSLNextProtocolTrampoline(const SSLNextProtocolAccept *npn, ProxyMutex *mutex) : Continuation(mutex), npnParent(npn)
   {
     SET_HANDLER(&SSLNextProtocolTrampoline::ioCompletionEvent);
   }
 
-  int ioCompletionEvent(int event, void * edata)
+  int
+  ioCompletionEvent(int event, void *edata)
   {
-    VIO * vio;
-    Continuation * plugin;
-    SSLNetVConnection * netvc;
+    VIO *vio;
+    Continuation *plugin;
+    SSLNetVConnection *netvc;
 
     vio = static_cast<VIO *>(edata);
     netvc = dynamic_cast<SSLNetVConnection *>(vio->vc_server);
@@ -111,13 +109,13 @@ struct SSLNextProtocolTrampoline : public Continuation
     return EVENT_CONT;
   }
 
-  const SSLNextProtocolAccept * npnParent;
+  const SSLNextProtocolAccept *npnParent;
 };
 
 int
-SSLNextProtocolAccept::mainEvent(int event, void * edata)
+SSLNextProtocolAccept::mainEvent(int event, void *edata)
 {
-  SSLNetVConnection * netvc = ssl_netvc_cast(event, edata);
+  SSLNetVConnection *netvc = ssl_netvc_cast(event, edata);
 
   netvc->sslHandshakeBeginTime = ink_get_hrtime();
   Debug("ssl", "[SSLNextProtocolAccept:mainEvent] event %d netvc %p", event, netvc);
@@ -148,22 +146,19 @@ SSLNextProtocolAccept::accept(NetVConnection *, MIOBuffer *, IOBufferReader *)
 }
 
 bool
-SSLNextProtocolAccept::registerEndpoint(
-    const char * protocol, Continuation * handler)
+SSLNextProtocolAccept::registerEndpoint(const char *protocol, Continuation *handler)
 {
   return this->protoset.registerEndpoint(protocol, handler);
 }
 
 bool
-SSLNextProtocolAccept::unregisterEndpoint(
-    const char * protocol, Continuation * handler)
+SSLNextProtocolAccept::unregisterEndpoint(const char *protocol, Continuation *handler)
 {
   return this->protoset.unregisterEndpoint(protocol, handler);
 }
 
-SSLNextProtocolAccept::SSLNextProtocolAccept(Continuation * ep, bool transparent_passthrough)
-    : SessionAccept(NULL), buffer(new_empty_MIOBuffer()), endpoint(ep),
-      transparent_passthrough(transparent_passthrough)
+SSLNextProtocolAccept::SSLNextProtocolAccept(Continuation *ep, bool transparent_passthrough)
+  : SessionAccept(NULL), buffer(new_empty_MIOBuffer()), endpoint(ep), transparent_passthrough(transparent_passthrough)
 {
   SET_HANDLER(&SSLNextProtocolAccept::mainEvent);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLNextProtocolSet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolSet.cc b/iocore/net/SSLNextProtocolSet.cc
index df0e5a1..751f67a 100644
--- a/iocore/net/SSLNextProtocolSet.cc
+++ b/iocore/net/SSLNextProtocolSet.cc
@@ -34,7 +34,7 @@
 // not say how many bytes the length is. For the record, it's 1.
 
 unsigned char *
-append_protocol(const char * proto, unsigned char * buf)
+append_protocol(const char *proto, unsigned char *buf)
 {
   size_t sz = strlen(proto);
   *buf++ = (unsigned char)sz;
@@ -43,12 +43,10 @@ append_protocol(const char * proto, unsigned char * buf)
 }
 
 static bool
-create_npn_advertisement(
-  const SSLNextProtocolSet::NextProtocolEndpoint::list_type& endpoints,
-  unsigned char ** npn, size_t * len)
+create_npn_advertisement(const SSLNextProtocolSet::NextProtocolEndpoint::list_type &endpoints, unsigned char **npn, size_t *len)
 {
-  const SSLNextProtocolSet::NextProtocolEndpoint * ep;
-  unsigned char * advertised;
+  const SSLNextProtocolSet::NextProtocolEndpoint *ep;
+  unsigned char *advertised;
 
   *npn = NULL;
   *len = 0;
@@ -77,7 +75,7 @@ fail:
 }
 
 bool
-SSLNextProtocolSet::advertiseProtocols(const unsigned char ** out, unsigned * len) const
+SSLNextProtocolSet::advertiseProtocols(const unsigned char **out, unsigned *len) const
 {
   if (npn && npnsz) {
     *out = npn;
@@ -89,7 +87,7 @@ SSLNextProtocolSet::advertiseProtocols(const unsigned char ** out, unsigned * le
 }
 
 bool
-SSLNextProtocolSet::registerEndpoint(const char * proto, Continuation * ep)
+SSLNextProtocolSet::registerEndpoint(const char *proto, Continuation *ep)
 {
   size_t len = strlen(proto);
 
@@ -116,11 +114,9 @@ SSLNextProtocolSet::registerEndpoint(const char * proto, Continuation * ep)
 }
 
 bool
-SSLNextProtocolSet::unregisterEndpoint(const char * proto, Continuation * ep)
+SSLNextProtocolSet::unregisterEndpoint(const char *proto, Continuation *ep)
 {
-
-  for (NextProtocolEndpoint * e = this->endpoints.head;
-        e; e = this->endpoints.next(e)) {
+  for (NextProtocolEndpoint *e = this->endpoints.head; e; e = this->endpoints.next(e)) {
     if (strcmp(proto, e->protocol) == 0 && e->endpoint == ep) {
       // Protocol must be registered only once; no need to remove
       // any more entries.
@@ -133,10 +129,9 @@ SSLNextProtocolSet::unregisterEndpoint(const char * proto, Continuation * ep)
 }
 
 Continuation *
-SSLNextProtocolSet::findEndpoint(
-  const unsigned char * proto, unsigned len) const
+SSLNextProtocolSet::findEndpoint(const unsigned char *proto, unsigned len) const
 {
-  for (const NextProtocolEndpoint * ep = this->endpoints.head; ep != NULL; ep = this->endpoints.next(ep)) {
+  for (const NextProtocolEndpoint *ep = this->endpoints.head; ep != NULL; ep = this->endpoints.next(ep)) {
     size_t sz = strlen(ep->protocol);
     if (sz == len && memcmp(ep->protocol, proto, len) == 0) {
       return ep->endpoint;
@@ -145,8 +140,7 @@ SSLNextProtocolSet::findEndpoint(
   return NULL;
 }
 
-SSLNextProtocolSet::SSLNextProtocolSet()
-  : npn(0), npnsz(0)
+SSLNextProtocolSet::SSLNextProtocolSet() : npn(0), npnsz(0)
 {
 }
 
@@ -154,14 +148,13 @@ SSLNextProtocolSet::~SSLNextProtocolSet()
 {
   ats_free(this->npn);
 
-  for (NextProtocolEndpoint * ep; (ep = this->endpoints.pop());) {
+  for (NextProtocolEndpoint *ep; (ep = this->endpoints.pop());) {
     delete ep;
   }
 }
 
-SSLNextProtocolSet::NextProtocolEndpoint::NextProtocolEndpoint(
-        const char * _proto, Continuation * _ep)
-  : protocol(_proto),  endpoint(_ep)
+SSLNextProtocolSet::NextProtocolEndpoint::NextProtocolEndpoint(const char *_proto, Continuation *_ep)
+  : protocol(_proto), endpoint(_ep)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLSessionCache.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLSessionCache.cc b/iocore/net/SSLSessionCache.cc
index 6fdd3c5..740b14f 100644
--- a/iocore/net/SSLSessionCache.cc
+++ b/iocore/net/SSLSessionCache.cc
@@ -37,30 +37,33 @@
 using ts::detail::RBNode;
 
 /* Session Cache */
-SSLSessionCache::SSLSessionCache()
-  : session_bucket(NULL), nbuckets(SSLConfigParams::session_cache_number_buckets)
+SSLSessionCache::SSLSessionCache() : session_bucket(NULL), nbuckets(SSLConfigParams::session_cache_number_buckets)
 {
-  Debug("ssl.session_cache", "Created new ssl session cache %p with %zu buckets each with size max size %zu",
-    this, nbuckets, SSLConfigParams::session_cache_max_bucket_size);
+  Debug("ssl.session_cache", "Created new ssl session cache %p with %zu buckets each with size max size %zu", this, nbuckets,
+        SSLConfigParams::session_cache_max_bucket_size);
 
   session_bucket = new SSLSessionBucket[nbuckets];
 }
 
-SSLSessionCache::~SSLSessionCache() {
-  delete []session_bucket;
+SSLSessionCache::~SSLSessionCache()
+{
+  delete[] session_bucket;
 }
 
-bool SSLSessionCache::getSession(const SSLSessionID &sid, SSL_SESSION **sess) const {
+bool
+SSLSessionCache::getSession(const SSLSessionID &sid, SSL_SESSION **sess) const
+{
   uint64_t hash = sid.hash();
   uint64_t target_bucket = hash % nbuckets;
   SSLSessionBucket *bucket = &session_bucket[target_bucket];
   bool ret = false;
 
   if (is_debug_tag_set("ssl.session_cache")) {
-     char buf[sid.len * 2 + 1];
-     sid.toString(buf, sizeof(buf));
-     Debug("ssl.session_cache.get", "SessionCache looking in bucket %" PRId64 " (%p) for session '%s' (hash: %" PRIX64 ").", target_bucket, bucket, buf, hash);
-   }
+    char buf[sid.len * 2 + 1];
+    sid.toString(buf, sizeof(buf));
+    Debug("ssl.session_cache.get", "SessionCache looking in bucket %" PRId64 " (%p) for session '%s' (hash: %" PRIX64 ").",
+          target_bucket, bucket, buf, hash);
+  }
 
   ret = bucket->getSession(sid, sess);
 
@@ -72,41 +75,49 @@ bool SSLSessionCache::getSession(const SSLSessionID &sid, SSL_SESSION **sess) co
   return ret;
 }
 
-void SSLSessionCache::removeSession(const SSLSessionID &sid) {
+void
+SSLSessionCache::removeSession(const SSLSessionID &sid)
+{
   uint64_t hash = sid.hash();
   uint64_t target_bucket = hash % nbuckets;
   SSLSessionBucket *bucket = &session_bucket[target_bucket];
 
   if (is_debug_tag_set("ssl.session_cache")) {
-     char buf[sid.len * 2 + 1];
-     sid.toString(buf, sizeof(buf));
-     Debug("ssl.session_cache.remove", "SessionCache using bucket %" PRId64 " (%p): Removing session '%s' (hash: %" PRIX64 ").", target_bucket, bucket, buf, hash);
-   }
+    char buf[sid.len * 2 + 1];
+    sid.toString(buf, sizeof(buf));
+    Debug("ssl.session_cache.remove", "SessionCache using bucket %" PRId64 " (%p): Removing session '%s' (hash: %" PRIX64 ").",
+          target_bucket, bucket, buf, hash);
+  }
 
   SSL_INCREMENT_DYN_STAT(ssl_session_cache_eviction);
   bucket->removeSession(sid);
 }
 
-void SSLSessionCache::insertSession(const SSLSessionID &sid, SSL_SESSION *sess) {
+void
+SSLSessionCache::insertSession(const SSLSessionID &sid, SSL_SESSION *sess)
+{
   uint64_t hash = sid.hash();
   uint64_t target_bucket = hash % nbuckets;
   SSLSessionBucket *bucket = &session_bucket[target_bucket];
 
   if (is_debug_tag_set("ssl.session_cache")) {
-     char buf[sid.len * 2 + 1];
-     sid.toString(buf, sizeof(buf));
-     Debug("ssl.session_cache.insert", "SessionCache using bucket %" PRId64 " (%p): Inserting session '%s' (hash: %" PRIX64 ").", target_bucket, bucket, buf, hash);
-   }
+    char buf[sid.len * 2 + 1];
+    sid.toString(buf, sizeof(buf));
+    Debug("ssl.session_cache.insert", "SessionCache using bucket %" PRId64 " (%p): Inserting session '%s' (hash: %" PRIX64 ").",
+          target_bucket, bucket, buf, hash);
+  }
 
   bucket->insertSession(sid, sess);
 }
 
-void SSLSessionBucket::insertSession(const SSLSessionID &id, SSL_SESSION *sess) {
+void
+SSLSessionBucket::insertSession(const SSLSessionID &id, SSL_SESSION *sess)
+{
   size_t len = i2d_SSL_SESSION(sess, NULL); // make sure we're not going to need more than SSL_MAX_SESSION_SIZE bytes
   /* do not cache a session that's too big. */
-  if (len > (size_t) SSL_MAX_SESSION_SIZE) {
-      Debug("ssl.session_cache", "Unable to save SSL session because size of %zd exceeds the max of %d", len, SSL_MAX_SESSION_SIZE);
-      return;
+  if (len > (size_t)SSL_MAX_SESSION_SIZE) {
+    Debug("ssl.session_cache", "Unable to save SSL session because size of %zd exceeds the max of %d", len, SSL_MAX_SESSION_SIZE);
+    return;
   }
 
   if (is_debug_tag_set("ssl.session_cache")) {
@@ -134,7 +145,7 @@ void SSLSessionBucket::insertSession(const SSLSessionID &id, SSL_SESSION *sess)
 
   PRINT_BUCKET("insertSession before")
   if (queue.size >= static_cast<int>(SSLConfigParams::session_cache_max_bucket_size)) {
-      removeOldestSession();
+    removeOldestSession();
   }
 
   /* do the actual insert */
@@ -143,23 +154,24 @@ void SSLSessionBucket::insertSession(const SSLSessionID &id, SSL_SESSION *sess)
   PRINT_BUCKET("insertSession after")
 }
 
-bool SSLSessionBucket::getSession(const SSLSessionID &id,
-                                  SSL_SESSION **sess) {
+bool
+SSLSessionBucket::getSession(const SSLSessionID &id, SSL_SESSION **sess)
+{
   char buf[id.len * 2 + 1];
   buf[0] = '\0'; // just to be safe.
   if (is_debug_tag_set("ssl.session_cache")) {
-   id.toString(buf, sizeof(buf));
+    id.toString(buf, sizeof(buf));
   }
 
   Debug("ssl.session_cache", "Looking for session with id '%s' in bucket %p", buf, this);
 
   MUTEX_TRY_LOCK(lock, mutex, this_ethread());
   if (!lock.is_locked()) {
-   SSL_INCREMENT_DYN_STAT(ssl_session_cache_lock_contention);
-   if (SSLConfigParams::session_cache_skip_on_lock_contention)
-     return false;
+    SSL_INCREMENT_DYN_STAT(ssl_session_cache_lock_contention);
+    if (SSLConfigParams::session_cache_skip_on_lock_contention)
+      return false;
 
-   lock.acquire(this_ethread());
+    lock.acquire(this_ethread());
   }
 
   PRINT_BUCKET("getSession")
@@ -167,12 +179,11 @@ bool SSLSessionBucket::getSession(const SSLSessionID &id,
   // We work backwards because that's the most likely place we'll find our session...
   SSLSession *node = queue.tail;
   while (node) {
-    if (node->session_id == id)
-    {
-       const unsigned char *loc = reinterpret_cast<const unsigned char *>(node->asn1_data->data());
-       *sess = d2i_SSL_SESSION(NULL, &loc, node->len_asn1_data);
+    if (node->session_id == id) {
+      const unsigned char *loc = reinterpret_cast<const unsigned char *>(node->asn1_data->data());
+      *sess = d2i_SSL_SESSION(NULL, &loc, node->len_asn1_data);
 
-       return true;
+      return true;
     }
     node = node->link.prev;
   }
@@ -181,10 +192,11 @@ bool SSLSessionBucket::getSession(const SSLSessionID &id,
   return false;
 }
 
-void inline SSLSessionBucket::print(const char *ref_str) const {
+void inline SSLSessionBucket::print(const char *ref_str) const
+{
   /* NOTE: This method assumes you're already holding the bucket lock */
   if (!is_debug_tag_set("ssl.session_cache.bucket")) {
-     return;
+    return;
   }
 
   fprintf(stderr, "-------------- BUCKET %p (%s) ----------------\n", this, ref_str);
@@ -192,7 +204,7 @@ void inline SSLSessionBucket::print(const char *ref_str) const {
   fprintf(stderr, "Queue: \n");
 
   SSLSession *node = queue.head;
-  while(node) {
+  while (node) {
     char s_buf[2 * node->session_id.len + 1];
     node->session_id.toString(s_buf, sizeof(s_buf));
     fprintf(stderr, "  %s\n", s_buf);
@@ -200,8 +212,7 @@ void inline SSLSessionBucket::print(const char *ref_str) const {
   }
 }
 
-void inline
-SSLSessionBucket::removeOldestSession()
+void inline SSLSessionBucket::removeOldestSession()
 {
   // Caller must hold the bucket lock.
   ink_assert(this_ethread() == mutex->thread_holding);
@@ -212,19 +223,21 @@ SSLSessionBucket::removeOldestSession()
     if (is_debug_tag_set("ssl.session_cache")) {
       char buf[old_head->session_id.len * 2 + 1];
       old_head->session_id.toString(buf, sizeof(buf));
-      Debug("ssl.session_cache", "Removing session '%s' from bucket %p because the bucket has size %d and max %zd", buf, this, (queue.size + 1), SSLConfigParams::session_cache_max_bucket_size);
+      Debug("ssl.session_cache", "Removing session '%s' from bucket %p because the bucket has size %d and max %zd", buf, this,
+            (queue.size + 1), SSLConfigParams::session_cache_max_bucket_size);
     }
     delete old_head;
   }
   PRINT_BUCKET("removeOldestSession after")
 }
 
-void SSLSessionBucket::removeSession(const SSLSessionID &id) {
+void
+SSLSessionBucket::removeSession(const SSLSessionID &id)
+{
   MUTEX_LOCK(lock, mutex, this_ethread()); // We can't bail on contention here because this session MUST be removed.
   SSLSession *node = queue.head;
   while (node) {
-    if (node->session_id == id)
-    {
+    if (node->session_id == id) {
       queue.remove(node);
       delete node;
       return;
@@ -240,5 +253,3 @@ SSLSessionBucket::SSLSessionBucket() : mutex(new_ProxyMutex())
 SSLSessionBucket::~SSLSessionBucket()
 {
 }
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/iocore/net/SSLSessionCache.h
----------------------------------------------------------------------
diff --git a/iocore/net/SSLSessionCache.h b/iocore/net/SSLSessionCache.h
index a0e6f30..15a0a3f 100644
--- a/iocore/net/SSLSessionCache.h
+++ b/iocore/net/SSLSessionCache.h
@@ -39,26 +39,30 @@ struct SSLSessionID {
   char bytes[SSL_MAX_SSL_SESSION_ID_LENGTH];
   size_t len;
 
-  SSLSessionID(const unsigned char *s, size_t l) : len(l) {
+  SSLSessionID(const unsigned char *s, size_t l) : len(l)
+  {
     ink_release_assert(l <= sizeof(bytes));
     memcpy(bytes, s, l);
   }
 
-  SSLSessionID(const SSLSessionID& other) {
+  SSLSessionID(const SSLSessionID &other)
+  {
     if (other.len)
       memcpy(bytes, other.bytes, other.len);
 
     len = other.len;
   }
 
- bool operator<(const SSLSessionID &other) const {
-   if (len != other.len)
-     return len < other.len;
+  bool operator<(const SSLSessionID &other) const
+  {
+    if (len != other.len)
+      return len < other.len;
 
-   return (memcmp(bytes, other.bytes, len) < 0);
- }
+    return (memcmp(bytes, other.bytes, len) < 0);
+  }
 
-  SSLSessionID& operator=(const SSLSessionID& other) {
+  SSLSessionID &operator=(const SSLSessionID &other)
+  {
     if (other.len)
       memcpy(bytes, other.bytes, other.len);
 
@@ -66,15 +70,18 @@ struct SSLSessionID {
     return *this;
   }
 
-  bool operator==(const SSLSessionID &other) const {
-   if (len != other.len)
-       return false;
+  bool operator==(const SSLSessionID &other) const
+  {
+    if (len != other.len)
+      return false;
 
-   // memcmp returns 0 on equal
-   return (memcmp(bytes, other.bytes, len) == 0);
+    // memcmp returns 0 on equal
+    return (memcmp(bytes, other.bytes, len) == 0);
   }
 
-  const char *toString(char *buf, size_t buflen) const {
+  const char *
+  toString(char *buf, size_t buflen) const
+  {
     char *cur_pos = buf;
     for (size_t i = 0; i < len && buflen > 0; ++i) {
       if (buflen > 2) { // we have enough space for 3 bytes, 2 hex and 1 null terminator
@@ -89,7 +96,9 @@ struct SSLSessionID {
     return buf;
   }
 
-  uint64_t hash() const {
+  uint64_t
+  hash() const
+  {
     // because the session ids should be uniformly random let's just use the upper 64 bits as the hash.
     if (len >= sizeof(uint64_t))
       return *reinterpret_cast<uint64_t *>(const_cast<char *>(bytes));
@@ -98,23 +107,25 @@ struct SSLSessionID {
     else
       return 0;
   }
-
 };
 
-class SSLSession {
+class SSLSession
+{
 public:
   SSLSessionID session_id;
   Ptr<IOBufferData> asn1_data; /* this is the ASN1 representation of the SSL_CTX */
   size_t len_asn1_data;
 
   SSLSession(const SSLSessionID &id, Ptr<IOBufferData> ssl_asn1_data, size_t len_asn1)
- : session_id(id), asn1_data(ssl_asn1_data), len_asn1_data(len_asn1)
-  { }
+    : session_id(id), asn1_data(ssl_asn1_data), len_asn1_data(len_asn1)
+  {
+  }
 
-	LINK(SSLSession, link);
+  LINK(SSLSession, link);
 };
 
-class SSLSessionBucket {
+class SSLSessionBucket
+{
 public:
   SSLSessionBucket();
   ~SSLSessionBucket();
@@ -131,17 +142,18 @@ private:
   CountQueue<SSLSession> queue;
 };
 
-class SSLSessionCache {
+class SSLSessionCache
+{
 public:
-	bool getSession(const SSLSessionID &sid, SSL_SESSION **sess) const;
-	void insertSession(const SSLSessionID &sid, SSL_SESSION *sess);
-	void removeSession(const SSLSessionID &sid);
+  bool getSession(const SSLSessionID &sid, SSL_SESSION **sess) const;
+  void insertSession(const SSLSessionID &sid, SSL_SESSION *sess);
+  void removeSession(const SSLSessionID &sid);
   SSLSessionCache();
   ~SSLSessionCache();
 
- private:
-    SSLSessionBucket *session_bucket;
-    size_t nbuckets;
+private:
+  SSLSessionBucket *session_bucket;
+  size_t nbuckets;
 };
 
 #endif /* __SSLSESSIONCACHE_H__ */


[21/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/AsyncHttpFetch.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncHttpFetch.cc b/lib/atscppapi/src/AsyncHttpFetch.cc
index af920b0..0ad46ad 100644
--- a/lib/atscppapi/src/AsyncHttpFetch.cc
+++ b/lib/atscppapi/src/AsyncHttpFetch.cc
@@ -54,16 +54,18 @@ struct atscppapi::AsyncHttpFetchState : noncopyable {
 
   AsyncHttpFetchState(const string &url_str, HttpMethod http_method, string request_body,
                       AsyncHttpFetch::StreamingFlag streaming_flag)
-    : request_body_(request_body), result_(AsyncHttpFetch::RESULT_FAILURE), body_(NULL), body_size_(0),
-      hdr_buf_(NULL), hdr_loc_(NULL), streaming_flag_(streaming_flag), fetch_sm_(NULL) {
-    request_.reset(new Request(url_str, http_method, (streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) ?
-                               HTTP_VERSION_1_0 : HTTP_VERSION_1_1));
+    : request_body_(request_body), result_(AsyncHttpFetch::RESULT_FAILURE), body_(NULL), body_size_(0), hdr_buf_(NULL),
+      hdr_loc_(NULL), streaming_flag_(streaming_flag), fetch_sm_(NULL)
+  {
+    request_.reset(new Request(url_str, http_method,
+                               (streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) ? HTTP_VERSION_1_0 : HTTP_VERSION_1_1));
     if (streaming_flag_ == AsyncHttpFetch::STREAMING_ENABLED) {
       body_ = body_buffer_;
     }
   }
 
-  ~AsyncHttpFetchState() {
+  ~AsyncHttpFetchState()
+  {
     if (hdr_loc_) {
       TSMLoc null_parent_loc = NULL;
       TSHandleMLocRelease(hdr_buf_, null_parent_loc, hdr_loc_);
@@ -77,12 +79,14 @@ struct atscppapi::AsyncHttpFetchState : noncopyable {
   }
 };
 
-namespace {
-
+namespace
+{
 const unsigned int LOCAL_IP_ADDRESS = 0x0100007f;
 const int LOCAL_PORT = 8080;
 
-static int handleFetchEvents(TSCont cont, TSEvent event, void *edata) {
+static int
+handleFetchEvents(TSCont cont, TSEvent event, void *edata)
+{
   LOG_DEBUG("Received fetch event = %d, edata = %p", event, edata);
   AsyncHttpFetch *fetch_provider = static_cast<AsyncHttpFetch *>(TSContDataGet(cont));
   AsyncHttpFetchState *state = utils::internal::getAsyncHttpFetchState(*fetch_provider);
@@ -105,72 +109,74 @@ static int handleFetchEvents(TSCont cont, TSEvent event, void *edata) {
           utils::internal::initResponse(state->response_, state->hdr_buf_, state->hdr_loc_);
           LOG_DEBUG("Fetch result had a status code of %d with a body length of %ld", status, state->body_size_);
         } else {
-          LOG_ERROR("Unable to parse response; Request URL [%s]; transaction %p",
-                    state->request_->getUrl().getUrlString().c_str(), txn);
+          LOG_ERROR("Unable to parse response; Request URL [%s]; transaction %p", state->request_->getUrl().getUrlString().c_str(),
+                    txn);
           event = static_cast<TSEvent>(AsyncHttpFetch::RESULT_FAILURE);
         }
         TSHttpParserDestroy(parser);
-      }
-      else {
+      } else {
         LOG_ERROR("Successful fetch did not result in any content. Assuming failure");
         event = static_cast<TSEvent>(AsyncHttpFetch::RESULT_FAILURE);
       }
       state->result_ = static_cast<AsyncHttpFetch::Result>(event);
     }
-  }
-  else {
+  } else {
     LOG_DEBUG("Handling streaming event %d", event);
     if (event == static_cast<TSEvent>(TS_FETCH_EVENT_EXT_HEAD_DONE)) {
       utils::internal::initResponse(state->response_, TSFetchRespHdrMBufGet(state->fetch_sm_),
                                     TSFetchRespHdrMLocGet(state->fetch_sm_));
       LOG_DEBUG("Response header initialized");
       state->result_ = AsyncHttpFetch::RESULT_HEADER_COMPLETE;
-    }
-    else {
+    } else {
       state->body_size_ = TSFetchReadData(state->fetch_sm_, state->body_buffer_, sizeof(state->body_buffer_));
       LOG_DEBUG("Read %zu bytes", state->body_size_);
-      state->result_ = (event == static_cast<TSEvent>(TS_FETCH_EVENT_EXT_BODY_READY)) ?
-        AsyncHttpFetch::RESULT_PARTIAL_BODY : AsyncHttpFetch::RESULT_BODY_COMPLETE;
+      state->result_ = (event == static_cast<TSEvent>(TS_FETCH_EVENT_EXT_BODY_READY)) ? AsyncHttpFetch::RESULT_PARTIAL_BODY :
+                                                                                        AsyncHttpFetch::RESULT_BODY_COMPLETE;
     }
   }
   if (!state->dispatch_controller_->dispatch()) {
     LOG_DEBUG("Unable to dispatch result from AsyncFetch because promise has died.");
   }
 
-  if ((state->streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) ||
-      (state->result_ == AsyncHttpFetch::RESULT_BODY_COMPLETE)) {
+  if ((state->streaming_flag_ == AsyncHttpFetch::STREAMING_DISABLED) || (state->result_ == AsyncHttpFetch::RESULT_BODY_COMPLETE)) {
     LOG_DEBUG("Shutting down");
     utils::internal::deleteAsyncHttpFetch(fetch_provider); // we must always cleans up when we're done.
     TSContDestroy(cont);
   }
   return 0;
 }
-
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, const string &request_body) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, const string &request_body)
+{
   init(url_str, HTTP_METHOD_POST, request_body, STREAMING_DISABLED);
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, HttpMethod http_method) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, HttpMethod http_method)
+{
   init(url_str, http_method, "", STREAMING_DISABLED);
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, const string &request_body) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, const string &request_body)
+{
   init(url_str, HTTP_METHOD_POST, request_body, streaming_flag);
 }
 
-AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, HttpMethod http_method) {
+AsyncHttpFetch::AsyncHttpFetch(const string &url_str, StreamingFlag streaming_flag, HttpMethod http_method)
+{
   init(url_str, http_method, "", streaming_flag);
 }
 
-void AsyncHttpFetch::init(const string &url_str, HttpMethod http_method, const string &request_body,
-                          StreamingFlag streaming_flag) {
+void
+AsyncHttpFetch::init(const string &url_str, HttpMethod http_method, const string &request_body, StreamingFlag streaming_flag)
+{
   LOG_DEBUG("Created new AsyncHttpFetch object %p", this);
   state_ = new AsyncHttpFetchState(url_str, http_method, request_body, streaming_flag);
 }
 
-void AsyncHttpFetch::run() {
+void
+AsyncHttpFetch::run()
+{
   state_->dispatch_controller_ = getDispatchController(); // keep a copy in state so that cont handler can use it
 
   TSCont fetchCont = TSContCreate(handleFetchEvents, TSMutexCreate());
@@ -210,21 +216,18 @@ void AsyncHttpFetch::run() {
     request_str += state_->request_body_;
 
     LOG_DEBUG("Issing (non-streaming) TSFetchUrl with request\n[%s]", request_str.c_str());
-    TSFetchUrl(request_str.c_str(), request_str.size(), reinterpret_cast<struct sockaddr const *>(&addr), fetchCont,
-               AFTER_BODY, event_ids);
-  }
-  else {
-    state_->fetch_sm_ = TSFetchCreate(fetchCont, HTTP_METHOD_STRINGS[state_->request_->getMethod()].c_str(),
-                                      state_->request_->getUrl().getUrlString().c_str(),
-                                      HTTP_VERSION_STRINGS[state_->request_->getVersion()].c_str(),
-                                      reinterpret_cast<struct sockaddr const *>(&addr),
-                                      TS_FETCH_FLAGS_STREAM | TS_FETCH_FLAGS_DECHUNK);
+    TSFetchUrl(request_str.c_str(), request_str.size(), reinterpret_cast<struct sockaddr const *>(&addr), fetchCont, AFTER_BODY,
+               event_ids);
+  } else {
+    state_->fetch_sm_ =
+      TSFetchCreate(fetchCont, HTTP_METHOD_STRINGS[state_->request_->getMethod()].c_str(),
+                    state_->request_->getUrl().getUrlString().c_str(), HTTP_VERSION_STRINGS[state_->request_->getVersion()].c_str(),
+                    reinterpret_cast<struct sockaddr const *>(&addr), TS_FETCH_FLAGS_STREAM | TS_FETCH_FLAGS_DECHUNK);
     string header_value;
     for (Headers::iterator iter = headers.begin(), end = headers.end(); iter != end; ++iter) {
       HeaderFieldName header_name = (*iter).name();
       header_value = (*iter).values();
-      TSFetchHeaderAdd(state_->fetch_sm_, header_name.c_str(), header_name.length(), header_value.data(),
-                       header_value.size());
+      TSFetchHeaderAdd(state_->fetch_sm_, header_name.c_str(), header_name.length(), header_value.data(), header_value.size());
     }
     LOG_DEBUG("Launching streaming fetch");
     TSFetchLaunch(state_->fetch_sm_);
@@ -235,31 +238,44 @@ void AsyncHttpFetch::run() {
   }
 }
 
-Headers &AsyncHttpFetch::getRequestHeaders() {
+Headers &
+AsyncHttpFetch::getRequestHeaders()
+{
   return state_->request_->getHeaders();
 }
 
-AsyncHttpFetch::Result AsyncHttpFetch::getResult() const {
+AsyncHttpFetch::Result
+AsyncHttpFetch::getResult() const
+{
   return state_->result_;
 }
 
-const Url &AsyncHttpFetch::getRequestUrl() const {
+const Url &
+AsyncHttpFetch::getRequestUrl() const
+{
   return state_->request_->getUrl();
 }
 
-const string &AsyncHttpFetch::getRequestBody() const {
+const string &
+AsyncHttpFetch::getRequestBody() const
+{
   return state_->request_body_;
 }
 
-const Response &AsyncHttpFetch::getResponse() const {
+const Response &
+AsyncHttpFetch::getResponse() const
+{
   return state_->response_;
 }
 
-void AsyncHttpFetch::getResponseBody(const void *&body, size_t &body_size) const {
+void
+AsyncHttpFetch::getResponseBody(const void *&body, size_t &body_size) const
+{
   body = state_->body_;
   body_size = state_->body_size_;
 }
 
-AsyncHttpFetch::~AsyncHttpFetch() {
+AsyncHttpFetch::~AsyncHttpFetch()
+{
   delete state_;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/AsyncTimer.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncTimer.cc b/lib/atscppapi/src/AsyncTimer.cc
index 4604375..baf7c67 100644
--- a/lib/atscppapi/src/AsyncTimer.cc
+++ b/lib/atscppapi/src/AsyncTimer.cc
@@ -35,21 +35,24 @@ struct atscppapi::AsyncTimerState {
   AsyncTimer *timer_;
   shared_ptr<AsyncDispatchControllerBase> dispatch_controller_;
   AsyncTimerState(AsyncTimer::Type type, int period_in_ms, int initial_period_in_ms, AsyncTimer *timer)
-    : type_(type), period_in_ms_(period_in_ms), initial_period_in_ms_(initial_period_in_ms),
-      initial_timer_action_(NULL), periodic_timer_action_(NULL), timer_(timer) { }
+    : type_(type), period_in_ms_(period_in_ms), initial_period_in_ms_(initial_period_in_ms), initial_timer_action_(NULL),
+      periodic_timer_action_(NULL), timer_(timer)
+  {
+  }
 };
 
-namespace {
-
-int handleTimerEvent(TSCont cont, TSEvent event, void *edata) {
+namespace
+{
+int
+handleTimerEvent(TSCont cont, TSEvent event, void *edata)
+{
   AsyncTimerState *state = static_cast<AsyncTimerState *>(TSContDataGet(cont));
   if (state->initial_timer_action_) {
     LOG_DEBUG("Received initial timer event.");
     state->initial_timer_action_ = NULL; // mark it so that it won't be canceled later on
     if (state->type_ == AsyncTimer::TYPE_PERIODIC) {
       LOG_DEBUG("Scheduling periodic event now");
-      state->periodic_timer_action_ = TSContScheduleEvery(state->cont_, state->period_in_ms_,
-                                                          TS_THREAD_POOL_DEFAULT);
+      state->periodic_timer_action_ = TSContScheduleEvery(state->cont_, state->period_in_ms_, TS_THREAD_POOL_DEFAULT);
     }
   }
   if (!state->dispatch_controller_->dispatch()) {
@@ -58,39 +61,39 @@ int handleTimerEvent(TSCont cont, TSEvent event, void *edata) {
   }
   return 0;
 }
-
 }
 
-AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms) {
+AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms)
+{
   state_ = new AsyncTimerState(type, period_in_ms, initial_period_in_ms, this);
   state_->cont_ = TSContCreate(handleTimerEvent, TSMutexCreate());
   TSContDataSet(state_->cont_, static_cast<void *>(state_));
 }
 
-void AsyncTimer::run() {
+void
+AsyncTimer::run()
+{
   state_->dispatch_controller_ = getDispatchController(); // keep a copy in state so that cont handler can use it
   int one_off_timeout_in_ms = 0;
   int regular_timeout_in_ms = 0;
   if (state_->type_ == AsyncTimer::TYPE_ONE_OFF) {
     one_off_timeout_in_ms = state_->period_in_ms_;
-  }
-  else {
+  } else {
     one_off_timeout_in_ms = state_->initial_period_in_ms_;
     regular_timeout_in_ms = state_->period_in_ms_;
   }
   if (one_off_timeout_in_ms) {
     LOG_DEBUG("Scheduling initial/one-off event");
-    state_->initial_timer_action_ = TSContSchedule(state_->cont_, one_off_timeout_in_ms,
-                                                   TS_THREAD_POOL_DEFAULT);
-  }
-  else if (regular_timeout_in_ms) {
+    state_->initial_timer_action_ = TSContSchedule(state_->cont_, one_off_timeout_in_ms, TS_THREAD_POOL_DEFAULT);
+  } else if (regular_timeout_in_ms) {
     LOG_DEBUG("Scheduling regular timer events");
-    state_->periodic_timer_action_ = TSContScheduleEvery(state_->cont_, regular_timeout_in_ms,
-                                                         TS_THREAD_POOL_DEFAULT);
+    state_->periodic_timer_action_ = TSContScheduleEvery(state_->cont_, regular_timeout_in_ms, TS_THREAD_POOL_DEFAULT);
   }
 }
 
-void AsyncTimer::cancel() {
+void
+AsyncTimer::cancel()
+{
   if (!state_->cont_) {
     LOG_DEBUG("Already canceled");
     return;
@@ -109,7 +112,8 @@ void AsyncTimer::cancel() {
   state_->cont_ = NULL;
 }
 
-AsyncTimer::~AsyncTimer() {
+AsyncTimer::~AsyncTimer()
+{
   cancel();
   delete state_;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/CaseInsensitiveStringComparator.cc b/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
index e30ce96..34c7eac 100644
--- a/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
+++ b/lib/atscppapi/src/CaseInsensitiveStringComparator.cc
@@ -22,19 +22,23 @@
 
 #include "atscppapi/CaseInsensitiveStringComparator.h"
 
-namespace {
-  static char NORMALIZED_CHARACTERS[256];
-  static volatile bool normalizer_initialized(false);
+namespace
+{
+static char NORMALIZED_CHARACTERS[256];
+static volatile bool normalizer_initialized(false);
 }
 
 using atscppapi::CaseInsensitiveStringComparator;
 using std::string;
 
-bool CaseInsensitiveStringComparator::operator()(const string &lhs, const string &rhs) const {
+bool CaseInsensitiveStringComparator::operator()(const string &lhs, const string &rhs) const
+{
   return (compare(lhs, rhs) < 0);
 }
 
-int CaseInsensitiveStringComparator::compare(const string &lhs, const string &rhs) const {
+int
+CaseInsensitiveStringComparator::compare(const string &lhs, const string &rhs) const
+{
   if (!normalizer_initialized) {
     // this initialization is safe to execute in concurrent threads - hence no locking
     for (int i = 0; i < 256; ++i) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/ClientRequest.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/ClientRequest.cc b/lib/atscppapi/src/ClientRequest.cc
index 32d7306..8df7964 100644
--- a/lib/atscppapi/src/ClientRequest.cc
+++ b/lib/atscppapi/src/ClientRequest.cc
@@ -31,31 +31,34 @@ using namespace atscppapi;
 /**
  * @private
  */
-struct atscppapi::ClientRequestState: noncopyable {
+struct atscppapi::ClientRequestState : noncopyable {
   TSHttpTxn txn_;
   TSMBuffer pristine_hdr_buf_;
   TSMLoc pristine_url_loc_;
   Url pristine_url_;
-  ClientRequestState(TSHttpTxn txn) : txn_(txn), pristine_hdr_buf_(NULL), pristine_url_loc_(NULL) { }
+  ClientRequestState(TSHttpTxn txn) : txn_(txn), pristine_hdr_buf_(NULL), pristine_url_loc_(NULL) {}
 };
 
-atscppapi::ClientRequest::ClientRequest(void *ats_txn_handle, void *hdr_buf, void *hdr_loc) :
-    Request(hdr_buf, hdr_loc) {
+atscppapi::ClientRequest::ClientRequest(void *ats_txn_handle, void *hdr_buf, void *hdr_loc) : Request(hdr_buf, hdr_loc)
+{
   state_ = new ClientRequestState(static_cast<TSHttpTxn>(ats_txn_handle));
 }
 
-atscppapi::ClientRequest::~ClientRequest() {
+atscppapi::ClientRequest::~ClientRequest()
+{
   if (state_->pristine_url_loc_ && state_->pristine_hdr_buf_) {
     TSMLoc null_parent_loc = NULL;
-    LOG_DEBUG("Releasing pristine url loc for transaction %p; hdr_buf %p, url_loc %p", state_->txn_,
-              state_->pristine_hdr_buf_, state_->pristine_url_loc_);
+    LOG_DEBUG("Releasing pristine url loc for transaction %p; hdr_buf %p, url_loc %p", state_->txn_, state_->pristine_hdr_buf_,
+              state_->pristine_url_loc_);
     TSHandleMLocRelease(state_->pristine_hdr_buf_, null_parent_loc, state_->pristine_url_loc_);
   }
 
   delete state_;
 }
 
-const Url &atscppapi::ClientRequest::getPristineUrl() const {
+const Url &
+atscppapi::ClientRequest::getPristineUrl() const
+{
   if (!state_->pristine_url_loc_) {
     TSHttpTxnPristineUrlGet(state_->txn_, &state_->pristine_hdr_buf_, &state_->pristine_url_loc_);
 
@@ -63,8 +66,8 @@ const Url &atscppapi::ClientRequest::getPristineUrl() const {
       state_->pristine_url_.init(state_->pristine_hdr_buf_, state_->pristine_url_loc_);
       LOG_DEBUG("Pristine URL initialized");
     } else {
-      LOG_ERROR("Failed to get pristine URL for transaction %p; hdr_buf %p, url_loc %p", state_->txn_,
-                state_->pristine_hdr_buf_, state_->pristine_url_loc_);
+      LOG_ERROR("Failed to get pristine URL for transaction %p; hdr_buf %p, url_loc %p", state_->txn_, state_->pristine_hdr_buf_,
+                state_->pristine_url_loc_);
     }
   } else {
     LOG_DEBUG("Pristine URL already initialized");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/GlobalPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/GlobalPlugin.cc b/lib/atscppapi/src/GlobalPlugin.cc
index b2d8581..467e4e8 100644
--- a/lib/atscppapi/src/GlobalPlugin.cc
+++ b/lib/atscppapi/src/GlobalPlugin.cc
@@ -38,17 +38,20 @@ struct atscppapi::GlobalPluginState : noncopyable {
   bool ignore_internal_transactions_;
 
   GlobalPluginState(GlobalPlugin *global_plugin, bool ignore_internal_transactions)
-    : global_plugin_(global_plugin), ignore_internal_transactions_(ignore_internal_transactions) { }
+    : global_plugin_(global_plugin), ignore_internal_transactions_(ignore_internal_transactions)
+  {
+  }
 };
 
-namespace {
-
-static int handleGlobalPluginEvents(TSCont cont, TSEvent event, void *edata) {
+namespace
+{
+static int
+handleGlobalPluginEvents(TSCont cont, TSEvent event, void *edata)
+{
   TSHttpTxn txn = static_cast<TSHttpTxn>(edata);
   GlobalPluginState *state = static_cast<GlobalPluginState *>(TSContDataGet(cont));
   if (state->ignore_internal_transactions_ && (TSHttpIsInternalRequest(txn) == TS_SUCCESS)) {
-    LOG_DEBUG("Ignoring event %d on internal transaction %p for global plugin %p", event, txn,
-              state->global_plugin_);
+    LOG_DEBUG("Ignoring event %d on internal transaction %p for global plugin %p", event, txn, state->global_plugin_);
     TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
   } else {
     LOG_DEBUG("Invoking global plugin %p for event %d on transaction %p", state->global_plugin_, event, txn);
@@ -59,7 +62,8 @@ static int handleGlobalPluginEvents(TSCont cont, TSEvent event, void *edata) {
 
 } /* anonymous namespace */
 
-GlobalPlugin::GlobalPlugin(bool ignore_internal_transactions) {
+GlobalPlugin::GlobalPlugin(bool ignore_internal_transactions)
+{
   utils::internal::initTransactionManagement();
   state_ = new GlobalPluginState(this, ignore_internal_transactions);
   TSMutex mutex = NULL;
@@ -67,12 +71,15 @@ GlobalPlugin::GlobalPlugin(bool ignore_internal_transactions) {
   TSContDataSet(state_->cont_, static_cast<void *>(state_));
 }
 
-GlobalPlugin::~GlobalPlugin() {
+GlobalPlugin::~GlobalPlugin()
+{
   TSContDestroy(state_->cont_);
   delete state_;
 }
 
-void GlobalPlugin::registerHook(Plugin::HookType hook_type) {
+void
+GlobalPlugin::registerHook(Plugin::HookType hook_type)
+{
   TSHttpHookID hook_id = utils::internal::convertInternalHookToTsHook(hook_type);
   TSHttpHookAdd(hook_id, state_->cont_);
   LOG_DEBUG("Registered global plugin %p for hook %s", this, HOOK_TYPE_STRINGS[hook_type].c_str());

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/GzipDeflateTransformation.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/GzipDeflateTransformation.cc b/lib/atscppapi/src/GzipDeflateTransformation.cc
index 5ee9f66..d375856 100644
--- a/lib/atscppapi/src/GzipDeflateTransformation.cc
+++ b/lib/atscppapi/src/GzipDeflateTransformation.cc
@@ -32,7 +32,8 @@ using namespace atscppapi::transformations;
 using std::string;
 using std::vector;
 
-namespace {
+namespace
+{
 const int GZIP_MEM_LEVEL = 8;
 const int WINDOW_BITS = 31; // Always use 31 for gzip.
 const unsigned int ONE_KB = 1024;
@@ -41,18 +42,17 @@ const unsigned int ONE_KB = 1024;
 /**
  * @private
  */
-struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable {
+struct atscppapi::transformations::GzipDeflateTransformationState : noncopyable {
   z_stream z_stream_;
   bool z_stream_initialized_;
   TransformationPlugin::Type transformation_type_;
   int64_t bytes_produced_;
 
-  GzipDeflateTransformationState(TransformationPlugin::Type type) :
-        z_stream_initialized_(false), transformation_type_(type), bytes_produced_(0) {
-
+  GzipDeflateTransformationState(TransformationPlugin::Type type)
+    : z_stream_initialized_(false), transformation_type_(type), bytes_produced_(0)
+  {
     memset(&z_stream_, 0, sizeof(z_stream_));
-    int err =
-        deflateInit2(&z_stream_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, WINDOW_BITS , GZIP_MEM_LEVEL, Z_DEFAULT_STRATEGY);
+    int err = deflateInit2(&z_stream_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, WINDOW_BITS, GZIP_MEM_LEVEL, Z_DEFAULT_STRATEGY);
 
     if (Z_OK != err) {
       LOG_ERROR("deflateInit2 failed with error code '%d'.", err);
@@ -61,7 +61,8 @@ struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable {
     }
   };
 
-  ~GzipDeflateTransformationState() {
+  ~GzipDeflateTransformationState()
+  {
     if (z_stream_initialized_) {
       deflateEnd(&z_stream_);
     }
@@ -69,15 +70,20 @@ struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable {
 };
 
 
-GzipDeflateTransformation::GzipDeflateTransformation(Transaction &transaction, TransformationPlugin::Type type) : TransformationPlugin(transaction, type) {
+GzipDeflateTransformation::GzipDeflateTransformation(Transaction &transaction, TransformationPlugin::Type type)
+  : TransformationPlugin(transaction, type)
+{
   state_ = new GzipDeflateTransformationState(type);
 }
 
-GzipDeflateTransformation::~GzipDeflateTransformation() {
+GzipDeflateTransformation::~GzipDeflateTransformation()
+{
   delete state_;
 }
 
-void GzipDeflateTransformation::consume(const string &data) {
+void
+GzipDeflateTransformation::consume(const string &data)
+{
   if (data.size() == 0) {
     return;
   }
@@ -112,7 +118,8 @@ void GzipDeflateTransformation::consume(const string &data) {
     int bytes_to_write = buffer_size - state_->z_stream_.avail_out;
     state_->bytes_produced_ += bytes_to_write;
 
-    LOG_DEBUG("Iteration %d: Deflate compressed %ld bytes to %d bytes, producing output...", iteration, data.size(), bytes_to_write);
+    LOG_DEBUG("Iteration %d: Deflate compressed %ld bytes to %d bytes, producing output...", iteration, data.size(),
+              bytes_to_write);
     produce(string(reinterpret_cast<char *>(&buffer[0]), static_cast<size_t>(bytes_to_write)));
   } while (state_->z_stream_.avail_out == 0);
 
@@ -123,7 +130,9 @@ void GzipDeflateTransformation::consume(const string &data) {
   }
 }
 
-void GzipDeflateTransformation::handleInputComplete() {
+void
+GzipDeflateTransformation::handleInputComplete()
+{
   // We will flush out anything that's remaining in the gzip buffer
   int status = Z_OK;
   int iteration = 0;
@@ -143,7 +152,8 @@ void GzipDeflateTransformation::handleInputComplete() {
     state_->bytes_produced_ += bytes_to_write;
 
     if (status == Z_OK || status == Z_STREAM_END) {
-      LOG_DEBUG("Iteration %d: Gzip deflate finalize had an extra %d bytes to process, status '%d'. Producing output...", iteration, bytes_to_write, status);
+      LOG_DEBUG("Iteration %d: Gzip deflate finalize had an extra %d bytes to process, status '%d'. Producing output...", iteration,
+                bytes_to_write, status);
       produce(string(reinterpret_cast<char *>(buffer), static_cast<size_t>(bytes_to_write)));
     } else if (status != Z_STREAM_END) {
       LOG_ERROR("Iteration %d: Gzip deflinate finalize produced an error '%d'", iteration, status);
@@ -152,6 +162,7 @@ void GzipDeflateTransformation::handleInputComplete() {
 
   int64_t bytes_written = setOutputComplete();
   if (state_->bytes_produced_ != bytes_written) {
-    LOG_ERROR("Gzip bytes produced sanity check failed, deflated bytes = %" PRId64 " != written bytes = %" PRId64, state_->bytes_produced_, bytes_written);
+    LOG_ERROR("Gzip bytes produced sanity check failed, deflated bytes = %" PRId64 " != written bytes = %" PRId64,
+              state_->bytes_produced_, bytes_written);
   }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/GzipInflateTransformation.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/GzipInflateTransformation.cc b/lib/atscppapi/src/GzipInflateTransformation.cc
index 936a472..a6424a7 100644
--- a/lib/atscppapi/src/GzipInflateTransformation.cc
+++ b/lib/atscppapi/src/GzipInflateTransformation.cc
@@ -33,7 +33,8 @@ using namespace atscppapi::transformations;
 using std::string;
 using std::vector;
 
-namespace {
+namespace
+{
 const int WINDOW_BITS = 31; // Always use 31 for gzip.
 unsigned int INFLATE_SCALE_FACTOR = 6;
 }
@@ -41,15 +42,15 @@ unsigned int INFLATE_SCALE_FACTOR = 6;
 /**
  * @private
  */
-struct atscppapi::transformations::GzipInflateTransformationState: noncopyable {
+struct atscppapi::transformations::GzipInflateTransformationState : noncopyable {
   z_stream z_stream_;
   bool z_stream_initialized_;
   int64_t bytes_produced_;
   TransformationPlugin::Type transformation_type_;
 
-  GzipInflateTransformationState(TransformationPlugin::Type type) :
-        z_stream_initialized_(false), bytes_produced_(0), transformation_type_(type) {
-
+  GzipInflateTransformationState(TransformationPlugin::Type type)
+    : z_stream_initialized_(false), bytes_produced_(0), transformation_type_(type)
+  {
     memset(&z_stream_, 0, sizeof(z_stream_));
 
     int err = inflateInit2(&z_stream_, WINDOW_BITS);
@@ -60,7 +61,8 @@ struct atscppapi::transformations::GzipInflateTransformationState: noncopyable {
     }
   };
 
-  ~GzipInflateTransformationState() {
+  ~GzipInflateTransformationState()
+  {
     if (z_stream_initialized_) {
       int err = inflateEnd(&z_stream_);
       if (Z_OK != err && Z_STREAM_END != err) {
@@ -71,15 +73,20 @@ struct atscppapi::transformations::GzipInflateTransformationState: noncopyable {
 };
 
 
-GzipInflateTransformation::GzipInflateTransformation(Transaction &transaction, TransformationPlugin::Type type) : TransformationPlugin(transaction, type) {
+GzipInflateTransformation::GzipInflateTransformation(Transaction &transaction, TransformationPlugin::Type type)
+  : TransformationPlugin(transaction, type)
+{
   state_ = new GzipInflateTransformationState(type);
 }
 
-GzipInflateTransformation::~GzipInflateTransformation() {
+GzipInflateTransformation::~GzipInflateTransformation()
+{
   delete state_;
 }
 
-void GzipInflateTransformation::consume(const string &data) {
+void
+GzipInflateTransformation::consume(const string &data)
+{
   if (data.size() == 0) {
     return;
   }
@@ -110,24 +117,25 @@ void GzipInflateTransformation::consume(const string &data) {
     err = inflate(&state_->z_stream_, Z_SYNC_FLUSH);
 
     if (err != Z_OK && err != Z_STREAM_END) {
-     LOG_ERROR("Iteration %d: Inflate failed with error '%d'", iteration, err);
-     state_->z_stream_.next_out = NULL;
-     return;
+      LOG_ERROR("Iteration %d: Inflate failed with error '%d'", iteration, err);
+      state_->z_stream_.next_out = NULL;
+      return;
     }
 
-    LOG_DEBUG("Iteration %d: Gzip inflated a total of %d bytes, producingOutput...", iteration, (inflate_block_size - state_->z_stream_.avail_out));
+    LOG_DEBUG("Iteration %d: Gzip inflated a total of %d bytes, producingOutput...", iteration,
+              (inflate_block_size - state_->z_stream_.avail_out));
     produce(string(&buffer[0], (inflate_block_size - state_->z_stream_.avail_out)));
     state_->bytes_produced_ += (inflate_block_size - state_->z_stream_.avail_out);
   }
   state_->z_stream_.next_out = NULL;
 }
 
-void GzipInflateTransformation::handleInputComplete() {
+void
+GzipInflateTransformation::handleInputComplete()
+{
   int64_t bytes_written = setOutputComplete();
   if (state_->bytes_produced_ != bytes_written) {
-    LOG_ERROR("Gzip bytes produced sanity check failed, inflated bytes = %" PRId64 " != written bytes = %" PRId64, state_->bytes_produced_, bytes_written);
+    LOG_ERROR("Gzip bytes produced sanity check failed, inflated bytes = %" PRId64 " != written bytes = %" PRId64,
+              state_->bytes_produced_, bytes_written);
   }
 }
-
-
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Headers.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Headers.cc b/lib/atscppapi/src/Headers.cc
index 5693c52..ee7fba3 100644
--- a/lib/atscppapi/src/Headers.cc
+++ b/lib/atscppapi/src/Headers.cc
@@ -37,58 +37,73 @@ using atscppapi::header_field_value_iterator;
 
 using std::string;
 
-namespace atscppapi {
-
-HeaderFieldName::HeaderFieldName(const std::string &name) {
+namespace atscppapi
+{
+HeaderFieldName::HeaderFieldName(const std::string &name)
+{
   name_ = name;
 }
 
-HeaderFieldName::operator std::string() {
+HeaderFieldName::operator std::string()
+{
   return name_;
 }
 
-HeaderFieldName::operator const char*() {
+HeaderFieldName::operator const char *()
+{
   return name_.c_str();
 }
 
-std::string HeaderFieldName::str() {
+std::string
+HeaderFieldName::str()
+{
   return name_;
 }
 
-HeaderFieldName::size_type HeaderFieldName::length() {
+HeaderFieldName::size_type
+HeaderFieldName::length()
+{
   return name_.length();
 }
 
-const char *HeaderFieldName::c_str() {
+const char *
+HeaderFieldName::c_str()
+{
   return name_.c_str();
 }
 
-bool HeaderFieldName::operator==(const char *field_name) {
+bool HeaderFieldName::operator==(const char *field_name)
+{
   return (::strcasecmp(c_str(), field_name) == 0);
 }
 
-bool HeaderFieldName::operator==(const std::string &field_name) {
+bool HeaderFieldName::operator==(const std::string &field_name)
+{
   return operator==(field_name.c_str());
 }
 
-bool HeaderFieldName::operator!=(const char *field_name) {
+bool HeaderFieldName::operator!=(const char *field_name)
+{
   return !operator==(field_name);
 }
 
-bool HeaderFieldName::operator!=(const std::string &field_name) {
+bool HeaderFieldName::operator!=(const std::string &field_name)
+{
   return !operator==(field_name.c_str());
 }
 
 /**
  * @private
  */
-struct HeaderFieldValueIteratorState: noncopyable {
+struct HeaderFieldValueIteratorState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc field_loc_;
   int index_;
-  HeaderFieldValueIteratorState() : hdr_buf_(NULL), hdr_loc_(NULL), field_loc_(NULL), index_(0) { }
-  void reset(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc, int index) {
+  HeaderFieldValueIteratorState() : hdr_buf_(NULL), hdr_loc_(NULL), field_loc_(NULL), index_(0) {}
+  void
+  reset(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc, int index)
+  {
     hdr_buf_ = bufp;
     hdr_loc_ = hdr_loc;
     field_loc_ = field_loc;
@@ -96,51 +111,56 @@ struct HeaderFieldValueIteratorState: noncopyable {
   }
 };
 
-header_field_value_iterator::header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, int index) {
+header_field_value_iterator::header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, int index)
+{
   state_ = new HeaderFieldValueIteratorState();
-  state_->reset(static_cast<TSMBuffer>(bufp),
-      static_cast<TSMLoc>(hdr_loc),
-      static_cast<TSMLoc>(field_loc),
-      index);
+  state_->reset(static_cast<TSMBuffer>(bufp), static_cast<TSMLoc>(hdr_loc), static_cast<TSMLoc>(field_loc), index);
 }
 
-header_field_value_iterator::header_field_value_iterator(const header_field_value_iterator& it) {
+header_field_value_iterator::header_field_value_iterator(const header_field_value_iterator &it)
+{
   state_ = new HeaderFieldValueIteratorState();
   state_->reset(it.state_->hdr_buf_, it.state_->hdr_loc_, it.state_->field_loc_, it.state_->index_);
 }
 
-header_field_value_iterator::~header_field_value_iterator() {
+header_field_value_iterator::~header_field_value_iterator()
+{
   delete state_;
 }
 
-std::string header_field_value_iterator::operator*() {
+std::string header_field_value_iterator::operator*()
+{
   if (state_->index_ >= 0) {
     int length = 0;
     const char *str = TSMimeHdrFieldValueStringGet(state_->hdr_buf_, state_->hdr_loc_, state_->field_loc_, state_->index_, &length);
     if (length && str) {
-     return std::string(str, length);
+      return std::string(str, length);
     }
   }
   return std::string();
 }
 
-header_field_value_iterator& header_field_value_iterator::operator++() {
+header_field_value_iterator &header_field_value_iterator::operator++()
+{
   ++state_->index_;
   return *this;
 }
 
-header_field_value_iterator header_field_value_iterator::operator++(int) {
- header_field_value_iterator tmp(*this);
- operator++();
- return tmp;
+header_field_value_iterator header_field_value_iterator::operator++(int)
+{
+  header_field_value_iterator tmp(*this);
+  operator++();
+  return tmp;
 }
 
-bool header_field_value_iterator::operator==(const header_field_value_iterator& rhs) const {
+bool header_field_value_iterator::operator==(const header_field_value_iterator &rhs) const
+{
   return (state_->hdr_buf_ == rhs.state_->hdr_buf_) && (state_->hdr_loc_ == rhs.state_->hdr_loc_) &&
-                 (state_->field_loc_ == rhs.state_->field_loc_) && (state_->index_ == rhs.state_->index_);
+         (state_->field_loc_ == rhs.state_->field_loc_) && (state_->index_ == rhs.state_->index_);
 }
 
-bool header_field_value_iterator::operator!=(const header_field_value_iterator& rhs) const {
+bool header_field_value_iterator::operator!=(const header_field_value_iterator &rhs) const
+{
   return !operator==(rhs);
 }
 
@@ -151,9 +171,9 @@ struct MLocContainer {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc field_loc_;
-  MLocContainer(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc) :
-    hdr_buf_(bufp), hdr_loc_(hdr_loc), field_loc_(field_loc) { }
-  ~MLocContainer() {
+  MLocContainer(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc) : hdr_buf_(bufp), hdr_loc_(hdr_loc), field_loc_(field_loc) {}
+  ~MLocContainer()
+  {
     if (field_loc_ != TS_NULL_MLOC) {
       TSHandleMLocRelease(hdr_buf_, hdr_loc_, field_loc_);
     }
@@ -166,36 +186,53 @@ struct MLocContainer {
 struct HeaderFieldIteratorState {
   shared_ptr<MLocContainer> mloc_container_;
   HeaderFieldIteratorState(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc)
-    : mloc_container_(new MLocContainer(bufp, hdr_loc, field_loc)) { }
+    : mloc_container_(new MLocContainer(bufp, hdr_loc, field_loc))
+  {
+  }
 };
 
-HeaderField::~HeaderField() {
+HeaderField::~HeaderField()
+{
 }
 
-HeaderField::size_type HeaderField::size() const {
-  return TSMimeHdrFieldValuesCount(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_);
+HeaderField::size_type
+HeaderField::size() const
+{
+  return TSMimeHdrFieldValuesCount(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                   iter_.state_->mloc_container_->field_loc_);
 }
 
-header_field_value_iterator HeaderField::begin() {
-  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, 0);
+header_field_value_iterator
+HeaderField::begin()
+{
+  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                     iter_.state_->mloc_container_->field_loc_, 0);
 }
 
-header_field_value_iterator HeaderField::end() {
-  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, size());
+header_field_value_iterator
+HeaderField::end()
+{
+  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                     iter_.state_->mloc_container_->field_loc_, size());
 }
 
-HeaderFieldName HeaderField::name() const {
+HeaderFieldName
+HeaderField::name() const
+{
   int length = 0;
-  const char *str = TSMimeHdrFieldNameGet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, &length);
+  const char *str = TSMimeHdrFieldNameGet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                          iter_.state_->mloc_container_->field_loc_, &length);
   if (str && length) {
     return std::string(str, length);
   }
   return std::string();
 }
 
-std::string HeaderField::values(const char *join) {
+std::string
+HeaderField::values(const char *join)
+{
   std::string ret;
-  for(header_field_value_iterator it = begin(); it != end(); ++it) {
+  for (header_field_value_iterator it = begin(); it != end(); ++it) {
     if (ret.size()) {
       ret.append(join);
     }
@@ -204,15 +241,21 @@ std::string HeaderField::values(const char *join) {
   return ret;
 }
 
-std::string HeaderField::values(const std::string &join) {
+std::string
+HeaderField::values(const std::string &join)
+{
   return values(join.c_str());
 }
 
-std::string HeaderField::values(const char join) {
-  return values(std::string().append(1,join));
+std::string
+HeaderField::values(const char join)
+{
+  return values(std::string().append(1, join));
 }
 
-std::string Headers::value(const std::string key, size_type index /* = 0 */) {
+std::string
+Headers::value(const std::string key, size_type index /* = 0 */)
+{
   header_field_iterator iter = find(key);
   if (iter == end()) {
     return string();
@@ -229,74 +272,101 @@ std::string Headers::value(const std::string key, size_type index /* = 0 */) {
   return string();
 }
 
-bool HeaderField::empty() {
+bool
+HeaderField::empty()
+{
   return (begin() == end());
 }
 
-bool HeaderField::clear() {
-  return (TSMimeHdrFieldValuesClear(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_) == TS_SUCCESS);
+bool
+HeaderField::clear()
+{
+  return (TSMimeHdrFieldValuesClear(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                    iter_.state_->mloc_container_->field_loc_) == TS_SUCCESS);
 }
 
-bool HeaderField::erase(header_field_value_iterator it) {
-  return (TSMimeHdrFieldValueDelete(it.state_->hdr_buf_, it.state_->hdr_loc_, it.state_->field_loc_, it.state_->index_) == TS_SUCCESS);
+bool
+HeaderField::erase(header_field_value_iterator it)
+{
+  return (TSMimeHdrFieldValueDelete(it.state_->hdr_buf_, it.state_->hdr_loc_, it.state_->field_loc_, it.state_->index_) ==
+          TS_SUCCESS);
 }
 
-bool HeaderField::append(const std::string &value) {
+bool
+HeaderField::append(const std::string &value)
+{
   return append(value.c_str(), value.length());
 }
 
-bool HeaderField::append(const char *value, int length) {
-  return (TSMimeHdrFieldValueStringInsert(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, -1, value, -1) == TS_SUCCESS);
+bool
+HeaderField::append(const char *value, int length)
+{
+  return (TSMimeHdrFieldValueStringInsert(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                          iter_.state_->mloc_container_->field_loc_, -1, value, -1) == TS_SUCCESS);
 }
 
-bool HeaderField::setName(const std::string &str) {
-  return (TSMimeHdrFieldNameSet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, str.c_str(), str.length()) == TS_SUCCESS);
+bool
+HeaderField::setName(const std::string &str)
+{
+  return (TSMimeHdrFieldNameSet(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                iter_.state_->mloc_container_->field_loc_, str.c_str(), str.length()) == TS_SUCCESS);
 }
 
-bool HeaderField::operator==(const char *field_name) const {
+bool HeaderField::operator==(const char *field_name) const
+{
   return (::strcasecmp(name(), field_name) == 0);
 }
 
-bool HeaderField::operator==(const std::string &field_name) const {
+bool HeaderField::operator==(const std::string &field_name) const
+{
   return operator==(field_name.c_str());
 }
 
-bool HeaderField::operator!=(const char *field_name) const {
+bool HeaderField::operator!=(const char *field_name) const
+{
   return !operator==(field_name);
 }
 
-bool HeaderField::operator!=(const std::string &field_name) const {
+bool HeaderField::operator!=(const std::string &field_name) const
+{
   return !operator==(field_name.c_str());
 }
 
-bool HeaderField::operator=(const std::string &field_value) {
-  if(!clear())
+bool HeaderField::operator=(const std::string &field_value)
+{
+  if (!clear())
     return false;
 
   return append(field_value);
 }
 
-bool HeaderField::operator=(const char *field_value) {
-  if(!clear())
+bool HeaderField::operator=(const char *field_value)
+{
+  if (!clear())
     return false;
 
   return append(field_value);
 }
 
-std::string HeaderField::operator[](const int index) {
-  return *header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_, iter_.state_->mloc_container_->field_loc_, index);
+std::string HeaderField::operator[](const int index)
+{
+  return *header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, iter_.state_->mloc_container_->hdr_loc_,
+                                      iter_.state_->mloc_container_->field_loc_, index);
 }
 
-std::string HeaderField::str() {
+std::string
+HeaderField::str()
+{
   std::ostringstream oss;
   oss << (*this);
   return oss.str();
 }
 
-std::ostream& operator<<(std::ostream& os, HeaderField& obj) {
+std::ostream &operator<<(std::ostream &os, HeaderField &obj)
+{
   os << obj.name() << ": ";
   int count = obj.size();
-  for(HeaderField::iterator it = obj.begin(); it != obj.end(); ++it) {
+  for (HeaderField::iterator it = obj.begin(); it != obj.end(); ++it) {
     os << (*it);
     if (--count > 0)
       os << ",";
@@ -304,14 +374,18 @@ std::ostream& operator<<(std::ostream& os, HeaderField& obj) {
   return os;
 }
 
-header_field_iterator::header_field_iterator(void *hdr_buf, void *hdr_loc, void *field_loc) :
-  state_(new HeaderFieldIteratorState(static_cast<TSMBuffer>(hdr_buf), static_cast<TSMLoc>(hdr_loc),
-                                      static_cast<TSMLoc>(field_loc))) { }
+header_field_iterator::header_field_iterator(void *hdr_buf, void *hdr_loc, void *field_loc)
+  : state_(
+      new HeaderFieldIteratorState(static_cast<TSMBuffer>(hdr_buf), static_cast<TSMLoc>(hdr_loc), static_cast<TSMLoc>(field_loc)))
+{
+}
 
-header_field_iterator::header_field_iterator(const header_field_iterator& it) :
-  state_(new HeaderFieldIteratorState(*it.state_)) { }
+header_field_iterator::header_field_iterator(const header_field_iterator &it) : state_(new HeaderFieldIteratorState(*it.state_))
+{
+}
 
-header_field_iterator &header_field_iterator::operator=(const header_field_iterator &rhs) {
+header_field_iterator &header_field_iterator::operator=(const header_field_iterator &rhs)
+{
   if (this != &rhs) {
     delete state_;
     state_ = new HeaderFieldIteratorState(*rhs.state_);
@@ -319,13 +393,15 @@ header_field_iterator &header_field_iterator::operator=(const header_field_itera
   return *this;
 }
 
-header_field_iterator::~header_field_iterator() {
+header_field_iterator::~header_field_iterator()
+{
   delete state_;
 }
 
 // utility function to use to advance iterators using different functions
-HeaderFieldIteratorState *advanceIterator(HeaderFieldIteratorState *state,
-                                          TSMLoc (*getNextField)(TSMBuffer, TSMLoc, TSMLoc)) {
+HeaderFieldIteratorState *
+advanceIterator(HeaderFieldIteratorState *state, TSMLoc (*getNextField)(TSMBuffer, TSMLoc, TSMLoc))
+{
   if (state->mloc_container_->field_loc_ != TS_NULL_MLOC) {
     TSMBuffer hdr_buf = state->mloc_container_->hdr_buf_;
     TSMLoc hdr_loc = state->mloc_container_->hdr_loc_;
@@ -336,48 +412,59 @@ HeaderFieldIteratorState *advanceIterator(HeaderFieldIteratorState *state,
   return state;
 }
 
-header_field_iterator& header_field_iterator::operator++() {
+header_field_iterator &header_field_iterator::operator++()
+{
   state_ = advanceIterator(state_, TSMimeHdrFieldNext);
   return *this;
 }
 
-header_field_iterator header_field_iterator::operator++(int) {
+header_field_iterator header_field_iterator::operator++(int)
+{
   header_field_iterator tmp(*this);
   operator++();
   return tmp;
 }
 
-header_field_iterator& header_field_iterator::nextDup() {
+header_field_iterator &
+header_field_iterator::nextDup()
+{
   state_ = advanceIterator(state_, TSMimeHdrFieldNextDup);
   return *this;
 }
 
-bool header_field_iterator::operator==(const header_field_iterator& rhs) const {
-  return (state_->mloc_container_->hdr_buf_ == rhs.state_->mloc_container_->hdr_buf_) && (state_->mloc_container_->hdr_loc_ == rhs.state_->mloc_container_->hdr_loc_) &&
-      (state_->mloc_container_->field_loc_ == rhs.state_->mloc_container_->field_loc_);
+bool header_field_iterator::operator==(const header_field_iterator &rhs) const
+{
+  return (state_->mloc_container_->hdr_buf_ == rhs.state_->mloc_container_->hdr_buf_) &&
+         (state_->mloc_container_->hdr_loc_ == rhs.state_->mloc_container_->hdr_loc_) &&
+         (state_->mloc_container_->field_loc_ == rhs.state_->mloc_container_->field_loc_);
 }
 
-bool header_field_iterator::operator!=(const header_field_iterator& rhs) const {
+bool header_field_iterator::operator!=(const header_field_iterator &rhs) const
+{
   return !operator==(rhs);
 }
 
-HeaderField header_field_iterator::operator*() {
+HeaderField header_field_iterator::operator*()
+{
   return HeaderField(*this);
 }
 
 /**
  * @private
  */
-struct HeadersState: noncopyable {
+struct HeadersState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   bool self_created_structures_;
-  HeadersState() {
+  HeadersState()
+  {
     hdr_buf_ = TSMBufferCreate();
     hdr_loc_ = TSHttpHdrCreate(hdr_buf_);
     self_created_structures_ = true;
   }
-  void reset(TSMBuffer bufp, TSMLoc hdr_loc) {
+  void
+  reset(TSMBuffer bufp, TSMLoc hdr_loc)
+  {
     if (self_created_structures_) {
       TSHandleMLocRelease(hdr_buf_, TS_NULL_MLOC /* no parent */, hdr_loc_);
       TSMBufferDestroy(hdr_buf_);
@@ -386,65 +473,89 @@ struct HeadersState: noncopyable {
     hdr_buf_ = bufp;
     hdr_loc_ = hdr_loc;
   }
-  ~HeadersState() {
-    reset(NULL, NULL);
-  }
+  ~HeadersState() { reset(NULL, NULL); }
 };
 
-Headers::Headers() {
+Headers::Headers()
+{
   state_ = new HeadersState();
 }
 
-Headers::Headers(void *bufp, void *mloc) {
+Headers::Headers(void *bufp, void *mloc)
+{
   state_ = new HeadersState();
   reset(bufp, mloc);
 }
 
-void Headers::reset(void *bufp, void *mloc) {
+void
+Headers::reset(void *bufp, void *mloc)
+{
   state_->reset(static_cast<TSMBuffer>(bufp), static_cast<TSMLoc>(mloc));
 }
 
-Headers::~Headers() {
+Headers::~Headers()
+{
   delete state_;
 }
 
-bool Headers::isInitialized() const {
+bool
+Headers::isInitialized() const
+{
   return (state_->hdr_buf_ && state_->hdr_loc_);
 }
 
-bool Headers::empty() {
+bool
+Headers::empty()
+{
   return (begin() == end());
 }
 
-Headers::size_type Headers::size() const {
+Headers::size_type
+Headers::size() const
+{
   return TSMimeHdrFieldsCount(state_->hdr_buf_, state_->hdr_loc_);
 }
 
-Headers::size_type Headers::lengthBytes() const {
+Headers::size_type
+Headers::lengthBytes() const
+{
   return TSMimeHdrLengthGet(state_->hdr_buf_, state_->hdr_loc_);
 }
 
-header_field_iterator Headers::begin() {
+header_field_iterator
+Headers::begin()
+{
   return header_field_iterator(state_->hdr_buf_, state_->hdr_loc_, TSMimeHdrFieldGet(state_->hdr_buf_, state_->hdr_loc_, 0));
 }
 
-header_field_iterator Headers::end() {
+header_field_iterator
+Headers::end()
+{
   return header_field_iterator(state_->hdr_buf_, state_->hdr_loc_, TS_NULL_MLOC);
 }
 
-bool Headers::clear() {
+bool
+Headers::clear()
+{
   return (TSMimeHdrFieldsClear(state_->hdr_buf_, state_->hdr_loc_) == TS_SUCCESS);
 }
 
-bool Headers::erase(header_field_iterator it) {
-  return (TSMimeHdrFieldDestroy(it.state_->mloc_container_->hdr_buf_, it.state_->mloc_container_->hdr_loc_, it.state_->mloc_container_->field_loc_) == TS_SUCCESS);
+bool
+Headers::erase(header_field_iterator it)
+{
+  return (TSMimeHdrFieldDestroy(it.state_->mloc_container_->hdr_buf_, it.state_->mloc_container_->hdr_loc_,
+                                it.state_->mloc_container_->field_loc_) == TS_SUCCESS);
 }
 
-Headers::size_type Headers::erase(const std::string &key) {
+Headers::size_type
+Headers::erase(const std::string &key)
+{
   return erase(key.c_str(), key.length());
 }
 
-Headers::size_type Headers::erase(const char *key, int length) {
+Headers::size_type
+Headers::erase(const char *key, int length)
+{
   header_field_iterator iter = find(key, length);
   size_type erased_count = 0;
   while (iter != end()) {
@@ -456,9 +567,11 @@ Headers::size_type Headers::erase(const char *key, int length) {
   return erased_count;
 }
 
-Headers::size_type Headers::count(const char *key, int length) {
+Headers::size_type
+Headers::count(const char *key, int length)
+{
   size_type ret_count = 0;
-  for(header_field_iterator it = begin(); it != end(); ++it) {
+  for (header_field_iterator it = begin(); it != end(); ++it) {
     if ((*it).name() == key) {
       ret_count++;
     }
@@ -466,11 +579,15 @@ Headers::size_type Headers::count(const char *key, int length) {
   return ret_count;
 }
 
-Headers::size_type Headers::count(const std::string &key) {
+Headers::size_type
+Headers::count(const std::string &key)
+{
   return count(key.c_str(), key.length());
 }
 
-std::string Headers::values(const std::string &key, const char *join) {
+std::string
+Headers::values(const std::string &key, const char *join)
+{
   std::string ret;
   for (header_field_iterator it = find(key); it != end(); it.nextDup()) {
     if (ret.size()) {
@@ -482,19 +599,27 @@ std::string Headers::values(const std::string &key, const char *join) {
   return ret;
 }
 
-std::string Headers::values(const std::string &key, const std::string &join) {
+std::string
+Headers::values(const std::string &key, const std::string &join)
+{
   return values(key, join.c_str());
 }
 
-std::string Headers::values(const std::string &key, const char join) {
+std::string
+Headers::values(const std::string &key, const char join)
+{
   return values(key, std::string().assign(1, join));
 }
 
-header_field_iterator Headers::find(const std::string &key) {
+header_field_iterator
+Headers::find(const std::string &key)
+{
   return find(key.c_str(), key.length());
 }
 
-header_field_iterator Headers::find(const char *key, int length) {
+header_field_iterator
+Headers::find(const char *key, int length)
+{
   TSMLoc field_loc = TSMimeHdrFieldFind(state_->hdr_buf_, state_->hdr_loc_, key, length);
   if (field_loc != TS_NULL_MLOC)
     return header_field_iterator(state_->hdr_buf_, state_->hdr_loc_, field_loc);
@@ -502,7 +627,9 @@ header_field_iterator Headers::find(const char *key, int length) {
   return end();
 }
 
-Headers::iterator Headers::append(const std::string &key, const std::string &value) {
+Headers::iterator
+Headers::append(const std::string &key, const std::string &value)
+{
   TSMLoc field_loc = TS_NULL_MLOC;
 
   if (TSMimeHdrFieldCreate(state_->hdr_buf_, state_->hdr_loc_, &field_loc) == TS_SUCCESS) {
@@ -514,12 +641,15 @@ Headers::iterator Headers::append(const std::string &key, const std::string &val
     return end();
 }
 
-Headers::iterator Headers::set(const std::string &key, const std::string &value) {
+Headers::iterator
+Headers::set(const std::string &key, const std::string &value)
+{
   erase(key);
   return append(key, value);
 }
 
-HeaderField Headers::operator[](const std::string &key) {
+HeaderField Headers::operator[](const std::string &key)
+{
   // In STL fashion if the key doesn't exist it will be added with an empty value.
   header_field_iterator it = find(key);
   if (it != end()) {
@@ -529,13 +659,17 @@ HeaderField Headers::operator[](const std::string &key) {
   }
 }
 
-std::string Headers::str() {
+std::string
+Headers::str()
+{
   std::ostringstream oss;
   oss << (*this);
   return oss.str();
 }
 
-std::string Headers::wireStr() {
+std::string
+Headers::wireStr()
+{
   string retval;
   for (iterator iter = begin(), last = end(); iter != last; ++iter) {
     HeaderField hf = *iter;
@@ -547,8 +681,9 @@ std::string Headers::wireStr() {
   return retval;
 }
 
-std::ostream& operator<<(std::ostream &os, atscppapi::Headers &obj) {
-  for(header_field_iterator it = obj.begin(); it != obj.end(); ++it) {
+std::ostream &operator<<(std::ostream &os, atscppapi::Headers &obj)
+{
+  for (header_field_iterator it = obj.begin(); it != obj.end(); ++it) {
     HeaderField hf = *it;
     os << hf << std::endl;
   }
@@ -556,4 +691,3 @@ std::ostream& operator<<(std::ostream &os, atscppapi::Headers &obj) {
 }
 
 } /* atscppapi namespace */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/HttpMethod.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/HttpMethod.cc b/lib/atscppapi/src/HttpMethod.cc
index 0ce5c5f..8bde500 100644
--- a/lib/atscppapi/src/HttpMethod.cc
+++ b/lib/atscppapi/src/HttpMethod.cc
@@ -22,16 +22,7 @@
 
 #include "atscppapi/HttpMethod.h"
 
-const std::string atscppapi::HTTP_METHOD_STRINGS[] = { std::string("UNKNOWN"),
-                                                       std::string("GET"),
-                                                       std::string("POST"),
-                                                       std::string("HEAD"),
-                                                       std::string("CONNECT"),
-                                                       std::string("DELETE"),
-                                                       std::string("ICP_QUERY"),
-                                                       std::string("OPTIONS"),
-                                                       std::string("PURGE"),
-                                                       std::string("PUT"),
-                                                       std::string("TRACE"),
-                                                       std::string("PUSH") };
-
+const std::string atscppapi::HTTP_METHOD_STRINGS[] = {std::string("UNKNOWN"),   std::string("GET"),     std::string("POST"),
+                                                      std::string("HEAD"),      std::string("CONNECT"), std::string("DELETE"),
+                                                      std::string("ICP_QUERY"), std::string("OPTIONS"), std::string("PURGE"),
+                                                      std::string("PUT"),       std::string("TRACE"),   std::string("PUSH")};

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/HttpVersion.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/HttpVersion.cc b/lib/atscppapi/src/HttpVersion.cc
index 7a1e3d5..5834693 100644
--- a/lib/atscppapi/src/HttpVersion.cc
+++ b/lib/atscppapi/src/HttpVersion.cc
@@ -22,8 +22,5 @@
 
 #include "atscppapi/HttpVersion.h"
 
-const std::string atscppapi::HTTP_VERSION_STRINGS[] = { std::string("UNKNOWN"),
-                                                        std::string("HTTP/0.9"),
-                                                        std::string("HTTP/1.0"),
-                                                        std::string("HTTP/1.1") };
-
+const std::string atscppapi::HTTP_VERSION_STRINGS[] = {std::string("UNKNOWN"), std::string("HTTP/0.9"), std::string("HTTP/1.0"),
+                                                       std::string("HTTP/1.1")};

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/InterceptPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/InterceptPlugin.cc b/lib/atscppapi/src/InterceptPlugin.cc
index 9503949..8f494bf 100644
--- a/lib/atscppapi/src/InterceptPlugin.cc
+++ b/lib/atscppapi/src/InterceptPlugin.cc
@@ -48,8 +48,9 @@ struct InterceptPlugin::State {
     TSVIO vio_;
     TSIOBuffer buffer_;
     TSIOBufferReader reader_;
-    IoHandle() : vio_(NULL), buffer_(NULL), reader_(NULL) { };
-    ~IoHandle() {
+    IoHandle() : vio_(NULL), buffer_(NULL), reader_(NULL){};
+    ~IoHandle()
+    {
       if (reader_) {
         TSIOBufferReaderFree(reader_);
       }
@@ -84,15 +85,16 @@ struct InterceptPlugin::State {
   bool plugin_io_done_;
 
   State(TSCont cont, InterceptPlugin *plugin)
-    : cont_(cont), net_vc_(NULL), expected_body_size_(0), num_body_bytes_read_(0), hdr_parsed_(false),
-      hdr_buf_(NULL), hdr_loc_(NULL), num_bytes_written_(0), plugin_(plugin), timeout_action_(NULL),
-      plugin_io_done_(false) {
+    : cont_(cont), net_vc_(NULL), expected_body_size_(0), num_body_bytes_read_(0), hdr_parsed_(false), hdr_buf_(NULL),
+      hdr_loc_(NULL), num_bytes_written_(0), plugin_(plugin), timeout_action_(NULL), plugin_io_done_(false)
+  {
     plugin_mutex_ = plugin->getMutex();
     http_parser_ = TSHttpParserCreate();
   }
-  
-  ~State() {
-    TSHttpParserDestroy(http_parser_); 
+
+  ~State()
+  {
+    TSHttpParserDestroy(http_parser_);
     if (hdr_loc_) {
       TSHandleMLocRelease(hdr_buf_, TS_NULL_MLOC, hdr_loc_);
     }
@@ -102,39 +104,39 @@ struct InterceptPlugin::State {
   }
 };
 
-namespace {
-
+namespace
+{
 int handleEvents(TSCont cont, TSEvent event, void *edata);
 void destroyCont(InterceptPlugin::State *state);
-
 }
 
-InterceptPlugin::InterceptPlugin(Transaction &transaction, InterceptPlugin::Type type)
-  : TransactionPlugin(transaction) {
+InterceptPlugin::InterceptPlugin(Transaction &transaction, InterceptPlugin::Type type) : TransactionPlugin(transaction)
+{
   TSCont cont = TSContCreate(handleEvents, TSMutexCreate());
   state_ = new State(cont, this);
   TSContDataSet(cont, state_);
   TSHttpTxn txn = static_cast<TSHttpTxn>(transaction.getAtsHandle());
   if (type == SERVER_INTERCEPT) {
     TSHttpTxnServerIntercept(cont, txn);
-  }
-  else {
+  } else {
     TSHttpTxnIntercept(cont, txn);
   }
 }
 
-InterceptPlugin::~InterceptPlugin() {
+InterceptPlugin::~InterceptPlugin()
+{
   if (state_->cont_) {
     LOG_DEBUG("Relying on callback for cleanup");
     state_->plugin_ = NULL; // prevent callback from invoking plugin
-  }
-  else { // safe to cleanup
+  } else {                  // safe to cleanup
     LOG_DEBUG("Normal cleanup");
     delete state_;
   }
 }
 
-bool InterceptPlugin::produce(const void *data, int data_size) {
+bool
+InterceptPlugin::produce(const void *data, int data_size)
+{
   if (!state_->net_vc_) {
     LOG_ERROR("Intercept not operational");
     return false;
@@ -146,8 +148,7 @@ bool InterceptPlugin::produce(const void *data, int data_size) {
   }
   int num_bytes_written = TSIOBufferWrite(state_->output_.buffer_, data, data_size);
   if (num_bytes_written != data_size) {
-    LOG_ERROR("Error while writing to buffer! Attempted %d bytes but only wrote %d bytes", data_size,
-              num_bytes_written);
+    LOG_ERROR("Error while writing to buffer! Attempted %d bytes but only wrote %d bytes", data_size, num_bytes_written);
     return false;
   }
   TSVIOReenable(state_->output_.vio_);
@@ -156,7 +157,9 @@ bool InterceptPlugin::produce(const void *data, int data_size) {
   return true;
 }
 
-bool InterceptPlugin::setOutputComplete() {
+bool
+InterceptPlugin::setOutputComplete()
+{
   ScopedSharedMutexLock scopedLock(getMutex());
   if (!state_->net_vc_) {
     LOG_ERROR("Intercept not operational");
@@ -173,17 +176,21 @@ bool InterceptPlugin::setOutputComplete() {
   return true;
 }
 
-Headers &InterceptPlugin::getRequestHeaders() {
+Headers &
+InterceptPlugin::getRequestHeaders()
+{
   return state_->request_headers_;
 }
 
-bool InterceptPlugin::doRead() {
+bool
+InterceptPlugin::doRead()
+{
   int avail = TSIOBufferReaderAvail(state_->input_.reader_);
   if (avail == TS_ERROR) {
     LOG_ERROR("Error while getting number of bytes available");
     return false;
   }
-  
+
   int consumed = 0; // consumed is used to update the input buffers
   if (avail > 0) {
     int64_t num_body_bytes_in_block;
@@ -195,8 +202,7 @@ bool InterceptPlugin::doRead() {
       num_body_bytes_in_block = 0;
       if (!state_->hdr_parsed_) {
         const char *endptr = data + data_len;
-        if (TSHttpHdrParseReq(state_->http_parser_, state_->hdr_buf_, state_->hdr_loc_, &data,
-                              endptr) == TS_PARSE_DONE) {
+        if (TSHttpHdrParseReq(state_->http_parser_, state_->hdr_buf_, state_->hdr_loc_, &data, endptr) == TS_PARSE_DONE) {
           LOG_DEBUG("Parsed header");
           string content_length_str = state_->request_headers_.value("Content-Length");
           if (!content_length_str.empty()) {
@@ -206,8 +212,7 @@ bool InterceptPlugin::doRead() {
             if ((errno != ERANGE) && (end_ptr != start_ptr) && (*end_ptr == '\0')) {
               LOG_DEBUG("Got content length: %d", content_length);
               state_->expected_body_size_ = content_length;
-            }
-            else {
+            } else {
               LOG_ERROR("Invalid content length header [%s]; Assuming no content", content_length_str.c_str());
             }
           }
@@ -222,8 +227,7 @@ bool InterceptPlugin::doRead() {
           num_body_bytes_in_block = endptr - data;
         }
         consume(string(startptr, data - startptr), InterceptPlugin::REQUEST_HEADER);
-      }
-      else {
+      } else {
         num_body_bytes_in_block = data_len;
       }
       if (num_body_bytes_in_block) {
@@ -236,7 +240,7 @@ bool InterceptPlugin::doRead() {
   }
   LOG_DEBUG("Consumed %d bytes from input vio", consumed);
   TSIOBufferReaderConsume(state_->input_.reader_, consumed);
-  
+
   // Modify the input VIO to reflect how much data we've completed.
   TSVIONDoneSet(state_->input_.vio_, TSVIONDoneGet(state_->input_.vio_) + consumed);
 
@@ -247,21 +251,20 @@ bool InterceptPlugin::doRead() {
       // TODO: any further action required?
     }
     handleInputComplete();
-  }
-  else {
-    LOG_DEBUG("Reenabling input vio as %d bytes still need to be read",
-              state_->expected_body_size_ - state_->num_body_bytes_read_);
+  } else {
+    LOG_DEBUG("Reenabling input vio as %d bytes still need to be read", state_->expected_body_size_ - state_->num_body_bytes_read_);
     TSVIOReenable(state_->input_.vio_);
   }
   return true;
 }
 
-void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
+void
+InterceptPlugin::handleEvent(int abstract_event, void *edata)
+{
   TSEvent event = static_cast<TSEvent>(abstract_event);
   LOG_DEBUG("Received event %d", event);
 
   switch (event) {
-
   case TS_EVENT_NET_ACCEPT:
     LOG_DEBUG("Handling net accept");
     state_->net_vc_ = static_cast<TSVConn>(edata);
@@ -277,11 +280,11 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
     break;
 
   case TS_EVENT_VCONN_WRITE_READY: // nothing to do
-    LOG_DEBUG("Got write ready"); 
+    LOG_DEBUG("Got write ready");
     break;
 
   case TS_EVENT_VCONN_READ_READY:
-    LOG_DEBUG("Handling read ready");  
+    LOG_DEBUG("Handling read ready");
     if (doRead()) {
       break;
     }
@@ -290,12 +293,11 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
   case TS_EVENT_VCONN_READ_COMPLETE: // fall throughs intentional
   case TS_EVENT_VCONN_WRITE_COMPLETE:
   case TS_EVENT_VCONN_EOS:
-  case TS_EVENT_ERROR: // erroring out, nothing more to do
+  case TS_EVENT_ERROR:             // erroring out, nothing more to do
   case TS_EVENT_NET_ACCEPT_FAILED: // somebody canceled the transaction
     if (event == TS_EVENT_ERROR) {
       LOG_ERROR("Unknown Error!");
-    }
-    else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
+    } else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
       LOG_ERROR("Got net_accept_failed!");
     }
     LOG_DEBUG("Shutting down intercept");
@@ -307,10 +309,11 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
   }
 }
 
-namespace {
-
-int handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata) {
-
+namespace
+{
+int
+handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata)
+{
   // Separating pristine and mutable data helps debugging
   TSEvent event = pristine_event;
   void *edata = pristine_edata;
@@ -331,18 +334,15 @@ int handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata) {
     if (state->plugin_io_done_) { // plugin is done, so can't send it saved event
       event = TS_EVENT_VCONN_EOS; // fake completion
       edata = NULL;
-    }
-    else {
+    } else {
       event = state->saved_event_;
       edata = state->saved_edata_;
     }
   }
   if (state->plugin_) {
     utils::internal::dispatchInterceptEvent(state->plugin_, event, edata);
-  }
-  else if (state->timeout_action_) { // we had scheduled a timeout on ourselves; let's wait for it
-  }
-  else { // plugin was destroyed before intercept was completed; cleaning up here
+  } else if (state->timeout_action_) { // we had scheduled a timeout on ourselves; let's wait for it
+  } else {                             // plugin was destroyed before intercept was completed; cleaning up here
     LOG_DEBUG("Cleaning up as intercept plugin is already destroyed");
     destroyCont(state);
     delete state;
@@ -350,7 +350,9 @@ int handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata) {
   return 0;
 }
 
-void destroyCont(InterceptPlugin::State *state) {
+void
+destroyCont(InterceptPlugin::State *state)
+{
   if (state->net_vc_) {
     TSVConnShutdown(state->net_vc_, 1, 1);
     TSVConnClose(state->net_vc_);
@@ -361,5 +363,4 @@ void destroyCont(InterceptPlugin::State *state) {
     state->cont_ = NULL;
   }
 }
-
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Logger.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Logger.cc b/lib/atscppapi/src/Logger.cc
index 8302a3f..6802e5b 100644
--- a/lib/atscppapi/src/Logger.cc
+++ b/lib/atscppapi/src/Logger.cc
@@ -40,7 +40,7 @@ using atscppapi::Logger;
 /**
  * @private
  */
-struct atscppapi::LoggerState: noncopyable  {
+struct atscppapi::LoggerState : noncopyable {
   std::string filename_;
   bool add_timestamp_;
   bool rename_file_;
@@ -50,12 +50,14 @@ struct atscppapi::LoggerState: noncopyable  {
   TSTextLogObject text_log_obj_;
   bool initialized_;
 
-  LoggerState() : add_timestamp_(false), rename_file_(false), level_(Logger::LOG_LEVEL_NO_LOG), rolling_enabled_(false),
-                  rolling_interval_seconds_(-1), text_log_obj_(NULL), initialized_(false) { };
-  ~LoggerState() { };
+  LoggerState()
+    : add_timestamp_(false), rename_file_(false), level_(Logger::LOG_LEVEL_NO_LOG), rolling_enabled_(false),
+      rolling_interval_seconds_(-1), text_log_obj_(NULL), initialized_(false){};
+  ~LoggerState(){};
 };
 
-namespace {
+namespace
+{
 // Since the TSTextLog API doesn't support override the log file sizes (I will add this to TS api at some point)
 // we will use the roll size specified by default in records.config.
 const int ROLL_ON_TIME = 1; // See RollingEnabledValues in LogConfig.h
@@ -65,11 +67,13 @@ const int ROLL_ON_TIME = 1; // See RollingEnabledValues in LogConfig.h
 /*
  * These have default values specified for add_timestamp and rename_file in Logger.h
  */
-Logger::Logger() {
+Logger::Logger()
+{
   state_ = new LoggerState();
 }
 
-Logger::~Logger() {
+Logger::~Logger()
+{
   if (state_->initialized_ && state_->text_log_obj_) {
     TSTextLogObjectDestroy(state_->text_log_obj_);
   }
@@ -80,9 +84,13 @@ Logger::~Logger() {
 /*
  * These have default values specified for rolling_enabled and rolling_interval_seconds in Logger.h
  */
-bool Logger::init(const string &file, bool add_timestamp, bool rename_file, LogLevel level, bool rolling_enabled, int rolling_interval_seconds) {
+bool
+Logger::init(const string &file, bool add_timestamp, bool rename_file, LogLevel level, bool rolling_enabled,
+             int rolling_interval_seconds)
+{
   if (state_->initialized_) {
-    LOG_ERROR("Attempt to reinitialize a logger named '%s' that's already been initialized to '%s'.", file.c_str(), state_->filename_.c_str());
+    LOG_ERROR("Attempt to reinitialize a logger named '%s' that's already been initialized to '%s'.", file.c_str(),
+              state_->filename_.c_str());
     return false;
   }
   state_->filename_ = file;
@@ -116,21 +124,27 @@ bool Logger::init(const string &file, bool add_timestamp, bool rename_file, LogL
   return result == TS_SUCCESS;
 }
 
-void Logger::setLogLevel(Logger::LogLevel level) {
+void
+Logger::setLogLevel(Logger::LogLevel level)
+{
   if (state_->initialized_) {
     state_->level_ = level;
     LOG_DEBUG("Set log level to %d for log [%s]", level, state_->filename_.c_str());
   }
 }
 
-Logger::LogLevel Logger::getLogLevel() const {
+Logger::LogLevel
+Logger::getLogLevel() const
+{
   if (!state_->initialized_) {
     LOG_ERROR("Not initialized");
   }
   return state_->level_;
 }
 
-void Logger::setRollingIntervalSeconds(int seconds) {
+void
+Logger::setRollingIntervalSeconds(int seconds)
+{
   if (state_->initialized_) {
     state_->rolling_interval_seconds_ = seconds;
     TSTextLogObjectRollingIntervalSecSet(state_->text_log_obj_, seconds);
@@ -140,14 +154,18 @@ void Logger::setRollingIntervalSeconds(int seconds) {
   }
 }
 
-int Logger::getRollingIntervalSeconds() const {
+int
+Logger::getRollingIntervalSeconds() const
+{
   if (!state_->initialized_) {
     LOG_ERROR("Not initialized");
   }
   return state_->rolling_interval_seconds_;
 }
 
-void Logger::setRollingEnabled(bool enabled) {
+void
+Logger::setRollingEnabled(bool enabled)
+{
   if (state_->initialized_) {
     state_->rolling_enabled_ = enabled;
     TSTextLogObjectRollingEnabledSet(state_->text_log_obj_, enabled ? ROLL_ON_TIME : 0);
@@ -157,14 +175,18 @@ void Logger::setRollingEnabled(bool enabled) {
   }
 }
 
-bool Logger::isRollingEnabled() const {
+bool
+Logger::isRollingEnabled() const
+{
   if (!state_->initialized_) {
     LOG_ERROR("Not initialized!");
   }
   return state_->rolling_enabled_;
 }
 
-void Logger::flush() {
+void
+Logger::flush()
+{
   if (state_->initialized_) {
     TSTextLogObjectFlush(state_->text_log_obj_);
   } else {
@@ -172,43 +194,51 @@ void Logger::flush() {
   }
 }
 
-namespace {
-const int DEFAULT_BUFFER_SIZE_FOR_VARARGS = 8*1024;
+namespace
+{
+const int DEFAULT_BUFFER_SIZE_FOR_VARARGS = 8 * 1024;
 
 // We use a macro here because varargs would be a pain to forward via a helper
 // function
-#define TS_TEXT_LOG_OBJECT_WRITE(level) \
-    char buffer[DEFAULT_BUFFER_SIZE_FOR_VARARGS]; \
-    int n; \
-    va_list ap; \
-    while (true) { \
-     va_start(ap, fmt); \
-     n = vsnprintf (&buffer[0], sizeof(buffer), fmt, ap); \
-     va_end(ap); \
-     if (n > -1 && n < static_cast<int>(sizeof(buffer))) { \
-       LOG_DEBUG("logging a " level " to '%s' with length %d", state_->filename_.c_str(), n); \
-       TSTextLogObjectWrite(state_->text_log_obj_, const_cast<char*>("[" level "] %s"), buffer); \
-     } else { \
-       LOG_ERROR("Unable to log " level " message to '%s' due to size exceeding %zu bytes", state_->filename_.c_str(), sizeof(buffer)); \
-     } \
-     return; \
-    }
+#define TS_TEXT_LOG_OBJECT_WRITE(level)                                                                               \
+  char buffer[DEFAULT_BUFFER_SIZE_FOR_VARARGS];                                                                       \
+  int n;                                                                                                              \
+  va_list ap;                                                                                                         \
+  while (true) {                                                                                                      \
+    va_start(ap, fmt);                                                                                                \
+    n = vsnprintf(&buffer[0], sizeof(buffer), fmt, ap);                                                               \
+    va_end(ap);                                                                                                       \
+    if (n > -1 && n < static_cast<int>(sizeof(buffer))) {                                                             \
+      LOG_DEBUG("logging a " level " to '%s' with length %d", state_->filename_.c_str(), n);                          \
+      TSTextLogObjectWrite(state_->text_log_obj_, const_cast<char *>("[" level "] %s"), buffer);                      \
+    } else {                                                                                                          \
+      LOG_ERROR("Unable to log " level " message to '%s' due to size exceeding %zu bytes", state_->filename_.c_str(), \
+                sizeof(buffer));                                                                                      \
+    }                                                                                                                 \
+    return;                                                                                                           \
+  }
 
 } /* end anonymous namespace */
 
-void Logger::logDebug(const char *fmt, ...) {
+void
+Logger::logDebug(const char *fmt, ...)
+{
   if (state_->level_ <= LOG_LEVEL_DEBUG) {
     TS_TEXT_LOG_OBJECT_WRITE("DEBUG");
   }
 }
 
-void Logger::logInfo(const char *fmt, ...) {
+void
+Logger::logInfo(const char *fmt, ...)
+{
   if (state_->level_ <= LOG_LEVEL_INFO) {
     TS_TEXT_LOG_OBJECT_WRITE("INFO");
   }
 }
 
-void Logger::logError(const char *fmt, ...) {
+void
+Logger::logError(const char *fmt, ...)
+{
   if (state_->level_ <= LOG_LEVEL_ERROR) {
     TS_TEXT_LOG_OBJECT_WRITE("ERROR");
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Plugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Plugin.cc b/lib/atscppapi/src/Plugin.cc
index 214d278..9e319e5 100644
--- a/lib/atscppapi/src/Plugin.cc
+++ b/lib/atscppapi/src/Plugin.cc
@@ -21,15 +21,8 @@
  */
 #include "atscppapi/Plugin.h"
 
-const std::string atscppapi::HOOK_TYPE_STRINGS[] = { std::string("HOOK_READ_REQUEST_HEADERS_PRE_REMAP"),
-                                                     std::string("HOOK_READ_REQUEST_HEADERS_POST_REMAP"),
-                                                     std::string("HOOK_SEND_REQUEST_HEADERS"),
-                                                     std::string("HOOK_READ_RESPONSE_HEADERS"),
-                                                     std::string("HOOK_SEND_RESPONSE_HEADERS"),
-                                                     std::string("HOOK_OS_DNS"),
-                                                     std::string("HOOK_READ_REQUEST_HEADERS"),
-                                                     std::string("HOOK_READ_CACHE_HEADERS"),
-                                                     std::string("HOOK_CACHE_LOOKUP_COMPLETE"),
-                                                     std::string("HOOK_SELECT_ALT")
-                                                      };
-
+const std::string atscppapi::HOOK_TYPE_STRINGS[] = {
+  std::string("HOOK_READ_REQUEST_HEADERS_PRE_REMAP"), std::string("HOOK_READ_REQUEST_HEADERS_POST_REMAP"),
+  std::string("HOOK_SEND_REQUEST_HEADERS"), std::string("HOOK_READ_RESPONSE_HEADERS"), std::string("HOOK_SEND_RESPONSE_HEADERS"),
+  std::string("HOOK_OS_DNS"), std::string("HOOK_READ_REQUEST_HEADERS"), std::string("HOOK_READ_CACHE_HEADERS"),
+  std::string("HOOK_CACHE_LOOKUP_COMPLETE"), std::string("HOOK_SELECT_ALT")};

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/RemapPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/RemapPlugin.cc b/lib/atscppapi/src/RemapPlugin.cc
index 9ff07b6..f96597f 100644
--- a/lib/atscppapi/src/RemapPlugin.cc
+++ b/lib/atscppapi/src/RemapPlugin.cc
@@ -27,7 +27,9 @@
 
 using namespace atscppapi;
 
-TSRemapStatus TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo* rri) {
+TSRemapStatus
+TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
+{
   RemapPlugin *remap_plugin = static_cast<RemapPlugin *>(ih);
   Url map_from_url(rri->requestBufp, rri->mapFromUrl), map_to_url(rri->requestBufp, rri->mapToUrl);
   Transaction &transaction = utils::internal::getTransaction(rh);
@@ -51,16 +53,20 @@ TSRemapStatus TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo* rri) {
   }
 }
 
-void TSRemapDeleteInstance(void *ih) {
+void
+TSRemapDeleteInstance(void *ih)
+{
   RemapPlugin *remap_plugin = static_cast<RemapPlugin *>(ih);
   delete remap_plugin;
 }
 
-TSReturnCode TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size) {
+TSReturnCode
+TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
+{
   return TS_SUCCESS;
 }
 
-RemapPlugin::RemapPlugin(void **instance_handle) {
+RemapPlugin::RemapPlugin(void **instance_handle)
+{
   *instance_handle = static_cast<void *>(this);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index 15e3235..6e1166e 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -31,7 +31,7 @@ using std::string;
 /**
  * @private
  */
-struct atscppapi::RequestState: noncopyable  {
+struct atscppapi::RequestState : noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc url_loc_;
@@ -41,21 +41,27 @@ struct atscppapi::RequestState: noncopyable  {
   HttpMethod method_;
   HttpVersion version_;
   bool destroy_buf_;
-  RequestState() : hdr_buf_(NULL), hdr_loc_(NULL), url_loc_(NULL), method_(HTTP_METHOD_UNKNOWN),
-                   version_(HTTP_VERSION_UNKNOWN), destroy_buf_(false) { }
+  RequestState()
+    : hdr_buf_(NULL), hdr_loc_(NULL), url_loc_(NULL), method_(HTTP_METHOD_UNKNOWN), version_(HTTP_VERSION_UNKNOWN),
+      destroy_buf_(false)
+  {
+  }
 };
 
-Request::Request() {
+Request::Request()
+{
   state_ = new RequestState();
 }
 
-Request::Request(void *hdr_buf, void *hdr_loc) {
+Request::Request(void *hdr_buf, void *hdr_loc)
+{
   state_ = new RequestState();
   init(hdr_buf, hdr_loc);
   LOG_DEBUG("Initialized request object %p with hdr_buf=%p and hdr_loc=%p", this, hdr_buf, hdr_loc);
 }
 
-Request::Request(const string &url_str, HttpMethod method, HttpVersion version) {
+Request::Request(const string &url_str, HttpMethod method, HttpVersion version)
+{
   state_ = new RequestState();
   state_->method_ = method;
   state_->version_ = version;
@@ -66,21 +72,21 @@ Request::Request(const string &url_str, HttpMethod method, HttpVersion version)
     const char *url_str_end = url_str_start + url_str.size();
     if (TSUrlParse(state_->hdr_buf_, state_->url_loc_, &url_str_start, url_str_end) != TS_PARSE_DONE) {
       LOG_ERROR("[%s] does not represent a valid url", url_str.c_str());
-    }
-    else {
+    } else {
       state_->url_.init(state_->hdr_buf_, state_->url_loc_);
     }
-  }
-  else {
+  } else {
     state_->url_loc_ = NULL;
     LOG_ERROR("Could not create URL field; hdr_buf %p", state_->hdr_buf_);
   }
 }
 
-void Request::init(void *hdr_buf, void *hdr_loc) {
+void
+Request::init(void *hdr_buf, void *hdr_loc)
+{
   if (state_->hdr_buf_ || state_->hdr_loc_) {
-    LOG_ERROR("Reinitialization; (hdr_buf, hdr_loc) current(%p, %p), attempted(%p, %p)", state_->hdr_buf_,
-              state_->hdr_loc_, hdr_buf, hdr_loc);
+    LOG_ERROR("Reinitialization; (hdr_buf, hdr_loc) current(%p, %p), attempted(%p, %p)", state_->hdr_buf_, state_->hdr_loc_,
+              hdr_buf, hdr_loc);
     return;
   }
   state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
@@ -90,14 +96,15 @@ void Request::init(void *hdr_buf, void *hdr_loc) {
   TSHttpHdrUrlGet(state_->hdr_buf_, state_->hdr_loc_, &state_->url_loc_);
   if (!state_->url_loc_) {
     LOG_ERROR("TSHttpHdrUrlGet returned a null url loc, hdr_buf=%p, hdr_loc=%p", state_->hdr_buf_, state_->hdr_loc_);
-  }
-  else {
+  } else {
     state_->url_.init(state_->hdr_buf_, state_->url_loc_);
     LOG_DEBUG("Initialized url");
   }
 }
 
-HttpMethod Request::getMethod() const {
+HttpMethod
+Request::getMethod() const
+{
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     int method_len;
     const char *method_str = TSHttpHdrMethodGet(state_->hdr_buf_, state_->hdr_loc_, &method_len);
@@ -123,34 +130,42 @@ HttpMethod Request::getMethod() const {
       } else if (method_str == TS_HTTP_METHOD_TRACE) {
         state_->method_ = HTTP_METHOD_TRACE;
       }
-      LOG_DEBUG("Request method=%d [%s] on hdr_buf=%p, hdr_loc=%p",
-          state_->method_, HTTP_METHOD_STRINGS[state_->method_].c_str(), state_->hdr_buf_, state_->hdr_loc_);
+      LOG_DEBUG("Request method=%d [%s] on hdr_buf=%p, hdr_loc=%p", state_->method_, HTTP_METHOD_STRINGS[state_->method_].c_str(),
+                state_->hdr_buf_, state_->hdr_loc_);
     } else {
-      LOG_ERROR("TSHttpHdrMethodGet returned null string or it was zero length, hdr_buf=%p, hdr_loc=%p, method str=%p, method_len=%d",
-          state_->hdr_buf_, state_->hdr_loc_, method_str, method_len);
+      LOG_ERROR(
+        "TSHttpHdrMethodGet returned null string or it was zero length, hdr_buf=%p, hdr_loc=%p, method str=%p, method_len=%d",
+        state_->hdr_buf_, state_->hdr_loc_, method_str, method_len);
     }
   }
   return state_->method_;
 }
 
-Url &Request::getUrl() {
+Url &
+Request::getUrl()
+{
   return state_->url_;
 }
 
-atscppapi::HttpVersion Request::getVersion() const {
+atscppapi::HttpVersion
+Request::getVersion() const
+{
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     state_->version_ = utils::internal::getHttpVersion(state_->hdr_buf_, state_->hdr_loc_);
-    LOG_DEBUG("Request version=%d [%s] on hdr_buf=%p, hdr_loc=%p",
-        state_->version_, HTTP_VERSION_STRINGS[state_->version_].c_str(), state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Request version=%d [%s] on hdr_buf=%p, hdr_loc=%p", state_->version_, HTTP_VERSION_STRINGS[state_->version_].c_str(),
+              state_->hdr_buf_, state_->hdr_loc_);
   }
   return state_->version_;
 }
 
-atscppapi::Headers &Request::getHeaders() const {
+atscppapi::Headers &
+Request::getHeaders() const
+{
   return state_->headers_;
 }
 
-Request::~Request() {
+Request::~Request()
+{
   if (state_->url_loc_) {
     if (state_->destroy_buf_) {
       // usually, hdr_loc is the parent of url_loc, but we created this url_loc "directly" in hdr_buf,
@@ -159,8 +174,8 @@ Request::~Request() {
       TSHandleMLocRelease(state_->hdr_buf_, null_parent_loc, state_->url_loc_);
       TSMBufferDestroy(state_->hdr_buf_);
     } else {
-      LOG_DEBUG("Destroying request object on hdr_buf=%p, hdr_loc=%p, url_loc=%p", state_->hdr_buf_,
-                state_->hdr_loc_, state_->url_loc_);
+      LOG_DEBUG("Destroying request object on hdr_buf=%p, hdr_loc=%p, url_loc=%p", state_->hdr_buf_, state_->hdr_loc_,
+                state_->url_loc_);
       TSHandleMLocRelease(state_->hdr_buf_, state_->hdr_loc_, state_->url_loc_);
     }
   }


[11/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/SimpleTokenizer.h
----------------------------------------------------------------------
diff --git a/lib/ts/SimpleTokenizer.h b/lib/ts/SimpleTokenizer.h
index 929a606..2a5812a 100644
--- a/lib/ts/SimpleTokenizer.h
+++ b/lib/ts/SimpleTokenizer.h
@@ -112,12 +112,10 @@
 class SimpleTokenizer
 {
 public:
-
   // by default, null fields are disregarded, whitespace is trimmed left
   // and right, and input string is copied (not overwritten)
   //
-  enum
-  {
+  enum {
     CONSIDER_NULL_FIELDS = 1,
     KEEP_WHITESPACE_LEFT = 2,
     KEEP_WHITESPACE_RIGHT = 4,
@@ -127,20 +125,20 @@ public:
 
   SimpleTokenizer(char delimiter = ' ', unsigned mode = 0, char escape = '\\')
     : _data(0), _delimiter(delimiter), _mode(mode), _escape(escape), _start(0), _length(0)
-  {  }
+  {
+  }
 
   // NOTE: The input strring 's' is overwritten for mode OVERWRITE_INPUT_STRING.
   SimpleTokenizer(const char *s, char delimiter = ' ', unsigned mode = 0, char escape = '\\')
-  : _data(0), _delimiter(delimiter), _mode(mode), _escape(escape)
+    : _data(0), _delimiter(delimiter), _mode(mode), _escape(escape)
   {
     setString(s);
   }
 
-  ~SimpleTokenizer() {
-    _clearData();
-  }
+  ~SimpleTokenizer() { _clearData(); }
 
-  void setString(const char *s)
+  void
+  setString(const char *s)
   {
     _clearData();
 
@@ -155,69 +153,77 @@ public:
     //
     _data[_length++] = _delimiter;
   };
-  char *getNext(int count = 1) {
+  char *
+  getNext(int count = 1)
+  {
     return _getNext(_delimiter, false, count);
   };
-  char *getNext(char delimiter, int count = 1) {
+  char *
+  getNext(char delimiter, int count = 1)
+  {
     return _getNext(delimiter, false, count);
   }
-  char *getRest()
+  char *
+  getRest()
   {
     // there can't be more than _length tokens, so we get the rest
     // of the tokens by requesting _length of them
     //
     return _getNext(_delimiter, false, _length);
   }
-  size_t getNumTokensRemaining()
+  size_t
+  getNumTokensRemaining()
   {
     return _getNumTokensRemaining(_delimiter);
   };
-  size_t getNumTokensRemaining(char delimiter)
+  size_t
+  getNumTokensRemaining(char delimiter)
   {
     return _getNumTokensRemaining(delimiter);
   };
-  char *peekAtRestOfString()
+  char *
+  peekAtRestOfString()
   {
     _data[_length - 1] = 0;
     return (_start < _length ? &_data[_start] : &_data[_length - 1]);
   }
 
 private:
-
-  char *_data;                  // a pointer to the input data itself,
+  char *_data; // a pointer to the input data itself,
   // or to a copy of it
-  char _delimiter;              // the token delimiter
-  unsigned _mode;                    // flags that determine the
+  char _delimiter; // the token delimiter
+  unsigned _mode;  // flags that determine the
   // mode of operation
-  char _escape;                 // the escape character
-  size_t _start;                // pointer to the start of the next
+  char _escape;  // the escape character
+  size_t _start; // pointer to the start of the next
   // token
-  size_t _length;               // the length of _data
+  size_t _length; // the length of _data
 
-  void _clearData()
+  void
+  _clearData()
   {
     if (_data && !(_mode & OVERWRITE_INPUT_STRING)) {
       ats_free(_data);
     }
   }
 
-  char *_getNext(char delimiter, bool countOnly = false, int numTokens = 1) {
+  char *
+  _getNext(char delimiter, bool countOnly = false, int numTokens = 1)
+  {
     char *next = NULL;
 
     if (_start < _length) {
       // set start
       //
-      bool hasEsc = false;      // escape character seen
+      bool hasEsc = false; // escape character seen
       while (_start < _length &&
              ((!(_mode & CONSIDER_NULL_FIELDS) &&
-               (_data[_start] == delimiter &&
-                !(_start &&
-                  (_data[_start - 1] == _escape ? (hasEsc = true) : 0)))) ||
+               (_data[_start] == delimiter && !(_start && (_data[_start - 1] == _escape ? (hasEsc = true) : 0)))) ||
               (!(_mode & KEEP_WHITESPACE_LEFT) && isspace(_data[_start])))) {
         ++_start;
       }
 
-      if (_start < _length)     // data still available
+      if (_start < _length) // data still available
       {
         // update the extra delimiter just in case the function
         // is called with a different delimiter from the previous one
@@ -230,10 +236,8 @@ private:
         //
         size_t end = _start;
         int delimCount = 0;
-        while (end < _length &&
-               (_data[end] != delimiter ||
-                (end && (_data[end - 1] == _escape ? (hasEsc = true) : 0)) ||
-                ((++delimCount < numTokens) && (end < _length - 1)))) {
+        while (end < _length && (_data[end] != delimiter || (end && (_data[end - 1] == _escape ? (hasEsc = true) : 0)) ||
+                                 ((++delimCount < numTokens) && (end < _length - 1)))) {
           ++end;
         }
 
@@ -244,12 +248,14 @@ private:
         // CONSIDER_NULL_FIELDS flag is not set
         //
         if (!(_mode & CONSIDER_NULL_FIELDS)) {
-          while (_data[--end] == delimiter);
+          while (_data[--end] == delimiter)
+            ;
           ++end;
         }
 
         if (!(_mode & KEEP_WHITESPACE_RIGHT)) {
-          while (isspace(_data[--end]));
+          while (isspace(_data[--end]))
+            ;
           ++end;
         }
 
@@ -277,9 +283,10 @@ private:
     return next;
   };
 
-  size_t _getNumTokensRemaining(char delimiter)
+  size_t
+  _getNumTokensRemaining(char delimiter)
   {
-    size_t startSave = _start;  // save current position
+    size_t startSave = _start; // save current position
     size_t count = 0;
     while (_getNext(delimiter, true)) {
       ++count;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/TestBox.h
----------------------------------------------------------------------
diff --git a/lib/ts/TestBox.h b/lib/ts/TestBox.h
index 0461152..cee6926 100644
--- a/lib/ts/TestBox.h
+++ b/lib/ts/TestBox.h
@@ -1,4 +1,4 @@
-#if ! defined(TS_TEST_BOX_HEADER)
+#if !defined(TS_TEST_BOX_HEADER)
 #define TS_TEST_BOX_HEADER
 
 /** @file
@@ -24,45 +24,50 @@
     limitations under the License.
 */
 
-# include <ts/Regression.h>
+#include <ts/Regression.h>
 
-namespace {
-  /** Class to make handling regression tests easier.
-      This holds the important regression test values so they don't have to
-      be passed repeated.
-  */
-  struct TestBox {
-    typedef TestBox self; ///< Self reference type.
-    RegressionTest* _test; ///< The test object.
-    int* _status; ///< Current status pointer.
+namespace
+{
+/** Class to make handling regression tests easier.
+    This holds the important regression test values so they don't have to
+    be passed repeated.
+*/
+struct TestBox {
+  typedef TestBox self;  ///< Self reference type.
+  RegressionTest *_test; ///< The test object.
+  int *_status;          ///< Current status pointer.
 
-    /// Construct from @a test object and @a status pointer.
-    TestBox(RegressionTest* test, int* status) : _test(test), _status(status) {}
+  /// Construct from @a test object and @a status pointer.
+  TestBox(RegressionTest *test, int *status) : _test(test), _status(status) {}
 
-    /// Construct from @a test object, @a status pointer and @a regression status.
-    TestBox(RegressionTest* test, int* status, int rstatus) : _test(test), _status(status) {
-      *this = rstatus;
-    }
+  /// Construct from @a test object, @a status pointer and @a regression status.
+  TestBox(RegressionTest *test, int *status, int rstatus) : _test(test), _status(status) { *this = rstatus; }
 
-    /// Check the result and print a message on failure.
-    bool check(bool result, char const* fmt, ...) TS_PRINTFLIKE(3, 4);
+  /// Check the result and print a message on failure.
+  bool check(bool result, char const *fmt, ...) TS_PRINTFLIKE(3, 4);
 
-    /// Directly assign status.
-    self& operator = (int status) { *_status = status; return *this; }
-  };
+  /// Directly assign status.
+  self &operator=(int status)
+  {
+    *_status = status;
+    return *this;
+  }
+};
 
-  bool TestBox::check(bool result, char const* fmt, ...) {
-    if (!result) {
-      static size_t const N = 1<<16;
-      char buffer[N]; // just stack, go big.
-      va_list ap;
-      va_start(ap, fmt);
-      vsnprintf(buffer, N, fmt, ap);
-      va_end(ap);
-      rprintf(_test, "%s\n", buffer);
-      *_status = REGRESSION_TEST_FAILED;
-    }
-    return result;
+bool
+TestBox::check(bool result, char const *fmt, ...)
+{
+  if (!result) {
+    static size_t const N = 1 << 16;
+    char buffer[N]; // just stack, go big.
+    va_list ap;
+    va_start(ap, fmt);
+    vsnprintf(buffer, N, fmt, ap);
+    va_end(ap);
+    rprintf(_test, "%s\n", buffer);
+    *_status = REGRESSION_TEST_FAILED;
   }
+  return result;
+}
 }
 #endif // TS_TEST_BOX_HEADER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/TestHttpHeader.cc
----------------------------------------------------------------------
diff --git a/lib/ts/TestHttpHeader.cc b/lib/ts/TestHttpHeader.cc
index e722d77..3a03bb9 100644
--- a/lib/ts/TestHttpHeader.cc
+++ b/lib/ts/TestHttpHeader.cc
@@ -48,7 +48,7 @@
 #include <sys/stat.h>
 
 static void
-add_field(HttpHeader * h, const char *name, const char *value)
+add_field(HttpHeader *h, const char *name, const char *value)
 {
   h->m_header_fields.set_raw_header_field(name, value);
 }
@@ -59,7 +59,7 @@ add_field(HttpHeader * h, const char *name, const char *value)
 //
 /////////////////////////////////////////////////////////////
 static void
-test_add_fields(HttpHeader * h)
+test_add_fields(HttpHeader *h)
 {
   char long_accept_header[2048];
   memset(long_accept_header, 'B', sizeof(long_accept_header));
@@ -130,8 +130,12 @@ void
 test_url()
 {
   test_url_parse("http://charm.example.com  ");
-  test_url_parse
-    ("http://webchat16.wbs.net:6666?private=herbalessences&color=4&volume=0&tagline=&picture=&home_page=hi@there.&ignore=edheldinruth+taz0069+speezman&back=&Room=Hot_Tub&handle=cagou67&mu=893e159ef7fe0ddb022c655cc1c30abd33d4ae6d90d22f8a&last_read_para=&npo=&fsection=input&chatmode=push&reqtype=input&InputText=Sweetie%2C+do+you+have+time+to+go+to+a+private+room..if+not+I%27m+just+going+to+have+to+change+to+normal+mode...let+me+know%3F%3F/");
+  test_url_parse("http://"
+                 "webchat16.wbs.net:6666?private=herbalessences&color=4&volume=0&tagline=&picture=&home_page=hi@there.&ignore="
+                 "edheldinruth+taz0069+speezman&back=&Room=Hot_Tub&handle=cagou67&mu="
+                 "893e159ef7fe0ddb022c655cc1c30abd33d4ae6d90d22f8a&last_read_para=&npo=&fsection=input&chatmode=push&reqtype=input&"
+                 "InputText=Sweetie%2C+do+you+have+time+to+go+to+a+private+room..if+not+I%27m+just+going+to+have+to+change+to+"
+                 "normal+mode...let+me+know%3F%3F/");
 
   return;
 }
@@ -161,9 +165,14 @@ test_header_tokenizer_run(const char *buf, HttpMessageType_t message_type)
 void
 test_header_tokenizer()
 {
-  test_header_tokenizer_run
-    ("GET http://webchat16.wbs.net:6666?private=herbalessences&color=4&volume=0&tagline=&picture=&home_page=hi@there.&ignore=edheldinruth+taz0069+speezman&back=&Room=Hot_Tub&handle=cagou67&mu=893e159ef7fe0ddb022c655cc1c30abd33d4ae6d90d22f8a&last_read_para=&npo=&fsection=input&chatmode=push&reqtype=input&InputText=Sweetie%2C+do+you+have+time+to+go+to+a+private+room..if+not+I%27m+just+going+to+have+to+change+to+normal+mode...let+me+know%3F%3F/ HTTP/1.0\r\n",
-     HTTP_MESSAGE_TYPE_REQUEST);
+  test_header_tokenizer_run("GET "
+                            "http://"
+                            "webchat16.wbs.net:6666?private=herbalessences&color=4&volume=0&tagline=&picture=&home_page=hi@there.&"
+                            "ignore=edheldinruth+taz0069+speezman&back=&Room=Hot_Tub&handle=cagou67&mu="
+                            "893e159ef7fe0ddb022c655cc1c30abd33d4ae6d90d22f8a&last_read_para=&npo=&fsection=input&chatmode=push&"
+                            "reqtype=input&InputText=Sweetie%2C+do+you+have+time+to+go+to+a+private+room..if+not+I%27m+just+going+"
+                            "to+have+to+change+to+normal+mode...let+me+know%3F%3F/ HTTP/1.0\r\n",
+                            HTTP_MESSAGE_TYPE_REQUEST);
 
   return;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/TextBuffer.cc
----------------------------------------------------------------------
diff --git a/lib/ts/TextBuffer.cc b/lib/ts/TextBuffer.cc
index 374892a..b41fbce 100644
--- a/lib/ts/TextBuffer.cc
+++ b/lib/ts/TextBuffer.cc
@@ -38,7 +38,6 @@ textBuffer::textBuffer(int size)
   nextAdd = NULL;
   currentSize = spaceLeft = 0;
   if (size > 0) {
-
     // Insitute a minimum size
     if (size < 1024) {
       size = 1024;
@@ -47,7 +46,7 @@ textBuffer::textBuffer(int size)
     bufferStart = (char *)ats_malloc(size);
     nextAdd = bufferStart;
     currentSize = size;
-    spaceLeft = size - 1;     // Leave room for a terminator;
+    spaceLeft = size - 1; // Leave room for a terminator;
     nextAdd[0] = '\0';
   }
 }
@@ -60,7 +59,7 @@ textBuffer::~textBuffer()
 char *
 textBuffer::release()
 {
-  char * ret = bufferStart;
+  char *ret = bufferStart;
 
   bufferStart = nextAdd = NULL;
   currentSize = spaceLeft = 0;
@@ -94,7 +93,6 @@ textBuffer::reUse()
 int
 textBuffer::copyFrom(const void *source, unsigned num_bytes)
 {
-
   // Get more space if necessary
   if (spaceLeft < num_bytes) {
     if (enlargeBuffer(num_bytes) == -1) {
@@ -128,7 +126,6 @@ textBuffer::enlargeBuffer(unsigned N)
   char *newSpace;
 
   if (spaceLeft < N) {
-
     while ((newSize - currentSize) < N) {
       newSize *= 2;
     }
@@ -137,7 +134,7 @@ textBuffer::enlargeBuffer(unsigned N)
 
     newSpace = (char *)ats_realloc(bufferStart, newSize);
     if (newSpace != NULL) {
-      nextAdd = newSpace + (unsigned) (nextAdd - bufferStart);
+      nextAdd = newSpace + (unsigned)(nextAdd - bufferStart);
       bufferStart = newSpace;
       spaceLeft += addedSize;
       currentSize = newSize;
@@ -173,7 +170,7 @@ textBuffer::rawReadFromFile(int fd)
 
   readSize = read(fd, nextAdd, spaceLeft - 1);
 
-  if (readSize == 0) {          //EOF
+  if (readSize == 0) { // EOF
     return 0;
   } else if (readSize < 0) {
     // Error on read
@@ -237,7 +234,7 @@ textBuffer::bufPtr()
 }
 
 void
-textBuffer::format(const char * fmt, ...)
+textBuffer::format(const char *fmt, ...)
 {
   va_list ap;
   bool done = false;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/TextBuffer.h
----------------------------------------------------------------------
diff --git a/lib/ts/TextBuffer.h b/lib/ts/TextBuffer.h
index 2dae20b..b9bf0a7 100644
--- a/lib/ts/TextBuffer.h
+++ b/lib/ts/TextBuffer.h
@@ -39,26 +39,40 @@ class textBuffer
 {
 public:
   inkcoreapi textBuffer(int size);
-  inkcoreapi ~ textBuffer();
+  inkcoreapi ~textBuffer();
   int rawReadFromFile(int fd);
   int readFromFD(int fd);
   inkcoreapi int copyFrom(const void *, unsigned num_bytes);
   void reUse();
   inkcoreapi char *bufPtr();
 
-  void clear() { this->reUse(); }
-  void resize(unsigned nbytes) { this->enlargeBuffer(nbytes); }
+  void
+  clear()
+  {
+    this->reUse();
+  }
+  void
+  resize(unsigned nbytes)
+  {
+    this->enlargeBuffer(nbytes);
+  }
 
-  size_t spaceUsed() const {
-    return (size_t) (nextAdd - bufferStart);
+  size_t
+  spaceUsed() const
+  {
+    return (size_t)(nextAdd - bufferStart);
   };
 
   void chomp();
   void slurp(int);
-  bool empty() const { return this->spaceUsed() == 0; }
-  void format(const char * fmt, ...) TS_PRINTFLIKE(2, 3);
+  bool
+  empty() const
+  {
+    return this->spaceUsed() == 0;
+  }
+  void format(const char *fmt, ...) TS_PRINTFLIKE(2, 3);
 
-  char * release();
+  char *release();
 
 private:
   textBuffer(const textBuffer &);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Tokenizer.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Tokenizer.cc b/lib/ts/Tokenizer.cc
index b4c039d..b2a6f21 100644
--- a/lib/ts/Tokenizer.cc
+++ b/lib/ts/Tokenizer.cc
@@ -33,7 +33,7 @@
  *
  *
  *
- ****************************************************************************/        /* MAGIC_EDITING_TAG */
+ ****************************************************************************/ /* MAGIC_EDITING_TAG */
 
 Tokenizer::Tokenizer(const char *StrOfDelimiters)
 {
@@ -42,7 +42,7 @@ Tokenizer::Tokenizer(const char *StrOfDelimiters)
   if (StrOfDelimiters == NULL) {
     strOfDelimit = NULL;
   } else {
-    length = (int) (strlen(StrOfDelimiters) + 1);
+    length = (int)(strlen(StrOfDelimiters) + 1);
     strOfDelimit = new char[length];
     memcpy(strOfDelimit, StrOfDelimiters, length);
   }
@@ -61,15 +61,15 @@ Tokenizer::Tokenizer(const char *StrOfDelimiters)
 Tokenizer::~Tokenizer()
 {
   bool root = true;
-  tok_node *cur = &start_node;;
+  tok_node *cur = &start_node;
+  ;
   tok_node *next = NULL;
 
   if (strOfDelimit != NULL) {
-    delete[]strOfDelimit;
+    delete[] strOfDelimit;
   }
 
   while (cur != NULL) {
-
     if (options & COPY_TOKS) {
       for (int i = 0; i < TOK_NODE_ELEMENTS; i++)
         ats_free(cur->el[i]);
@@ -88,7 +88,7 @@ Tokenizer::~Tokenizer()
 unsigned
 Tokenizer::Initialize(const char *str)
 {
-  return Initialize((char *) str, COPY_TOKS);
+  return Initialize((char *)str, COPY_TOKS);
 }
 
 inline int
@@ -145,7 +145,6 @@ Tokenizer::Initialize(char *str, unsigned opt)
   tokStart = str;
 
   while (*str != '\0') {
-
     // Check to see if we've run to maxToken limit
     if (tok_count + 1 == maxTokens) {
       max_limit_hit = true;
@@ -162,7 +161,7 @@ Tokenizer::Initialize(char *str, unsigned opt)
     //          to skip past repeated delimiters
     if (options & ALLOW_EMPTY_TOKS) {
       if (isDelimiter(*str)) {
-        addToken(tokStart, (int) (str - tokStart));
+        addToken(tokStart, (int)(str - tokStart));
         tok_count++;
         tokStart = str + 1;
         priorCharWasDelimit = 1;
@@ -174,7 +173,7 @@ Tokenizer::Initialize(char *str, unsigned opt)
       if (isDelimiter(*str)) {
         if (priorCharWasDelimit == 0) {
           // This is a word end, so add it
-          addToken(tokStart, (int) (str - tokStart));
+          addToken(tokStart, (int)(str - tokStart));
           tok_count++;
         }
         priorCharWasDelimit = 1;
@@ -193,19 +192,18 @@ Tokenizer::Initialize(char *str, unsigned opt)
 
   // Check to see if we stoped due to a maxToken limit
   if (max_limit_hit == true) {
-
     if (options & ALLOW_EMPTY_TOKS) {
-
       // Go till either we hit a delimiter or we've
       //   come to the end of the string, then
       //   set for copying
-      for (; *str != '\0' && !isDelimiter(*str); str++);
+      for (; *str != '\0' && !isDelimiter(*str); str++)
+        ;
       priorCharWasDelimit = 0;
 
     } else {
-
       // First, skip the delimiters
-      for (; *str != '\0' && isDelimiter(*str); str++);
+      for (; *str != '\0' && isDelimiter(*str); str++)
+        ;
 
       // If there are only delimiters remaining, bail and set
       //   so that we do not add the empty token
@@ -217,10 +215,12 @@ Tokenizer::Initialize(char *str, unsigned opt)
         priorCharWasDelimit = 0;
 
         // Advance until the end of the string
-        for (; *str != '\0'; str++);
+        for (; *str != '\0'; str++)
+          ;
 
         // Now back off all trailing delimiters
-        for (; isDelimiter(*(str - 1)); str--);
+        for (; isDelimiter(*(str - 1)); str--)
+          ;
       }
     }
   }
@@ -230,7 +230,7 @@ Tokenizer::Initialize(char *str, unsigned opt)
   //  only have gotten it if the string ended with a delimiter
   if (priorCharWasDelimit == 0) {
     // We did not get it
-    addToken(tokStart, (int) (str - tokStart));
+    addToken(tokStart, (int)(str - tokStart));
     tok_count++;
   }
 
@@ -271,10 +271,9 @@ Tokenizer::addToken(char *startAddr, int length)
 }
 
 
-const char *
-Tokenizer::operator[] (unsigned index) const
+const char *Tokenizer::operator[](unsigned index) const
 {
-  const tok_node * cur_node = &start_node;
+  const tok_node *cur_node = &start_node;
   unsigned cur_start = 0;
 
   if (index >= numValidTokens) {
@@ -296,7 +295,7 @@ Tokenizer::count() const
 }
 
 const char *
-Tokenizer::iterFirst(tok_iter_state * state)
+Tokenizer::iterFirst(tok_iter_state *state)
 {
   state->node = &start_node;
   state->index = -1;
@@ -304,9 +303,10 @@ Tokenizer::iterFirst(tok_iter_state * state)
 }
 
 const char *
-Tokenizer::iterNext(tok_iter_state * state)
+Tokenizer::iterNext(tok_iter_state *state)
 {
-  tok_node *node = state->node;;
+  tok_node *node = state->node;
+  ;
   int index = state->index;
 
   index++;
@@ -329,7 +329,6 @@ Tokenizer::iterNext(tok_iter_state * state)
 }
 
 
-
 void
 Tokenizer::Print()
 {
@@ -338,7 +337,6 @@ Tokenizer::Print()
   int count = 0;
 
   while (cur_node != NULL) {
-
     if (cur_node->el[node_index] != NULL) {
       printf("Token %d : |%s|\n", count, cur_node->el[node_index]);
       count++;
@@ -376,22 +374,16 @@ Tokenizer::ReUse()
 #if TS_HAS_TESTS
 #include "TestBox.h"
 
-REGRESSION_TEST(libts_Tokenizer) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)
+REGRESSION_TEST(libts_Tokenizer)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
 {
   TestBox box(test, pstatus);
   box = REGRESSION_TEST_PASSED;
 
   Tokenizer remap(" \t");
 
-  const char * line = "map https://abc.com https://abc.com @plugin=conf_remap.so @pparam=proxy.config.abc='ABC DEF'";
+  const char *line = "map https://abc.com https://abc.com @plugin=conf_remap.so @pparam=proxy.config.abc='ABC DEF'";
 
-  const char * toks[] = {
-    "map",
-    "https://abc.com",
-    "https://abc.com",
-    "@plugin=conf_remap.so",
-    "@pparam=proxy.config.abc='ABC DEF'"
-  };
+  const char *toks[] = {"map", "https://abc.com", "https://abc.com", "@plugin=conf_remap.so", "@pparam=proxy.config.abc='ABC DEF'"};
 
   unsigned count = remap.Initialize(const_cast<char *>(line), (COPY_TOKS | ALLOW_SPACES));
 
@@ -399,8 +391,7 @@ REGRESSION_TEST(libts_Tokenizer) (RegressionTest * test, int /* atype ATS_UNUSED
   box.check(count == remap.count(), "parsed %u tokens, but now we have %u tokens", count, remap.count());
 
   for (unsigned i = 0; i < count; ++i) {
-    box.check(strcmp(remap[i], toks[i]) == 0, "expected token %u to be '%s' but found '%s'",
-        count, toks[i], remap[i]);
+    box.check(strcmp(remap[i], toks[i]) == 0, "expected token %u to be '%s' but found '%s'", count, toks[i], remap[i]);
   }
 }
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Tokenizer.h
----------------------------------------------------------------------
diff --git a/lib/ts/Tokenizer.h b/lib/ts/Tokenizer.h
index 81ac7cf..8157458 100644
--- a/lib/ts/Tokenizer.h
+++ b/lib/ts/Tokenizer.h
@@ -104,21 +104,19 @@
 
 #include "ink_apidefs.h"
 
-#define COPY_TOKS         (1u << 0)
-#define SHARE_TOKS        (1u << 1)
-#define ALLOW_EMPTY_TOKS  (1u << 2)
-#define ALLOW_SPACES      (1u << 3)
+#define COPY_TOKS (1u << 0)
+#define SHARE_TOKS (1u << 1)
+#define ALLOW_EMPTY_TOKS (1u << 2)
+#define ALLOW_SPACES (1u << 3)
 
-#define TOK_NODE_ELEMENTS  16
+#define TOK_NODE_ELEMENTS 16
 
-struct tok_node
-{
+struct tok_node {
   char *el[TOK_NODE_ELEMENTS];
   tok_node *next;
 };
 
-struct tok_iter_state
-{
+struct tok_iter_state {
   tok_node *node;
   int index;
 };
@@ -130,25 +128,29 @@ public:
   inkcoreapi ~Tokenizer();
 
   unsigned Initialize(char *str, unsigned options);
-  inkcoreapi unsigned Initialize(const char *str);   // Automatically sets option to copy
-  const char * operator[] (unsigned index) const;
+  inkcoreapi unsigned Initialize(const char *str); // Automatically sets option to copy
+  const char *operator[](unsigned index) const;
 
-  void setMaxTokens(unsigned max) {
+  void
+  setMaxTokens(unsigned max)
+  {
     maxTokens = max;
   };
 
-  unsigned getMaxTokens() const {
+  unsigned
+  getMaxTokens() const
+  {
     return maxTokens;
   };
 
   unsigned count() const;
-  void Print();                 // Debugging print out
+  void Print(); // Debugging print out
 
-  inkcoreapi const char *iterFirst(tok_iter_state * state);
-  inkcoreapi const char *iterNext(tok_iter_state * state);
+  inkcoreapi const char *iterFirst(tok_iter_state *state);
+  inkcoreapi const char *iterNext(tok_iter_state *state);
 
 private:
-  Tokenizer & operator=(const Tokenizer &);
+  Tokenizer &operator=(const Tokenizer &);
   Tokenizer(const Tokenizer &);
   int isDelimiter(char c);
   void addToken(char *startAddr, int length);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Trie.h
----------------------------------------------------------------------
diff --git a/lib/ts/Trie.h b/lib/ts/Trie.h
index 5bf766d..0a8fa79 100644
--- a/lib/ts/Trie.h
+++ b/lib/ts/Trie.h
@@ -31,25 +31,25 @@
 
 // Note that you should provide the class to use here, but we'll store
 // pointers to such objects internally.
-template<typename T>
-class Trie
+template <typename T> class Trie
 {
 public:
-  Trie()
-    {
-      m_root.Clear();
-    }
+  Trie() { m_root.Clear(); }
 
   // will return false for duplicates; key should be NULL-terminated
   // if key_len is defaulted to -1
   bool Insert(const char *key, T *value, int rank, int key_len = -1);
 
   // will return false if not found; else value_ptr will point to found value
-  T* Search(const char *key, int key_len = -1) const;
+  T *Search(const char *key, int key_len = -1) const;
   void Clear();
   void Print();
 
-  bool Empty() const { return m_value_list.empty(); }
+  bool
+  Empty() const
+  {
+    return m_value_list.empty();
+  }
 
   virtual ~Trie() { Clear(); }
 
@@ -59,11 +59,13 @@ private:
   class Node
   {
   public:
-    T* value;
+    T *value;
     bool occupied;
     int rank;
 
-    void Clear() {
+    void
+    Clear()
+    {
       value = NULL;
       occupied = false;
       rank = 0;
@@ -71,11 +73,17 @@ private:
     }
 
     void Print(const char *debug_tag) const;
-    inline Node* GetChild(char index) const { return children[static_cast<unsigned char>(index)]; }
-    inline Node* AllocateChild(char index) {
-      Node * &child = children[static_cast<unsigned char>(index)];
+    inline Node *
+    GetChild(char index) const
+    {
+      return children[static_cast<unsigned char>(index)];
+    }
+    inline Node *
+    AllocateChild(char index)
+    {
+      Node *&child = children[static_cast<unsigned char>(index)];
       ink_assert(child == NULL);
-      child = static_cast<Node*>(ats_malloc(sizeof(Node)));
+      child = static_cast<Node *>(ats_malloc(sizeof(Node)));
       child->Clear();
       return child;
     }
@@ -92,25 +100,24 @@ private:
 
   // make copy-constructor and assignment operator private
   // till we properly implement them
-  Trie(const Trie<T> &rhs) { };
-  Trie &operator =(const Trie<T> &rhs) { return *this; }
+  Trie(const Trie<T> &rhs){};
+  Trie &operator=(const Trie<T> &rhs) { return *this; }
 };
 
-template<typename T>
+template <typename T>
 void
 Trie<T>::_CheckArgs(const char *key, int &key_len) const
 {
   if (!key) {
     key_len = 0;
-  }
-  else if (key_len == -1) {
+  } else if (key_len == -1) {
     key_len = strlen(key);
   }
 }
 
-template<typename T>
+template <typename T>
 bool
-Trie<T>::Insert(const char *key, T* value, int rank, int key_len /* = -1 */)
+Trie<T>::Insert(const char *key, T *value, int rank, int key_len /* = -1 */)
 {
   _CheckArgs(key, key_len);
 
@@ -154,8 +161,8 @@ Trie<T>::Insert(const char *key, T* value, int rank, int key_len /* = -1 */)
   return true;
 }
 
-template<typename T>
-T*
+template <typename T>
+T *
 Trie<T>::Search(const char *key, int key_len /* = -1 */) const
 {
   _CheckArgs(key, key_len);
@@ -190,7 +197,7 @@ Trie<T>::Search(const char *key, int key_len /* = -1 */) const
 }
 
 
-template<typename T>
+template <typename T>
 void
 Trie<T>::_Clear(Node *node)
 {
@@ -205,11 +212,11 @@ Trie<T>::_Clear(Node *node)
   }
 }
 
-template<typename T>
+template <typename T>
 void
 Trie<T>::Clear()
 {
-  T* iter;
+  T *iter;
   while (NULL != (iter = m_value_list.pop()))
     delete iter;
 
@@ -217,15 +224,15 @@ Trie<T>::Clear()
   m_root.Clear();
 }
 
-template<typename T>
+template <typename T>
 void
-Trie<T>::Print() {
+Trie<T>::Print()
+{
   // The class we contain must provide a ::Print() method.
-  forl_LL(T, iter, m_value_list)
-    iter->Print();
+  forl_LL(T, iter, m_value_list) iter->Print();
 }
 
-template<typename T>
+template <typename T>
 void
 Trie<T>::Node::Print(const char *debug_tag) const
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/TsBuffer.h
----------------------------------------------------------------------
diff --git a/lib/ts/TsBuffer.h b/lib/ts/TsBuffer.h
index 006c821..4da12ff 100644
--- a/lib/ts/TsBuffer.h
+++ b/lib/ts/TsBuffer.h
@@ -1,5 +1,5 @@
-# if ! defined TS_BUFFER_HEADER
-# define TS_BUFFER_HEADER
+#if !defined TS_BUFFER_HEADER
+#define TS_BUFFER_HEADER
 
 /** @file
     Definitions for a buffer type, to carry a reference to a chunk of memory.
@@ -26,376 +26,483 @@
     limitations under the License.
  */
 
-# if defined _MSC_VER
-# include <stddef.h>
-# else
-# include <unistd.h>
-# endif
+#if defined _MSC_VER
+#include <stddef.h>
+#else
+#include <unistd.h>
+#endif
 
 // For memcmp()
-# include <memory.h>
+#include <memory.h>
 
 /// Apache Traffic Server commons.
-namespace ts {
-  struct ConstBuffer;
-  /** A chunk of writable memory.
-      A convenience class because we pass this kind of pair frequently.
-
-      @note The default construct leaves the object
-      uninitialized. This is for performance reasons. To construct an
-      empty @c Buffer use @c Buffer(0).
-   */
-  struct Buffer {
-    typedef Buffer self; ///< Self reference type.
-    typedef bool (self::*pseudo_bool)() const;
-
-    char * _ptr; ///< Pointer to base of memory chunk.
-    size_t _size; ///< Size of memory chunk.
-
-    /// Default constructor (empty buffer).
-    Buffer();
-
-    /** Construct from pointer and size.
-	@note Due to ambiguity issues do not call this with
-	two arguments if the first argument is 0.
-     */
-    Buffer(
-      char* ptr, ///< Pointer to buffer.
-      size_t n  ///< Size of buffer.
-    );
-    /** Construct from two pointers.
-	@note This presumes a half open range, (start, end]
-    */
-    Buffer(
-     char* start, ///< First valid character.
-     char* end ///< First invalid character.
-    );
-
-    /** Equality.
-        @return @c true if @a that refers to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator == (self const& that) const;
-    /** Inequality.
-        @return @c true if @a that does not refer to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator != (self const& that) const;
-    /** Equality for a constant buffer.
-        @return @c true if @a that refers to the same memory as @a this.
-        @c false otherwise.
-     */
-    bool operator == (ConstBuffer const& that) const;
-    /** Inequality.
-        @return @c true if @a that does not refer to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator != (ConstBuffer const& that) const;
-
-    /// @return The first character in the buffer.
-    char operator* () const;
-    /** Discard the first character in the buffer.
-        @return @a this object.
-    */
-    self& operator++();
-
-    /// Check for empty buffer.
-    /// @return @c true if the buffer has a zero pointer @b or size.
-    bool operator ! () const;
-    /// Check for non-empty buffer.
-    /// @return @c true if the buffer has a non-zero pointer @b and size.
-    operator pseudo_bool() const;
-
-    /// @name Accessors.
-    //@{
-    /// Get the data in the buffer.
-    char* data() const;
-    /// Get the size of the buffer.
-    size_t size() const;
-    //@}
-
-    /// Set the chunk.
-    /// Any previous values are discarded.
-    /// @return @c this object.
-    self& set(
-      char* ptr, ///< Buffer address.
-      size_t n = 0 ///< Buffer size.
-    );
-    /// Reset to empty.
-    self& reset();
-  };
-
-  /** A chunk of read only memory.
-      A convenience class because we pass this kind of pair frequently.
-   */
-  struct ConstBuffer {
-    typedef ConstBuffer self; ///< Self reference type.
-    typedef bool (self::*pseudo_bool)() const;
-
-    char const * _ptr; ///< Pointer to base of memory chunk.
-    size_t _size; ///< Size of memory chunk.
-
-    /// Default constructor (empty buffer).
-    ConstBuffer();
-
-    /** Construct from pointer and size.
-     */
-    ConstBuffer(
-      char const * ptr, ///< Pointer to buffer.
-      size_t n ///< Size of buffer.
-    );
-    /** Construct from two pointers.
-	@note This presumes a half open range (start, end]
-	@note Due to ambiguity issues do not invoke this with
-	@a start == 0.
-    */
-    ConstBuffer(
-      char const* start, ///< First valid character.
-      char const* end ///< First invalid character.
-    );
-    /// Construct from writable buffer.
-    ConstBuffer(
-      Buffer const& buffer ///< Buffer to copy.
-    );
-
-    /** Equality.
-        @return @c true if @a that refers to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator == (self const& that) const;
-    /** Equality.
-        @return @c true if @a that refers to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator == (Buffer const& that) const;
-    /** Inequality.
-        @return @c true if @a that does not refer to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator != (self const& that) const;
-    /** Inequality.
-        @return @c true if @a that does not refer to the same memory as @a this,
-        @c false otherwise.
-     */
-    bool operator != (Buffer const& that) const;
-    /// Assign from non-const Buffer.
-    self& operator = (
-        Buffer const& that ///< Source buffer.
-    );
-
-    /// @return The first character in the buffer.
-    char operator* () const;
-    /** Discard the first character in the buffer.
-        @return @a this object.
-    */
-    self& operator++();
-    /** Discard the first @a n characters.
-	@return @a this object.
-    */
-    self& operator += (size_t n);
-
-    /// Check for empty buffer.
-    /// @return @c true if the buffer has a zero pointer @b or size.
-    bool operator ! () const;
-    /// Check for non-empty buffer.
-    /// @return @c true if the buffer has a non-zero pointer @b and size.
-    operator pseudo_bool() const;
-
-    /// @name Accessors.
-    //@{
-    /// Get the data in the buffer.
-    char const * data() const;
-    /// Get the size of the buffer.
-    size_t size() const;
-    /// Access a character (no bounds check).
-    char operator[] (int n) const;
-    //@}
-    /// @return @c true if @a p points at a character in @a this.
-    bool contains(char const* p) const;
-
-    /// Set the chunk.
-    /// Any previous values are discarded.
-    /// @return @c this object.
-    self& set(
-      char const * ptr, ///< Buffer address.
-      size_t n = 0 ///< Buffer size.
-    );
-    /** Set from 2 pointers.
-	@note This presumes a half open range (start, end]
-    */
-    self& set(
-	   char const* start, ///< First valid character.
-	   char const* end ///< First invalid character.
-	   );
-    /// Reset to empty.
-    self& reset();
-
-    /** Find a character.
-        @return A pointer to the first occurrence of @a c in @a this
-        or @c NULL if @a c is not found.
-    */
-    char const* find(char c) const;
-
-    /** Split the buffer on the character at @a p.
-
-        The buffer is split in to two parts and the character at @a p
-        is discarded. @a this retains all data @b after @a p. The
-        initial part of the buffer is returned. Neither buffer will
-        contain the character at @a p.
-
-        This is convenient when tokenizing and @a p points at the token
-        separator.
-
-        @note If @a *p is not in the buffer then @a this is not changed
-        and an empty buffer is returned. This means the caller can
-        simply pass the result of @c find and check for an empty
-        buffer returned to detect no more separators.
-
-        @return A buffer containing data up to but not including @a p.
-    */
-    self splitOn(char const* p);
-
-    /** Split the buffer on the character @a c.
-
-        The buffer is split in to two parts and the occurrence of @a c
-        is discarded. @a this retains all data @b after @a c. The
-        initial part of the buffer is returned. Neither buffer will
-        contain the first occurrence of @a c.
-
-        This is convenient when tokenizing and @a c is the token
-        separator.
-
-        @note If @a c is not found then @a this is not changed and an
-        empty buffer is returned.
-
-        @return A buffer containing data up to but not including @a p.
-    */
-    self splitOn(char c);
-    /** Get a trailing segment of the buffer.
-
-        @return A buffer that contains all data after @a p.
-    */
-    self after(char const* p) const;
-    /** Get a trailing segment of the buffer.
-
-        @return A buffer that contains all data after the first
-        occurrence of @a c.
-    */
-    self after(char c) const;
-    /** Remove trailing segment.
-
-        Data at @a p and beyond is removed from the buffer.
-        If @a p is not in the buffer, no change is made.
-
-        @return @a this.
-    */
-    self& clip(char const* p);
-  };
-
-  // ----------------------------------------------------------
-  // Inline implementations.
-
-  inline Buffer::Buffer() : _ptr(NULL), _size(0) { }
-  inline Buffer::Buffer(char* ptr, size_t n) : _ptr(ptr), _size(n) { }
-  inline Buffer& Buffer::set(char* ptr, size_t n) { _ptr = ptr; _size = n; return *this; }
-  inline Buffer::Buffer(char* start, char* end) : _ptr(start), _size(end - start) { }
-  inline Buffer& Buffer::reset() { _ptr = 0; _size = 0 ; return *this; }
-  inline bool Buffer::operator != (self const& that) const { return ! (*this == that); }
-  inline bool Buffer::operator != (ConstBuffer const& that) const { return ! (*this == that); }
-  inline bool Buffer::operator == (self const& that) const {
-    return _size == that._size &&  _ptr == that._ptr;
-  }
-  inline bool Buffer::operator == (ConstBuffer const& that) const {
-    return _size == that._size &&  _ptr == that._ptr;
-  }
-  inline bool Buffer::operator ! () const { return !(_ptr && _size); }
-  inline Buffer::operator pseudo_bool() const { return _ptr && _size ? &self::operator! : 0; }
-  inline char Buffer::operator * () const { return *_ptr; }
-  inline Buffer& Buffer::operator++ () {
-    ++_ptr;
-    --_size;
-    return *this;
-  }
-  inline char * Buffer::data() const { return _ptr; }
-  inline size_t Buffer::size() const { return _size; }
-
-  inline ConstBuffer::ConstBuffer() : _ptr(NULL), _size(0) { }
-  inline ConstBuffer::ConstBuffer(char const* ptr, size_t n) : _ptr(ptr), _size(n) { }
-  inline ConstBuffer::ConstBuffer(char const* start, char const* end) : _ptr(start), _size(end - start) { }
-  inline ConstBuffer::ConstBuffer(Buffer const& that) : _ptr(that._ptr), _size(that._size) { }
-  inline ConstBuffer& ConstBuffer::set(char const* ptr, size_t n) { _ptr = ptr; _size = n; return *this; }
-
-  inline ConstBuffer& ConstBuffer::set(char const* start, char const* end) {
-    _ptr = start;
-    _size = end - start;
-    return *this;
-  }
+namespace ts
+{
+struct ConstBuffer;
+/** A chunk of writable memory.
+    A convenience class because we pass this kind of pair frequently.
+
+    @note The default construct leaves the object
+    uninitialized. This is for performance reasons. To construct an
+    empty @c Buffer use @c Buffer(0).
+ */
+struct Buffer {
+  typedef Buffer self; ///< Self reference type.
+  typedef bool (self::*pseudo_bool)() const;
 
-  inline ConstBuffer& ConstBuffer::reset() { _ptr = 0; _size = 0 ; return *this; }
-  inline bool ConstBuffer::operator != (self const& that) const { return ! (*this == that); }
-  inline bool ConstBuffer::operator != (Buffer const& that) const { return ! (*this == that); }
-  inline bool ConstBuffer::operator == (self const& that) const {
-      return _size == that._size && 0 == memcmp(_ptr, that._ptr, _size);
-  }
-  inline ConstBuffer& ConstBuffer::operator = (Buffer const& that) { _ptr = that._ptr ; _size = that._size; return *this; }
-  inline bool ConstBuffer::operator == (Buffer const& that) const {
-      return _size == that._size && 0 == memcmp(_ptr, that._ptr, _size);
-  }
-  inline bool ConstBuffer::operator ! () const { return !(_ptr && _size); }
-  inline ConstBuffer::operator pseudo_bool() const { return _ptr && _size ? &self::operator! : 0; }
-  inline char ConstBuffer::operator * () const { return *_ptr; }
-  inline ConstBuffer& ConstBuffer::operator++ () {
-    ++_ptr;
-    --_size;
-    return *this;
-  }
-  inline ConstBuffer& ConstBuffer::operator += (size_t n) {
-    _ptr += n;
-    _size -= n;
-    return *this;
-  }
-  inline char const * ConstBuffer::data() const { return _ptr; }
-  inline char ConstBuffer::operator[] (int n) const { return _ptr[n]; }
-  inline size_t ConstBuffer::size() const { return _size; }
-  inline bool ConstBuffer::contains(char const* p) const {
-    return _ptr <= p && p < _ptr + _size;
-  }
+  char *_ptr;   ///< Pointer to base of memory chunk.
+  size_t _size; ///< Size of memory chunk.
 
-  inline ConstBuffer ConstBuffer::splitOn(char const* p) {
-    self zret; // default to empty return.
-    if (this->contains(p)) {
-      size_t n = p - _ptr;
-      zret.set(_ptr, n);
-      _ptr = p + 1;
-      _size -= n + 1;
-    }
-    return zret;
-  }
+  /// Default constructor (empty buffer).
+  Buffer();
 
-  inline char const* ConstBuffer::find(char c) const {
-    return static_cast<char const*>(memchr(_ptr, c, _size));
-  }
+  /** Construct from pointer and size.
+      @note Due to ambiguity issues do not call this with
+      two arguments if the first argument is 0.
+   */
+  Buffer(char *ptr, ///< Pointer to buffer.
+         size_t n   ///< Size of buffer.
+         );
+  /** Construct from two pointers.
+      @note This presumes a half open range, (start, end]
+  */
+  Buffer(char *start, ///< First valid character.
+         char *end    ///< First invalid character.
+         );
+
+  /** Equality.
+      @return @c true if @a that refers to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator==(self const &that) const;
+  /** Inequality.
+      @return @c true if @a that does not refer to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator!=(self const &that) const;
+  /** Equality for a constant buffer.
+      @return @c true if @a that refers to the same memory as @a this.
+      @c false otherwise.
+   */
+  bool operator==(ConstBuffer const &that) const;
+  /** Inequality.
+      @return @c true if @a that does not refer to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator!=(ConstBuffer const &that) const;
+
+  /// @return The first character in the buffer.
+  char operator*() const;
+  /** Discard the first character in the buffer.
+      @return @a this object.
+  */
+  self &operator++();
+
+  /// Check for empty buffer.
+  /// @return @c true if the buffer has a zero pointer @b or size.
+  bool operator!() const;
+  /// Check for non-empty buffer.
+  /// @return @c true if the buffer has a non-zero pointer @b and size.
+  operator pseudo_bool() const;
+
+  /// @name Accessors.
+  //@{
+  /// Get the data in the buffer.
+  char *data() const;
+  /// Get the size of the buffer.
+  size_t size() const;
+  //@}
+
+  /// Set the chunk.
+  /// Any previous values are discarded.
+  /// @return @c this object.
+  self &set(char *ptr,   ///< Buffer address.
+            size_t n = 0 ///< Buffer size.
+            );
+  /// Reset to empty.
+  self &reset();
+};
+
+/** A chunk of read only memory.
+    A convenience class because we pass this kind of pair frequently.
+ */
+struct ConstBuffer {
+  typedef ConstBuffer self; ///< Self reference type.
+  typedef bool (self::*pseudo_bool)() const;
 
-  inline ConstBuffer ConstBuffer::splitOn(char c) {
-    return this->splitOn(this->find(c));
-  }
+  char const *_ptr; ///< Pointer to base of memory chunk.
+  size_t _size;     ///< Size of memory chunk.
 
-  inline ConstBuffer ConstBuffer::after(char const* p) const {
-    return this->contains(p) ? self(p + 1, (_size-(p-_ptr))-1) : self();
-  }
-  inline ConstBuffer ConstBuffer::after(char c) const {
-    return this->after(this->find(c));
+  /// Default constructor (empty buffer).
+  ConstBuffer();
+
+  /** Construct from pointer and size.
+   */
+  ConstBuffer(char const *ptr, ///< Pointer to buffer.
+              size_t n         ///< Size of buffer.
+              );
+  /** Construct from two pointers.
+      @note This presumes a half open range (start, end]
+      @note Due to ambiguity issues do not invoke this with
+      @a start == 0.
+  */
+  ConstBuffer(char const *start, ///< First valid character.
+              char const *end    ///< First invalid character.
+              );
+  /// Construct from writable buffer.
+  ConstBuffer(Buffer const &buffer ///< Buffer to copy.
+              );
+
+  /** Equality.
+      @return @c true if @a that refers to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator==(self const &that) const;
+  /** Equality.
+      @return @c true if @a that refers to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator==(Buffer const &that) const;
+  /** Inequality.
+      @return @c true if @a that does not refer to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator!=(self const &that) const;
+  /** Inequality.
+      @return @c true if @a that does not refer to the same memory as @a this,
+      @c false otherwise.
+   */
+  bool operator!=(Buffer const &that) const;
+  /// Assign from non-const Buffer.
+  self &operator=(Buffer const &that ///< Source buffer.
+                  );
+
+  /// @return The first character in the buffer.
+  char operator*() const;
+  /** Discard the first character in the buffer.
+      @return @a this object.
+  */
+  self &operator++();
+  /** Discard the first @a n characters.
+      @return @a this object.
+  */
+  self &operator+=(size_t n);
+
+  /// Check for empty buffer.
+  /// @return @c true if the buffer has a zero pointer @b or size.
+  bool operator!() const;
+  /// Check for non-empty buffer.
+  /// @return @c true if the buffer has a non-zero pointer @b and size.
+  operator pseudo_bool() const;
+
+  /// @name Accessors.
+  //@{
+  /// Get the data in the buffer.
+  char const *data() const;
+  /// Get the size of the buffer.
+  size_t size() const;
+  /// Access a character (no bounds check).
+  char operator[](int n) const;
+  //@}
+  /// @return @c true if @a p points at a character in @a this.
+  bool contains(char const *p) const;
+
+  /// Set the chunk.
+  /// Any previous values are discarded.
+  /// @return @c this object.
+  self &set(char const *ptr, ///< Buffer address.
+            size_t n = 0     ///< Buffer size.
+            );
+  /** Set from 2 pointers.
+      @note This presumes a half open range (start, end]
+  */
+  self &set(char const *start, ///< First valid character.
+            char const *end    ///< First invalid character.
+            );
+  /// Reset to empty.
+  self &reset();
+
+  /** Find a character.
+      @return A pointer to the first occurrence of @a c in @a this
+      or @c NULL if @a c is not found.
+  */
+  char const *find(char c) const;
+
+  /** Split the buffer on the character at @a p.
+
+      The buffer is split in to two parts and the character at @a p
+      is discarded. @a this retains all data @b after @a p. The
+      initial part of the buffer is returned. Neither buffer will
+      contain the character at @a p.
+
+      This is convenient when tokenizing and @a p points at the token
+      separator.
+
+      @note If @a *p is not in the buffer then @a this is not changed
+      and an empty buffer is returned. This means the caller can
+      simply pass the result of @c find and check for an empty
+      buffer returned to detect no more separators.
+
+      @return A buffer containing data up to but not including @a p.
+  */
+  self splitOn(char const *p);
+
+  /** Split the buffer on the character @a c.
+
+      The buffer is split in to two parts and the occurrence of @a c
+      is discarded. @a this retains all data @b after @a c. The
+      initial part of the buffer is returned. Neither buffer will
+      contain the first occurrence of @a c.
+
+      This is convenient when tokenizing and @a c is the token
+      separator.
+
+      @note If @a c is not found then @a this is not changed and an
+      empty buffer is returned.
+
+      @return A buffer containing data up to but not including @a p.
+  */
+  self splitOn(char c);
+  /** Get a trailing segment of the buffer.
+
+      @return A buffer that contains all data after @a p.
+  */
+  self after(char const *p) const;
+  /** Get a trailing segment of the buffer.
+
+      @return A buffer that contains all data after the first
+      occurrence of @a c.
+  */
+  self after(char c) const;
+  /** Remove trailing segment.
+
+      Data at @a p and beyond is removed from the buffer.
+      If @a p is not in the buffer, no change is made.
+
+      @return @a this.
+  */
+  self &clip(char const *p);
+};
+
+// ----------------------------------------------------------
+// Inline implementations.
+
+inline Buffer::Buffer() : _ptr(NULL), _size(0)
+{
+}
+inline Buffer::Buffer(char *ptr, size_t n) : _ptr(ptr), _size(n)
+{
+}
+inline Buffer &
+Buffer::set(char *ptr, size_t n)
+{
+  _ptr = ptr;
+  _size = n;
+  return *this;
+}
+inline Buffer::Buffer(char *start, char *end) : _ptr(start), _size(end - start)
+{
+}
+inline Buffer &
+Buffer::reset()
+{
+  _ptr = 0;
+  _size = 0;
+  return *this;
+}
+inline bool Buffer::operator!=(self const &that) const
+{
+  return !(*this == that);
+}
+inline bool Buffer::operator!=(ConstBuffer const &that) const
+{
+  return !(*this == that);
+}
+inline bool Buffer::operator==(self const &that) const
+{
+  return _size == that._size && _ptr == that._ptr;
+}
+inline bool Buffer::operator==(ConstBuffer const &that) const
+{
+  return _size == that._size && _ptr == that._ptr;
+}
+inline bool Buffer::operator!() const
+{
+  return !(_ptr && _size);
+}
+inline Buffer::operator pseudo_bool() const
+{
+  return _ptr && _size ? &self::operator! : 0;
+}
+inline char Buffer::operator*() const
+{
+  return *_ptr;
+}
+inline Buffer &Buffer::operator++()
+{
+  ++_ptr;
+  --_size;
+  return *this;
+}
+inline char *
+Buffer::data() const
+{
+  return _ptr;
+}
+inline size_t
+Buffer::size() const
+{
+  return _size;
+}
+
+inline ConstBuffer::ConstBuffer() : _ptr(NULL), _size(0)
+{
+}
+inline ConstBuffer::ConstBuffer(char const *ptr, size_t n) : _ptr(ptr), _size(n)
+{
+}
+inline ConstBuffer::ConstBuffer(char const *start, char const *end) : _ptr(start), _size(end - start)
+{
+}
+inline ConstBuffer::ConstBuffer(Buffer const &that) : _ptr(that._ptr), _size(that._size)
+{
+}
+inline ConstBuffer &
+ConstBuffer::set(char const *ptr, size_t n)
+{
+  _ptr = ptr;
+  _size = n;
+  return *this;
+}
+
+inline ConstBuffer &
+ConstBuffer::set(char const *start, char const *end)
+{
+  _ptr = start;
+  _size = end - start;
+  return *this;
+}
+
+inline ConstBuffer &
+ConstBuffer::reset()
+{
+  _ptr = 0;
+  _size = 0;
+  return *this;
+}
+inline bool ConstBuffer::operator!=(self const &that) const
+{
+  return !(*this == that);
+}
+inline bool ConstBuffer::operator!=(Buffer const &that) const
+{
+  return !(*this == that);
+}
+inline bool ConstBuffer::operator==(self const &that) const
+{
+  return _size == that._size && 0 == memcmp(_ptr, that._ptr, _size);
+}
+inline ConstBuffer &ConstBuffer::operator=(Buffer const &that)
+{
+  _ptr = that._ptr;
+  _size = that._size;
+  return *this;
+}
+inline bool ConstBuffer::operator==(Buffer const &that) const
+{
+  return _size == that._size && 0 == memcmp(_ptr, that._ptr, _size);
+}
+inline bool ConstBuffer::operator!() const
+{
+  return !(_ptr && _size);
+}
+inline ConstBuffer::operator pseudo_bool() const
+{
+  return _ptr && _size ? &self::operator! : 0;
+}
+inline char ConstBuffer::operator*() const
+{
+  return *_ptr;
+}
+inline ConstBuffer &ConstBuffer::operator++()
+{
+  ++_ptr;
+  --_size;
+  return *this;
+}
+inline ConstBuffer &ConstBuffer::operator+=(size_t n)
+{
+  _ptr += n;
+  _size -= n;
+  return *this;
+}
+inline char const *
+ConstBuffer::data() const
+{
+  return _ptr;
+}
+inline char ConstBuffer::operator[](int n) const
+{
+  return _ptr[n];
+}
+inline size_t
+ConstBuffer::size() const
+{
+  return _size;
+}
+inline bool
+ConstBuffer::contains(char const *p) const
+{
+  return _ptr <= p && p < _ptr + _size;
+}
+
+inline ConstBuffer
+ConstBuffer::splitOn(char const *p)
+{
+  self zret; // default to empty return.
+  if (this->contains(p)) {
+    size_t n = p - _ptr;
+    zret.set(_ptr, n);
+    _ptr = p + 1;
+    _size -= n + 1;
   }
-  inline ConstBuffer& ConstBuffer::clip(char const* p) {
-    if (this->contains(p)) {
-      _size = p - _ptr;
-    }
-    return *this;
+  return zret;
+}
+
+inline char const *
+ConstBuffer::find(char c) const
+{
+  return static_cast<char const *>(memchr(_ptr, c, _size));
+}
+
+inline ConstBuffer
+ConstBuffer::splitOn(char c)
+{
+  return this->splitOn(this->find(c));
+}
+
+inline ConstBuffer
+ConstBuffer::after(char const *p) const
+{
+  return this->contains(p) ? self(p + 1, (_size - (p - _ptr)) - 1) : self();
+}
+inline ConstBuffer
+ConstBuffer::after(char c) const
+{
+  return this->after(this->find(c));
+}
+inline ConstBuffer &
+ConstBuffer::clip(char const *p)
+{
+  if (this->contains(p)) {
+    _size = p - _ptr;
   }
+  return *this;
+}
 
 } // end namespace
 
 typedef ts::Buffer TsBuffer;
 typedef ts::ConstBuffer TsConstBuffer;
 
-# endif // TS_BUFFER_HEADER
+#endif // TS_BUFFER_HEADER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/ts/Vec.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Vec.cc b/lib/ts/Vec.cc
index 781e7dc..669d413 100644
--- a/lib/ts/Vec.cc
+++ b/lib/ts/Vec.cc
@@ -25,55 +25,46 @@
 #include <stdint.h>
 #include "Vec.h"
 
-const uintptr_t prime2[] = {
-  1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191,
-  16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143,
-  4194301, 8388593, 16777213, 33554393, 67108859, 134217689,
-  268435399, 536870909
-};
+const uintptr_t prime2[] = {1,       3,       7,       13,       31,       61,       127,       251,       509,      1021,
+                            2039,    4093,    8191,    16381,    32749,    65521,    131071,    262139,    524287,   1048573,
+                            2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909};
 
 // primes generated with map_mult.c
 const uintptr_t open_hash_primes[256] = {
-0x02D4AF27, 0x1865DFC7, 0x47C62B43, 0x35B4889B, 0x210459A1, 0x3CC51CC7, 0x02ADD945, 0x0607C4D7,
-0x558E6035, 0x0554224F, 0x5A281657, 0x1C458C7F, 0x7F8BE723, 0x20B9BA99, 0x7218AA35, 0x64B10C2B,
-0x548E8983, 0x5951218F, 0x7AADC871, 0x695FA5B1, 0x40D40FCB, 0x20E03CC9, 0x55E9920F, 0x554CE08B,
-0x7E78B1D7, 0x7D965DF9, 0x36A520A1, 0x1B0C6C11, 0x33385667, 0x2B0A7B9B, 0x0F35AE23, 0x0BD608FB,
-0x2284ADA3, 0x6E6C0687, 0x129B3EED, 0x7E86289D, 0x1143C24B, 0x1B6C7711, 0x1D87BB41, 0x4C7E635D,
-0x67577999, 0x0A0113C5, 0x6CF085B5, 0x14A4D0FB, 0x4E93E3A7, 0x5C87672B, 0x67F3CA17, 0x5F944339,
-0x4C16DFD7, 0x5310C0E3, 0x2FAD1447, 0x4AFB3187, 0x08468B7F, 0x49E56C51, 0x6280012F, 0x097D1A85,
-0x34CC9403, 0x71028BD7, 0x6DEDC7E9, 0x64093291, 0x6D78BB0B, 0x7A03B465, 0x2E044A43, 0x1AE58515,
-0x23E495CD, 0x46102A83, 0x51B78A59, 0x051D8181, 0x5352CAC9, 0x57D1312B, 0x2726ED57, 0x2E6BC515,
-0x70736281, 0x5938B619, 0x0D4B6ACB, 0x44AB5E2B, 0x0029A485, 0x002CE54F, 0x075B0591, 0x3EACFDA9,
-0x0AC03411, 0x53B00F73, 0x2066992D, 0x76E72223, 0x55F62A8D, 0x3FF92EE1, 0x17EE0EB3, 0x5E470AF1,
-0x7193EB7F, 0x37A2CCD3, 0x7B44F7AF, 0x0FED8B3F, 0x4CC05805, 0x7352BF79, 0x3B61F755, 0x523CF9A3,
-0x1AAFD219, 0x76035415, 0x5BE84287, 0x6D598909, 0x456537E9, 0x407EA83F, 0x23F6FFD5, 0x60256F39,
-0x5D8EE59F, 0x35265CEB, 0x1D4AD4EF, 0x676E2E0F, 0x2D47932D, 0x776BB33B, 0x6DE1902B, 0x2C3F8741,
-0x5B2DE8EF, 0x686DDB3B, 0x1D7C61C7, 0x1B061633, 0x3229EA51, 0x7FCB0E63, 0x5F22F4C9, 0x517A7199,
-0x2A8D7973, 0x10DCD257, 0x41D59B27, 0x2C61CA67, 0x2020174F, 0x71653B01, 0x2FE464DD, 0x3E7ED6C7,
-0x164D2A71, 0x5D4F3141, 0x5F7BABA7, 0x50E1C011, 0x140F5D77, 0x34E80809, 0x04AAC6B3, 0x29C42BAB,
-0x08F9B6F7, 0x461E62FD, 0x45C2660B, 0x08BF25A7, 0x5494EA7B, 0x0225EBB7, 0x3C5A47CF, 0x2701C333,
-0x457ED05B, 0x48CDDE55, 0x14083099, 0x7C69BDAB, 0x7BF163C9, 0x41EE1DAB, 0x258B1307, 0x0FFAD43B,
-0x6601D767, 0x214DBEC7, 0x2852CCF5, 0x0009B471, 0x190AC89D, 0x5BDFB907, 0x15D4E331, 0x15D22375,
-0x13F388D5, 0x12ACEDA5, 0x3835EA5D, 0x2587CA35, 0x06756643, 0x487C6F55, 0x65C295EB, 0x1029F2E1,
-0x10CEF39D, 0x14C2E415, 0x444825BB, 0x24BE0A2F, 0x1D2B7C01, 0x64AE3235, 0x5D2896E5, 0x61BBBD87,
-0x4A49E86D, 0x12C277FF, 0x72C81289, 0x5CF42A3D, 0x332FF177, 0x0DAECD23, 0x6000ED1D, 0x203CDDE1,
-0x40C62CAD, 0x19B9A855, 0x782020C3, 0x6127D5BB, 0x719889A7, 0x40E4FCCF, 0x2A3C8FF9, 0x07411C7F,
-0x3113306B, 0x4D7CA03F, 0x76119841, 0x54CEFBDF, 0x11548AB9, 0x4B0748EB, 0x569966B1, 0x45BC721B,
-0x3D5A376B, 0x0D8923E9, 0x6D95514D, 0x0F39A367, 0x2FDAD92F, 0x721F972F, 0x42D0E21D, 0x5C5952DB,
-0x7394D007, 0x02692C55, 0x7F92772F, 0x025F8025, 0x34347113, 0x560EA689, 0x0DCC21DF, 0x09ECC7F5,
-0x091F3993, 0x0E0B52AB, 0x497CAA55, 0x0A040A49, 0x6D8F0CC5, 0x54F41609, 0x6E0CB8DF, 0x3DCB64C3,
-0x16C365CD, 0x6D6B9FB5, 0x02B9382B, 0x6A5BFAF1, 0x1669D75F, 0x13CFD4FD, 0x0FDF316F, 0x21F3C463,
-0x6FC58ABF, 0x04E45BE7, 0x1911225B, 0x28CD1355, 0x222084E9, 0x672AD54B, 0x476FC267, 0x6864E16D,
-0x20AEF4FB, 0x603C5FB9, 0x55090595, 0x1113B705, 0x24E38493, 0x5291AF97, 0x5F5446D9, 0x13A6F639,
-0x3D501313, 0x37E02017, 0x236B0ED3, 0x60F246BF, 0x01E02501, 0x2D2F66BD, 0x6BF23609, 0x16729BAF
-};
+  0x02D4AF27, 0x1865DFC7, 0x47C62B43, 0x35B4889B, 0x210459A1, 0x3CC51CC7, 0x02ADD945, 0x0607C4D7, 0x558E6035, 0x0554224F,
+  0x5A281657, 0x1C458C7F, 0x7F8BE723, 0x20B9BA99, 0x7218AA35, 0x64B10C2B, 0x548E8983, 0x5951218F, 0x7AADC871, 0x695FA5B1,
+  0x40D40FCB, 0x20E03CC9, 0x55E9920F, 0x554CE08B, 0x7E78B1D7, 0x7D965DF9, 0x36A520A1, 0x1B0C6C11, 0x33385667, 0x2B0A7B9B,
+  0x0F35AE23, 0x0BD608FB, 0x2284ADA3, 0x6E6C0687, 0x129B3EED, 0x7E86289D, 0x1143C24B, 0x1B6C7711, 0x1D87BB41, 0x4C7E635D,
+  0x67577999, 0x0A0113C5, 0x6CF085B5, 0x14A4D0FB, 0x4E93E3A7, 0x5C87672B, 0x67F3CA17, 0x5F944339, 0x4C16DFD7, 0x5310C0E3,
+  0x2FAD1447, 0x4AFB3187, 0x08468B7F, 0x49E56C51, 0x6280012F, 0x097D1A85, 0x34CC9403, 0x71028BD7, 0x6DEDC7E9, 0x64093291,
+  0x6D78BB0B, 0x7A03B465, 0x2E044A43, 0x1AE58515, 0x23E495CD, 0x46102A83, 0x51B78A59, 0x051D8181, 0x5352CAC9, 0x57D1312B,
+  0x2726ED57, 0x2E6BC515, 0x70736281, 0x5938B619, 0x0D4B6ACB, 0x44AB5E2B, 0x0029A485, 0x002CE54F, 0x075B0591, 0x3EACFDA9,
+  0x0AC03411, 0x53B00F73, 0x2066992D, 0x76E72223, 0x55F62A8D, 0x3FF92EE1, 0x17EE0EB3, 0x5E470AF1, 0x7193EB7F, 0x37A2CCD3,
+  0x7B44F7AF, 0x0FED8B3F, 0x4CC05805, 0x7352BF79, 0x3B61F755, 0x523CF9A3, 0x1AAFD219, 0x76035415, 0x5BE84287, 0x6D598909,
+  0x456537E9, 0x407EA83F, 0x23F6FFD5, 0x60256F39, 0x5D8EE59F, 0x35265CEB, 0x1D4AD4EF, 0x676E2E0F, 0x2D47932D, 0x776BB33B,
+  0x6DE1902B, 0x2C3F8741, 0x5B2DE8EF, 0x686DDB3B, 0x1D7C61C7, 0x1B061633, 0x3229EA51, 0x7FCB0E63, 0x5F22F4C9, 0x517A7199,
+  0x2A8D7973, 0x10DCD257, 0x41D59B27, 0x2C61CA67, 0x2020174F, 0x71653B01, 0x2FE464DD, 0x3E7ED6C7, 0x164D2A71, 0x5D4F3141,
+  0x5F7BABA7, 0x50E1C011, 0x140F5D77, 0x34E80809, 0x04AAC6B3, 0x29C42BAB, 0x08F9B6F7, 0x461E62FD, 0x45C2660B, 0x08BF25A7,
+  0x5494EA7B, 0x0225EBB7, 0x3C5A47CF, 0x2701C333, 0x457ED05B, 0x48CDDE55, 0x14083099, 0x7C69BDAB, 0x7BF163C9, 0x41EE1DAB,
+  0x258B1307, 0x0FFAD43B, 0x6601D767, 0x214DBEC7, 0x2852CCF5, 0x0009B471, 0x190AC89D, 0x5BDFB907, 0x15D4E331, 0x15D22375,
+  0x13F388D5, 0x12ACEDA5, 0x3835EA5D, 0x2587CA35, 0x06756643, 0x487C6F55, 0x65C295EB, 0x1029F2E1, 0x10CEF39D, 0x14C2E415,
+  0x444825BB, 0x24BE0A2F, 0x1D2B7C01, 0x64AE3235, 0x5D2896E5, 0x61BBBD87, 0x4A49E86D, 0x12C277FF, 0x72C81289, 0x5CF42A3D,
+  0x332FF177, 0x0DAECD23, 0x6000ED1D, 0x203CDDE1, 0x40C62CAD, 0x19B9A855, 0x782020C3, 0x6127D5BB, 0x719889A7, 0x40E4FCCF,
+  0x2A3C8FF9, 0x07411C7F, 0x3113306B, 0x4D7CA03F, 0x76119841, 0x54CEFBDF, 0x11548AB9, 0x4B0748EB, 0x569966B1, 0x45BC721B,
+  0x3D5A376B, 0x0D8923E9, 0x6D95514D, 0x0F39A367, 0x2FDAD92F, 0x721F972F, 0x42D0E21D, 0x5C5952DB, 0x7394D007, 0x02692C55,
+  0x7F92772F, 0x025F8025, 0x34347113, 0x560EA689, 0x0DCC21DF, 0x09ECC7F5, 0x091F3993, 0x0E0B52AB, 0x497CAA55, 0x0A040A49,
+  0x6D8F0CC5, 0x54F41609, 0x6E0CB8DF, 0x3DCB64C3, 0x16C365CD, 0x6D6B9FB5, 0x02B9382B, 0x6A5BFAF1, 0x1669D75F, 0x13CFD4FD,
+  0x0FDF316F, 0x21F3C463, 0x6FC58ABF, 0x04E45BE7, 0x1911225B, 0x28CD1355, 0x222084E9, 0x672AD54B, 0x476FC267, 0x6864E16D,
+  0x20AEF4FB, 0x603C5FB9, 0x55090595, 0x1113B705, 0x24E38493, 0x5291AF97, 0x5F5446D9, 0x13A6F639, 0x3D501313, 0x37E02017,
+  0x236B0ED3, 0x60F246BF, 0x01E02501, 0x2D2F66BD, 0x6BF23609, 0x16729BAF};
 
 // binary search over intervals
 static int
-i_find(const Intervals *i, int x) {
+i_find(const Intervals *i, int x)
+{
   ink_assert(i->n);
   int l = 0, h = i->n;
- Lrecurse:
+Lrecurse:
   if (h <= l + 2) {
     if (h <= l)
       return -(l + 1);
@@ -94,7 +85,8 @@ i_find(const Intervals *i, int x) {
 }
 
 bool
-Intervals::in(int x) const {
+Intervals::in(int x) const
+{
   if (!n)
     return false;
   if (i_find(this, x) > 0)
@@ -104,7 +96,8 @@ Intervals::in(int x) const {
 
 // insert into interval with merge
 void
-Intervals::insert(int x) {
+Intervals::insert(int x)
+{
   if (!n) {
     add(x);
     add(x);
@@ -142,16 +135,16 @@ Intervals::insert(int x) {
       goto Lmerge;
     }
   }
- Lmore:
+Lmore:
   fill(n + 2);
   if (n - 2 - l > 0)
     memmove(v + l + 2, v + l, sizeof(int) * (n - 2 - l));
   v[l] = x;
-  v[l+1] = x;
+  v[l + 1] = x;
   return;
- Lmerge:
+Lmerge:
   if (l) {
-    if (v[l] - v[l-1] < 2) {
+    if (v[l] - v[l - 1] < 2) {
       l -= 2;
       goto Ldomerge;
     }
@@ -161,14 +154,15 @@ Intervals::insert(int x) {
       goto Ldomerge;
   }
   return;
- Ldomerge:
+Ldomerge:
   memmove(v + l + 1, v + l + 3, sizeof(int) * (n - 3 - l));
   n -= 2;
   goto Lmerge;
 }
 
 void
-UnionFind::size(int s) {
+UnionFind::size(int s)
+{
   size_t nn = n;
   fill(s);
   for (size_t i = nn; i < n; i++)
@@ -176,9 +170,11 @@ UnionFind::size(int s) {
 }
 
 int
-UnionFind::find(int n) {
+UnionFind::find(int n)
+{
   int i, t;
-  for (i = n; v[i] >= 0; i = v[i]);
+  for (i = n; v[i] >= 0; i = v[i])
+    ;
   while (v[n] >= 0) {
     t = n;
     n = v[n];
@@ -188,7 +184,8 @@ UnionFind::find(int n) {
 }
 
 void
-UnionFind::unify(int n, int m) {
+UnionFind::unify(int n, int m)
+{
   n = find(n);
   m = find(m);
   if (n != m) {


[03/52] [partial] trafficserver git commit: TS-3419 Fix some enum's such that clang-format can handle it the way we want. Basically this means having a trailing , on short enum's. TS-3419 Run clang-format over most of the source

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65477944/lib/wccp/WccpLocal.h
----------------------------------------------------------------------
diff --git a/lib/wccp/WccpLocal.h b/lib/wccp/WccpLocal.h
index 89bab24..aefc526 100644
--- a/lib/wccp/WccpLocal.h
+++ b/lib/wccp/WccpLocal.h
@@ -1,5 +1,5 @@
-# if !defined(TS_WCCP_LOCAL_HEADER)
-# define TS_WCCP_LOCAL_HEADER
+#if !defined(TS_WCCP_LOCAL_HEADER)
+#define TS_WCCP_LOCAL_HEADER
 
 /** @file
     WCCP (v2) support for Apache Traffic Server.
@@ -23,20 +23,22 @@
     limitations under the License.
  */
 
-# include "Wccp.h"
-# include "WccpUtil.h"
-# include <ts/TsBuffer.h>
+#include "Wccp.h"
+#include "WccpUtil.h"
+#include <ts/TsBuffer.h>
 // Needed for template use of byte ordering functions.
-# include <netinet/in.h>
-# include <memory.h>
-# include <map>
-
-namespace wccp {
+#include <netinet/in.h>
+#include <memory.h>
+#include <map>
 
+namespace wccp
+{
 // Forward declares
-namespace detail {
+namespace detail
+{
   class Assignment;
-  namespace cache {
+  namespace cache
+  {
     struct RouterData;
   }
 }
@@ -89,48 +91,45 @@ static int const PARSE_DATA_OVERRUN = 10;
     Takes the basic ATS buffer and adds a count field to track
     the amount of buffer in use.
 */
-class MsgBuffer : protected ts::Buffer {
+class MsgBuffer : protected ts::Buffer
+{
 public:
-  typedef MsgBuffer self; ///< Self reference type.
+  typedef MsgBuffer self;   ///< Self reference type.
   typedef ts::Buffer super; ///< Parent type.
 
   MsgBuffer(); ///< Default construct empty buffer.
   /// Construct from ATS buffer.
-  MsgBuffer(
-    super const& that ///< Instance to copy.
-  );
+  MsgBuffer(super const &that ///< Instance to copy.
+            );
   /// Construct from pointer and size.
-  MsgBuffer(
-    void* ptr, ///< Pointer to buffer.
-    size_t n ///< Size of buffer.
-  );
+  MsgBuffer(void *ptr, ///< Pointer to buffer.
+            size_t n   ///< Size of buffer.
+            );
   /// Assign a buffer.
-  MsgBuffer& set(
-    void* ptr, ///< Pointer to buffer.
-    size_t n ///< Size of buffer.
-  );
+  MsgBuffer &set(void *ptr, ///< Pointer to buffer.
+                 size_t n   ///< Size of buffer.
+                 );
 
   /// Get the buffer size.
   size_t getSize() const;
   /// Get the content size (use count).
   size_t getCount() const;
   /// Get address of first unused byte.
-  char* getTail();
+  char *getTail();
   /// Get address of first byte.
-  char* getBase();
+  char *getBase();
   /// Get address of first byte.
-  char const* getBase() const;
+  char const *getBase() const;
   /// Get the remaining space in the buffer.
   size_t getSpace() const;
   /// Mark additional space in use.
-  self& use(
-    size_t n ///< Additional space to mark in use.
-  );
+  self &use(size_t n ///< Additional space to mark in use.
+            );
   /// Mark all space as unused.
-  self& reset();
+  self &reset();
 
   /// Reset and zero the buffer.
-  self& zero();
+  self &zero();
 
   size_t _count; ///< Number of bytes in use.
 };
@@ -138,16 +137,16 @@ public:
 /// Sect 4.4: Cache assignment method.
 enum CacheAssignmentType {
   ASSIGNMENT_BY_HASH = 0,
-  ASSIGNMENT_BY_MASK = 1
+  ASSIGNMENT_BY_MASK = 1,
 };
 
 /// Top level message types.
 enum message_type_t {
   INVALID_MSG_TYPE = 0,
-  HERE_I_AM =  10,
-  I_SEE_YOU =  11,
+  HERE_I_AM = 10,
+  I_SEE_YOU = 11,
   REDIRECT_ASSIGN = 12,
-  REMOVAL_QUERY = 13
+  REMOVAL_QUERY = 13,
 };
 
 /// Message component type.
@@ -176,12 +175,11 @@ struct RouterId {
 
   RouterId(); ///< Default constructor.
   /// Construct from address and sequence number.
-  RouterId(
-    uint32_t addr, ///< Router address.
-    uint32_t recv_id ///< Receive ID (sequence number).
-  );
+  RouterId(uint32_t addr,   ///< Router address.
+           uint32_t recv_id ///< Receive ID (sequence number).
+           );
 
-  uint32_t m_addr; ///< Identifying router IP address.
+  uint32_t m_addr;    ///< Identifying router IP address.
   uint32_t m_recv_id; ///< Recieve ID (sequence #).
 };
 
@@ -192,7 +190,8 @@ struct RouterId {
     @internal A @c RouterId with accessors to guarantee correct memory
     layout.
 */
-class RouterIdElt : protected RouterId {
+class RouterIdElt : protected RouterId
+{
 protected:
   typedef RouterId super; ///< Parent type.
 public:
@@ -201,70 +200,69 @@ public:
   /// Default constructor, members zero initialized.
   RouterIdElt();
   /// Construct from address and sequence number.
-  RouterIdElt(
-    uint32_t addr, ///< Router address.
-    uint32_t recv_id ///< Receive ID (sequence number).
-  );
+  RouterIdElt(uint32_t addr,   ///< Router address.
+              uint32_t recv_id ///< Receive ID (sequence number).
+              );
 
   /// @name Accessors
   //@{
-  uint32_t getAddr() const; ///< Get the address field.
-  self& setAddr(uint32_t addr); ///< Set the address field to @a addr.
-  uint32_t getRecvId() const; ///< Get the receive ID field.
-  self& setRecvId(uint32_t id); ///< Set the receive ID field to @a id.
+  uint32_t getAddr() const;     ///< Get the address field.
+  self &setAddr(uint32_t addr); ///< Set the address field to @a addr.
+  uint32_t getRecvId() const;   ///< Get the receive ID field.
+  self &setRecvId(uint32_t id); ///< Set the receive ID field to @a id.
   //@}
 
   /// Assign from non-serialized variant.
-  self& operator = (super const& that);
+  self &operator=(super const &that);
 };
 
 /// Sect 5.7.3: Assignment Key Element
 /// @note This maps directly on to message content.
 /// @internal: At top level because it is used in more than one component.
-class AssignmentKeyElt {
+class AssignmentKeyElt
+{
 public:
   typedef AssignmentKeyElt self; ///< Self reference type.
 
   AssignmentKeyElt(); ///< Default constructor. No member initialization.
   /// Construct from address and sequence number.
-  AssignmentKeyElt(
-    uint32_t addr, ///< Key address.
-    uint32_t generation ///< Change number.
-  );
+  AssignmentKeyElt(uint32_t addr,      ///< Key address.
+                   uint32_t generation ///< Change number.
+                   );
 
   /// @name Accessors
   //@{
-  uint32_t getAddr() const; ///< Get the address field.
-  self& setAddr(uint32_t addr); ///< Set the address field to @a addr.
-  uint32_t getChangeNumber() const; ///< Get change number field.
-  self& setChangeNumber(uint32_t n); ///< Set change number field to @a n.
+  uint32_t getAddr() const;          ///< Get the address field.
+  self &setAddr(uint32_t addr);      ///< Set the address field to @a addr.
+  uint32_t getChangeNumber() const;  ///< Get change number field.
+  self &setChangeNumber(uint32_t n); ///< Set change number field to @a n.
   //@}
 protected:
-  uint32_t m_addr; ///< Identifying router IP address.
+  uint32_t m_addr;          ///< Identifying router IP address.
   uint32_t m_change_number; ///< Change number (sequence #).
 };
 
 /// Sect 5.7.4: Router Assignment Element
 /// @note This maps directly on to message content.
 /// @internal: At top level because it is used in more than one component.
-class RouterAssignElt : public RouterIdElt {
+class RouterAssignElt : public RouterIdElt
+{
 public:
   typedef RouterAssignElt self; ///< Self reference type.
-  typedef RouterIdElt super; ///< Parent type.
+  typedef RouterIdElt super;    ///< Parent type.
 
   /// Default constructor, members zero initialized.
   RouterAssignElt();
   /// Construct from address and sequence number.
-  RouterAssignElt(
-    uint32_t addr, ///< Router address.
-    uint32_t recv_id, ///< Receive ID (sequence number).
-    uint32_t change_number ///< Change number (sequence number).
-  );
+  RouterAssignElt(uint32_t addr,         ///< Router address.
+                  uint32_t recv_id,      ///< Receive ID (sequence number).
+                  uint32_t change_number ///< Change number (sequence number).
+                  );
 
   /// @name Accessors
   //@{
-  uint32_t getChangeNumber() const; ///< Get change number field.
-  self& setChangeNumber(uint32_t n); ///< Set change number field to @a n.
+  uint32_t getChangeNumber() const;  ///< Get change number field.
+  self &setChangeNumber(uint32_t n); ///< Set change number field to @a n.
   //@}
 protected:
   uint32_t m_change_number; ///< Change number (sequence #).
@@ -274,37 +272,34 @@ protected:
     @note Not explicitly part of the spec, but it shows up in multiple
     places.
  */
-class RouterAssignListElt {
+class RouterAssignListElt
+{
 public:
   typedef RouterAssignListElt self; ///< Self reference type.
 
   /// Default constructor - @b no initialization.
   RouterAssignListElt();
   /// Construct with @n elements.
-  RouterAssignListElt(
-    int n ///< Number of elements.
-  );
+  RouterAssignListElt(int n ///< Number of elements.
+                      );
 
   /// @name Accessors
   //@{
   /// Access element.
-  RouterAssignElt& elt(
-    int idx ///< Index of target element.
-  );
+  RouterAssignElt &elt(int idx ///< Index of target element.
+                       );
   /// Access const element.
-  RouterAssignElt const& elt(
-    int idx ///< Index of target element.
-  ) const;
+  RouterAssignElt const &elt(int idx ///< Index of target element.
+                             ) const;
   /// Get the number of elements.
   uint32_t getCount() const;
   //@}
 
   /// Update ID for a router.
-  self& updateRouterId(
-    uint32_t addr, ///< Identifying IP address of router.
-    uint32_t rcvid, ///< New receive ID value.
-    uint32_t cno ///< New change number.
-  );
+  self &updateRouterId(uint32_t addr,  ///< Identifying IP address of router.
+                       uint32_t rcvid, ///< New receive ID value.
+                       uint32_t cno    ///< New change number.
+                       );
 
   /// Get size in bytes of this structure.
   size_t getSize() const;
@@ -313,89 +308,86 @@ public:
   /// stub structure.
   size_t getVarSize() const;
   /// Calculate size in bytes for @a n elements.
-  static size_t calcSize(
-    int n ///< Number of elements.
-  );
+  static size_t calcSize(int n ///< Number of elements.
+                         );
   /// Calculate size of variable data in bytes for @a n elements.
-  static size_t calcVarSize(
-    int n ///< Number of elements.
-  );
+  static size_t calcVarSize(int n ///< Number of elements.
+                            );
+
 protected:
   uint32_t m_count; ///< # of elements (network order).
 };
 
 /// Sect 5.7.5: Capability Element
 /// @note This maps directly on to message content.
-class CapabilityElt {
+class CapabilityElt
+{
 public:
   typedef CapabilityElt self; ///< Self reference type.
 
   /// Capability types.
   enum Type {
-    PACKET_FORWARD_METHOD = 1, ///< Packet forwarding methods.
+    PACKET_FORWARD_METHOD = 1,   ///< Packet forwarding methods.
     CACHE_ASSIGNMENT_METHOD = 2, ///< Cache assignment methods.
-    PACKET_RETURN_METHOD = 3 ///< Packet return methods.
+    PACKET_RETURN_METHOD = 3     ///< Packet return methods.
   };
 
   CapabilityElt(); ///< Default constructor.
   /// Construct from address and sequence number.
-  CapabilityElt(
-    Type type, ///< Capability type.
-    uint32_t data ///< Capability data.
-  );
+  CapabilityElt(Type type,    ///< Capability type.
+                uint32_t data ///< Capability data.
+                );
 
   /// @name Accessors
   //@{
   Type getCapType() const; ///< Get the capability type.
   /// Set capability type.
-  self& setCapType(
-    Type cap ///< Capability type.
-  );
+  self &setCapType(Type cap ///< Capability type.
+                   );
   uint32_t getCapData() const; ///< Get capability data.
   /// Set capability data.
-  self& setCapData(
-    uint32_t data ///< Data value.
-  );
+  self &setCapData(uint32_t data ///< Data value.
+                   );
   //@}
 protected:
-  uint16_t m_cap_type; ///< Capability type.
+  uint16_t m_cap_type;   ///< Capability type.
   uint16_t m_cap_length; ///< Length of capability data.
-  uint32_t m_cap_data; ///< Capability data.
+  uint32_t m_cap_data;   ///< Capability data.
 };
 
 /// Sect 5.7.7: Mask element
-class MaskElt {
+class MaskElt
+{
 public:
   typedef MaskElt self; ///< Self reference type.
 
   /// Default constructor - @b no initialization.
   MaskElt();
   /// Construct with specific values.
-  MaskElt(
-    uint32_t srcAddr, ///< Mask for source address.
-    uint32_t dstAddr, ///< Mask for destination address.
-    uint16_t srcPort, ///< Mask for source port.
-    uint16_t dstPort  ///< Mask for destination port.
-  );
+  MaskElt(uint32_t srcAddr, ///< Mask for source address.
+          uint32_t dstAddr, ///< Mask for destination address.
+          uint16_t srcPort, ///< Mask for source port.
+          uint16_t dstPort  ///< Mask for destination port.
+          );
 
   /// @name Accessors
   //@{
   /// Get source address mask field.
   uint32_t getSrcAddr() const;
   /// Set source address mask field to @a mask.
-  self& setSrcAddr(uint32_t mask);
+  self &setSrcAddr(uint32_t mask);
   /// Get destination address field.
   uint32_t getDstAddr() const;
   /// Set destination address field to @a mask.
-  self& setDstAddr(uint32_t mask);
+  self &setDstAddr(uint32_t mask);
   /// Get source port mask field.
   uint16_t getSrcPort() const;
   /// Set source port mask field to @a mask.
-  self& setSrcPort(uint16_t mask);
+  self &setSrcPort(uint16_t mask);
   /// Get destination port mask field.
   uint16_t getDstPort() const;
   /// Set destination port mask field to @a mask.
-  self& setDstPort(uint16_t mask);
+  self &setDstPort(uint16_t mask);
   //@}
 
 protected:
@@ -406,155 +398,149 @@ protected:
 };
 
 /// Sect 5.7.8: Value element.
-class ValueElt {
+class ValueElt
+{
 public:
   typedef ValueElt self; ///< Self reference type.
 
   /// Default constructor - @b no initialization.
   ValueElt();
   /// Construct a specific value.
-  ValueElt(
-    uint32_t cacheAddr, ///< Address of cache for this value.
-    uint32_t srcAddr, ///< Value for source address.
-    uint32_t dstAddr, ///< Value for destination address.
-    uint16_t srcPort, ///< Value for source port.
-    uint16_t dstPort  ///< Value for destination port.
-  );
+  ValueElt(uint32_t cacheAddr, ///< Address of cache for this value.
+           uint32_t srcAddr,   ///< Value for source address.
+           uint32_t dstAddr,   ///< Value for destination address.
+           uint16_t srcPort,   ///< Value for source port.
+           uint16_t dstPort    ///< Value for destination port.
+           );
 
   /// @name Accessors
   //@{
-  uint32_t getf_src_addr() const; ///< Get source address field.
-  self& setf_src_addr(uint32_t addr); ///< Set source address field to @a addr.
-  uint32_t getDstAddr() const; ///< Get destination address field.
-  self& setf_dst_addr(uint32_t addr); ///< Set destination address field to @a addr.
-  uint16_t getf_src_port() const; ///< Get source port field.
-  self& setf_src_port(uint16_t port); ///< Set source port field to @a port.
-  uint16_t getDstPort() const; ///< Get destination port field.
-  self& setf_dst_port(uint16_t port); ///< Set destination port field to @a port.
-  uint32_t getCacheAddr() const; ///< Get cache address field.
-  self& setCacheAddr(uint32_t addr); ///< Set cache address field to @a addr
+  uint32_t getf_src_addr() const;     ///< Get source address field.
+  self &setf_src_addr(uint32_t addr); ///< Set source address field to @a addr.
+  uint32_t getDstAddr() const;        ///< Get destination address field.
+  self &setf_dst_addr(uint32_t addr); ///< Set destination address field to @a addr.
+  uint16_t getf_src_port() const;     ///< Get source port field.
+  self &setf_src_port(uint16_t port); ///< Set source port field to @a port.
+  uint16_t getDstPort() const;        ///< Get destination port field.
+  self &setf_dst_port(uint16_t port); ///< Set destination port field to @a port.
+  uint32_t getCacheAddr() const;      ///< Get cache address field.
+  self &setCacheAddr(uint32_t addr);  ///< Set cache address field to @a addr
   //@}
 
 protected:
-  uint32_t m_src_addr; ///< Source address.
-  uint32_t m_dst_addr; ///< Destination address.
-  uint16_t m_src_port; ///< Source port.
-  uint16_t m_dst_port; ///< Destination port.
+  uint32_t m_src_addr;   ///< Source address.
+  uint32_t m_dst_addr;   ///< Destination address.
+  uint16_t m_src_port;   ///< Source port.
+  uint16_t m_dst_port;   ///< Destination port.
   uint32_t m_cache_addr; ///< Cache address.
 };
 
 /** Sect 5.7.6: Mask/Value Set Element
     This is a variable sized element.
  */
-class MaskValueSetElt {
+class MaskValueSetElt
+{
 public:
   typedef MaskValueSetElt self; ///< Self reference type.
 
   MaskValueSetElt(); ///< Default constructor.
   /// Construct from address and sequence number.
-  MaskValueSetElt(
-    uint32_t n ///< Value count.
-  );
+  MaskValueSetElt(uint32_t n ///< Value count.
+                  );
 
   /// @name Accessors
   //@{
   /// Directly access contained mask element.
-  MaskElt& maskElt();
+  MaskElt &maskElt();
 
   /// Get source address mask field.
   uint32_t getSrcAddrMask() const;
   /// Set source address mask field to @a mask.
-  self& setSrcAddrMask(uint32_t mask);
+  self &setSrcAddrMask(uint32_t mask);
   /// Get destination address field.
   uint32_t getDstAddrMask() const;
   /// Set destination address field to @a mask.
-  self& setDstAddrMask(uint32_t mask);
+  self &setDstAddrMask(uint32_t mask);
   /// Get source port mask field.
   uint16_t getSrcPortMask() const;
   /// Set source port mask field to @a mask.
-  self& setSrcPortMask(uint16_t mask);
+  self &setSrcPortMask(uint16_t mask);
   /// Get destination port mask field.
   uint16_t getDstPortMask() const;
   /// Set destination port mask field to @a mask.
-  self& setDstPortMask(uint16_t mask);
+  self &setDstPortMask(uint16_t mask);
 
   /// Append a value to this set.
-  self& addValue(
-    uint32_t cacheAddr, ///< Address of cache for this value.
-    uint32_t srcAddr, ///< Value for source address.
-    uint32_t dstAddr, ///< Value for destination address.
-    uint16_t srcPort, ///< Value for source port.
-    uint16_t dstPort  ///< Value for destination port.
-  );
+  self &addValue(uint32_t cacheAddr, ///< Address of cache for this value.
+                 uint32_t srcAddr,   ///< Value for source address.
+                 uint32_t dstAddr,   ///< Value for destination address.
+                 uint16_t srcPort,   ///< Value for source port.
+                 uint16_t dstPort    ///< Value for destination port.
+                 );
 
   /// Get the value count.
   /// @note No corresponding @c set because this cannot be directly changed.
   uint32_t getCount() const;
   /// Access value element.
-  ValueElt& operator [] (
-    int idx ///< Index of target element.
-  );
+  ValueElt &operator[](int idx ///< Index of target element.
+                       );
   //@}
   /// Calcuate the size of an element with @a n values.
-  static size_t calcSize(
-    uint32_t n ///< Number of values.
-  );
+  static size_t calcSize(uint32_t n ///< Number of values.
+                         );
   /// Get the size (length) of this element.
   size_t getSize() const;
+
 protected:
   // All members are kept in network order.
-  MaskElt m_mask; ///< Base mask element.
+  MaskElt m_mask;   ///< Base mask element.
   uint32_t m_count; ///< Number of value elements.
 
   /// Get base address of Value elements.
-  ValueElt* values();
+  ValueElt *values();
   /// Get base address of Value elements.
-  ValueElt const* values() const;
+  ValueElt const *values() const;
 };
 
 /// Assignment of caches by hash.
 /// Not in specification.
-class HashAssignElt {
+class HashAssignElt
+{
 public:
   typedef HashAssignElt self; ///< Self reference type.
 
   /// Hash assignment bucket.
   struct Bucket {
-    unsigned int m_idx:7; ///< Cache index.
-    unsigned int m_alt:1; ///<  Alternate hash flag.
+    unsigned int m_idx : 7; ///< Cache index.
+    unsigned int m_alt : 1; ///<  Alternate hash flag.
 
     /// Test for unassigned value in bucket.
     bool is_unassigned() const;
-  } __attribute__((aligned(1),packed));
+  } __attribute__((aligned(1), packed));
 
   /// Default constructor - @b no initialization.
   HashAssignElt();
   /// Construct with @n elements.
-  HashAssignElt(
-    int n ///< Number of elements.
-  );
+  HashAssignElt(int n ///< Number of elements.
+                );
 
   /// @name Accessors
   //@{
   /// Get the number of caches.
   uint32_t getCount() const;
   /// Get a cache address.
-  uint32_t getAddr(
-    int idx ///< Index of target address.
-  ) const;
+  uint32_t getAddr(int idx ///< Index of target address.
+                   ) const;
   /// Set a cache address.
-  self& setAddr(
-    int idx, ///< Index of target address.
-    uint32_t addr ///< Address value to set.
-  );
+  self &setAddr(int idx,      ///< Index of target address.
+                uint32_t addr ///< Address value to set.
+                );
   /// Access a bucket.
-  Bucket& operator [] (
-    size_t idx ///< Bucket index (0..N_BUCKETS-1)
-  );
+  Bucket &operator[](size_t idx ///< Bucket index (0..N_BUCKETS-1)
+                     );
   /// Access a const bucket.
-  Bucket const& operator [] (
-    size_t idx ///< Bucket index (0..N_BUCKETS-1)
-  ) const;
+  Bucket const &operator[](size_t idx ///< Bucket index (0..N_BUCKETS-1)
+                           ) const;
   //@}
 
   /** Do a round robin assignment.
@@ -562,18 +548,18 @@ public:
       index of the last cache.
       @return @c this.
   */
-  self& round_robin_assign();
+  self &round_robin_assign();
 
   /// Get size in bytes of this structure.
   size_t getSize() const;
   /// Calculate size in bytes for @a n caches.
-  static size_t calcSize(
-    int n ///< Number of caches.
-  );
+  static size_t calcSize(int n ///< Number of caches.
+                         );
+
 protected:
   uint32_t m_count; ///< # of caches (network order).
 
-  Bucket* getBucketBase();
+  Bucket *getBucketBase();
 };
 
 /** Assignment of caches by mask.
@@ -585,7 +571,8 @@ protected:
     for that, which functions in a manner similar to an iterator.
  */
 
-class MaskAssignElt {
+class MaskAssignElt
+{
 public:
   typedef MaskAssignElt self; ///< Self reference type.
 
@@ -597,25 +584,23 @@ public:
   struct appender {
     typedef appender self; ///< Self reference type.
     /// Get pointer to current set.
-    MaskValueSetElt* operator -> ();
+    MaskValueSetElt *operator->();
     /// Append a new mask/value set.
     /// @return A pointer to the new set.
-    MaskValueSetElt* mask(
-      uint32_t srcAddr, ///< Mask for source address.
-      uint32_t dstAddr, ///< Mask for destination address.
-      uint16_t srcPort, ///< Mask for source port.
-      uint16_t dstPort  ///< Mask for destination port.
-    );
+    MaskValueSetElt *mask(uint32_t srcAddr, ///< Mask for source address.
+                          uint32_t dstAddr, ///< Mask for destination address.
+                          uint16_t srcPort, ///< Mask for source port.
+                          uint16_t dstPort  ///< Mask for destination port.
+                          );
     /// Initialize the current set to empty with specific mask values.
     /// @return A pointer to the new set.
-    MaskValueSetElt* initSet(
-      uint32_t srcAddr, ///< Mask for source address.
-      uint32_t dstAddr, ///< Mask for destination address.
-      uint16_t srcPort, ///< Mask for source port.
-      uint16_t dstPort  ///< Mask for destination port.
-    );
-    MaskValueSetElt* m_set; ///< Current set.
-    MaskAssignElt* m_elt; ///< Parent element.
+    MaskValueSetElt *initSet(uint32_t srcAddr, ///< Mask for source address.
+                             uint32_t dstAddr, ///< Mask for destination address.
+                             uint16_t srcPort, ///< Mask for source port.
+                             uint16_t dstPort  ///< Mask for destination port.
+                             );
+    MaskValueSetElt *m_set; ///< Current set.
+    MaskAssignElt *m_elt;   ///< Parent element.
   };
 
   /// @name Accessors
@@ -624,12 +609,11 @@ public:
   uint32_t getCount() const;
   //@}
 
-  appender init(
-    uint32_t srcAddr, ///< Mask for source address.
-    uint32_t dstAddr, ///< Mask for destination address.
-    uint16_t srcPort, ///< Mask for source port.
-    uint16_t dstPort  ///< Mask for destination port.
-  );
+  appender init(uint32_t srcAddr, ///< Mask for source address.
+                uint32_t dstAddr, ///< Mask for destination address.
+                uint16_t srcPort, ///< Mask for source port.
+                uint16_t dstPort  ///< Mask for destination port.
+                );
 
   /// Get size in bytes of this structure.
   /// @note This is not constant time. The mask/value sets must be traversed
@@ -639,6 +623,7 @@ public:
   /// @note This is not constant time. The mask/value sets must be traversed
   /// to get the total size.
   size_t getVarSize() const;
+
 protected:
   uint32_t m_count; ///< # of sets (network order).
 
@@ -662,8 +647,10 @@ class CacheIdBox;
     @see CacheHashIdElt
     @see CacheMaskIdElt
 */
-class CacheIdElt {
+class CacheIdElt
+{
   friend class CacheIdBox;
+
 public:
   typedef CacheIdElt self; ///< Self reference type.
 
@@ -672,43 +659,42 @@ public:
 
   /// @name Accessors
   //@{
-  uint32_t getAddr() const; ///< Get address field.
-  self& setAddr(uint32_t addr); ///< Set address field to @a addr.
-  uint16_t getHashRev() const; ///< Get hash revision field.
-  self& setHashRev(uint16_t rev); ///< Set hash revision field to @a rev.
-  self& initHashRev(); ///< Set hash revision to default value.
-  bool getUnassigned() const; ///< Get unassigned field.
-  self& setUnassigned(bool state); ///< Set unassigned field to @a state.
-  bool isMask() const; ///< @return @c true if this is a mask assignment.
-  /** Set the maskiness of this structure.
-      Be very careful with this, as different values change the
-      memory layout of the object.
-  */
-  self& setMask(
-    bool state ///< @c true to be mask, @c false to be hash.
-  );
-
-  self& clearReserved(); ///< Set reserved bits to zero.
+  uint32_t getAddr() const;        ///< Get address field.
+  self &setAddr(uint32_t addr);    ///< Set address field to @a addr.
+  uint16_t getHashRev() const;     ///< Get hash revision field.
+  self &setHashRev(uint16_t rev);  ///< Set hash revision field to @a rev.
+  self &initHashRev();             ///< Set hash revision to default value.
+  bool getUnassigned() const;      ///< Get unassigned field.
+  self &setUnassigned(bool state); ///< Set unassigned field to @a state.
+  bool isMask() const;             ///< @return @c true if this is a mask assignment.
+                                   /** Set the maskiness of this structure.
+                                       Be very careful with this, as different values change the
+                                       memory layout of the object.
+                                   */
+  self &setMask(bool state         ///< @c true to be mask, @c false to be hash.
+                );
+
+  self &clearReserved(); ///< Set reserved bits to zero.
   //@}
 
 protected:
-  uint32_t m_addr; ///< Identifying cache IP address.
-  uint16_t m_hash_rev; ///< Hash revision.
-  unsigned int m_reserved_0:7; ///< Reserved bits.
-  /** Cache not assigned.
-      If set the cache does not have an assignment in the redirection
-      hash table and the data in @a m_buckets is historical. This allows
-      a cache that was removed to be added back in the same buckets.
-  */
-  unsigned int m_unassigned:1;
-  unsigned int m_reserved_1:1; ///< Reserved (unused).
-  unsigned int m_is_mask:1; ///< Set -> mask, Clear -> hash.
-  unsigned int m_reserved_2:6; ///< Reserved (unused).
-  /** Trailing elements common to all cache ID variants.
-      Unfortunately, although @c weight and @c status are common, they are
-      after the variable data and so can't be put in the base class.
-      Best we can do is declare a struct for them for later convenience.
-  */
+  uint32_t m_addr;               ///< Identifying cache IP address.
+  uint16_t m_hash_rev;           ///< Hash revision.
+  unsigned int m_reserved_0 : 7; ///< Reserved bits.
+                                 /** Cache not assigned.
+                                     If set the cache does not have an assignment in the redirection
+                                     hash table and the data in @a m_buckets is historical. This allows
+                                     a cache that was removed to be added back in the same buckets.
+                                 */
+  unsigned int m_unassigned : 1;
+  unsigned int m_reserved_1 : 1; ///< Reserved (unused).
+  unsigned int m_is_mask : 1;    ///< Set -> mask, Clear -> hash.
+  unsigned int m_reserved_2 : 6; ///< Reserved (unused).
+                                 /** Trailing elements common to all cache ID variants.
+                                     Unfortunately, although @c weight and @c status are common, they are
+                                     after the variable data and so can't be put in the base class.
+                                     Best we can do is declare a struct for them for later convenience.
+                                 */
   struct Tail {
     uint16_t m_weight; ///< Weight of assignment.
     uint16_t m_status; ///< Cache status.
@@ -717,33 +703,36 @@ protected:
 
 /** Cache ID for Hash assignment.
  */
-class CacheHashIdElt : public CacheIdElt {
+class CacheHashIdElt : public CacheIdElt
+{
   friend class CacheIdBox;
+
 public:
   typedef CacheHashIdElt self; ///< Self reference type.
-  typedef CacheIdElt super; ///< Parent type.
+  typedef CacheIdElt super;    ///< Parent type.
   /// Container for hash assignment.
   typedef uint8_t HashBuckets[N_BUCKETS >> 3];
   /// @name Accessors
   //@{
   bool getBucket(int idx) const; ///< Get bucket state at index @a idx.
   /// Set bucket at index @a idx to @a state.
-  self& setBucket(int idx, bool state);
-  self& setBuckets(bool state); ///< Set all buckets to @a state.
-  uint16_t getWeight() const; ///< Get weight field.
-  self& setWeight(uint16_t w); ///< Set weight field to @a w.
-  uint16_t getStatus() const; ///< Get status field.
-  self& setStatus(uint16_t s); ///< Set status field to @a s.
+  self &setBucket(int idx, bool state);
+  self &setBuckets(bool state); ///< Set all buckets to @a state.
+  uint16_t getWeight() const;   ///< Get weight field.
+  self &setWeight(uint16_t w);  ///< Set weight field to @a w.
+  uint16_t getStatus() const;   ///< Get status field.
+  self &setStatus(uint16_t s);  ///< Set status field to @a s.
   //@}
   /// Get object size in bytes.
   size_t getSize() const;
+
 protected:
   /// Bit vector of buckets assigned to this cache.
   HashBuckets m_buckets;
   Tail m_tail; /// Trailing values in element.
 
   /// Get the address of the tail elements.
-  Tail* getTailPtr();
+  Tail *getTailPtr();
 };
 
 /** Cache ID for Mask assignment.
@@ -757,28 +746,31 @@ protected:
     - A single mask assign element with a mask set with one value seems to
     work.
  */
-class CacheMaskIdElt : public CacheIdElt {
+class CacheMaskIdElt : public CacheIdElt
+{
   friend class CacheIdBox;
+
 public:
   typedef CacheMaskIdElt self; ///< Self reference type.
-  typedef CacheIdElt super; ///< Parent type.
+  typedef CacheIdElt super;    ///< Parent type.
   /// @name Accessors
   //@{
-  uint16_t getWeight() const; ///< Get weight field.
-  self& setWeight(uint16_t w); ///< Set weight field to @a w.
-  uint16_t getStatus() const; ///< Get status field.
-  self& setStatus(uint16_t s); ///< Set status field to @a s.
+  uint16_t getWeight() const;  ///< Get weight field.
+  self &setWeight(uint16_t w); ///< Set weight field to @a w.
+  uint16_t getStatus() const;  ///< Get status field.
+  self &setStatus(uint16_t s); ///< Set status field to @a s.
   /// Get the number of mask/value sets.
   uint32_t getCount() const;
   //@}
   /// Get object size in bytes.
   size_t getSize() const;
+
 protected:
   /// Mask assignment data.
   MaskAssignElt m_assign;
   /// Get a pointer to where the tail data is.
   /// Presumes the assignment is filled out.
-  Tail* getTailPtr();
+  Tail *getTailPtr();
 };
 
 /** Holder for a @c CacheIdElt.
@@ -787,7 +779,8 @@ protected:
     instances of it in other classes. This box both holds an instance and
     handles some of the memory allocation issues involved.
  */
-class CacheIdBox {
+class CacheIdBox
+{
 public:
   typedef CacheIdBox self; ///< Self reference type.
 
@@ -799,67 +792,60 @@ public:
   /// Get the identifying cache address.
   uint32_t getAddr() const;
   /// Set the identifying cache address.
-  self& setAddr(
-    uint32_t ///< Identifying IP address.
-  );
-  uint16_t getHashRev() const; ///< Get hash revision field.
-  self& setHashRev(uint16_t rev); ///< Set hash revision field to @a rev.
-  self& initHashRev(); ///< Set hash revision to default value.
-  bool getUnassigned() const; ///< Get unassigned field.
-  self& setUnassigned(bool state); ///< Set unassigned field to @a state.
-  bool isMask() const; ///< @return @c true if this is a mask assignment.
-  /** Set the maskiness of this structure.
-      Be very careful with this, as different values change the
-      memory layout of the object.
-  */
-  self& setMask(
-    bool state ///< @c true to be mask, @c false to be hash.
-  );
-
-  self& clearReserved(); ///< Set reserved bits to zero.
+  self &setAddr(uint32_t ///< Identifying IP address.
+                );
+  uint16_t getHashRev() const;     ///< Get hash revision field.
+  self &setHashRev(uint16_t rev);  ///< Set hash revision field to @a rev.
+  self &initHashRev();             ///< Set hash revision to default value.
+  bool getUnassigned() const;      ///< Get unassigned field.
+  self &setUnassigned(bool state); ///< Set unassigned field to @a state.
+  bool isMask() const;             ///< @return @c true if this is a mask assignment.
+                                   /** Set the maskiness of this structure.
+                                       Be very careful with this, as different values change the
+                                       memory layout of the object.
+                                   */
+  self &setMask(bool state         ///< @c true to be mask, @c false to be hash.
+                );
+
+  self &clearReserved(); ///< Set reserved bits to zero.
   //@}
   /// Initialize to unassigned hash.
   /// The cache address is set to @a addr.
-  self& initDefaultHash(
-    uint32_t addr ///< Identifying cache address.
-  );
+  self &initDefaultHash(uint32_t addr ///< Identifying cache address.
+                        );
   /// Initialize to unassigned mask
   /// The cache address is set to @a addr.
-  self& initDefaultMask(
-    uint32_t addr ///< Identifying cache address.
-  );
+  self &initDefaultMask(uint32_t addr ///< Identifying cache address.
+                        );
   /** Fill in element from source copy.
       Internal memory is allocated and the @a src copied.
    */
-  self& fill(
-    self const& src ///< Original source element
-  );
+  self &fill(self const &src ///< Original source element
+             );
   /** Fill in element from source copy.
       This is used to write the element to memory that is allocated
       independently of the box.
       @note Caller is expected to have verified sufficient buffer space.
    */
-  self& fill(
-    void* base, ///< Target buffer.
-    self const& src ///< Original source element
-  );
+  self &fill(void *base,     ///< Target buffer.
+             self const &src ///< Original source element
+             );
   /// Initialize box from an existing element in memory.
-  int parse(
-    MsgBuffer base ///< Source memory.
-  );
+  int parse(MsgBuffer base ///< Source memory.
+            );
 
   /// Get the size in bytes of the contained element.
   size_t getSize() const;
+
 protected:
   /// Force buffer to be at least @a n bytes
-  self& require(
-    size_t n ///< Minimum buffer size required.
-  );
-
-  CacheIdElt* m_base; ///< Base address of memory for element.
-  CacheIdElt::Tail* m_tail; ///< Base address of trailing data elements.
-  size_t m_size; ///< Size of element (valid data in buffer);
-  size_t m_cap; ///< Size of allocated memory. Zero if external memory.
+  self &require(size_t n ///< Minimum buffer size required.
+                );
+
+  CacheIdElt *m_base;       ///< Base address of memory for element.
+  CacheIdElt::Tail *m_tail; ///< Base address of trailing data elements.
+  size_t m_size;            ///< Size of element (valid data in buffer);
+  size_t m_cap;             ///< Size of allocated memory. Zero if external memory.
 };
 
 /** Base class for all components.
@@ -878,7 +864,8 @@ protected:
     represented by a C++ structure (which is why we need this
     indirection in the first place).
 */
-class ComponentBase {
+class ComponentBase
+{
 public:
   typedef ComponentBase self; ///< Self reference type.
   /// Default constructor.
@@ -889,21 +876,22 @@ public:
 protected:
   /// Base of component in message data.
   /// If this is @c NULL then the component is not in the message.
-  char* m_base;
+  char *m_base;
 };
 
 /// Synthetic component to represent the overall message header.
-class MsgHeaderComp : public ComponentBase {
+class MsgHeaderComp : public ComponentBase
+{
 public:
-  typedef MsgHeaderComp self; ///< Self reference type.
+  typedef MsgHeaderComp self;  ///< Self reference type.
   typedef ComponentBase super; ///< Parent type.
 
   /// Sect 5.5:  Message Header
   /// Serialized layout of message header.
   struct raw_t {
-    uint32_t m_type; ///< @c message_type_t
+    uint32_t m_type;    ///< @c message_type_t
     uint16_t m_version; ///< Implementation version of sender
-    uint16_t m_length; ///< Message body length (excluding header)
+    uint16_t m_length;  ///< Message body length (excluding header)
   };
 
   /// Default constructor.
@@ -911,26 +899,24 @@ public:
 
   /// @name Accessors
   //@{
-  message_type_t getType(); ///< Get message type field.
-  uint16_t getVersion(); ///< Get message version field.
-  uint16_t getLength(); ///< Get message length field.
-  self& setType(message_type_t type); ///< Set message type field to @a type.
-  self& setVersion(uint16_t version); ///< Set version field to @a version.
-  self& setLength(uint16_t length); ///< Set length field to @a length.
+  message_type_t getType();           ///< Get message type field.
+  uint16_t getVersion();              ///< Get message version field.
+  uint16_t getLength();               ///< Get message length field.
+  self &setType(message_type_t type); ///< Set message type field to @a type.
+  self &setVersion(uint16_t version); ///< Set version field to @a version.
+  self &setLength(uint16_t length);   ///< Set length field to @a length.
   //@}
 
   /// Write initial values to message data.
   /// @a base is updated to account for this component.
-  self& fill(
-    MsgBuffer& base, ///< [in,out] Buffer for component storage.
-    message_type_t t ///< Message type.
-  );
+  self &fill(MsgBuffer &base, ///< [in,out] Buffer for component storage.
+             message_type_t t ///< Message type.
+             );
 
   /// Validate component for existing data.
   /// @a base is updated to account for this component.
-  int parse(
-    MsgBuffer& base ///< [in,out] Base address for component data.
-  );
+  int parse(MsgBuffer &base ///< [in,out] Base address for component data.
+            );
 
   /// Compute size of a component of this type.
   static size_t calcSize();
@@ -947,9 +933,8 @@ public:
     @internal This saves some work getting around C++ co-variance issues
     with return values.
 */
-template <
-  typename T ///< Child class (CRT pattern)
-  >
+template <typename T ///< Child class (CRT pattern)
+          >
 struct CompWithHeader : public ComponentBase {
   /** Serialized layout of per component header.
       All components except the message header start with this structure.
@@ -957,7 +942,7 @@ struct CompWithHeader : public ComponentBase {
       subclass this for their own @c raw_t.
   */
   struct raw_t {
-    uint16_t m_type; ///< Serialized @ref CompType.
+    uint16_t m_type;   ///< Serialized @ref CompType.
     uint16_t m_length; ///< length of rest of component (not including header).
   };
   /** Size of header.
@@ -968,11 +953,11 @@ struct CompWithHeader : public ComponentBase {
 
   /// @name Accessors
   //@{
-  CompType getType() const; ///< Get component type field.
-  uint16_t getLength() const; ///< Get component length field.
-  T& setType(CompType type); ///< Set component type field to @a type.
-  T& setLength(uint16_t length); ///< Set length field to @a length.
-  //@}
+  CompType getType() const;      ///< Get component type field.
+  uint16_t getLength() const;    ///< Get component length field.
+  T &setType(CompType type);     ///< Set component type field to @a type.
+  T &setLength(uint16_t length); ///< Set length field to @a length.
+                                 //@}
 
   /** Check the component header for type and length sanity.
       This requires the (subclass) client to
@@ -985,21 +970,19 @@ struct CompWithHeader : public ComponentBase {
 
       @return A parse result.
   */
-  int checkHeader(
-    MsgBuffer const& buffer, ///< Message buffer.
-    CompType t ///< Expected component type.
-  );
+  int checkHeader(MsgBuffer const &buffer, ///< Message buffer.
+                  CompType t               ///< Expected component type.
+                  );
 };
 
 /** Sect 5.6.1: Security Info Component
     This is used for both security options. Clients should check
     the @c m_option to see if the @a m_impl member is valid.
 */
-class SecurityComp
-  : public CompWithHeader<SecurityComp> {
-
+class SecurityComp : public CompWithHeader<SecurityComp>
+{
 public:
-  typedef SecurityComp self; ///< Self reference type.
+  typedef SecurityComp self;          ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
   /// Specify the type for this component.
   static CompType const COMP_TYPE = SECURITY_INFO;
@@ -1030,14 +1013,14 @@ public:
 
   /// @name Accessors
   //@{
-  Option getOption() const; ///< Get security option field.
-  self& setOption(Option opt); ///< Set security option field to @a opt.
+  Option getOption() const;    ///< Get security option field.
+  self &setOption(Option opt); ///< Set security option field to @a opt.
   //@}
 
   /// Write default values to the serialization buffer.
-  self& fill(MsgBuffer& buffer, Option opt = m_default_opt);
+  self &fill(MsgBuffer &buffer, Option opt = m_default_opt);
   /// Validate an existing structure.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the memory size of the component.
   static size_t calcSize(Option opt);
@@ -1045,27 +1028,22 @@ public:
   /// Set the global / default security key.
   /// This is used for the security hash unless the local key is set.
   /// @a key is copied to a global buffer and clipped to @c KEY_SIZE bytes.
-  static void setDefaultKey(
-    char const* key ///< Shared key.
-  );
-  static void setDefaultOption(
-    Option opt ///< Type of security.
-  );
+  static void setDefaultKey(char const *key ///< Shared key.
+                            );
+  static void setDefaultOption(Option opt ///< Type of security.
+                               );
 
   /// Set messsage local security key.
-  self& setKey(
-    char const* key ///< Shared key.
-  );
+  self &setKey(char const *key ///< Shared key.
+               );
 
   /// Compute and set the security data.
   /// @a msg must be a buffer that covers exactly the entire message.
-  self& secure(
-    MsgBuffer const& msg ///< Message data.
-  );
+  self &secure(MsgBuffer const &msg ///< Message data.
+               );
 
-  bool validate(
-    MsgBuffer const& msg ///< Message data.
-  ) const;
+  bool validate(MsgBuffer const &msg ///< Message data.
+                ) const;
 
 protected:
   /// Local to this message shared key / password.
@@ -1079,11 +1057,10 @@ protected:
 };
 
 /// Sect 5.6.2: Service Info Component
-class ServiceComp
-  : public CompWithHeader<ServiceComp> {
-
+class ServiceComp : public CompWithHeader<ServiceComp>
+{
 public:
-  typedef ServiceComp self; ///< Self reference type.
+  typedef ServiceComp self;           ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Specify the type for this component.
@@ -1098,64 +1075,60 @@ public:
   /// @name Accessors
   //@{
   ServiceGroup::Type getSvcType() const; ///< Get service type field.
-  /** Set the service type.
-      If @a svc is @c SERVICE_STANDARD then all fields except the
-      component header and service id are set to zero as required
-      by the protocol.
-  */
-  self& setSvcType(ServiceGroup::Type svc);
+                                         /** Set the service type.
+                                             If @a svc is @c SERVICE_STANDARD then all fields except the
+                                             component header and service id are set to zero as required
+                                             by the protocol.
+                                         */
+  self &setSvcType(ServiceGroup::Type svc);
 
-  uint8_t getSvcId() const; ///< Get service ID field.
-  self& setSvcId(uint8_t id); ///< Set service ID field to @a id.
+  uint8_t getSvcId() const;   ///< Get service ID field.
+  self &setSvcId(uint8_t id); ///< Set service ID field to @a id.
 
-  uint8_t getPriority() const; ///< Get priority field.
-  self& setPriority(uint8_t pri); ///< Set priority field to @a p.
+  uint8_t getPriority() const;    ///< Get priority field.
+  self &setPriority(uint8_t pri); ///< Set priority field to @a p.
 
-  uint8_t getProtocol() const; ///< Get protocol field.
-  self& setProtocol(uint8_t p); ///< Set protocol field to @a p.
+  uint8_t getProtocol() const;  ///< Get protocol field.
+  self &setProtocol(uint8_t p); ///< Set protocol field to @a p.
 
-  uint32_t getFlags() const; ///< Get flags field.
-  self& setFlags(uint32_t f); ///< Set the flags flags in field to @a f.
+  uint32_t getFlags() const;  ///< Get flags field.
+  self &setFlags(uint32_t f); ///< Set the flags flags in field to @a f.
   /// Set the flags in the flag field that are set in @a f.
   /// Other flags are unchanged.
-  self& enableFlags(uint32_t f);
+  self &enableFlags(uint32_t f);
   /// Clear the flags in the flag field that are set in @a f.
   /// Other flags are unchanged.
-  self& disableFlags(uint32_t f);
+  self &disableFlags(uint32_t f);
 
   /// Get a port value.
-  uint16_t getPort(
-    int idx ///< Index of target port.
-  ) const;
+  uint16_t getPort(int idx ///< Index of target port.
+                   ) const;
   /// Set a port value.
-  self& setPort(
-    int idx, ///< Index of port.
-    uint16_t port ///< Value for port.
-  );
+  self &setPort(int idx,      ///< Index of port.
+                uint16_t port ///< Value for port.
+                );
   /// Zero (clear) all ports.
-  self& clearPorts();
+  self &clearPorts();
   /** Add a port to the service.
       The first port which has not been set is set to @a port. It is an error
       to add more than @c N_PORTS ports.
    */
-  self& addPort(
-    uint16_t port ///< Port value.
-  );
+  self &addPort(uint16_t port ///< Port value.
+                );
   //@}
 
   /// Raw access to ServiceGroup.
-  operator ServiceGroup const& () const;
+  operator ServiceGroup const &() const;
 
   /** Fill from a service group definition.
    */
-  self& fill(
-    MsgBuffer& base, ///< Target storage.
-    ServiceGroup const& svc ///< Service group definition.
-  );
+  self &fill(MsgBuffer &base,        ///< Target storage.
+             ServiceGroup const &svc ///< Service group definition.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the memory size of the component.
   static size_t calcSize();
@@ -1164,19 +1137,18 @@ protected:
   int m_port_count; ///< Number of ports in use.
 
   /// Cast raw internal pointer to data type.
-  raw_t* access();
+  raw_t *access();
   /// Cast raw internal pointer to data type.
-  raw_t const* access() const;
+  raw_t const *access() const;
 };
 
 /// Sect 5.6.3: RouterIdentity Info Component
 /// @note An instance of this struct is followed by @a m_count
 /// IP addresses.
-class RouterIdComp
-  : public CompWithHeader<RouterIdComp> {
-
+class RouterIdComp : public CompWithHeader<RouterIdComp>
+{
 public:
-  typedef RouterIdComp self; ///< Self reference type.
+  typedef RouterIdComp self;          ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Specify the type for this component.
@@ -1197,81 +1169,72 @@ public:
   /// @name Accessors
   //@{
   /// Directly access router ID element.
-  RouterIdElt& idElt();
+  RouterIdElt &idElt();
   /// Directly access router ID element.
-  RouterIdElt const& idElt() const;
+  RouterIdElt const &idElt() const;
   /// Set the fields in the router ID element.
-  self& setIdElt(
-    uint32_t addr, ///< Identifying IP address for router.
-    uint32_t recv_id ///< Receive count for router to target cache.
-  );
-  uint32_t getAddr() const; ///< Get the address field in the ID element.
-  self& setAddr(uint32_t addr); ///< Set the address field in the ID element.
-  uint32_t getRecvId() const; ///< Get the receive ID field in the ID element.
-  self& setRecvId(uint32_t id); ///< Set the receive ID field in the ID element.
+  self &setIdElt(uint32_t addr,   ///< Identifying IP address for router.
+                 uint32_t recv_id ///< Receive count for router to target cache.
+                 );
+  uint32_t getAddr() const;     ///< Get the address field in the ID element.
+  self &setAddr(uint32_t addr); ///< Set the address field in the ID element.
+  uint32_t getRecvId() const;   ///< Get the receive ID field in the ID element.
+  self &setRecvId(uint32_t id); ///< Set the receive ID field in the ID element.
 
   /// Get the sent to address.
   uint32_t getToAddr() const;
   /// Set the sent to address.
-  self& setToAddr(
-    uint32_t addr ///< Address value.
-  );
+  self &setToAddr(uint32_t addr ///< Address value.
+                  );
   /// Get router count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getFromCount() const;
   /// Get received from address.
-  uint32_t getFromAddr(
-    int idx ///< Index of address.
-  ) const;
+  uint32_t getFromAddr(int idx ///< Index of address.
+                       ) const;
   /// Set received from address.
-  self& setFromAddr(
-    int idx, ///< Index of address.
-    uint32_t addr ///< Address value.
-  );
+  self &setFromAddr(int idx,      ///< Index of address.
+                    uint32_t addr ///< Address value.
+                    );
   //@}
   /// Find an address in the from list.
   /// @return The index of the address, or -1 if not found.
-  int findFromAddr(
-    uint32_t addr ///< Search value.
-  );
+  int findFromAddr(uint32_t addr ///< Search value.
+                   );
 
   /** Write serialization data for single cache target.
       This completely fills the component.
   */
-  self& fillSingleton(
-    MsgBuffer& base, ///< Target storage.
-    uint32_t addr, ///< Identifying IP address.
-    uint32_t recv_count, ///< Receive count for target cache.
-    uint32_t to_addr, ///< Destination address in initial packet.
-    uint32_t from_addr ///< Identifying IP address of target cache.
-  );
+  self &fillSingleton(MsgBuffer &base,     ///< Target storage.
+                      uint32_t addr,       ///< Identifying IP address.
+                      uint32_t recv_count, ///< Receive count for target cache.
+                      uint32_t to_addr,    ///< Destination address in initial packet.
+                      uint32_t from_addr   ///< Identifying IP address of target cache.
+                      );
 
   /** Write basic message structure.
       The router and cache data must be filled in separately.
   */
-  self& fill(
-    MsgBuffer& base, ///< Target storage.
-    size_t n_caches ///< Number of caches (fromAddr).
-  );
+  self &fill(MsgBuffer &base, ///< Target storage.
+             size_t n_caches  ///< Number of caches (fromAddr).
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the memory size of the component.
-  static size_t calcSize(
-    int n ///< Receive address count
-  );
+  static size_t calcSize(int n ///< Receive address count
+                         );
 };
 
 /** Sect 5.6.4: Web-Cache Identity Info Component
 */
-class CacheIdComp
-  : public CompWithHeader<CacheIdComp> {
-
+class CacheIdComp : public CompWithHeader<CacheIdComp>
+{
 public:
-  typedef CacheIdComp self; ///< Self reference type.
+  typedef CacheIdComp self;           ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1285,49 +1248,48 @@ public:
   /// @name Accessors
   //@{
   /// Direct access to the cache ID element.
-  CacheIdBox& cacheId();
-  CacheIdBox const& cacheId() const;
+  CacheIdBox &cacheId();
+  CacheIdBox const &cacheId() const;
 
   // Only forward the common ones.
-  uint32_t getAddr() const; ///< Get address field.
-  self& setAddr(uint32_t addr); ///< Set address field to @a addr.
-  uint16_t getHashRev() const; ///< Get hash revision field.
-  self& setHashRev(uint16_t rev); ///< Set hash revision field to @a rev.
-  bool getUnassigned() const; ///< Get unassigned field.
-  self& setUnassigned(bool state); ///< Set unassigned field to @a state.
-  uint16_t getWeight() const; ///< Get weight field.
-  self& setWeight(uint16_t w); ///< Set weight field to @a w.
-  uint16_t getStatus() const; ///< Get status field.
-  self& setStatus(uint16_t s); ///< Set status field to @a s.
-  //@}
+  uint32_t getAddr() const;        ///< Get address field.
+  self &setAddr(uint32_t addr);    ///< Set address field to @a addr.
+  uint16_t getHashRev() const;     ///< Get hash revision field.
+  self &setHashRev(uint16_t rev);  ///< Set hash revision field to @a rev.
+  bool getUnassigned() const;      ///< Get unassigned field.
+  self &setUnassigned(bool state); ///< Set unassigned field to @a state.
+  uint16_t getWeight() const;      ///< Get weight field.
+  self &setWeight(uint16_t w);     ///< Set weight field to @a w.
+  uint16_t getStatus() const;      ///< Get status field.
+  self &setStatus(uint16_t s);     ///< Set status field to @a s.
+                                   //@}
 
   /** Write serialization data.
       - Sets required header fields for the component.
       - Copies the data from @a src.
   */
-  self& fill(
-    MsgBuffer& base, ///< Target storage.
-    CacheIdBox const& src ///< Cache descriptor
-  );
+  self &fill(MsgBuffer &base,      ///< Target storage.
+             CacheIdBox const &src ///< Cache descriptor
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the memory size of the component.
   /// Cannot be reliably computed statically.
   size_t getSize();
+
 protected:
   CacheIdBox m_box; ///< Wrapper for cache id element.
 };
 
 /** Sect 5.6.5: Router View Info Component
  */
-class RouterViewComp
-  : public CompWithHeader<RouterViewComp> {
-
+class RouterViewComp : public CompWithHeader<RouterViewComp>
+{
 public:
-  typedef RouterViewComp self; ///< Self reference type.
+  typedef RouterViewComp self;        ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1337,8 +1299,8 @@ public:
   /// There is more variable sized data that must be handled specially.
   struct raw_t : public super::raw_t {
     uint32_t m_change_number; ///< Sequence number.
-    AssignmentKeyElt m_key; ///< Assignment data.
-    uint32_t m_router_count; ///< # of router elements.
+    AssignmentKeyElt m_key;   ///< Assignment data.
+    uint32_t m_router_count;  ///< # of router elements.
   };
 
   RouterViewComp();
@@ -1346,46 +1308,42 @@ public:
   /// @name Accessors
   //@{
   /// Directly access assignment key.
-  AssignmentKeyElt& keyElt();
+  AssignmentKeyElt &keyElt();
   /// Directly access assignment key.
-  AssignmentKeyElt const& keyElt() const;
+  AssignmentKeyElt const &keyElt() const;
   /// Get address in assignment key.
   uint32_t getKeyAddr() const;
   /// Set address in assignment key.
-  self& setKeyAddr(uint32_t addr);
+  self &setKeyAddr(uint32_t addr);
   /// Get change number in assignment key.
   uint32_t getKeyChangeNumber() const;
   /// Set change number in assignment key.
-  self& setKeyChangeNumber(uint32_t n);
+  self &setKeyChangeNumber(uint32_t n);
 
-  uint32_t getChangeNumber() const; ///< Get change number field.
-  self& setChangeNumber(uint32_t n); ///< Set change number field to @a n
+  uint32_t getChangeNumber() const;  ///< Get change number field.
+  self &setChangeNumber(uint32_t n); ///< Set change number field to @a n
 
   /// Get cache count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getCacheCount() const;
   /// Access cache element.
-  CacheIdBox& cacheId(
-    int idx ///< Index of target element.
-  );
+  CacheIdBox &cacheId(int idx ///< Index of target element.
+                      );
   /// Access cache element.
-  CacheIdBox const& cacheId(
-    int idx ///< Index of target element.
-  ) const;
+  CacheIdBox const &cacheId(int idx ///< Index of target element.
+                            ) const;
   /// Get router count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getRouterCount() const;
   /// Get router address.
-  uint32_t getRouterAddr(
-    int idx ///< Index of router.
-  ) const;
+  uint32_t getRouterAddr(int idx ///< Index of router.
+                         ) const;
   /// Set router address.
-  self& setRouterAddr(
-    int idx, ///< Index of router.
-    uint32_t addr ///< Address value.
-  );
+  self &setRouterAddr(int idx,      ///< Index of router.
+                      uint32_t addr ///< Address value.
+                      );
   //@}
 
   /** Write serialization data.
@@ -1393,36 +1351,34 @@ public:
       A client @b must call this method before writing any fields directly.
       After invocation the client must fill in the router and cache elements.
   */
-  self& fill(
-    MsgBuffer& base, ///< Target storage.
-    int n_routers, ///< Number of routers in view.
-    int n_caches ///< Number of caches in view.
-  );
+  self &fill(MsgBuffer &base, ///< Target storage.
+             int n_routers,   ///< Number of routers in view.
+             int n_caches     ///< Number of caches in view.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
 protected:
   /// Serialized count of cache addresses.
   /// The actual addresses start immediate after this.
-  uint32_t* m_cache_count;
+  uint32_t *m_cache_count;
   /// Wrappers for cache identity elements.
   /// These are variably sized in the general case.
   CacheIdBox m_cache_ids[MAX_CACHES];
 
   /// Compute the address of the cache count field.
   /// Assumes the router count field is set.
-  uint32_t* calc_cache_count_ptr();
+  uint32_t *calc_cache_count_ptr();
 };
 
 /** Sect 5.6.6: Web-Cache View Info Component
  */
-class CacheViewComp
-  : public CompWithHeader<CacheViewComp> {
-
+class CacheViewComp : public CompWithHeader<CacheViewComp>
+{
 public:
-  typedef CacheViewComp self; ///< Self reference type.
+  typedef CacheViewComp self;         ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1432,42 +1388,38 @@ public:
   /// There is more variable sized data that must be handled specially.
   struct raw_t : public super::raw_t {
     uint32_t m_change_number; ///< Sequence number.
-    uint32_t m_router_count; ///< # of router ID elements.
+    uint32_t m_router_count;  ///< # of router ID elements.
   };
 
   /// @name Accessors
   //@{
-  uint32_t getChangeNumber() const; ///< Get change number field.
-  self& setChangeNumber(uint32_t n); ///< Set change number field to @a n
+  uint32_t getChangeNumber() const;  ///< Get change number field.
+  self &setChangeNumber(uint32_t n); ///< Set change number field to @a n
 
   /// Get router count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getRouterCount() const;
   /// Access a router ID element.
-  RouterIdElt& routerElt(
-    int idx ///< Index of target element.
-  );
+  RouterIdElt &routerElt(int idx ///< Index of target element.
+                         );
   /** Find a router element by router IP address.
       @return A pointer to the router element or @c NULL
       if no router is identified by @a addr.
   */
-  RouterIdElt* findf_router_elt(
-    uint32_t addr ///< Router IP address.
-  );
+  RouterIdElt *findf_router_elt(uint32_t addr ///< Router IP address.
+                                );
   /// Get cache count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getCacheCount() const;
   /// Get a cache address.
-  uint32_t getCacheAddr(
-    int idx ///< Index of target address.
-  ) const;
+  uint32_t getCacheAddr(int idx ///< Index of target address.
+                        ) const;
   /// Set a cache address.
-  self& setCacheAddr(
-    int idx, ///< Index of target address.
-    uint32_t addr ///< Address value to set.
-  );
+  self &setCacheAddr(int idx,      ///< Index of target address.
+                     uint32_t addr ///< Address value to set.
+                     );
   //@}
 
   /** Write serialization data.
@@ -1475,37 +1427,34 @@ public:
       A client @b must call this method before writing any fields directly.
       After invocation the client must fill in the router and cache elements.
   */
-  self& fill(
-    MsgBuffer& buffer, ///< Target storage.
-    detail::cache::GroupData const& group ///< Service group information.
-  );
+  self &fill(MsgBuffer &buffer,                    ///< Target storage.
+             detail::cache::GroupData const &group ///< Service group information.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the total size of the component.
-  static size_t calcSize(
-    int n_routers, ///< Number of routers in view.
-    int n_caches ///< Number of caches in view.
-  );
+  static size_t calcSize(int n_routers, ///< Number of routers in view.
+                         int n_caches   ///< Number of caches in view.
+                         );
 
 protected:
   /// Get router element array.
   /// @return A pointer to the first router element.
-  RouterIdElt* atf_router_array();
+  RouterIdElt *atf_router_array();
   /// Serialized count of cache addresses.
   /// The actual addresses start immediate after this.
-  uint32_t* m_cache_count;
+  uint32_t *m_cache_count;
 };
 
 /** Sect 5.6.7: Assignment Info Component
  */
-class AssignInfoComp
-  : public CompWithHeader<AssignInfoComp> {
-
+class AssignInfoComp : public CompWithHeader<AssignInfoComp>
+{
 public:
-  typedef AssignInfoComp self; ///< Self reference type.
+  typedef AssignInfoComp self;        ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1514,7 +1463,7 @@ public:
   /// Stub of the serialized data.
   /// There is more variable sized data that must be handled specially.
   struct raw_t : public super::raw_t {
-    AssignmentKeyElt m_key; ///< Assignment key data.
+    AssignmentKeyElt m_key;        ///< Assignment key data.
     RouterAssignListElt m_routers; ///< Routers.
   };
   typedef HashAssignElt::Bucket Bucket; ///< Import type.
@@ -1522,84 +1471,76 @@ public:
   /// @name Accessors
   //@{
   /// Directly access assignment key.
-  AssignmentKeyElt& keyElt();
+  AssignmentKeyElt &keyElt();
   /// Directly access assignment key.
-  AssignmentKeyElt const& keyElt() const;
+  AssignmentKeyElt const &keyElt() const;
   /// Get address in assignment key.
   uint32_t getKeyAddr() const;
   /// Set address in assignment key.
-  self& setKeyAddr(uint32_t addr);
+  self &setKeyAddr(uint32_t addr);
   /// Get change number in assignment key.
   uint32_t getKeyChangeNumber() const;
   /// Set change number in assignment key.
-  self& setKeyChangeNumber(uint32_t n);
+  self &setKeyChangeNumber(uint32_t n);
 
   /// Get router count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getRouterCount() const;
   /// Access a router assignment element.
-  RouterAssignElt& routerElt(
-    int idx ///< Index of target element.
-  );
+  RouterAssignElt &routerElt(int idx ///< Index of target element.
+                             );
   /// Get cache count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getCacheCount() const;
   /// Get a cache address.
-  uint32_t getCacheAddr(
-    int idx ///< Index of target address.
-  ) const;
+  uint32_t getCacheAddr(int idx ///< Index of target address.
+                        ) const;
   /// Set a cache address.
-  self& setCacheAddr(
-    int idx, ///< Index of target address.
-    uint32_t addr ///< Address value to set.
-  );
+  self &setCacheAddr(int idx,      ///< Index of target address.
+                     uint32_t addr ///< Address value to set.
+                     );
   /// Access a bucket.
-  Bucket& bucket(
-    int idx  ///< Index of target bucket.
-  );
+  Bucket &bucket(int idx ///< Index of target bucket.
+                 );
   /// Access a bucket.
-  Bucket const& bucket(
-    int idx ///< Index of target bucket.
-  ) const;
+  Bucket const &bucket(int idx ///< Index of target bucket.
+                       ) const;
   //@}
 
   /// Fill out the component from an @c Assignment.
-  self& fill(
-    MsgBuffer& buffer, ///< Target storage.
-    detail::Assignment const& assign ///< Assignment data.
-  );
+  self &fill(MsgBuffer &buffer,               ///< Target storage.
+             detail::Assignment const &assign ///< Assignment data.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the total size of the component.
-  static size_t calcSize(
-    int n_routers, ///< Number of routers in view.
-    int n_caches ///< Number of caches in view.
-  );
+  static size_t calcSize(int n_routers, ///< Number of routers in view.
+                         int n_caches   ///< Number of caches in view.
+                         );
 
 protected:
   /// Serialized count of cache addresses.
   /// The actual addresses start immediate after this.
-  uint32_t* m_cache_count;
+  uint32_t *m_cache_count;
   /// Serialized bucket data.
-  Bucket* m_buckets;
+  Bucket *m_buckets;
   /// Calculate the address of the cache count.
-  uint32_t* calcCacheCountPtr();
+  uint32_t *calcCacheCountPtr();
   /// Calculate the address of the bucket array.
-  Bucket* calcBucketPtr();
+  Bucket *calcBucketPtr();
 };
 
 /** Sect 5.6.9: Capabilities Info Component
  */
-class CapComp
-  : public CompWithHeader<CapComp> {
-
+class CapComp : public CompWithHeader<CapComp>
+{
 public:
-  typedef CapComp self; ///< Self reference type.
+  typedef CapComp self;               ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1613,12 +1554,10 @@ public:
   /// @name Accessors.
   //@{
   /// Directly access mask value element.
-  CapabilityElt& elt(
-    int idx ///< Index of target element.
-  );
-  CapabilityElt const& elt(
-    int idx ///< Index of target element.
-  ) const;
+  CapabilityElt &elt(int idx ///< Index of target element.
+                     );
+  CapabilityElt const &elt(int idx ///< Index of target element.
+                           ) const;
   /// Get the element count.
   /// @note No corresponding @c setf_ because that cannot be changed once set.
   /// @see fill
@@ -1630,19 +1569,17 @@ public:
       The capability elements must be filled @b after invoking this method.
       And, of course, do not fill more than @a n of them.
   */
-  self& fill(
-    MsgBuffer& buffer, ///< Target storage.
-    int n ///< Number of capabilities.
-  );
+  self &fill(MsgBuffer &buffer, ///< Target storage.
+             int n              ///< Number of capabilities.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the total size of the component.
-  static size_t calcSize(
-    int n ///< Number of capabilities.
-  );
+  static size_t calcSize(int n ///< Number of capabilities.
+                         );
 
   /// Find value for Cache Assignment.
   ServiceGroup::CacheAssignmentStyle getCacheAssignmentStyle() const;
@@ -1652,17 +1589,17 @@ public:
   ServiceGroup::PacketStyle getPacketReturnStyle() const;
   /// Invalidate cached values.
   /// Needed after modifying elements via the @c elt method.
-  self& invalidate();
+  self &invalidate();
 
 protected:
   /// Fill the cached values.
   void cache() const;
 
   int m_count; ///< # of elements.
-  /** Whether the style values are valid.
-      We load all the values on the first request because we have to walk
-      all the capabilities anyway, and cache them.
-  */
+               /** Whether the style values are valid.
+                   We load all the values on the first request because we have to walk
+                   all the capabilities anyway, and cache them.
+               */
   mutable bool m_cached;
   /// Style used to forward packets to cache.
   mutable ServiceGroup::PacketStyle m_packet_forward;
@@ -1675,11 +1612,10 @@ protected:
 /** Sect 5.6.10: Alternate Assignment Component
     This is an abstract base class. It is specialized for each alternate.
  */
-class AltAssignComp
-  : public CompWithHeader<AltAssignComp> {
-
+class AltAssignComp : public CompWithHeader<AltAssignComp>
+{
 public:
-  typedef AltAssignComp self; ///< Self reference type.
+  typedef AltAssignComp self;         ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1692,14 +1628,14 @@ public:
   /// Component secondary header.
   /// @internal Split out because we need to compute its size.
   struct local_header_t {
-    uint16_t m_assign_type; ///< Assignment body type.
+    uint16_t m_assign_type;   ///< Assignment body type.
     uint16_t m_assign_length; ///< Assignment body length.
   };
   /// Stub of the serialized data.
   /// There is more variable sized data that must be handled specially.
   struct raw_t : public super::raw_t, public local_header_t {
     // These are the same in all current subclasses.
-    AssignmentKeyElt m_key; ///< Assignment key data.
+    AssignmentKeyElt m_key;        ///< Assignment key data.
     RouterAssignListElt m_routers; ///< Routers.
   };
 
@@ -1711,49 +1647,45 @@ public:
   /// Get the assignment type.
   uint16_t getAssignType() const;
   /// Set the assignment type.
-  self& setAssignType(
-    uint16_t t ///< Assignment type.
-  );
+  self &setAssignType(uint16_t t ///< Assignment type.
+                      );
   /// Get the assignment length.
   uint16_t getAssignLength() const;
   /// Set the assignment length.
-  self& setAssignLength(
-    uint16_t length ///< Length in bytes.
-  );
+  self &setAssignLength(uint16_t length ///< Length in bytes.
+                        );
   /// Get router count field.
   /// @note No @c setf method because this cannot be changed independently.
   /// @see fill
   uint32_t getRouterCount() const;
   /// Directly access assignment key.
-  AssignmentKeyElt& keyElt();
+  AssignmentKeyElt &keyElt();
   /// Directly access assignment key.
-  AssignmentKeyElt const& keyElt() const;
+  AssignmentKeyElt const &keyElt() const;
   //@}
 
   /// Fill out the component from an @c Assignment.
-  virtual self& fill(
-    MsgBuffer& buffer, ///< Target storage.
-    detail::Assignment const& assign ///< Assignment data.
-  ) = 0;
+  virtual self &fill(MsgBuffer &buffer,               ///< Target storage.
+                     detail::Assignment const &assign ///< Assignment data.
+                     ) = 0;
 
   /// Validate an existing structure.
   /// @return Parse result.
-  virtual int parse(MsgBuffer& buffer) = 0;
+  virtual int parse(MsgBuffer &buffer) = 0;
 
 protected:
   /// Calculate the first byte past the end of the variable data.
-  void* calcVarPtr();
+  void *calcVarPtr();
 };
 
 /** Sect 5.6.10: Alternate Assignment Component
     This is the hash based version.
  */
-class AltHashAssignComp
-  : public AltAssignComp {
-
+class AltHashAssignComp : public AltAssignComp
+{
 public:
   typedef AltHashAssignComp self; ///< Self reference type.
-  typedef AltAssignComp super; ///< Parent type.
+  typedef AltAssignComp super;    ///< Parent type.
 
   /// @name Accessors
   //@{
@@ -1767,63 +1699,58 @@ public:
   virtual ~AltHashAssignComp() {}
 
   /// Fill out the component from an @c Assignment.
-  virtual self& fill(
-    MsgBuffer& buffer, ///< Target storage.
-    detail::Assignment const& assign ///< Assignment data.
-  );
+  virtual self &fill(MsgBuffer &buffer,               ///< Target storage.
+                     detail::Assignment const &assign ///< Assignment data.
+                     );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  virtual int parse(MsgBuffer& buffer);
+  virtual int parse(MsgBuffer &buffer);
 
   /// Compute the total size of the component.
-  static size_t calcSize(
-    int n_routers, ///< Number of routers in view.
-    int n_caches ///< Number of caches in view.
-  );
+  static size_t calcSize(int n_routers, ///< Number of routers in view.
+                         int n_caches   ///< Number of caches in view.
+                         );
 
 protected:
   /// Serialized count of cache addresses.
   /// The actual addresses start immediate after this.
-  uint32_t* m_cache_count;
+  uint32_t *m_cache_count;
   /// Calculate the address of the cache count.
-  uint32_t* calcCacheCountPtr();
+  uint32_t *calcCacheCountPtr();
 };
 
 /** Sect 5.6.10: Alternate Assignment Component
     This is the mask based version.
  */
-class AltMaskAssignComp
-  : public AltAssignComp {
-
+class AltMaskAssignComp : public AltAssignComp
+{
 public:
   typedef AltMaskAssignComp self; ///< Self reference type.
-  typedef AltAssignComp super; ///< Parent type.
+  typedef AltAssignComp super;    ///< Parent type.
 
   /// Force virtual desctructor.
   virtual ~AltMaskAssignComp() {}
 
   /// Fill out the component from an @c Assignment.
-  virtual self& fill(
-    MsgBuffer& buffer, ///< Target storage.
-    detail::Assignment const& assign ///< Assignment data.
-  );
+  virtual self &fill(MsgBuffer &buffer,               ///< Target storage.
+                     detail::Assignment const &assign ///< Assignment data.
+                     );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  virtual int parse(MsgBuffer& buffer);
+  virtual int parse(MsgBuffer &buffer);
 
 protected:
-  MaskAssignElt* m_mask_elt; ///< Address of the mask assign element.
+  MaskAssignElt *m_mask_elt; ///< Address of the mask assign element.
 };
 
 /** Sect 5.6.12: Command Info Component
  */
-class CmdComp
-  : public CompWithHeader<CmdComp> {
-
+class CmdComp : public CompWithHeader<CmdComp>
+{
 public:
-  typedef CmdComp self; ///< Self reference type.
+  typedef CmdComp self;               ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1831,7 +1758,7 @@ public:
 
   /// Command types.
   enum cmd_t {
-    SHUTDOWN = 1, ///< Cache is shutting down.
+    SHUTDOWN = 1,         ///< Cache is shutting down.
     SHUTDOWN_RESPONSE = 2 ///< SHUTDOWN ack.
   };
 
@@ -1839,42 +1766,40 @@ public:
   /// @internal Technically the command data is variable, but all currently
   /// defined commands have the same 32 bit data element.
   struct raw_t : public super::raw_t {
-    uint16_t m_cmd; ///< Command type / code.
+    uint16_t m_cmd;        ///< Command type / code.
     uint16_t m_cmd_length; ///< Length of command data.
-    uint32_t m_cmd_data; ///< Command data.
+    uint32_t m_cmd_data;   ///< Command data.
   };
 
   /// @name Accessors.
   //@{
   /// Directly access mask value element.
-  cmd_t getCmd() const; ///< Get command type.
-  self& setCmd(cmd_t cmd); ///< Set command type.
-  uint32_t getCmdData() const; ///< Get command data.
-  self& setCmdData(uint32_t data); ///< Set command @a data.
+  cmd_t getCmd() const;            ///< Get command type.
+  self &setCmd(cmd_t cmd);         ///< Set command type.
+  uint32_t getCmdData() const;     ///< Get command data.
+  self &setCmdData(uint32_t data); ///< Set command @a data.
   //@}
 
   /// Write basic serialization data.
   /// Elements must be filled in seperately and after invoking this method.
-  self& fill(
-    MsgBuffer& buffer, ///< Component storage.
-    cmd_t cmd, ///< Command type.
-    uint32_t data ///< Command data.
-  );
+  self &fill(MsgBuffer &buffer, ///< Component storage.
+             cmd_t cmd,         ///< Command type.
+             uint32_t data      ///< Command data.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the total size of the component.
   static size_t calcSize();
 };
 
 /// Sect 5.6.11: Assignment Map Component
-class AssignMapComp
-  : public CompWithHeader<AssignMapComp> {
-
+class AssignMapComp : public CompWithHeader<AssignMapComp>
+{
 public:
-  typedef AssignMapComp self; ///< Self reference type.
+  typedef AssignMapComp self;         ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1896,21 +1821,20 @@ public:
   //@}
 
   /// Fill from assignment data.
-  self& fill(
-    MsgBuffer& buffer, ///< Component storage.
-    detail::Assignment const& assign ///< Assignment data.
-  );
+  self &fill(MsgBuffer &buffer,               ///< Component storage.
+             detail::Assignment const &assign ///< Assignment data.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 };
 
 /// Sect 5.6.8: Router Query Info Component.
-class QueryComp
-  : public CompWithHeader<QueryComp> {
+class QueryComp : public CompWithHeader<QueryComp>
+{
 public:
-  typedef QueryComp self; ///< Self reference type.
+  typedef QueryComp self;             ///< Self reference type.
   typedef CompWithHeader<self> super; ///< Parent type.
 
   /// Component type ID for this component.
@@ -1919,37 +1843,36 @@ public:
   /// Internal layout.
   struct raw_t : public super::raw_t {
     uint32_t m_router_addr; ///< Identifying router address.
-    uint32_t m_recv_id; ///< Receive ID router expects in reply.
-    uint32_t m_to_addr; ///< Destination address of query.
-    uint32_t m_cache_addr; ///< Identifying address of cache.
+    uint32_t m_recv_id;     ///< Receive ID router expects in reply.
+    uint32_t m_to_addr;     ///< Destination address of query.
+    uint32_t m_cache_addr;  ///< Identifying address of cache.
   };
 
   /// @name Accessors.
   //@{
   /// Directly access mask value element.
-  uint32_t getRouterAddr() const; ///< Get identifying router address.
-  self& setRouterAddr(uint32_t addr); ///< Set identifying router address.
-  uint32_t getToAddr() const; ///< Get target address.
-  self& setToAddr(uint32_t addr); ///< Set target address.
-  uint32_t getCacheAddr() const; ///< Get identifying cache address.
-  self& setCacheAddr(uint32_t addr); ///< Set identifying cache address.
-  uint32_t getRecvId() const; ///< Get receive ID.
-  self& setRecvId(uint32_t data); ///< Set receive ID.
+  uint32_t getRouterAddr() const;     ///< Get identifying router address.
+  self &setRouterAddr(uint32_t addr); ///< Set identifying router address.
+  uint32_t getToAddr() const;         ///< Get target address.
+  self &setToAddr(uint32_t addr);     ///< Set target address.
+  uint32_t getCacheAddr() const;      ///< Get identifying cache address.
+  self &setCacheAddr(uint32_t addr);  ///< Set identifying cache address.
+  uint32_t getRecvId() const;         ///< Get receive ID.
+  self &setRecvId(uint32_t data);     ///< Set receive ID.
   //@}
 
   /// Write serialization data.
   /// This fills in all fields.
-  self& fill(
-    MsgBuffer& buffer, ///< Component storage.
-    uint32_t routerAddr, ///< Router identifying address.
-    uint32_t toAddr, ///< Destination address.
-    uint32_t cacheAddr, ///< Cache identifying address.
-    uint32_t recvId ///< Recieve ID.
-  );
+  self &fill(MsgBuffer &buffer,   ///< Component storage.
+             uint32_t routerAddr, ///< Router identifying address.
+             uint32_t toAddr,     ///< Destination address.
+             uint32_t cacheAddr,  ///< Cache identifying address.
+             uint32_t recvId      ///< Recieve ID.
+             );
 
   /// Validate an existing structure.
   /// @return Parse result.
-  int parse(MsgBuffer& buffer);
+  int parse(MsgBuffer &buffer);
 
   /// Compute the total size of the component.
   static size_t calcSize();
@@ -1957,9 +1880,9 @@ public:
 
 /// Cache assignment hash function.
 inline uint8_t
-assignment_hash(
-  uint32_t key ///< Key to hash.
-) {
+assignment_hash(uint32_t key ///< Key to hash.
+                )
+{
   key ^= key >> 16;
   key ^= key >> 8;
   return key & 0xFF;
@@ -1972,18 +1895,20 @@ struct IpHeader {
 };
 
 // Various static values.
-char const* const BUFFER_TOO_SMALL_FOR_COMP_TEXT = "Unable to write component -- buffer too small";
+char const *const BUFFER_TOO_SMALL_FOR_COMP_TEXT = "Unable to write component -- buffer too small";
 
 // ------------------------------------------------------
-namespace detail {
+namespace detail
+{
   /** Local storage for cache assignment data.
       The maintenance of this data is sufficiently complex that it is better
       to have a standard class to hold it, rather than updating a serialized
       form.
   */
-  class Assignment {
+  class Assignment
+  {
   public:
-    typedef Assignment self; ///< Self reference type.
+    typedef Assignment self;      ///< Self reference type.
     typedef AssignmentKeyElt Key; ///< Import assignment key type.
     /// Import assignment bucket definition.
     /// @internal Just one byte, no serialization issues.
@@ -2002,37 +1927,34 @@ namespace detail {
     */
     bool isActive() const;
     /// Control active flag.
-    self& setActive(
-      bool state ///< New active state.
-    );
+    self &setActive(bool state ///< New active state.
+                    );
 
     /** Fill the assignment from cache service group data.
         Caches that are obsolete are purged from the data.
         @return @c true if a valid assignment was generated,
         @c false otherwise.
     */
-    bool fill(
-      cache::GroupData& group, ///< Service group data.
-      uint32_t addr ///< Identifying IP address of designated cache.
-    );
+    bool fill(cache::GroupData &group, ///< Service group data.
+              uint32_t addr            ///< Identifying IP address of designated cache.
+              );
     /// Update the receive ID for a router.
-    self& updateRouterId(
-      uint32_t addr, ///< Identifying IP address of router.
-      uint32_t rcvid, ///< New receive ID.
-      uint32_t cno ///< New change number.
-    );
+    self &updateRouterId(uint32_t addr,  ///< Identifying IP address of router.
+                         uint32_t rcvid, ///< New receive ID.
+                         uint32_t cno    ///< New change number.
+                         );
 
     /// Get the assignment key.
-    AssignmentKeyElt const& getKey() const;
+    AssignmentKeyElt const &getKey() const;
     /// Get the router assignment list.
-    RouterAssignListElt const& getRouterList() const;
+    RouterAssignListElt const &getRouterList() const;
     /// Get the hash assignment.
-    HashAssignElt const& getHash() const;
+    HashAssignElt const &getHash() const;
     /// Get the mask assignment.
-    MaskAssignElt const& getMask() const;
+    MaskAssignElt const &getMask() const;
 
   protected:
-    Key m_key; ///< Assignment key.
+    Key m_key;     ///< Assignment key.
     bool m_active; ///< Active state.
 
     // These store the serialized assignment chunks which are assembled
@@ -2049,19 +1971,20 @@ namespace detail {
     MsgBuffer m_buffer;
   };
 
-  namespace endpoint {
+  namespace endpoint
+  {
     /// Common service group data.
     struct GroupData {
       typedef GroupData self; ///< Self reference type.
 
-      ServiceGroup m_svc; ///< The service definition.
-      uint32_t m_generation; ///< Generation value (change number).
+      ServiceGroup m_svc;       ///< The service definition.
+      uint32_t m_generation;    ///< Generation value (change number).
       time_t m_generation_time; ///< Time of last view change.
 
-      bool m_use_security_opt; ///< Use group local security.
+      bool m_use_security_opt;             ///< Use group local security.
       SecurityComp::Option m_security_opt; ///< Type of security.
-      bool m_use_security_key; ///< Use group local key.
-      SecurityComp::Key m_security_key; ///< MD5 key.
+      bool m_use_security_key;             ///< Use group local key.
+      SecurityComp::Key m_security_key;    ///< MD5 key.
 
       /** Group assignment data.
           This is used as a place to generate an assignment or
@@ -2072,20 +1995,19 @@ namespace detail {
       /// Default constructor.
       GroupData();
       /// Use @a key instead of global default.
-      self& setKey(
-        char const* key ///< Shared key.
-      );
+      self &setKey(char const *key ///< Shared key.
+                   );
       /// Use security @a style instead of global default.
-      self& setSecurity(
-        SecurityOption style ///< Security style to use.
-      );
+      self &setSecurity(SecurityOption style ///< Security style to use.
+                        );
     };
   }
 }
 // ------------------------------------------------------
 /** Base class for all messages.
  */
-class BaseMsg {
+class BaseMsg
+{
 public:
   /// Default constructor.
   BaseMsg();
@@ -2093,11 +2015,10 @@ public:
   virtual ~BaseMsg() {}
 
   /// Set the message @a buffer.
-  void setBuffer(
-    MsgBuffer const& buffer ///< Storage for message.
-  );
+  void setBuffer(MsgBuffer const &buffer ///< Storage for message.
+                 );
   /// Get the current buffer.
-  MsgBuffer const& buffer() const;
+  MsgBuffer const &buffer() const;
   /// Invoke once all components have been filled.
   /// Sets the length and updates security data if needed.
   virtual void finalize();
@@ -2111,17 +2032,17 @@ public:
   bool validateSecurity() const;
 
   // Common starting components for all messages.
-  MsgHeaderComp m_header; ///< Message header.
+  MsgHeaderComp m_header;  ///< Message header.
   SecurityComp m_security; ///< Security component.
-  ServiceComp m_service; ///< Service provided.
+  ServiceComp m_service;   ///< Service provided.
 
 protected:
   MsgBuffer m_buffer; ///< Raw storage for message data.
 };
 
 /// Sect 5.1: Layout and control for @c WCCP2_HERE_I_AM
-class HereIAmMsg
-  : public BaseMsg {
+class HereIAmMsg : public BaseMsg
+{
 public:
   typedef HereIAmMsg self; ///< Self reference type.
 
@@ -2132,67 +2053,62 @@ public:
       after this call, which will allocate the appropriate spaces
       in the message layou.
   */
-  void fill(
-    detail::cache::GroupData const& group, ///< Service group for message.
-    CacheIdBox const& cache_id, ///< ID to use for this cache.
-    SecurityOption sec_opt ///< Security option to use.
-  );
+  void fill(detail::cache::GroupData const &group, ///< Service group for message.
+            CacheIdBox const &cache_id,            ///< ID to use for this cache.

<TRUNCATED>