]> git.sur5r.net Git - openldap/commitdiff
Straighten out some argument passing... cache code need more cleanup,
authorKurt Zeilenga <kurt@openldap.org>
Sat, 26 Jan 2002 01:01:10 +0000 (01:01 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 26 Jan 2002 01:01:10 +0000 (01:01 +0000)
uses deprecated routines...

servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/dn2id.c

index c401aae548ce5a0c2851562cd5b55eb838665734..56b902f1f8711ba1f2445fd9d56d36c1a2f0b493 100644 (file)
@@ -224,7 +224,7 @@ retry:          /* transaction retry */
                                matched_dn, NULL, refs, NULL );
 
                        ber_bvarray_free( refs );
-                       bdb_cache_return_entry_r( be, p );
+                       bdb_cache_return_entry_r( &bdb->bi_cache, p );
                        p = NULL;
                        goto done;
                }
@@ -235,7 +235,7 @@ retry:          /* transaction retry */
                }
 
                /* free parent and reader lock */
-               bdb_cache_return_entry_r( be, p );
+               bdb_cache_return_entry_r( &bdb->bi_cache, p );
                p = NULL;
 
        } else {
index f3360752161b83f7181ea263febc8fb93bc475ba..95f39070342bcd620fb93df13b155a7ed7010e81 100644 (file)
@@ -225,7 +225,8 @@ bdb_dn2id(
 
        assert (id);
  
-       if ((*id = bdb_cache_find_entry_ndn2id(be,&bdb->bi_cache,dn)) != NOID) {
+       *id = bdb_cache_find_entry_ndn2id(be, &bdb->bi_cache, dn);
+       if (*id != NOID) {
                return 0;
        }
 
@@ -268,7 +269,8 @@ bdb_dn2id_matched(
        DBT             key, data;
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
        DB *db = bdb->bi_dn2id->bdi_db;
-       char            *buf, *dn;
+       char            *buf;
+       struct  berval dn;
        ID              cached_id;
 
        Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_matched( \"%s\" )\n", in->bv_val, 0, 0 );
@@ -277,8 +279,9 @@ bdb_dn2id_matched(
        key.size = in->bv_len + 2;
        buf = ch_malloc( key.size );
        key.data = buf;
-       dn = buf+1;
-       AC_MEMCPY( dn, in->bv_val, key.size - 1 );
+       dn.bv_val = buf+1;
+       dn.bv_len = key.size - 2;
+       AC_MEMCPY( dn.bv_val, in->bv_val, key.size - 1 );
 
        /* store the ID */
        DBTzero( &data );
@@ -287,17 +290,17 @@ bdb_dn2id_matched(
        data.flags = DB_DBT_USERMEM;
 
        while(1) {
-               dn[-1] = DN_BASE_PREFIX;
+               dn.bv_val[-1] = DN_BASE_PREFIX;
 
                *id = NOID;
 
                /* lookup cache */
-               cached_id = bdb_cache_find_entry_ndn2id(be,&bdb->bi_cache,dn);
+               cached_id = bdb_cache_find_entry_ndn2id(be, &bdb->bi_cache, &dn);
  
                if (cached_id != NOID) {
                        rc = 0;
                        *id = cached_id;
-                       if ( dn != buf+1 ) {
+                       if ( dn.bv_val != buf+1 ) {
                                *id2 = *id;
                        }
                        break;
@@ -309,8 +312,8 @@ bdb_dn2id_matched(
                if( rc == DB_NOTFOUND ) {
                        char    *pdn = NULL;
 
-                       if ( ! be_issuffix( be, dn ) ) {
-                               rc = dnParent( dn, &pdn );
+                       if ( ! be_issuffix( be, dn.bv_val ) ) {
+                               rc = dnParent( dn.bv_val, &pdn );
                                if ( rc != LDAP_SUCCESS ) {
                                        Debug( LDAP_DEBUG_TRACE,
                                                "<= bdb_dn2id_matched: dnParent(\"%s\") failed\n",
@@ -326,8 +329,9 @@ bdb_dn2id_matched(
                                break;
                        }
 
-                       key.size -= pdn - dn;
-                       dn = pdn;
+                       key.size -= pdn - dn.bv_val;
+                       dn.bv_val = pdn;
+                       dn.bv_len = key.size - 2;
                        key.data = pdn - 1;
 
                } else if ( rc == 0 ) {
@@ -338,7 +342,7 @@ bdb_dn2id_matched(
                                        (long) sizeof(ID), (long) data.size, 0 );
                        }
 
-                       if( dn != buf+1 ) {
+                       if( dn.bv_val != buf+1 ) {
                                *id2 = *id;
                        }