]> git.sur5r.net Git - openldap/commitdiff
cleanup
authorKurt Zeilenga <kurt@openldap.org>
Wed, 31 Dec 2003 01:41:16 +0000 (01:41 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 31 Dec 2003 01:41:16 +0000 (01:41 +0000)
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/cache.c

index 763523cdd4279fb0ae68aede36f88235297e82cc..892e969f9c42623bd9d606940454dd8205f9d01a 100644 (file)
@@ -363,7 +363,8 @@ retry:      /* transaction retry */
        if( rs->sr_err != 0 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG ( OPERATION, ERR, 
-                       "bdb_add: txn_begin(2) failed: %s (%d)\n", db_strerror(rs->sr_err), rs->sr_err, 0 );
+                       "bdb_add: txn_begin(2) failed: %s (%d)\n",
+                       db_strerror(rs->sr_err), rs->sr_err, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_add: txn_begin(2) failed: %s (%d)\n",
@@ -379,7 +380,8 @@ retry:      /* transaction retry */
        if ( rs->sr_err != 0 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG ( OPERATION, ERR, 
-                       "bdb_add: dn2id_add failed: %s (%d)\n", db_strerror(rs->sr_err), rs->sr_err, 0 );
+                       "bdb_add: dn2id_add failed: %s (%d)\n",
+                       db_strerror(rs->sr_err), rs->sr_err, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "bdb_add: dn2id_add failed: %s (%d)\n",
                        db_strerror(rs->sr_err), rs->sr_err, 0 );
@@ -477,13 +479,13 @@ retry:    /* transaction retry */
                bdb_cache_add( bdb, ei, e, &nrdn, locker );
 
                if ( suffix_ei == NULL ) {
-                       suffix_ei = e->e_private;
+                       suffix_ei = BEI(e);
                }
 
                if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
                        if ( ctxcsn_added ) {
                                bdb_cache_add( bdb, suffix_ei, ctxcsn_e,
-                                               (struct berval *)&slap_ldapsync_cn_bv, locker );
+                                       (struct berval *)&slap_ldapsync_cn_bv, locker );
                        }
                }
 
index 109b03c60f15ff68bf8818eb2839299552f13d79..73a6673585abb06dcebd426520b0c5f53764258f 100644 (file)
@@ -199,8 +199,10 @@ bdb_rdn_cmp( const void *v_e1, const void *v_e2 )
 {
        const EntryInfo *e1 = v_e1, *e2 = v_e2;
        int rc = e1->bei_nrdn.bv_len - e2->bei_nrdn.bv_len;
-       if (rc == 0) rc = strncmp( e1->bei_nrdn.bv_val, e2->bei_nrdn.bv_val,
-               e1->bei_nrdn.bv_len );
+       if (rc == 0) {
+               rc = strncmp( e1->bei_nrdn.bv_val, e2->bei_nrdn.bv_val,
+                       e1->bei_nrdn.bv_len );
+       }
        return rc;
 }
 
@@ -217,8 +219,7 @@ static int
 bdb_entryinfo_add_internal(
        struct bdb_info *bdb,
        EntryInfo *ei,
-       EntryInfo **res
-)
+       EntryInfo **res )
 {
        EntryInfo *ei2 = NULL;
 
@@ -271,8 +272,7 @@ bdb_cache_find_ndn(
        Operation       *op,
        DB_TXN          *txn,
        struct berval   *ndn,
-       EntryInfo       **res
-)
+       EntryInfo       **res )
 {
        struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
        EntryInfo       ei, *eip, *ei2;
@@ -299,7 +299,8 @@ bdb_cache_find_ndn(
                if ( !ei2 ) {
                        int len = ei.bei_nrdn.bv_len;
                                
-                       ei.bei_nrdn.bv_len = ndn->bv_len - (ei.bei_nrdn.bv_val - ndn->bv_val);
+                       ei.bei_nrdn.bv_len = ndn->bv_len -
+                               (ei.bei_nrdn.bv_val - ndn->bv_val);
                        bdb_cache_entryinfo_unlock( eip );
 
                        rc = bdb_dn2id( op, txn, &ei.bei_nrdn, &ei );
@@ -335,7 +336,7 @@ bdb_cache_find_ndn(
 
                /* Advance to next lower RDN */
                for (ptr = ei.bei_nrdn.bv_val - 2; ptr > ndn->bv_val
-                       && !DN_SEPARATOR(*ptr); ptr--);
+                       && !DN_SEPARATOR(*ptr); ptr--) /* empty */;
                if ( ptr >= ndn->bv_val ) {
                        if (DN_SEPARATOR(*ptr)) ptr++;
                        ei.bei_nrdn.bv_len = ei.bei_nrdn.bv_val - ptr - 1;
@@ -760,6 +761,7 @@ bdb_cache_add(
        ber_dupbv( &ei.bei_rdn, &rdn );
        if ( eip->bei_dkids ) eip->bei_dkids++;
 #endif
+
        rc = bdb_entryinfo_add_internal( bdb, &ei, &new );
        /* bdb_csn_commit can cause this when adding the database root entry */
        if ( new->bei_e ) bdb_entry_return( new->bei_e );
@@ -767,7 +769,9 @@ bdb_cache_add(
        e->e_private = new;
        new->bei_state = CACHE_ENTRY_NO_KIDS | CACHE_ENTRY_NO_GRANDKIDS;
        eip->bei_state &= ~CACHE_ENTRY_NO_KIDS;
-       if (eip->bei_parent) eip->bei_parent->bei_state &= ~CACHE_ENTRY_NO_GRANDKIDS;
+       if (eip->bei_parent) {
+               eip->bei_parent->bei_state &= ~CACHE_ENTRY_NO_GRANDKIDS;
+       }
 
        /* set lru mutex */
        ldap_pvt_thread_mutex_lock( &bdb->bi_cache.lru_mutex );