• Per Cederqvist's avatar
    Let dbfile_open_write() write the file header. Extract the code · 39b34b6a
    Per Cederqvist authored
    that changes the state to dbfile_change_magic().  Reduce code
    duplication by teaching foutput_header() to handle old file
    formats.
    * src/server/simple-cache.c (pre_sync): Adjusted to new API of
    dbfile_open_write(), including removing calls to foutput_header().
    (save_one_text): Extracted parts of the functionality to
    dbfile_change_magic().
    * src/server/ram-output.c (foutput_header): Moved support for file
    formats 0, 1 and 2 here from sync_output_header().
    * src/server/ram-io.c, src/server/ram-io.h
    (dbfile_open_write): New argument: magic.  Write a file header
    with the specified state.
    (dbfile_change_magic): New function, extracted from
    cache_sync_all() in dbck-cache.c and save_one_text().
    * src/server/dbck-cache.c (sync_output_header): Removed.
    The ability to emit old-style headers moved to foutput_header().
    (cache_sync_all): Adjusted to new API of dbfile_open_write,
    including removing calls to sync_output_header().  Use
    dbfile_change_magic() instead of rewind() and
    sync_output_header().
    * src/server/Makefile.am (libcheck_a_SOURCES): Added
    server-time.c.
    39b34b6a
ram-output.c 24.7 KB