You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by mo...@apache.org on 2025/10/27 17:09:48 UTC
(trafficserver) branch fast-date-parse created (now 4b172486b4)
This is an automated email from the ASF dual-hosted git repository.
mochen pushed a change to branch fast-date-parse
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
at 4b172486b4 Use anonymous namespace instead of static
This branch includes the following new commits:
new 4b172486b4 Use anonymous namespace instead of static
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(trafficserver) 01/01: Use anonymous namespace instead of static
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mochen pushed a commit to branch fast-date-parse
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 4b172486b4375fb9a484c3e7f8d8a2060eb3a775
Author: Mo Chen <mo...@apache.org>
AuthorDate: Mon Oct 27 12:09:35 2025 -0500
Use anonymous namespace instead of static
---
src/proxy/hdrs/MIME.cc | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/proxy/hdrs/MIME.cc b/src/proxy/hdrs/MIME.cc
index a97f556c88..fe7365a16b 100644
--- a/src/proxy/hdrs/MIME.cc
+++ b/src/proxy/hdrs/MIME.cc
@@ -54,16 +54,18 @@ using swoc::TextView;
* *
***********************************************************************/
-static constexpr std::array<std::string_view, 7> day_names = {
+namespace
+{
+constexpr std::array<std::string_view, 7> day_names = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
};
-static constexpr std::array<std::string_view, 12> month_names = {
+constexpr std::array<std::string_view, 12> month_names = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
};
template <size_t count>
-static consteval std::array<uint32_t, count>
+consteval std::array<uint32_t, count>
make_packed(const std::array<std::string_view, count> &names)
{
std::array<uint32_t, count> packed{};
@@ -80,14 +82,14 @@ make_packed(const std::array<std::string_view, count> &names)
return packed;
}
-static constexpr std::array<uint32_t, day_names.size()> day_names_packed = make_packed(day_names);
-static constexpr std::array<uint32_t, month_names.size()> month_names_packed = make_packed(month_names);
+constexpr std::array<uint32_t, day_names.size()> day_names_packed = make_packed(day_names);
+constexpr std::array<uint32_t, month_names.size()> month_names_packed = make_packed(month_names);
// Case-insensitive match of first 3 characters of input string against array of names
// Longer strings will match if their first 3 characters match - this is intentional for
// matching non-standard day/month names like "Thursday" or "September".
template <size_t count>
-__attribute__((always_inline)) static constexpr int
+__attribute__((always_inline)) constexpr int
match_3char_ci(const std::string_view s, const std::array<uint32_t, count> &names_packed)
{
if (s.size() < 3) {
@@ -104,6 +106,7 @@ match_3char_ci(const std::string_view s, const std::array<uint32_t, count> &name
}
return -1;
}
+} // namespace
struct MDY {
uint8_t m;