]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/index.c
Code clean-up.
[openldap] / servers / slapd / back-ldbm / index.c
index 6ccfbc38fdf9cac97247d88aa2b0902801b3a222..0d595119c693d912dc4be00fc6fc9b95af80d9e2 100644 (file)
@@ -85,7 +85,7 @@ index_add_mods(
        return( 0 );
 }
 
-IDList *
+ID_BLOCK *
 index_read(
     Backend    *be,
     char       *type,
@@ -95,7 +95,7 @@ index_read(
 {
        struct dbcache  *db;
        Datum           key;
-       IDList          *idl;
+       ID_BLOCK                *idl;
        int             indexmask, syntax;
        char            prefix;
        char            *realval, *tmpval;
@@ -111,8 +111,8 @@ index_read(
        if ( ! (indextype & indexmask) ) {
                idl =  idl_allids( be );
                Debug( LDAP_DEBUG_TRACE,
-                   "<= index_read %lu candidates (allids - not indexed)\n",
-                   idl ? idl->b_nids : 0, 0, 0 );
+                   "<= index_read %ld candidates (allids - not indexed)\n",
+                   idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
                return( idl );
        }
 
@@ -151,8 +151,8 @@ index_read(
 
        ldbm_cache_close( be, db );
 
-       Debug( LDAP_DEBUG_TRACE, "<= index_read %lu candidates\n",
-           idl ? idl->b_nids : 0, 0, 0 );
+       Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
+           idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
        return( idl );
 }
 
@@ -168,19 +168,17 @@ add_value(
 {
        int     rc;
        Datum   key;
-       IDList  *idl;
-       char    prefix;
-       char    *realval, *tmpval, *s;
+       ID_BLOCK        *idl = NULL;
+       char    *tmpval = NULL;
+       char    *realval = val;
        char    buf[BUFSIZ];
 
+       char    prefix = index2prefix( indextype );
+
        ldbm_datum_init( key );
 
-       prefix = index2prefix( indextype );
        Debug( LDAP_DEBUG_TRACE, "=> add_value( \"%c%s\" )\n", prefix, val, 0 );
 
-       realval = val;
-       tmpval = NULL;
-       idl = NULL;
        if ( prefix != UNKNOWN_PREFIX ) {
               unsigned int     len = strlen( val );
 
@@ -203,9 +201,12 @@ add_value(
        if ( tmpval != NULL ) {
                free( tmpval );
        }
-       idl_free( idl );
 
-       pthread_yield();
+       if( idl != NULL ) {
+               idl_free( idl );
+       }
+
+       ldap_pvt_thread_yield();
 
        /* Debug( LDAP_DEBUG_TRACE, "<= add_value %d\n", rc, 0, 0 ); */
        return( rc );