From ec6f8c4fe162500645109eb24856051c97bfb2fe Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Mon, 18 Mar 2019 19:45:34 +0100 Subject: Remove the extra argument from cc4group_mmap and cc4group_munmap as its actually not needed --- src/platform/windows.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/platform/windows.c') diff --git a/src/platform/windows.c b/src/platform/windows.c index bd1016c..53d5038 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -17,8 +17,6 @@ #include #include -#include - #include "platform.h" #ifdef __USE_FILE_OFFSET64 @@ -29,7 +27,7 @@ # define DWORD_LO(x) (x) #endif -void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset, void** extra) +void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { (void)start; if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) @@ -83,22 +81,19 @@ void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off dwDesiredAccess |= FILE_MAP_EXECUTE; void *ret = MapViewOfFile(h, dwDesiredAccess, DWORD_HI(offset), DWORD_LO(offset), length); + CloseHandle(h); if (ret == NULL) { - CloseHandle(h); ret = MAP_FAILED; } - *extra = h; return ret; } -int cc4group_munmap(void *addr, size_t length, void* extra) +int cc4group_munmap(void *addr, size_t length) { (void)length; UnmapViewOfFile(addr); - CloseHandle(extra); - /* ruh-ro, we leaked handle from CreateFileMapping() ... */ return 0; } -- cgit v1.2.3-54-g00ecf