[comctl32] Reduce memory usage of the syslink control

Robert Shearman rob at codeweavers.com
Fri Dec 30 05:56:29 CST 2005


Thomas Weidenmueller wrote:

>@@ -135,16 +141,16 @@
>                                         SL_ITEM_TYPE type, PDOC_ITEM LastItem)
> {
>     PDOC_ITEM Item;
>-    Item = Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR)));
>+
>+    textlen = min(textlen, lstrlenW(Text));
>+    Item = Alloc(FIELD_OFFSET(DOC_ITEM, Text[0]) + ((textlen + 1) * sizeof(WCHAR)));
>  
>

This line can be written simpler as:

Item = Alloc(FIELD_OFFSET(DOC_ITEM, Text[textlen + 1]));


-- 
Rob Shearman




More information about the wine-devel mailing list