summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-13 18:10:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-13 18:10:23 -0700
commit3d704888eb6f5c72edd3abe6e5e48a62ef218975 (patch)
treecb7771f57efd960274d266c6166abb2fc60a775c /core
parentb31ca718ee94b681b9a1c3e59dcd885a4f421a5f (diff)
downloadpdfium-3d704888eb6f5c72edd3abe6e5e48a62ef218975.tar.xz
Add check for trivial string equality
BUG= Review-Url: https://codereview.chromium.org/2338623005
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/fx_basic_bstring.cpp3
-rw-r--r--core/fxcrt/fx_basic_wstring.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp
index d0ba1af5ba..0b9d9873d8 100644
--- a/core/fxcrt/fx_basic_bstring.cpp
+++ b/core/fxcrt/fx_basic_bstring.cpp
@@ -202,6 +202,9 @@ bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
}
bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
+ if (m_pData == other.m_pData)
+ return true;
+
if (IsEmpty())
return other.IsEmpty();
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 8837c6bb3b..88fc588947 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -180,6 +180,9 @@ bool CFX_WideString::operator==(const CFX_WideStringC& str) const {
}
bool CFX_WideString::operator==(const CFX_WideString& other) const {
+ if (m_pData == other.m_pData)
+ return true;
+
if (IsEmpty())
return other.IsEmpty();