You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/05/31 14:47:10 UTC

[trafficserver] branch master updated: More NULL to nullptr conversion

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

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  25b20bf   More NULL to nullptr conversion
25b20bf is described below

commit 25b20bfa3ce7ef914cebbd600dafe31f9d7cdb72
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue May 30 21:15:09 2017 -0700

    More NULL to nullptr conversion
---
 .../experimental/ats_pagespeed/ats_pagespeed.cc    | 202 ++++++++++-----------
 proxy/http/HttpTransactCache.h                     |   6 +-
 proxy/logging/LogBuffer.h                          |   6 +-
 proxy/logging/LogField.h                           |   7 +-
 proxy/logging/LogFile.h                            |   4 +-
 proxy/logging/LogFormat.h                          |   2 +-
 proxy/logging/LogObject.h                          |   4 +-
 proxy/logging/LogUtils.h                           |   8 +-
 proxy/logstats.cc                                  | 162 ++++++++---------
 9 files changed, 201 insertions(+), 200 deletions(-)

diff --git a/plugins/experimental/ats_pagespeed/ats_pagespeed.cc b/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
index fe90fd1..25033b4 100644
--- a/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
+++ b/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
@@ -96,7 +96,7 @@ static int TXN_INDEX_OWNED_ARG;
 static int TXN_INDEX_OWNED_ARG_SET;
 static int TXN_INDEX_OWNED_ARG_UNSET;
 TSMutex config_mutex = TSMutexCreate();
-AtsConfig *config    = NULL;
+AtsConfig *config    = nullptr;
 TransformCtx *
 get_transaction_context(TSHttpTxn txnp)
 {
@@ -109,35 +109,35 @@ ats_ctx_alloc()
   TransformCtx *ctx;
 
   ctx                    = (TransformCtx *)TSmalloc(sizeof(TransformCtx));
-  ctx->downstream_vio    = NULL;
-  ctx->downstream_buffer = NULL;
+  ctx->downstream_vio    = nullptr;
+  ctx->downstream_buffer = nullptr;
   ctx->downstream_length = 0;
   ctx->state             = transform_state_initialized;
 
-  ctx->base_fetch  = NULL;
-  ctx->proxy_fetch = NULL;
+  ctx->base_fetch  = nullptr;
+  ctx->proxy_fetch = nullptr;
 
-  ctx->inflater              = NULL;
-  ctx->url_string            = NULL;
-  ctx->gurl                  = NULL;
+  ctx->inflater              = nullptr;
+  ctx->url_string            = nullptr;
+  ctx->gurl                  = nullptr;
   ctx->write_pending         = false;
   ctx->fetch_done            = false;
   ctx->resource_request      = false;
   ctx->beacon_request        = false;
   ctx->transform_added       = false;
   ctx->mps_user_agent        = false;
-  ctx->user_agent            = NULL;
-  ctx->server_context        = NULL;
+  ctx->user_agent            = nullptr;
+  ctx->server_context        = nullptr;
   ctx->html_rewrite          = false;
-  ctx->request_method        = NULL;
+  ctx->request_method        = nullptr;
   ctx->alive                 = 0xaaaa;
-  ctx->options               = NULL;
-  ctx->to_host               = NULL;
+  ctx->options               = nullptr;
+  ctx->to_host               = nullptr;
   ctx->in_place              = false;
-  ctx->driver                = NULL;
+  ctx->driver                = nullptr;
   ctx->record_in_place       = false;
-  ctx->recorder              = NULL;
-  ctx->ipro_response_headers = NULL;
+  ctx->recorder              = nullptr;
+  ctx->ipro_response_headers = nullptr;
   ctx->serve_in_place        = false;
   return ctx;
 }
@@ -149,59 +149,59 @@ ats_ctx_destroy(TransformCtx *ctx)
   CHECK(ctx->alive == 0xaaaa) << "Already dead!";
   ctx->alive = 0xbbbb;
 
-  if (ctx->base_fetch != NULL) {
+  if (ctx->base_fetch != nullptr) {
     ctx->base_fetch->Release();
-    ctx->base_fetch = NULL;
+    ctx->base_fetch = nullptr;
   }
 
-  if (ctx->proxy_fetch != NULL) {
+  if (ctx->proxy_fetch != nullptr) {
     ctx->proxy_fetch->Done(false /* failure */);
-    ctx->proxy_fetch = NULL;
+    ctx->proxy_fetch = nullptr;
   }
 
-  if (ctx->inflater != NULL) {
+  if (ctx->inflater != nullptr) {
     delete ctx->inflater;
-    ctx->inflater = NULL;
+    ctx->inflater = nullptr;
   }
 
   if (ctx->downstream_buffer) {
     TSIOBufferDestroy(ctx->downstream_buffer);
   }
 
-  if (ctx->url_string != NULL) {
+  if (ctx->url_string != nullptr) {
     delete ctx->url_string;
-    ctx->url_string = NULL;
+    ctx->url_string = nullptr;
   }
 
-  if (ctx->gurl != NULL) {
+  if (ctx->gurl != nullptr) {
     delete ctx->gurl;
-    ctx->gurl = NULL;
+    ctx->gurl = nullptr;
   }
-  if (ctx->user_agent != NULL) {
+  if (ctx->user_agent != nullptr) {
     delete ctx->user_agent;
-    ctx->user_agent = NULL;
+    ctx->user_agent = nullptr;
   }
-  ctx->request_method = NULL;
-  if (ctx->options != NULL) {
+  ctx->request_method = nullptr;
+  if (ctx->options != nullptr) {
     delete ctx->options;
-    ctx->options = NULL;
+    ctx->options = nullptr;
   }
-  if (ctx->to_host != NULL) {
+  if (ctx->to_host != nullptr) {
     delete ctx->to_host;
-    ctx->to_host = NULL;
+    ctx->to_host = nullptr;
   }
-  if (ctx->driver != NULL) {
+  if (ctx->driver != nullptr) {
     ctx->driver->Cleanup();
-    ctx->driver = NULL;
+    ctx->driver = nullptr;
   }
-  if (ctx->recorder != NULL) {
+  if (ctx->recorder != nullptr) {
     ctx->recorder->Fail();
-    ctx->recorder->DoneAndSetHeaders(NULL); // Deletes recorder.
-    ctx->recorder = NULL;
+    ctx->recorder->DoneAndSetHeaders(nullptr); // Deletes recorder.
+    ctx->recorder = nullptr;
   }
-  if (ctx->ipro_response_headers != NULL) {
+  if (ctx->ipro_response_headers != nullptr) {
     delete ctx->ipro_response_headers;
-    ctx->ipro_response_headers = NULL;
+    ctx->ipro_response_headers = nullptr;
   }
 
   TSfree(ctx);
@@ -220,13 +220,13 @@ ps_determine_request_options(const RewriteOptions *domain_options, /* may be nul
     // Failed to parse query params or request headers.  Treat this as if there
     // were no query params given.
     TSError("[ats_pagespeed] ps_route request: parsing headers or query params failed");
-    return NULL;
+    return nullptr;
   }
 
   *pagespeed_query_params   = rewrite_query.pagespeed_query_params().ToEscapedString();
   *pagespeed_option_cookies = rewrite_query.pagespeed_option_cookies().ToEscapedString();
 
-  // Will be NULL if there aren't any options set with query params or in
+  // Will be nullptr if there aren't any options set with query params or in
   // headers.
   return rewrite_query.ReleaseOptions();
 }
@@ -238,7 +238,7 @@ ps_determine_request_options(const RewriteOptions *domain_options, /* may be nul
 //  - experiment framework
 // Consider them all, returning appropriate options for this request, of which
 // the caller takes ownership.  If the only applicable options are global,
-// set options to NULL so we can use server_context->global_options().
+// set options to nullptr so we can use server_context->global_options().
 bool
 ps_determine_options(ServerContext *server_context, RequestHeaders *request_headers, ResponseHeaders *response_headers,
                      RewriteOptions **options, RequestContextPtr request_context, GoogleUrl *url,
@@ -249,24 +249,24 @@ ps_determine_options(ServerContext *server_context, RequestHeaders *request_head
 
   // TODO(oschaaf): we don't have directory_options right now. But if we did,
   // we'd need to take them into account here.
-  RewriteOptions *directory_options = NULL;
+  RewriteOptions *directory_options = nullptr;
 
   // Request-specific options, nearly always null.  If set they need to be
   // rebased on the directory options or the global options.
   // TODO(oschaaf): domain options..
   RewriteOptions *request_options =
-    ps_determine_request_options(NULL /*domain options*/, request_headers, response_headers, request_context, server_context, url,
-                                 pagespeed_query_params, pagespeed_option_cookies);
+    ps_determine_request_options(nullptr /*domain options*/, request_headers, response_headers, request_context, server_context,
+                                 url, pagespeed_query_params, pagespeed_option_cookies);
 
   // Because the caller takes ownership of any options we return, the only
   // situation in which we can avoid allocating a new RewriteOptions is if the
   // global options are ok as are.
-  if (directory_options == NULL && request_options == NULL && !global_options->running_experiment()) {
+  if (directory_options == nullptr && request_options == nullptr && !global_options->running_experiment()) {
     return true;
   }
 
   // Start with directory options if we have them, otherwise request options.
-  if (directory_options != NULL) {
+  if (directory_options != nullptr) {
     //*options = directory_options->Clone();
     // OS: HACK! TODO!
     *options = global_options->Clone();
@@ -279,7 +279,7 @@ ps_determine_options(ServerContext *server_context, RequestHeaders *request_head
   // if we need to.  If there are request options then ignore the experiment
   // because we don't want experiments to be contaminated with unexpected
   // settings.
-  if (request_options != NULL) {
+  if (request_options != nullptr) {
     (*options)->Merge(*request_options);
     delete request_options;
   }
@@ -289,7 +289,7 @@ ps_determine_options(ServerContext *server_context, RequestHeaders *request_head
         r, request_headers, *options, url->Host());
     if (!ok) {
       delete *options;
-      *options = NULL;
+      *options = nullptr;
       return false;
       }
   }*/
@@ -308,9 +308,9 @@ handle_send_response_headers(TSHttpTxn txnp)
   }
   CHECK(ctx->alive == 0xaaaa) << "Already dead !";
   if (ctx->html_rewrite) {
-    TSMBuffer bufp = NULL;
-    TSMLoc hdr_loc = NULL;
-    if (ctx->base_fetch == NULL) {
+    TSMBuffer bufp = nullptr;
+    TSMLoc hdr_loc = nullptr;
+    if (ctx->base_fetch == nullptr) {
       // TODO(oschaaf): figure out when this happens.
       return;
     }
@@ -327,7 +327,7 @@ handle_send_response_headers(TSHttpTxn txnp)
         }
 
         TSMLoc field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, name_gs.data(), name_gs.size());
-        if (field_loc != NULL) {
+        if (field_loc != nullptr) {
           TSMimeHdrFieldValuesClear(bufp, hdr_loc, field_loc);
           TSMimeHdrFieldValueStringInsert(bufp, hdr_loc, field_loc, -1, value_gs.data(), value_gs.size());
         } else if (TSMimeHdrFieldCreate(bufp, hdr_loc, &field_loc) == TS_SUCCESS) {
@@ -369,7 +369,7 @@ copy_response_headers_to_psol(TSMBuffer bufp, TSMLoc hdr_loc, ResponseHeaders *p
     int n_field_values = TSMimeHdrFieldValuesCount(bufp, hdr_loc, field_loc);
     for (int j = 0; j < n_field_values; ++j) {
       value = TSMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, j, &value_len);
-      if (NULL == value || !value_len) {
+      if (nullptr == value || !value_len) {
         TSDebug(DEBUG_TAG, "[%s] Error while getting value #%d of header [%.*s]", __FUNCTION__, j, name_len, name);
       } else {
         StringPiece s_value(value, value_len);
@@ -400,7 +400,7 @@ copy_request_headers_to_psol(TSMBuffer bufp, TSMLoc hdr_loc, RequestHeaders *pso
     int n_field_values = TSMimeHdrFieldValuesCount(bufp, hdr_loc, field_loc);
     for (int j = 0; j < n_field_values; ++j) {
       value = TSMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, j, &value_len);
-      if (NULL == value || !value_len) {
+      if (nullptr == value || !value_len) {
         TSDebug(DEBUG_TAG, "[%s] Error while getting value #%d of header [%.*s]", __FUNCTION__, j, name_len, name);
       } else {
         StringPiece s_value(value, value_len);
@@ -429,7 +429,7 @@ get_host_options(const StringPiece &host, ServerContext *server_context)
   TSMutexLock(config_mutex);
   AtsRewriteOptions *r = (AtsRewriteOptions *)server_context->global_options()->Clone();
   AtsHostConfig *hc    = config->Find(host.data(), host.size());
-  if (hc->options() != NULL) {
+  if (hc->options() != nullptr) {
     // We return a clone here to avoid having to thing about
     // configuration reloads and outstanding options
     hc->options()->ClearSignatureWithCaution();
@@ -484,7 +484,7 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
   downstream_conn        = TSTransformOutputVConnGet(contp);
   ctx->downstream_buffer = TSIOBufferCreate();
   ctx->downstream_vio    = TSVConnWrite(downstream_conn, contp, TSIOBufferReaderAlloc(ctx->downstream_buffer), INT64_MAX);
-  if (ctx->recorder != NULL) {
+  if (ctx->recorder != nullptr) {
     TSHandleMLocRelease(reqp, TS_NULL_MLOC, req_hdr_loc);
     TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return;
@@ -505,21 +505,21 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
   copy_response_headers_to_psol(bufp, hdr_loc, &response_headers);
 
   std::string host        = ctx->gurl->HostAndPort().as_string();
-  RewriteOptions *options = NULL;
+  RewriteOptions *options = nullptr;
   if (host.size() > 0) {
     options = get_host_options(host.c_str(), server_context);
-    if (options != NULL) {
+    if (options != nullptr) {
       server_context->message_handler()->Message(kInfo, "request options found \r\n");
     }
   }
-  if (options == NULL) {
+  if (options == nullptr) {
     options = server_context->global_options()->Clone();
   }
 
   server_context->message_handler()->Message(kInfo, "request options:\r\n[%s]", options->OptionsToString().c_str());
 
   /*
-  RewriteOptions* options = NULL;
+  RewriteOptions* options = nullptr;
   GoogleString pagespeed_query_params;
   GoogleString pagespeed_option_cookies;
   bool ok = ps_determine_options(server_context,
@@ -547,7 +547,7 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
     }*/
 
   RewriteDriver *driver;
-  if (custom_options.get() == NULL) {
+  if (custom_options.get() == nullptr) {
     driver = server_context->NewRewriteDriver(ctx->base_fetch->request_context());
   } else {
     driver = server_context->NewCustomRewriteDriver(custom_options.release(), ctx->base_fetch->request_context());
@@ -569,7 +569,7 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
     false /* requires_blink_cohort (no longer unused) */, &page_callback_added));
 
   ctx->proxy_fetch = ats_process_context->proxy_fetch_factory()->CreateNewProxyFetch(
-    *(ctx->url_string), ctx->base_fetch, driver, property_callback.release(), NULL /* original_content_fetch */);
+    *(ctx->url_string), ctx->base_fetch, driver, property_callback.release(), nullptr /* original_content_fetch */);
 
   TSHandleMLocRelease(reqp, TS_NULL_MLOC, req_hdr_loc);
   TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
@@ -602,8 +602,8 @@ ats_transform_one(TransformCtx *ctx, TSIOBufferReader upstream_reader, int amoun
 
     TSDebug("ats-speed", "transform!");
     // TODO(oschaaf): use at least the message handler from the server conrtext here?
-    if (ctx->inflater == NULL) {
-      if (ctx->recorder != NULL) {
+    if (ctx->inflater == nullptr) {
+      if (ctx->recorder != nullptr) {
         ctx->recorder->Write(StringPiece((char *)upstream_buffer, upstream_length), ats_process_context->message_handler());
       } else {
         ctx->proxy_fetch->Write(StringPiece((char *)upstream_buffer, upstream_length), ats_process_context->message_handler());
@@ -618,7 +618,7 @@ ats_transform_one(TransformCtx *ctx, TSIOBufferReader upstream_reader, int amoun
         if (num_inflated_bytes < 0) {
           TSError("[ats_pagespeed] Corrupted inflation");
         } else if (num_inflated_bytes > 0) {
-          if (ctx->recorder != NULL) {
+          if (ctx->recorder != nullptr) {
             ctx->recorder->Write(StringPiece(buf, num_inflated_bytes), ats_process_context->message_handler());
           } else {
             ctx->proxy_fetch->Write(StringPiece(buf, num_inflated_bytes), ats_process_context->message_handler());
@@ -626,7 +626,7 @@ ats_transform_one(TransformCtx *ctx, TSIOBufferReader upstream_reader, int amoun
         }
       }
     }
-    // ctx->proxy_fetch->Flush(NULL);
+    // ctx->proxy_fetch->Flush(nullptr);
     TSIOBufferReaderConsume(upstream_reader, upstream_length);
     amount -= upstream_length;
   }
@@ -640,14 +640,14 @@ ats_transform_finish(TransformCtx *ctx)
 {
   if (ctx->state == transform_state_output) {
     ctx->state = transform_state_finished;
-    if (ctx->recorder != NULL) {
+    if (ctx->recorder != nullptr) {
       TSDebug("ats-speed", "ipro recording finished");
       ctx->recorder->DoneAndSetHeaders(ctx->ipro_response_headers);
-      ctx->recorder = NULL;
+      ctx->recorder = nullptr;
     } else {
       TSDebug("ats-speed", "proxy fetch finished");
       ctx->proxy_fetch->Done(true);
-      ctx->proxy_fetch = NULL;
+      ctx->proxy_fetch = nullptr;
     }
   }
 }
@@ -685,7 +685,7 @@ ats_transform_do(TSCont contp)
     }
 
     if (upstream_todo > 0) {
-      if (ctx->recorder != NULL) {
+      if (ctx->recorder != nullptr) {
         ctx->downstream_length += upstream_todo;
         TSIOBufferCopy(TSVIOBufferGet(ctx->downstream_vio), TSVIOReaderGet(upstream_vio), upstream_todo, 0);
       }
@@ -703,7 +703,7 @@ ats_transform_do(TSCont contp)
     }
   } else {
     // When not recording, the base fetch will re-enable from the PSOL callback.
-    if (ctx->recorder != NULL) {
+    if (ctx->recorder != nullptr) {
       TSVIONBytesSet(ctx->downstream_vio, ctx->downstream_length);
       TSVIOReenable(ctx->downstream_vio);
     }
@@ -759,7 +759,7 @@ ats_pagespeed_transform_add(TSHttpTxn txnp)
     ctx->transform_added = true;
   }
 
-  TSHttpTxnUntransformedRespCache(txnp, ctx->recorder == NULL ? 1 : 0);
+  TSHttpTxnUntransformedRespCache(txnp, ctx->recorder == nullptr ? 1 : 0);
   TSHttpTxnTransformedRespCache(txnp, 0);
 
   TSVConn connp;
@@ -772,9 +772,9 @@ ats_pagespeed_transform_add(TSHttpTxn txnp)
 void
 handle_read_request_header(TSHttpTxn txnp)
 {
-  TSMBuffer reqp = NULL;
-  TSMLoc hdr_loc = NULL;
-  char *url      = NULL;
+  TSMBuffer reqp = nullptr;
+  TSMLoc hdr_loc = nullptr;
+  char *url      = nullptr;
   int url_length = -1;
 
   TransformCtx *ctx = ats_ctx_alloc();
@@ -842,11 +842,11 @@ handle_read_request_header(TSHttpTxn txnp)
           // ctx->base_fetch->response_headers()->ComputeCaching();
           std::string host = ctx->gurl->HostAndPort().as_string();
           // request_headers->Lookup1(HttpAttributes::kHost);
-          RewriteOptions *options = NULL;
+          RewriteOptions *options = nullptr;
           if (host.size() > 0) {
             options = get_host_options(host.c_str(), server_context);
           }
-          if (options == NULL) {
+          if (options == nullptr) {
             options = server_context->global_options()->Clone();
           }
 
@@ -854,7 +854,7 @@ handle_read_request_header(TSHttpTxn txnp)
           // GoogleString pagespeed_option_cookies;
           // bool ok = ps_determine_options(server_context,
           //                               ctx->base_fetch->request_headers(),
-          //                               NULL /*ResponseHeaders* */,
+          //                               nullptr /*ResponseHeaders* */,
           //                               &options,
           //                               rptr,
           //                              ctx->gurl,
@@ -871,7 +871,7 @@ handle_read_request_header(TSHttpTxn txnp)
           rptr->set_options(options->ComputeHttpOptions());
           if (options->in_place_rewriting_enabled() && options->enabled() && options->IsAllowed(ctx->gurl->Spec())) {
             RewriteDriver *driver;
-            if (custom_options.get() == NULL) {
+            if (custom_options.get() == nullptr) {
               driver = server_context->NewRewriteDriver(ctx->base_fetch->request_context());
             } else {
               driver = server_context->NewCustomRewriteDriver(custom_options.release(), ctx->base_fetch->request_context());
@@ -942,11 +942,11 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
   }
   if (event == TS_EVENT_HTTP_TXN_CLOSE) {
     TransformCtx *ctx = get_transaction_context(txn);
-    // if (ctx != NULL && !ctx->resource_request && !ctx->beacon_request && !ctx->html_rewrite) {
+    // if (ctx != nullptr && !ctx->resource_request && !ctx->beacon_request && !ctx->html_rewrite) {
     // For intercepted requests like beacons and resource requests, we don't own the
     // ctx here - the interceptor does.
 
-    if (ctx != NULL) {
+    if (ctx != nullptr) {
       bool is_owned = TSHttpTxnArgGet(txn, TXN_INDEX_OWNED_ARG) == &TXN_INDEX_OWNED_ARG_SET
                       // TODO(oschaaf): rewrite this.
                       && !ctx->serve_in_place;
@@ -961,8 +961,8 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
     handle_read_request_header(txn);
     return 0;
   } else if (event == TS_EVENT_HTTP_SEND_REQUEST_HDR) {
-    TSMBuffer request_header_buf = NULL;
-    TSMLoc request_header_loc    = NULL;
+    TSMBuffer request_header_buf = nullptr;
+    TSMLoc request_header_loc    = nullptr;
 
     if (TSHttpTxnServerReqGet(txn, &request_header_buf, &request_header_loc) == TS_SUCCESS) {
       hide_accept_encoding(request_header_buf, request_header_loc, "@xxAccept-Encoding");
@@ -975,8 +975,8 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
     TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
     return 0;
   } else if (event == TS_EVENT_HTTP_READ_RESPONSE_HDR) {
-    TSMBuffer request_header_buf = NULL;
-    TSMLoc request_header_loc    = NULL;
+    TSMBuffer request_header_buf = nullptr;
+    TSMLoc request_header_loc    = nullptr;
 
     if (TSHttpTxnServerReqGet(txn, &request_header_buf, &request_header_loc) == TS_SUCCESS) {
       restore_accept_encoding(request_header_buf, request_header_loc, "@xxAccept-Encoding");
@@ -989,7 +989,7 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
   CHECK(event == TS_EVENT_HTTP_READ_RESPONSE_HDR || event == TS_EVENT_HTTP_READ_CACHE_HDR);
 
   TransformCtx *ctx = get_transaction_context(txn);
-  if (ctx == NULL) {
+  if (ctx == nullptr) {
     // TODO(oschaaf): document how and when this happens.
     TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
     return 0;
@@ -1002,15 +1002,15 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
   std::string *to_host = new std::string();
   to_host->append(get_remapped_host(ctx->txn));
   ctx->to_host                  = to_host;
-  TSMBuffer response_header_buf = NULL;
-  TSMLoc response_header_loc    = NULL;
+  TSMBuffer response_header_buf = nullptr;
+  TSMLoc response_header_loc    = nullptr;
 
   // TODO(oschaaf): from configuration!
   bool override_expiry = false;
 
   const char *host = ctx->gurl->HostAndPort().as_string().c_str();
   // request_headers->Lookup1(HttpAttributes::kHost);
-  if (host != NULL && strlen(host) > 0) {
+  if (host != nullptr && strlen(host) > 0) {
     override_expiry = get_override_expiry(host);
   }
 
@@ -1070,7 +1070,7 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
     StringPiece s_content_type                    = get_header(response_header_buf, response_header_loc, "Content-Type");
     const net_instaweb::ContentType *content_type = net_instaweb::MimeTypeToContentType(s_content_type);
 
-    if (ctx->record_in_place && content_type != NULL) {
+    if (ctx->record_in_place && content_type != nullptr) {
       GoogleString cache_url = *ctx->url_string;
       ctx->server_context->rewrite_stats()->ipro_not_in_cache()->Add(1);
       ctx->server_context->message_handler()->Message(kInfo, "Could not rewrite resource in-place "
@@ -1100,7 +1100,7 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
       ctx->ipro_response_headers->ComputeCaching();
 
       ctx->recorder->ConsiderResponseHeaders(InPlaceResourceRecorder::kPreliminaryHeaders, ctx->ipro_response_headers);
-    } else if ((content_type == NULL || !content_type->IsHtmlLike())) {
+    } else if ((content_type == nullptr || !content_type->IsHtmlLike())) {
       ok = false;
       TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
       return 0;
@@ -1124,10 +1124,10 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
       ctx->inflater = new GzipInflater(inflate_type);
       ctx->inflater->Init();
     }
-    ctx->html_rewrite = ctx->recorder == NULL;
+    ctx->html_rewrite = ctx->recorder == nullptr;
     if (ctx->html_rewrite) {
       TSDebug(DEBUG_TAG, "Will optimize [%s]", ctx->url_string->c_str());
-    } else if (ctx->recorder != NULL) {
+    } else if (ctx->recorder != nullptr) {
       TSDebug(DEBUG_TAG, "Will record in place: [%s]", ctx->url_string->c_str());
     } else {
       CHECK(false) << "At this point, adding a transform makes no sense";
@@ -1175,8 +1175,8 @@ process_configuration()
   DIR *dir;
   struct dirent *ent;
 
-  if ((dir = opendir("/usr/local/etc/trafficserver/psol/")) != NULL) {
-    while ((ent = readdir(dir)) != NULL) {
+  if ((dir = opendir("/usr/local/etc/trafficserver/psol/")) != nullptr) {
+    while ((ent = readdir(dir)) != nullptr) {
       size_t len = strlen(ent->d_name);
       if (len <= 0)
         continue;
@@ -1202,7 +1202,7 @@ process_configuration()
   old_config = config;
   config     = new_config;
   TSMutexUnlock(config_mutex);
-  if (old_config != NULL) {
+  if (old_config != nullptr) {
     delete old_config;
   }
 }
@@ -1248,7 +1248,7 @@ config_notification_callback(void *data)
   inotify_rm_watch(fd, wd);
   close(fd);
 
-  return NULL;
+  return nullptr;
 }
 
 void
@@ -1268,7 +1268,7 @@ TSPluginInit(int argc, const char *argv[])
     atexit(cleanup_process);
     ats_process_context = new AtsProcessContext();
     process_configuration();
-    TSCont transform_contp = TSContCreate(transform_plugin, NULL);
+    TSCont transform_contp = TSContCreate(transform_plugin, nullptr);
     TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, transform_contp);
     TSHttpHookAdd(TS_HTTP_READ_CACHE_HDR_HOOK, transform_contp);
     TSHttpHookAdd(TS_HTTP_SEND_REQUEST_HDR_HOOK, transform_contp);
@@ -1277,7 +1277,7 @@ TSPluginInit(int argc, const char *argv[])
     TSHttpHookAdd(TS_HTTP_SEND_RESPONSE_HDR_HOOK, transform_contp);
 
     setup_resource_intercept();
-    CHECK(TSThreadCreate(config_notification_callback, NULL)) << "";
+    CHECK(TSThreadCreate(config_notification_callback, nullptr)) << "";
     ats_process_context->message_handler()->Message(kInfo, "TSPluginInit OK");
   }
 }
diff --git a/proxy/http/HttpTransactCache.h b/proxy/http/HttpTransactCache.h
index b3e7cb2..ff6bdd9 100644
--- a/proxy/http/HttpTransactCache.h
+++ b/proxy/http/HttpTransactCache.h
@@ -66,14 +66,14 @@ public:
   static float calculate_quality_of_accept_match(MIMEField *accept_field, MIMEField *content_field);
 
   static float calculate_quality_of_accept_charset_match(MIMEField *accept_field, MIMEField *content_field,
-                                                         MIMEField *cached_accept_field = NULL);
+                                                         MIMEField *cached_accept_field = nullptr);
 
   static float calculate_quality_of_accept_encoding_match(MIMEField *accept_field, MIMEField *content_field,
-                                                          MIMEField *cached_accept_field = NULL);
+                                                          MIMEField *cached_accept_field = nullptr);
   static ContentEncoding match_gzip(MIMEField *accept_field);
 
   static float calculate_quality_of_accept_language_match(MIMEField *accept_field, MIMEField *content_field,
-                                                          MIMEField *cached_accept_field = NULL);
+                                                          MIMEField *cached_accept_field = nullptr);
 
   ///////////////////////////////////////////////
   // variability & server negotiation routines //
diff --git a/proxy/logging/LogBuffer.h b/proxy/logging/LogBuffer.h
index b7462ad..4b04d6b 100644
--- a/proxy/logging/LogBuffer.h
+++ b/proxy/logging/LogBuffer.h
@@ -188,10 +188,10 @@ public:
   // static functions
   static size_t max_entry_bytes();
   static int to_ascii(LogEntryHeader *entry, LogFormatType type, char *buf, int max_len, const char *symbol_str, char *printf_str,
-                      unsigned buffer_version, const char *alt_format = NULL);
+                      unsigned buffer_version, const char *alt_format = nullptr);
   static int resolve_custom_entry(LogFieldList *fieldlist, char *printf_str, char *read_from, char *write_to, int write_to_len,
-                                  long timestamp, long timestamp_us, unsigned buffer_version, LogFieldList *alt_fieldlist = NULL,
-                                  char *alt_printf_str = NULL);
+                                  long timestamp, long timestamp_us, unsigned buffer_version, LogFieldList *alt_fieldlist = nullptr,
+                                  char *alt_printf_str = nullptr);
 
   static void
   destroy(LogBuffer *lb)
diff --git a/proxy/logging/LogField.h b/proxy/logging/LogField.h
index c9f0356..17b39eb 100644
--- a/proxy/logging/LogField.h
+++ b/proxy/logging/LogField.h
@@ -117,12 +117,13 @@ public:
     N_AGGREGATES,
   };
 
-  LogField(const char *name, const char *symbol, Type type, MarshalFunc marshal, UnmarshalFunc unmarshal, SetFunc _setFunc = NULL);
+  LogField(const char *name, const char *symbol, Type type, MarshalFunc marshal, UnmarshalFunc unmarshal,
+           SetFunc _setFunc = nullptr);
 
   LogField(const char *name, const char *symbol, Type type, MarshalFunc marshal, UnmarshalFuncWithMap unmarshal,
-           const Ptr<LogFieldAliasMap> &map, SetFunc _setFunc = NULL);
+           const Ptr<LogFieldAliasMap> &map, SetFunc _setFunc = nullptr);
 
-  LogField(const char *field, Container container, SetFunc _setFunc = NULL);
+  LogField(const char *field, Container container, SetFunc _setFunc = nullptr);
   LogField(const LogField &rhs);
   ~LogField();
 
diff --git a/proxy/logging/LogFile.h b/proxy/logging/LogFile.h
index 5c8c31f..0a31609 100644
--- a/proxy/logging/LogFile.h
+++ b/proxy/logging/LogFile.h
@@ -83,8 +83,8 @@ public:
     return (m_file_format == LOG_FILE_BINARY ? "binary" : (m_file_format == LOG_FILE_PIPE ? "ascii_pipe" : "ascii"));
   }
 
-  static int write_ascii_logbuffer(LogBufferHeader *buffer_header, int fd, const char *path, const char *alt_format = NULL);
-  int write_ascii_logbuffer3(LogBufferHeader *buffer_header, const char *alt_format = NULL);
+  static int write_ascii_logbuffer(LogBufferHeader *buffer_header, int fd, const char *path, const char *alt_format = nullptr);
+  int write_ascii_logbuffer3(LogBufferHeader *buffer_header, const char *alt_format = nullptr);
   static bool rolled_logfile(char *file);
   static bool exists(const char *pathname);
 
diff --git a/proxy/logging/LogFormat.h b/proxy/logging/LogFormat.h
index e72dac2..c016919 100644
--- a/proxy/logging/LogFormat.h
+++ b/proxy/logging/LogFormat.h
@@ -175,7 +175,7 @@ private:
 static inline LogFormat *
 MakeTextLogFormat(const char *name = "text")
 {
-  return new LogFormat(name, NULL /* format_str */);
+  return new LogFormat(name, nullptr /* format_str */);
 }
 
 /*-------------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.h b/proxy/logging/LogObject.h
index 98c4aa4..d68f1a6 100644
--- a/proxy/logging/LogObject.h
+++ b/proxy/logging/LogObject.h
@@ -119,7 +119,7 @@ public:
     m_flags |= LOG_OBJECT_FMT_TIMESTAMP;
   }
 
-  int log(LogAccess *lad, const char *text_entry = NULL);
+  int log(LogAccess *lad, const char *text_entry = nullptr);
   int va_log(LogAccess *lad, const char *fmt, va_list ap);
 
   unsigned roll_files(long time_now = 0);
@@ -259,7 +259,7 @@ public:
   inline void
   force_new_buffer()
   {
-    _checkout_write(NULL, 0);
+    _checkout_write(nullptr, 0);
   }
 
   bool operator==(LogObject &rhs);
diff --git a/proxy/logging/LogUtils.h b/proxy/logging/LogUtils.h
index 908f93f..b72e97d 100644
--- a/proxy/logging/LogUtils.h
+++ b/proxy/logging/LogUtils.h
@@ -49,10 +49,10 @@ char *timestamp_to_time_str(long timestamp);
 unsigned ip_from_host(char *host);
 void manager_alarm(AlarmType alarm_type, const char *msg, ...) TS_PRINTFLIKE(2, 3);
 void strip_trailing_newline(char *buf);
-char *escapify_url(Arena *arena, char *url, size_t len_in, int *len_out, char *dst = NULL, size_t dst_size = 0,
-                   const unsigned char *map = NULL);
-char *pure_escapify_url(Arena *arena, char *url, size_t len_in, int *len_out, char *dst = NULL, size_t dst_size = 0,
-                        const unsigned char *map = NULL);
+char *escapify_url(Arena *arena, char *url, size_t len_in, int *len_out, char *dst = nullptr, size_t dst_size = 0,
+                   const unsigned char *map = nullptr);
+char *pure_escapify_url(Arena *arena, char *url, size_t len_in, int *len_out, char *dst = nullptr, size_t dst_size = 0,
+                        const unsigned char *map = nullptr);
 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');
 void remove_content_type_attributes(char *type_str, int *type_len);
diff --git a/proxy/logstats.cc b/proxy/logstats.cc
index 15c946b..5efc506 100644
--- a/proxy/logstats.cc
+++ b/proxy/logstats.cc
@@ -377,7 +377,7 @@ public:
     }
 
     _stack.sort();
-    for (LruStack::iterator u = _stack.begin(); NULL != u->url && --show >= 0; ++u) {
+    for (LruStack::iterator u = _stack.begin(); nullptr != u->url && --show >= 0; ++u) {
       _dump_url(u, as_object);
     }
     if (as_object) {
@@ -633,25 +633,25 @@ struct CommandLineArgs {
 static CommandLineArgs cl;
 
 static ArgumentDescription argument_descriptions[] = {
-  {"log_file", 'f', "Specific logfile to parse", "S1023", cl.log_file, NULL, NULL},
-  {"origin_list", 'o', "Only show stats for listed Origins", "S4095", cl.origin_list, NULL, NULL},
-  {"origin_file", 'O', "File listing Origins to show", "S1023", cl.origin_file, NULL, NULL},
-  {"max_orgins", 'M', "Max number of Origins to show", "I", &cl.max_origins, NULL, NULL},
-  {"urls", 'u', "Produce JSON stats for URLs, argument is LRU size", "I", &cl.urls, NULL, NULL},
-  {"show_urls", 'U', "Only show max this number of URLs", "I", &cl.show_urls, NULL, NULL},
-  {"as_object", 'A', "Produce URL stats as a JSON object instead of array", "T", &cl.as_object, NULL, NULL},
-  {"concise", 'C', "Eliminate metrics that can be inferred from other values", "T", &cl.concise, NULL, NULL},
-  {"incremental", 'i', "Incremental log parsing", "T", &cl.incremental, NULL, NULL},
-  {"statetag", 'S', "Name of the state file to use", "S1023", cl.state_tag, NULL, NULL},
-  {"tail", 't', "Parse the last <sec> seconds of log", "I", &cl.tail, NULL, NULL},
-  {"summary", 's', "Only produce the summary", "T", &cl.summary, NULL, NULL},
-  {"json", 'j', "Produce JSON formatted output", "T", &cl.json, NULL, NULL},
-  {"cgi", 'c', "Produce HTTP headers suitable as a CGI", "T", &cl.cgi, NULL, NULL},
-  {"min_hits", 'm', "Minimum total hits for an Origin", "L", &cl.min_hits, NULL, NULL},
-  {"max_age", 'a', "Max age for log entries to be considered", "I", &cl.max_age, NULL, NULL},
-  {"line_len", 'l', "Output line length", "I", &cl.line_len, NULL, NULL},
-  {"debug_tags", 'T', "Colon-Separated Debug Tags", "S1023", &error_tags, NULL, NULL},
-  {"report_per_user", 'r', "Report stats per user instead of host", "T", &cl.report_per_user, NULL, NULL},
+  {"log_file", 'f', "Specific logfile to parse", "S1023", cl.log_file, nullptr, nullptr},
+  {"origin_list", 'o', "Only show stats for listed Origins", "S4095", cl.origin_list, nullptr, nullptr},
+  {"origin_file", 'O', "File listing Origins to show", "S1023", cl.origin_file, nullptr, nullptr},
+  {"max_orgins", 'M', "Max number of Origins to show", "I", &cl.max_origins, nullptr, nullptr},
+  {"urls", 'u', "Produce JSON stats for URLs, argument is LRU size", "I", &cl.urls, nullptr, nullptr},
+  {"show_urls", 'U', "Only show max this number of URLs", "I", &cl.show_urls, nullptr, nullptr},
+  {"as_object", 'A', "Produce URL stats as a JSON object instead of array", "T", &cl.as_object, nullptr, nullptr},
+  {"concise", 'C', "Eliminate metrics that can be inferred from other values", "T", &cl.concise, nullptr, nullptr},
+  {"incremental", 'i', "Incremental log parsing", "T", &cl.incremental, nullptr, nullptr},
+  {"statetag", 'S', "Name of the state file to use", "S1023", cl.state_tag, nullptr, nullptr},
+  {"tail", 't', "Parse the last <sec> seconds of log", "I", &cl.tail, nullptr, nullptr},
+  {"summary", 's', "Only produce the summary", "T", &cl.summary, nullptr, nullptr},
+  {"json", 'j', "Produce JSON formatted output", "T", &cl.json, nullptr, nullptr},
+  {"cgi", 'c', "Produce HTTP headers suitable as a CGI", "T", &cl.cgi, nullptr, nullptr},
+  {"min_hits", 'm', "Minimum total hits for an Origin", "L", &cl.min_hits, nullptr, nullptr},
+  {"max_age", 'a', "Max age for log entries to be considered", "I", &cl.max_age, nullptr, nullptr},
+  {"line_len", 'l', "Output line length", "I", &cl.line_len, nullptr, nullptr},
+  {"debug_tags", 'T', "Colon-Separated Debug Tags", "S1023", &error_tags, nullptr, nullptr},
+  {"report_per_user", 'r', "Report stats per user instead of host", "T", &cl.report_per_user, nullptr, nullptr},
   HELP_ARGUMENT_DESCRIPTION(),
   VERSION_ARGUMENT_DESCRIPTION()};
 
@@ -670,14 +670,14 @@ CommandLineArgs::parse_arguments(const char **argv)
     json = 1;
     cgi  = 1;
 
-    if (NULL != (query = getenv("QUERY_STRING"))) {
+    if (nullptr != (query = getenv("QUERY_STRING"))) {
       char buffer[MAX_ORIG_STRING];
       char *tok, *sep_ptr, *val;
 
       ink_strlcpy(buffer, query, sizeof(buffer));
       unescapifyStr(buffer);
 
-      for (tok = strtok_r(buffer, "&", &sep_ptr); tok != NULL;) {
+      for (tok = strtok_r(buffer, "&", &sep_ptr); tok != nullptr;) {
         val = strchr(tok, '=');
         if (val) {
           *(val++) = '\0';
@@ -686,23 +686,23 @@ CommandLineArgs::parse_arguments(const char **argv)
           } else if (0 == strncmp(tok, "state_tag", 9)) {
             ink_strlcpy(state_tag, val, sizeof(state_tag));
           } else if (0 == strncmp(tok, "max_origins", 11)) {
-            max_origins = strtol(val, NULL, 10);
+            max_origins = strtol(val, nullptr, 10);
           } else if (0 == strncmp(tok, "urls", 4)) {
-            urls = strtol(val, NULL, 10);
+            urls = strtol(val, nullptr, 10);
           } else if (0 == strncmp(tok, "show_urls", 9)) {
-            show_urls = strtol(val, NULL, 10);
+            show_urls = strtol(val, nullptr, 10);
           } else if (0 == strncmp(tok, "as_object", 9)) {
-            as_object = strtol(val, NULL, 10);
+            as_object = strtol(val, nullptr, 10);
           } else if (0 == strncmp(tok, "min_hits", 8)) {
-            min_hits = strtol(val, NULL, 10);
+            min_hits = strtol(val, nullptr, 10);
           } else if (0 == strncmp(tok, "incremental", 11)) {
-            incremental = strtol(val, NULL, 10);
+            incremental = strtol(val, nullptr, 10);
           } else {
             // Unknown query arg.
           }
         }
 
-        tok = strtok_r(NULL, "&", &sep_ptr);
+        tok = strtok_r(nullptr, "&", &sep_ptr);
       }
     }
   }
@@ -722,7 +722,7 @@ struct ExitStatus {
 
   ExitStatus() : level(EXIT_OK) { memset(notice, 0, sizeof(notice)); }
   void
-  set(ExitLevel l, const char *n = NULL)
+  set(ExitLevel l, const char *n = nullptr)
   {
     if (l > level) {
       level = l;
@@ -1172,9 +1172,9 @@ update_schemes(OriginStats *stat, int scheme, int size)
 OriginStats *
 find_or_create_stats(const char *key)
 {
-  OriginStats *o_stats = NULL;
+  OriginStats *o_stats = nullptr;
   OriginStorage::iterator o_iter;
-  char *o_server = NULL;
+  char *o_server = nullptr;
 
   // TODO: If we save state (struct) for a run, we probably need to always
   // update the origin data, no matter what the origin_set is.
@@ -1207,7 +1207,7 @@ update_stats(OriginStats *o_stats, const HTTPMethod method, URLScheme scheme, in
   update_methods(&totals, method, size);
   update_schemes(&totals, scheme, size);
   update_counter(totals.total, size);
-  if (NULL != o_stats) {
+  if (nullptr != o_stats) {
     update_results_elapsed(o_stats, result, elapsed, size);
     update_codes(o_stats, http_code, size);
     update_methods(o_stats, method, size);
@@ -1221,7 +1221,7 @@ update_stats(OriginStats *o_stats, const HTTPMethod method, URLScheme scheme, in
 int
 parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate_per_userid = false)
 {
-  static LogFieldList *fieldlist = NULL;
+  static LogFieldList *fieldlist = nullptr;
 
   LogEntryHeader *entry;
   LogBufferIterator buf_iter(buf_header);
@@ -1242,7 +1242,7 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
 
   if (!fieldlist) {
     fieldlist = new LogFieldList;
-    ink_assert(fieldlist != NULL);
+    ink_assert(fieldlist != nullptr);
     bool agg = false;
     LogFormat::parse_symbol_string(buf_header->fmt_fieldlist(), fieldlist, &agg);
   }
@@ -1257,7 +1257,7 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
     }
 
     state   = P_STATE_ELAPSED;
-    o_stats = NULL;
+    o_stats = nullptr;
     method  = METHOD_OTHER;
     scheme  = SCHEME_OTHER;
 
@@ -1434,43 +1434,43 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
         switch (hier) {
         case SQUID_HIER_NONE:
           update_counter(totals.hierarchies.none, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->hierarchies.none, size);
           }
           break;
         case SQUID_HIER_DIRECT:
           update_counter(totals.hierarchies.direct, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->hierarchies.direct, size);
           }
           break;
         case SQUID_HIER_SIBLING_HIT:
           update_counter(totals.hierarchies.sibling, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->hierarchies.sibling, size);
           }
           break;
         case SQUID_HIER_PARENT_HIT:
           update_counter(totals.hierarchies.parent, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->hierarchies.direct, size);
           }
           break;
         case SQUID_HIER_EMPTY:
           update_counter(totals.hierarchies.empty, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->hierarchies.empty, size);
           }
           break;
         default:
           if ((hier >= SQUID_HIER_EMPTY) && (hier < SQUID_HIER_INVALID_ASSIGNED_CODE)) {
             update_counter(totals.hierarchies.other, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->hierarchies.other, size);
             }
           } else {
             update_counter(totals.hierarchies.invalid, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->hierarchies.invalid, size);
             }
           }
@@ -1492,7 +1492,7 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
         state = P_STATE_END;
         if (IMAG_AS_INT == *reinterpret_cast<int *>(read_from)) {
           update_counter(totals.content.image.total, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->content.image.total, size);
           }
           tok = read_from + 6;
@@ -1500,42 +1500,42 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
           case JPEG_AS_INT:
             tok_len = 10;
             update_counter(totals.content.image.jpeg, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.image.jpeg, size);
             }
             break;
           case JPG_AS_INT:
             tok_len = 9;
             update_counter(totals.content.image.jpeg, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.image.jpeg, size);
             }
             break;
           case GIF_AS_INT:
             tok_len = 9;
             update_counter(totals.content.image.gif, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.image.gif, size);
             }
             break;
           case PNG_AS_INT:
             tok_len = 9;
             update_counter(totals.content.image.png, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.image.png, size);
             }
             break;
           case BMP_AS_INT:
             tok_len = 9;
             update_counter(totals.content.image.bmp, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.image.bmp, size);
             }
             break;
           default:
             tok_len = 6 + strlen(tok);
             update_counter(totals.content.image.other, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.image.other, size);
             }
             break;
@@ -1543,7 +1543,7 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
         } else if (TEXT_AS_INT == *reinterpret_cast<int *>(read_from)) {
           tok = read_from + 5;
           update_counter(totals.content.text.total, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->content.text.total, size);
           }
           switch (*reinterpret_cast<int *>(tok)) {
@@ -1551,42 +1551,42 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
             // TODO verify if really "javascript"
             tok_len = 15;
             update_counter(totals.content.text.javascript, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.text.javascript, size);
             }
             break;
           case CSS_AS_INT:
             tok_len = 8;
             update_counter(totals.content.text.css, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.text.css, size);
             }
             break;
           case XML_AS_INT:
             tok_len = 8;
             update_counter(totals.content.text.xml, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.text.xml, size);
             }
             break;
           case HTML_AS_INT:
             tok_len = 9;
             update_counter(totals.content.text.html, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.text.html, size);
             }
             break;
           case PLAI_AS_INT:
             tok_len = 10;
             update_counter(totals.content.text.plain, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.text.plain, size);
             }
             break;
           default:
             tok_len = 5 + strlen(tok);
             update_counter(totals.content.text.other, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.text.other, size);
             }
             break;
@@ -1594,28 +1594,28 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
         } else if (0 == strncmp(read_from, "application", 11)) {
           tok = read_from + 12;
           update_counter(totals.content.application.total, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->content.application.total, size);
           }
           switch (*reinterpret_cast<int *>(tok)) {
           case ZIP_AS_INT:
             tok_len = 15;
             update_counter(totals.content.application.zip, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.application.zip, size);
             }
             break;
           case JAVA_AS_INT:
             tok_len = 22;
             update_counter(totals.content.application.javascript, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.application.javascript, size);
             }
             break;
           case X_JA_AS_INT:
             tok_len = 24;
             update_counter(totals.content.application.javascript, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.application.javascript, size);
             }
             break;
@@ -1623,19 +1623,19 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
             if (0 == strcmp(tok + 4, "xml")) {
               tok_len = 19;
               update_counter(totals.content.application.rss_xml, size);
-              if (o_stats != NULL) {
+              if (o_stats != nullptr) {
                 update_counter(o_stats->content.application.rss_xml, size);
               }
             } else if (0 == strcmp(tok + 4, "atom")) {
               tok_len = 20;
               update_counter(totals.content.application.rss_atom, size);
-              if (o_stats != NULL) {
+              if (o_stats != nullptr) {
                 update_counter(o_stats->content.application.rss_atom, size);
               }
             } else {
               tok_len = 12 + strlen(tok);
               update_counter(totals.content.application.rss_other, size);
-              if (o_stats != NULL) {
+              if (o_stats != nullptr) {
                 update_counter(o_stats->content.application.rss_other, size);
               }
             }
@@ -1644,19 +1644,19 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
             if (0 == strcmp(tok, "x-shockwave-flash")) {
               tok_len = 29;
               update_counter(totals.content.application.shockwave_flash, size);
-              if (o_stats != NULL) {
+              if (o_stats != nullptr) {
                 update_counter(o_stats->content.application.shockwave_flash, size);
               }
             } else if (0 == strcmp(tok, "x-quicktimeplayer")) {
               tok_len = 29;
               update_counter(totals.content.application.quicktime, size);
-              if (o_stats != NULL) {
+              if (o_stats != nullptr) {
                 update_counter(o_stats->content.application.quicktime, size);
               }
             } else {
               tok_len = 12 + strlen(tok);
               update_counter(totals.content.application.other, size);
-              if (o_stats != NULL) {
+              if (o_stats != nullptr) {
                 update_counter(o_stats->content.application.other, size);
               }
             }
@@ -1665,35 +1665,35 @@ parse_log_buff(LogBufferHeader *buf_header, bool summary = false, bool aggregate
           tok     = read_from + 6;
           tok_len = 6 + strlen(tok);
           update_counter(totals.content.audio.total, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->content.audio.total, size);
           }
           if ((0 == strcmp(tok, "x-wav")) || (0 == strcmp(tok, "wav"))) {
             update_counter(totals.content.audio.wav, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.audio.wav, size);
             }
           } else if ((0 == strcmp(tok, "x-mpeg")) || (0 == strcmp(tok, "mpeg"))) {
             update_counter(totals.content.audio.mpeg, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.audio.mpeg, size);
             }
           } else {
             update_counter(totals.content.audio.other, size);
-            if (o_stats != NULL) {
+            if (o_stats != nullptr) {
               update_counter(o_stats->content.audio.other, size);
             }
           }
         } else if ('-' == *read_from) {
           tok_len = 1;
           update_counter(totals.content.none, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->content.none, size);
           }
         } else {
           tok_len = strlen(read_from);
           update_counter(totals.content.other, size);
-          if (o_stats != NULL) {
+          if (o_stats != nullptr) {
             update_counter(o_stats->content.other, size);
           }
         }
@@ -1845,7 +1845,7 @@ use_origin(const OriginStats *stat)
 {
   return cl.report_per_user != 0 ?
            (stat->total.count > cl.min_hits) :
-           ((stat->total.count > cl.min_hits) && (NULL != strchr(stat->server, '.')) && (NULL == strchr(stat->server, '%')));
+           ((stat->total.count > cl.min_hits) && (nullptr != strchr(stat->server, '.')) && (nullptr == strchr(stat->server, '%')));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -2396,7 +2396,7 @@ main(int /* argc ATS_UNUSED */, const char *argv[])
   if (cl.max_age > 0) {
     struct timeval tv;
 
-    gettimeofday(&tv, NULL);
+    gettimeofday(&tv, nullptr);
     max_age = tv.tv_sec - cl.max_age;
   } else {
     max_age = 0;
@@ -2411,9 +2411,9 @@ main(int /* argc ATS_UNUSED */, const char *argv[])
     char *tok;
     char *sep_ptr;
 
-    for (tok = strtok_r(cl.origin_list, ",", &sep_ptr); tok != NULL;) {
+    for (tok = strtok_r(cl.origin_list, ",", &sep_ptr); tok != nullptr;) {
       origin_set->insert(tok);
-      tok = strtok_r(NULL, ",", &sep_ptr);
+      tok = strtok_r(nullptr, ",", &sep_ptr);
     }
   }
   // Load origins from an "external" file (\n separated)
@@ -2565,8 +2565,8 @@ main(int /* argc ATS_UNUSED */, const char *argv[])
     // Check if the main log file was rotated, and if so, locate
     // the old file first, and parse the remaining log data.
     if (stat_buf.st_ino != last_state.st_ino) {
-      DIR *dirp         = NULL;
-      struct dirent *dp = NULL;
+      DIR *dirp         = nullptr;
+      struct dirent *dp = nullptr;
       ino_t old_inode   = last_state.st_ino;
 
       // Save the current log-file's I-Node number.
@@ -2574,10 +2574,10 @@ main(int /* argc ATS_UNUSED */, const char *argv[])
 
       // Find the old log file.
       dirp = opendir(Layout::get()->logdir);
-      if (NULL == dirp) {
+      if (nullptr == dirp) {
         exit_status.set(EXIT_WARNING, " can't read log directory");
       } else {
-        while ((dp = readdir(dirp)) != NULL) {
+        while ((dp = readdir(dirp)) != nullptr) {
           // coverity[fs_check_call]
           if (stat(dp->d_name, &stat_buf) < 0) {
             exit_status.set(EXIT_WARNING, " can't stat ");

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