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