Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / isc / include / isc / region.h
blobbd96e0e968da1196b07fef9970ad68c32dcb36ad
1 /*
2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2001 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.2.1 2004/03/09 06:12:00 marka Exp $ */
20 #ifndef ISC_REGION_H
21 #define ISC_REGION_H 1
23 #include <isc/types.h>
25 struct isc_region {
26 unsigned char * base;
27 unsigned int length;
30 struct isc_textregion {
31 char * base;
32 unsigned int length;
35 /* XXXDCL questionable ... bears discussion. we have been putting off
36 * discussing the region api.
38 struct isc_constregion {
39 const void * base;
40 unsigned int length;
43 struct isc_consttextregion {
44 const char * base;
45 unsigned int length;
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) \
54 do { \
55 isc_region_t *_r = (r); \
56 unsigned int _l = (l); \
57 INSIST(_r->length >= _l); \
58 _r->base += _l; \
59 _r->length -= _l; \
60 } while (0)
62 #define isc_textregion_consume(r,l) \
63 do { \
64 isc_textregion_t *_r = (r); \
65 unsigned int _l = (l); \
66 INSIST(_r->length >= _l); \
67 _r->base += _l; \
68 _r->length -= _l; \
69 } while (0)
71 #define isc_constregion_consume(r,l) \
72 do { \
73 isc_constregion_t *_r = (r); \
74 unsigned int _l = (l); \
75 INSIST(_r->length >= _l); \
76 _r->base += _l; \
77 _r->length -= _l; \
78 } while (0)
80 #endif /* ISC_REGION_H */