mirror of https://github.com/getdnsapi/getdns.git
char *getdns_pretty_print_list(getdns_list *list)
Handy for debugging purposes
This commit is contained in:
parent
ebb519919a
commit
2ad1470b4e
26
src/dict.c
26
src/dict.c
|
@ -598,7 +598,7 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent,
|
||||||
* if an output error is encountered, a negative value
|
* if an output error is encountered, a negative value
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
getdns_pp_list(gldns_buffer *buf, size_t indent, getdns_list *list,
|
getdns_pp_list(gldns_buffer *buf, size_t indent, const getdns_list *list,
|
||||||
int for_namespaces)
|
int for_namespaces)
|
||||||
{
|
{
|
||||||
size_t i, length, p = gldns_buffer_position(buf);
|
size_t i, length, p = gldns_buffer_position(buf);
|
||||||
|
@ -901,7 +901,7 @@ getdns_pretty_print_dict(const struct getdns_dict *dict)
|
||||||
if (!dict)
|
if (!dict)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
buf = gldns_buffer_new(100);
|
buf = gldns_buffer_new(8192);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -914,6 +914,28 @@ getdns_pretty_print_dict(const struct getdns_dict *dict)
|
||||||
return ret;
|
return ret;
|
||||||
} /* getdns_pretty_print_dict */
|
} /* getdns_pretty_print_dict */
|
||||||
|
|
||||||
|
char *
|
||||||
|
getdns_pretty_print_list(const getdns_list *list)
|
||||||
|
{
|
||||||
|
gldns_buffer *buf;
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
if (!list)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
buf = gldns_buffer_new(4096);
|
||||||
|
if (!buf)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (getdns_pp_list(buf, 0, list, 0) < 0) {
|
||||||
|
gldns_buffer_free(buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ret = (char *) gldns_buffer_export(buf);
|
||||||
|
gldns_buffer_free(buf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_remove_name(struct getdns_dict *this_dict, const char *name)
|
getdns_dict_remove_name(struct getdns_dict *this_dict, const char *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,6 +187,8 @@ getdns_context_get_edns_version(getdns_context *context, uint8_t* value);
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_context_get_edns_do_bit(getdns_context *context, uint8_t* value);
|
getdns_context_get_edns_do_bit(getdns_context *context, uint8_t* value);
|
||||||
|
|
||||||
|
char *getdns_pretty_print_list(const getdns_list *some_list);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue