From: Howard Chu Date: Sat, 24 Nov 2001 03:43:52 +0000 (+0000) Subject: Fix initialization bugs X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~842 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=02b464b6844f219b5ea0f5dc85050f8eb7cb1328;p=openldap Fix initialization bugs --- diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index f1f0d1577c..c579511de8 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -440,7 +440,7 @@ bdb_idl_intersection( ID *ids ) { ID ida, idb; - ID cursora, cursorb; + ID cursora = 0, cursorb = 0; if ( BDB_IDL_IS_ZERO( a ) || BDB_IDL_IS_ZERO( b ) ) { ids[0] = 0; @@ -505,7 +505,7 @@ bdb_idl_union( ID *ids ) { ID ida, idb; - ID cursora, cursorb; + ID cursora = 0, cursorb = 0; if ( BDB_IDL_IS_ZERO( a ) ) { BDB_IDL_CPY( ids, b ); @@ -524,7 +524,7 @@ bdb_idl_union( return 0; } - ida = bdb_idl_first( a, &cursora ), + ida = bdb_idl_first( a, &cursora ); idb = bdb_idl_first( b, &cursorb ); ids[0] = 0; @@ -566,7 +566,7 @@ bdb_idl_notin( ID *ids ) { ID ida, idb; - ID cursora, cursorb; + ID cursora = 0, cursorb = 0; if( BDB_IDL_IS_ZERO( a ) || BDB_IDL_IS_ZERO( b ) || @@ -625,7 +625,10 @@ ID bdb_idl_first( ID *ids, ID *cursor ) return *cursor; } - pos = bdb_idl_search( ids, *cursor ); + if ( *cursor == 0 ) + pos = 1; + else + pos = bdb_idl_search( ids, *cursor ); if( pos > ids[0] ) { return NOID; @@ -644,10 +647,9 @@ ID bdb_idl_next( ID *ids, ID *cursor ) return *cursor; } - if ( *cursor < ids[0] ) { - return ids[(*cursor)++]; + if ( ++(*cursor) <= ids[0] ) { + return ids[*cursor]; } return NOID; } -