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

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

commit 6ab1f574d2259c833f61c2514d3ce852300867af
Author: Alan M. Carroll <[email protected]>
AuthorDate: Tue Nov 21 16:38:30 2023 -0600

    Clang format.
---
 code/include/swoc/Errata.h   | 25 +++++++++++++------------
 code/include/swoc/TextView.h | 15 ++++++++++-----
 code/src/bw_format.cc        |  2 +-
 unit_tests/test_Errata.cc    | 27 ++++++++++-----------------
 4 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/code/include/swoc/Errata.h b/code/include/swoc/Errata.h
index 8d3c129..944129d 100644
--- a/code/include/swoc/Errata.h
+++ b/code/include/swoc/Errata.h
@@ -86,8 +86,8 @@ public:
   /// This defaults to zero and no filtering is done unless it is overwritten.
   static Severity FILTER_SEVERITY;
 
-  static inline TextView AUTOTEXT_SEVERITY = "{}"; ///< Format for auto 
generated annotation with severity.
-  static inline TextView AUTOTEXT_CODE = "{}"; ///< Format for auto generated 
annotation with error code.
+  static inline TextView AUTOTEXT_SEVERITY      = "{}";     ///< Format for 
auto generated annotation with severity.
+  static inline TextView AUTOTEXT_CODE          = "{}";     ///< Format for 
auto generated annotation with error code.
   static inline TextView AUTOTEXT_SEVERITY_CODE = "{}: {}"; ///< Format for 
auto generate annotation with error code and severity.
 
   /// Mapping of severity to string.
@@ -200,15 +200,16 @@ protected:
     TextView _indent_text                   = DEFAULT_INDENT_TEXT;
     bool _glue_final_p                      = true; ///< Add glue after the 
last annotation?
 
-    std::optional<Severity> _severity;     ///< Severity.
-    code_type _code{DEFAULT_CODE}; ///< Message code / ID
-    Container _notes;                      ///< The message stack.
-    swoc::MemArena _arena;                 ///< Annotation text storage.
+    std::optional<Severity> _severity; ///< Severity.
+    code_type _code{DEFAULT_CODE};     ///< Message code / ID
+    Container _notes;                  ///< The message stack.
+    swoc::MemArena _arena;             ///< Annotation text storage.
   };
 
 public:
   /// Used to indicate automatically generated annotation text.
-  static constexpr struct AutoText {} AUTO {};
+  static constexpr struct AutoText {
+  } AUTO{};
 
   /// Default constructor - empty errata, very fast.
   Errata()                      = default;
@@ -224,7 +225,7 @@ public:
    *
    * No annotation is created.
    */
-  explicit Errata(code_type const& ec);
+  explicit Errata(code_type const &ec);
 
   /** Construct with an error code and generated annotation.
    *
@@ -233,7 +234,7 @@ public:
    * An annotation is created using the format @c AUTOTEXT_CODE with @a ec as 
the argument.
    * @see AUTOTEXT_CODE
    */
-  explicit Errata(code_type const& ec, AutoText);
+  explicit Errata(code_type const &ec, AutoText);
 
   /** Construct with a severity.
    *
@@ -270,7 +271,7 @@ public:
    * The annotation uses the format @c AUTOTEXT_SEVERITY_CODE with arguments 
@a severity , @a ec
    * @see AUTOTEXT_SEVERITY_CODE
    */
-  explicit Errata(code_type const& ec, Severity severity, AutoText auto_text);
+  explicit Errata(code_type const &ec, Severity severity, AutoText auto_text);
 
   /** Constructor.
    *
@@ -1030,7 +1031,7 @@ inline Errata::Errata(self_type &&that) noexcept {
   std::swap(_data, that._data);
 }
 
-inline Errata::Errata(code_type const& ec) {
+inline Errata::Errata(code_type const &ec) {
   this->data()->_code = ec;
 }
 
@@ -1044,7 +1045,7 @@ inline Errata::Errata(const code_type &ec, Severity 
severity) {
   d->_code     = ec;
 }
 
-inline Errata::Errata(code_type const& ec, AutoText) {
+inline Errata::Errata(code_type const &ec, AutoText) {
   this->data()->_code = ec;
   this->note(AUTOTEXT_CODE, ec);
 }
diff --git a/code/include/swoc/TextView.h b/code/include/swoc/TextView.h
index ed342ee..41ed9ba 100644
--- a/code/include/swoc/TextView.h
+++ b/code/include/swoc/TextView.h
@@ -41,9 +41,14 @@ class TextView;
  */
 class CharSet {
   using self_type = CharSet;
+
 public:
-  constexpr CharSet(TextView const& chars);
-  bool operator () (u_char idx) const { return _chars[idx]; }
+  constexpr CharSet(TextView const &chars);
+  bool
+  operator()(u_char idx) const {
+    return _chars[idx];
+  }
+
 protected:
   std::bitset<256> _chars;
 };
