#define isc_mempool_create(c, s, mp) \
isc__mempool_create((c), (s), (mp)_ISC_MEM_FILELINE)
void
-isc__mempool_create(isc_mem_t *mctx, size_t size,
+isc__mempool_create(isc_mem_t *restrict mctx, const size_t element_size,
isc_mempool_t **mpctxp _ISC_MEM_FLARG);
/*%<
* Create a memory pool.
#define isc_mempool_destroy(mp) isc__mempool_destroy((mp)_ISC_MEM_FILELINE)
void
-isc__mempool_destroy(isc_mempool_t **mpctxp _ISC_MEM_FLARG);
+isc__mempool_destroy(isc_mempool_t **restrict mpctxp _ISC_MEM_FLARG);
/*%<
* Destroy a memory pool.
*
*/
void
-isc_mempool_setname(isc_mempool_t *mpctx, const char *name);
+isc_mempool_setname(isc_mempool_t *restrict mpctx, const char *name);
/*%<
* Associate a name with a memory pool. At most 15 characters may be
*used.
*/
unsigned int
-isc_mempool_getfreemax(isc_mempool_t *mpctx);
+isc_mempool_getfreemax(isc_mempool_t *restrict mpctx);
/*%<
* Returns the maximum allowed size of the free list.
*/
void
-isc_mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit);
+isc_mempool_setfreemax(isc_mempool_t *restrict mpctx, const unsigned int limit);
/*%<
* Sets the maximum allowed size of the free list.
*/
unsigned int
-isc_mempool_getfreecount(isc_mempool_t *mpctx);
+isc_mempool_getfreecount(isc_mempool_t *restrict mpctx);
/*%<
* Returns current size of the free list.
*/
unsigned int
-isc_mempool_getallocated(isc_mempool_t *mpctx);
+isc_mempool_getallocated(isc_mempool_t *restrict mpctx);
/*%<
* Returns the number of items allocated from this pool.
*/
unsigned int
-isc_mempool_getfillcount(isc_mempool_t *mpctx);
+isc_mempool_getfillcount(isc_mempool_t *restrict mpctx);
/*%<
* Returns the number of items allocated as a block from the parent
* memory context when the free list is empty.
*/
void
-isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit);
+isc_mempool_setfillcount(isc_mempool_t *restrict mpctx,
+ const unsigned int limit);
/*%<
* Sets the fillcount.
*
*/
void
-isc__mempool_create(isc_mem_t *mctx, size_t size,
- isc_mempool_t **mpctxp FLARG) {
- isc_mempool_t *mpctx = NULL;
+isc__mempool_create(isc_mem_t *restrict mctx, const size_t element_size,
+ isc_mempool_t **restrict mpctxp FLARG) {
+ isc_mempool_t *restrict mpctx = NULL;
+ size_t size = element_size;
REQUIRE(VALID_CONTEXT(mctx));
REQUIRE(size > 0U);
}
void
-isc_mempool_setname(isc_mempool_t *mpctx, const char *name) {
+isc_mempool_setname(isc_mempool_t *restrict mpctx, const char *name) {
REQUIRE(VALID_MEMPOOL(mpctx));
REQUIRE(name != NULL);
}
void
-isc__mempool_destroy(isc_mempool_t **mpctxp FLARG) {
- isc_mempool_t *mpctx = NULL;
+isc__mempool_destroy(isc_mempool_t **restrict mpctxp FLARG) {
+ isc_mempool_t *restrict mpctx = NULL;
isc_mem_t *mctx = NULL;
- element *item = NULL;
+ element *restrict item = NULL;
REQUIRE(mpctxp != NULL);
REQUIRE(VALID_MEMPOOL(*mpctxp));
#if __SANITIZE_ADDRESS__
void *
-isc__mempool_get(isc_mempool_t *mpctx FLARG) {
+isc__mempool_get(isc_mempool_t *restrict mpctx FLARG) {
REQUIRE(VALID_MEMPOOL(mpctx));
mpctx->allocated++;
}
void
-isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
+isc__mempool_put(isc_mempool_t *restrict mpctx, void *mem FLARG) {
REQUIRE(VALID_MEMPOOL(mpctx));
REQUIRE(mem != NULL);
#else /* __SANITIZE_ADDRESS__ */
void *
-isc__mempool_get(isc_mempool_t *mpctx FLARG) {
- element *item = NULL;
+isc__mempool_get(isc_mempool_t *restrict mpctx FLARG) {
+ element *restrict item = NULL;
REQUIRE(VALID_MEMPOOL(mpctx));
/* coverity[+free : arg-1] */
void
-isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
- element *item = NULL;
+isc__mempool_put(isc_mempool_t *restrict mpctx, void *mem FLARG) {
+ element *restrict item = NULL;
REQUIRE(VALID_MEMPOOL(mpctx));
REQUIRE(mem != NULL);
*/
void
-isc_mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit) {
+isc_mempool_setfreemax(isc_mempool_t *restrict mpctx,
+ const unsigned int limit) {
REQUIRE(VALID_MEMPOOL(mpctx));
mpctx->freemax = limit;
}
unsigned int
-isc_mempool_getfreemax(isc_mempool_t *mpctx) {
+isc_mempool_getfreemax(isc_mempool_t *restrict mpctx) {
REQUIRE(VALID_MEMPOOL(mpctx));
return (mpctx->freemax);
}
unsigned int
-isc_mempool_getfreecount(isc_mempool_t *mpctx) {
+isc_mempool_getfreecount(isc_mempool_t *restrict mpctx) {
REQUIRE(VALID_MEMPOOL(mpctx));
return (mpctx->freecount);
}
unsigned int
-isc_mempool_getallocated(isc_mempool_t *mpctx) {
+isc_mempool_getallocated(isc_mempool_t *restrict mpctx) {
REQUIRE(VALID_MEMPOOL(mpctx));
return (mpctx->allocated);
}
void
-isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit) {
+isc_mempool_setfillcount(isc_mempool_t *restrict mpctx,
+ unsigned int const limit) {
REQUIRE(VALID_MEMPOOL(mpctx));
REQUIRE(limit > 0);
}
unsigned int
-isc_mempool_getfillcount(isc_mempool_t *mpctx) {
+isc_mempool_getfillcount(isc_mempool_t *restrict mpctx) {
REQUIRE(VALID_MEMPOOL(mpctx));
return (mpctx->fillcount);