MapMemory.h   MapMemory.h 
/* /*
Copyright 2005-2012 Intel Corporation. All Rights Reserved. Copyright 2005-2013 Intel Corporation. All Rights Reserved.
This file is part of Threading Building Blocks. This file is part of Threading Building Blocks.
Threading Building Blocks is free software; you can redistribute it Threading Building Blocks is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License and/or modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation. version 2 as published by the Free Software Foundation.
Threading Building Blocks is distributed in the hope that it will be Threading Building Blocks is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 103 skipping to change at line 103
#elif (_WIN32 || _WIN64) && !_XBOX && !__TBB_WIN8UI_SUPPORT #elif (_WIN32 || _WIN64) && !_XBOX && !__TBB_WIN8UI_SUPPORT
#include <windows.h> #include <windows.h>
#define MEMORY_MAPPING_USES_MALLOC 0 #define MEMORY_MAPPING_USES_MALLOC 0
void* MapMemory (size_t bytes, bool) void* MapMemory (size_t bytes, bool)
{ {
/* Is VirtualAlloc thread safe? */ /* Is VirtualAlloc thread safe? */
return VirtualAlloc(NULL, bytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRI TE); return VirtualAlloc(NULL, bytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRI TE);
} }
int UnmapMemory(void *area, size_t bytes) int UnmapMemory(void *area, size_t /*bytes*/)
{ {
BOOL result = VirtualFree(area, 0, MEM_RELEASE); BOOL result = VirtualFree(area, 0, MEM_RELEASE);
return !result; return !result;
} }
#else #else
#define MEMORY_MAPPING_USES_MALLOC 1 #define MEMORY_MAPPING_USES_MALLOC 1
void* MapMemory (size_t bytes, bool) void* MapMemory (size_t bytes, bool)
{ {
return ErrnoPreservingMalloc( bytes ); return ErrnoPreservingMalloc( bytes );
} }
int UnmapMemory(void *area, size_t bytes) int UnmapMemory(void *area, size_t /*bytes*/)
{ {
free( area ); free( area );
return 0; return 0;
} }
#endif /* OS dependent */ #endif /* OS dependent */
#if MALLOC_CHECK_RECURSION && MEMORY_MAPPING_USES_MALLOC #if MALLOC_CHECK_RECURSION && MEMORY_MAPPING_USES_MALLOC
#error Impossible to protect against malloc recursion when memory mapping u ses malloc. #error Impossible to protect against malloc recursion when memory mapping u ses malloc.
#endif #endif
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/