]> granicus.if.org Git - php/commitdiff
Added missing #if to allow compilation withput ZEND_MM_CUSTOM
authorDmitry Stogov <dmitry@zend.com>
Mon, 15 Jan 2018 14:37:15 +0000 (17:37 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 15 Jan 2018 14:37:15 +0000 (17:37 +0300)
Zend/zend_alloc.c

index d09c7cc5d2938ceefd069d36d8748487d4362e5c..241223ffd8b1030122c538f66dcae908d9cad284 100644 (file)
@@ -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));