summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-09-17 20:54:50 -0400
committerNat Goodspeed <nat@lindenlab.com>2016-09-17 20:54:50 -0400
commitd0249fb7c099d30015f22e49cc5421f3c80e05b7 (patch)
tree845472f2d75917b3d4091967c272e682904678f9 /indra
parent0f0920135a375563bbc97ae5fa8df6ad5d849f5d (diff)
MAINT-5232: Eliminate pointless string search for "class " prefix.
The Visual C++ runtime produces typeid(MyClass).name() as "class MyClass". It's prudent to check for the presence of that prefix before stripping off the first six characters, but if the first comparison should ever fail, find() would continue searching the rest of the string for "class " -- a search guaranteed to fail. Use compare() instead.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llerror.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 2ef748e3e4..245118b00f 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -270,15 +270,15 @@ namespace LLError
// DevStudio: type_info::name() includes the text "class " at the start
static const std::string class_prefix = "class ";
-
std::string name = mangled;
- std::string::size_type p = name.find(class_prefix);
- if (p == std::string::npos)
+ if (0 != name.compare(0, class_prefix.length(), class_prefix))
{
+ LL_DEBUGS() << "Did not see '" << class_prefix << "' prefix on '"
+ << name << "'" << LL_ENDL;
return name;
}
- return name.substr(p + class_prefix.size());
+ return name.substr(class_prefix.length());
#else
return mangled;