From: Jerome St-Louis Date: Sun, 3 Jul 2016 10:45:04 +0000 (-0400) Subject: ecere/com/containers/List: Worked around too much memory being allocated X-Git-Tag: 0.44.15~154 X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=e131cb516190d3061ca0ce263855141267fef5bc ecere/com/containers/List: Worked around too much memory being allocated - Added a note regarding Link instantiation allocating too much memory --- diff --git a/ecere/src/com/containers/List.ec b/ecere/src/com/containers/List.ec index e8822d1..edd898c 100644 --- a/ecere/src/com/containers/List.ec +++ b/ecere/src/com/containers/List.ec @@ -31,13 +31,20 @@ public class List : LinkList Link Insert(Link after, LLT value) { Link link; - if(class(LLT) && class(LLT).type == structClass) + Class cLLT = class(LLT); + if(cLLT && cLLT.type == structClass) { - link = (Link)new0 byte[sizeof(class ListItem) + class(LLT).structSize]; - memcpy((void *)&link.data, (void *)value, class(LLT).structSize); + uint sType = cLLT.structSize; + link = (Link)new0 byte[sizeof(class ListItem) + sType]; + memcpy((void *)&link.data, (void *)value, sType); } else - link = Link { data = (uint64)value }; + { + // TOFIX: This allocates too much data? + // link = Link { data = (uint64)value }; + link = (Link)new0 byte[sizeof(class ListItem) + sizeof(uint64)]; + link.data = (uint64)value; + } LinkList::Insert(after, (LT)link); return link; }