Skip to content

Commit c20a97d

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed pefree_size (efree_size will be expaned to do {} while () form)
2 parents 33eb302 + 2139c2c commit c20a97d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Zend/zend_alloc.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,14 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
195195
#define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
196196
#define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
197197
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
198-
#define pefree_size(ptr, size, persistent) ((persistent)?free(ptr):efree_size(ptr, size))
198+
#define pefree_size(ptr, size, persistent) do { \
199+
if (persistent) { \
200+
free(ptr); \
201+
} else { \
202+
efree_size(ptr, size);\
203+
} \
204+
} while (0)
205+
199206
#define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
200207
#define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
201208
#define perealloc2(ptr, size, copy_size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc2((ptr), (size), (copy_size)))

0 commit comments

Comments
 (0)