[vlc-devel] [PATCH 1/2] adaptive: avoid using global static objects
Steve Lhomme
robux4 at ycbcr.xyz
Thu Apr 1 10:34:59 UTC 2021
This avoids calling a C++ allocator early or a C++ deallocator late in the
lifetime of the module/program.
In this case the EmptyString doesn't need to be static, just const.
---
modules/demux/adaptive/xml/Node.cpp | 2 --
modules/demux/adaptive/xml/Node.h | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/modules/demux/adaptive/xml/Node.cpp b/modules/demux/adaptive/xml/Node.cpp
index 1d9cf0e5857..e2ef962cd5c 100644
--- a/modules/demux/adaptive/xml/Node.cpp
+++ b/modules/demux/adaptive/xml/Node.cpp
@@ -33,8 +33,6 @@
using namespace adaptive::xml;
-const std::string Node::EmptyString = "";
-
Node::Node() :
type( -1 )
{
diff --git a/modules/demux/adaptive/xml/Node.h b/modules/demux/adaptive/xml/Node.h
index d40b8875d8a..5a9a5cb6502 100644
--- a/modules/demux/adaptive/xml/Node.h
+++ b/modules/demux/adaptive/xml/Node.h
@@ -55,7 +55,7 @@ namespace adaptive
std::vector<std::string> toString(int) const;
private:
- static const std::string EmptyString;
+ const std::string EmptyString;
std::vector<Node *> subNodes;
std::map<std::string, std::string> attributes;
std::string name;
--
2.29.2
More information about the vlc-devel
mailing list