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);
}
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);
}
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,
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;
}
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;
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;
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;
}
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 */
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 );
}
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;
}
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 ) {
{
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 );
}
*/
#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
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--;
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;
}
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++ = ',';
|| 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;
}
#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;
}
#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;
}
#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
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;
}
{
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 );
}
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++ ) {
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;
char *serverNamePrefix = "";
size_t l;
- sl_mem_init();
+ slap_sl_mem_init();
serverName = lutil_progname( "slapd", argc, argv );
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;
}
/*
* 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
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 );
* 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
/* free e_flags */
if ( e_flags ) {
- sl_free( e_flags, op->o_tmpmemctx );
+ slap_sl_free( e_flags, op->o_tmpmemctx );
e_flags = NULL;
}
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;
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;
}
}
/* 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,
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 );
/* 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,
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 */
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 );
rc = slap_parseURI( opx, ®out, &op.o_req_dn,
&op.o_req_ndn, &op.oq_search.rs_scope, &op.oq_search.rs_filter,
&op.ors_filterstr );
- if ( !BER_BVISNULL( ®out ) ) sl_free( regout.bv_val, opx->o_tmpmemctx );
+ if ( !BER_BVISNULL( ®out ) ) slap_sl_free( regout.bv_val, opx->o_tmpmemctx );
if ( rc != LDAP_SUCCESS ) {
goto 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 );
/* 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;
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 ) {
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;
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 &&
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 );
/* 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 == '-' )) {
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;
}
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;
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;
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;
}
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;
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;
/* 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;
}
/* 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;
}
}
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;
}
}
/* 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++ ) {
}
if( !found ) {
- ocvalues = sl_realloc( ocvalues,
+ ocvalues = slap_sl_realloc( ocvalues,
sizeof( struct berval ) * (noc+2), ctx );
assert( k == noc );
rc = octetStringIndexer( use, mask, syntax, mr,
prefix, ocvalues, keysp, ctx );
- sl_free( ocvalues, ctx );
+ slap_sl_free( ocvalues, ctx );
return rc;
}
}
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 );
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 );
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 );
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;
}
};
void
-sl_mem_destroy(
+slap_sl_mem_destroy(
void *key,
void *data
)
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
)
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;
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 );
}
}
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
)
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 );
}
}
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 );
}
}
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 ) {
}
#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 );
}
if ( size == 0 ) {
- sl_free( ptr, ctx );
+ slap_sl_free( ptr, ctx );
return NULL;
}
/* 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;
}
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;
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 */
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;
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],
}
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;
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;
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;
}
&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;
}