+static ID_BLOCK* idl_dup( ID_BLOCK *idl );
+
+static void cont_alloc( Datum *cont, Datum *key )
+{
+ ldbm_datum_init( *cont );
+ cont->dsize = 1 + sizeof(ID) + key->dsize;
+ cont->dptr = ch_malloc( cont->dsize );
+
+ * (unsigned char *) cont->dptr = SLAP_INDEX_CONT_PREFIX;
+
+ AC_MEMCPY( &((unsigned char *)cont->dptr)[1 + sizeof(ID)],
+ key->dptr, key->dsize );
+}
+
+static void cont_id( Datum *cont, ID id )
+{
+ unsigned int i;
+
+ for( i=1; i <= sizeof(id); i++) {
+ ((unsigned char *)cont->dptr)[i] = (unsigned char)(id & 0xFF);
+ id >>= 8;
+ }
+
+}
+
+static void cont_free( Datum *cont )
+{
+ 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 */