mirror of https://github.com/getdnsapi/getdns.git
Rename a gldns function
This commit is contained in:
parent
30e1683d2f
commit
445470d831
|
@ -1354,7 +1354,7 @@ getdns_context_create_with_extended_memory_functions(
|
|||
result->suffixes = no_suffixes;
|
||||
result->suffixes_len = sizeof(no_suffixes);
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, result->trust_anchors_spc
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, result->trust_anchors_spc
|
||||
, sizeof(result->trust_anchors_spc));
|
||||
|
||||
if (!_getdns_parse_ta_file(NULL, &gbuf)) {
|
||||
|
@ -2333,7 +2333,7 @@ getdns_context_set_suffix(getdns_context *context, getdns_list *value)
|
|||
context->suffixes_len = sizeof(no_suffixes);
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
gldns_buffer_init_frm_data_v(&gbuf, buf_spc, sizeof(buf_spc));
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, buf_spc, sizeof(buf_spc));
|
||||
for (;;) {
|
||||
for ( i = 0
|
||||
; !(r = getdns_list_get_bindata(value, i, &bindata))
|
||||
|
|
|
@ -297,7 +297,7 @@ getdns_rr_dict2wire_scan(
|
|||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, *wire, *wire_sz);
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, *wire, *wire_sz);
|
||||
if ((r = _getdns_rr_dict2wire(rr_dict, &gbuf)))
|
||||
return r;
|
||||
|
||||
|
@ -447,7 +447,7 @@ getdns_rr_dict2str_scan(
|
|||
if (!rr_dict || !str || !*str || !str_len)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, buf, sizeof(buf_spc));
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, buf, sizeof(buf_spc));
|
||||
r = _getdns_rr_dict2wire(rr_dict, &gbuf);
|
||||
if (gldns_buffer_position(&gbuf) > sizeof(buf_spc)) {
|
||||
if (!(buf = GETDNS_XMALLOC(
|
||||
|
@ -960,7 +960,7 @@ getdns_msg_dict2wire_scan(
|
|||
if (!msg_dict || !wire || !wire_sz || (!*wire && *wire_sz))
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, *wire, *wire_sz);
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, *wire, *wire_sz);
|
||||
if ((r = _getdns_msg_dict2wire_buf(msg_dict, &gbuf)))
|
||||
return r;
|
||||
|
||||
|
@ -1036,7 +1036,7 @@ getdns_msg_dict2str_scan(
|
|||
if (!msg_dict || !str || !*str || !str_len)
|
||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, buf, sizeof(buf_spc));
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, buf, sizeof(buf_spc));
|
||||
r = _getdns_msg_dict2wire_buf(msg_dict, &gbuf);
|
||||
if (gldns_buffer_position(&gbuf) > sizeof(buf_spc)) {
|
||||
if (!(buf = GETDNS_XMALLOC(
|
||||
|
|
|
@ -1186,7 +1186,7 @@ getdns_pretty_snprint_dict(char *str, size_t size, const getdns_dict *dict)
|
|||
|
||||
if (!dict) return -1;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&buf, str, size);
|
||||
gldns_buffer_init_vfixed_frm_data(&buf, str, size);
|
||||
return getdns_pp_dict(&buf, 0, dict, 0) < 0
|
||||
? -1 : (int)gldns_buffer_position(&buf);
|
||||
}
|
||||
|
@ -1220,7 +1220,7 @@ getdns_pretty_snprint_list(char *str, size_t size, const getdns_list *list)
|
|||
|
||||
if (!list) return -1;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&buf, str, size);
|
||||
gldns_buffer_init_vfixed_frm_data(&buf, str, size);
|
||||
return getdns_pp_list(&buf, 0, list, 0, 0) < 0
|
||||
? -1 : (int)gldns_buffer_position(&buf);
|
||||
}
|
||||
|
@ -1255,7 +1255,7 @@ getdns_snprint_json_dict(
|
|||
|
||||
if (!dict) return -1;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&buf, str, size);
|
||||
gldns_buffer_init_vfixed_frm_data(&buf, str, size);
|
||||
return getdns_pp_dict(&buf, 0, dict, pretty ? 1 : 2) < 0
|
||||
? -1 : (int)gldns_buffer_position(&buf);
|
||||
}
|
||||
|
@ -1290,7 +1290,7 @@ getdns_snprint_json_list(
|
|||
|
||||
if (!list) return -1;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&buf, str, size);
|
||||
gldns_buffer_init_vfixed_frm_data(&buf, str, size);
|
||||
return getdns_pp_list(&buf, 0, list, 0, pretty ? 1 : 2) < 0
|
||||
? -1 : (int)gldns_buffer_position(&buf);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ gldns_buffer_init_frm_data(gldns_buffer *buffer, void *data, size_t size)
|
|||
}
|
||||
|
||||
void
|
||||
gldns_buffer_init_frm_data_v(gldns_buffer *buffer, void *data, size_t size)
|
||||
gldns_buffer_init_vfixed_frm_data(gldns_buffer *buffer, void *data, size_t size)
|
||||
{
|
||||
memset(buffer, 0, sizeof(*buffer));
|
||||
buffer->_data = data;
|
||||
|
|
|
@ -194,14 +194,16 @@ void gldns_buffer_init_frm_data(gldns_buffer *buffer, void *data, size_t size);
|
|||
|
||||
/**
|
||||
* Setup a buffer with the data pointed to. No data copied, no memory allocs.
|
||||
* The buffer is fixed. Writes beyond size (the capacity) will update the
|
||||
* position (and not write data). This allows to determine how big the buffer
|
||||
* should have been to contain all the written data.
|
||||
* The buffer is "virtually" fixed. Writes beyond size (the capacity) will
|
||||
* only update position, but no data will be written beyond capacity. This
|
||||
* allows to determine how big the buffer should have been to contain all the
|
||||
* written data, by looking at the position with gldns_buffer_position(),
|
||||
* similarly to the return value of POSIX's snprintf.
|
||||
* \param[in] buffer pointer to the buffer to put the data in
|
||||
* \param[in] data the data to encapsulate in the buffer
|
||||
* \param[in] size the size of the data
|
||||
*/
|
||||
void gldns_buffer_init_frm_data_v(gldns_buffer *buffer, void *data, size_t size);
|
||||
void gldns_buffer_init_vfixed_frm_data(gldns_buffer *buffer, void *data, size_t size);
|
||||
|
||||
/**
|
||||
* clears the buffer and make it ready for writing. The buffer's limit
|
||||
|
|
|
@ -383,7 +383,7 @@ _getdns_network_req_add_tsig(getdns_network_req *req)
|
|||
#endif
|
||||
tsig_info = _getdns_get_tsig_info(upstream->tsig_alg);
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, req->response, MAXIMUM_TSIG_SPACE);
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, req->response, MAXIMUM_TSIG_SPACE);
|
||||
gldns_buffer_write(&gbuf,
|
||||
upstream->tsig_dname, upstream->tsig_dname_len); /* Name */
|
||||
gldns_buffer_write_u16(&gbuf, GETDNS_RRCLASS_ANY); /* Class */
|
||||
|
|
|
@ -1510,7 +1510,7 @@ uint8_t *_getdns_list2wire(
|
|||
gldns_buffer gbuf;
|
||||
size_t sz;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, buf, *buf_len);
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, buf, *buf_len);
|
||||
_getdns_list2wire_buf(&gbuf, l);
|
||||
|
||||
if ((sz = gldns_buffer_position(&gbuf)) <= *buf_len) {
|
||||
|
@ -1531,7 +1531,7 @@ uint8_t *_getdns_reply2wire(
|
|||
gldns_buffer gbuf;
|
||||
size_t sz;
|
||||
|
||||
gldns_buffer_init_frm_data_v(&gbuf, buf, *buf_len);
|
||||
gldns_buffer_init_vfixed_frm_data(&gbuf, buf, *buf_len);
|
||||
_getdns_reply2wire_buf(&gbuf, r);
|
||||
|
||||
if ((sz = gldns_buffer_position(&gbuf)) <= *buf_len) {
|
||||
|
|
Loading…
Reference in New Issue