Convenience list append functions

This commit is contained in:
Willem Toorop 2015-02-16 16:01:15 +01:00
parent 177ee2046a
commit d3f480009b
2 changed files with 33 additions and 0 deletions

View File

@ -480,5 +480,30 @@ getdns_list_set_int(struct getdns_list * list, size_t index,
list->items[index].data.n = child_int; list->items[index].data.n = child_int;
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
} /* getdns_list_set_int */ } /* getdns_list_set_int */
getdns_return_t
getdns_list_append_dict(getdns_list *list, const getdns_dict *child_dict)
{
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
return getdns_list_set_dict(list, list->numinuse, child_dict);
}
getdns_return_t
getdns_list_append_list(getdns_list *list, const getdns_list *child_list)
{
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
return getdns_list_set_list(list, list->numinuse, child_list);
}
getdns_return_t
getdns_list_append_bindata(getdns_list *list, const getdns_bindata *child_bindata)
{
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
return getdns_list_set_bindata(list, list->numinuse, child_bindata);
}
getdns_return_t
getdns_list_append_int(getdns_list *list, uint32_t child_int)
{
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
return getdns_list_set_int(list, list->numinuse, child_int);
}
/* getdns_list.c */ /* getdns_list.c */

View File

@ -71,6 +71,14 @@ getdns_return_t getdns_apply_network_result(getdns_network_req* netreq, struct u
* @return GETDNS_RETURN_GENERAL_ERROR if out of memory * @return GETDNS_RETURN_GENERAL_ERROR if out of memory
*/ */
getdns_return_t getdns_list_add_item(struct getdns_list *list, size_t * index); getdns_return_t getdns_list_add_item(struct getdns_list *list, size_t * index);
getdns_return_t getdns_list_append_dict(getdns_list *list,
const getdns_dict *child_dict);
getdns_return_t getdns_list_append_list(getdns_list *list,
const getdns_list *child_list);
getdns_return_t getdns_list_append_bindata(getdns_list *list,
const getdns_bindata *child_bindata);
getdns_return_t getdns_list_append_int(getdns_list *list,
uint32_t child_uint32);
/** /**
* private function (API users should not be calling this), this uses library * private function (API users should not be calling this), this uses library