diff options
| author | Alyssa Milburn | 2011-07-07 09:24:10 +0200 |
|---|---|---|
| committer | Alyssa Milburn | 2011-07-07 09:24:10 +0200 |
| commit | 66e81d633f987310f12038147ae01b8ce4f640f7 (patch) | |
| tree | 6035a7124789c3e6cdff5f603e9933529b7efdc7 /common | |
| parent | affaa1f4d6cf5f27f654029133b1aec7b9eca4b5 (diff) | |
| parent | 72da8ef5adf82d8a65da299207f30af5058ca8a9 (diff) | |
| download | scummvm-rg350-66e81d633f987310f12038147ae01b8ce4f640f7.tar.gz scummvm-rg350-66e81d633f987310f12038147ae01b8ce4f640f7.tar.bz2 scummvm-rg350-66e81d633f987310f12038147ae01b8ce4f640f7.zip | |
Merge remote-tracking branch 'origin/master' into soltys_wip2
Diffstat (limited to 'common')
| -rw-r--r-- | common/EventRecorder.cpp | 4 | ||||
| -rw-r--r-- | common/archive.cpp | 4 | ||||
| -rw-r--r-- | common/config-manager.cpp | 4 | ||||
| -rw-r--r-- | common/debug.cpp | 5 | ||||
| -rw-r--r-- | common/hashmap.h | 11 | ||||
| -rw-r--r-- | common/singleton.h | 6 | ||||
| -rw-r--r-- | common/system.h | 4 | ||||
| -rw-r--r-- | common/translation.cpp | 4 | ||||
| -rw-r--r-- | common/xmlparser.h | 1 |
9 files changed, 26 insertions, 17 deletions
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp index eb22e1ea88..4441070050 100644 --- a/common/EventRecorder.cpp +++ b/common/EventRecorder.cpp @@ -27,10 +27,10 @@ #include "common/savefile.h" #include "common/textconsole.h" -DECLARE_SINGLETON(Common::EventRecorder); - namespace Common { +DECLARE_SINGLETON(EventRecorder); + #define RECORD_SIGNATURE 0x54455354 #define RECORD_VERSION 1 diff --git a/common/archive.cpp b/common/archive.cpp index 0ef3893a8c..102d7aaa3f 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -285,7 +285,7 @@ void SearchManager::clear() { addDirectory(".", ".", -2); } -} // namespace Common +DECLARE_SINGLETON(SearchManager); -DECLARE_SINGLETON(Common::SearchManager); +} // namespace Common diff --git a/common/config-manager.cpp b/common/config-manager.cpp index a9d8c89035..fbdb611f3c 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -27,8 +27,6 @@ #include "common/system.h" #include "common/textconsole.h" -DECLARE_SINGLETON(Common::ConfigManager); - static bool isValidDomainName(const Common::String &domName) { const char *p = domName.c_str(); while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_')) @@ -38,6 +36,8 @@ static bool isValidDomainName(const Common::String &domName) { namespace Common { +DECLARE_SINGLETON(ConfigManager); + const char *ConfigManager::kApplicationDomain = "scummvm"; const char *ConfigManager::kTransientDomain = "__TRANSIENT"; diff --git a/common/debug.cpp b/common/debug.cpp index 0dae344bb2..9c3a93e5a6 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -23,16 +23,17 @@ #include "common/debug-channels.h" #include "common/system.h" #include "common/textconsole.h" +#include "common/algorithm.h" #include <stdarg.h> // For va_list etc. // TODO: Move gDebugLevel into namespace Common. int gDebugLevel = -1; -DECLARE_SINGLETON(Common::DebugManager); - namespace Common { +DECLARE_SINGLETON(DebugManager); + namespace { struct DebugLevelComperator { diff --git a/common/hashmap.h b/common/hashmap.h index f2a4d843b8..347ac1fd25 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -106,8 +106,9 @@ private: HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR }; - +#ifdef USE_HASHMAP_MEMORY_POOL ObjectPool<Node, HASHMAP_MEMORYPOOL_SIZE> _nodePool; +#endif Node **_storage; ///< hashtable of size arrsize. uint _mask; ///< Capacity of the HashMap minus one; must be a power of two of minus one @@ -128,12 +129,20 @@ private: #endif Node *allocNode(const Key &key) { +#ifdef USE_HASHMAP_MEMORY_POOL return new (_nodePool) Node(key); +#else + return new Node(key); +#endif } void freeNode(Node *node) { if (node && node != HASHMAP_DUMMY_NODE) +#ifdef USE_HASHMAP_MEMORY_POOL _nodePool.deleteChunk(node); +#else + delete node; +#endif } void assign(const HM_t &map); diff --git a/common/singleton.h b/common/singleton.h index 2f5fa41877..43f1c0c4d0 100644 --- a/common/singleton.h +++ b/common/singleton.h @@ -89,15 +89,13 @@ protected: }; /** - * Note that you need to use this macro from the global namespace. + * Note that you need to use this macro from the Common namespace. * * This is because C++ requires initial explicit specialization * to be placed in the same namespace as the template. - * It has to be put in the global namespace to assure the correct - * namespace Common is referenced. */ #define DECLARE_SINGLETON(T) \ - template<> T *Common::Singleton<T>::_singleton = 0 + template<> T *Singleton<T>::_singleton = 0 } // End of namespace Common diff --git a/common/system.h b/common/system.h index 15fbe386b1..9b833c5b1a 100644 --- a/common/system.h +++ b/common/system.h @@ -154,9 +154,9 @@ protected: #if defined(USE_TASKBAR) /** - * No default value is provided for _savefileManager by OSystem. + * No default value is provided for _taskbarManager by OSystem. * - * @note _savefileManager is deleted by the OSystem destructor. + * @note _taskbarManager is deleted by the OSystem destructor. */ Common::TaskbarManager *_taskbarManager; #endif diff --git a/common/translation.cpp b/common/translation.cpp index e456f733fd..5c8a04352d 100644 --- a/common/translation.cpp +++ b/common/translation.cpp @@ -37,10 +37,10 @@ #ifdef USE_TRANSLATION -DECLARE_SINGLETON(Common::TranslationManager); - namespace Common { +DECLARE_SINGLETON(TranslationManager); + bool operator<(const TLanguage &l, const TLanguage &r) { return strcmp(l.name, r.name) < 0; } diff --git a/common/xmlparser.h b/common/xmlparser.h index 40c779b87e..d75dc0e4a9 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -31,6 +31,7 @@ #include "common/hashmap.h" #include "common/hash-str.h" #include "common/stack.h" +#include "common/memorypool.h" namespace Common { |
