};
static Avlnode *attr_index = NULL;
+static Avlnode *attr_cache = NULL;
static LDAP_SLIST_HEAD(ATList, slap_attribute_type) attr_list
= LDAP_SLIST_HEAD_INITIALIZER(&attr_list);
+int at_oc_cache;
+
static int
attr_index_cmp(
const void *v_air1,
{
struct aindexrec *air;
+ if ( attr_cache ) {
+ air = avl_find( attr_cache, name, attr_index_name_cmp );
+ if ( air ) return air->air_at;
+ }
+
air = avl_find( attr_index, name, attr_index_name_cmp );
+ if ( air && ( slapMode & SLAP_TOOL_MODE ) && at_oc_cache ) {
+ avl_insert( &attr_cache, (caddr_t) air,
+ attr_index_cmp, avl_dup_error );
+ }
+
return air != NULL ? air->air_at : NULL;
}
Attribute **a;
for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
- if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) {
+ if ( (*a)->a_desc == desc ) {
break;
}
}
Attribute **a;
for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
- if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) {
+ if ( (*a)->a_desc == desc ) {
break;
}
}
AttributeDescription *desc )
{
for ( ; a != NULL; a = a->a_next ) {
- if ( ad_cmp( a->a_desc, desc ) == 0 ) {
+ if ( a->a_desc == desc ) {
return( a );
}
}
Attribute **a;
for ( a = attrs; *a != NULL; a = &(*a)->a_next ) {
- if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) {
+ if ( (*a)->a_desc == desc ) {
Attribute *save = *a;
*a = (*a)->a_next;
attr_free( save );
};
static Avlnode *oc_index = NULL;
+static Avlnode *oc_cache = NULL;
static LDAP_SLIST_HEAD(OCList, slap_object_class) oc_list
= LDAP_SLIST_HEAD_INITIALIZER(&oc_list);
{
struct oindexrec *oir;
+ if ( oc_cache ) {
+ oir = avl_find( oc_cache, ocname, oc_index_name_cmp );
+ if ( oir ) return oir->oir_oc;
+ }
oir = avl_find( oc_index, ocname, oc_index_name_cmp );
if ( oir != NULL ) {
+ if ( at_oc_cache ) {
+ avl_insert( &oc_cache, (caddr_t) oir,
+ oc_index_cmp, avl_dup_error );
+ }
return( oir->oir_oc );
}
/*
* at.c
*/
+LDAP_SLAPD_V(int) at_oc_cache;
LDAP_SLAPD_F (void) at_config LDAP_P((
const char *fname, int lineno,
int argc, char **argv ));
exit( EXIT_FAILURE );
}
+ at_oc_cache = 1;
ldap_syslog = 0;
switch ( tool ) {