[PATCH] comctl32: Avoid calling strlen on a constant

Alex Henrie alexhenrie24 at gmail.com
Tue Feb 5 00:12:07 CST 2019


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/comctl32/datetime.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index fb8a5c0380..ec87f253f7 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -127,7 +127,7 @@ extern int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace);
 
 static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code);
 static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr);
-static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', 0};
+static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X'};
 static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1};
 
 /* valid date limits */
@@ -244,14 +244,14 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *sy
 static void
 DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
 {
+    static const int len = ARRAY_SIZE(allowedformatchars);
     unsigned int i;
-    int j, k, len;
+    int j, k;
     BOOL inside_literal = FALSE; /* inside '...' */
     int *nrFields = &infoPtr->nrFields;
 
     *nrFields = 0;
     infoPtr->fieldspec[*nrFields] = 0;
-    len = strlenW(allowedformatchars);
     k = 0;
 
     for (i = 0; formattxt[i]; i++)  {
-- 
2.20.1




More information about the wine-devel mailing list