summaryrefslogtreecommitdiffstats
path: root/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/platform.h4
-rw-r--r--src/platform/unix.c6
-rw-r--r--src/platform/windows.c11
3 files changed, 7 insertions, 14 deletions
diff --git a/src/platform/platform.h b/src/platform/platform.h
index 8e52d51..688d851 100644
--- a/src/platform/platform.h
+++ b/src/platform/platform.h
@@ -31,5 +31,5 @@
#define SET_BINARY(fd)
#endif
-void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset, void** extra);
-int cc4group_munmap(void *addr, size_t length, void* extra); \ No newline at end of file
+void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
+int cc4group_munmap(void *addr, size_t length); \ No newline at end of file
diff --git a/src/platform/unix.c b/src/platform/unix.c
index ecf5166..9bd8f57 100644
--- a/src/platform/unix.c
+++ b/src/platform/unix.c
@@ -1,13 +1,11 @@
#include "platform.h"
-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)extra;
return mmap(start, length, prot, flags, fd, offset);
}
-int cc4group_munmap(void *addr, size_t length, void* extra)
+int cc4group_munmap(void *addr, size_t length)
{
- (void)extra;
return munmap(addr, length);
}
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 <windows.h>
#include <sys/types.h>
-#include <stdio.h>
-
#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;
}