<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>
<div>
<div>I like your other posting regarding registering allocators independent of the context, that makes for a cleaner, less error prone interface.  Let's carry the conversation further in that thread.</div>
<div>
<div>
<div>-- </div>
<div>Glen Wiley</div>
<div>KK4SFV</div>
</div>
<div>Sr. Engineer</div>
<div>The Hive, Verisign, Inc.</div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Willem Toorop <<a href="mailto:willem@nlnetlabs.nl">willem@nlnetlabs.nl</a>><br>
<span style="font-weight:bold">Date: </span>Friday, September 20, 2013 8:25 AM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:getdns-api@vpnc.org">getdns-api@vpnc.org</a>" <<a href="mailto:getdns-api@vpnc.org">getdns-api@vpnc.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [getdns-api] changes to signatures of data helper functions<br>
</div>
<div><br>
</div>
<div>
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Op 10-09-13 21:21, Wiley, Glen schreef:<br>
</div>
<blockquote cite="mid:CE54E98B.15B84%25gwiley@verisign.com" type="cite">
<div>I'd like to change the signatures for the non-trivial data type helper functions to include the context so that we will have access to the user defined allocators.  For example</div>
<div><br>
</div>
getdns_return_t getdns_list_copy(getdns_<span style="font-style:italic">context_</span>t context, struct getdns_list *srclist, struct getdns_list **dstlist);
<div></div>
getdns_return_t getdns_dict_get_names(getdns_<span style="font-style:italic">context_</span>t context, struct getdns_dict *dict, struct getdns_list **answer);
<div><br>
</div>
<div>What do folks think?</div>
</blockquote>
The structures representing lists and dicts could have an internal reference to context themselves and pass it on to the newly created lists and dicts.  As long as the dicts and lists involved are created by the lookup functions (which have the context argument)
 this will be okay.  It does not work when dicts and lists need to be created separately, for example to specify extensions. Thus the getdns_list_create and getdns_dict_create would need a context argument.<br>
<br>
Though, I actually think it would be better if setting the custom memory management functions should be  implementation specific, just like setting the event base is.<br>
<br>
-- Willem<br>
</div>
</div>
</span>
</body>
</html>