[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/comphelper
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 31 08:22:56 UTC 2021
include/comphelper/profilezone.hxx | 24 +++++++++++++++++-------
include/comphelper/traceevent.hxx | 20 +++++++++++++++-----
2 files changed, 32 insertions(+), 12 deletions(-)
New commits:
commit 1bafb0dd8bd1a210e23c02491e81a29a0722e3da
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu May 27 10:43:16 2021 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon May 31 10:22:24 2021 +0200
Avoid empty std::map constructor
Change-Id: Ie1bc333409fb201d82dd2cff7597e281600f01db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116232
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index ebaae5aa43e8..36730e7f8af6 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -30,13 +30,8 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent
void addRecording();
- public:
-
- // Note that the char pointer is stored as such in the ProfileZone object and used in the
- // destructor, so be sure to pass a pointer that stays valid for the duration of the object's
- // lifetime.
- ProfileZone(const char* sName, const std::map<OUString, OUString> &args = std::map<OUString, OUString>())
- : NamedEvent(sName, args)
+ ProfileZone(const char* sName, const OUString &sArgs)
+ : NamedEvent(sName, sArgs)
, m_nNesting(-1)
{
if (s_bRecording)
@@ -51,6 +46,21 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent
m_nCreateTime = 0;
}
+ public:
+
+ // Note that the char pointer is stored as such in the ProfileZone object and used in the
+ // destructor, so be sure to pass a pointer that stays valid for the duration of the object's
+ // lifetime.
+ ProfileZone(const char* sName, const std::map<OUString, OUString> &aArgs)
+ : ProfileZone(sName, createArgsString(aArgs))
+ {
+ }
+
+ ProfileZone(const char* sName)
+ : ProfileZone(sName, OUString())
+ {
+ }
+
~ProfileZone()
{
if (m_nCreateTime > 0)
diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx
index 339e924e637d..cc3c390d7e59 100644
--- a/include/comphelper/traceevent.hxx
+++ b/include/comphelper/traceevent.hxx
@@ -82,9 +82,14 @@ protected:
const int m_nPid;
const OUString m_sArgs;
- TraceEvent(std::map<OUString, OUString> args)
+ TraceEvent(const OUString& sArgs)
: m_nPid(getPid())
- , m_sArgs(createArgsString(args))
+ , m_sArgs(sArgs)
+ {
+ }
+
+ TraceEvent(std::map<OUString, OUString> args)
+ : TraceEvent(createArgsString(args))
{
}
@@ -105,9 +110,14 @@ class COMPHELPER_DLLPUBLIC NamedEvent : public TraceEvent
protected:
const char* m_sName;
- NamedEvent(const char* sName,
- const std::map<OUString, OUString>& args = std::map<OUString, OUString>())
- : TraceEvent(args)
+ NamedEvent(const char* sName, const OUString& sArgs)
+ : TraceEvent(sArgs)
+ , m_sName(sName ? sName : "(null)")
+ {
+ }
+
+ NamedEvent(const char* sName, const std::map<OUString, OUString>& aArgs)
+ : TraceEvent(aArgs)
, m_sName(sName ? sName : "(null)")
{
}
More information about the Libreoffice-commits
mailing list