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 ));
* 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;
}
}
+ 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;
} 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 );
}
}