ITS#3092: Rename sl_free() and friends to slap_sl_free()

This commit is contained in:
Kurt Zeilenga 2004-04-20 03:44:57 +00:00
parent 0aeec234ea
commit 1372965d89
23 changed files with 134 additions and 131 deletions

View file

@ -1777,7 +1777,7 @@ aci_set_gather (SetCookie *cookie, struct berval *name, struct berval *attr)
backend_attribute(cp->op,
cp->e, &ndn, desc, &bvals);
}
sl_free(ndn.bv_val, cp->op->o_tmpmemctx);
slap_sl_free(ndn.bv_val, cp->op->o_tmpmemctx);
}
return(bvals);
}
@ -1845,7 +1845,7 @@ aci_match_set (
cookie.e = e;
rc = (slap_set_filter(aci_set_gather, (SetCookie *)&cookie, &set,
&op->o_ndn, &e->e_nname, NULL) > 0);
sl_free(set.bv_val, op->o_tmpmemctx);
slap_sl_free(set.bv_val, op->o_tmpmemctx);
}
return(rc);
}

View file

@ -188,7 +188,7 @@ attr_merge_normalize(
for ( i = 0; vals[i].bv_val; i++ );
nvals = sl_calloc( sizeof(struct berval), i + 1, memctx );
nvals = slap_sl_calloc( sizeof(struct berval), i + 1, memctx );
for ( i = 0; vals[i].bv_val; i++ ) {
rc = (*desc->ad_type->sat_equality->smr_normalize)(
SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
@ -275,7 +275,7 @@ attr_merge_normalize_one(
rc = attr_merge_one( e, desc, val, nvalp );
if ( nvalp != NULL ) {
sl_free( nval.bv_val, memctx );
slap_sl_free( nval.bv_val, memctx );
}
return rc;
}

View file

@ -330,7 +330,7 @@ bdb_abandon( Operation *op, SlapReply *rs )
ps = bdb_drop_psearch( op, op->oq_abandon.rs_msgid );
if ( ps ) {
if ( ps->o_tmpmemctx ) {
sl_mem_destroy( NULL, ps->o_tmpmemctx );
slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
}
slap_op_free ( ps );
return LDAP_SUCCESS;
@ -348,7 +348,7 @@ bdb_cancel( Operation *op, SlapReply *rs )
rs->sr_err = LDAP_CANCELLED;
send_ldap_result( ps, rs );
if ( ps->o_tmpmemctx ) {
sl_mem_destroy( NULL, ps->o_tmpmemctx );
slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
}
slap_op_free ( ps );
return LDAP_SUCCESS;
@ -1192,9 +1192,9 @@ id2entry_retry:
rs->sr_flags = 0;
result = send_search_entry( sop, rs );
if ( cookie.bv_val ) ch_free( cookie.bv_val );
sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
slap_sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
sop->o_tmpmemctx );
sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
slap_sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
ctrls[num_ctrls] = NULL;
rs->sr_ctrls = NULL;
}
@ -1228,9 +1228,9 @@ id2entry_retry:
rs->sr_attrs = sop->oq_search.rs_attrs;
rs->sr_flags = 0;
result = send_search_entry( sop, rs );
sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
slap_sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
sop->o_tmpmemctx );
sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
slap_sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
ctrls[num_ctrls] = NULL;
rs->sr_ctrls = NULL;
} else { /* PRESENT */
@ -1414,10 +1414,10 @@ nochange:
rs->sr_rspoid = NULL;
send_ldap_result( sop, rs );
if ( ctrls[num_ctrls-1]->ldctl_value.bv_val != NULL ) {
sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
slap_sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
sop->o_tmpmemctx );
}
sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
slap_sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
ctrls[num_ctrls] = NULL;
if ( cookie.bv_val ) ch_free( cookie.bv_val );
}

View file

@ -715,11 +715,11 @@ cleanup:
op->o_conn->c_sasl_bindop = NULL;
if( op->o_req_dn.bv_val != NULL ) {
sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
op->o_req_dn.bv_val = NULL;
}
if( op->o_req_ndn.bv_val != NULL ) {
sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
op->o_req_ndn.bv_val = NULL;
}

View file

