ch_free( cont->dptr );
}
+#ifdef LDBM_DEBUG_IDL
+static void idl_check(ID_BLOCK *idl)
+{
+ int i;
+ ID_BLOCK last;
+
+ if( ID_BLOCK_INDIRECT(idl) || ID_BLOCK_ALLIDS(idl)
+ || ID_BLOCK_NIDS(idl) <= 1 )
+ {
+ return;
+ }
+
+ for( last = ID_BLOCK_ID(idl, 0), i = 1;
+ i < ID_BLOCK_NIDS(idl);
+ last = ID_BLOCK_ID(idl, i), i++ )
+ {
+ assert (last < ID_BLOCK_ID(idl, i) );
+ }
+}
+#endif
+
/* Allocate an ID_BLOCK with room for nids ids */
ID_BLOCK *
idl_alloc( unsigned int nids )
}
free( (char *) tmp );
+#ifdef LDBM_DEBUG_IDL
+ idl_check(idl);
+#endif
+
#ifdef NEW_LOGGING
LDAP_LOG(( "cache", LDAP_LEVEL_ENTRY,
"idl_fetch: %ld ids (%ld max)\n",
Datum data;
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+#ifdef LDBM_DEBUG_IDL
+ idl_check(idl);
+#endif
+
ldbm_datum_init( data );
/* Debug( LDAP_DEBUG_TRACE, "=> idl_store\n", 0, 0, 0 ); */
(char *) &ID_BLOCK_ID(b, nr),
nl * sizeof(ID) );
ID_BLOCK_NIDS(*left) = nl + (nr == 0 ? 0 : 1);
+
+#ifdef LDBM_DEBUG_IDL
+ idl_check(*right);
+ idl_check(*left);
+#endif
}
'\0',
(ID_BLOCK_NMAX(*idl) - ID_BLOCK_NIDS(*idl)) * sizeof(ID) );
+#ifdef LDBM_DEBUG_IDL
+ idl_check(*idl);
+#endif
+
return( i == 0 ? 1 : 0 ); /* inserted - first id changed or not */
}
(char *) idl,
(ID_BLOCK_NMAX(idl) + ID_BLOCK_IDS_OFFSET) * sizeof(ID) );
+#ifdef LDBM_DEBUG_IDL
+ idl_check(new);
+#endif
+
return( new );
}
n = idl_dup( idl_min( a, b ) );
+#ifdef LDBM_DEBUG_IDL
+ idl_check(a);
+ idl_check(b);
+#endif
+
for ( ni = 0, ai = 0, bi = 0; ai < ID_BLOCK_NIDS(a); ai++ ) {
for ( ;
bi < ID_BLOCK_NIDS(b) && ID_BLOCK_ID(b, bi) < ID_BLOCK_ID(a, ai);
}
ID_BLOCK_NIDS(n) = ni;
+#ifdef LDBM_DEBUG_IDL
+ idl_check(n);
+#endif
+
return( n );
}
return( idl_allids( be ) );
}
+#ifdef LDBM_DEBUG_IDL
+ idl_check(a);
+ idl_check(b);
+#endif
+
if ( ID_BLOCK_NIDS(b) < ID_BLOCK_NIDS(a) ) {
n = a;
a = b;
}
ID_BLOCK_NIDS(n) = ni;
+#ifdef LDBM_DEBUG_IDL
+ idl_check(n);
+#endif
+
return( n );
}
}
ID_BLOCK_NIDS(n) = ni;
+#ifdef LDBM_DEBUG_IDL
+ idl_check(n);
+#endif
+
return( n );
}