mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
new ldap_pvt_thread_pool_setkey API
This commit is contained in:
parent
ac689156bc
commit
622c4d3884
@ -268,11 +268,16 @@ ldap_pvt_thread_pool_getkey LDAP_P((
|
||||
ldap_pvt_thread_pool_keyfree_t **kfree ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_pool_setkey LDAP_P((
|
||||
ldap_pvt_thread_pool_setkey_x LDAP_P((
|
||||
void *ctx,
|
||||
void *key,
|
||||
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_pvt_thread_pool_purgekey LDAP_P(( void *key ));
|
||||
|
@ -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.
|
||||
* 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 *key,
|
||||
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;
|
||||
int i, found;
|
||||
@ -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 ( i>=MAXKEYS )
|
||||
return ENOMEM;
|
||||
|
@ -234,14 +234,11 @@ memberof_saved_member_set( Operation *op, void *keyp, BerVarray vals )
|
||||
} else {
|
||||
BerVarray old_vals = NULL;
|
||||
|
||||
ldap_pvt_thread_pool_getkey( op->o_threadctx,
|
||||
key, (void **)&old_vals, NULL );
|
||||
ldap_pvt_thread_pool_setkey_x( op->o_threadctx, key,
|
||||
saved_vals, memberof_saved_member_free, &old_vals, NULL );
|
||||
if ( old_vals != NULL ) {
|
||||
ber_bvarray_free( old_vals );
|
||||
}
|
||||
|
||||
ldap_pvt_thread_pool_setkey( op->o_threadctx, key,
|
||||
saved_vals, memberof_saved_member_free );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user