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

bneradt pushed a commit to branch dev-1-2-0
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit 8b3f9529f55a386b03fdb715daecfeb67e22a903
Author: Alan M. Carroll <[email protected]>
AuthorDate: Sat Apr 4 09:49:56 2020 -0500

    More style tweaks.
---
 swoc++/include/swoc/ArenaWriter.h      |  2 +-
 swoc++/include/swoc/BufferWriter.h     |  2 +-
 swoc++/include/swoc/DiscreteRange.h    |  2 +-
 swoc++/include/swoc/Errata.h           |  2 +-
 swoc++/include/swoc/IntrusiveDList.h   |  2 +-
 swoc++/include/swoc/IntrusiveHashMap.h |  2 +-
 swoc++/include/swoc/MemArena.h         |  2 +-
 swoc++/include/swoc/MemSpan.h          |  2 +-
 swoc++/include/swoc/RBTree.h           |  2 +-
 swoc++/include/swoc/Scalar.h           |  2 +-
 swoc++/include/swoc/TextView.h         |  2 +-
 swoc++/include/swoc/bwf_base.h         |  2 +-
 swoc++/include/swoc/bwf_ex.h           |  2 +-
 swoc++/include/swoc/swoc_ip.h          |  2 +-
 swoc++/include/swoc/swoc_meta.h        |  2 +-
 swoc++/src/ArenaWriter.cc              |  2 +-
 swoc++/src/Errata.cc                   |  2 +-
 swoc++/src/RBTree.cc                   |  2 +-
 swoc++/src/TextView.cc                 | 92 +++++++++++++++++-----------------
 swoc++/src/bw_format.cc                | 19 ++-----
 swoc++/src/bw_ip_format.cc             | 17 +------
 swoc++/src/swoc_file.cc                | 17 +------
 swoc++/src/swoc_ip.cc                  |  2 +-
 23 files changed, 71 insertions(+), 112 deletions(-)

