dirfile_discard (3) - Linux Manuals
dirfile_discard: close a dirfile and free associated memory.
NAME
dirfile_close, dirfile_discard --- close a dirfile and free associated memory.SYNOPSIS
#include <getdata.h>-
int dirfile_close(DIRFILE *dirfile);
- int dirfile_discard(DIRFILE *dirfile);
DESCRIPTION
The dirfile_discard() function behaves similarly, except modified metadata is not written to disk, but simply discarded. In order to ensure that modified data files associated with RAW fields are properly terminated, changes to RAW data files are still flushed to disk by this function. If dirfile was opened in read-only mode, dirfile_discard() and dirfile_close() behave identically.
One of these functions should be called on all pointers returned by dirfile_cbopen(3) and dirfile_open(3), even if the call to those function failed. After dirfile_close() or dirfile_discard() returns successfully, the pointer dirfile should be considered invalid.
RETURN VALUE
dirfile_close() and dirfile_discard() return zero on success. On error, they do not deallocate dirfile and set the dirfile error to a non-zero error value. Possible error values are:- GD_E_RAW_IO
- An error occurred while trying to flush or close one or more open raw files. In this case, another call to dirfile_close() or dirfile_discard() may be attempted. The dirfile error may be retrieved by calling get_error(3). A descriptive error string for the last error encountered can be obtained from a call to get_error_string(3).