Go to the previous, next section.

Database reorganization.

The following function should be used very seldom.

ret = gdbm_reorganize(dbf);

The parameter is:

GDBM_FILE dbf
The pointer returned by gdbm_open.

If you have had a lot of deletions and would like to shrink the space used by the gdbm file, this function will reorganize the database. gdbm will not shorten the length of a gdbm file (deleted file space will be reused) except by using this reorganization.

This reorganization requires creating a new file and inserting all the elements in the old file dbf into the new file. The new file is then renamed to the same name as the old file and dbf is updated to contain all the correct information about the new file. If an error is detected, the return value is negative. The value zero is returned after a successful reorganization.

Go to the previous, next section.