half-hearted improvements to Windows compilability

This commit is contained in:
leitner
2019-04-23 13:25:26 +00:00
parent 3aef1c2faa
commit 77a2bbd17a
9 changed files with 38 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
#include "likely.h"
#include <stdlib.h>
#ifndef __MINGW32__
#ifndef _WIN32
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
@@ -13,7 +13,7 @@
#endif
static iarray_page* new_page(size_t pagesize) {
#ifdef __MINGW32__
#ifdef _WIN32
void* x=malloc(pagesize);
if (x==0) return 0;
#else
@@ -49,7 +49,7 @@ void* iarray_allocate(iarray* ia,size_t pos) {
p=&(*p)->next;
}
if (newpage)
#ifdef __MINGW32__
#ifdef _WIN32
free(newpage);
#else
munmap(newpage,ia->bytesperpage);

View File

@@ -1,14 +1,15 @@
#include <stdlib.h>
#ifndef __MINGW32__
#ifndef _WIN32
#include <sys/mman.h>
#endif
#else
#include <unistd.h>
#endif
#include "iarray.h"
static void freechain(iarray_page* p,size_t pagesize) {
while (p) {
iarray_page* n=p->next;
#ifdef __MINGW32__
#ifdef _WIN32
free(p);
#else
munmap(p,pagesize);