/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003-2014 The OpenLDAP Foundation.
+ * Copyright 2003-2017 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct slab_object *so;
int i;
+ if (!sh)
+ return;
+
if (!sh->sh_stack) {
for (i = 0; i <= sh->sh_maxorder - order_start; i++) {
so = LDAP_LIST_FIRST(&sh->sh_free[i]);
}
/*
- * Separate memory context from thread context. Future users must
+ * Assign memory context to thread context. Use NULL to detach
+ * current memory context from thread. Future users must
* know the context, since ch_free/slap_sl_context() cannot find it.
*/
void
-slap_sl_mem_detach(
+slap_sl_mem_setctx(
void *thrctx,
void *memctx
)
{
- SET_MEMCTX(thrctx, NULL, 0);
+ SET_MEMCTX(thrctx, memctx, slap_sl_mem_destroy);
}
void *
}
}
+void
+slap_sl_release( void *ptr, void *ctx )
+{
+ struct slab_heap *sh = ctx;
+ if ( sh && ptr >= sh->sh_base && ptr <= sh->sh_end )
+ sh->sh_last = ptr;
+}
+
+void *
+slap_sl_mark( void *ctx )
+{
+ struct slab_heap *sh = ctx;
+ return sh->sh_last;
+}
+
/*
* Return the memory context of the current thread if the given block of
* memory belongs to it, otherwise return NULL.