Commit 90e303b1 authored by Olafur Gudmundsson's avatar Olafur Gudmundsson
Browse files

Adding function isc_region_compare and using in instead of compare_region in lib/dns

parent cfbdb5e0
1171. [func] Added function isc_region_compare(), updated files in
lib/dns to use this function instead of local one.
1170. [bug] Don't attempt to print the token when a I/O error
occurs when parsing named.conf. [RT #2275]
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.c,v 1.156 2001/11/30 01:02:09 gson Exp $ */
/* $Id: rdata.c,v 1.157 2002/01/05 07:05:05 ogud Exp $ */
#include <config.h>
#include <ctype.h>
......@@ -152,9 +152,6 @@ uint8_fromregion(isc_region_t *region);
static isc_result_t
mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length);
static int
compare_region(isc_region_t *r1, isc_region_t *r2);
static int
hexvalue(char value);
......@@ -449,7 +446,7 @@ dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
result = compare_region(&r1, &r2);
result = isc_region_compare(&r1, &r2);
}
return (result);
}
......@@ -1625,20 +1622,6 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
return (ISC_R_SUCCESS);
}
static int
compare_region(isc_region_t *r1, isc_region_t *r2) {
unsigned int l;
int result;
l = (r1->length < r2->length) ? r1->length : r2->length;
if ((result = memcmp(r1->base, r2->base, l)) != 0)
return ((result < 0) ? -1 : 1);
else
return ((r1->length == r2->length) ? 0 :
(r1->length < r2->length) ? -1 : 1);
}
static int
hexvalue(char value) {
char *s;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tsig_250.c,v 1.53 2001/11/27 01:55:32 gson Exp $ */
/* $Id: tsig_250.c,v 1.54 2002/01/05 07:05:06 ogud Exp $ */
/* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */
......@@ -350,7 +350,7 @@ compare_any_tsig(ARGS_COMPARE) {
return (order);
isc_region_consume(&r1, name_length(&name1));
isc_region_consume(&r2, name_length(&name2));
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cert_37.c,v 1.41 2001/11/27 01:55:35 gson Exp $ */
/* $Id: cert_37.c,v 1.42 2002/01/05 07:05:07 ogud Exp $ */
/* Reviewed: Wed Mar 15 21:14:32 EST 2000 by tale */
......@@ -161,7 +161,7 @@ compare_cert(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gpos_27.c,v 1.33 2001/11/27 00:55:58 gson Exp $ */
/* $Id: gpos_27.c,v 1.34 2002/01/05 07:05:08 ogud Exp $ */
/* reviewed: Wed Mar 15 16:48:45 PST 2000 by brister */
......@@ -109,7 +109,7 @@ compare_gpos(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: hinfo_13.c,v 1.38 2001/11/27 00:56:00 gson Exp $ */
/* $Id: hinfo_13.c,v 1.39 2002/01/05 07:05:10 ogud Exp $ */
/*
* Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley.
......@@ -101,7 +101,7 @@ compare_hinfo(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: isdn_20.c,v 1.30 2001/07/16 03:06:08 marka Exp $ */
/* $Id: isdn_20.c,v 1.31 2002/01/05 07:05:11 ogud Exp $ */
/* Reviewed: Wed Mar 15 16:53:11 PST 2000 by bwelling */
......@@ -110,7 +110,7 @@ compare_isdn(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: key_25.c,v 1.42 2001/11/27 01:55:36 gson Exp $ */
/* $Id: key_25.c,v 1.43 2002/01/05 07:05:12 ogud Exp $ */
/*
* Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley.
......@@ -176,7 +176,7 @@ compare_key(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: loc_29.c,v 1.31 2001/11/27 00:56:01 gson Exp $ */
/* $Id: loc_29.c,v 1.32 2002/01/05 07:05:13 ogud Exp $ */
/* Reviewed: Wed Mar 15 18:13:09 PST 2000 by explorer */
......@@ -619,7 +619,7 @@ compare_loc(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: null_10.c,v 1.36 2001/09/10 23:47:25 marka Exp $ */
/* $Id: null_10.c,v 1.37 2002/01/05 07:05:14 ogud Exp $ */
/* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
......@@ -86,7 +86,7 @@ compare_null(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nxt_30.c,v 1.51 2001/11/27 01:55:38 gson Exp $ */
/* $Id: nxt_30.c,v 1.52 2002/01/05 07:05:15 ogud Exp $ */
/* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */
......@@ -193,7 +193,7 @@ compare_nxt(ARGS_COMPARE) {
if (order != 0)
return (order);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: opt_41.c,v 1.25 2001/07/16 03:06:24 marka Exp $ */
/* $Id: opt_41.c,v 1.26 2002/01/05 07:05:16 ogud Exp $ */
/* Reviewed: Thu Mar 16 14:06:44 PST 2000 by gson */
......@@ -154,7 +154,7 @@ compare_opt(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: proforma.c,v 1.30 2001/01/09 21:54:35 bwelling Exp $ */
/* $Id: proforma.c,v 1.31 2002/01/05 07:05:17 ogud Exp $ */
#ifndef RDATA_GENERIC_#_#_C
#define RDATA_GENERIC_#_#_C
......@@ -84,7 +84,7 @@ compare_#(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sig_24.c,v 1.55 2001/11/27 01:55:40 gson Exp $ */
/* $Id: sig_24.c,v 1.56 2002/01/05 07:05:18 ogud Exp $ */
/* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */
......@@ -335,7 +335,7 @@ compare_sig(ARGS_COMPARE) {
INSIST(r2.length > 18);
r1.length = 18;
r2.length = 18;
order = compare_region(&r1, &r2);
order = isc_region_compare(&r1, &r2);
if (order != 0)
return (order);
......@@ -354,7 +354,7 @@ compare_sig(ARGS_COMPARE) {
isc_region_consume(&r1, name_length(&name1));
isc_region_consume(&r2, name_length(&name2));
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: soa_6.c,v 1.55 2001/11/27 01:55:42 gson Exp $ */
/* $Id: soa_6.c,v 1.56 2002/01/05 07:05:19 ogud Exp $ */
/* Reviewed: Thu Mar 16 15:18:32 PST 2000 by explorer */
......@@ -255,7 +255,7 @@ compare_soa(ARGS_COMPARE) {
isc_region_consume(&region1, name_length(&name1));
isc_region_consume(&region2, name_length(&name2));
return (compare_region(&region1, &region2));
return (isc_region_compare(&region1, &region2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tkey_249.c,v 1.49 2001/11/27 01:55:43 gson Exp $ */
/* $Id: tkey_249.c,v 1.50 2002/01/05 07:05:20 ogud Exp $ */
/*
* Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley.
......@@ -340,7 +340,7 @@ compare_tkey(ARGS_COMPARE) {
return (order);
isc_region_consume(&r1, name_length(&name1));
isc_region_consume(&r2, name_length(&name2));
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: txt_16.c,v 1.37 2001/07/16 03:06:33 marka Exp $ */
/* $Id: txt_16.c,v 1.38 2002/01/05 07:05:21 ogud Exp $ */
/* Reviewed: Thu Mar 16 15:40:00 PST 2000 by bwelling */
......@@ -119,7 +119,7 @@ compare_txt(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: unspec_103.c,v 1.29 2001/09/10 23:47:26 marka Exp $ */
/* $Id: unspec_103.c,v 1.30 2002/01/05 07:05:22 ogud Exp $ */
#ifndef RDATA_GENERIC_UNSPEC_103_C
#define RDATA_GENERIC_UNSPEC_103_C
......@@ -83,7 +83,7 @@ compare_unspec(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: x25_19.c,v 1.31 2001/07/16 03:06:36 marka Exp $ */
/* $Id: x25_19.c,v 1.32 2002/01/05 07:05:24 ogud Exp $ */
/* Reviewed: Thu Mar 16 16:15:57 PST 2000 by bwelling */
......@@ -103,7 +103,7 @@ compare_x25(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: a_1.c,v 1.46 2001/07/16 03:06:40 marka Exp $ */
/* $Id: a_1.c,v 1.47 2002/01/05 07:05:25 ogud Exp $ */
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */
......@@ -127,7 +127,7 @@ compare_in_a(ARGS_COMPARE) {
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (compare_region(&r1, &r2));
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
......
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