Skip to content
Snippets Groups Projects
Commit 38f2124c authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

new ldap_pvt_thread_pool_setkey API

parent 385beddb
No related branches found
No related tags found
No related merge requests found
...@@ -268,11 +268,16 @@ ldap_pvt_thread_pool_getkey LDAP_P(( ...@@ -268,11 +268,16 @@ ldap_pvt_thread_pool_getkey LDAP_P((
ldap_pvt_thread_pool_keyfree_t **kfree )); ldap_pvt_thread_pool_keyfree_t **kfree ));
LDAP_F( int ) LDAP_F( int )
ldap_pvt_thread_pool_setkey LDAP_P(( ldap_pvt_thread_pool_setkey_x LDAP_P((
void *ctx, void *ctx,
void *key, void *key,
void *data, void *data,
ldap_pvt_thread_pool_keyfree_t *kfree )); ldap_pvt_thread_pool_keyfree_t *kfree,
void **olddatap,
ldap_pvt_thread_pool_keyfree_t **oldkfreep ));
#define ldap_pvt_thread_pool_setkey( ctx, key, data, kfree ) \
ldap_pvt_thread_pool_setkey_x( (ctx), (key), (data), (kfree), NULL, NULL )
LDAP_F( void ) LDAP_F( void )
ldap_pvt_thread_pool_purgekey LDAP_P(( void *key )); ldap_pvt_thread_pool_purgekey LDAP_P(( void *key ));
......
...@@ -756,11 +756,13 @@ clear_key_idx( ldap_int_thread_userctx_t *ctx, int i ) ...@@ -756,11 +756,13 @@ clear_key_idx( ldap_int_thread_userctx_t *ctx, int i )
* responsibility to free any existing data with the same key. * responsibility to free any existing data with the same key.
* kfree() must not call functions taking a tpool argument. * kfree() must not call functions taking a tpool argument.
*/ */
int ldap_pvt_thread_pool_setkey( int ldap_pvt_thread_pool_setkey_x(
void *xctx, void *xctx,
void *key, void *key,
void *data, void *data,
ldap_pvt_thread_pool_keyfree_t *kfree ) ldap_pvt_thread_pool_keyfree_t *kfree,
void **olddatap,
ldap_pvt_thread_pool_keyfree_t **oldkfreep )
{ {
ldap_int_thread_userctx_t *ctx = xctx; ldap_int_thread_userctx_t *ctx = xctx;
int i, found; int i, found;
...@@ -776,6 +778,22 @@ int ldap_pvt_thread_pool_setkey( ...@@ -776,6 +778,22 @@ int ldap_pvt_thread_pool_setkey(
} }
} }
if ( olddatap ) {
if ( found ) {
*olddatap = ctx->ltu_key[i].ltk_data;
} else {
*olddatap = NULL;
}
}
if ( oldkfreep ) {
if ( found ) {
*oldkfreep = ctx->ltu_key[i].ltk_free;
} else {
*oldkfreep = NULL;
}
}
if ( data || kfree ) { if ( data || kfree ) {
if ( i>=MAXKEYS ) if ( i>=MAXKEYS )
return ENOMEM; return ENOMEM;
......
...@@ -234,14 +234,11 @@ memberof_saved_member_set( Operation *op, void *keyp, BerVarray vals ) ...@@ -234,14 +234,11 @@ memberof_saved_member_set( Operation *op, void *keyp, BerVarray vals )
} else { } else {
BerVarray old_vals = NULL; BerVarray old_vals = NULL;
ldap_pvt_thread_pool_getkey( op->o_threadctx, ldap_pvt_thread_pool_setkey_x( op->o_threadctx, key,
key, (void **)&old_vals, NULL ); saved_vals, memberof_saved_member_free, &old_vals, NULL );
if ( old_vals != NULL ) { if ( old_vals != NULL ) {
ber_bvarray_free( old_vals ); ber_bvarray_free( old_vals );
} }
ldap_pvt_thread_pool_setkey( op->o_threadctx, key,
saved_vals, memberof_saved_member_free );
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment