This is an automated email from the ASF dual-hosted git repository. bneradt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/10.0.x by this push: new d25bd86118 Cleanup cripts headers (#11086) d25bd86118 is described below commit d25bd86118ee7d692efa6169645968e4bcfda3c0 Author: Chris McFarlen <ch...@mcfarlen.us> AuthorDate: Fri Feb 23 10:35:06 2024 -0600 Cleanup cripts headers (#11086) * cleanup headers * anonymous namespace * scope format to fmt:: --------- Co-authored-by: Chris McFarlen <cmcfar...@apple.com> (cherry picked from commit bb6d53aa374293e2de229627531a81b65187686d) --- include/cripts/Connections.hpp | 6 ------ include/cripts/Headers.hpp | 4 ---- include/cripts/Matcher.hpp | 7 +++---- include/cripts/Transaction.hpp | 9 --------- src/cripts/Bundles/LogsMetrics.cc | 12 ++++++------ src/cripts/Connections.cc | 1 + 6 files changed, 10 insertions(+), 29 deletions(-) diff --git a/include/cripts/Connections.hpp b/include/cripts/Connections.hpp index 4546221fd1..7c5624564e 100644 --- a/include/cripts/Connections.hpp +++ b/include/cripts/Connections.hpp @@ -22,15 +22,9 @@ namespace Cript class Context; } -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> - #include "ts/apidefs.h" #include "ts/ts.h" -#include "ts/remap.h" -#include "swoc/swoc_ip.h" #include "cripts/Matcher.hpp" diff --git a/include/cripts/Headers.hpp b/include/cripts/Headers.hpp index 437f013c90..560e00deec 100644 --- a/include/cripts/Headers.hpp +++ b/include/cripts/Headers.hpp @@ -18,13 +18,9 @@ #pragma once #include <cstring> -#include <iostream> #include <iterator> -#include <utility> #include <string> -#include <string_view> -#include "ts/remap.h" #include "ts/ts.h" #include "cripts/Transaction.hpp" diff --git a/include/cripts/Matcher.hpp b/include/cripts/Matcher.hpp index a186d30f2e..0b2a4c6582 100644 --- a/include/cripts/Matcher.hpp +++ b/include/cripts/Matcher.hpp @@ -17,17 +17,16 @@ */ #pragma once +#include "cripts/Headers.hpp" +#include "cripts/Lulu.hpp" +#include "swoc/IPRange.h" // Setup for PCRE2 #define PCRE2_CODE_UNIT_WIDTH 8 #include <pcre2.h> #include <vector> #include <tuple> -#include "swoc/swoc_ip.h" - -#include "ts/apidefs.h" #include "ts/ts.h" -#include "ts/remap.h" namespace Matcher { diff --git a/include/cripts/Transaction.hpp b/include/cripts/Transaction.hpp index 5f5a52005f..6865aaaca4 100644 --- a/include/cripts/Transaction.hpp +++ b/include/cripts/Transaction.hpp @@ -17,18 +17,9 @@ */ #pragma once -#include <memory> -#include <algorithm> -#include <vector> -#include <string> -#include <string_view> -#include <chrono> -#include <climits> - #include <fmt/core.h> #include "ts/ts.h" -#include "ts/remap.h" #include "cripts/Error.hpp" diff --git a/src/cripts/Bundles/LogsMetrics.cc b/src/cripts/Bundles/LogsMetrics.cc index cb0e86917a..36b04465a9 100644 --- a/src/cripts/Bundles/LogsMetrics.cc +++ b/src/cripts/Bundles/LogsMetrics.cc @@ -24,7 +24,7 @@ namespace Bundle { // Bundle::LogsMetrics -namespace Bundle +namespace { enum { PROPSTAT_CACHE_MISS = 0, // TS_CACHE_LOOKUP_MISS == 0 @@ -73,7 +73,7 @@ namespace Bundle // clang-format on }; -} // namespace Bundle +} // namespace // The .propstats(str) is particularly complicated, since it has to create all the metrics LogsMetrics::self_type & @@ -85,7 +85,7 @@ LogsMetrics::propstats(const Cript::string_view &label) needCallback({Cript::Callbacks::DO_CACHE_LOOKUP, Cript::Callbacks::DO_TXN_CLOSE}); for (int ix = 0; ix < Bundle::PROPSTAT_MAX; ++ix) { - auto name = format("{}.{}", _label, Bundle::PROPSTAT_SUFFIXES[ix]); + auto name = fmt::format("{}.{}", _label, Bundle::PROPSTAT_SUFFIXES[ix]); _inst->debug("Creating metrics for: {}", name); _inst->metrics[ix] = Metrics::Counter::create(name); @@ -104,7 +104,7 @@ LogsMetrics::doTxnClose(Cript::Context *context) if (_tcpinfo && control.logging.get()) { borrow conn = Client::Connection::get(); - resp["@TCPInfo"] += format(",TC; {}", conn.tcpinfo.log()); + resp["@TCPInfo"] += fmt::format(",TC; {}", conn.tcpinfo.log()); } // .label(str) @@ -157,7 +157,7 @@ LogsMetrics::doSendResponse(Cript::Context *context) // .tcpinfo(bool) if (_tcpinfo && control.logging.get()) { - resp["@TCPInfo"] = format("SR; {}", conn.tcpinfo.log()); + resp["@TCPInfo"] = fmt::format("SR; {}", conn.tcpinfo.log()); } } @@ -189,7 +189,7 @@ LogsMetrics::doRemap(Cript::Context *context) if (_tcpinfo && !sampled) { borrow req = Client::Request::get(); borrow conn = Client::Connection::get(); - req["@TCPInfo"] = format("TS; {}", conn.tcpinfo.log()); + req["@TCPInfo"] = fmt::format("TS; {}", conn.tcpinfo.log()); } } diff --git a/src/cripts/Connections.cc b/src/cripts/Connections.cc index 5a028a05a5..445f46d70d 100644 --- a/src/cripts/Connections.cc +++ b/src/cripts/Connections.cc @@ -18,6 +18,7 @@ #include "cripts/Lulu.hpp" #include "cripts/Preamble.hpp" +#include <arpa/inet.h> constexpr unsigned NORMALIZED_TIME_QUANTUM = 3600; // 1 hour