- /* Free is mostly empty... */
- newdb.zhdr.zone_bits = INITIAL_ZONE_BITS;
- memset(newdb.free, 0, sizeof(newdb.free));
-
- /* Create the single free entry. */
- newdb.frec.magic_and_meta = TDB_FREE_MAGIC | INITIAL_ZONE_BITS;
- newdb.frec.data_len = (sizeof(newdb.frec)
- - sizeof(struct tdb_used_record)
- + sizeof(newdb.space));
-
- /* Add it to the correct bucket. */
- bucket = size_to_bucket(INITIAL_ZONE_BITS, newdb.frec.data_len);
- newdb.free[bucket] = offsetof(struct new_database, frec);
- newdb.frec.next = newdb.frec.prev = 0;
-
- /* Clear free space to keep valgrind happy, and avoid leaking stack. */
- memset(newdb.space, 0, sizeof(newdb.space));
-
- /* Tailer contains maximum number of free_zone bits. */
- newdb.tailer = INITIAL_ZONE_BITS;
+ /* Free is empty. */
+ newdb.hdr.free_list = offsetof(struct new_database, flist);
+ memset(&newdb.flist, 0, sizeof(newdb.flist));
+ set_header(NULL, &newdb.flist.hdr, 0,
+ sizeof(newdb.flist) - sizeof(newdb.flist.hdr),
+ sizeof(newdb.flist) - sizeof(newdb.flist.hdr), 1);