[Libreoffice-commits] core.git: include/tools tools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 10 19:20:00 UTC 2021


 include/tools/json_writer.hxx     |    4 ++--
 tools/source/misc/json_writer.cxx |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9490588c2460a77c16aacd52b7f449db60a6b34b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Sep 10 19:29:41 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 10 21:19:24 2021 +0200

    clang:optin.performance.Padding in tools
    
    Excessive padding in 'class tools::JsonWriter' (15 padding bytes, where
    7 is optimal).
    
    Change-Id: I7e37eec095d935a344b2e5fea7bb108ee878472a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121920
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/tools/json_writer.hxx b/include/tools/json_writer.hxx
index 2e50670c5b26..fb40e1920314 100644
--- a/include/tools/json_writer.hxx
+++ b/include/tools/json_writer.hxx
@@ -34,10 +34,10 @@ class TOOLS_DLLPUBLIC JsonWriter
     friend class ScopedJsonWriterArray;
     friend class ScopedJsonWriterStruct;
 
-    int mSpaceAllocated;
     char* mpBuffer;
-    int mStartNodeCount;
     char* mPos;
+    int mSpaceAllocated;
+    int mStartNodeCount;
     bool mbFirstFieldInNode;
 
 public:
diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx
index c326201eb9e5..b6482329ea55 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -21,10 +21,10 @@ namespace tools
 constexpr int DEFAULT_BUFFER_SIZE = 2048;
 
 JsonWriter::JsonWriter()
-    : mSpaceAllocated(DEFAULT_BUFFER_SIZE)
-    , mpBuffer(static_cast<char*>(malloc(mSpaceAllocated)))
-    , mStartNodeCount(0)
+    : mpBuffer(static_cast<char*>(malloc(DEFAULT_BUFFER_SIZE)))
     , mPos(mpBuffer)
+    , mSpaceAllocated(DEFAULT_BUFFER_SIZE)
+    , mStartNodeCount(0)
     , mbFirstFieldInNode(true)
 {
     *mPos = '{';


More information about the Libreoffice-commits mailing list