[getdns-api] changes to signatures of data helper functions
gwiley at verisign.com
Fri Sep 20 11:27:44 MST 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.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the getdns-api