<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Ugzip.m3 does an unnecessary heap allocation and copy.<br><br><br>Here I have changed it to avoid the heap allocation.<br>But it still makes a copy.<br><br>How can I fix that?<br><br>It seems ADR cannot be applied to constants?<br><br>CONST<br> ZLIB_VERSION = ARRAY [0..5] OF char{<br> ORD('1'), ORD('.'), ORD('0'), ORD('.'), ORD('4'), 0};<br><br>This works but still is inefficient:<br><br>PROCEDURE deflateInit(strm: z_stream_star; level: int): int =<br> VAR version := ZLIB_VERSION;<br> BEGIN<br> RETURN UgzipP.deflateInit_(strm, level, ADR(version[0]), BYTESIZE(z_stream));<br> END deflateInit;<br><br><br>I'd like to say ADR(ZLIB_VERSION[0]) or ADR(ZLIB_VERSION);<br>
const ZLIB_VERSION = "1.0.4"; and ADR(ZLIB_VERSION[0]) of that.<br><br><br> - Jay<br> </div></body>
</html>