com php-src: Added missing #if to allow compilation withput ZEND_MM_CUSTOM: Zend/zend_alloc.c
| From: | Dmitry Stogov | Date: | Mon, 15 Jan 2018 14:37:15 +0000 |
| Subject: | com php-src: Added missing #if to allow compilation withput ZEND_MM_CUSTOM: Zend/zend_alloc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100890@lists.php.net to get a copy of this message | ||
Commit: d5238b95a3d67ab47ff4090bed1b6884c90d6132
Author: Dmitry Stogov <dmitry@zend.com> Mon, 15 Jan 2018 17:37:15 +0300
Parents: 106575ed39603c36bd3bc0eeae3836e261b41e5c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d5238b95a3d67ab47ff4090bed1b6884c90d6132
Log:
Added missing #if to allow compilation withput ZEND_MM_CUSTOM
Changed paths:
M Zend/zend_alloc.c
Diff:
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index d09c7cc..241223f 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -2408,14 +2408,12 @@ ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR, x, y)
ZEND_API void* ZEND_FASTCALL _emalloc_large(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
-
ZEND_MM_CUSTOM_ALLOCATOR(size);
return zend_mm_alloc_large(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);
}
ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size)
{
-
ZEND_MM_CUSTOM_ALLOCATOR(size);
return zend_mm_alloc_huge(AG(mm_heap), size);
}
@@ -2450,7 +2448,6 @@ ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y)
ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
{
-
ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
{
size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
@@ -2475,7 +2472,6 @@ ZEND_API void ZEND_FASTCALL _efree_huge(void *ptr, size_t size)
ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
-
#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
if (ZEND_DEBUG && AG(mm_heap)->use_custom_heap == ZEND_MM_CUSTOM_HEAP_DEBUG) {
@@ -2490,7 +2486,6 @@ ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC
ZEND_FILE_LI
ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
-
#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
if (ZEND_DEBUG && AG(mm_heap)->use_custom_heap == ZEND_MM_CUSTOM_HEAP_DEBUG) {
@@ -2506,7 +2501,7 @@ ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC
ZEND_FILE_LINE_OR
ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC)
{
-
+#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
if (ZEND_DEBUG && AG(mm_heap)->use_custom_heap == ZEND_MM_CUSTOM_HEAP_DEBUG) {
return AG(mm_heap)->custom_heap.debug._realloc(ptr, size ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -2514,12 +2509,13 @@ ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size
ZEND_FILE_LINE_DC
return AG(mm_heap)->custom_heap.std._realloc(ptr, size);
}
}
+#endif
return zend_mm_realloc_heap(AG(mm_heap), ptr, size, 0, size ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);
}
ZEND_API void* ZEND_FASTCALL _erealloc2(void *ptr, size_t size, size_t copy_size ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC)
{
-
+#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
if (ZEND_DEBUG && AG(mm_heap)->use_custom_heap == ZEND_MM_CUSTOM_HEAP_DEBUG) {
return AG(mm_heap)->custom_heap.debug._realloc(ptr, size ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -2527,14 +2523,17 @@ ZEND_API void* ZEND_FASTCALL _erealloc2(void *ptr, size_t size, size_t
copy_size
return AG(mm_heap)->custom_heap.std._realloc(ptr, size);
}
}
+#endif
return zend_mm_realloc_heap(AG(mm_heap), ptr, size, 1, copy_size ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);
}
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC)
{
+#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
return 0;
}
+#endif
return zend_mm_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
@@ -2655,9 +2654,12 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown)
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
{
-#if ZEND_MM_CUSTOM
- char *tmp = getenv("USE_ZEND_ALLOC");
+#if ZEND_MM_CUSTOM || MAP_HUGETLB
+ char *tmp;
+#endif
+#if ZEND_MM_CUSTOM
+ tmp = getenv("USE_ZEND_ALLOC");
if (tmp && !zend_atoi(tmp, 0)) {
alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
memset(alloc_globals->mm_heap, 0, sizeof(zend_mm_heap));