} while (0)
/*@{*/
-void
-isc_mem_create(isc_mem_t **mctxp);
+#define isc_mem_create(cp) ISCMEMFUNC(create)((cp)_ISC_MEM_FILELINE)
+void ISCMEMFUNC(create)(isc_mem_t **_ISC_MEM_FLARG);
/*!<
* \brief Create a memory context.
/*@{*/
void
isc_mem_attach(isc_mem_t *, isc_mem_t **);
-void
-isc_mem_detach(isc_mem_t **);
+#define isc_mem_detach(cp) ISCMEMFUNC(detach)((cp)_ISC_MEM_FILELINE)
+void ISCMEMFUNC(detach)(isc_mem_t **_ISC_MEM_FLARG);
/*!<
* \brief Attach to / detach from a memory context.
*
*/
/*@}*/
-void
-isc_mem_destroy(isc_mem_t **);
+#define isc_mem_destroy(cp) ISCMEMFUNC(destroy)((cp)_ISC_MEM_FILELINE)
+void ISCMEMFUNC(destroy)(isc_mem_t **_ISC_MEM_FLARG);
/*%<
* Destroy a memory context.
*/
}
void
-isc_mem_detach(isc_mem_t **ctxp) {
+isc__mem_detach(isc_mem_t **ctxp FLARG) {
REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
isc_mem_t *ctx = *ctxp;
if (isc_refcount_decrement(&ctx->references) == 1) {
isc_refcount_destroy(&ctx->references);
+#if ISC_MEM_TRACKLINES
+ if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) {
+ fprintf(stderr, "destroy mctx %p file %s line %u\n",
+ ctx, file, line);
+ }
+#endif
destroy(ctx);
}
}
}
void
-isc_mem_destroy(isc_mem_t **ctxp) {
+isc__mem_destroy(isc_mem_t **ctxp FLARG) {
/*
* This routine provides legacy support for callers who use mctxs
* without attaching/detaching.
isc_mem_t *ctx = *ctxp;
#if ISC_MEM_TRACKLINES
+ if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) {
+ fprintf(stderr, "destroy mctx %p file %s line %u\n", ctx, file,
+ line);
+ }
+
if (isc_refcount_decrement(&ctx->references) > 1) {
print_active(ctx, stderr);
}
void *
isc__mempool_get(isc_mempool_t *mpctx FLARG) {
element *item = NULL;
- unsigned int i;
REQUIRE(VALID_MEMPOOL(mpctx));
* We need to dip into the well. Lock the memory
* context here and fill up our free list.
*/
- for (i = 0; i < fillcount; i++) {
+ for (size_t i = 0; i < fillcount; i++) {
item = mem_get(mctx, mpctx->size);
mem_getstats(mctx, mpctx->size);
item->next = mpctx->items;
#endif /* HAVE_JSON_C */
void
-isc_mem_create(isc_mem_t **mctxp) {
+isc__mem_create(isc_mem_t **mctxp FLARG) {
mem_create(mctxp, isc_mem_defaultflags);
+#if ISC_MEM_TRACKLINES
+ if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) {
+ fprintf(stderr, "create mctx %p file %s line %u\n", *mctxp,
+ file, line);
+ }
+#endif /* ISC_MEM_TRACKLINES */
}
void