summaryrefslogtreecommitdiffstats
path: root/src/linkedmap.h
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-04-10 12:13:39 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-04-10 12:13:39 (GMT)
commit533242a8b422e66854327468a544a461c8bf9b7c (patch)
treeeadea9931af7cce7a0a27da0c8bdc6919626af10 /src/linkedmap.h
parentd6c0408b905868713856921af35654accf918686 (diff)
downloadDoxygen-533242a8b422e66854327468a544a461c8bf9b7c.zip
Doxygen-533242a8b422e66854327468a544a461c8bf9b7c.tar.gz
Doxygen-533242a8b422e66854327468a544a461c8bf9b7c.tar.bz2
Fixes after coverity run
Diffstat (limited to 'src/linkedmap.h')
-rw-r--r--src/linkedmap.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/linkedmap.h b/src/linkedmap.h
index f3caeb0..c724a39 100644
--- a/src/linkedmap.h
+++ b/src/linkedmap.h
@@ -36,8 +36,9 @@ class LinkedMap
//! find an element given the key.
//! Returns a pointer to the element if found or nullptr if it is not found.
- const T *find(const char *key) const
+ const T *find(const char *k) const
{
+ std::string key = k ? std::string(k) : std::string();
auto it = m_lookup.find(key);
return it!=m_lookup.end() ? it->second : nullptr;
}
@@ -52,14 +53,15 @@ class LinkedMap
//! Return a non-owning pointer to the newly added item, or to the existing item if it was
//! already inserted before.
template<class...Args>
- T *add(const char *key, Args&&... args)
+ T *add(const char *k, Args&&... args)
{
- T *result = find(key);
+ T *result = find(k);
if (result==nullptr)
{
- Ptr ptr = std::make_unique<T>(key,std::forward<Args>(args)...);
+ std::string key = k ? std::string(k) : std::string();
+ Ptr ptr = std::make_unique<T>(k,std::forward<Args>(args)...);
result = ptr.get();
- m_lookup.insert({key ? std::string(key) : std::string(),result});
+ m_lookup.insert({key,result});
m_entries.push_back(std::move(ptr));
}
return result;