@ -82,9 +82,9 @@ ch_realloc(
ch_free( block );
}
ctx = sl_context( block );
ctx = slap_sl_context( block );
if ( ctx ) {
return sl_realloc( block, size, ctx );
return slap_sl_realloc( block, size, ctx );
}
if ( (new = (void *) ber_memrealloc_x( block, size, NULL )) == NULL ) {
@ -152,9 +152,9 @@ ch_free( void *ptr )
{
void *ctx;
ctx = sl_context( ptr );
ctx = slap_sl_context( ptr );
if (ctx) {
sl_free( ptr, ctx );
slap_sl_free( ptr, ctx );
} else {
ber_memfree_x( ptr, NULL );
}

View file

@ -986,13 +986,13 @@ connection_operation( void *ctx, void *arg_v )
*/
#if 0
memsiz = ber_len( op->o_ber ) * 64;
if ( SLMALLOC_SLAB_SIZE > memsiz ) memsiz = SLMALLOC_SLAB_SIZE;
if ( SLAP_SLAB_SIZE > memsiz ) memsiz = SLAP_SLAB_SIZE;
#endif
memsiz = SLMALLOC_SLAB_SIZE;
memsiz = SLAP_SLAB_SIZE;
memctx = sl_mem_create( memsiz, ctx );
memctx = slap_sl_mem_create( memsiz, ctx );
op->o_tmpmemctx = memctx;
op->o_tmpmfuncs = &sl_mfuncs;
op->o_tmpmfuncs = &slap_sl_mfuncs;
if ( tag != LDAP_REQ_ADD && tag != LDAP_REQ_MODIFY ) {
/* Note - the ber and its buffer are already allocated from
* regular memory; this only affects subsequent mallocs that
@ -1129,9 +1129,9 @@ operations_error:
if ( op->o_cancel != SLAP_CANCEL_ACK &&
( op->o_sync_mode & SLAP_SYNC_PERSIST ) ) {
sl_mem_detach( ctx, memctx );
slap_sl_mem_detach( ctx, memctx );
} else if (( op->o_sync_slog_size != -1 )) {
sl_mem_detach( ctx, memctx );
slap_sl_mem_detach( ctx, memctx );
LDAP_STAILQ_REMOVE( &conn->c_ops, op, slap_op, o_next);
LDAP_STAILQ_NEXT(op, o_next) = NULL;
conn->c_n_ops_executing--;
@ -1873,8 +1873,8 @@ connection_fake_init(
conn->c_peer_name = slap_empty_bv;
/* set memory context */
op->o_tmpmemctx = sl_mem_create( SLMALLOC_SLAB_SIZE, ctx );
op->o_tmpmfuncs = &sl_mfuncs;
op->o_tmpmemctx = slap_sl_mem_create( SLAP_SLAB_SIZE, ctx );
op->o_tmpmfuncs = &slap_sl_mfuncs;
op->o_threadctx = ctx;
op->o_conn = conn;

View file

@ -849,7 +849,7 @@ build_new_dn( struct berval * new_dn,
}
new_dn->bv_len = parent_dn->bv_len + newrdn->bv_len + 1;
new_dn->bv_val = (char *) sl_malloc( new_dn->bv_len + 1, memctx );
new_dn->bv_val = (char *) slap_sl_malloc( new_dn->bv_len + 1, memctx );
ptr = lutil_strcopy( new_dn->bv_val, newrdn->bv_val );
*ptr++ = ',';

View file

@ -527,7 +527,7 @@ get_ssa(
|| ssa.sa_any != NULL
|| ssa.sa_final.bv_val != NULL )
{
sl_free( nvalue.bv_val, op->o_tmpmemctx );
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx );
goto return_error;
}
@ -544,7 +544,7 @@ get_ssa(
#endif
if ( ssa.sa_final.bv_val != NULL ) {
sl_free( nvalue.bv_val, op->o_tmpmemctx );
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx );
goto return_error;
}
@ -561,7 +561,7 @@ get_ssa(
#endif
if ( ssa.sa_final.bv_val != NULL ) {
sl_free( nvalue.bv_val, op->o_tmpmemctx );
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx );
goto return_error;
}
@ -580,7 +580,7 @@ get_ssa(
#endif
assert( 0 );
sl_free( nvalue.bv_val, op->o_tmpmemctx );
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx );
return_error:
#ifdef NEW_LOGGING
@ -591,9 +591,9 @@ return_error:
Debug( LDAP_DEBUG_FILTER, " error=%ld\n",
(long) rc, 0, 0 );
#endif
sl_free( ssa.sa_initial.bv_val, op->o_tmpmemctx );
slap_sl_free( ssa.sa_initial.bv_val, op->o_tmpmemctx );
ber_bvarray_free_x( ssa.sa_any, op->o_tmpmemctx );
sl_free( ssa.sa_final.bv_val, op->o_tmpmemctx );
slap_sl_free( ssa.sa_final.bv_val, op->o_tmpmemctx );
return rc;
}
@ -681,8 +681,8 @@ filter_free( Filter *f )
{
Operation op;
op.o_tmpmemctx = sl_context( f );
op.o_tmpmfuncs = &sl_mfuncs;
op.o_tmpmemctx = slap_sl_context( f );
op.o_tmpmfuncs = &slap_sl_mfuncs;
filter_free_x( &op, f );
}
@ -927,7 +927,7 @@ filter_escape_value_x(
assert( out );
i = in->bv_len * 3 + 1;
out->bv_val = ctx ? sl_malloc( i, ctx ) : ch_malloc( i );
out->bv_val = ctx ? slap_sl_malloc( i, ctx ) : ch_malloc( i );
out->bv_len = 0;
for( i=0; i < in->bv_len ; i++ ) {

View file

@ -59,7 +59,7 @@ slap_build_sync_state_ctrl(
ber_init2( ber, 0, LBER_USE_DER );
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
ctrls[num_ctrls] = sl_malloc ( sizeof ( LDAPControl ), op->o_tmpmemctx );
ctrls[num_ctrls] = slap_sl_malloc ( sizeof ( LDAPControl ), op->o_tmpmemctx );
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
AttributeDescription *desc = a->a_desc;

View file

@ -208,7 +208,7 @@ int main( int argc, char **argv )
char *serverNamePrefix = "";
size_t l;
sl_mem_init();
slap_sl_mem_init();
serverName = lutil_progname( "slapd", argc, argv );

View file

@ -93,7 +93,7 @@ slap_op_free( Operation *op )
GroupAssertion *g, *n;
for (g = op->o_groups; g; g=n) {
n = g->ga_next;
sl_free(g, op->o_tmpmemctx);
slap_sl_free(g, op->o_tmpmemctx);
}
op->o_groups = NULL;
}

View file

@ -1097,16 +1097,22 @@ LDAP_SLAPD_F (int) slap_add_session_log LDAP_P((
/*
* sl_malloc.c
*/
LDAP_SLAPD_V (BerMemoryFunctions) sl_mfuncs;
LDAP_SLAPD_F (void *) sl_malloc LDAP_P(( ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void *) sl_realloc LDAP_P(( void *block, ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void *) sl_calloc LDAP_P(( ber_len_t nelem, ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void) sl_free LDAP_P(( void *, void *ctx ));
LDAP_SLAPD_F (void) sl_mem_init LDAP_P(( void ));
LDAP_SLAPD_F (void *) sl_mem_create LDAP_P(( ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void) sl_mem_detach LDAP_P(( void *ctx, void *memctx ));
LDAP_SLAPD_F (void) sl_mem_destroy LDAP_P(( void *key, void *data ));
LDAP_SLAPD_F (void *) sl_context LDAP_P(( void *ptr ));
LDAP_SLAPD_F (void *) slap_sl_malloc LDAP_P((
ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void *) slap_sl_realloc LDAP_P((
void *block, ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void *) slap_sl_calloc LDAP_P((
ber_len_t nelem, ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void) slap_sl_free LDAP_P((
void *, void *ctx ));
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, void *ctx ));
LDAP_SLAPD_F (void) slap_sl_mem_detach 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 ));
/*
* starttls.c

View file

@ -858,15 +858,15 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
size = i * sizeof(char *) + k;
if ( size > 0 ) {
char *a_flags;
e_flags = sl_calloc ( 1, i * sizeof(char *) + k, op->o_tmpmemctx );
e_flags = slap_sl_calloc ( 1, i * sizeof(char *) + k, op->o_tmpmemctx );
if( e_flags == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"send_search_entry: conn %lu sl_calloc failed\n",
"send_search_entry: conn %lu slap_sl_calloc failed\n",
op->o_connid ? op->o_connid : 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"send_search_entry: sl_calloc failed\n", 0, 0, 0 );
"send_search_entry: slap_sl_calloc failed\n", 0, 0, 0 );
#endif
ber_free( ber, 1 );
@ -1049,7 +1049,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
* Reuse previous memory - we likely need less space
* for operational attributes
*/
tmp = sl_realloc( e_flags, i * sizeof(char *) + k,
tmp = slap_sl_realloc( e_flags, i * sizeof(char *) + k,
op->o_tmpmemctx );
if ( tmp == NULL ) {
#ifdef NEW_LOGGING
@ -1255,7 +1255,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
/* free e_flags */
if ( e_flags ) {
sl_free( e_flags, op->o_tmpmemctx );
slap_sl_free( e_flags, op->o_tmpmemctx );
e_flags = NULL;
}
@ -1349,7 +1349,7 @@ error_return:;
rs->sr_flags &= ~REP_ENTRY_MUSTBEFREED;
}
if ( e_flags ) sl_free( e_flags, op->o_tmpmemctx );
if ( e_flags ) slap_sl_free( e_flags, op->o_tmpmemctx );
if (op->o_callback) {
slap_callback *sc = op->o_callback;
@ -1664,7 +1664,7 @@ int slap_read_controls(
c.ldctl_oid = oid->bv_val;
c.ldctl_iscritical = 0;
*ctrl = sl_calloc( 1, sizeof(LDAPControl), NULL );
*ctrl = slap_sl_calloc( 1, sizeof(LDAPControl), NULL );
**ctrl = c;
return LDAP_SUCCESS;
}

View file

@ -1815,7 +1815,7 @@ int slap_sasl_getdn( Connection *conn, Operation *op, struct berval *id,
}
/* Build the new dn */
dn->bv_val = sl_malloc( len + 1, op->o_tmpmemctx );
dn->bv_val = slap_sl_malloc( len + 1, op->o_tmpmemctx );
if( dn->bv_val == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( TRANSPORT, ERR,
@ -1861,7 +1861,7 @@ int slap_sasl_getdn( Connection *conn, Operation *op, struct berval *id,
rc = dnNormalize( 0, NULL, NULL, dn, &dn2, op->o_tmpmemctx );
/* User DNs were constructed above and must be freed now */
sl_free( dn->bv_val, op->o_tmpmemctx );
slap_sl_free( dn->bv_val, op->o_tmpmemctx );
if ( rc != LDAP_SUCCESS ) {
BER_BVZERO( dn );
@ -1873,7 +1873,7 @@ int slap_sasl_getdn( Connection *conn, Operation *op, struct berval *id,
/* Run thru regexp */
slap_sasl2dn( op, dn, &dn2, flags );
if( !BER_BVISNULL( &dn2 ) ) {
sl_free( dn->bv_val, op->o_tmpmemctx );
slap_sl_free( dn->bv_val, op->o_tmpmemctx );
*dn = dn2;
#ifdef NEW_LOGGING
LDAP_LOG( TRANSPORT, ENTRY,

View file

@ -562,7 +562,7 @@ static void slap_sasl_rx_exp(
len += str[i].rm_eo - str[i].rm_so;
n++;
}
out->bv_val = sl_malloc( len + 1, ctx );
out->bv_val = slap_sl_malloc( len + 1, ctx );
out->bv_len = len;
/* Fill in URI with replace string, replacing $i as we go */
@ -902,7 +902,7 @@ exact_match:
CONCLUDED:
if( op.o_req_dn.bv_len ) ch_free( op.o_req_dn.bv_val );
if( op.o_req_ndn.bv_len ) sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
if( op.o_req_ndn.bv_len ) slap_sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
if( op.oq_search.rs_filter ) filter_free_x( opx, op.oq_search.rs_filter );
if( op.ors_filterstr.bv_len ) ch_free( op.ors_filterstr.bv_val );
@ -1014,7 +1014,7 @@ void slap_sasl2dn( Operation *opx,
rc = slap_parseURI( opx, &regout, &op.o_req_dn,
&op.o_req_ndn, &op.oq_search.rs_scope, &op.oq_search.rs_filter,
&op.ors_filterstr );
if ( !BER_BVISNULL( &regout ) ) sl_free( regout.bv_val, opx->o_tmpmemctx );
if ( !BER_BVISNULL( &regout ) ) slap_sl_free( regout.bv_val, opx->o_tmpmemctx );
if ( rc != LDAP_SUCCESS ) {
goto FINISHED;
}
@ -1093,8 +1093,8 @@ FINISHED:
if( !BER_BVISEMPTY( sasldn ) ) {
opx->o_conn->c_authz_backend = op.o_bd;
}
if( !BER_BVISNULL( &op.o_req_dn ) ) sl_free( op.o_req_dn.bv_val, opx->o_tmpmemctx );
if( !BER_BVISNULL( &op.o_req_ndn ) ) sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
if( !BER_BVISNULL( &op.o_req_dn ) ) slap_sl_free( op.o_req_dn.bv_val, opx->o_tmpmemctx );
if( !BER_BVISNULL( &op.o_req_ndn ) ) slap_sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
if( op.oq_search.rs_filter ) filter_free_x( opx, op.oq_search.rs_filter );
if( !BER_BVISNULL( &op.ors_filterstr ) ) ch_free( op.ors_filterstr.bv_val );

View file

@ -177,7 +177,7 @@ int octetStringIndexer(
/* we should have at least one value at this point */
assert( i > 0 );
keys = sl_malloc( sizeof( struct berval ) * (i+1), ctx );
keys = slap_sl_malloc( sizeof( struct berval ) * (i+1), ctx );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
@ -231,7 +231,7 @@ int octetStringFilter(
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
keys = sl_malloc( sizeof( struct berval ) * 2, ctx );
keys = slap_sl_malloc( sizeof( struct berval ) * 2, ctx );
HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
@ -440,7 +440,7 @@ octetStringSubstringsIndexer(
return LDAP_SUCCESS;
}
keys = sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
keys = slap_sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
@ -597,7 +597,7 @@ octetStringSubstringsFilter (
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
keys = sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
keys = slap_sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
nkeys = 0;
if( flags & SLAP_INDEX_SUBSTR_INITIAL && sa->sa_initial.bv_val != NULL &&
@ -823,7 +823,7 @@ nameUIDPretty(
if( rc != LDAP_SUCCESS ) return rc;
if( uidval.bv_val ) {
char *tmp = sl_realloc( out->bv_val, out->bv_len + uidval.bv_len + 2, ctx );
char *tmp = slap_sl_realloc( out->bv_val, out->bv_len + uidval.bv_len + 2, ctx );
int i, c, got1;
if( tmp == NULL ) {
ber_memfree_x( out->bv_val, ctx );
@ -1482,7 +1482,7 @@ telephoneNumberNormalize(
/* validator should have refused an empty string */
assert( val->bv_len );
q = normalized->bv_val = sl_malloc( val->bv_len + 1, ctx );
q = normalized->bv_val = slap_sl_malloc( val->bv_len + 1, ctx );
for( p = val->bv_val; *p; p++ ) {
if ( ! ( ASCII_SPACE( *p ) || *p == '-' )) {
@ -1494,7 +1494,7 @@ telephoneNumberNormalize(
normalized->bv_len = q - normalized->bv_val;
if( normalized->bv_len == 0 ) {
sl_free( normalized->bv_val, ctx );
slap_sl_free( normalized->bv_val, ctx );
normalized->bv_val = NULL;
return LDAP_INVALID_SYNTAX;
}
@ -1771,7 +1771,7 @@ IA5StringNormalize(
normalized->bv_len = q - normalized->bv_val;
if( normalized->bv_len == 0 ) {
normalized->bv_val = sl_realloc( normalized->bv_val, 2, ctx );
normalized->bv_val = slap_sl_realloc( normalized->bv_val, 2, ctx );
normalized->bv_val[0] = ' ';
normalized->bv_val[1] = '\0';
normalized->bv_len = 1;
@ -1824,7 +1824,7 @@ UUIDNormalize(
int i;
int j;
normalized->bv_len = 16;
normalized->bv_val = sl_malloc( normalized->bv_len+1, ctx );
normalized->bv_val = slap_sl_malloc( normalized->bv_len+1, ctx );
for( i=0, j=0; i<36; i++ ) {
unsigned char nibble;
@ -1841,7 +1841,7 @@ UUIDNormalize(
nibble = val->bv_val[i] - ('A'-10);
} else {
sl_free( normalized->bv_val, ctx );
slap_sl_free( normalized->bv_val, ctx );
return LDAP_INVALID_SYNTAX;
}
@ -1892,7 +1892,7 @@ numericStringNormalize(
assert( val->bv_len );
normalized->bv_val = sl_malloc( val->bv_len + 1, ctx );
normalized->bv_val = slap_sl_malloc( val->bv_len + 1, ctx );
p = val->bv_val;
q = normalized->bv_val;
@ -1915,7 +1915,7 @@ numericStringNormalize(
normalized->bv_len = q - normalized->bv_val;
if( normalized->bv_len == 0 ) {
normalized->bv_val = sl_realloc( normalized->bv_val, 2, ctx );
normalized->bv_val = slap_sl_realloc( normalized->bv_val, 2, ctx );
normalized->bv_val[0] = ' ';
normalized->bv_val[1] = '\0';
normalized->bv_len = 1;
@ -2083,10 +2083,10 @@ serialNumberAndIssuerPretty(
/* make room from sn + "$" */
out->bv_len = sn.bv_len + newi.bv_len + 1;
out->bv_val = sl_realloc( newi.bv_val, out->bv_len + 1, ctx );
out->bv_val = slap_sl_realloc( newi.bv_val, out->bv_len + 1, ctx );
if( out->bv_val == NULL ) {
sl_free( newi.bv_val, ctx );
slap_sl_free( newi.bv_val, ctx );
return LDAP_OTHER;
}
@ -2170,10 +2170,10 @@ serialNumberAndIssuerNormalize(
/* make room from sn + "$" */
out->bv_len = sn.bv_len + newi.bv_len + 1;
out->bv_val = sl_realloc( newi.bv_val, out->bv_len + 1, ctx );
out->bv_val = slap_sl_realloc( newi.bv_val, out->bv_len + 1, ctx );
if( out->bv_val == NULL ) {
sl_free( newi.bv_val, ctx );
slap_sl_free( newi.bv_val, ctx );
return LDAP_OTHER;
}
@ -2516,7 +2516,7 @@ generalizedTimeNormalize(
}
len = sizeof("YYYYmmddHHMMSSZ")-1 + fraction.bv_len;
normalized->bv_val = sl_malloc( len + 1, ctx );
normalized->bv_val = slap_sl_malloc( len + 1, ctx );
if ( normalized->bv_val == NULL ) {
return LBER_ERROR_MEMORY;
}

View file

@ -115,7 +115,7 @@ static int objectSubClassIndexer(
}
/* over allocate */
ocvalues = sl_malloc( sizeof( struct berval ) * (noc+16), ctx );
ocvalues = slap_sl_malloc( sizeof( struct berval ) * (noc+16), ctx );
/* copy listed values (and termination) */
for( i=0; i<noc; i++ ) {
@ -149,7 +149,7 @@ static int objectSubClassIndexer(
}
if( !found ) {
ocvalues = sl_realloc( ocvalues,
ocvalues = slap_sl_realloc( ocvalues,
sizeof( struct berval ) * (noc+2), ctx );
assert( k == noc );
@ -170,7 +170,7 @@ static int objectSubClassIndexer(
rc = octetStringIndexer( use, mask, syntax, mr,
prefix, ocvalues, keysp, ctx );
sl_free( ocvalues, ctx );
slap_sl_free( ocvalues, ctx );
return rc;
}

View file

@ -335,8 +335,8 @@ do_search(
}
if( !op->o_req_ndn.bv_len && default_search_nbase.bv_len ) {
sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
ber_dupbv_x( &op->o_req_dn, &default_search_base, op->o_tmpmemctx );
ber_dupbv_x( &op->o_req_ndn, &default_search_nbase, op->o_tmpmemctx );
@ -419,8 +419,8 @@ return_results:;
if ( ( op->o_sync_slog_size != -1 ) )
return rs->sr_err;
if( op->o_req_dn.bv_val != NULL) sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
if( op->o_req_ndn.bv_val != NULL) sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
if( op->o_req_dn.bv_val != NULL) slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
if( op->o_req_ndn.bv_val != NULL) slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
if( op->ors_filterstr.bv_val != NULL) op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
if( op->ors_filter != NULL) filter_free_x( op, op->ors_filter );
@ -520,7 +520,7 @@ static int call_search_rewrite_plugins( Operation *op )
op->o_req_dn.bv_len = strlen( op->o_req_dn.bv_val );
if( op->o_req_ndn.bv_val != NULL) {
sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
}
rc = dnNormalize( 0, NULL, NULL, &op->o_req_dn, &op->o_req_ndn,
op->o_tmpmemctx );

View file

@ -89,8 +89,8 @@ slap_send_session_log(
rs->sr_ctrls = ctrls;
rs->sr_flags = 0;
result = send_search_entry( op, rs );
sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val, op->o_tmpmemctx );
sl_free( ctrls[--num_ctrls], op->o_tmpmemctx );
slap_sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val, op->o_tmpmemctx );
slap_sl_free( ctrls[--num_ctrls], op->o_tmpmemctx );
ctrls[num_ctrls] = NULL;
rs->sr_ctrls = NULL;
}

View file

@ -28,7 +28,7 @@ struct slab_heap {
};
void
sl_mem_destroy(
slap_sl_mem_destroy(
void *key,
void *data
)
@ -39,23 +39,17 @@ sl_mem_destroy(
ber_memfree_x(sh, NULL);
}
BER_MEMALLOC_FN sl_malloc;
BER_MEMCALLOC_FN sl_calloc;
BER_MEMREALLOC_FN sl_realloc;
BER_MEMFREE_FN sl_free;
BerMemoryFunctions sl_mfuncs =
{ sl_malloc, sl_calloc, sl_realloc, sl_free };
BerMemoryFunctions slap_sl_mfuncs =
{ slap_sl_malloc, slap_sl_calloc, slap_sl_realloc, slap_sl_free };
void
sl_mem_init()
slap_sl_mem_init()
{
ber_set_option( NULL, LBER_OPT_MEMORY_FNS, &sl_mfuncs );
ber_set_option( NULL, LBER_OPT_MEMORY_FNS, &slap_sl_mfuncs );
}
void *
sl_mem_create(
slap_sl_mem_create(
ber_len_t size,
void *ctx
)
@ -63,7 +57,7 @@ sl_mem_create(
struct slab_heap *sh = NULL;
int pad = 2*sizeof(int)-1;
ldap_pvt_thread_pool_getkey( ctx, (void *)sl_mem_init, (void **)&sh, NULL );
ldap_pvt_thread_pool_getkey( ctx, (void *)slap_sl_mem_init, (void **)&sh, NULL );
/* round up to doubleword boundary */
size += pad;
@ -72,7 +66,8 @@ sl_mem_create(
if (!sh) {
sh = ch_malloc( sizeof(struct slab_heap) );
sh->h_base = ch_malloc( size );
ldap_pvt_thread_pool_setkey( ctx, (void *)sl_mem_init, (void *)sh, sl_mem_destroy );
ldap_pvt_thread_pool_setkey( ctx, (void *)slap_sl_mem_init,
(void *)sh, slap_sl_mem_destroy );
} else if ( size > (char *) sh->h_end - (char *) sh->h_base ) {
sh->h_base = ch_realloc( sh->h_base, size );
}
@ -82,17 +77,17 @@ sl_mem_create(
}
void
sl_mem_detach(
slap_sl_mem_detach(
void *ctx,
void *memctx
)
{
/* separate from context */
ldap_pvt_thread_pool_setkey( ctx, (void *)sl_mem_init, NULL, NULL );
ldap_pvt_thread_pool_setkey( ctx, (void *)slap_sl_mem_init, NULL, NULL );
}
void *
sl_malloc(
slap_sl_malloc(
ber_len_t size,
void *ctx
)
@ -111,10 +106,12 @@ sl_malloc(
if ((char *) sh->h_last + size >= (char *) sh->h_end ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO,
"sl_malloc of %lu bytes failed, using ch_malloc\n", (long)size, 0,0 );
"slap_sl_malloc of %lu bytes failed, using ch_malloc\n",
(long)size, 0,0 );
#else
Debug( LDAP_DEBUG_TRACE,
"sl_malloc of %lu bytes failed, using ch_malloc\n", (long)size, 0,0 );
"slap_sl_malloc of %lu bytes failed, using ch_malloc\n",
(long)size, 0,0 );
#endif
return ch_malloc( size );
}
@ -126,11 +123,11 @@ sl_malloc(
}
void *
sl_calloc( ber_len_t n, ber_len_t size, void *ctx )
slap_sl_calloc( ber_len_t n, ber_len_t size, void *ctx )
{
void *new;
new = sl_malloc( n*size, ctx );
new = slap_sl_malloc( n*size, ctx );
if ( new ) {
memset( new, 0, n*size );
}
@ -138,14 +135,14 @@ sl_calloc( ber_len_t n, ber_len_t size, void *ctx )
}
void *
sl_realloc( void *ptr, ber_len_t size, void *ctx )
slap_sl_realloc( void *ptr, ber_len_t size, void *ctx )
{
struct slab_heap *sh = ctx;
int pad = 2*sizeof(int)-1;
ber_len_t *p = (ber_len_t *)ptr;
ber_len_t *new;
if ( ptr == NULL ) return sl_malloc( size, ctx );
if ( ptr == NULL ) return slap_sl_malloc( size, ctx );
/* Not our memory? */
if ( !sh || ptr < sh->h_base || ptr >= sh->h_end ) {
@ -156,7 +153,7 @@ sl_realloc( void *ptr, ber_len_t size, void *ctx )
}
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"ch_realloc: reallocation of %lu bytes failed\n", (long)size, 0,0 );
"ch_realloc: reallocation of %lu bytes failed\n", (long)size, 0,0 );
#else
Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
(long) size, 0, 0 );
@ -166,7 +163,7 @@ sl_realloc( void *ptr, ber_len_t size, void *ctx )
}
if ( size == 0 ) {
sl_free( ptr, ctx );
slap_sl_free( ptr, ctx );
return NULL;
}
@ -186,14 +183,14 @@ sl_realloc( void *ptr, ber_len_t size, void *ctx )
/* Nowhere to grow, need to alloc and copy */
} else {
new = sl_malloc( size, ctx );
new = slap_sl_malloc( size, ctx );
AC_MEMCPY( new, ptr, p[-1] );
}
return new;
}
void
sl_free( void *ptr, void *ctx )
slap_sl_free( void *ptr, void *ctx )
{
struct slab_heap *sh = ctx;
ber_len_t *p = (ber_len_t *)ptr;
@ -207,14 +204,14 @@ sl_free( void *ptr, void *ctx )
}
void *
sl_context( void *ptr )
slap_sl_context( void *ptr )
{
struct slab_heap *sh = NULL;
void *ctx;
ctx = ldap_pvt_thread_pool_context();
ldap_pvt_thread_pool_getkey( ctx, (void *)sl_mem_init, (void **)&sh, NULL );
ldap_pvt_thread_pool_getkey( ctx, (void *)slap_sl_mem_init, (void **)&sh, NULL );
if ( sh && ptr >= sh->h_base && ptr <= sh->h_end ) {
return sh;

View file

@ -2360,7 +2360,7 @@ typedef int (SLAP_CTRL_PARSE_FN) LDAP_P((
SlapReply *rs,
LDAPControl *ctrl ));
#define SLMALLOC_SLAB_SIZE (1024*1024)
#define SLAP_SLAB_SIZE (1024*1024)
#if defined(LDAP_DEVEL) && defined(ENABLE_REWRITE)
/* use librewrite for sasl-regexp */

View file

@ -963,8 +963,8 @@ syncrepl_message_to_entry(
dnPrettyNormal( NULL, &bdn, &dn, &ndn, op->o_tmpmemctx );
ber_dupbv( &op->o_req_dn, &dn );
ber_dupbv( &op->o_req_ndn, &ndn );
sl_free( ndn.bv_val, op->o_tmpmemctx );
sl_free( dn.bv_val, op->o_tmpmemctx );
slap_sl_free( ndn.bv_val, op->o_tmpmemctx );
slap_sl_free( dn.bv_val, op->o_tmpmemctx );
if ( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_DELETE ) {
return LDAP_SUCCESS;
@ -1091,7 +1091,7 @@ syncrepl_entry(
op->ors_filter = &f;
op->ors_filterstr.bv_len = (sizeof("entryUUID=")-1) + syncUUID->bv_len;
op->ors_filterstr.bv_val = (char *) sl_malloc(
op->ors_filterstr.bv_val = (char *) slap_sl_malloc(
op->ors_filterstr.bv_len + 1, op->o_tmpmemctx );
AC_MEMCPY( op->ors_filterstr.bv_val, "entryUUID=", sizeof("entryUUID=")-1 );
AC_MEMCPY( &op->ors_filterstr.bv_val[sizeof("entryUUID=")-1],
@ -1117,7 +1117,7 @@ syncrepl_entry(
}
if ( op->ors_filterstr.bv_val ) {
sl_free( op->ors_filterstr.bv_val, op->o_tmpmemctx );
slap_sl_free( op->ors_filterstr.bv_val, op->o_tmpmemctx );
}
cb.sc_response = null_callback;
@ -1693,7 +1693,7 @@ syncrepl_updateCookie(
ber_dupbv( &e->e_nname, &slap_syncrepl_dn_bv );
if ( slap_syncrepl_dn_bv.bv_val ) {
sl_free( slap_syncrepl_dn_bv.bv_val, op->o_tmpmemctx );
slap_sl_free( slap_syncrepl_dn_bv.bv_val, op->o_tmpmemctx );
}
e->e_attrs = NULL;
@ -1960,13 +1960,13 @@ slap_uuidstr_from_normalized(
if ( uuidstr ) {
new = uuidstr;
} else {
new = (struct berval *)sl_malloc( sizeof(struct berval), ctx );
new = (struct berval *)slap_sl_malloc( sizeof(struct berval), ctx );
}
new->bv_len = 36;
if (( new->bv_val = sl_malloc( new->bv_len + 1, ctx )) == NULL) {
if ( !uuidstr ) sl_free( new, ctx );
if (( new->bv_val = slap_sl_malloc( new->bv_len + 1, ctx )) == NULL) {
if ( !uuidstr ) slap_sl_free( new, ctx );
return NULL;
}

View file

@ -274,11 +274,11 @@ int value_find_ex(
&vals[i], nval.bv_val == NULL ? val : &nval, &text );
if( rc == LDAP_SUCCESS && match == 0 ) {
sl_free( nval.bv_val, ctx );
slap_sl_free( nval.bv_val, ctx );
return rc;
}
}
sl_free( nval.bv_val, ctx );
slap_sl_free( nval.bv_val, ctx );
return LDAP_NO_SUCH_ATTRIBUTE;
}