/* idl.c - ldap id list handling routines */
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
#include "portable.h"
#define IDL_CMP(x,y) ( x < y ? -1 : ( x > y ? 1 : 0 ) )
-#ifdef SLAP_IDL_CACHE
#define IDL_LRU_DELETE( bdb, e ) do { \
if ( e->idl_lru_prev != NULL ) { \
e->idl_lru_prev->idl_lru_next = e->idl_lru_next; \
const bdb_idl_cache_entry_t *idl1 = v_idl1, *idl2 = v_idl2;
int rc;
- if ((rc = idl1->db - idl2->db )) return rc;
+ if ((rc = SLAP_PTRCMP( idl1->db, idl2->db ))) return rc;
if ((rc = idl1->kstr.bv_len - idl2->kstr.bv_len )) return rc;
return ( memcmp ( idl1->kstr.bv_val, idl2->kstr.bv_val , idl1->kstr.bv_len ) );
}
-#endif
#if IDL_DEBUG > 0
static void idl_check( ID *ids )
}
}
-#ifdef SLAP_IDL_CACHE
-
/* Find a db/key pair in the IDL cache. If ids is non-NULL,
* copy the cached IDL into it, otherwise just return the status.
*/
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_idl_tree_rwlock );
}
-#endif
int
bdb_idl_fetch_key(
assert( ids != NULL );
-#ifdef SLAP_IDL_CACHE
if ( bdb->bi_idl_cache_size ) {
rc = bdb_idl_cache_get( bdb, db, key, ids );
if ( rc != LDAP_NO_SUCH_OBJECT ) return rc;
}
-#endif
DBTzero( &data );
}
if( rc == DB_NOTFOUND ) {
-#ifndef SLAP_IDL_CACHE
return rc;
-#endif
} else if( rc != 0 ) {
#ifdef NEW_LOGGING
return -1;
}
-#ifdef SLAP_IDL_CACHE
if ( bdb->bi_idl_cache_max_size ) {
bdb_idl_cache_put( bdb, db, key, ids, rc );
}
-#endif
return rc;
}
assert( id != NOID );
-#ifdef SLAP_IDL_CACHE
if ( bdb->bi_idl_cache_size ) {
bdb_idl_cache_del( bdb, db, key );
}
-#endif
DBTzero( &data );
data.size = sizeof( ID );
}
assert( id != NOID );
-#ifdef SLAP_IDL_CACHE
if ( bdb->bi_idl_cache_max_size ) {
bdb_idl_cache_del( bdb, db, key );
}
-#endif
DBTzero( &data );
data.data = &tmp;