The shared/ dns_packet_read_uint*() functions used to be a bit
inconsistent when it comes to the handling of NULL in *ret. The
helpers dns_packet_read_{uint16,name} accepted NULL but the
dns_packet_read_uint{8,32} did not.
This commit makes them all symmetric in accepting NULL.
int r;
assert(p);
- assert(ret);
r = dns_packet_read(p, sizeof(uint8_t), &d, start);
if (r < 0)
return r;
- *ret = ((uint8_t*) d)[0];
+ if (ret)
+ *ret = ((uint8_t*) d)[0];
+
return 0;
}
int r;
assert(p);
- assert(ret);
r = dns_packet_read(p, sizeof(uint32_t), &d, start);
if (r < 0)
return r;
- *ret = unaligned_read_be32(d);
+ if (ret)
+ *ret = unaligned_read_be32(d);
return 0;
}