Commit 4af46a85 authored by Matthijs Mekking's avatar Matthijs Mekking 🏡 Committed by Ondřej Surý

rdata: delay assignment until after REQUIRE

parent 86184dfb
......@@ -353,14 +353,16 @@ compare_any_tsig(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_any_tsig(ARGS_FROMSTRUCT) {
dns_rdata_any_tsig_t *tsig = source;
dns_rdata_any_tsig_t *tsig;
isc_region_t tr;
REQUIRE(type == dns_rdatatype_tsig);
REQUIRE(rdclass == dns_rdataclass_any);
REQUIRE(tsig != NULL);
REQUIRE(tsig->common.rdclass == rdclass);
REQUIRE(tsig->common.rdtype == type);
REQUIRE(((dns_rdata_any_tsig_t *)source) != NULL);
REQUIRE(((dns_rdata_any_tsig_t *)source)->common.rdclass == rdclass);
REQUIRE(((dns_rdata_any_tsig_t *)source)->common.rdtype == type);
tsig = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -521,11 +523,13 @@ tostruct_any_tsig(ARGS_TOSTRUCT) {
static inline void
freestruct_any_tsig(ARGS_FREESTRUCT) {
dns_rdata_any_tsig_t *tsig = (dns_rdata_any_tsig_t *) source;
dns_rdata_any_tsig_t *tsig;
REQUIRE(((dns_rdata_any_tsig_t *)source) != NULL);
REQUIRE(((dns_rdata_any_tsig_t *)source)->common.rdtype == dns_rdatatype_tsig);
REQUIRE(((dns_rdata_any_tsig_t *)source)->common.rdclass == dns_rdataclass_any);
REQUIRE(tsig != NULL);
REQUIRE(tsig->common.rdtype == dns_rdatatype_tsig);
REQUIRE(tsig->common.rdclass == dns_rdataclass_any);
tsig = (dns_rdata_any_tsig_t *) source;
if (tsig->mctx == NULL)
return;
......
......@@ -187,13 +187,15 @@ compare_ch_a(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_ch_a(ARGS_FROMSTRUCT) {
dns_rdata_ch_a_t *a = source;
dns_rdata_ch_a_t *a;
isc_region_t region;
REQUIRE(type == dns_rdatatype_a);
REQUIRE(a != NULL);
REQUIRE(a->common.rdtype == type);
REQUIRE(a->common.rdclass == rdclass);
REQUIRE(((dns_rdata_ch_a_t *)source) != NULL);
REQUIRE(((dns_rdata_ch_a_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_ch_a_t *)source)->common.rdclass == rdclass);
a = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -206,7 +208,7 @@ fromstruct_ch_a(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_ch_a(ARGS_TOSTRUCT) {
dns_rdata_ch_a_t *a = target;
dns_rdata_ch_a_t *a;
isc_region_t region;
dns_name_t name;
......@@ -214,6 +216,8 @@ tostruct_ch_a(ARGS_TOSTRUCT) {
REQUIRE(rdata->rdclass == dns_rdataclass_ch);
REQUIRE(rdata->length != 0);
a = target;
a->common.rdclass = rdata->rdclass;
a->common.rdtype = rdata->type;
ISC_LINK_INIT(&a->common, link);
......@@ -233,10 +237,12 @@ tostruct_ch_a(ARGS_TOSTRUCT) {
static inline void
freestruct_ch_a(ARGS_FREESTRUCT) {
dns_rdata_ch_a_t *a = source;
dns_rdata_ch_a_t *a;
REQUIRE(((dns_rdata_ch_a_t *)source) != NULL);
REQUIRE(((dns_rdata_ch_a_t *)source)->common.rdtype == dns_rdatatype_a);
REQUIRE(a != NULL);
REQUIRE(a->common.rdtype == dns_rdatatype_a);
a = source;
if (a->mctx == NULL)
return;
......
......@@ -170,13 +170,15 @@ compare_afsdb(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_afsdb(ARGS_FROMSTRUCT) {
dns_rdata_afsdb_t *afsdb = source;
dns_rdata_afsdb_t *afsdb;
isc_region_t region;
REQUIRE(type == dns_rdatatype_afsdb);
REQUIRE(afsdb != NULL);
REQUIRE(afsdb->common.rdclass == rdclass);
REQUIRE(afsdb->common.rdtype == type);
REQUIRE(((dns_rdata_afsdb_t *)source) != NULL);
REQUIRE(((dns_rdata_afsdb_t *)source)->common.rdclass == rdclass);
REQUIRE(((dns_rdata_afsdb_t *)source)->common.rdtype == type);
afsdb = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -189,13 +191,15 @@ fromstruct_afsdb(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_afsdb(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_afsdb_t *afsdb = target;
dns_rdata_afsdb_t *afsdb;
dns_name_t name;
REQUIRE(((dns_rdata_afsdb_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_afsdb);
REQUIRE(afsdb != NULL);
REQUIRE(rdata->length != 0);
afsdb = target;
afsdb->common.rdclass = rdata->rdclass;
afsdb->common.rdtype = rdata->type;
ISC_LINK_INIT(&afsdb->common, link);
......@@ -217,10 +221,13 @@ tostruct_afsdb(ARGS_TOSTRUCT) {
static inline void
freestruct_afsdb(ARGS_FREESTRUCT) {
dns_rdata_afsdb_t *afsdb = source;
dns_rdata_afsdb_t *afsdb;
REQUIRE(((dns_rdata_afsdb_t *)source) != NULL);
REQUIRE(((dns_rdata_afsdb_t *)source)->common.rdtype ==
dns_rdatatype_afsdb);
REQUIRE(afsdb != NULL);
REQUIRE(afsdb->common.rdtype == dns_rdatatype_afsdb);
afsdb = source;
if (afsdb->mctx == NULL)
return;
......
......@@ -264,14 +264,16 @@ compare_amtrelay(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_amtrelay(ARGS_FROMSTRUCT) {
dns_rdata_amtrelay_t *amtrelay = source;
dns_rdata_amtrelay_t *amtrelay;
isc_region_t region;
uint32_t n;
REQUIRE(type == dns_rdatatype_amtrelay);
REQUIRE(amtrelay != NULL);
REQUIRE(amtrelay->common.rdtype == type);
REQUIRE(amtrelay->common.rdclass == rdclass);
REQUIRE(((dns_rdata_amtrelay_t *)source) != NULL);
REQUIRE(((dns_rdata_amtrelay_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_amtrelay_t *)source)->common.rdclass == rdclass);
amtrelay = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -305,14 +307,16 @@ fromstruct_amtrelay(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_amtrelay(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_amtrelay_t *amtrelay = target;
dns_rdata_amtrelay_t *amtrelay;
dns_name_t name;
uint32_t n;
REQUIRE(((dns_rdata_amtrelay_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_amtrelay);
REQUIRE(amtrelay != NULL);
REQUIRE(rdata->length >= 2);
amtrelay = target;
amtrelay->common.rdclass = rdata->rdclass;
amtrelay->common.rdtype = rdata->type;
ISC_LINK_INIT(&amtrelay->common, link);
......@@ -368,10 +372,13 @@ tostruct_amtrelay(ARGS_TOSTRUCT) {
static inline void
freestruct_amtrelay(ARGS_FREESTRUCT) {
dns_rdata_amtrelay_t *amtrelay = source;
dns_rdata_amtrelay_t *amtrelay;
REQUIRE(((dns_rdata_amtrelay_t *)source) != NULL);
REQUIRE(((dns_rdata_amtrelay_t *)source)->common.rdtype ==
dns_rdatatype_amtrelay);
REQUIRE(amtrelay != NULL);
REQUIRE(amtrelay->common.rdtype == dns_rdatatype_amtrelay);
amtrelay = source;
if (amtrelay->mctx == NULL)
return;
......
......@@ -87,10 +87,12 @@ fromstruct_avc(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_avc(ARGS_TOSTRUCT) {
dns_rdata_avc_t *avc = target;
dns_rdata_avc_t *avc;
REQUIRE(((dns_rdata_avc_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_avc);
REQUIRE(avc != NULL);
avc = target;
avc->common.rdclass = rdata->rdclass;
avc->common.rdtype = rdata->type;
......@@ -101,10 +103,8 @@ tostruct_avc(ARGS_TOSTRUCT) {
static inline void
freestruct_avc(ARGS_FREESTRUCT) {
dns_rdata_avc_t *avc = source;
REQUIRE(avc != NULL);
REQUIRE(avc->common.rdtype == dns_rdatatype_avc);
REQUIRE(((dns_rdata_avc_t *)source) != NULL);
REQUIRE(((dns_rdata_avc_t *)source)->common.rdtype == dns_rdatatype_avc);
generic_freestruct_txt(source);
}
......
......@@ -191,16 +191,19 @@ compare_caa(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_caa(ARGS_FROMSTRUCT) {
dns_rdata_caa_t *caa = source;
dns_rdata_caa_t *caa;
isc_region_t region;
unsigned int i;
REQUIRE(type == dns_rdatatype_caa);
REQUIRE(caa != NULL);
REQUIRE(caa->common.rdtype == type);
REQUIRE(caa->common.rdclass == rdclass);
REQUIRE(caa->tag != NULL && caa->tag_len != 0);
REQUIRE(caa->value != NULL);
REQUIRE(((dns_rdata_caa_t *)source) != NULL);
REQUIRE(((dns_rdata_caa_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_caa_t *)source)->common.rdclass == rdclass);
REQUIRE(((dns_rdata_caa_t *)source)->tag != NULL);
REQUIRE(((dns_rdata_caa_t *)source)->tag_len != 0);
REQUIRE(((dns_rdata_caa_t *)source)->value != NULL);
caa = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -235,14 +238,16 @@ fromstruct_caa(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_caa(ARGS_TOSTRUCT) {
dns_rdata_caa_t *caa = target;
dns_rdata_caa_t *caa;
isc_region_t sr;
REQUIRE(((dns_rdata_caa_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_caa);
REQUIRE(caa != NULL);
REQUIRE(rdata->length >= 3U);
REQUIRE(rdata->data != NULL);
caa = target;
caa->common.rdclass = rdata->rdclass;
caa->common.rdtype = rdata->type;
ISC_LINK_INIT(&caa->common, link);
......@@ -289,10 +294,13 @@ tostruct_caa(ARGS_TOSTRUCT) {
static inline void
freestruct_caa(ARGS_FREESTRUCT) {
dns_rdata_caa_t *caa = (dns_rdata_caa_t *) source;
dns_rdata_caa_t *caa;
REQUIRE(((dns_rdata_caa_t *)source) != NULL);
REQUIRE(((dns_rdata_caa_t *)source)->common.rdtype ==
dns_rdatatype_caa);
REQUIRE(caa != NULL);
REQUIRE(caa->common.rdtype == dns_rdatatype_caa);
caa = source;
if (caa->mctx == NULL)
return;
......
......@@ -86,12 +86,14 @@ fromstruct_cdnskey(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_cdnskey(ARGS_TOSTRUCT) {
dns_rdata_cdnskey_t *dnskey = target;
dns_rdata_cdnskey_t *dnskey;
REQUIRE(dnskey != NULL);
REQUIRE(((dns_rdata_cdnskey_t *)target) != NULL);
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
dnskey = target;
dnskey->common.rdclass = rdata->rdclass;
dnskey->common.rdtype = rdata->type;
ISC_LINK_INIT(&dnskey->common, link);
......@@ -101,10 +103,9 @@ tostruct_cdnskey(ARGS_TOSTRUCT) {
static inline void
freestruct_cdnskey(ARGS_FREESTRUCT) {
dns_rdata_cdnskey_t *dnskey = (dns_rdata_cdnskey_t *) source;
REQUIRE(dnskey != NULL);
REQUIRE(dnskey->common.rdtype == dns_rdatatype_cdnskey);
REQUIRE(((dns_rdata_cdnskey_t *)source) != NULL);
REQUIRE(((dns_rdata_cdnskey_t *)source)->common.rdtype ==
dns_rdatatype_cdnskey);
generic_freestruct_key(source);
}
......
......@@ -88,12 +88,14 @@ fromstruct_cds(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_cds(ARGS_TOSTRUCT) {
dns_rdata_cds_t *cds = target;
dns_rdata_cds_t *cds;
REQUIRE(((dns_rdata_cds_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_cds);
REQUIRE(cds != NULL);
REQUIRE(rdata->length != 0);
cds = target;
/*
* Checked by generic_tostruct_ds().
*/
......@@ -106,10 +108,13 @@ tostruct_cds(ARGS_TOSTRUCT) {
static inline void
freestruct_cds(ARGS_FREESTRUCT) {
dns_rdata_cds_t *cds = source;
dns_rdata_cds_t *cds;
REQUIRE(((dns_rdata_cds_t *)source) != NULL);
REQUIRE(((dns_rdata_cds_t *)source)->common.rdtype ==
dns_rdatatype_cds);
REQUIRE(cds != NULL);
REQUIRE(cds->common.rdtype == dns_rdatatype_cds);
cds = source;
if (cds->mctx == NULL) {
return;
......
......@@ -159,12 +159,14 @@ compare_cert(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_cert(ARGS_FROMSTRUCT) {
dns_rdata_cert_t *cert = source;
dns_rdata_cert_t *cert;
REQUIRE(type == dns_rdatatype_cert);
REQUIRE(cert != NULL);
REQUIRE(cert->common.rdtype == type);
REQUIRE(cert->common.rdclass == rdclass);
REQUIRE(((dns_rdata_cert_t *)source) != NULL);
REQUIRE(((dns_rdata_cert_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_cert_t *)source)->common.rdclass == rdclass);
cert = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -178,13 +180,15 @@ fromstruct_cert(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_cert(ARGS_TOSTRUCT) {
dns_rdata_cert_t *cert = target;
dns_rdata_cert_t *cert;
isc_region_t region;
REQUIRE(((dns_rdata_cert_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_cert);
REQUIRE(cert != NULL);
REQUIRE(rdata->length != 0);
cert = target;
cert->common.rdclass = rdata->rdclass;
cert->common.rdtype = rdata->type;
ISC_LINK_INIT(&cert->common, link);
......@@ -209,10 +213,13 @@ tostruct_cert(ARGS_TOSTRUCT) {
static inline void
freestruct_cert(ARGS_FREESTRUCT) {
dns_rdata_cert_t *cert = source;
dns_rdata_cert_t *cert;
REQUIRE(((dns_rdata_cert_t *)source) != NULL);
REQUIRE(((dns_rdata_cert_t *)source)->common.rdtype ==
dns_rdatatype_cert);
REQUIRE(cert != NULL);
REQUIRE(cert->common.rdtype == dns_rdatatype_cert);
cert = source;
if (cert->mctx == NULL)
return;
......
......@@ -119,13 +119,15 @@ compare_cname(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_cname(ARGS_FROMSTRUCT) {
dns_rdata_cname_t *cname = source;
dns_rdata_cname_t *cname;
isc_region_t region;
REQUIRE(type == dns_rdatatype_cname);
REQUIRE(cname != NULL);
REQUIRE(cname->common.rdtype == type);
REQUIRE(cname->common.rdclass == rdclass);
REQUIRE(((dns_rdata_cname_t *)source) != NULL);
REQUIRE(((dns_rdata_cname_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_cname_t *)source)->common.rdclass == rdclass);
cname = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -137,13 +139,15 @@ fromstruct_cname(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_cname(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_cname_t *cname = target;
dns_rdata_cname_t *cname;
dns_name_t name;
REQUIRE(((dns_rdata_cname_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_cname);
REQUIRE(cname != NULL);
REQUIRE(rdata->length != 0);
cname = target;
cname->common.rdclass = rdata->rdclass;
cname->common.rdtype = rdata->type;
ISC_LINK_INIT(&cname->common, link);
......@@ -159,9 +163,11 @@ tostruct_cname(ARGS_TOSTRUCT) {
static inline void
freestruct_cname(ARGS_FREESTRUCT) {
dns_rdata_cname_t *cname = source;
dns_rdata_cname_t *cname;
REQUIRE(((dns_rdata_cname_t *)source) != NULL);
REQUIRE(cname != NULL);
cname = source;
if (cname->mctx == NULL)
return;
......
......@@ -136,14 +136,17 @@ compare_csync(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_csync(ARGS_FROMSTRUCT) {
dns_rdata_csync_t *csync = source;
dns_rdata_csync_t *csync;
isc_region_t region;
REQUIRE(type == dns_rdatatype_csync);
REQUIRE(csync != NULL);
REQUIRE(csync->common.rdtype == type);
REQUIRE(csync->common.rdclass == rdclass);
REQUIRE(csync->typebits != NULL || csync->len == 0);
REQUIRE(((dns_rdata_csync_t *)source) != NULL);
REQUIRE(((dns_rdata_csync_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_csync_t *)source)->common.rdclass == rdclass);
REQUIRE(((dns_rdata_csync_t *)source)->typebits != NULL ||
((dns_rdata_csync_t *)source)->len == 0);
csync = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -160,12 +163,14 @@ fromstruct_csync(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_csync(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_csync_t *csync = target;
dns_rdata_csync_t *csync;
REQUIRE(((dns_rdata_csync_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_csync);
REQUIRE(csync != NULL);
REQUIRE(rdata->length != 0);
csync = target;
csync->common.rdclass = rdata->rdclass;
csync->common.rdtype = rdata->type;
ISC_LINK_INIT(&csync->common, link);
......@@ -192,10 +197,13 @@ tostruct_csync(ARGS_TOSTRUCT) {
static inline void
freestruct_csync(ARGS_FREESTRUCT) {
dns_rdata_csync_t *csync = source;
dns_rdata_csync_t *csync;
REQUIRE(((dns_rdata_csync_t *)source) != NULL);
REQUIRE(((dns_rdata_csync_t *)source)->common.rdtype ==
dns_rdatatype_csync);
REQUIRE(csync != NULL);
REQUIRE(csync->common.rdtype == dns_rdatatype_csync);
csync = source;
if (csync->mctx == NULL)
return;
......
......@@ -89,10 +89,12 @@ fromstruct_dlv(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_dlv(ARGS_TOSTRUCT) {
dns_rdata_dlv_t *dlv = target;
dns_rdata_dlv_t *dlv;
REQUIRE(((dns_rdata_dlv_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_dlv);
REQUIRE(dlv != NULL);
dlv = target;
dlv->common.rdclass = rdata->rdclass;
dlv->common.rdtype = rdata->type;
......@@ -103,10 +105,13 @@ tostruct_dlv(ARGS_TOSTRUCT) {
static inline void
freestruct_dlv(ARGS_FREESTRUCT) {
dns_rdata_dlv_t *dlv = source;
dns_rdata_dlv_t *dlv;
REQUIRE(((dns_rdata_dlv_t *)source) != NULL);
REQUIRE(((dns_rdata_dlv_t *)source)->common.rdtype ==
dns_rdatatype_dlv);
REQUIRE(dlv != NULL);
REQUIRE(dlv->common.rdtype == dns_rdatatype_dlv);
dlv = source;
if (dlv->mctx == NULL)
return;
......
......@@ -119,13 +119,15 @@ compare_dname(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_dname(ARGS_FROMSTRUCT) {
dns_rdata_dname_t *dname = source;
dns_rdata_dname_t *dname;
isc_region_t region;
REQUIRE(type == dns_rdatatype_dname);
REQUIRE(dname != NULL);
REQUIRE(dname->common.rdtype == type);
REQUIRE(dname->common.rdclass == rdclass);
REQUIRE(((dns_rdata_dname_t *)source) != NULL);
REQUIRE(((dns_rdata_dname_t *)source)->common.rdtype == type);
REQUIRE(((dns_rdata_dname_t *)source)->common.rdclass == rdclass);
dname = source;
UNUSED(type);
UNUSED(rdclass);
......@@ -137,13 +139,15 @@ fromstruct_dname(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_dname(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_dname_t *dname = target;
dns_rdata_dname_t *dname;
dns_name_t name;
REQUIRE(((dns_rdata_dname_t *)target) != NULL);
REQUIRE(rdata->type == dns_rdatatype_dname);
REQUIRE(dname != NULL);
REQUIRE(rdata->length != 0);
dname = target;
dname->common.rdclass = rdata->rdclass;
dname->common.rdtype = rdata->type;
ISC_LINK_INIT(&dname->common, link);
......@@ -159,10 +163,13 @@ tostruct_dname(ARGS_TOSTRUCT) {
static inline void
freestruct_dname(ARGS_FREESTRUCT) {
dns_rdata_dname_t *dname = source;
dns_rdata_dname_t *dname;
REQUIRE(((dns_rdata_dname_t *)source) != NULL);
REQUIRE(((dns_rdata_dname_t *)source)->common.rdtype ==
dns_rdatatype_dname);
REQUIRE(dname != NULL);
REQUIRE(dname->common.rdtype == dns_rdatatype_dname);
dname = source;
if (dname->mctx == NULL)
return;
......
......@@ -87,12 +87,14 @@ fromstruct_dnskey(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_dnskey(ARGS_TOSTRUCT) {
dns_rdata_dnskey_t *dnskey = target;
dns_rdata_dnskey_t *dnskey;
REQUIRE(dnskey != NULL);
REQUIRE(((dns_rdata_dnskey_t *)target) != NULL);
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_dnskey);
dnskey = target;
dnskey->common.rdclass = rdata->rdclass;
dnskey->common.rdtype = rdata->type;
ISC_LINK_INIT(&dnskey->common, link);
......@@ -102,10 +104,9 @@ tostruct_dnskey(ARGS_TOSTRUCT) {
static inline void
freestruct_dnskey(ARGS_FREESTRUCT) {
dns_rdata_dnskey_t *dnskey = (dns_rdata_dnskey_t *) source;
REQUIRE(dnskey != NULL);
REQUIRE(dnskey->common.rdtype == dns_rdatatype_dnskey);
REQUIRE(((dns_rdata_dnskey_t *)source) != NULL);
REQUIRE(((dns_rdata_dnskey_t *)source)->common.rdtype ==
dns_rdatatype_dnskey);
generic_freestruct_key(source);
}
......
......@@ -188,12 +188,15 @@ compare_doa(ARGS_COMPARE) {
static inline isc_result_t
fromstruct_doa(ARGS_FROMSTRUCT) {
dns_rdata_doa_t *doa = source;
dns_rdata_doa_t *doa;
REQUIRE(type == dns_rdatatype_doa);
REQUIRE(doa != NULL);
REQUIRE(doa->common.rdtype == dns_rdatatype_doa);
REQUIRE(doa->common.rdclass == rdclass);
REQUIRE(((dns_rdata_doa_t *)source) != NULL);
REQUIRE(((dns_rdata_doa_t *)source)->common.rdclass == rdclass);
REQUIRE(((dns_rdata_doa_t *)source)->common.rdtype ==
dns_rdatatype_doa);
doa = source;
RETERR(uint32_tobuffer(doa->enterprise, target));
RETERR(uint32_tobuffer(doa->type, target));
......@@ -205,14 +208,16 @@ fromstruct_doa(ARGS_FROMSTRUCT) {
static inline isc_result_t
tostruct_doa(ARGS_TOSTRUCT) {
dns_rdata_doa_t *doa = target;
dns_rdata_doa_t *doa;
isc_region_t region;
REQUIRE(((dns_rdata_doa_t *)target) != NULL);
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_doa);
REQUIRE(doa != NULL);
REQUIRE(rdata->length != 0);
doa = target;
doa->common.rdclass = rdata->rdclass;
doa->common.rdtype = rdata->type;
ISC_LINK_INIT(&doa->common, link);
......@@ -287,10 +292,13 @@ cleanup: