[getdns-api] changes to signatures of data helper functions
Wiley, Glen
gwiley at verisign.com
Fri Sep 20 20:27:44 CEST 2013
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.
--
Glen Wiley
KK4SFV
Sr. Engineer
The Hive, Verisign, Inc.
From: Willem Toorop <willem at nlnetlabs.nl<mailto:willem at nlnetlabs.nl>>
Date: Friday, September 20, 2013 8:25 AM
To: "getdns-api at vpnc.org<mailto:getdns-api at vpnc.org>" <getdns-api at vpnc.org<mailto:getdns-api at vpnc.org>>
Subject: Re: [getdns-api] changes to signatures of data helper functions
Op 10-09-13 21:21, Wiley, Glen schreef:
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
getdns_return_t getdns_list_copy(getdns_context_t context, struct getdns_list *srclist, struct getdns_list **dstlist);
getdns_return_t getdns_dict_get_names(getdns_context_t context, struct getdns_dict *dict, struct getdns_list **answer);
What do folks think?
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.
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.
-- Willem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://getdnsapi.net/pipermail/spec/attachments/20130920/ac502eaa/attachment.html>
More information about the spec
mailing list