contrib/ldns/rr.c
static int
ldns_rr_compare_ds_dnskey(ldns_rr *ds,
                          ldns_rr *dnskey)
{
	ldns_rr *ds_gen;
	bool result = false;
	ldns_hash algo;

	if (!dnskey || !ds ||
	    ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS ||
	    ldns_rr_get_type(dnskey) != LDNS_RR_TYPE_DNSKEY) {
		return false;
	}

	if (ldns_rr_rdf(ds, 2) == NULL) {
		return false;
	}
	algo = ldns_rdf2native_int8(ldns_rr_rdf(ds, 2));

	ds_gen = ldns_key_rr2ds(dnskey, algo);
	if (ds_gen) {
		result = ldns_rr_compare(ds, ds_gen) == 0;
		ldns_rr_free(ds_gen);
	}
	return result;
}
/* convert dnskey to a ds with the given algorithm,
 * then compare the result with the given ds */
convert dnskey to a ds with the given algorithm,
then compare the result with the given ds
convert dnskey to a ds with the given algorithm then compare the result with the given ds
static int
ldns_rr_compare_ds_dnskey(ldns_rr *ds,
                          ldns_rr *dnskey)
{
	ldns_rr *ds_gen;
	bool result = false;
	ldns_hash algo;
	if (!dnskey || !ds ||
	    ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS ||
	    ldns_rr_get_type(dnskey) != LDNS_RR_TYPE_DNSKEY) {
		return false;
	}
	if (ldns_rr_rdf(ds, 2) == NULL) {
		return false;
	}
	algo = ldns_rdf2native_int8(ldns_rr_rdf(ds, 2));
	ds_gen = ldns_key_rr2ds(dnskey, algo);
	if (ds_gen) {
		result = ldns_rr_compare(ds, ds_gen) == 0;
		ldns_rr_free(ds_gen);
	}
	return result;
}
static int ldns_rr_compare_ds_dnskey ( ldns_rr * ds , ldns_rr * dnskey ) { ldns_rr * ds_gen ; bool result = false ; ldns_hash algo ; if ( ! dnskey || ! ds || ldns_rr_get_type ( ds ) != LDNS_RR_TYPE_DS || ldns_rr_get_type ( dnskey ) != LDNS_RR_TYPE_DNSKEY ) { return false ; } if ( ldns_rr_rdf ( ds , 2 ) == NULL ) { return false ; } algo = ldns_rdf2native_int8 ( ldns_rr_rdf ( ds , 2 ) ) ; ds_gen = ldns_key_rr2ds ( dnskey , algo ) ; if ( ds_gen ) { result = ldns_rr_compare ( ds , ds_gen ) == 0 ; ldns_rr_free ( ds_gen ) ; } return result ; }
convert dnskey to a ds with the given algorithm,
 then compare the result with the given ds
convert dnskey to a ds with the given algorithm then compare the result with the given ds