Commit 373854f6 authored by Daniel Salzman's avatar Daniel Salzman

rdata: code cleanup

parent bfde7a94
......@@ -251,14 +251,13 @@ static int rdata_len(const uint8_t **src, size_t *src_avail,
const uint8_t *pkt_wire,
const knot_rdata_descriptor_t *desc)
{
int ret;
int _len = 0;
const uint8_t *_src = *src;
size_t _src_avail = *src_avail;
for (int i = 0; desc->block_types[i] != KNOT_RDATA_WF_END; i++) {
int block_type = desc->block_types[i];
ret = rdata_len_block(&_src, &_src_avail, pkt_wire, block_type);
int ret = rdata_len_block(&_src, &_src_avail, pkt_wire, block_type);
if (ret < 0) {
return ret;
}
......@@ -641,8 +640,7 @@ static int parse_rdata(const uint8_t *pkt_wire, size_t *pos, size_t pkt_size,
const uint8_t *src = pkt_wire + *pos;
size_t src_avail = rdlength;
int buffer_size = 0;
buffer_size = rdata_len(&src, &src_avail, pkt_wire, desc);
int buffer_size = rdata_len(&src, &src_avail, pkt_wire, desc);
if (buffer_size < 0) {
return buffer_size;
}
......
......@@ -235,8 +235,7 @@ int knot_rdataset_reserve(knot_rdataset_t *rrs, size_t size, mm_ctx_t *mm)
size_t new_size = total_size + knot_rdata_array_size(size);
uint8_t *tmp = mm_realloc(mm, rrs->data, new_size, total_size);
if (!tmp) {
if (tmp == NULL) {
return KNOT_ENOMEM;
}
......@@ -374,7 +373,7 @@ int knot_rdataset_sort_at(knot_rdataset_t *rrs, size_t pos, mm_ctx_t *mm)
knot_rdata_t *rr = knot_rdataset_at(rrs, pos);
assert(rr);
knot_rdata_t *earlier_rr;
knot_rdata_t *earlier_rr = NULL;
for (uint16_t i = 0; i < rrs->rr_count; ++i) {
if (i == pos) {
// It already is at the position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment