Commit b420577e authored by Bob Halley's avatar Bob Halley
Browse files

add consume macros

parent e8b21314
/*
* Copyright (C) 1998 Internet Software Consortium.
* Copyright (C) 1998, 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
......@@ -29,8 +29,26 @@ typedef struct isc_textregion {
} isc_textregion_t;
/*
* There are no methods which operate on regions. The structure is not
* opaque, and must be directly manipulated by applications.
* The region structure is not opaque, and is usually directly manipulated.
* Some macros are defined below for convenience.
*/
#define isc_region_consume(r,l) \
do { \
isc_region_t *__r = (r); \
unsigned int __l = (l); \
INSIST(__r->length >= __l); \
__r->base += __l; \
__r->length -= __l; \
} while (0)
#define isc_textregion_consume(r,l) \
do { \
isc_textregion_t *__r = (r); \
unsigned int __l = (l); \
INSIST(__r->length >= __l); \
__r->base += __l; \
__r->length -= __l; \
} while (0)
#endif /* ISC_REGION_H */
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