From 292f4e2a8cc91c287285952ea2fa843f26dc0898 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Sun, 13 Mar 2016 11:28:04 +0100 Subject: [PATCH] CGridListCtrlEx - OnKeyboardSearch - Minor optimization in CString allocations --- CGridListCtrlEx/CGridListCtrlEx.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CGridListCtrlEx/CGridListCtrlEx.cpp b/CGridListCtrlEx/CGridListCtrlEx.cpp index dc663fd9..fb5633e9 100644 --- a/CGridListCtrlEx/CGridListCtrlEx.cpp +++ b/CGridListCtrlEx/CGridListCtrlEx.cpp @@ -1844,11 +1844,10 @@ int CGridListCtrlEx::OnKeyboardSearch(int nCol, int nStartRow, const CString& st { for (int i = nStartRow; i < nRowCount; ++i) { - CString cellText = GetItemText(i, nCol); + const CString& cellText = GetItemText(i, nCol); if (cellText.GetLength() >= strSearch.GetLength()) { - cellText = cellText.Left(strSearch.GetLength()); - if (cellText.CompareNoCase(strSearch) == 0) + if (_tcsnicmp(cellText, strSearch, strSearch.GetLength()) == 0) return i; } }