Avoid duplicate implicit ByteStringView creation in CFX_FolderFontInfo.
Potential for repeated calls to strlen() under the covers unless an
optimizer is smart enough to remove them.
Change-Id: I4df07c2caf20541ccc3a4d92b3050175c94e9e7f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65510
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index 7fd947a..05d7ec9 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -299,6 +299,7 @@
if (charset == FX_CHARSET_ANSI && FontFamilyIsFixedPitch(pitch_family))
return GetFont("Courier New");
+ ByteStringView bsFamily(family);
uint32_t charset_flag = GetCharset(charset);
int32_t iBestSimilar = 0;
for (const auto& it : m_FontList) {
@@ -307,7 +308,7 @@
if (!(pFont->m_Charsets & charset_flag) && charset != FX_CHARSET_Default)
continue;
- if (bMatchName && !bsName.Contains(family))
+ if (bMatchName && !bsName.Contains(bsFamily))
continue;
int32_t iSimilarValue =