[Pcre-svn] [1054] code/trunk/src/sljit/sljitExecAllocator.c:…

Páxina inicial
Borrar esta mensaxe
Autor: Subversion repository
Data:  
Para: pcre-svn
Asunto: [Pcre-svn] [1054] code/trunk/src/sljit/sljitExecAllocator.c: Use TARGET_OS_MAC macro in the executable allocator.
Revision: 1054
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1054
Author:   zherczeg
Date:     2018-12-14 08:00:49 +0000 (Fri, 14 Dec 2018)
Log Message:
-----------
Use TARGET_OS_MAC macro in the executable allocator.


Modified Paths:
--------------
    code/trunk/src/sljit/sljitExecAllocator.c


Modified: code/trunk/src/sljit/sljitExecAllocator.c
===================================================================
--- code/trunk/src/sljit/sljitExecAllocator.c    2018-12-13 13:23:59 UTC (rev 1053)
+++ code/trunk/src/sljit/sljitExecAllocator.c    2018-12-14 08:00:49 UTC (rev 1054)
@@ -94,20 +94,28 @@


#else

-#ifdef MAP_JIT
+#ifdef __APPLE__
+// Configures TARGET_OS_MAC when appropriate.
+#include <TargetConditionals.h>

-#ifdef __APPLE__
+#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 @@
     }


     return map_jit_flag;
-#else /* !__APPLE__ */
+#else /* !TARGET_OS_MAC */
     return MAP_JIT;
-#endif /* __APPLE__ */
+#endif /* TARGET_OS_MAC */
 }


#endif /* MAP_JIT */