From dfda8826eb4654845430520dac48c011e058e1c0 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 1 Mar 2013 11:21:35 -0800 Subject: Make WL updates use pre-hashed strings for uniform sets --- indra/llcommon/CMakeLists.txt | 1 + indra/llcommon/llstringtable.h | 54 ------------------------------------------ indra/llcommon/llthread.h | 4 ++-- 3 files changed, 3 insertions(+), 56 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 5cce8ff2c4..e019c17280 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -236,6 +236,7 @@ set(llcommon_HEADER_FILES llstrider.h llstring.h llstringtable.h + llstaticstringtable.h llsys.h llthread.h llthreadsafequeue.h diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h index 4f6417328c..787a046741 100644 --- a/indra/llcommon/llstringtable.h +++ b/indra/llcommon/llstringtable.h @@ -33,7 +33,6 @@ #include "llstl.h" #include #include -#include #if LL_WINDOWS # if (_MSC_VER >= 1300 && _MSC_VER < 1400) @@ -43,59 +42,6 @@ //# define STRING_TABLE_HASH_MAP 1 #endif -#if STRING_TABLE_HASH_MAP -# if LL_WINDOWS -# include -# else -# include -# endif -#endif - -class LLStaticHashedString -{ -public: - - LLStaticHashedString(const std::string& s) - { - string_hash = makehash(s); - string = s; - } - - const std::string& String() const { return string; } - size_t Hash() const { return string_hash; } - -protected: - - size_t makehash(const std::string& s) - { - size_t len = s.size(); - const char* c = s.c_str(); - size_t hashval = 0; - for (size_t i=0; i -struct LLStaticStringHasher -{ - enum { bucket_size = 8 }; - size_t operator()(const T& key_value) const { return key_value.Hash(); } - bool operator()(const T& left, const T& right) const { return left.Hash() < right.Hash(); } -}; - -template< typename MappedObject > -class LL_COMMON_API LLStaticStringTable - : public std::hash_map< LLStaticHashedString , MappedObject, LLStaticStringHasher< LLStaticHashedString > > -{ -}; - const U32 MAX_STRINGS_LENGTH = 256; class LL_COMMON_API LLStringTableEntry diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index c2f4184a8a..0d22bc863d 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -262,9 +262,9 @@ public: // so that two threads who get into the if in parallel // don't both attempt to the delete. // - if (mRef == 1) - delete this; mRef--; + if (mRef == 0) + delete this; if (sMutex) sMutex->unlock(); return 0; } -- cgit v1.2.3