diff --git a/swoc++/include/swoc/ArenaWriter.h 
b/swoc++/include/swoc/ArenaWriter.h
index 49df69e..81d5d3e 100644
--- a/swoc++/include/swoc/ArenaWriter.h
+++ b/swoc++/include/swoc/ArenaWriter.h
@@ -61,4 +61,4 @@ protected:
 inline swoc::ArenaWriter::ArenaWriter(swoc::MemArena& arena)
     : super_type(arena.remnant()), _arena(arena) {}
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/BufferWriter.h 
b/swoc++/include/swoc/BufferWriter.h
index b256884..ed22f46 100644
--- a/swoc++/include/swoc/BufferWriter.h
+++ b/swoc++/include/swoc/BufferWriter.h
@@ -626,7 +626,7 @@ inline FixedBufferWriter::operator std::string_view() const 
{
 // --- LocalBufferWriter ---
 template<size_t N> LocalBufferWriter<N>::LocalBufferWriter() : 
super_type(_arr, N) {}
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
 
 namespace std
 {
diff --git a/swoc++/include/swoc/DiscreteRange.h 
b/swoc++/include/swoc/DiscreteRange.h
index cb9f976..80da09c 100644
--- a/swoc++/include/swoc/DiscreteRange.h
+++ b/swoc++/include/swoc/DiscreteRange.h
@@ -1409,4 +1409,4 @@ DiscreteSpace<METRIC, 
PAYLOAD>::blend(DiscreteSpace::range_type const& range, U
   return *this;
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/Errata.h b/swoc++/include/swoc/Errata.h
index 261cbff..1c2443e 100644
--- a/swoc++/include/swoc/Errata.h
+++ b/swoc++/include/swoc/Errata.h
@@ -859,7 +859,7 @@ BufferWriter &bwformat(BufferWriter &w, bwf::Spec const 
&spec, Errata::Annotatio
 
 BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, Errata const &);
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
 
 // Tuple / structured binding support.
 namespace std
diff --git a/swoc++/include/swoc/IntrusiveDList.h 
b/swoc++/include/swoc/IntrusiveDList.h
index 132b61c..eca4cf8 100644
--- a/swoc++/include/swoc/IntrusiveDList.h
+++ b/swoc++/include/swoc/IntrusiveDList.h
@@ -886,4 +886,4 @@ IntrusiveDList<L>::apply(F&& f) -> self_type& {
   return detail::Intrusive_DList_Apply(*this, f);
 };
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/IntrusiveHashMap.h 
b/swoc++/include/swoc/IntrusiveHashMap.h
index 532e556..fed69f9 100644
--- a/swoc++/include/swoc/IntrusiveHashMap.h
+++ b/swoc++/include/swoc/IntrusiveHashMap.h
@@ -682,4 +682,4 @@ IntrusiveHashMap<H>::get_expansion_limit() const {
   return _expansion_limit;
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/MemArena.h b/swoc++/include/swoc/MemArena.h
index 51f76fd..289d2fe 100644
--- a/swoc++/include/swoc/MemArena.h
+++ b/swoc++/include/swoc/MemArena.h
@@ -485,4 +485,4 @@ void FixedArena<T>::clear() {
   _list._next = nullptr;
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/MemSpan.h b/swoc++/include/swoc/MemSpan.h
index cd45d6c..c94c2d2 100644
--- a/swoc++/include/swoc/MemSpan.h
+++ b/swoc++/include/swoc/MemSpan.h
@@ -915,7 +915,7 @@ MemSpan<void>::view() const {
   return {static_cast<char const *>(_ptr), _size};
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
 
 /// @cond NO_DOXYGEN
 // STL tuple support - this allows the @c MemSpan to be used as a tuple of a 
pointer
diff --git a/swoc++/include/swoc/RBTree.h b/swoc++/include/swoc/RBTree.h
index 2150bb5..133238b 100644
--- a/swoc++/include/swoc/RBTree.h
+++ b/swoc++/include/swoc/RBTree.h
@@ -221,4 +221,4 @@ RBNode::structure_validate() {
 }
 
 } // namespace detail
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/Scalar.h b/swoc++/include/swoc/Scalar.h
index 5e6cc88..f3cb3bd 100644
--- a/swoc++/include/swoc/Scalar.h
+++ b/swoc++/include/swoc/Scalar.h
@@ -993,7 +993,7 @@ tag_label(std::ostream& w) {
   return w;
 }
 } // namespace detail
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
 
 namespace std
 {
diff --git a/swoc++/include/swoc/TextView.h b/swoc++/include/swoc/TextView.h
index 23072bc..34a04f5 100644
--- a/swoc++/include/swoc/TextView.h
+++ b/swoc++/include/swoc/TextView.h
@@ -1644,7 +1644,7 @@ namespace literals
   constexpr swoc::TextView operator"" _tv(const char *s, size_t n) { return 
{s, n}; }
 } // namespace literals
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
 
 namespace std {
 /// Write the contents of @a view to the stream @a os.
diff --git a/swoc++/include/swoc/bwf_base.h b/swoc++/include/swoc/bwf_base.h
index 0263ee2..046c2ce 100644
--- a/swoc++/include/swoc/bwf_base.h
+++ b/swoc++/include/swoc/bwf_base.h
@@ -1198,4 +1198,4 @@ As_Hex(T const& t) {
 
 BufferWriter& bwformat(BufferWriter& w, bwf::Spec const& spec, bwf::HexDump 
const& hex);
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/bwf_ex.h b/swoc++/include/swoc/bwf_ex.h
index 1e59a4a..b843b35 100644
--- a/swoc++/include/swoc/bwf_ex.h
+++ b/swoc++/include/swoc/bwf_ex.h
@@ -210,4 +210,4 @@ bwformat(BufferWriter& w, bwf::Spec const& spec, 
bwf::SubText<Args...> const& su
   return w;
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/swoc_ip.h b/swoc++/include/swoc/swoc_ip.h
index 7001b89..203a32b 100644
--- a/swoc++/include/swoc/swoc_ip.h
+++ b/swoc++/include/swoc/swoc_ip.h
@@ -2794,4 +2794,4 @@ get(swoc::IPNet const& net) {
   }
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/include/swoc/swoc_meta.h b/swoc++/include/swoc/swoc_meta.h
index 95d5ee3..38d0889 100644
--- a/swoc++/include/swoc/swoc_meta.h
+++ b/swoc++/include/swoc/swoc_meta.h
@@ -192,4 +192,4 @@ template<typename... Types> struct type_list {
 };
 
 } // namespace meta
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/src/ArenaWriter.cc b/swoc++/src/ArenaWriter.cc
index ccfe0eb..b5a60a8 100644
--- a/swoc++/src/ArenaWriter.cc
+++ b/swoc++/src/ArenaWriter.cc
@@ -48,4 +48,4 @@ ArenaWriter::realloc(size_t n)
   memcpy(_buffer, text.data(), text.size());
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/src/Errata.cc b/swoc++/src/Errata.cc
index 4089f5b..2d8b9fe 100644
--- a/swoc++/src/Errata.cc
+++ b/swoc++/src/Errata.cc
@@ -185,4 +185,4 @@ operator<<(std::ostream& os, Errata const& err) {
   return err.write(os);
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/src/RBTree.cc b/swoc++/src/RBTree.cc
index 515f825..504206a 100644
--- a/swoc++/src/RBTree.cc
+++ b/swoc++/src/RBTree.cc
@@ -350,4 +350,4 @@ RBNode::left_most_descendant() const -> self_type * {
 }
 
 } // namespace detail
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/src/TextView.cc b/swoc++/src/TextView.cc
index 6459712..7f1e5e7 100644
--- a/swoc++/src/TextView.cc
+++ b/swoc++/src/TextView.cc
@@ -54,39 +54,40 @@ strcasecmp(const std::string_view &lhs, const 
std::string_view &rhs)
   return r ? r : zret;
 }
 
+namespace swoc { inline namespace SWOC_VERSION_NS {
+
 /// @cond INTERNAL_DETAIL
-const int8_t swoc::svtoi_convert[256] = {
-  /* [can't do this nicely because clang format won't allow exdented comments]
-   0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
-  */
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 00
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20
-  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  -1, -1, -1, -1, -1, -1, // 30
-  -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 40
-  25, 26, 27, 28, 20, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // 50
-  -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 60
-  25, 26, 27, 28, 20, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // 70
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 80
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 90
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // A0
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // B0
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // C0
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // D0
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // E0
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // F0
+const int8_t svtoi_convert[256] = {
+    /* [can't do this nicely because clang format won't allow exdented 
comments]
+     0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
+    */
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 00
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20
+    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, // 30
+    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 40
+    25, 26, 27, 28, 20, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // 50
+    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 60
+    25, 26, 27, 28, 20, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // 70
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 80
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 90
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // A0
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // B0
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // C0
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // D0
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // E0
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // F0
 };
 /// @endcond
 
 intmax_t
-swoc::svtoi(TextView src, TextView *out, int base)
-{
+svtoi(TextView src, TextView *out, int base) {
   intmax_t zret = 0;
 
   if (src.ltrim_if(&isspace) && src) {
     TextView parsed;
     const char *start = src.data();
-    bool neg          = false;
+    bool neg = false;
     if ('-' == *src) {
       ++src;
       neg = true;
@@ -107,8 +108,7 @@ swoc::svtoi(TextView src, TextView *out, int base)
 }
 
 uintmax_t
-swoc::svtou(TextView src, TextView *out, int base)
-{
+svtou(TextView src, TextView *out, int base) {
   uintmax_t zret = 0;
 
   if (out) {
@@ -135,26 +135,24 @@ swoc::svtou(TextView src, TextView *out, int base)
 
     // For performance in common cases, use the templated conversion.
     switch (base) {
-    case 8:
-      zret = svto_radix<8>(src);
-      break;
-    case 10:
-      zret = svto_radix<10>(src);
-      break;
-    case 16:
-      zret = svto_radix<16>(src);
-      break;
-    default:
-      while (src.size() && (0 <= (v = svtoi_convert[static_cast<unsigned 
char>(*src)])) && v < base) {
-        auto n = zret * base + v;
-        if (n < zret) {
-          zret = std::numeric_limits<uintmax_t>::max();
-          break; // overflow, stop parsing.
+      case 8:zret = svto_radix<8>(src);
+        break;
+      case 10:zret = svto_radix<10>(src);
+        break;
+      case 16:zret = svto_radix<16>(src);
+        break;
+      default:
+        while (src.size() && (0 <= (v = svtoi_convert[static_cast<unsigned 
char>(*src)])) &&
+               v < base) {
+          auto n = zret * base + v;
+          if (n < zret) {
+            zret = std::numeric_limits<uintmax_t>::max();
+            break; // overflow, stop parsing.
+          }
+          zret = n;
+          ++src;
         }
-        zret = n;
-        ++src;
-      }
-      break;
+        break;
     }
 
     if (out) {
@@ -164,8 +162,10 @@ swoc::svtou(TextView src, TextView *out, int base)
   return zret;
 }
 
-// Do the template instantions.
-template std::ostream &swoc::TextView::stream_write(std::ostream &, const 
swoc::TextView &) const;
+// Do the template instantiations.
+template std::ostream& TextView::stream_write(std::ostream&, const TextView&) 
const;
+
+}} // namespace swoc
 
 namespace std
 {
diff --git a/swoc++/src/bw_format.cc b/swoc++/src/bw_format.cc
index 6265577..4246593 100644
--- a/swoc++/src/bw_format.cc
+++ b/swoc++/src/bw_format.cc
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright Apache Software Foundation 2019
 /** @file
 
     Formatted output for BufferWriter.
-
-    @section license License
-
-    Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
-    agreements.  See the NOTICE file distributed with this work for additional 
information regarding
-    copyright ownership.  The ASF licenses this file to you under the Apache 
License, Version 2.0
-    (the "License"); you may not use this file except in compliance with the 
License.  You may
-    obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software 
distributed under the
-    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS OF ANY KIND, either
-    express or implied. See the License for the specific language governing 
permissions and
-    limitations under the License.
  */
 
 #include <array>
@@ -823,7 +810,7 @@ bwformat(BufferWriter &w, bwf::Spec const &spec, IpAddr 
const &addr)
 namespace {
 } // namespace
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
 
 namespace std
 {
diff --git a/swoc++/src/bw_ip_format.cc b/swoc++/src/bw_ip_format.cc
index 38ce284..afddfcf 100644
--- a/swoc++/src/bw_ip_format.cc
+++ b/swoc++/src/bw_ip_format.cc
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright Apache Software Foundation 2019
 /** @file
 
   BufferWriter formatting for IP address data.
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.
-  See the NOTICE file distributed with this work for additional information 
regarding copyright
-  ownership.  The ASF licenses this file to you under the Apache License, 
Version 2.0 (the
-  "License"); you may not use this file except in compliance with the License. 
 You may obtain a
-  copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software 
distributed under the License
-  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
-  or implied. See the License for the specific language governing permissions 
and limitations under
-  the License.
  */
 
 #include "swoc/swoc_ip.h"
diff --git a/swoc++/src/swoc_file.cc b/swoc++/src/swoc_file.cc
index 74f9fb9..fb88d07 100644
--- a/swoc++/src/swoc_file.cc
+++ b/swoc++/src/swoc_file.cc
@@ -3,21 +3,6 @@
 /** @file
 
     Minimalist version of std::filesystem.
-
-    @section license License
-
-    Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
-    agreements.  See the NOTICE file distributed with this work for additional 
information regarding
-    copyright ownership.  The ASF licenses this file to you under the Apache 
License, Version 2.0
-    (the "License"); you may not use this file except in compliance with the 
License.  You may
-    obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software 
distributed under the
-    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS OF ANY KIND, either
-    express or implied. See the License for the specific language governing 
permissions and
-    limitations under the License.
  */
 
 #include <fcntl.h>
@@ -131,4 +116,4 @@ bwformat(BufferWriter& w, bwf::Spec const& spec, file::path 
const& p) {
   return bwformat(w, spec, p.string());
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc
diff --git a/swoc++/src/swoc_ip.cc b/swoc++/src/swoc_ip.cc
index 9d94420..1d8f88c 100644
--- a/swoc++/src/swoc_ip.cc
+++ b/swoc++/src/swoc_ip.cc
@@ -966,4 +966,4 @@ void IP6Range::NetSource::search_narrower() {
   }
 }
 
-}} // namespace SWOC_NAMESPACE
+}} // namespace swoc

Reply via email to