diff --git a/headers/private/debugger/util/StringUtils.h b/headers/private/debugger/util/StringUtils.h deleted file mode 100644 index e2aaca7595..0000000000 --- a/headers/private/debugger/util/StringUtils.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef STRING_UTILS_H -#define STRING_UTILS_H - -#include - - -class StringUtils { -public: - static uint32 HashValue(const char* string); - static uint32 HashValue(const BString& string); -}; - - -/*static*/ inline uint32 -StringUtils::HashValue(const BString& string) -{ - return HashValue(string.String()); -} - - -#endif // STRING_UTILS_H diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 095d69333b..7f0ceb9b9e 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -42,7 +42,6 @@ #include "StackTrace.h" #include "StackFrame.h" #include "StackFrameValues.h" -#include "StringUtils.h" #include "StringValue.h" #include "SyntheticPrimitiveType.h" #include "TableCellValueEditor.h" @@ -245,7 +244,7 @@ protected: virtual uint32 ComputeHashValue() const { uint32 hash = reinterpret_cast(fInfo); - hash = hash * 19 + StringUtils::HashValue(fInfo->Expression()); + hash = hash * 19 + fInfo->Expression().HashValue(); return hash; } diff --git a/src/kits/debugger/Jamfile b/src/kits/debugger/Jamfile index aca5a49353..e34c110663 100644 --- a/src/kits/debugger/Jamfile +++ b/src/kits/debugger/Jamfile @@ -285,7 +285,6 @@ local sources = BitBuffer.cpp IntegerFormatter.cpp RangeList.cpp - StringUtils.cpp Worker.cpp # value diff --git a/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp index e44ddc2731..5280de93f2 100644 --- a/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/kits/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -50,7 +50,6 @@ #include "SourceFile.h" #include "StackFrame.h" #include "Statement.h" -#include "StringUtils.h" #include "SymbolInfo.h" #include "TargetAddressRangeList.h" #include "Team.h" @@ -247,7 +246,7 @@ struct DwarfImageDebugInfo::TypeNameKey { uint32 HashValue() const { - return StringUtils::HashValue(typeName); + return typeName.HashValue(); } bool operator==(const TypeNameKey& other) const diff --git a/src/kits/debugger/debug_info/DwarfStackFrameDebugInfo.cpp b/src/kits/debugger/debug_info/DwarfStackFrameDebugInfo.cpp index b2fe7b30ec..2f7f9c2d9d 100644 --- a/src/kits/debugger/debug_info/DwarfStackFrameDebugInfo.cpp +++ b/src/kits/debugger/debug_info/DwarfStackFrameDebugInfo.cpp @@ -26,7 +26,6 @@ #include "Register.h" #include "RegisterMap.h" #include "ReturnValueID.h" -#include "StringUtils.h" #include "Tracing.h" #include "ValueLocation.h" #include "Variable.h" @@ -63,7 +62,7 @@ protected: virtual uint32 ComputeHashValue() const { uint32 hash = fFunctionID->HashValue(); - return hash * 19 + StringUtils::HashValue(fName); + return hash * 19 + fName.HashValue(); } private: @@ -106,7 +105,7 @@ protected: virtual uint32 ComputeHashValue() const { uint32 hash = fFunctionID->HashValue(); - hash = hash * 19 + StringUtils::HashValue(fName); + hash = hash * 19 + fName.HashValue(); hash = hash * 19 + fLine; hash = hash * 19 + fColumn; return hash; @@ -152,7 +151,7 @@ protected: virtual uint32 ComputeHashValue() const { uint32 hash = fFunctionID->HashValue(); - return hash * 25 + StringUtils::HashValue(fName); + return hash * 25 + fName.HashValue(); } private: diff --git a/src/kits/debugger/debug_info/GlobalTypeLookup.cpp b/src/kits/debugger/debug_info/GlobalTypeLookup.cpp index 509f65ed47..39b890779c 100644 --- a/src/kits/debugger/debug_info/GlobalTypeLookup.cpp +++ b/src/kits/debugger/debug_info/GlobalTypeLookup.cpp @@ -12,7 +12,6 @@ #include -#include "StringUtils.h" #include "Type.h" #include "TypeLookupConstraints.h" @@ -42,7 +41,7 @@ struct GlobalTypeCache::TypeEntryHashDefinitionByName { size_t HashKey(const BString& key) const { - return StringUtils::HashValue(key); + return key.HashValue(); } size_t Hash(const TypeEntry* value) const @@ -68,7 +67,7 @@ struct GlobalTypeCache::TypeEntryHashDefinitionByID { size_t HashKey(const BString& key) const { - return StringUtils::HashValue(key); + return key.HashValue(); } size_t Hash(const TypeEntry* value) const diff --git a/src/kits/debugger/debug_info/TeamDebugInfo.cpp b/src/kits/debugger/debug_info/TeamDebugInfo.cpp index 5ed9ba1e88..a8ed610a0c 100644 --- a/src/kits/debugger/debug_info/TeamDebugInfo.cpp +++ b/src/kits/debugger/debug_info/TeamDebugInfo.cpp @@ -29,7 +29,6 @@ #include "SourceFile.h" #include "SourceLanguage.h" #include "SpecificImageDebugInfo.h" -#include "StringUtils.h" #include "Type.h" #include "TypeLookupConstraints.h" @@ -47,7 +46,7 @@ struct TeamDebugInfo::FunctionHashDefinition { if (key->SourceFile() == NULL) return (uint32)(addr_t)key; - uint32 hash = StringUtils::HashValue(key->Name()); + uint32 hash = key->Name().HashValue(); hash = hash * 17 + (uint32)(addr_t)key->SourceFile(); SourceLocation location = key->GetSourceLocation(); hash = hash * 17 + location.Line(); diff --git a/src/kits/debugger/files/FileManager.cpp b/src/kits/debugger/files/FileManager.cpp index 8389e1ba3a..2c9b01d813 100644 --- a/src/kits/debugger/files/FileManager.cpp +++ b/src/kits/debugger/files/FileManager.cpp @@ -14,7 +14,6 @@ #include "LocatableDirectory.h" #include "LocatableFile.h" #include "SourceFile.h" -#include "StringUtils.h" #include "TeamFileManagerSettings.h" @@ -58,8 +57,8 @@ struct FileManager::EntryPath { size_t HashValue() const { - return StringUtils::HashValue(directory) - ^ StringUtils::HashValue(name); + return BString::HashValue(directory) + ^ BString::HashValue(name); } bool operator==(const EntryPath& other) const @@ -519,7 +518,7 @@ struct FileManager::SourceFileHashDefinition { size_t HashKey(const BString& key) const { - return StringUtils::HashValue(key); + return key.HashValue(); } size_t Hash(const SourceFileEntry* value) const diff --git a/src/kits/debugger/ids/FunctionID.cpp b/src/kits/debugger/ids/FunctionID.cpp index c2d89b7b71..65e72a0404 100644 --- a/src/kits/debugger/ids/FunctionID.cpp +++ b/src/kits/debugger/ids/FunctionID.cpp @@ -10,8 +10,6 @@ #include -#include "StringUtils.h" - // #pragma mark - FunctionID @@ -55,8 +53,8 @@ FunctionID::Archive(BMessage* archive, bool deep) const uint32 FunctionID::ComputeHashValue() const { - return StringUtils::HashValue(fPath) * 17 - + StringUtils::HashValue(fFunctionName); + return fPath.HashValue() * 17 + + fFunctionName.HashValue(); } diff --git a/src/kits/debugger/model/ExpressionValues.cpp b/src/kits/debugger/model/ExpressionValues.cpp index 7032bb0702..f357ee1c7f 100644 --- a/src/kits/debugger/model/ExpressionValues.cpp +++ b/src/kits/debugger/model/ExpressionValues.cpp @@ -11,7 +11,6 @@ #include "FunctionID.h" #include "model/Thread.h" -#include "StringUtils.h" struct ExpressionValues::Key { @@ -30,7 +29,7 @@ struct ExpressionValues::Key { uint32 HashValue() const { return function->HashValue() ^ thread->ID() - ^ StringUtils::HashValue(expression); + ^ expression.HashValue(); } bool operator==(const Key& other) const diff --git a/src/kits/debugger/model/TypeComponentPath.cpp b/src/kits/debugger/model/TypeComponentPath.cpp index 0377e29762..50c82d48bb 100644 --- a/src/kits/debugger/model/TypeComponentPath.cpp +++ b/src/kits/debugger/model/TypeComponentPath.cpp @@ -10,8 +10,6 @@ #include -#include "StringUtils.h" - // #pragma mark - TypeComponent @@ -32,7 +30,7 @@ uint32 TypeComponent::HashValue() const { uint32 hash = ((uint32)index << 8) | (componentKind << 4) | typeKind; - return StringUtils::HashValue(name) * 13 + hash; + return name.HashValue() * 13 + hash; } diff --git a/src/kits/debugger/util/StringUtils.cpp b/src/kits/debugger/util/StringUtils.cpp deleted file mode 100644 index 7e1eb47d2b..0000000000 --- a/src/kits/debugger/util/StringUtils.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ - -#include "StringUtils.h" - - -// from the Dragon Book: a slightly modified hashpjw() -/*static*/ uint32 -StringUtils::HashValue(const char* string) -{ - if (string == NULL) - return 0; - - uint32 h = 0; - - for (; *string; string++) { - uint32 g = h & 0xf0000000; - if (g) - h ^= g >> 24; - h = (h << 4) + *string; - } - - return h; -}