summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2018-12-14 07:57:58 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2018-12-14 07:57:58 +0000
commitf9f0c6b54d62d048001c508e5384174e74155bb1 (patch)
tree08f036a87deda80634a5b0dd8c729e2ec84c4b1d
parentd1aab866c14cf0fcdb754fe409aef66a6150c96c (diff)
downloadpcre-f9f0c6b54d62d048001c508e5384174e74155bb1.tar.gz
Use TARGET_OS_MAC macro in the executable allocator.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1744 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--sljit/sljitExecAllocator.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sljit/sljitExecAllocator.c b/sljit/sljitExecAllocator.c
index 6e3b295..7a97114 100644
--- a/sljit/sljitExecAllocator.c
+++ b/sljit/sljitExecAllocator.c
@@ -94,20 +94,28 @@ static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size)
#else
-#ifdef MAP_JIT
-
#ifdef __APPLE__
+// Configures TARGET_OS_MAC when appropriate.
+#include <TargetConditionals.h>
+
+#if defined TARGET_OS_MAC && defined MAP_JIT
#include <sys/utsname.h>
+#endif /* TARGET_OS_MAC && MAP_JIT */
#endif /* __APPLE__ */
+#ifdef MAP_JIT
+
static SLJIT_INLINE int get_map_jit_flag()
{
-#ifdef __APPLE__
+#ifdef TARGET_OS_MAC
/* On macOS systems, returns MAP_JIT if it is defined _and_ we're running on a version
of macOS where it's OK to have more than one JIT block. On non-macOS systems, returns
MAP_JIT if it is defined. */
static int map_jit_flag = -1;
+ /* The following code is thread safe because multiple initialization
+ sets map_jit_flag to the same value and the code has no side-effects.
+ Changing the kernel version witout system restart is (very) unlikely. */
if (map_jit_flag == -1) {
struct utsname name;
@@ -118,9 +126,9 @@ static SLJIT_INLINE int get_map_jit_flag()
}
return map_jit_flag;
-#else /* !__APPLE__ */
+#else /* !TARGET_OS_MAC */
return MAP_JIT;
-#endif /* __APPLE__ */
+#endif /* TARGET_OS_MAC */
}
#endif /* MAP_JIT */