-
Per Cederqvist authored
and use them when accessing database files. This is a preparatory step for introducing "struct dbfile", which will enable lyskomd to manipulate more than one database file format at the same time. That ability is needed for solving bug 1616. * src/server/ram-io.c, src/server/ram-io.h: New files. (dbfile_ftell): New function. (dbfile_getc): New function. (dbfile_ungetc): New function. * src/server/Makefile.am (libcheck_a_SOURCES): Added ram-io.c. (lyskomd_SOURCES): Added ram-io.h and ram-io.c. (DBCK): Added ram-io.h and ram-io.c. * src/server/simple-cache.c (read_person): Check the return value from fparse_set_pos(). (read_conference): Ditto. (read_text_stat): Ditto. (write_conf): New static function. (save_one_conf): Use it to simplify code. (write_text): New static function. (save_one_text): Use it to simplify code. * src/server/ram-parse.h, src/server/ram-parse.c (fparse_set_pos): New function. * src/server/ram-output.c: Include ram-io.h. (foutput_space): New static function. Use it where appropriate. (foutput_bool): Ditto. (foutput_array_start): Ditto. (foutput_array_end): Ditto. (foutput_array_nodata): Ditto. * src/server/ram-output.h, src/server/ram-output.c (foutput_atsign): New function. (foutput_newline): New function. * src/server/dbck-cache.c: Include ram-io.h. Use dbfile_getc() instead of getc(), dbfile_ungetc() instead of ungetc(), and dbfile_ftell() instead of ftell(), when accessing the database file. Use foutput_atsign and foutput_newline when appropriate. * src/server/local-to-global.c: Ditto. * src/server/ram-parse.c: Ditto. * src/server/simple-cache.c: Ditto.
d7498aeb