bool keep_always;
bool in_unused;
+ int prot;
void *ptr;
uint64_t offset;
- int prot;
size_t size;
FileDescriptor *fd;
struct MMapCache {
int n_ref;
+ unsigned n_windows;
Hashmap *fds;
Hashmap *contexts;
- unsigned n_windows;
-
LIST_HEAD(Window, unused);
Window *last_unused;
};
free(w);
}
-static bool window_matches(Window *w, int fd, int prot, uint64_t offset, size_t size) {
+_pure_ static bool window_matches(Window *w, int fd, int prot, uint64_t offset, size_t size) {
assert(w);
assert(fd >= 0);
assert(size > 0);
if (w->in_unused) {
/* Used again? */
LIST_REMOVE(Window, unused, c->cache->unused, w);
- if (!c->cache->last_unused)
- c->cache->last_unused = w;
+ if (c->cache->last_unused == w)
+ c->cache->last_unused = w->unused_prev;
w->in_unused = false;
}