From: Howard Chu Date: Thu, 1 Oct 2015 22:55:10 +0000 (+0100) Subject: ITS#8261 change sl_mem_detach to sl_mem_setctx X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=756a6b868321805d23fe84bf2043c11b13b13e8e;p=openldap ITS#8261 change sl_mem_detach to sl_mem_setctx --- diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 1b56b14adf..d8c4cabbbd 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1861,7 +1861,7 @@ LDAP_SLAPD_V (BerMemoryFunctions) slap_sl_mfuncs; LDAP_SLAPD_F (void) slap_sl_mem_init LDAP_P(( void )); LDAP_SLAPD_F (void *) slap_sl_mem_create LDAP_P(( ber_len_t size, int stack, void *ctx, int flag )); -LDAP_SLAPD_F (void) slap_sl_mem_detach LDAP_P(( void *ctx, void *memctx )); +LDAP_SLAPD_F (void) slap_sl_mem_setctx LDAP_P(( void *ctx, void *memctx )); LDAP_SLAPD_F (void) slap_sl_mem_destroy LDAP_P(( void *key, void *data )); LDAP_SLAPD_F (void *) slap_sl_context LDAP_P(( void *ptr )); diff --git a/servers/slapd/sl_malloc.c b/servers/slapd/sl_malloc.c index d440acbf28..017e61301e 100644 --- a/servers/slapd/sl_malloc.c +++ b/servers/slapd/sl_malloc.c @@ -279,16 +279,17 @@ slap_sl_mem_create( } /* - * 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 *