[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - common/Log.cpp common/Log.hpp

Michael Meeks michael.meeks at collabora.com
Thu May 11 10:03:32 UTC 2017


 common/Log.cpp |   15 +++++++++++++++
 common/Log.hpp |    2 ++
 2 files changed, 17 insertions(+)

New commits:
commit 8491f4f17e3680eec5aad98a090cb45bff66434a
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Apr 28 19:05:45 2017 +0100

    Signal safe number logging (lame but useful).
    
    Change-Id: I0b6095fc08dcc237a224b5942ab5a09e6820e43f
    Reviewed-on: https://gerrit.libreoffice.org/37480
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/common/Log.cpp b/common/Log.cpp
index 71b5a5b6..e4a9e995 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -78,6 +78,21 @@ namespace Log
         }
     }
 
+    // We need a signal safe means of writing messages
+    //   $ man 7 signal
+    void signalLogNumber(size_t num)
+    {
+        int i;
+        char buf[22];
+        buf[21] = '\0';
+        for (i = 20; i > 0 && num > 0; --i)
+        {
+            buf[i] = '0' + num % 10;
+            num /= 10;
+        }
+        signalLog(buf + i + 1);
+    }
+
     char* prefix(char* buffer, const char* level, bool sigSafe)
     {
         long osTid;
diff --git a/common/Log.hpp b/common/Log.hpp
index 3f64303a..21de30f6 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -50,6 +50,8 @@ namespace Log
     void signalLogPrefix();
     /// Signal safe logging
     void signalLog(const char* message);
+    /// Signal log number
+    void signalLogNumber(size_t num);
 
     /// The following is to write streaming logs.
     /// Log::info() << "Value: 0x" << std::hex << value


More information about the Libreoffice-commits mailing list