mirror of https://github.com/getdnsapi/getdns.git
Use non-copying dict_set_dict
This commit is contained in:
parent
fc5f16dbcb
commit
6f157854ce
|
@ -3158,24 +3158,31 @@ _get_context_settings(getdns_context* context)
|
||||||
}
|
}
|
||||||
|
|
||||||
getdns_dict*
|
getdns_dict*
|
||||||
getdns_context_get_api_information(getdns_context* context) {
|
getdns_context_get_api_information(getdns_context* context)
|
||||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
{
|
||||||
getdns_dict* result = getdns_dict_create_with_context(context);
|
getdns_dict* result;
|
||||||
getdns_dict* settings;
|
getdns_dict* settings;
|
||||||
if (!result) {
|
|
||||||
return NULL;
|
if ((result = getdns_dict_create_with_context(context))
|
||||||
}
|
|
||||||
r = getdns_dict_util_set_string(result, "version_string", GETDNS_VERSION);
|
&& ! getdns_dict_util_set_string(
|
||||||
r |= getdns_dict_util_set_string(result, "implementation_string", PACKAGE_URL);
|
result, "version_string", GETDNS_VERSION)
|
||||||
r |= getdns_dict_set_int(result, "resolution_type", context->resolution_type);
|
|
||||||
settings = _get_context_settings(context);
|
&& ! getdns_dict_util_set_string(
|
||||||
r |= getdns_dict_set_dict(result, "all_context", settings);
|
result, "implementation_string", PACKAGE_URL)
|
||||||
getdns_dict_destroy(settings);
|
|
||||||
if (r != GETDNS_RETURN_GOOD) {
|
&& ! getdns_dict_set_int(
|
||||||
getdns_dict_destroy(result);
|
result, "resolution_type", context->resolution_type)
|
||||||
result = NULL;
|
|
||||||
}
|
&& (settings = _get_context_settings(context))) {
|
||||||
return result;
|
|
||||||
|
if (!_getdns_dict_set_this_dict(result,"all_context",settings))
|
||||||
|
return result;
|
||||||
|
|
||||||
|
getdns_dict_destroy(settings);
|
||||||
|
}
|
||||||
|
getdns_dict_destroy(result);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
|
|
|
@ -637,9 +637,8 @@ _getdns_wire2msg_dict_scan(struct mem_funcs *mf,
|
||||||
SET_WIRE_CNT(arcount, ARCOUNT);
|
SET_WIRE_CNT(arcount, ARCOUNT);
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
if ((r = getdns_dict_set_dict(result, "header", header)))
|
if ((r = _getdns_dict_set_this_dict(result, "header", header)))
|
||||||
goto error;
|
goto error;
|
||||||
getdns_dict_destroy(header);
|
|
||||||
header = NULL;
|
header = NULL;
|
||||||
eop = *wire + 12;
|
eop = *wire + 12;
|
||||||
|
|
||||||
|
@ -655,7 +654,7 @@ _getdns_wire2msg_dict_scan(struct mem_funcs *mf,
|
||||||
|
|
||||||
switch ((section = _getdns_rr_iter_section(rr_iter))) {
|
switch ((section = _getdns_rr_iter_section(rr_iter))) {
|
||||||
case GLDNS_SECTION_QUESTION:
|
case GLDNS_SECTION_QUESTION:
|
||||||
if ((r = getdns_dict_set_dict(
|
if ((r = _getdns_dict_set_this_dict(
|
||||||
result, "question", rr_dict)))
|
result, "question", rr_dict)))
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
@ -663,6 +662,7 @@ _getdns_wire2msg_dict_scan(struct mem_funcs *mf,
|
||||||
if ((r = _getdns_list_append_dict(
|
if ((r = _getdns_list_append_dict(
|
||||||
sections[section], rr_dict)))
|
sections[section], rr_dict)))
|
||||||
goto error;
|
goto error;
|
||||||
|
getdns_dict_destroy(rr_dict);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rr_dict = NULL;
|
rr_dict = NULL;
|
||||||
|
|
|
@ -376,10 +376,9 @@ _getdns_rr_iter2rr_dict(struct mem_funcs *mf, _getdns_rr_iter *i)
|
||||||
getdns_list_destroy(repeat_list);
|
getdns_list_destroy(repeat_list);
|
||||||
repeat_list = NULL;
|
repeat_list = NULL;
|
||||||
}
|
}
|
||||||
if (getdns_dict_set_dict(rr_dict, "rdata", rdata_dict))
|
if (_getdns_dict_set_this_dict(rr_dict, "rdata", rdata_dict))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
|
|
||||||
getdns_dict_destroy(rdata_dict);
|
|
||||||
return rr_dict;
|
return rr_dict;
|
||||||
|
|
||||||
rdata_error:
|
rdata_error:
|
||||||
|
@ -529,8 +528,9 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
SET_WIRE_CNT(arcount, ARCOUNT);
|
SET_WIRE_CNT(arcount, ARCOUNT);
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
if ((r = getdns_dict_set_dict(result, "header", header)))
|
if ((r = _getdns_dict_set_this_dict(result, "header", header)))
|
||||||
goto error;
|
goto error;
|
||||||
|
header = NULL;
|
||||||
|
|
||||||
canonical_name = req->owner->name;
|
canonical_name = req->owner->name;
|
||||||
canonical_name_len = req->owner->name_len;
|
canonical_name_len = req->owner->name_len;
|
||||||
|
@ -548,9 +548,10 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
section = _getdns_rr_iter_section(rr_iter);
|
section = _getdns_rr_iter_section(rr_iter);
|
||||||
if (section == GLDNS_SECTION_QUESTION) {
|
if (section == GLDNS_SECTION_QUESTION) {
|
||||||
|
|
||||||
if (getdns_dict_set_dict(result, "question", rr_dict))
|
if (_getdns_dict_set_this_dict(result, "question", rr_dict))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
rr_dict = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (_getdns_list_append_dict(sections[section], rr_dict))
|
if (_getdns_list_append_dict(sections[section], rr_dict))
|
||||||
|
@ -788,7 +789,7 @@ _getdns_create_call_reporting_dict(
|
||||||
_getdns_sockaddr_to_dict(
|
_getdns_sockaddr_to_dict(
|
||||||
context, &netreq->upstream->addr, &address_debug);
|
context, &netreq->upstream->addr, &address_debug);
|
||||||
|
|
||||||
if (getdns_dict_set_dict(netreq_debug, "query_to", address_debug)) {
|
if (_getdns_dict_set_this_dict(netreq_debug,"query_to",address_debug)){
|
||||||
getdns_dict_destroy(address_debug);
|
getdns_dict_destroy(address_debug);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -802,8 +803,6 @@ _getdns_create_call_reporting_dict(
|
||||||
getdns_dict_destroy(netreq_debug);
|
getdns_dict_destroy(netreq_debug);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
getdns_dict_destroy(address_debug);
|
|
||||||
|
|
||||||
if (transport != GETDNS_TRANSPORT_UDP) {
|
if (transport != GETDNS_TRANSPORT_UDP) {
|
||||||
/* Report the idle timeout actually used on the connection. Must trim,
|
/* Report the idle timeout actually used on the connection. Must trim,
|
||||||
maximum used in practice is 6553500ms, but this is stored in a uint64_t.*/
|
maximum used in practice is 6553500ms, but this is stored in a uint64_t.*/
|
||||||
|
|
Loading…
Reference in New Issue