mirror of https://github.com/getdnsapi/getdns.git
list_append_list not used
This commit is contained in:
parent
90beaaff1d
commit
c057f65b28
54
src/list.c
54
src/list.c
|
@ -335,23 +335,23 @@ _getdns_list_copy(const struct getdns_list * srclist,
|
|||
switch (srclist->items[i].dtype) {
|
||||
case t_int:
|
||||
retval = _getdns_list_append_int(*dstlist,
|
||||
srclist->items[i].data.n);
|
||||
srclist->items[i].data.n);
|
||||
break;
|
||||
|
||||
case t_list:
|
||||
retval = _getdns_list_append_list(*dstlist,
|
||||
srclist->items[i].data.list);
|
||||
retval = getdns_list_set_list(*dstlist,
|
||||
(*dstlist)->numinuse, srclist->items[i].data.list);
|
||||
break;
|
||||
|
||||
case t_bindata:
|
||||
retval = _getdns_list_append_const_bindata(*dstlist,
|
||||
srclist->items[i].data.bindata->size,
|
||||
srclist->items[i].data.bindata->data);
|
||||
srclist->items[i].data.bindata->size,
|
||||
srclist->items[i].data.bindata->data);
|
||||
break;
|
||||
|
||||
case t_dict:
|
||||
retval = _getdns_list_append_dict(*dstlist,
|
||||
srclist->items[i].data.dict);
|
||||
srclist->items[i].data.dict);
|
||||
break;
|
||||
}
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
|
@ -544,23 +544,6 @@ getdns_list_set_dict(
|
|||
} /* getdns_list_set_dict */
|
||||
|
||||
/*---------------------------------------- getdns_list_set_list */
|
||||
static getdns_return_t
|
||||
getdns_list_set_this_list(
|
||||
getdns_list *list, size_t index, getdns_list *child_list)
|
||||
{
|
||||
getdns_return_t r;
|
||||
|
||||
if (!list || !child_list)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
if ((r = _getdns_list_request_index(list, index)))
|
||||
return r;
|
||||
|
||||
list->items[index].dtype = t_list;
|
||||
list->items[index].data.list = child_list;
|
||||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_list_set_list */
|
||||
|
||||
getdns_return_t
|
||||
getdns_list_set_list(
|
||||
getdns_list *list, size_t index, const getdns_list *child_list)
|
||||
|
@ -574,10 +557,13 @@ getdns_list_set_list(
|
|||
if ((r = _getdns_list_copy(child_list, &newlist)))
|
||||
return r;
|
||||
|
||||
if ((r = _getdns_list_set_this_list(list, index, newlist)))
|
||||
if ((r = _getdns_list_request_index(list, index))) {
|
||||
getdns_list_destroy(newlist);
|
||||
|
||||
return r;
|
||||
return r;
|
||||
}
|
||||
list->items[index].dtype = t_list;
|
||||
list->items[index].data.list = newlist;
|
||||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_list_set_list */
|
||||
|
||||
/*---------------------------------------- getdns_list_set_bindata */
|
||||
|
@ -645,22 +631,10 @@ _getdns_list_append_dict(getdns_list *list, const getdns_dict *child_dict)
|
|||
return getdns_list_set_dict(list, list->numinuse, child_dict);
|
||||
}
|
||||
getdns_return_t
|
||||
_getdns_list_append_thist_dict(getdns_list *list, getdns_dict *child_dict)
|
||||
_getdns_list_append_this_dict(getdns_list *list, getdns_dict *child_dict)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_this_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_this_list(getdns_list *list, getdns_list *child_list)
|
||||
{
|
||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return getdns_list_set_this_list(list, list->numinuse, child_list);
|
||||
return _getdns_list_set_this_dict(list, list->numinuse, child_dict);
|
||||
}
|
||||
getdns_return_t
|
||||
_getdns_list_append_const_bindata(
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include <openssl/x509.h>
|
||||
#include <string.h>
|
||||
#include "context.h"
|
||||
#include "util-internal.h"
|
||||
|
||||
/* we only support sha256 at the moment. adding support for another
|
||||
digest is more complex than just adding another entry here. in
|
||||
|
@ -156,11 +157,9 @@ getdns_dict* getdns_pubkey_pin_create_from_string(
|
|||
*/
|
||||
|
||||
#define PKP_SC_ERR(e) { \
|
||||
err.size = sizeof(e); \
|
||||
err.data = (uint8_t*)e; \
|
||||
if (errorlist) \
|
||||
getdns_list_set_bindata(errorlist, \
|
||||
preverrs + errorcount, &err); \
|
||||
_getdns_list_append_const_bindata(errorlist, \
|
||||
sizeof(e), e); \
|
||||
errorcount++; \
|
||||
}
|
||||
#define PKP_SC_HARDERR(e, val) { \
|
||||
|
@ -170,15 +169,10 @@ getdns_return_t getdns_pubkey_pinset_sanity_check(
|
|||
const getdns_list* pinset,
|
||||
getdns_list* errorlist)
|
||||
{
|
||||
size_t errorcount = 0, preverrs = 0, pins = 0, i;
|
||||
getdns_bindata err;
|
||||
size_t errorcount = 0, pins = 0, i;
|
||||
getdns_dict * pin;
|
||||
getdns_bindata * data;
|
||||
|
||||
if (errorlist)
|
||||
if (getdns_list_get_length(errorlist, &preverrs))
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
if (getdns_list_get_length(pinset, &pins))
|
||||
PKP_SC_HARDERR("Can't get length of pinset",
|
||||
GETDNS_RETURN_INVALID_PARAMETER);
|
||||
|
@ -281,7 +275,6 @@ _getdns_get_pubkey_pinset_list(getdns_context *ctx,
|
|||
uint8_t buf[SHA256_DIGEST_LENGTH];
|
||||
getdns_bindata value = { .size = SHA256_DIGEST_LENGTH, .data = buf };
|
||||
getdns_dict *pin = NULL;
|
||||
size_t idx = 0;
|
||||
|
||||
if (out == NULL)
|
||||
return GETDNS_RETURN_MEMORY_ERROR;
|
||||
|
@ -296,9 +289,8 @@ _getdns_get_pubkey_pinset_list(getdns_context *ctx,
|
|||
memcpy(buf, pinset_in->pin, sizeof(buf));
|
||||
if (r = getdns_dict_set_bindata(pin, "value", &value), r)
|
||||
goto fail;
|
||||
if (r = getdns_list_set_dict(out, idx++, pin), r)
|
||||
if (r = _getdns_list_append_this_dict(out, pin), r)
|
||||
goto fail;
|
||||
getdns_dict_destroy(pin);
|
||||
pin = NULL;
|
||||
pinset_in = pinset_in->next;
|
||||
}
|
||||
|
|
|
@ -74,15 +74,9 @@ getdns_return_t getdns_apply_network_result(getdns_network_req* netreq,
|
|||
getdns_return_t _getdns_list_append_this_dict(getdns_list *list,
|
||||
getdns_dict *child_dict);
|
||||
|
||||
getdns_return_t _getdns_list_append_this_list(getdns_list *list,
|
||||
getdns_list *child_list);
|
||||
|
||||
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_string(getdns_list *list,
|
||||
const char *value);
|
||||
|
||||
|
|
Loading…
Reference in New Issue