]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/stringpool.c
Split database into a writer and reader
[people/ms/libloc.git] / src / stringpool.c
index 52c1012f88a054cfa7d8c3df2a9a93b25683bc87..4a0a46b06027120b21116428f389ac548b18216c 100644 (file)
@@ -234,8 +234,6 @@ LOC_EXPORT void loc_stringpool_dump(struct loc_stringpool* pool) {
        }
 }
 
-#include <assert.h>
-
 LOC_EXPORT int loc_stringpool_read(struct loc_stringpool* pool, FILE* f, off_t offset, size_t length) {
        DEBUG(pool->ctx, "Reading string pool from %zu (%zu bytes)\n", offset, length);
 
@@ -252,11 +250,5 @@ LOC_EXPORT int loc_stringpool_read(struct loc_stringpool* pool, FILE* f, off_t o
 LOC_EXPORT size_t loc_stringpool_write(struct loc_stringpool* pool, FILE* f) {
        size_t size = loc_stringpool_get_size(pool);
 
-       size_t bytes_written = fwrite(pool->data, sizeof(*pool->data), size, f);
-
-       // Move to next page boundary
-       while (bytes_written % LOC_DATABASE_PAGE_SIZE > 0)
-               bytes_written += fwrite("", 1, 1, f);
-
-       return bytes_written;
+       return fwrite(pool->data, sizeof(*pool->data), size, f);
 }