static int cache_hash LDAP_P(( BerElement *ber ));
static LDAPMessage *msg_dup LDAP_P(( LDAPMessage *msg ));
static int request_cmp LDAP_P(( BerElement *req1, BerElement *req2 ));
static int cache_hash LDAP_P(( BerElement *ber ));
static LDAPMessage *msg_dup LDAP_P(( LDAPMessage *msg ));
static int request_cmp LDAP_P(( BerElement *req1, BerElement *req2 ));
-static int chain_contains_dn LDAP_P(( LDAPMessage *msg, char *dn ));
-static long msg_size LDAP_P(( LDAPMessage *msg ));
+static int chain_contains_dn LDAP_P(( LDAPMessage *msg, LDAP_CONST char *dn ));
+static ber_len_t msg_size LDAP_P(( LDAPMessage *msg ));
- if ( ld->ld_cache == NULLLDCACHE ) {
- if (( ld->ld_cache = (LDAPCache *)malloc( sizeof( LDAPCache )))
- == NULLLDCACHE ) {
+ if ( ld->ld_cache == NULL ) {
+ if (( ld->ld_cache = (LDAPCache *)LDAP_MALLOC( sizeof( LDAPCache )))
+ == NULL ) {
Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
/* delete all messages in the cache */
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
for ( m = ld->ld_cache->lc_buckets[ i ];
/* delete all messages in the cache */
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
for ( m = ld->ld_cache->lc_buckets[ i ];
- char *dn, /* if non-NULL, uncache entry */
- int msgid ) /* request to uncache (if dn == NULL) */
+ const char *dn, /* if non-NULL, uncache entry */
+ ber_int_t msgid ) /* request to uncache (if dn == NULL) */
- "ldap_uncache_entry_or_req dn %s msgid %d ld_cache %lx\n",
- dn, msgid, (long) ld->ld_cache );
+ "ldap_uncache_entry_or_req dn %s msgid %ld ld_cache %lx\n",
+ dn, (long) msgid, (long) ld->ld_cache );
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
m = next ) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
m = next ) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS;
Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS;
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
result->lm_msgid, result->lm_msgtype, 0 );
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
result->lm_msgid, result->lm_msgtype, 0 );
( ld->ld_cache->lc_enabled == 0 )) {
Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
return;
}
if ( result->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
( ld->ld_cache->lc_enabled == 0 )) {
Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
return;
}
if ( result->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
* result to it. if this result completes the results for the
* request, add the request/result chain to the cache proper.
*/
* result to it. if this result completes the results for the
* request, add the request/result chain to the cache proper.
*/
for ( m = ld->ld_cache->lc_requests; m != NULL; m = m->lm_next ) {
if ( m->lm_msgid == result->lm_msgid ) {
break;
for ( m = ld->ld_cache->lc_requests; m != NULL; m = m->lm_next ) {
if ( m->lm_msgid == result->lm_msgid ) {
break;
{
#ifndef LDAP_NOCACHE
LDAPMessage *m, *new, *prev, *next;
BerElement reqber;
int first, hash;
{
#ifndef LDAP_NOCACHE
LDAPMessage *m, *new, *prev, *next;
BerElement reqber;
int first, hash;
Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
m->lm_msgid, m->lm_msgtype, 0 );
Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
m->lm_msgid, m->lm_msgtype, 0 );
(size_t)len )) == NULL ) {
ber_free( new->lm_ber, 0 );
(size_t)len )) == NULL ) {
ber_free( new->lm_ber, 0 );
- if ( ber_scanf( &ber, "{i{a", &msgid, &s ) != LBER_ERROR ) {
+ if ( ber_scanf( &ber, "{i{a" /*}}*/, &msgid, &s ) != LBER_ERROR ) {
LDAPMessage *m, *prev, *next;
Debug( LDAP_DEBUG_TRACE, "check_cache_memused: %ld bytes in use (%ld max)\n",
lc->lc_memused, lc->lc_maxmem, 0 );
LDAPMessage *m, *prev, *next;
Debug( LDAP_DEBUG_TRACE, "check_cache_memused: %ld bytes in use (%ld max)\n",
lc->lc_memused, lc->lc_maxmem, 0 );
|| lc->lc_memused <= lc->lc_maxmem * SIZE_FACTOR ) {
return;
}
remove_threshold = lc->lc_timeout;
while ( lc->lc_memused > lc->lc_maxmem * SIZE_FACTOR ) {
|| lc->lc_memused <= lc->lc_maxmem * SIZE_FACTOR ) {
return;
}
remove_threshold = lc->lc_timeout;
while ( lc->lc_memused > lc->lc_maxmem * SIZE_FACTOR ) {