2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: region.h,v 1.16.12.3 2004/03/08 09:04:53 marka Exp $ */
21 #define ISC_REGION_H 1
23 #include <isc/types.h>
30 struct isc_textregion {
35 /* XXXDCL questionable ... bears discussion. we have been putting off
36 * discussing the region api.
38 struct isc_constregion {
43 struct isc_consttextregion {
49 * The region structure is not opaque, and is usually directly manipulated.
50 * Some macros are defined below for convenience.
53 #define isc_region_consume(r,l) \
55 isc_region_t *_r = (r); \
56 unsigned int _l = (l); \
57 INSIST(_r->length >= _l); \
62 #define isc_textregion_consume(r,l) \
64 isc_textregion_t *_r = (r); \
65 unsigned int _l = (l); \
66 INSIST(_r->length >= _l); \
71 #define isc_constregion_consume(r,l) \
73 isc_constregion_t *_r = (r); \
74 unsigned int _l = (l); \
75 INSIST(_r->length >= _l); \
81 isc_region_compare(isc_region_t *r1, isc_region_t *r2);
83 * Compares the contents of two regions
86 * 'r1' is a valid region
87 * 'r2' is a valid region
90 * < 0 if r1 is lexicographically less than r2
91 * = 0 if r1 is lexicographically identical to r2
92 * > 0 if r1 is lexicographically greater than r2
95 #endif /* ISC_REGION_H */