From 7e6aa19d42929ad5277a5c2d0ee2ad21482d3a5b Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 26 Oct 2016 15:57:24 -0700 Subject: [PATCH] Make sure memfile growth gets tested --- memfile.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/memfile.cpp b/memfile.cpp index 25c8a0f89..71bc09dbe 100644 --- a/memfile.cpp +++ b/memfile.cpp @@ -5,26 +5,27 @@ #include "memfile.hpp" #define INCREMENT 131072 +#define INITIAL 256 struct memfile *memfile_open(int fd) { - if (ftruncate(fd, INCREMENT) != 0) { + if (ftruncate(fd, INITIAL) != 0) { return NULL; } - char *map = (char *) mmap(NULL, INCREMENT, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + char *map = (char *) mmap(NULL, INITIAL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (map == MAP_FAILED) { return NULL; } struct memfile *mf = new memfile; if (mf == NULL) { - munmap(map, INCREMENT); + munmap(map, INITIAL); return NULL; } mf->fd = fd; mf->map = map; - mf->len = INCREMENT; + mf->len = INITIAL; mf->off = 0; mf->tree = 0;