[getdns-api] Memory part 2 - get and set (side note proposal)
Willem Toorop
willem at nlnetlabs.nl
Tue Jan 21 10:44:46 CET 2014
op 21-01-14 10:41, Willem Toorop schreef:
>> For the setters I propose this text to be the last paragraph of section 2.1:
>
> The helper setter functions store copies of the given "child"
> values. It is the responsibility of the caller to dispose of
> the original values.
Side note proposal:
The proposed memory strategy would most clearly be expressed by the
prototypes, with the given child value parameters const. The same for
the looked up names in dicts. The prototype would become:
getdns_return_t
getdns_list_set_dict(struct getdns_list *this_list, size_t index,
const struct getdns_dict *child_dict);
getdns_return_t
getdns_list_set_list(struct getdns_list *this_list, size_t index,
const struct getdns_list *child_list);
getdns_return_t
getdns_list_set_bindata(struct getdns_list *this_list, size_t index,
const struct getdns_bindata *child_bindata);
getdns_return_t
getdns_dict_set_dict(struct getdns_dict *this_dict, const char *name,
const struct getdns_dict *child_dict);
getdns_return_t
getdns_dict_set_list(struct getdns_dict *this_dict, const char *name,
const struct getdns_list *child_list);
getdns_return_t
getdns_dict_set_bindata(struct getdns_dict *this_dict,
const char *name, const struct getdns_bindata *child_bindata);
getdns_return_t
getdns_dict_set_int(struct getdns_dict *this_dict, const char *name,
uint32_t child_uint32);
getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict,
const char *name);
What do you think?
_______________________________________________
getdns-api mailing list
getdns-api at vpnc.org
More information about the spec
mailing list