]> git.ipfire.org Git - location/libloc.git/blobdiff - src/database.c
stringpool: Use mmap to make reading the pool more efficient
[location/libloc.git] / src / database.c
index 9c07590f6cd3e10146e98848bfdc0375c51d8482..494e2f762f6bb3e01dce04753c38ab98bdad58d5 100644 (file)
@@ -387,6 +387,10 @@ LOC_EXPORT int loc_database_write(struct loc_database* db, FILE* f) {
        }
        header.as_length = htonl(db->as_count * sizeof(dbas));
 
+       // Move to next page boundary
+       while (offset % LOC_DATABASE_PAGE_SIZE > 0)
+               offset += fwrite("", 1, 1, f);
+
        // Save the offset of the pool section
        DEBUG(db->ctx, "Pool starts at %jd bytes\n", offset);
        header.pool_offset = htonl(offset);