@@ -1081,8 +1086,8 @@ double svtod(TextView text, TextView *parsed = nullptr);
 // simpler plain @c TextView ? Because otherwise Doxygen can't match up the 
declaration and
 // definition and the reference documentation is messed up. Sigh.
 
-inline constexpr CharSet::CharSet(TextView const & chars) {
-  for ( auto c : chars) {
+inline constexpr CharSet::CharSet(TextView const &chars) {
+  for (auto c : chars) {
     _chars[u_char(c)] = true;
   }
 }
@@ -1510,7 +1515,7 @@ TextView::trim(char c) {
 
 inline TextView &
 TextView::ltrim(CharSet const &delimiters) {
-  const char *spot = this->data();
+  const char *spot  = this->data();
   const char *limit = this->data_end();
 
   while (spot < limit && delimiters(*spot)) {
diff --git a/code/src/bw_format.cc b/code/src/bw_format.cc
index 83f1689..60ceacc 100644
--- a/code/src/bw_format.cc
+++ b/code/src/bw_format.cc
@@ -905,7 +905,7 @@ bwformat(BufferWriter &w, bwf::Spec const &spec, 
std::error_code const &ec) {
 
   // This provides convenient safe access to the errno short name array.
   static const swoc::bwf::Format number_fmt{"[{}]"_sv}; // numeric value 
format.
-  if (spec.has_numeric_type()) {  // if numeric type, print just the numeric 
part.
+  if (spec.has_numeric_type()) {                        // if numeric type, 
print just the numeric part.
     bwformat(w, spec, ec.value());
   } else {
     if ((&ec.category() == G_CAT || &ec.category() == S_CAT) && 
swoc::ERRNO_RANGE.contains(ec.value())) {
diff --git a/unit_tests/test_Errata.cc b/unit_tests/test_Errata.cc
index da766ca..8ce82a5 100644
--- a/unit_tests/test_Errata.cc
+++ b/unit_tests/test_Errata.cc
@@ -30,11 +30,7 @@ std::array<swoc::TextView, 5> Severity_Names{
   {"Debug", "Diag", "Info", "Warn", "Error"}
 };
 
-enum class ECode {
-  ALPHA = 1,
-  BRAVO,
-  CHARLIE
-};
+enum class ECode { ALPHA = 1, BRAVO, CHARLIE };
 
 struct e_category : std::error_category {
   const char *name() const noexcept override;
@@ -44,27 +40,24 @@ struct e_category : std::error_category {
 e_category e_cat;
 
 const char *
-e_category::name() const noexcept
-{
+e_category::name() const noexcept {
   return "libswoc";
 }
 
 std::string
-e_category::message(int ev) const
-{
-  static swoc::Lexicon<ECode> lexicon {
-      {
-        { ECode::ALPHA , "Alpha" },
-        { ECode::BRAVO, "Bravo"},
-        { ECode::CHARLIE, "Charlie"}
-      }
-      , "Code out of range"
+e_category::message(int ev) const {
+  static swoc::Lexicon<ECode> lexicon{
+    {{ECode::ALPHA, "Alpha"}, {ECode::BRAVO, "Bravo"}, {ECode::CHARLIE, 
"Charlie"}},
+    "Code out of range"
   };
 
   return std::string(lexicon[ECode(ev)]);
 }
 
-inline std::error_code ecode(ECode c) { return { int(c) , e_cat }; }
+inline std::error_code
+ecode(ECode c) {
+  return {int(c), e_cat};
+}
 
 std::string ErrataSinkText;
 

Reply via email to