[dlls/msi/format.c] Cleanup some strlen usages.

Peter Berg Larsen pebl at math.ku.dk
Fri Apr 15 17:15:52 CDT 2005


I cannot get gcc to eliminate identical calls to strlen*, it just inlines
the strlens and I stumpled on this code somehow.

Changelog:
	Remove 2 identicals calls to strlenW.



Index: dlls/msi/format.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/format.c,v
retrieving revision 1.9
diff -u -r1.9 format.c
--- dlls/msi/format.c   28 Mar 2005 14:17:52 -0000      1.9
+++ dlls/msi/format.c   15 Apr 2005 20:14:26 -0000
@@ -358,11 +358,12 @@
                 value = deformat_index(record,key,&chunk);
             else
             {
-                chunk = (strlenW(key) + 2)*sizeof(WCHAR);
+                DWORD keylen = strlenW(key);
+                chunk = (keylen + 2)*sizeof(WCHAR);
                 value = HeapAlloc(GetProcessHeap(),0,chunk);
                 value[0] = '[';
-                memcpy(&value[1],key,strlenW(key)*sizeof(WCHAR));
-                value[strlenW(key)+1] = ']';
+                memcpy(&value[1],key,keylen*sizeof(WCHAR));
+                value[1+keylen] = ']';
             }
         }
         else





More information about the wine-patches mailing list