com php-src: Added API function to retrive current custom heap handlers: Zend/zend_alloc.c Zend/zend_alloc.h

From: Date: Tue, 14 Oct 2014 10:20:25 +0000
Subject: com php-src: Added API function to retrive current custom heap handlers: Zend/zend_alloc.c Zend/zend_alloc.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82285@lists.php.net to get a copy of this message
Commit: d2daa19701bdf0ac72bb6c23d868949185ca6723 Author: Dmitry Stogov <dmitry@zend.com> Tue, 14 Oct 2014 14:20:25 +0400 Parents: afdaedaa268197631e210772609fd1f7928f9973 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d2daa19701bdf0ac72bb6c23d868949185ca6723 Log: Added API function to retrive current custom heap handlers Changed paths: M Zend/zend_alloc.c M Zend/zend_alloc.h Diff: diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 32d2e5f..20313fa 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2423,6 +2423,30 @@ ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap, #endif } +ZEND_API void zend_mm_get_custom_handlers(zend_mm_heap *heap, + void* (**_malloc)(size_t), + void (**_free)(void*), + void* (**_realloc)(void*, size_t)) +{ +#if ZEND_MM_CUSTOM + zend_mm_heap *_heap = (zend_mm_heap*)heap; + + if (heap->use_custom_heap) { + *_malloc = _heap->_malloc; + *_free = _heap->_free; + *_realloc = _heap->_realloc; + } else { + *_malloc = NULL; + *_free = NULL; + *_realloc = NULL; + } +#else + *_malloc = NULL; + *_free = NULL; + *_realloc = NULL; +#endif +} + ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap) { #if ZEND_MM_CUSTOM diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index d0226bd..c991895 100644 --- a/Zend/zend_alloc..h +++ b/Zend/zend_alloc.h @@ -259,6 +259,10 @@ ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap, void* (*_malloc)(size_t), void (*_free)(void*), void* (*_realloc)(void*, size_t)); +ZEND_API void zend_mm_get_custom_handlers(zend_mm_heap *heap, + void* (**_malloc)(size_t), + void (**_free)(void*), + void* (**_realloc)(void*, size_t)); typedef struct _zend_mm_storage zend_mm_storage;

« previous php.cvs (#82285) next »