From bf82aeea369cacfc93a0e6d6d9feb01f1f2afdb2 Mon Sep 17 00:00:00 2001
From: Alexey Rusakov <Kitsune-Ral@users.sf.net>
Date: Tue, 18 Jan 2022 11:43:21 +0100
Subject: Don't use 'static' on top-level/namespace scope

When internal linkage is necessary, anonymous namespaces fulfil the same
purpose in a better way. See also:
https://stackoverflow.com/questions/4422507/superiority-of-unnamed-namespace-over-static
---
 lib/events/roommessageevent.cpp | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

(limited to 'lib/events')

diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp
index 0f58d8a6..5ab0f845 100644
--- a/lib/events/roommessageevent.cpp
+++ b/lib/events/roommessageevent.cpp
@@ -19,13 +19,15 @@ using namespace EventContent;
 
 using MsgType = RoomMessageEvent::MsgType;
 
-static constexpr auto RelatesToKey = "m.relates_to"_ls;
-static constexpr auto MsgTypeKey = "msgtype"_ls;
-static constexpr auto FormattedBodyKey = "formatted_body"_ls;
-static constexpr auto TextTypeKey = "m.text"_ls;
-static constexpr auto EmoteTypeKey = "m.emote"_ls;
-static constexpr auto NoticeTypeKey = "m.notice"_ls;
-static constexpr auto HtmlContentTypeId = "org.matrix.custom.html"_ls;
+namespace { // Supporting internal definitions
+
+constexpr auto RelatesToKey = "m.relates_to"_ls;
+constexpr auto MsgTypeKey = "msgtype"_ls;
+constexpr auto FormattedBodyKey = "formatted_body"_ls;
+constexpr auto TextTypeKey = "m.text"_ls;
+constexpr auto EmoteTypeKey = "m.emote"_ls;
+constexpr auto NoticeTypeKey = "m.notice"_ls;
+constexpr auto HtmlContentTypeId = "org.matrix.custom.html"_ls;
 
 template <typename ContentT>
 TypedBase* make(const QJsonObject& json)
@@ -87,6 +89,8 @@ inline bool isReplacement(const Omittable<RelatesTo>& rel)
     return rel && rel->type == RelatesTo::ReplacementTypeId();
 }
 
+} // anonymous namespace
+
 QJsonObject RoomMessageEvent::assembleContentJson(const QString& plainBody,
                                                   const QString& jsonMsgType,
                                                   TypedBase* content)
-- 
cgit v1.2.3