clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I16ee1c207c68c93c939ec7775238ab0cd86e7330
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 82c0e2c..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -7,7 +7,9 @@
 AlignConsecutiveDeclarations: false
 AlignEscapedNewlines: Right
 AlignOperands:  Align
-AlignTrailingComments: true
+AlignTrailingComments:
+  Kind: Always
+  OverEmptyLines: 1
 AllowAllParametersOfDeclarationOnNextLine: true
 AllowShortBlocksOnASingleLine: Empty
 AllowShortCaseLabelsOnASingleLine: false
@@ -36,6 +38,7 @@
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
   SplitEmptyNamespace:  false
+BreakAfterAttributes: Never
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 BreakBeforeTernaryOperators: true
@@ -78,8 +81,10 @@
 IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
+InsertNewlineAtEOF: true
 KeepEmptyLinesAtTheStartOfBlocks: false
 LambdaBodyIndentation: OuterScope
+LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
@@ -99,6 +104,7 @@
 ReferenceAlignment: Left
 ReflowComments:  true
 RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
 SortIncludes:    true
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
@@ -118,7 +124,6 @@
 SpacesInSquareBrackets: false
 Standard:        Latest
 TabWidth:        4
-UseCRLF: false
 UseTab:          Never
 ...
 
diff --git a/analyzer.cpp b/analyzer.cpp
index 80e22fc..81988a1 100644
--- a/analyzer.cpp
+++ b/analyzer.cpp
@@ -917,13 +917,13 @@
     }
     // Update global latency histogram
     // For method call latency
-    if (type == 1) // DBUS_MESSAGE_TYPE_METHOD_CALL
+    if (type == 1)       // DBUS_MESSAGE_TYPE_METHOD_CALL
     {
         uint64_t serial; // serial == cookie
         sd_bus_message_get_cookie(m, &serial);
         in_flight_methodcalls[serial] = Microseconds();
     }
-    else if (type == 2) // DBUS_MESSAGE_TYPE_MEHOTD_RETURN
+    else if (type == 2)            // DBUS_MESSAGE_TYPE_MEHOTD_RETURN
     {
         uint64_t reply_serial = 0; // serial == cookie
         sd_bus_message_get_reply_cookie(m, &reply_serial);
diff --git a/dbus_capture.cpp b/dbus_capture.cpp
index e464456..3395cef 100644
--- a/dbus_capture.cpp
+++ b/dbus_capture.cpp
@@ -237,4 +237,4 @@
         // Perform one analysis step
         dbus_top_analyzer::Process();
     }
-}
\ No newline at end of file
+}
diff --git a/histogram.hpp b/histogram.hpp
index 0c314d5..90a9313 100644
--- a/histogram.hpp
+++ b/histogram.hpp
@@ -181,4 +181,4 @@
     // "1% percentile" means "1% of the samples are below this value"
     ValueType low_percentile_, high_percentile_;
     int max_bucket_height_;
-};
\ No newline at end of file
+};
diff --git a/rect.hpp b/rect.hpp
index 8106143..e14fded 100644
--- a/rect.hpp
+++ b/rect.hpp
@@ -21,4 +21,4 @@
     int x, y, w, h; // X, Y, Width, Height
     Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h) {}
     Rect() : x(0), y(0), w(1), h(1) {}
-};
\ No newline at end of file
+};
diff --git a/sensorhelper.cpp b/sensorhelper.cpp
index 7326d47..2e09b60 100644
--- a/sensorhelper.cpp
+++ b/sensorhelper.cpp
@@ -163,4 +163,4 @@
         x = x.substr(idx);
     }
     return {d, x};
-}
\ No newline at end of file
+}
diff --git a/views.cpp b/views.cpp
index f5d9684..ea5140f 100644
--- a/views.cpp
+++ b/views.cpp
@@ -254,7 +254,7 @@
         float y_frac = lines_visible - static_cast<int>(lines_visible);
         char ch; // Last filling character
         if (y >= hist_ymin)
-        { // At the maximum bucket the Y overflows, so skip
+        {        // At the maximum bucket the Y overflows, so skip
             if (y_frac >= 0.66f)
             {
                 ch = ':';
@@ -1115,8 +1115,8 @@
                     };
                     int the_sum = 0; // For sorting
 
-                    std::string s; // String representation in the form or
-                                   // "1.00/2.00/3.00/4.00"
+                    std::string s;   // String representation in the form or
+                                     // "1.00/2.00/3.00/4.00"
                     for (int i = 0; i < 4; i++)
                     {
                         the_sum += numbers[i];
diff --git a/views.hpp b/views.hpp
index b661389..c74989c 100644
--- a/views.hpp
+++ b/views.hpp
@@ -422,7 +422,7 @@
     int highlight_col_idx_; // Currently highlighted column
     int row_idx_;           // Currently highlighted row
 
-    int sort_col_idx_; // Column used for sorting
+    int sort_col_idx_;      // Column used for sorting
     enum SortOrder
     {
         Ascending,
diff --git a/xmlparse.cpp b/xmlparse.cpp
index 93cb44d..20b2dc4 100644
--- a/xmlparse.cpp
+++ b/xmlparse.cpp
@@ -191,4 +191,4 @@
         }
     }
     return ret;
-}
\ No newline at end of file
+}