Commit a063ed5f authored by Brian Wellington's avatar Brian Wellington
Browse files

code review

parent 65debe76
......@@ -15,7 +15,9 @@
* SOFTWARE.
*/
/* $Id: a_1.c,v 1.23 2000/02/03 23:43:16 halley Exp $ */
/* $Id: a_1.c,v 1.24 2000/03/17 00:50:14 bwelling Exp $ */
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */
#ifndef RDATA_IN_1_A_1_C
#define RDATA_IN_1_A_1_C
......@@ -33,12 +35,12 @@ fromtext_in_a(dns_rdataclass_t rdclass, dns_rdatatype_t type,
struct in_addr addr;
isc_region_t region;
UNUSED(origin);
UNUSED(downcase);
REQUIRE(type == 1);
REQUIRE(rdclass == 1);
origin = origin; /*unused*/
downcase = downcase; /*unused*/
RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
if (inet_aton(token.value.as_pointer, &addr) != 1)
......@@ -57,12 +59,12 @@ totext_in_a(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
{
isc_region_t region;
UNUSED(tctx);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->rdclass == 1);
REQUIRE(rdata->length == 4);
tctx = tctx; /* unused */
isc_buffer_available(target, &region);
if (inet_ntop(AF_INET, rdata->data,
(char *)region.base, region.length) == NULL)
......@@ -80,13 +82,12 @@ fromwire_in_a(dns_rdataclass_t rdclass, dns_rdatatype_t type,
isc_region_t sregion;
isc_region_t tregion;
UNUSED(dctx);
UNUSED(downcase);
REQUIRE(type == 1);
REQUIRE(rdclass == 1);
dctx = dctx; /* unused */
downcase = downcase; /* unused */
isc_buffer_active(source, &sregion);
isc_buffer_available(target, &tregion);
if (sregion.length < 4)
......@@ -104,11 +105,11 @@ static inline isc_result_t
towire_in_a(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
isc_region_t region;
UNUSED(cctx);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->rdclass == 1);
cctx = cctx; /*unused*/
isc_buffer_available(target, &region);
if (region.length < rdata->length)
return (DNS_R_NOSPACE);
......@@ -119,31 +120,29 @@ towire_in_a(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
static inline int
compare_in_a(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
int result;
isc_region_t r1;
isc_region_t r2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->type);
REQUIRE(rdata1->type == 1);
REQUIRE(rdata1->rdclass == 1);
result = memcmp(rdata1->data, rdata2->data, 4);
if (result != 0)
result = (result < 0) ? -1 : 1;
return (result);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
}
static inline isc_result_t
fromstruct_in_a(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
isc_buffer_t *target)
{
UNUSED(source);
UNUSED(target);
REQUIRE(type == 1);
REQUIRE(rdclass == 1);
source = source;
target = target;
return (DNS_R_NOTIMPLEMENTED);
}
......@@ -153,11 +152,11 @@ tostruct_in_a(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
isc_uint32_t n;
isc_region_t region;
UNUSED(mctx);
REQUIRE(rdata->type == 1);
REQUIRE(rdata->rdclass == 1);
mctx = mctx; /* unused */
a->common.rdclass = rdata->rdclass;
a->common.rdtype = rdata->type;
ISC_LINK_INIT(&a->common, link);
......@@ -183,8 +182,8 @@ additionaldata_in_a(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
REQUIRE(rdata->type == 1);
REQUIRE(rdata->rdclass == 1);
(void)add;
(void)arg;
UNUSED(add);
UNUSED(arg);
return (DNS_R_SUCCESS);
}
......
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