2 * Copyright (C) 2004-2007, 2013 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or 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.25 2007/06/19 23:47:18 tbox Exp $ */
21 #define ISC_REGION_H 1
23 /*! \file isc/region.h */
25 #include <isc/types.h>
33 struct isc_textregion {
38 /* XXXDCL questionable ... bears discussion. we have been putting off
39 * discussing the region api.
41 struct isc_constregion {
46 struct isc_consttextregion {
53 * The region structure is not opaque, and is usually directly manipulated.
54 * Some macros are defined below for convenience.
57 #define isc_region_consume(r,l) \
59 isc_region_t *_r = (r); \
60 unsigned int _l = (l); \
61 INSIST(_r->length >= _l); \
66 #define isc_textregion_consume(r,l) \
68 isc_textregion_t *_r = (r); \
69 unsigned int _l = (l); \
70 INSIST(_r->length >= _l); \
75 #define isc_constregion_consume(r,l) \
77 isc_constregion_t *_r = (r); \
78 unsigned int _l = (l); \
79 INSIST(_r->length >= _l); \
88 isc_region_compare(isc_region_t *r1, isc_region_t *r2);
90 * Compares the contents of two regions
93 *\li 'r1' is a valid region
94 *\li 'r2' is a valid region
97 *\li < 0 if r1 is lexicographically less than r2
98 *\li = 0 if r1 is lexicographically identical to r2
99 *\li > 0 if r1 is lexicographically greater than r2
104 #endif /* ISC_REGION_H */