<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>On 10.03.2012 21:34, Anand Avati wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">
<pre>There is a no rule written on stone here. It is good practice to make</pre>
<pre>copies. Note that for things like iatt structure, you need not
"allocate" and "free" from the heap. Most of the time you can copy to
a structure on the stack, modify and return that. You will see that
for parameters which get modified in the callback (typically
aggregated from multiple subvolumes), most translators have a
"modified" copy inside frame-&gt;local.

Avati
</pre>
</blockquote>
<pre>Basically my problem was with dict_t. I already make copies of iatt and other simple structures without explicit memory allocation. These are cheap but anyway, if that were unnecessary, better not doing needless work.</pre>
<pre>&nbsp;</pre>
<pre>So, in general I can assume that all translators will make a copy if they modify any argument I pass to them, and I can use a COW (copy on write) policy for all structures I receive, either regular or callback calls. Right ?</pre>
<pre>&nbsp;</pre>
<pre>I had already seen that some translators were making copies, but I hadn't found any "official" statement saying that this was the way to do it. I just wanted to be sure.</pre>
<pre>&nbsp;</pre>
<pre>Thank you very much</pre>
<pre>&nbsp;</pre>
<pre>Xavi</pre>
</body></html>