diff --git a/lib/isc/buffer.c b/lib/isc/buffer.c index 30921f36bc..b766159749 100644 --- a/lib/isc/buffer.c +++ b/lib/isc/buffer.c @@ -379,6 +379,14 @@ isc_dynbuffer_allocate(isc_mem_t *mctx, isc_dynbuffer_t **dynbuffer, return (ISC_R_SUCCESS); } +void +isc_dynbuffer_reset(isc_dynbuffer_t *dynbuffer) +{ + REQUIRE(VALID_DYNBUFFER(dynbuffer)); + + isc_buffer_clear(&dynbuffer->buffer); +} + void isc_dynbuffer_free(isc_mem_t *mctx, isc_dynbuffer_t **dynbuffer) { diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index 6b745b7c42..b3190dbeb8 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -171,6 +171,13 @@ isc_dynbuffer_allocate(isc_mem_t *mctx, isc_dynbuffer_t **dynbuffer, * ISC_R_NOMEMORY - no memory available */ +void +isc_dynbuffer_reset(isc_dynbuffer_t *dynbuffer); +/* + * Reset the dynamic buffer to the initial state + */ + + void isc_dynbuffer_free(isc_mem_t *mctx, isc_dynbuffer_t **dynbuffer); /*