[PATCH] comctl32: Avoid an unneeded lstrlenW() call.

Francois Gouget fgouget at free.fr
Sun Oct 21 20:16:56 CDT 2018


Signed-off-by: Francois Gouget <fgouget at free.fr>
---

It seems wasteful to compute the length of the string when all we care 
about is the first character. Plus the 'if (*str)' pattern is pretty 
common and used extensively in Wine already.

 dlls/comctl32/toolbar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 6a51ad7fc17..ec3b49890fd 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -2435,7 +2435,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                     btnInfo->btn = nmtb.tbButton;
                     if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
                     {
-                        if (lstrlenW(nmtb.pszText))
+                        if (*nmtb.pszText)
                             lstrcpyW(btnInfo->text, nmtb.pszText);
                         else if (nmtb.tbButton.iString >= 0 && 
                             nmtb.tbButton.iString < infoPtr->nNumStrings)
-- 
2.19.1



More information about the wine-devel mailing list