[Libreoffice-commits] online.git: tools/map.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 14 07:44:23 UTC 2019


 tools/map.cpp |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 6bc1fa6215faa69b9327fcdac428f89635dd03b0
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jan 14 08:43:40 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jan 14 08:44:04 2019 +0100

    tools: make members private in AddrSpace
    
    Only _addrToStr needed a getter, the rest is not used externally.
    
    Change-Id: Ie1c0f860c6aa0acc26c8c7272298225a4804a5e5

diff --git a/tools/map.cpp b/tools/map.cpp
index 5f1df765f..845adfa07 100644
--- a/tools/map.cpp
+++ b/tools/map.cpp
@@ -141,11 +141,13 @@ public:
 };
 
 struct AddrSpace {
+private:
     unsigned _proc_id;
     std::vector<Map> _maps;
     std::unordered_map<addr_t, std::string> _addrToStr;
     StringData _strings[3];
 
+public:
     AddrSpace(unsigned proc_id) :
         _proc_id(proc_id)
     {
@@ -263,6 +265,8 @@ struct AddrSpace {
         }
         close (mem_fd);
     }
+
+    const std::unordered_map<addr_t, std::string>& getAddrToStr() const { return _addrToStr; }
 };
 
 
@@ -289,8 +293,8 @@ static void dumpDiff(const AddrSpace &space,
         for (unsigned int j = 0; j < width/8; j++)
         {
             std::string str;
-            auto it = space._addrToStr.find(ptrs[j]);
-            if (it != space._addrToStr.end())
+            auto it = space.getAddrToStr().find(ptrs[j]);
+            if (it != space.getAddrToStr().end())
             {
                 str = it->second;
                 haveAnnots = true;
@@ -486,7 +490,7 @@ static void dump_unshared(unsigned proc_id, unsigned parent_id,
     if (DumpStrings)
     {
         printf("String dump:\n");
-        for (const auto& addr : space._addrToStr)
+        for (const auto& addr : space.getAddrToStr())
         {
             if (DumpAll ||
                 unShared.find((addr.first & ~0x1fff)) != unShared.end())


More information about the Libreoffice-commits mailing list