Commit e4f133de authored by Michael Graff's avatar Michael Graff
Browse files

Add isc_buffer_usedcount() and availablecount() -- which should become macros

parent c520793f
......@@ -104,6 +104,14 @@ isc_buffer_used(isc_buffer_t *b, isc_region_t *r) {
r->length = b->used;
}
unsigned int
isc_buffer_usedcount(isc_buffer_t *b)
{
REQUIRE(VALID_BUFFER(b));
return (b->used);
}
void
isc_buffer_available(isc_buffer_t *b, isc_region_t *r) {
/*
......@@ -117,6 +125,13 @@ isc_buffer_available(isc_buffer_t *b, isc_region_t *r) {
r->length = b->length - b->used;
}
unsigned int
isc_buffer_availablecount(isc_buffer_t *b)
{
REQUIRE(VALID_BUFFER(b));
return (b->length - b->used);
}
void
isc_buffer_add(isc_buffer_t *b, unsigned int n) {
......
......@@ -141,8 +141,6 @@ struct isc_buffer {
isc_mem_t *mctx;
};
typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t;
/***
*** Functions
***/
......@@ -248,6 +246,16 @@ isc_buffer_used(isc_buffer_t *b, isc_region_t *r);
* 'r' points to a region structure.
*/
unsigned int
isc_buffer_usedcount(isc_buffer_t *b);
/*
* Return the size of the used region of buffer 'b'
*
* Requires:
*
* 'b' is a valid buffer.
*/
void
isc_buffer_available(isc_buffer_t *b, isc_region_t *r);
/*
......@@ -260,6 +268,16 @@ isc_buffer_available(isc_buffer_t *b, isc_region_t *r);
* 'r' points to a region structure.
*/
unsigned int
isc_buffer_availablecount(isc_buffer_t *b);
/*
* Return the size of the available region of buffer 'b'
*
* Requires:
*
* 'b' is a valid buffer.
*/
void
isc_buffer_add(isc_buffer_t *b, unsigned int n);
/*
......
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