From 853f881bd170e252537f3107ae2202f9832d78d4 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Apr 2019 14:44:57 +0200 Subject: [PATCH] Avoid code duplication --- ext/opcache/ZendAccelerator.c | 13 ------------- ext/opcache/ZendAccelerator.h | 15 +++++++++++++++ ext/opcache/jit/zend_jit.c | 15 --------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 1dccc72bb9..3b84d184ea 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -85,19 +85,6 @@ typedef int gid_t; #include #endif -#define SHM_PROTECT() \ - do { \ - if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(1); \ - } \ - } while (0) -#define SHM_UNPROTECT() \ - do { \ - if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(0); \ - } \ - } while (0) - ZEND_EXTENSION(); #ifndef ZTS diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 2ab786d76a..837898be1a 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -315,4 +315,19 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type); zend_string* ZEND_FASTCALL accel_new_interned_string(zend_string *str); +/* memory write protection */ +#define SHM_PROTECT() \ + do { \ + if (ZCG(accel_directives).protect_memory) { \ + zend_accel_shared_protect(1); \ + } \ + } while (0) + +#define SHM_UNPROTECT() \ + do { \ + if (ZCG(accel_directives).protect_memory) { \ + zend_accel_shared_protect(0); \ + } \ + } while (0) + #endif /* ZEND_ACCELERATOR_H */ diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 0472cc505f..46c3b37e5a 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -2644,21 +2644,6 @@ jit_failure: return FAILURE; } -/* memory write protection */ -#define SHM_PROTECT() \ - do { \ - if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(1); \ - } \ - } while (0) - -#define SHM_UNPROTECT() \ - do { \ - if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(0); \ - } \ - } while (0) - /* Run-time JIT handler */ static void ZEND_FASTCALL zend_runtime_jit(void) { -- 2.40.0